| Index: gpu/command_buffer/client/gles2_implementation.cc
|
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
|
| index 3fe999a05f7cd8530fc1636a00afcd516cf3aab1..f0003448aa7d850a3c9fb647e50a2768012222d8 100644
|
| --- a/gpu/command_buffer/client/gles2_implementation.cc
|
| +++ b/gpu/command_buffer/client/gles2_implementation.cc
|
| @@ -3948,8 +3948,10 @@ GLuint GLES2Implementation::InsertSyncPointCHROMIUM() {
|
| return gpu_control_->InsertSyncPoint();
|
| }
|
|
|
| -GLuint GLES2Implementation::CreateImageCHROMIUMHelper(
|
| - GLsizei width, GLsizei height, GLenum internalformat) {
|
| +GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width,
|
| + GLsizei height,
|
| + GLenum internalformat,
|
| + GLenum usage) {
|
| if (width <= 0) {
|
| SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "width <= 0");
|
| return 0;
|
| @@ -3963,9 +3965,23 @@ GLuint GLES2Implementation::CreateImageCHROMIUMHelper(
|
| // returned image_id has recently been in use with a different buffer.
|
| helper_->CommandBufferHelper::Flush();
|
|
|
| + gfx::GpuMemoryBuffer::Usage memory_usage;
|
| + switch (usage) {
|
| + case GL_READ_WRITE:
|
| + memory_usage = gfx::GpuMemoryBuffer::READ_WRITE;
|
| + break;
|
| + case GL_SCANOUT:
|
| + memory_usage = gfx::GpuMemoryBuffer::SCANOUT;
|
| + break;
|
| + default:
|
| + SetGLError(
|
| + GL_INVALID_ENUM, "glMapImageCHROMIUM", "invalid GPU access mode");
|
| + return 0;
|
| + }
|
| +
|
| // Create new buffer.
|
| GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer(
|
| - width, height, internalformat);
|
| + width, height, internalformat, memory_usage);
|
| if (buffer_id == 0) {
|
| SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "out of GPU memory.");
|
| return 0;
|
| @@ -3973,14 +3989,18 @@ GLuint GLES2Implementation::CreateImageCHROMIUMHelper(
|
| return buffer_id;
|
| }
|
|
|
| -GLuint GLES2Implementation::CreateImageCHROMIUM(
|
| - GLsizei width, GLsizei height, GLenum internalformat) {
|
| +GLuint GLES2Implementation::CreateImageCHROMIUM(GLsizei width,
|
| + GLsizei height,
|
| + GLenum internalformat,
|
| + GLenum usage) {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glCreateImageCHROMIUM("
|
| - << width << ", "
|
| - << height << ", "
|
| - << GLES2Util::GetStringTextureInternalFormat(internalformat) << ")");
|
| - GLuint image_id = CreateImageCHROMIUMHelper(width, height, internalformat);
|
| + GPU_CLIENT_LOG(
|
| + "[" << GetLogPrefix() << "] glCreateImageCHROMIUM(" << width << ", "
|
| + << height << ", "
|
| + << GLES2Util::GetStringTextureInternalFormat(internalformat) << ", "
|
| + << GLES2Util::GetStringTextureInternalFormat(usage) << ")");
|
| + GLuint image_id =
|
| + CreateImageCHROMIUMHelper(width, height, internalformat, usage);
|
| CheckGLError();
|
| return image_id;
|
| }
|
| @@ -4031,47 +4051,28 @@ void GLES2Implementation::UnmapImageCHROMIUM(GLuint image_id) {
|
| CheckGLError();
|
| }
|
|
|
| -void* GLES2Implementation::MapImageCHROMIUMHelper(GLuint image_id,
|
| - GLenum access) {
|
| +void* GLES2Implementation::MapImageCHROMIUMHelper(GLuint image_id) {
|
| gfx::GpuMemoryBuffer* gpu_buffer = gpu_memory_buffer_tracker_->GetBuffer(
|
| image_id);
|
| if (!gpu_buffer) {
|
| SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "invalid image");
|
| return NULL;
|
| }
|
| - gfx::GpuMemoryBuffer::AccessMode mode;
|
| - switch(access) {
|
| - case GL_WRITE_ONLY:
|
| - mode = gfx::GpuMemoryBuffer::WRITE_ONLY;
|
| - break;
|
| - case GL_READ_ONLY:
|
| - mode = gfx::GpuMemoryBuffer::READ_ONLY;
|
| - break;
|
| - case GL_READ_WRITE:
|
| - mode = gfx::GpuMemoryBuffer::READ_WRITE;
|
| - break;
|
| - default:
|
| - SetGLError(GL_INVALID_ENUM, "glMapImageCHROMIUM",
|
| - "invalid GPU access mode");
|
| - return NULL;
|
| - }
|
|
|
| if (gpu_buffer->IsMapped()) {
|
| SetGLError(GL_INVALID_OPERATION, "glMapImageCHROMIUM", "already mapped");
|
| return NULL;
|
| }
|
|
|
| - return gpu_buffer->Map(mode);
|
| + return gpu_buffer->Map();
|
| }
|
|
|
| -void* GLES2Implementation::MapImageCHROMIUM(
|
| - GLuint image_id, GLenum access) {
|
| +void* GLES2Implementation::MapImageCHROMIUM(GLuint image_id) {
|
| GPU_CLIENT_SINGLE_THREAD_CHECK();
|
| - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapImageCHROMIUM("
|
| - << image_id << ", "
|
| - << GLES2Util::GetStringEnum(access) << ")");
|
| + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glMapImageCHROMIUM(" << image_id
|
| + << ")");
|
|
|
| - void* mapped = MapImageCHROMIUMHelper(image_id, access);
|
| + void* mapped = MapImageCHROMIUMHelper(image_id);
|
| CheckGLError();
|
| return mapped;
|
| }
|
|
|