mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-11 12:20:15 +01:00
mesa/main: add support for EXT_texture_storage
It's sometimes really, really useful if GL_BGRA8 can be used as a sized internal format, and the combination of EXT_texture_storage and EXT_texture_format_BGRA8888 allows this (only when using texture-storage, which is good enough in some cases). Until now, we've only implemented ARB_texture_storage, and not the EXT version. So let's implement the EXT version as well, so we get the benefit of the interaction here. This pulls in a lot of other similar interactions as well, which also seems useful. ...because the ARB version is created from the EXT version, let's move the EXT function definitions to the EXT extension. These should probably have been suffixed with ARB in the ARB-version, but things seems to have just ended up kinda confused. Oh well. Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27222>
This commit is contained in:
parent
16f6f50ce4
commit
4de62731f4
8 changed files with 124 additions and 29 deletions
|
|
@ -400,7 +400,7 @@ GL_EXT_direct_state_access additions from other extensions (complete list):
|
|||
GL_EXT_external_buffer n/a
|
||||
GL_EXT_separate_shader_objects n/a
|
||||
GL_EXT_sparse_texture n/a
|
||||
GL_EXT_texture_storage n/a
|
||||
GL_EXT_texture_storage DONE
|
||||
GL_EXT_vertex_attrib_64bit DONE
|
||||
GL_EXT_EGL_image_storage n/a
|
||||
GL_NV_bindless_texture n/a
|
||||
|
|
|
|||
|
|
@ -34,33 +34,6 @@
|
|||
<param name="depth" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage1DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage2DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage3DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
<param name="depth" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
</category>
|
||||
|
||||
|
||||
|
|
|
|||
67
src/mapi/glapi/gen/EXT_texture_storage.xml
Normal file
67
src/mapi/glapi/gen/EXT_texture_storage.xml
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
|
||||
|
||||
<OpenGLAPI>
|
||||
|
||||
<category name="GL_EXT_texture_storage" number="556">
|
||||
|
||||
<enum name="TEXTURE_IMMUTABLE_FORMAT_EXT" value="0x912F"/>
|
||||
<enum name="ALPHA8_EXT" value="0x803C"/>
|
||||
<enum name="LUMINANCE8_EXT" value="0x8040"/>
|
||||
<enum name="LUMINANCE8_ALPHA8_EXT" value="0x8045"/>
|
||||
|
||||
<function name="TexStorage1DEXT" alias="TexStorage1D">
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TexStorage2DEXT" es2="2.0" alias="TexStorage2D">
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TexStorage3DEXT" es2="2.0" alias="TexStorage3D">
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
<param name="depth" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage1DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage2DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
<function name="TextureStorage3DEXT">
|
||||
<param name="texture" type="GLuint"/>
|
||||
<param name="target" type="GLenum"/>
|
||||
<param name="levels" type="GLsizei"/>
|
||||
<param name="internalFormat" type="GLenum"/>
|
||||
<param name="width" type="GLsizei"/>
|
||||
<param name="height" type="GLsizei"/>
|
||||
<param name="depth" type="GLsizei"/>
|
||||
</function>
|
||||
|
||||
</category>
|
||||
|
||||
|
||||
</OpenGLAPI>
|
||||
|
|
@ -12557,6 +12557,9 @@
|
|||
|
||||
<xi:include href="NV_copy_image.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<xi:include href="EXT_texture_storage.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<xi:include href="EXT_vertex_attrib_64bit.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<xi:include href="AMD_depth_clamp_separate.xml"
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ api_xml_files = files(
|
|||
'EXT_shader_image_load_store.xml',
|
||||
'EXT_texture_array.xml',
|
||||
'EXT_texture_integer.xml',
|
||||
'EXT_texture_storage.xml',
|
||||
'EXT_transform_feedback.xml',
|
||||
'EXT_vertex_attrib_64bit.xml',
|
||||
'EXT_window_rectangles.xml',
|
||||
|
|
|
|||
|
|
@ -341,6 +341,7 @@ EXT(EXT_texture_sRGB_decode , EXT_texture_sRGB_decode
|
|||
EXT(EXT_texture_shadow_lod , EXT_texture_shadow_lod , GLL, GLC, x , 30, 2018)
|
||||
EXT(EXT_texture_shared_exponent , EXT_texture_shared_exponent , GLL, GLC, x , x , 2004)
|
||||
EXT(EXT_texture_snorm , EXT_texture_snorm , GLL, GLC, x , x , 2009)
|
||||
EXT(EXT_texture_storage , dummy_true , GLL, GLC, x , ES2, 2009)
|
||||
EXT(EXT_texture_swizzle , EXT_texture_swizzle , GLL, GLC, x , x , 2008)
|
||||
EXT(EXT_texture_type_2_10_10_10_REV , EXT_texture_type_2_10_10_10_REV , x , x , x , ES2, 2008)
|
||||
EXT(EXT_texture_view , OES_texture_view , x , x , x , 31, 2014)
|
||||
|
|
|
|||
|
|
@ -221,6 +221,56 @@ GLboolean
|
|||
_mesa_is_legal_tex_storage_format(const struct gl_context *ctx,
|
||||
GLenum internalformat)
|
||||
{
|
||||
if (!_mesa_is_desktop_gl(ctx)) {
|
||||
assert(_mesa_has_EXT_texture_storage(ctx));
|
||||
|
||||
/* EXT_texture_storage allows us to use some sized internal formats
|
||||
* for TexStorage* that aren't otherwise allowed in OpenGL ES.
|
||||
**/
|
||||
switch (internalformat) {
|
||||
case GL_ALPHA8:
|
||||
case GL_LUMINANCE8:
|
||||
case GL_LUMINANCE8_ALPHA8:
|
||||
return true;
|
||||
|
||||
case GL_RGBA32F:
|
||||
case GL_RGB32F:
|
||||
case GL_ALPHA32F_EXT:
|
||||
case GL_LUMINANCE32F_EXT:
|
||||
case GL_LUMINANCE_ALPHA32F_EXT:
|
||||
return _mesa_has_OES_texture_float(ctx);
|
||||
|
||||
case GL_RGBA16F:
|
||||
case GL_RGB16F:
|
||||
case GL_ALPHA16F_EXT:
|
||||
case GL_LUMINANCE16F_EXT:
|
||||
case GL_LUMINANCE_ALPHA16F_EXT:
|
||||
return _mesa_has_OES_texture_half_float(ctx);
|
||||
|
||||
case GL_RGB10_A2:
|
||||
case GL_RGB10:
|
||||
return _mesa_has_EXT_texture_type_2_10_10_10_REV(ctx);
|
||||
|
||||
case GL_BGRA8_EXT:
|
||||
assert(_mesa_has_EXT_texture_format_BGRA8888(ctx));
|
||||
return true;
|
||||
|
||||
case GL_R8:
|
||||
case GL_RG8:
|
||||
return _mesa_has_EXT_texture_rg(ctx);
|
||||
|
||||
case GL_R32F_EXT:
|
||||
case GL_RG32F_EXT:
|
||||
return _mesa_has_EXT_texture_rg(ctx) &&
|
||||
_mesa_has_OES_texture_float(ctx);
|
||||
|
||||
case GL_R16F_EXT:
|
||||
case GL_RG16F_EXT:
|
||||
return _mesa_has_EXT_texture_rg(ctx) &&
|
||||
_mesa_has_OES_texture_half_float(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
/* check internal format - note that only sized formats are allowed */
|
||||
switch (internalformat) {
|
||||
case GL_ALPHA:
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ static const struct format_mapping format_map[] = {
|
|||
{ PIPE_FORMAT_R8G8B8A8_UNORM, DEFAULT_RGBA_FORMATS }
|
||||
},
|
||||
{
|
||||
{ GL_BGRA, 0 },
|
||||
{ GL_BGRA, GL_BGRA8_EXT, 0 },
|
||||
{ DEFAULT_RGBA_FORMATS }
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue