Skip to content

Commit

Permalink
Properly set the BufferToTextureTargetMap in Blimp
Browse files Browse the repository at this point in the history
Make sure to set the texture target map properly.  This is temporary as
this code will be going away shortly.  Android (and the Linux client)
look like they only use GL_TEXTURE_2D for the map entries, so hard
coding that for the standalone app.

BUG=632418

Review-Url: https://codereview.chromium.org/2207453002
Cr-Commit-Position: refs/heads/master@{#409213}
  • Loading branch information
dtrainor authored and Commit bot committed Aug 2, 2016
1 parent 1b78a89 commit 5ea3a82
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions blimp/client/feature/compositor/blimp_compositor_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ cc::LayerTreeSettings* BlimpCompositorManager::GetLayerTreeSettings() {
GenerateLayerTreeSettings(settings_.get());
settings_
->abort_commit_before_output_surface_creation = false;
settings_->renderer_settings.buffer_to_texture_target_map =
BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap();
}

return settings_.get();
Expand Down
19 changes: 19 additions & 0 deletions blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h"

#include <GLES2/gl2.h>
#include <stddef.h>
#include <stdint.h>

Expand Down Expand Up @@ -101,6 +102,24 @@ BlimpGpuMemoryBufferManager::BlimpGpuMemoryBufferManager() {}

BlimpGpuMemoryBufferManager::~BlimpGpuMemoryBufferManager() {}

// static
cc::BufferToTextureTargetMap
BlimpGpuMemoryBufferManager::GetDefaultBufferToTextureTargetMap() {
cc::BufferToTextureTargetMap image_targets;
for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
++usage_idx) {
gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
for (int format_idx = 0;
format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
++format_idx) {
gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
image_targets.insert(cc::BufferToTextureTargetMap::value_type(
cc::BufferToTextureTargetKey(usage, format), GL_TEXTURE_2D));
}
}
return image_targets;
}

std::unique_ptr<gfx::GpuMemoryBuffer>
BlimpGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
const gfx::Size& size,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <memory>

#include "base/macros.h"
#include "cc/output/buffer_to_texture_target_map.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"

namespace blimp {
Expand All @@ -18,6 +19,8 @@ class BlimpGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
BlimpGpuMemoryBufferManager();
~BlimpGpuMemoryBufferManager() override;

static cc::BufferToTextureTargetMap GetDefaultBufferToTextureTargetMap();

// Overridden from gpu::GpuMemoryBufferManager:
std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
const gfx::Size& size,
Expand Down

0 comments on commit 5ea3a82

Please sign in to comment.