mesa: Implement and advertise GL_MESA_sampler_objects
This is the GLES3 sampler object API trivially backported to GLES2, because it allows for simpler/better support in glamor and mutter. The only code change we need is adding these to the generated dispatch tables for ES2 contexts. The interactions with EXT_shadow_samplers, EXT_texture_filter_anisotropic and EXT_texture_sRGB_decode are already in place before this change, and OES_texture_border_clamp is always supported in Mesa. Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2440>
This commit is contained in:
105
docs/_extra/specs/MESA_sampler_objects.spec
Normal file
105
docs/_extra/specs/MESA_sampler_objects.spec
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
Name
|
||||||
|
|
||||||
|
MESA_sampler_objects
|
||||||
|
|
||||||
|
Name Strings
|
||||||
|
|
||||||
|
GL_MESA_sampler_objects
|
||||||
|
|
||||||
|
Contact
|
||||||
|
|
||||||
|
Adam Jackson <ajax@redhat.com>
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
|
||||||
|
Emma Anholt
|
||||||
|
The contributors to ARB_sampler_objects and OpenGL ES 3
|
||||||
|
|
||||||
|
Status
|
||||||
|
|
||||||
|
Shipping
|
||||||
|
|
||||||
|
Version
|
||||||
|
|
||||||
|
Last Modified Date: 14 Sep 2021
|
||||||
|
Author Revision: 3
|
||||||
|
|
||||||
|
Number
|
||||||
|
|
||||||
|
TBD
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
|
||||||
|
OpenGL ES 2.0 is required.
|
||||||
|
|
||||||
|
This extension interacts with:
|
||||||
|
- EXT_shadow_samplers
|
||||||
|
- EXT_texture_filter_anisotropic
|
||||||
|
- EXT_texture_sRGB_decode
|
||||||
|
- OES_texture_border_clamp
|
||||||
|
|
||||||
|
Overview
|
||||||
|
|
||||||
|
This extension makes the sampler object subset of OpenGL ES 3.0 available
|
||||||
|
in OpenGL ES 2.0 contexts. As the intent is to allow access to the API
|
||||||
|
without necessarily requiring additional renderer functionality, some
|
||||||
|
sampler state that would be mandatory in GLES 3 is dependent on the
|
||||||
|
presence of additional extensions. Under GLES 3.0 or above this extension's
|
||||||
|
name string may be exposed for compatibility, but it is otherwise without
|
||||||
|
effect.
|
||||||
|
|
||||||
|
Refer to the OpenGL ES 3.0 specification for API details not covered here.
|
||||||
|
|
||||||
|
New Procedures and Functions
|
||||||
|
|
||||||
|
void glGenSamplers (GLsizei count, GLuint *samplers);
|
||||||
|
void glDeleteSamplers (GLsizei count, const GLuint *samplers);
|
||||||
|
GLboolean glIsSampler (GLuint sampler);
|
||||||
|
void glBindSampler (GLuint unit, GLuint sampler);
|
||||||
|
void glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
|
||||||
|
void glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
|
||||||
|
void glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
|
||||||
|
void glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
|
||||||
|
void glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
|
||||||
|
void glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
|
||||||
|
|
||||||
|
Note that these names are exactly as in ES3, with no MESA suffix.
|
||||||
|
|
||||||
|
New Tokens
|
||||||
|
|
||||||
|
SAMPLER_BINDING 0x8919
|
||||||
|
|
||||||
|
Interactions
|
||||||
|
|
||||||
|
If EXT_shadow_samplers is not supported then TEXTURE_COMPARE_MODE and
|
||||||
|
TEXTURE_COMPARE_FUNC will generate INVALID_ENUM.
|
||||||
|
|
||||||
|
If EXT_texture_filter_anisotropic is not supported then
|
||||||
|
TEXTURE_MAX_ANISOTROPY_EXT will generate INVALID_ENUM.
|
||||||
|
|
||||||
|
If EXT_texture_sRGB_decode is not supported then TEXTURE_SRGB_DECODE_EXT
|
||||||
|
will generate INVALID_ENUM.
|
||||||
|
|
||||||
|
If OES_texture_border_clamp is not supported then TEXTURE_BORDER_COLOR
|
||||||
|
will generate INVALID_ENUM.
|
||||||
|
|
||||||
|
Issues
|
||||||
|
|
||||||
|
1) Why bother?
|
||||||
|
|
||||||
|
Sampler objects, at least in Mesa, are generically supported without any
|
||||||
|
driver-dependent requirements, so enabling this is essentially free. This
|
||||||
|
simplifies application support for otherwise GLES2 hardware, and for
|
||||||
|
drivers in development that haven't yet achieved GLES3.
|
||||||
|
|
||||||
|
Revision History
|
||||||
|
|
||||||
|
Rev. Date Author Changes
|
||||||
|
---- -------- -------- ---------------------------------------------
|
||||||
|
1 2019/10/22 ajax Initial revision
|
||||||
|
2 2019/11/14 ajax Add extension interactions:
|
||||||
|
- EXT_shadow_samplers
|
||||||
|
- EXT_texture_filter_anisotropic
|
||||||
|
- EXT_texture_sRGB_decode
|
||||||
|
- OES_texture_border_clamp
|
||||||
|
3 2021/09/14 ajax Expand the justification and ES3 interaction
|
@@ -7,45 +7,45 @@
|
|||||||
|
|
||||||
<category name="GL_ARB_sampler_objects" number="81">
|
<category name="GL_ARB_sampler_objects" number="81">
|
||||||
|
|
||||||
<function name="GenSamplers" es2="3.0" no_error="true">
|
<function name="GenSamplers" es2="2.0" no_error="true">
|
||||||
<param name="count" type="GLsizei"/>
|
<param name="count" type="GLsizei"/>
|
||||||
<param name="samplers" type="GLuint *"/>
|
<param name="samplers" type="GLuint *"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="DeleteSamplers" es2="3.0" no_error="true">
|
<function name="DeleteSamplers" es2="2.0" no_error="true">
|
||||||
<param name="count" type="GLsizei"/>
|
<param name="count" type="GLsizei"/>
|
||||||
<param name="samplers" type="const GLuint *" count="count"/>
|
<param name="samplers" type="const GLuint *" count="count"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="IsSampler" es2="3.0">
|
<function name="IsSampler" es2="2.0">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<return type="GLboolean"/>
|
<return type="GLboolean"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="BindSampler" es2="3.0" no_error="true" exec="dlist">
|
<function name="BindSampler" es2="2.0" no_error="true" exec="dlist">
|
||||||
<param name="unit" type="GLuint"/>
|
<param name="unit" type="GLuint"/>
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="SamplerParameteri" es2="3.0" exec="dlist">
|
<function name="SamplerParameteri" es2="2.0" exec="dlist">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="param" type="GLint"/>
|
<param name="param" type="GLint"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="SamplerParameterf" es2="3.0" exec="dlist">
|
<function name="SamplerParameterf" es2="2.0" exec="dlist">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="param" type="GLfloat"/>
|
<param name="param" type="GLfloat"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="SamplerParameteriv" es2="3.0" exec="dlist">
|
<function name="SamplerParameteriv" es2="2.0" exec="dlist">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="params" type="const GLint *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
<param name="params" type="const GLint *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="SamplerParameterfv" es2="3.0" exec="dlist">
|
<function name="SamplerParameterfv" es2="2.0" exec="dlist">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="params" type="const GLfloat *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
<param name="params" type="const GLfloat *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
||||||
@@ -63,13 +63,13 @@
|
|||||||
<param name="params" type="const GLuint *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
<param name="params" type="const GLuint *" count="_mesa_tex_param_enum_to_count(pname)"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="GetSamplerParameteriv" es2="3.0">
|
<function name="GetSamplerParameteriv" es2="2.0">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="params" type="GLint *"/>
|
<param name="params" type="GLint *"/>
|
||||||
</function>
|
</function>
|
||||||
|
|
||||||
<function name="GetSamplerParameterfv" es2="3.0">
|
<function name="GetSamplerParameterfv" es2="2.0">
|
||||||
<param name="sampler" type="GLuint"/>
|
<param name="sampler" type="GLuint"/>
|
||||||
<param name="pname" type="GLenum"/>
|
<param name="pname" type="GLenum"/>
|
||||||
<param name="params" type="GLfloat *"/>
|
<param name="params" type="GLfloat *"/>
|
||||||
|
@@ -380,6 +380,7 @@ EXT(KHR_texture_compression_astc_sliced_3d , KHR_texture_compression_astc_slice
|
|||||||
EXT(MESA_bgra , dummy_true , x , x , x , ES2, 2021)
|
EXT(MESA_bgra , dummy_true , x , x , x , ES2, 2021)
|
||||||
EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 30, 2018)
|
EXT(MESA_framebuffer_flip_y , MESA_framebuffer_flip_y , 43, 43, x , 30, 2018)
|
||||||
EXT(MESA_pack_invert , MESA_pack_invert , GLL, GLC, x , x , 2002)
|
EXT(MESA_pack_invert , MESA_pack_invert , GLL, GLC, x , x , 2002)
|
||||||
|
EXT(MESA_sampler_objects , dummy_true , x , x , x , ES2, 2019)
|
||||||
EXT(MESA_shader_integer_functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016)
|
EXT(MESA_shader_integer_functions , MESA_shader_integer_functions , GLL, GLC, x , 30, 2016)
|
||||||
EXT(MESA_texture_signed_rgba , EXT_texture_snorm , GLL, GLC, x , x , 2009)
|
EXT(MESA_texture_signed_rgba , EXT_texture_snorm , GLL, GLC, x , x , 2009)
|
||||||
EXT(MESA_tile_raster_order , MESA_tile_raster_order , GLL, GLC, x , ES2, 2017)
|
EXT(MESA_tile_raster_order , MESA_tile_raster_order , GLL, GLC, x , ES2, 2017)
|
||||||
|
Reference in New Issue
Block a user