Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ac8ed347655ba0561feebaa81cd2c0af234787b1..6d5edd230ebf2e038fa7342f310c03639c4ad51a 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -3949,8 +3949,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;
@@ -3966,7 +3968,7 @@ GLuint GLES2Implementation::CreateImageCHROMIUMHelper(
// Create new buffer.
GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer(
- width, height, internalformat);
+ width, height, internalformat, usage);
if (buffer_id == 0) {
SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "out of GPU memory.");
return 0;
@@ -3974,14 +3976,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;
}
@@ -4032,47 +4038,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;
}
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698