Index: gpu/command_buffer/build_gles2_cmd_buffer.py |
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py |
index 9babf735c5b20b1bbf13406af2be8a301303c93d..99acbc40cefc5ce812c42f17719c5da823373c40 100755 |
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py |
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py |
@@ -2313,6 +2313,197 @@ _FUNCTION_INFO = { |
} |
+_CHROMIUM_SPECIFIC_CONSTANTS = { |
+ 'GL_CONTEXT_LOST': '0x300E', # TODO(gman): What value? |
+} |
+ |
+ |
+_CHROMIUM_SPECIFIC_EXTENSIONS = { |
+ 'GL_EXT_framebuffer_multisample': { |
+ 'constants': { |
+ 'GL_DRAW_FRAMEBUFFER_BINDING': '0x8CA6', |
+ 'GL_DRAW_FRAMEBUFFER_BINDING_EXT': 'GL_DRAW_FRAMEBUFFER_BINDING', |
+ 'GL_FRAMEBUFFER_BINDING': '0x8CA6', |
+ 'GL_FRAMEBUFFER_BINDING_EXT': 'GL_FRAMEBUFFER_BINDING', |
+ 'GL_RENDERBUFFER_BINDING': '0x8CA7', |
+ 'GL_RENDERBUFFER_BINDING_EXT': 'GL_RENDERBUFFER_BINDING', |
+ 'GL_READ_FRAMEBUFFER': '0x8CA8', |
+ 'GL_READ_FRAMEBUFFER_EXT': 'GL_READ_FRAMEBUFFER', |
+ 'GL_DRAW_FRAMEBUFFER': '0x8CA9', |
+ 'GL_DRAW_FRAMEBUFFER_EXT': 'GL_DRAW_FRAMEBUFFER', |
+ 'GL_READ_FRAMEBUFFER_BINDING': '0x8CAA', |
+ 'GL_READ_FRAMEBUFFER_BINDING_EXT': 'GL_READ_FRAMEBUFFER_BINDING', |
+ 'GL_RENDERBUFFER_SAMPLES': '0x8CAB', |
+ 'GL_RENDERBUFFER_SAMPLES_EXT': 'GL_RENDERBUFFER_SAMPLES', |
+ 'GL_MAX_SAMPLES': '0x8D57', |
+ 'GL_MAX_SAMPLES_EXT': 'GL_MAX_SAMPLES', |
+ 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE': '0x8D56', |
+ 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT': |
+ 'GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE', |
+ }, |
+ }, |
+ 'GL_EXT_framebuffer_blit': { |
+ 'functions': [ |
+ 'BlitFramebufferEXT', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_map_sub': { |
+ 'constants': { |
+ 'GL_READ_ONLY': '0x88B8', |
+ 'GL_WRITE_ONLY': '0x88B9', |
+ }, |
+ 'functions': [ |
+ 'MapBufferSubDataCHROMIUM', |
+ 'UnmapBufferSubDataCHROMIUM', |
+ 'MapTexSubImage2DCHROMIUM', |
+ 'UnmapTexSubImage2DCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_resize': { |
+ 'functions': [ |
+ 'ResizeCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_request_extension': { |
+ 'functions': [ |
+ 'GetRequestableExtensionsCHROMIUM', |
+ 'RequestExtensionCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_rate_limit_offscreen_context': { |
+ 'functions': [ |
+ 'RateLimitOffscreenContextCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_get_multiple': { |
+ 'functions': [ |
+ 'GetMultipleIntegervCHROMIUM', |
+ 'GetProgramInfoCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_flipy': { |
+ 'constants': { |
+ 'GL_UNPACK_FLIP_Y_CHROMIUM': '0x9240', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_texture_compression_dxt3': { |
+ 'constants': { |
+ 'GL_COMPRESSED_RGBA_S3TC_DXT3_EXT': '0x83F2', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_texture_compression_dxt5': { |
+ 'constants': { |
+ 'GL_COMPRESSED_RGBA_S3TC_DXT5_EXT': '0x83F3', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_enable_feature': { |
+ 'functions': [ |
+ 'EnableFeatureCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_post_sub_buffer': { |
+ 'functions': [ |
+ 'PostSubBufferCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_front_buffer_cached': { |
+ }, |
+ 'GL_CHROMIUM_gpu_memory_manager': { |
+ 'constants': { |
+ 'GL_TEXTURE_POOL_CHROMIUM': '0x6000', |
+ 'GL_TEXTURE_POOL_MANAGED_CHROMIUM': '0x6001', |
+ 'GL_TEXTURE_POOL_UNMANAGED_CHROMIUM': '0x6002', |
+ }, |
+ }, |
+ 'GL_ARB_robustness': { |
+ 'constants': { |
+ 'GL_GUILTY_CONTEXT_RESET_ARB': '0x8253', |
+ 'GL_INNOCENT_CONTEXT_RESET_ARB': '0x8254', |
+ 'GL_UNKNOWN_CONTEXT_RESET_ARB': '0x8255', |
+ }, |
+ }, |
+ 'GL_ARB_texture_rectangle': { |
+ 'constants': { |
+ 'GL_TEXTURE_RECTANGLE_ARB': '0x84F5', |
+ 'GL_TEXTURE_BINDING_RECTANGLE_ARB': '0x84F6', |
+ 'GL_SAMPLER_2D_RECT_ARB': '0x8B63', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_iosurface': { |
+ 'functions': [ |
+ 'TexImageIOSurface2DCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_copy_texture': { |
+ 'constants': { |
+ 'GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM': '0x9241', |
+ 'GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM': '0x9242', |
+ 'GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM': '0x9243', |
+ }, |
+ 'functions': [ |
+ 'CopyTextureCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_command_buffer_query': { |
+ 'constants': { |
+ # TODO(gman): Get official numbers for these constants. |
+ 'GL_COMMANDS_ISSUED_CHROMIUM': '0x84F2', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_get_error_query': { |
+ 'constants': { |
+ # TODO(gman): Get official numbers for these constants. |
+ 'GL_GET_ERROR_QUERY_CHROMIUM': '0x84F3', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_command_buffer_latency_query': { |
+ 'constants': { |
+ # TODO(gman): Get official numbers for these constants. |
+ 'GL_LATENCY_QUERY_CHROMIUM': '0x84F4', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_texture_mailbox': { |
+ 'constants': { |
+ 'GL_MAILBOX_SIZE_CHROMIUM': '64', |
+ }, |
+ 'functions': [ |
+ 'GenMailboxCHROMIUM', |
+ 'ProduceTextureCHROMIUM', |
+ 'ConsumeTextureCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_bind_uniform_location': { |
+ 'functions': [ |
+ 'BindUniformLocationCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_texture_from_image': { |
+ 'functions': [ |
+ 'BindTexImage2DCHROMIUM', |
+ 'ReleaseTexImage2DCHROMIUM', |
+ ], |
+ }, |
+ 'GL_CHROMIUM_pixel_transfer_buffer_object': { |
+ 'constants': { |
+ # TODO(reveman): Get official numbers for these constants. |
+ 'GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM': '0x88EC', |
+ 'GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM': '0x88EF', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_async_pixel_transfers': { |
+ 'constants': { |
+ # TODO(reveman): Get official numbers for these constants. |
+ 'GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM': '0x84F5', |
+ }, |
+ }, |
+ 'GL_CHROMIUM_lose_context': { |
+ 'functions': [ |
+ 'LoseContextCHROMIUM', |
+ ], |
+ }, |
+} |
+ |
+ |
def Grouper(n, iterable, fillvalue=None): |
"""Collect data into fixed-length chunks or blocks""" |
args = [iter(iterable)] * n |
@@ -7081,11 +7272,17 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() { |
"""Writes the GLES2 header.""" |
file = CHeaderWriter( |
filename, |
- "// Because we are using both the real system GL and our own.\n" |
- "// emulated GL we need to use different names to avoid conflicts.\n" |
- "\n") |
+ "// This file contains Chromium-specific GLES2 declarations.\n\n") |
+ |
+ file.Write("#include <GLES2/gl2platform.h>\n") |
- file.Write("""#if defined(GLES2_USE_CPP_BINDINGS) |
+ for name, value in _CHROMIUM_SPECIFIC_CONSTANTS.iteritems(): |
+ file.Write("#define %s %s\n" % (name, value)) |
+ |
+ file.Write(""" |
+// Because we are using both the real system GL and our own |
+// emulated GL we need to use different names to avoid conflicts. |
+#if defined(GLES2_USE_CPP_BINDINGS) |
#define GLES2_GET_FUN(name) gles2::GetGLContext()->name |
#else |
#define GLES2_GET_FUN(name) GLES2 ## name |
@@ -7099,6 +7296,62 @@ void GLES2DecoderTestBase::SetupInitStateExpectations() { |
file.Write("\n") |
file.Close() |
+ def WriteGLES2ExtHeader(self, filename): |
+ """Writes the GLES2 extensions header.""" |
+ file = CHeaderWriter( |
+ filename, |
+ "// This file contains Chromium-specific " |
+ "GLES2 extensions declarations.\n\n") |
+ |
+ file.Write("#include <GLES2/gl2chromium.h>\n") |
+ file.Write("""#ifdef __cplusplus |
+extern "C" { |
+#endif |
+""") |
+ |
+ for ext_name, ext_dict in _CHROMIUM_SPECIFIC_EXTENSIONS.iteritems(): |
+ file.Write(""" |
+/* %(name)s */ |
+#ifndef %(name)s |
+#define %(name)s 1 |
+""" % {'name' : ext_name}) |
+ for name, value in ext_dict.get('constants', {}).iteritems(): |
+ file.Write(""" |
+#ifndef %(name)s |
+#define %(name)s %(value)s |
+#endif |
+""" % {'name': name, 'value': value}) |
+ |
+ for name in ext_dict.get('functions', []): |
+ found = False |
+ for function in self.original_functions: |
+ if function.name != name: |
+ continue |
+ file.Write("#ifdef GL_GLEXT_PROTOTYPES\n") |
+ file.Write("GL_APICALL %s GL_APIENTRY gl%s(%s);\n" % ( |
+ function.return_type, |
+ function.name, |
+ function.MakeTypedOriginalArgString(prefix=''))) |
+ file.Write("#endif\n") |
+ file.Write("typedef %s (GL_APIENTRYP %s) (%s);\n" % ( |
+ function.return_type, |
+ 'PFNGL%sPROC' % function.name.upper(), |
+ function.MakeTypedOriginalArgString(prefix=''))) |
+ found = True |
+ break |
+ if not found: |
+ self.Error("Function '%s' not found." % name) |
+ |
+ file.Write("#endif /* %s */\n" % ext_name) |
+ |
+ file.Write("""#ifdef __cplusplus |
+} |
+#endif |
+""") |
+ |
+ file.Write("\n") |
+ file.Close() |
+ |
def WriteGLES2CLibImplementation(self, filename): |
"""Writes the GLES2 c lib implementation.""" |
file = CHeaderWriter( |
@@ -7240,7 +7493,9 @@ NameToFunc g_gles2_function_table[] = { |
enum_re = re.compile(r'\#define\s+(GL_[a-zA-Z0-9_]+)\s+([0-9A-Fa-fx]+)') |
dict = {} |
for fname in ['../../third_party/khronos/GLES2/gl2.h', |
- '../../third_party/khronos/GLES2/gl2ext.h']: |
+ '../../third_party/khronos/GLES2/gl2ext.h', |
+ '../../gpu/GLES2/gl2chromium.h', |
+ '../../gpu/GLES2/gl2extchromium.h']: |
lines = open(fname).readlines() |
for line in lines: |
m = enum_re.match(line) |
@@ -7578,6 +7833,7 @@ def main(argv): |
gen.WriteCommonUtilsHeader("common/gles2_cmd_utils_autogen.h") |
gen.WriteCommonUtilsImpl("common/gles2_cmd_utils_implementation_autogen.h") |
gen.WriteGLES2Header("../GLES2/gl2chromium.h") |
+ gen.WriteGLES2ExtHeader("../GLES2/gl2extchromium.h") |
if gen.errors > 0: |
print "%d errors" % gen.errors |