summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreveman <reveman@chromium.org>2014-10-02 12:01:03 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-02 19:01:50 +0000
commit32115e57190cc45b4914e70797189243f53fffe9 (patch)
treeb71c6a992a89571cdc32f95f9566906a38abc4b8
parent22851a415bff2a92fa24c2794ffc768188137a3c (diff)
downloadchromium_src-32115e57190cc45b4914e70797189243f53fffe9.zip
chromium_src-32115e57190cc45b4914e70797189243f53fffe9.tar.gz
chromium_src-32115e57190cc45b4914e70797189243f53fffe9.tar.bz2
gpu: Add CHROMIUM_gpu_memory_buffer_image extension.
Add initial implementation of CHROMIUM_gpu_memory_buffer_image. This extension will replace current usage of CHROMIUM_image and CHROMIUM_image will later become the more generic extension that can be used by clients that need more control over GpuMemoryBuffer instances. BUG=418553 Review URL: https://codereview.chromium.org/617693003 Cr-Commit-Position: refs/heads/master@{#297873}
-rw-r--r--gpu/GLES2/extensions/CHROMIUM/CHROMIUM_gpu_memory_buffer_image.txt66
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h2
-rw-r--r--gpu/GLES2/gl2extchromium.h45
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py25
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h12
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc98
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h5
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h7
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h4
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h11
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt1
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_autogen.h2
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h17
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_autogen.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h13
-rw-r--r--ui/gl/gl_bindings.h4
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_impl.cc8
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_impl.h8
21 files changed, 326 insertions, 16 deletions
diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_gpu_memory_buffer_image.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_gpu_memory_buffer_image.txt
new file mode 100644
index 0000000..9f4d09d
--- /dev/null
+++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_gpu_memory_buffer_image.txt
@@ -0,0 +1,66 @@
+Name
+
+ CHROMIUM_gpu_memory_buffer_image
+
+Name Strings
+
+ GL_CHROMIUM_gpu_memory_buffer_image
+
+Version
+
+ Last Modifed Date: Sep 29, 2014
+
+Dependencies
+
+ OpenGL ES 2.0 is required.
+
+ GL_CHROMIUM_image is required.
+
+Overview
+
+ This extension provide a mechanism for creating a GpuMemoryBuffer
+ backed image resource.
+
+Issues
+
+ None
+
+New Tokens
+
+ Accepted by the <usage> parameter of CreateGpuMemoryBufferImageCHROMIUM:
+
+ MAP_CHROMIUM 0x78F1
+ SCANOUT_CHROMIUM 0x78F2
+
+New Procedures and Functions
+
+ GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage)
+
+ Create a GpuMemoryBuffer backed image with width equal to <width>
+ and height equal to <height> and format equal to <internalformat>.
+
+ Returns a unique identifier for the image that could be used in
+ subsequent operations.
+
+ INVALID_VALUE is generated if <width> or <height> is nonpositive.
+
+ INVALID_ENUM is generated if <internalformat> is not one of
+ RGB or RGBA.
+
+ INVALID_ENUM is generated if <usage> is not one of
+ MAP_CHROMIUM or SCANOUT_CHROMIUM.
+
+Errors
+
+ None.
+
+New State
+
+ None.
+
+Revision History
+
+ 9/29/2014 Documented the extension.
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index e71c0f7..6080a04 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -206,6 +206,8 @@
#define glCreateImageCHROMIUM GLES2_GET_FUN(CreateImageCHROMIUM)
#define glDestroyImageCHROMIUM GLES2_GET_FUN(DestroyImageCHROMIUM)
#define glGetImageParameterivCHROMIUM GLES2_GET_FUN(GetImageParameterivCHROMIUM)
+#define glCreateGpuMemoryBufferImageCHROMIUM \
+ GLES2_GET_FUN(CreateGpuMemoryBufferImageCHROMIUM)
#define glGetTranslatedShaderSourceANGLE \
GLES2_GET_FUN(GetTranslatedShaderSourceANGLE)
#define glPostSubBufferCHROMIUM GLES2_GET_FUN(PostSubBufferCHROMIUM)
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h
index b5ab0cb..5199864 100644
--- a/gpu/GLES2/gl2extchromium.h
+++ b/gpu/GLES2/gl2extchromium.h
@@ -103,8 +103,8 @@ typedef GLboolean (GL_APIENTRY PFNGLUNMAPBUFFERCHROMIUM) (GLuint target);
#endif /* GL_CHROMIUM_pixel_transfer_buffer_object */
/* GL_CHROMIUM_image */
-#ifndef GL_CHROMIUM_map_image
-#define GL_CHROMIUM_map_image 1
+#ifndef GL_CHROMIUM_image
+#define GL_CHROMIUM_image 1
#ifndef GL_IMAGE_ROWBYTES_CHROMIUM
#define GL_IMAGE_ROWBYTES_CHROMIUM 0x78F0
@@ -132,16 +132,39 @@ GL_APICALL void GL_APIENTRY glUnmapImageCHROMIUM(GLuint image_id);
typedef GLuint(GL_APIENTRYP PFNGLCREATEIMAGECHROMIUMPROC)(
GLsizei width,
GLsizei height,
- GLenum internalformat);
+ GLenum internalformat,
+ GLenum usage);
typedef void (
- GL_APIENTRYP PFNGLDESTROYIMAGECHROMIUMPROC) (GLuint image_id);
-typedef void (
- GL_APIENTRYP PFNGLGETIMAGEPARAMETERIVCHROMIUMPROC) (
- GLuint image_id, GLenum pname, GLint* params);
-typedef void* (GL_APIENTRYP PFNGLMAPIMAGECHROMIUMPROC) (
- GLuint image_id, GLenum access);
-typedef void (GL_APIENTRYP PFNGLUNMAPIMAGECHROMIUMPROC) (GLuint image_id);
-#endif /* GL_CHROMIUM_map_image */
+ GL_APIENTRYP PFNGLDESTROYIMAGECHROMIUMPROC)(GLuint image_id);
+typedef void* (GL_APIENTRYP PFNGLMAPIMAGECHROMIUMPROC)(GLuint image_id);
+typedef void (GL_APIENTRYP PFNGLUNMAPIMAGECHROMIUMPROC)(GLuint image_id);
+#endif /* GL_CHROMIUM_image */
+
+ /* GL_CHROMIUM_gpu_memory_buffer_image */
+#ifndef GL_CHROMIUM_gpu_memory_buffer_image
+#define GL_CHROMIUM_gpu_memory_buffer_image 1
+
+#ifndef GL_MAP_CHROMIUM
+#define GL_MAP_CHROMIUM 0x78F1
+#endif
+
+#ifndef GL_SCANOUT_CHROMIUM
+#define GL_SCANOUT_CHROMIUM 0x78F2
+#endif
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage);
+#endif
+typedef GLuint(GL_APIENTRYP PFNGLCREATEGPUMEMORYBUFFERIMAGECHROMIUMPROC) (
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage);
+#endif /* GL_CHROMIUM_gpu_memory_buffer_image */
/* GL_CHROMIUM_map_sub */
#ifndef GL_CHROMIUM_map_sub
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 24ffa26..4da6951 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1181,6 +1181,20 @@ _NAMED_TYPE_INFO = {
'GL_RGBA8_OES',
],
},
+ 'ImageInternalFormat': {
+ 'type': 'GLenum',
+ 'valid': [
+ 'GL_RGB',
+ 'GL_RGBA',
+ ],
+ },
+ 'ImageUsage': {
+ 'type': 'GLenum',
+ 'valid': [
+ 'GL_MAP_CHROMIUM',
+ 'GL_SCANOUT_CHROMIUM'
+ ],
+ },
'VertexAttribType': {
'type': 'GLenum',
'valid': [
@@ -1494,6 +1508,17 @@ _FUNCTION_INFO = {
'extension': True,
'chromium': True,
},
+ 'CreateGpuMemoryBufferImageCHROMIUM': {
+ 'type': 'Manual',
+ 'cmd_args':
+ 'GLsizei width, GLsizei height, GLenum internalformat, GLenum usage',
+ 'result': ['GLuint'],
+ 'client_test': False,
+ 'gen_cmd': False,
+ 'expectation': False,
+ 'extension': True,
+ 'chromium': True,
+ },
'CreateProgram': {
'type': 'Create',
'client_test': False,
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index fac68f7..565e775 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -811,6 +811,13 @@ void GLES2GetImageParameterivCHROMIUM(GLuint image_id,
GLint* params) {
gles2::GetGLContext()->GetImageParameterivCHROMIUM(image_id, pname, params);
}
+GLuint GLES2CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) {
+ return gles2::GetGLContext()->CreateGpuMemoryBufferImageCHROMIUM(
+ width, height, internalformat, usage);
+}
void GLES2GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
@@ -1736,6 +1743,11 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glGetImageParameterivCHROMIUM),
},
{
+ "glCreateGpuMemoryBufferImageCHROMIUM",
+ reinterpret_cast<GLES2FunctionPointer>(
+ glCreateGpuMemoryBufferImageCHROMIUM),
+ },
+ {
"glGetTranslatedShaderSourceANGLE",
reinterpret_cast<GLES2FunctionPointer>(glGetTranslatedShaderSourceANGLE),
},
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 88e27de..bfd929a 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2210,10 +2210,8 @@ const GLubyte* GLES2Implementation::GetStringHelper(GLenum name) {
"GL_CHROMIUM_flipy "
"GL_EXT_unpack_subimage "
"GL_CHROMIUM_map_sub";
- if (capabilities_.image) {
- // The first space character is intentional.
- str += " GL_CHROMIUM_image";
- }
+ if (capabilities_.image)
+ str += " GL_CHROMIUM_image GL_CHROMIUM_gpu_memory_buffer_image";
if (capabilities_.future_sync_points)
str += " GL_CHROMIUM_future_sync_point";
break;
@@ -3997,6 +3995,30 @@ void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) {
gpu_control_->RetireSyncPoint(sync_point);
}
+namespace {
+
+bool ValidImageFormat(GLenum internalformat) {
+ switch (internalformat) {
+ case GL_RGB:
+ case GL_RGBA:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool ValidImageUsage(GLenum usage) {
+ switch (usage) {
+ case GL_MAP_CHROMIUM:
+ case GL_SCANOUT_CHROMIUM:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // namespace
+
GLuint GLES2Implementation::CreateImageCHROMIUMHelper(GLsizei width,
GLsizei height,
GLenum internalformat,
@@ -4149,6 +4171,74 @@ void GLES2Implementation::GetImageParameterivCHROMIUM(
CheckGLError();
}
+GLuint GLES2Implementation::CreateGpuMemoryBufferImageCHROMIUMHelper(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) {
+ if (width <= 0) {
+ SetGLError(
+ GL_INVALID_VALUE, "glCreateGpuMemoryBufferImageCHROMIUM", "width <= 0");
+ return 0;
+ }
+
+ if (height <= 0) {
+ SetGLError(GL_INVALID_VALUE,
+ "glCreateGpuMemoryBufferImageCHROMIUM",
+ "height <= 0");
+ return 0;
+ }
+
+ if (!ValidImageFormat(internalformat)) {
+ SetGLError(GL_INVALID_VALUE,
+ "glCreateGpuMemoryBufferImageCHROMIUM",
+ "invalid format");
+ return 0;
+ }
+
+ if (!ValidImageUsage(usage)) {
+ SetGLError(GL_INVALID_VALUE,
+ "glCreateGpuMemoryBufferImageCHROMIUM",
+ "invalid usage");
+ return 0;
+ }
+
+ // Flush the command stream to ensure ordering in case the newly
+ // returned image_id has recently been in use with a different buffer.
+ helper_->CommandBufferHelper::Flush();
+
+ // Create new buffer.
+ GLuint buffer_id = gpu_memory_buffer_tracker_->CreateBuffer(
+ width,
+ height,
+ internalformat == GL_RGBA ? GL_RGBA8_OES : GL_RGB8_OES,
+ usage);
+ if (buffer_id == 0) {
+ SetGLError(GL_OUT_OF_MEMORY,
+ "glCreateGpuMemoryBufferImageCHROMIUM",
+ "out of GPU memory");
+ return 0;
+ }
+ return buffer_id;
+}
+
+GLuint GLES2Implementation::CreateGpuMemoryBufferImageCHROMIUM(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix()
+ << "] glCreateGpuMemoryBufferImageCHROMIUM(" << width
+ << ", " << height << ", "
+ << GLES2Util::GetStringImageInternalFormat(internalformat)
+ << ", " << GLES2Util::GetStringImageUsage(usage) << ")");
+ GLuint image_id = CreateGpuMemoryBufferImageCHROMIUMHelper(
+ width, height, internalformat, usage);
+ CheckGLError();
+ return image_id;
+}
+
bool GLES2Implementation::ValidateSize(const char* func, GLsizeiptr size) {
if (size < 0) {
SetGLError(GL_INVALID_VALUE, func, "size < 0");
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index b9b2b34..ce0852a 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -552,6 +552,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation
void UnmapImageCHROMIUMHelper(GLuint image_id);
void GetImageParameterivCHROMIUMHelper(
GLuint image_id, GLenum pname, GLint* params);
+ GLuint CreateGpuMemoryBufferImageCHROMIUMHelper(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage);
// Helper for GetVertexAttrib
bool GetVertexAttribHelper(GLuint index, GLenum pname, uint32* param);
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 1d862ea..24c02f5 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -628,6 +628,11 @@ virtual void GetImageParameterivCHROMIUM(GLuint image_id,
GLenum pname,
GLint* params) OVERRIDE;
+virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) OVERRIDE;
+
virtual void GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 904fdc7..c64fdfc 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -421,6 +421,10 @@ virtual void DestroyImageCHROMIUM(GLuint image_id) = 0;
virtual void GetImageParameterivCHROMIUM(GLuint image_id,
GLenum pname,
GLint* params) = 0;
+virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) = 0;
virtual void GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 7754d19..16b7d60 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -452,6 +452,10 @@ virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE;
virtual void GetImageParameterivCHROMIUM(GLuint image_id,
GLenum pname,
GLint* params) OVERRIDE;
+virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) OVERRIDE;
virtual void GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index e549d6b..e1a07f6 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -737,6 +737,13 @@ void GLES2InterfaceStub::GetImageParameterivCHROMIUM(GLuint /* image_id */,
GLenum /* pname */,
GLint* /* params */) {
}
+GLuint GLES2InterfaceStub::CreateGpuMemoryBufferImageCHROMIUM(
+ GLsizei /* width */,
+ GLsizei /* height */,
+ GLenum /* internalformat */,
+ GLenum /* usage */) {
+ return 0;
+}
void GLES2InterfaceStub::GetTranslatedShaderSourceANGLE(GLuint /* shader */,
GLsizei /* bufsize */,
GLsizei* /* length */,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index 057cfd2..c297d78c 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -452,6 +452,10 @@ virtual void DestroyImageCHROMIUM(GLuint image_id) OVERRIDE;
virtual void GetImageParameterivCHROMIUM(GLuint image_id,
GLenum pname,
GLint* params) OVERRIDE;
+virtual GLuint CreateGpuMemoryBufferImageCHROMIUM(GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) OVERRIDE;
virtual void GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index 55b9d23..14d78c4 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -1290,6 +1290,17 @@ void GLES2TraceImplementation::GetImageParameterivCHROMIUM(GLuint image_id,
gl_->GetImageParameterivCHROMIUM(image_id, pname, params);
}
+GLuint GLES2TraceImplementation::CreateGpuMemoryBufferImageCHROMIUM(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage) {
+ TRACE_EVENT_BINARY_EFFICIENT0(
+ "gpu", "GLES2Trace::CreateGpuMemoryBufferImageCHROMIUM");
+ return gl_->CreateGpuMemoryBufferImageCHROMIUM(
+ width, height, internalformat, usage);
+}
+
void GLES2TraceImplementation::GetTranslatedShaderSourceANGLE(GLuint shader,
GLsizei bufsize,
GLsizei* length,
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index 7308e98..b329d20 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -195,6 +195,7 @@ GL_APICALL GLuint GL_APIENTRY glCreateStreamTextureCHROMIUM (GLuint textur
GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM (GLsizei width, GLsizei height, GLenum internalformat, GLenum usage);
GL_APICALL void GL_APIENTRY glDestroyImageCHROMIUM (GLuint image_id);
GL_APICALL void GL_APIENTRY glGetImageParameterivCHROMIUM (GLuint image_id, GLenum pname, GLint* params);
+GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM (GLsizei width, GLsizei height, GLenum internalformat, GLenum usage);
GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLidShader shader, GLsizeiNotNegative bufsize, GLsizeiOptional* length, char* source);
GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM (GLint x, GLint y, GLint width, GLint height);
GL_APICALL void GL_APIENTRY glTexImageIOSurface2DCHROMIUM (GLenumTextureBindTarget target, GLsizei width, GLsizei height, GLuint ioSurfaceId, GLuint plane);
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_autogen.h
index 25556b2..1871201 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_autogen.h
@@ -32,6 +32,8 @@ static std::string GetStringGetMaxIndexType(uint32_t value);
static std::string GetStringGetTexParamTarget(uint32_t value);
static std::string GetStringHintMode(uint32_t value);
static std::string GetStringHintTarget(uint32_t value);
+static std::string GetStringImageInternalFormat(uint32_t value);
+static std::string GetStringImageUsage(uint32_t value);
static std::string GetStringIndexType(uint32_t value);
static std::string GetStringMatrixMode(uint32_t value);
static std::string GetStringPixelStore(uint32_t value);
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
index d9bccac..c5bbc54 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -3467,6 +3467,23 @@ std::string GLES2Util::GetStringHintTarget(uint32_t value) {
string_table, arraysize(string_table), value);
}
+std::string GLES2Util::GetStringImageInternalFormat(uint32_t value) {
+ static const EnumToString string_table[] = {
+ {GL_RGB, "GL_RGB"}, {GL_RGBA, "GL_RGBA"},
+ };
+ return GLES2Util::GetQualifiedEnumString(
+ string_table, arraysize(string_table), value);
+}
+
+std::string GLES2Util::GetStringImageUsage(uint32_t value) {
+ static const EnumToString string_table[] = {
+ {GL_MAP_CHROMIUM, "GL_MAP_CHROMIUM"},
+ {GL_SCANOUT_CHROMIUM, "GL_SCANOUT_CHROMIUM"},
+ };
+ return GLES2Util::GetQualifiedEnumString(
+ string_table, arraysize(string_table), value);
+}
+
std::string GLES2Util::GetStringIndexType(uint32_t value) {
static const EnumToString string_table[] = {
{GL_UNSIGNED_BYTE, "GL_UNSIGNED_BYTE"},
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_autogen.h
index 8241898..de84037 100644
--- a/gpu/command_buffer/service/gles2_cmd_validation_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_validation_autogen.h
@@ -32,6 +32,8 @@ ValueValidator<GLenum> get_max_index_type;
ValueValidator<GLenum> get_tex_param_target;
ValueValidator<GLenum> hint_mode;
ValueValidator<GLenum> hint_target;
+ValueValidator<GLenum> image_internal_format;
+ValueValidator<GLenum> image_usage;
ValueValidator<GLenum> index_type;
ValueValidator<GLenum> matrix_mode;
ValueValidator<GLenum> pixel_store;
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
index 5d5660e..790b9b3 100644
--- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
@@ -237,6 +237,16 @@ static const GLenum valid_hint_target_table[] = {
GL_GENERATE_MIPMAP_HINT,
};
+static const GLenum valid_image_internal_format_table[] = {
+ GL_RGB,
+ GL_RGBA,
+};
+
+static const GLenum valid_image_usage_table[] = {
+ GL_MAP_CHROMIUM,
+ GL_SCANOUT_CHROMIUM,
+};
+
static const GLenum valid_index_type_table[] = {
GL_UNSIGNED_BYTE,
GL_UNSIGNED_SHORT,
@@ -544,6 +554,9 @@ Validators::Validators()
arraysize(valid_get_tex_param_target_table)),
hint_mode(valid_hint_mode_table, arraysize(valid_hint_mode_table)),
hint_target(valid_hint_target_table, arraysize(valid_hint_target_table)),
+ image_internal_format(valid_image_internal_format_table,
+ arraysize(valid_image_internal_format_table)),
+ image_usage(valid_image_usage_table, arraysize(valid_image_usage_table)),
index_type(valid_index_type_table, arraysize(valid_index_type_table)),
matrix_mode(valid_matrix_mode_table, arraysize(valid_matrix_mode_table)),
pixel_store(valid_pixel_store_table, arraysize(valid_pixel_store_table)),
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h
index aae35b7..18dc6e6 100644
--- a/ui/gl/gl_bindings.h
+++ b/ui/gl/gl_bindings.h
@@ -136,6 +136,10 @@
#define GL_IMAGE_MAP_CHROMIUM 0x78F1
#define GL_IMAGE_SCANOUT_CHROMIUM 0x78F2
+// GL_CHROMIUM_gpu_memory_buffer_image
+#define GL_MAP_CHROMIUM 0x78F1
+#define GL_SCANOUT_CHROMIUM 0x78F2
+
// GL_CHROMIUM_schedule_overlay_plane
#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.cc b/webkit/common/gpu/webgraphicscontext3d_impl.cc
index 012d487..9e1606a 100644
--- a/webkit/common/gpu/webgraphicscontext3d_impl.cc
+++ b/webkit/common/gpu/webgraphicscontext3d_impl.cc
@@ -928,6 +928,14 @@ DELEGATE_TO_GL_1R(mapImageCHROMIUM, MapImageCHROMIUM, WGC3Duint, void*);
DELEGATE_TO_GL_1(unmapImageCHROMIUM, UnmapImageCHROMIUM, WGC3Duint);
+DELEGATE_TO_GL_4R(createGpuMemoryBufferImageCHROMIUM,
+ CreateGpuMemoryBufferImageCHROMIUM,
+ WGC3Dsizei,
+ WGC3Dsizei,
+ WGC3Denum,
+ WGC3Denum,
+ WGC3Duint);
+
DELEGATE_TO_GL_6(framebufferTexture2DMultisampleEXT,
FramebufferTexture2DMultisampleEXT,
WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint, WGC3Dsizei)
diff --git a/webkit/common/gpu/webgraphicscontext3d_impl.h b/webkit/common/gpu/webgraphicscontext3d_impl.h
index 64bf552..826bac3 100644
--- a/webkit/common/gpu/webgraphicscontext3d_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_impl.h
@@ -534,7 +534,7 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl
WGC3Denum type, WGC3Dintptr offset, WGC3Dsizei primcount);
virtual void vertexAttribDivisorANGLE(WGC3Duint index, WGC3Duint divisor);
- // GL_CHROMIUM_map_image
+ // GL_CHROMIUM_image
virtual WGC3Duint createImageCHROMIUM(WGC3Dsizei width,
WGC3Dsizei height,
WGC3Denum internalformat,
@@ -545,6 +545,12 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl
virtual void* mapImageCHROMIUM(WGC3Duint image_id);
virtual void unmapImageCHROMIUM(WGC3Duint image_id);
+ // GL_CHROMIUM_gpu_memory_buffer_image
+ virtual WGC3Duint createGpuMemoryBufferImageCHROMIUM(WGC3Dsizei width,
+ WGC3Dsizei height,
+ WGC3Denum internalformat,
+ WGC3Denum usage);
+
// GL_EXT_multisampled_render_to_texture
virtual void framebufferTexture2DMultisampleEXT(WGC3Denum target,
WGC3Denum attachment,