--- /dev/null
+extension ARB_depth_buffer_float
extension ARB_depth_texture
-# Deprecated and not particularly useful
+# We are ignoring most tokens in the extension and the remaining one was used
+# for other purposes in earlier versions
+gl:core_version 1.4
+gles2:core_version 3.0
+# Sized depth formats are better accessed through OES_required_internalformat
+ignore GL_DEPTH_COMPONENT16_ARB
+ignore GL_DEPTH_COMPONENT24_ARB
+ignore GL_DEPTH_COMPONENT32_ARB
+# Used to specify color channels to use when sampling depth textures where
+# color samples are expected; deprecated
ignore GL_DEPTH_TEXTURE_MODE_ARB
+# Texture component size queries are not available on OpenGL ES until 3.1
+ignore GL_TEXTURE_DEPTH_SIZE_ARB
extension ARB_fragment_shader
+# Fragment derivative functions are not available on OpenGL ES until 3.0; they
+# should be accessed through OES_standard_derivatives if needed
+ignore GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB
+# Maximum uniform component count queries are not available on OpenGL ES until
+# 3.0; similar queries for vector counts are available in 2.0
+ignore GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB
extension ARB_geometry_shader4
-# We use the version from EXT_texture_array
+# EXT_texture_array has an equivalent function and it more properly belongs
+# there
ignore glFramebufferTextureLayerARB
-# Not promoted to core
+# Binding a single face of a cube map array texture was not promoted to core
+# even with EXT_texture_cube_map_array
ignore glFramebufferTextureFaceARB
+# Stage-specific maximum varying component count queries were not promoted to
+# core; the more generic overall queries are deprecated too
ignore GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB
ignore GL_MAX_VERTEX_VARYING_COMPONENTS_ARB
-# Not promoted but required to support the extension flavor of geometry shaders
+# Program point size is always used in OpenGL ES
+optional GL_PROGRAM_POINT_SIZE_ARB
+# The core flavor allows different layer counts per attachment; keep the error
+# condition around in case we end up using the extension flavor
+optional GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB
+# In the core flavor input and output layouts are set in GLSL source; keep
+# these so we can support the extension flavor
optional GL_GEOMETRY_INPUT_TYPE_ARB
optional GL_GEOMETRY_OUTPUT_TYPE_ARB
optional GL_GEOMETRY_VERTICES_OUT_ARB
optional glProgramParameteriARB
-optional GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB
extension ARB_multitexture
+# OpenGL ES does not have fixed-function attributes
+ignore glMultiTexCoord1sARB
+ignore glMultiTexCoord1svARB
+ignore glMultiTexCoord1iARB
+ignore glMultiTexCoord1ivARB
+ignore glMultiTexCoord1fARB
+ignore glMultiTexCoord1fvARB
+ignore glMultiTexCoord1dARB
+ignore glMultiTexCoord1dvARB
+ignore glMultiTexCoord2sARB
+ignore glMultiTexCoord2svARB
+ignore glMultiTexCoord2iARB
+ignore glMultiTexCoord2ivARB
+ignore glMultiTexCoord2fARB
+ignore glMultiTexCoord2fvARB
+ignore glMultiTexCoord2dARB
+ignore glMultiTexCoord2dvARB
+ignore glMultiTexCoord3sARB
+ignore glMultiTexCoord3svARB
+ignore glMultiTexCoord3iARB
+ignore glMultiTexCoord3ivARB
+ignore glMultiTexCoord3fARB
+ignore glMultiTexCoord3fvARB
+ignore glMultiTexCoord3dARB
+ignore glMultiTexCoord3dvARB
+ignore glMultiTexCoord4sARB
+ignore glMultiTexCoord4svARB
+ignore glMultiTexCoord4iARB
+ignore glMultiTexCoord4ivARB
+ignore glMultiTexCoord4fARB
+ignore glMultiTexCoord4fvARB
+ignore glMultiTexCoord4dARB
+ignore glMultiTexCoord4dvARB
+# With shaders the newer GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is more
+# appropriate; keep the old constant for legacy support
+optional GL_MAX_TEXTURE_UNITS_ARB
+# Used to control legacy vertex arrays
+optional GL_CLIENT_ACTIVE_TEXTURE_ARB
+optional glClientActiveTextureARB
extension ARB_occlusion_query
+# OpenGL ES only has the unsigned version
+ignore glGetQueryObjectivARB
+# OpenGL ES only has GL_ANY_SAMPLES_PASSED, but on desktop OpenGL it
+# additionally requires the ARB_occlusion_query2 extension
+optional GL_SAMPLES_PASSED_ARB
+# Counter resolution query is not available on OpenGL ES
+ignore GL_QUERY_COUNTER_BITS_ARB
extension ARB_shader_objects
-# Not promoted to core
+# In the core flavor the current program is queried through the standard
+# glGetIntegerv interface
ignore glGetHandleARB
+# Only the integer version was promoted to core
ignore glGetObjectParameterfvARB
+# Since the unified objects idea was not promoted to core, these enums related
+# to object type queries are obsolete
+ignore GL_OBJECT_TYPE_ARB
ignore GL_PROGRAM_OBJECT_ARB
ignore GL_SHADER_OBJECT_ARB
-ignore GL_OBJECT_TYPE_ARB
ignore GL_OBJECT_SUBTYPE_ARB
-# Rectangular textures have their own extension
+# 1D textures are not available on OpenGL ES
+optional GL_SAMPLER_1D_ARB
+# Rectangular texture samplers additionally require ARB_texture_rectangle
optional GL_SAMPLER_2D_RECT_ARB
+# 3D texture samplers additionally require EXT_texture3D
+optional GL_SAMPLER_3D_ARB
+# Shadows samplers require the ARB_shadow extension in addition to texture type
+# specific extensions
+optional GL_SAMPLER_1D_SHADOW_ARB
+optional GL_SAMPLER_2D_SHADOW_ARB
optional GL_SAMPLER_2D_RECT_SHADOW_ARB
extension ARB_shadow
-# The name got changed in OpenGL 3.0; mark as optional to circumvent the
-# deprecation
+# The name is different in OpenGL 3.0 and OpenGL ES but semantics are
+# essentially the same; keep using the old name for now because the aliasing
+# is a bit hairy
optional GL_COMPARE_R_TO_TEXTURE_ARB
extension ARB_texture_cube_map
-# Deprecated; related to texture coordinate generation which we don't use
+# Texture coordinate generation is deprecated
ignore GL_NORMAL_MAP_ARB
ignore GL_REFLECTION_MAP_ARB
+# Proxy textures are not available on OpenGL ES
+ignore GL_PROXY_TEXTURE_CUBE_MAP_ARB
extension ARB_texture_float
+# Source extensions can't be detected properly on OpenGL ES because of the
+# complex relationships between format enums and the functions where they are
+# used; this set allows sized float formats for glTextureStorage
+gles2:source gles2.EXT_texture_storage
+gles2:source gles2.OES_texture_float
+gles2:source gles2.OES_texture_half_float
# Alpha, luminance and intensity formats were replaced with R and RG formats
ignore GL_ALPHA16F_ARB
ignore GL_LUMINANCE16F_ARB
ignore GL_INTENSITY32F_ARB
ignore GL_TEXTURE_LUMINANCE_TYPE_ARB
ignore GL_TEXTURE_INTENSITY_TYPE_ARB
+# Texture component type queries are not available on OpenGL ES until 3.1
+ignore GL_TEXTURE_RED_TYPE_ARB
+ignore GL_TEXTURE_GREEN_TYPE_ARB
+ignore GL_TEXTURE_BLUE_TYPE_ARB
+ignore GL_TEXTURE_ALPHA_TYPE_ARB
+ignore GL_TEXTURE_DEPTH_TYPE_ARB
extension ARB_texture_rg
+# OpenGL ES doesn't have 16-bit fixed-point formats
+ignore GL_R16
+ignore GL_RG16
extension ARB_texture_storage
+# 1D textures are not available on OpenGL ES
+optional glTexStorage1D
extension ARB_texture_swizzle
+# OpenGL ES can't set all swizzle values at once
+optional GL_TEXTURE_SWIZZLE_RGBA
+# Individual color enums are not available in any reasonable extension; they
+# were introduced to desktop OpenGL very early and to OpenGL ES in 3.0 together
+# with swizzling
+optional GL_GREEN
+optional GL_BLUE
extension ARB_uniform_buffer_object
+# For some reason it's not possible to query uniform block usage in geometry
+# shader on OpenGL ES even though similar queries are available for vertex and
+# fragment shaders
+ignore GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER
+# Querying just the uniform name is not available on OpenGL ES; fortunately
+# it's included in the information provided by glGetActiveUniform
+ignore glGetActiveUniformName
+# Queries related to geometry shaders additionally require the
+# ARB_geometry_shader4 extension
+optional GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS
+optional GL_MAX_GEOMETRY_UNIFORM_BLOCKS
extension ARB_vertex_buffer_object
-# Fixed-function arrays are deprecated and we don't query the bindings
+# Queries for fixed-function array buffer bindings are deprecated
ignore GL_COLOR_ARRAY_BUFFER_BINDING_ARB
ignore GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB
ignore GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB
ignore GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB
ignore GL_VERTEX_ARRAY_BUFFER_BINDING_ARB
ignore GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB
+# Buffer mapping has a separate extension on OpenGL ES; see OES_mapbuffer
+ignore glMapBufferARB
+ignore glUnmapBufferARB
+ignore GL_BUFFER_ACCESS_ARB
+ignore GL_BUFFER_MAPPED_ARB
+ignore GL_BUFFER_MAP_POINTER_ARB
+ignore glGetBufferPointervARB
+ignore GL_READ_ONLY_ARB
+ignore GL_WRITE_ONLY_ARB
+ignore GL_READ_WRITE_ARB
+# Buffer content readback is not supported on OpenGL ES
+ignore glGetBufferSubDataARB
+# OpenGL ES does not support copy and read usages before 3.0
+optional GL_DYNAMIC_COPY_ARB
+optional GL_DYNAMIC_READ_ARB
+optional GL_STATIC_COPY_ARB
+optional GL_STATIC_READ_ARB
+optional GL_STREAM_COPY_ARB
+optional GL_STREAM_READ_ARB
extension ARB_vertex_shader
-# Deprecated fixed-function interop tokens
+# Fixed-function interop enums are deprecated
ignore GL_MAX_TEXTURE_COORDS_ARB
ignore GL_VERTEX_PROGRAM_TWO_SIDE_ARB
+# OpenGL ES does not have the full range of data types
+ignore glVertexAttrib1sARB
+ignore glVertexAttrib1svARB
+ignore glVertexAttrib1dARB
+ignore glVertexAttrib1dvARB
+ignore glVertexAttrib2sARB
+ignore glVertexAttrib2svARB
+ignore glVertexAttrib2dARB
+ignore glVertexAttrib2dvARB
+ignore glVertexAttrib3sARB
+ignore glVertexAttrib3svARB
+ignore glVertexAttrib3dARB
+ignore glVertexAttrib3dvARB
+ignore glVertexAttrib4bvARB
+ignore glVertexAttrib4ubvARB
+ignore glVertexAttrib4sARB
+ignore glVertexAttrib4svARB
+ignore glVertexAttrib4usvARB
+ignore glVertexAttrib4ivARB
+ignore glVertexAttrib4uivARB
+ignore glVertexAttrib4dARB
+ignore glVertexAttrib4dvARB
+ignore glVertexAttrib4NbvARB
+ignore glVertexAttrib4NubARB
+ignore glVertexAttrib4NubvARB
+ignore glVertexAttrib4NivARB
+ignore glVertexAttrib4NsvARB
+ignore glVertexAttrib4NusvARB
+ignore glVertexAttrib4NivARB
+ignore glVertexAttrib4NuivARB
+ignore glGetVertexAttribdvARB
+# Program point size is always used in OpenGL ES
+optional GL_VERTEX_PROGRAM_POINT_SIZE_ARB
+# Queries for max varying component counts are deprecated
+ignore GL_MAX_VARYING_FLOATS_ARB
+# Maximum uniform component count queries were introduced to OpenGL ES in 3.0
+ignore GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB
extension EXT_blend_minmax
# Prevent autodetection of ARB_imaging as backport extension
-backport none
+gl:backport none
+# The source extension gets misdetected as OES_draw_buffer_indexed because it
+# uses the same enums and has higher preference
+gles2:source EXT_blend_minmax
extension EXT_blend_subtract
# Prevent autodetection of ARB_imaging as backport extension
-backport none
+gl:backport none
+# The source extension gets misdetected as OES_draw_buffer_indexed
+gles2:source none
extension EXT_framebuffer_object
-# Not promoted; keep them around for more accurate error checking
+# The core flavor allows attachments to have different sizes or formats; keep
+# these error codes around in case we encounter extension flavor framebuffers
optional GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
optional GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT
+# Changing the draw or read buffer is not available on OpenGL ES before 3.0 so
+# these errors don't exist
+optional GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
+optional GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
+# OpenGL ES has a more limited range of stencil formats
+ignore GL_STENCIL_INDEX1_EXT
+ignore GL_STENCIL_INDEX4_EXT
+ignore GL_STENCIL_INDEX16_EXT
+# 1D textures are not available on OpenGL ES
+optional glFramebufferTexture1DEXT
+# 2D array textures were introduced to OpenGL ES at the same time as 3D
+# textures, so the more generic glFramebufferTextureLayer should be used
+optional glFramebufferTexture3DEXT
+# Color attachments beyond 0 are not available on OpenGL ES before 3.0; access
+# through NV_fbo_color_attachments instead
+ignore GL_MAX_COLOR_ATTACHMENTS_EXT
+ignore GL_COLOR_ATTACHMENT1_EXT
+ignore GL_COLOR_ATTACHMENT2_EXT
+ignore GL_COLOR_ATTACHMENT3_EXT
+ignore GL_COLOR_ATTACHMENT4_EXT
+ignore GL_COLOR_ATTACHMENT5_EXT
+ignore GL_COLOR_ATTACHMENT6_EXT
+ignore GL_COLOR_ATTACHMENT7_EXT
+ignore GL_COLOR_ATTACHMENT8_EXT
+ignore GL_COLOR_ATTACHMENT9_EXT
+ignore GL_COLOR_ATTACHMENT10_EXT
+ignore GL_COLOR_ATTACHMENT11_EXT
+ignore GL_COLOR_ATTACHMENT12_EXT
+ignore GL_COLOR_ATTACHMENT13_EXT
+ignore GL_COLOR_ATTACHMENT14_EXT
+ignore GL_COLOR_ATTACHMENT15_EXT
+# The query for attached texture layer is not available on OpenGL ES before 3.0
+# due to the lack of appropriate texture types
+ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT
extension EXT_gpu_shader4
-# Buffer textures have their own extension
+# 1D textures are not available on OpenGL ES
+optional GL_SAMPLER_1D_ARRAY_EXT
+optional GL_SAMPLER_1D_ARRAY_SHADOW_EXT
+optional GL_INT_SAMPLER_1D_EXT
+optional GL_INT_SAMPLER_1D_ARRAY_EXT
+optional GL_UNSIGNED_INT_SAMPLER_1D_EXT
+optional GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT
+# Buffer texture samplers additionally require ARB_texture_buffer_object
optional GL_SAMPLER_BUFFER_EXT
optional GL_INT_SAMPLER_BUFFER_EXT
optional GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT
-# Ditto for rectangular textures
+# Rectangular texture samplers additionally require ARB_texture_rectangle
optional GL_INT_SAMPLER_2D_RECT_EXT
optional GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT
extension EXT_texture3D
+# Packing into a 3D subimage is not supported on OpenGL ES
+ignore GL_PACK_IMAGE_HEIGHT_EXT
+ignore GL_PACK_SKIP_IMAGES_EXT
+# Proxy textures are not available on OpenGL ES
+ignore GL_PROXY_TEXTURE_3D_EXT
+# Queries for texture dimensions were not introduced to OpenGL ES until 3.1
+ignore GL_TEXTURE_DEPTH_EXT
extension EXT_texture_array
-# We use the version from ARB_shadow
+# ARB_shadow has an equivalent enum and was introduced earlier
ignore GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT
+# 1D textures are not available on OpenGL ES
+optional GL_TEXTURE_1D_ARRAY_EXT
+optional GL_TEXTURE_BINDING_1D_ARRAY_EXT
+# Proxy textures are not available on OpenGL ES
+ignore GL_PROXY_TEXTURE_1D_ARRAY_EXT
+ignore GL_PROXY_TEXTURE_2D_ARRAY_EXT
extension EXT_texture_sRGB
+# The automatically detected source extensions are incorrect; EXT_sRGB provides
+# SRGB8_ALPHA8 only for renderbuffers while NV_sRGB_formats provides SRGB8 only
+# for immutable texture storage
+gles2:source none
+# Unsized sRGB internal formats are not available on OpenGL ES
+optional GL_SRGB_EXT
+optional GL_SRGB_ALPHA_EXT
# Specific compressed formats were not promoted to core
ignore GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
ignore GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
ignore GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
ignore GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
+# Generic compressed formats are not available on OpenGL ES
+ignore GL_COMPRESSED_SRGB_EXT
+ignore GL_COMPRESSED_SRGB_ALPHA_EXT
# Luminance formats are deprecated
ignore GL_COMPRESSED_SLUMINANCE_EXT
ignore GL_COMPRESSED_SLUMINANCE_ALPHA_EXT
--- /dev/null
+extension MSP_buffer_control
+optional glDrawBuffer
+++ /dev/null
-extension MSP_draw_buffer
+++ /dev/null
-extension MSP_sized_internal_formats
--- /dev/null
+extension gles2.NV_fbo_color_attachments
--- /dev/null
+extension gles2.OES_mapbuffer
+# Whole buffer mapping was not promoted to core in OpenGL ES
+optional glMapBufferOES
+# Because of the above, mapped access cannot be queried on OpenGL ES
+ignore GL_BUFFER_ACCESS_OES
+# Include the access mode enums for desktop OpenGL
+optional GL_READ_ONLY
+optional GL_WRITE_ONLY_OES
+optional GL_READ_WRITE
--- /dev/null
+extension gles2.OES_required_internalformat
+# Some formats were not promoted to core in OpenGL ES
+ignore GL_ALPHA8_OES
+ignore GL_LUMINANCE4_ALPHA4_OES
+ignore GL_LUMINANCE8_ALPHA8_OES
+ignore GL_LUMINANCE8_OES
+ignore GL_RGB10_EXT
+# 32-bit fixed point depth was not promoted to core in OpenGL ES; prefer
+# GL_DEPTH_COMPONENT32F from ARB_depth_buffer_float
+optional GL_DEPTH_COMPONENT32_OES
+# 5/6/5-bit RGB internal format additionally requires ARB_ES2_compatibility on
+# desktop OpenGL
+optional GL_RGB565_OES
+# Combined depth/stencil format additionally requires EXT_packed_depth_stencil
+# on desktop OpenGL
+optional GL_DEPTH24_STENCIL8_OES
--- /dev/null
+extension gles2.OES_texture_stencil8
<!-- The name got changed but as far as I can tell they mean the same
thing. -->
<enum value="0x8CD4" name="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT" alias="GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER"/>
+
+ <!-- Add an alias to improve desktop OpenGL compatibility even though
+ this was not promoted to core in OpenGL ES. -->
+ <enum value="0x81A7" name="GL_DEPTH_COMPONENT32_OES" alias="GL_DEPTH_COMPONENT32"/>
</enums>
<feature api="gl" name="GL_VERSION_1_4" number="1.4">
</require>
</feature>
+ <feature api="gles2">
+ <require>
+ <!-- Annotate support for certain things in OpenGL ES. Don't set
+ version because they are only available through extensions. -->
+ <enum name="GL_DEPTH_COMPONENT32"/>
+ <enum name="GL_BUFFER_ACCESS"/>
+ <command name="glBindFragDataLocation"/>
+ <command name="glMapBuffer"/>
+ </require>
+ </feature>
+
+ <feature api="gles2" name="GL_ES_VERSION_3_0" number="3.0">
+ <require>
+ <!-- These are found in the 3.0 spec. -->
+ <enum name="GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER"/>
+ <enum name="GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER"/>
+ </require>
+ </feature>
+
<extensions>
- <!-- Put GL_RED here for the benefit of OpenGL ES. -->
- <extension name="GL_ARB_texture_rg" supported="gl|glcore">
+ <extension name="GL_ARB_depth_texture" supported="gl">
<require>
- <enum name="GL_RED"/>
+ <!-- The base GL_DEPTH_COMPONENT format was introduced for
+ other purposes before it could be used for textures. -->
+ <enum name="GL_DEPTH_COMPONENT"/>
</require>
</extension>
- <!-- And the remaining color components here. -->
- <extension name="GL_ARB_texture_swizzle" supported="gl|glcore">
+ <extension name="GL_ARB_texture_rg" supported="gl|glcore">
<require>
- <enum name="GL_GREEN"/>
- <enum name="GL_BLUE"/>
- <enum name="GL_ALPHA"/>
+ <!-- GL_RED is mentioned in the extension spec. -->
+ <enum name="GL_RED"/>
</require>
</extension>
</extensions>
</extension>
<!-- OpenGL ES does not have glDrawBuffer. -->
- <extension name="GL_MSP_draw_buffer" supported="gl">
+ <extension name="GL_MSP_buffer_control" supported="gl">
<require>
<command name="glDrawBuffer" />
<command name="glReadBuffer" />
</require>
</extension>
- <!-- Sized internal formats were introduced in OpenGL ES 3.0, but are
- not available as an extension. -->
- <extension name="GL_MSP_sized_internal_formats" supported="gl|gles2">
- <require>
- <enum name="GL_RGB8" />
- <enum name="GL_RGBA8" />
- </require>
- </extension>
-
<!-- 1D textures are not available in OpenGL ES, but could conceivably
be added at a later date. -->
<extension name="GL_MSP_texture1D" supported="gl">
print "Looking for %d things in %d extensions"%(len(things), len(things_by_ext))
extensions = []
+ keep_exts = 0
+ base_version = None
+ recheck_base_version = True
missing = set(things)
- while missing and things_by_ext:
+ while 1:
+ if recheck_base_version:
+ max_version = Version(1, 0)
+ for t in missing:
+ supp = t.api_support.get(host_api.name)
+ if supp and supp.core_version and max_version:
+ max_version = max(max_version, supp.core_version)
+ else:
+ max_version = None
+
+ if max_version:
+ if not base_version or max_version<base_version:
+ base_version = max_version
+ keep_exts = len(extensions)
+ elif not base_version:
+ keep_exts = len(extensions)
+
+ recheck_base_version = False
+
+ if not missing or not things_by_ext:
+ break
+
largest_ext = None
largest_count = 0
for e, t in things_by_ext.iteritems():
extensions.append(largest_ext)
for t in things_by_ext[largest_ext]:
missing.remove(t)
- if not missing:
- break
+
+ supp = t.api_support.get(host_api.name)
+ if supp and supp.core_version==base_version:
+ recheck_base_version = True
del things_by_ext[largest_ext]
for e in things_by_ext.keys():
else:
del things_by_ext[e]
- if missing:
+ if not missing:
+ return None, extensions
+ elif base_version:
+ if debug:
+ print "Found remaining things in version %s"%base_version
+ if keep_exts<len(extensions):
+ print "Discarding %d extensions that do not improve base version"%(len(extensions)-keep_exts)
+ del extensions[keep_exts:]
+ return base_version, extensions
+ else:
if debug:
print "%d things still missing:"%len(missing)
for t in missing:
print " "+t.name
- return None
-
- return extensions
+ return None, None
class SourceGenerator:
self.core_version = detect_core_version(host_api, things, debug)
self.deprecated_version = detect_deprecated_version(host_api, things, debug)
self.backport_ext = detect_backport_extension(host_api, things);
- self.source_exts = detect_source_extension(host_api, things, debug)
+ b, e = detect_source_extension(host_api, things, debug)
+ self.base_version = b
+ self.source_exts = e
if not self.core_version and not self.backport_ext and not self.source_exts:
print "Warning: Not supportable on host API"
if self.backport_ext:
print "Backport %s"%self.backport_ext.name
if self.source_exts:
- print "Sources %s"%", ".join(e.name for e in self.source_exts)
+ names = [e.name for e in self.source_exts]
+ if self.base_version:
+ names.insert(0, "Version %s"%self.base_version)
+ print "Sources %s"%", ".join(names)
def write_header_intro(self, out):
out.write("#ifndef MSP_GL_%s_\n"%self.ext_name.upper())
out.write(", %r"%self.deprecated_version)
out.write("))\n\t{\n")
for f in self.funcs:
- supp = f.api_support[self.host_api.name]
- gpa_suffix = ""
- if supp.core_version is not None and supp.core_version<=Version(1, 1):
- gpa_suffix = "_1_1"
- out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS%s(%s));\n"%(f.name, self.func_typedefs[f.name], gpa_suffix, f.name))
+ supp = f.api_support.get(self.host_api.name)
+ if supp:
+ gpa_suffix = ""
+ if supp.core_version is not None and supp.core_version<=Version(1, 1):
+ gpa_suffix = "_1_1"
+ out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS%s(%s));\n"%(f.name, self.func_typedefs[f.name], gpa_suffix, f.name))
out.write("\t\treturn Extension::CORE;\n")
out.write("\t}\n")
out.write("#endif\n")
if self.source_exts:
out.write("#if !defined(__APPLE__) || defined(GL_%s)\n"%self.ext_name)
- out.write("\tif(%s)\n\t{\n"%" && ".join("is_supported(\"GL_%s\")"%s.name for s in self.source_exts))
+ out.write("\tif(")
+ if self.base_version:
+ out.write("is_supported(%r) && "%self.base_version)
+ out.write("%s)\n\t{\n"%" && ".join("is_supported(\"GL_%s\")"%s.name for s in self.source_exts))
for f in self.funcs:
- supp = f.api_support[self.host_api.name]
- if supp.sources:
- src = None
- for e in self.source_exts:
+ supp = f.api_support.get(self.host_api.name)
+ src = None
+ for e in self.source_exts:
+ if f in e.things:
+ src = f
+ elif supp:
for s in supp.sources:
if s.name in e.things:
src = s
break
- if src:
- break
- else:
- src = f
+ if src:
+ break
+ if not src and supp and supp.core_version and self.base_version>=supp.core_version:
+ sec = f
if src:
out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, self.func_typedefs[f.name], src.name))
self.core_version = None
self.deprecated_version = None
self.backport_ext = None
+ self.source_exts = []
self.ignore_things = []
self.optional_things = []
def parse(self, fn):
for line in open(fn):
line = line.strip()
- if line.startswith("#"):
+ if not line or line.startswith("#"):
continue
parts = line.split()
self.deprecated_version = Version(*map(int, parts[1].split('.')))
elif keyword=="backport":
self.backport_ext = parts[1]
+ elif keyword=="source":
+ self.source_exts.append(parts[1])
elif keyword=="ignore":
self.ignore_things.append(parts[1])
elif keyword=="optional":
generator.backport_ext = None
else:
generator.backport_ext = get_extension(xml_parser.apis, ext_parser.backport_ext)
+ if ext_parser.source_exts:
+ generator.base_version = None
+ if len(ext_parser.source_exts)==1 and ext_parser.source_exts[0]=="none":
+ generator.source_exts = []
+ else:
+ generator.source_exts = map((lambda e: get_extension(xml_parser.apis, e)), ext_parser.source_exts)
if debug:
generator.dump_info()
generator.write_header(out_base+".h")
}
else if(ARB_direct_state_access)
return glMapNamedBuffer(id, access);
- else
+ else if(OES_mapbuffer)
{
BindRestore _bind(this, type);
return glMapBuffer(type, access);
}
+ else
+ throw invalid_operation("Buffer::map");
}
bool Buffer::unmap()
#include <msp/gl/extensions/arb_pixel_buffer_object.h>
#include <msp/gl/extensions/arb_vertex_buffer_object.h>
#include <msp/gl/extensions/arb_uniform_buffer_object.h>
+#include <msp/gl/extensions/oes_mapbuffer.h>
namespace Msp {
namespace GL {
#include <msp/gl/extensions/ext_framebuffer_object.h>
#include <msp/gl/extensions/ext_texture_array.h>
#include <msp/gl/extensions/ext_texture3d.h>
-#include <msp/gl/extensions/msp_draw_buffer.h>
+#include <msp/gl/extensions/msp_buffer_control.h>
#include "error.h"
#include "framebuffer.h"
#include "misc.h"
{
if(ARB_draw_buffers)
glDrawBuffers(color_bufs.size(), &color_bufs[0]);
- else if(MSP_draw_buffer)
+ else if(MSP_buffer_control)
glDrawBuffer(first_buffer);
- if(MSP_draw_buffer)
+ if(MSP_buffer_control)
glReadBuffer(first_buffer);
}
}
#include "texturecube.h"
#include <msp/gl/extensions/ext_framebuffer_object.h>
#include <msp/gl/extensions/msp_stereo_rendering.h>
+#include <msp/gl/extensions/nv_fbo_color_attachments.h>
namespace Msp {
namespace GL {
case SLUMINANCE8_ALPHA8: return SLUMINANCE_ALPHA;
case DEPTH_COMPONENT16:
case DEPTH_COMPONENT24:
- case DEPTH_COMPONENT32: return DEPTH_COMPONENT;
+ case DEPTH_COMPONENT32:
+ case DEPTH_COMPONENT32F: return DEPTH_COMPONENT;
default: return pf;
}
}
case RG: return RG32F;
case RGB: return RGB32F;
case RGBA: return RGBA32F;
- case DEPTH_COMPONENT: return DEPTH_COMPONENT32;
+ case DEPTH_COMPONENT: return ARB_depth_buffer_float ? DEPTH_COMPONENT32F : DEPTH_COMPONENT32;
default: throw invalid_argument("get_sized_pixelformat");
}
default:
case RGB32F:
case RGBA32F:
case DEPTH_COMPONENT32:
+ case DEPTH_COMPONENT32F:
return 4;
default:
return 0;
void require_pixelformat(PixelFormat pf)
{
+ /* TODO These checks are only accurate for textures. On OpenGL ES some
+ formats are allowed for render buffers earlier than textures. In particular
+ it's possible to create a 16-bit depth renderbuffer on OpenGL ES 2.0 but
+ depth textures are only available with 3.0 or the OES_depth_texture
+ extension.*/
switch(pf)
{
+ case RGB8:
+ case RGBA8:
+ { static Require _req(OES_required_internalformat); }
+ break;
case RED:
case R8:
case RG:
{ static Require _req(EXT_bgra); }
break;
case DEPTH_COMPONENT:
+ { static Require _req(ARB_depth_texture); }
+ break;
case DEPTH_COMPONENT16:
case DEPTH_COMPONENT24:
case DEPTH_COMPONENT32:
{ static Require _req(ARB_depth_texture); }
+ { static Require _req(OES_required_internalformat); }
+ break;
+ case DEPTH_COMPONENT32F:
+ { static Require _req(ARB_depth_buffer_float); }
+ break;
+ case STENCIL_INDEX:
+ { static Require _req(OES_texture_stencil8); }
break;
default:
break;
#include <msp/graphics/pixelformat.h>
#include <msp/strings/lexicalcast.h>
#include "gl.h"
+#include <msp/gl/extensions/arb_depth_buffer_float.h>
#include <msp/gl/extensions/arb_depth_texture.h>
#include <msp/gl/extensions/arb_texture_float.h>
#include <msp/gl/extensions/arb_texture_rg.h>
#include <msp/gl/extensions/ext_bgra.h>
#include <msp/gl/extensions/ext_texture_srgb.h>
#include <msp/gl/extensions/msp_legacy_features.h>
-#include <msp/gl/extensions/msp_sized_internal_formats.h>
+#include <msp/gl/extensions/oes_required_internalformat.h>
+#include <msp/gl/extensions/oes_texture_stencil8.h>
namespace Msp {
namespace GL {
DEPTH_COMPONENT16 = GL_DEPTH_COMPONENT16,
DEPTH_COMPONENT24 = GL_DEPTH_COMPONENT24,
DEPTH_COMPONENT32 = GL_DEPTH_COMPONENT32,
+ DEPTH_COMPONENT32F = GL_DEPTH_COMPONENT32F,
RED = GL_RED,
RG = GL_RG,
RGB = GL_RGB,
if(count<0)
{
if(ARB_vertex_shader)
- count = get_i(GL_MAX_TEXTURE_IMAGE_UNITS);
+ count = get_i(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
else if(ARB_multitexture)
count = get_i(GL_MAX_TEXTURE_UNITS);
else