mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 05:10:17 +01:00
mesa: enable EXT_render_snorm extension
Patch sets additional formats renderable and enables the extension
when OpenGL ES 3.1 is supported.
v2: instead of dummy_true, have a separate toggle for extension
(Eric Anholt)
v3: add missing checks, simplify some existing checks and fix
glCopyTexImage2D check (Nanley Chery)
add SHORT and BYTE support in read_pixels_es3_error_check
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
This commit is contained in:
parent
de57926dc9
commit
0d356cf478
6 changed files with 62 additions and 10 deletions
|
|
@ -247,6 +247,7 @@ EXT(EXT_polygon_offset_clamp , ARB_polygon_offset_clamp
|
|||
EXT(EXT_primitive_bounding_box , OES_primitive_bounding_box , x , x , x , 31, 2014)
|
||||
EXT(EXT_provoking_vertex , EXT_provoking_vertex , GLL, GLC, x , x , 2009)
|
||||
EXT(EXT_read_format_bgra , dummy_true , x , x , ES1, ES2, 2009)
|
||||
EXT(EXT_render_snorm , EXT_render_snorm , x , x , x, 31, 2014)
|
||||
EXT(EXT_rescale_normal , dummy_true , GLL, x , x , x , 1997)
|
||||
EXT(EXT_robustness , KHR_robustness , x, x, x , ES2, 2011)
|
||||
EXT(EXT_secondary_color , dummy_true , GLL, x , x , x , 1999)
|
||||
|
|
|
|||
|
|
@ -729,7 +729,15 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format,
|
|||
|
||||
/* Reject additional cases for GLES */
|
||||
switch (internalFormat) {
|
||||
case GL_R8_SNORM:
|
||||
case GL_RG8_SNORM:
|
||||
case GL_RGBA8_SNORM:
|
||||
return _mesa_has_EXT_render_snorm(ctx);
|
||||
case GL_R16_SNORM:
|
||||
case GL_RG16_SNORM:
|
||||
case GL_RGBA16_SNORM:
|
||||
return _mesa_has_EXT_texture_norm16(ctx) &&
|
||||
_mesa_has_EXT_render_snorm(ctx);
|
||||
case GL_RGB32F:
|
||||
case GL_RGB32I:
|
||||
case GL_RGB32UI:
|
||||
|
|
@ -742,8 +750,6 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format,
|
|||
case GL_SRGB8:
|
||||
case GL_RGB10:
|
||||
case GL_RGB9_E5:
|
||||
case GL_RG8_SNORM:
|
||||
case GL_R8_SNORM:
|
||||
return GL_FALSE;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -2060,25 +2066,40 @@ _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat)
|
|||
return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
|
||||
? GL_RG : 0;
|
||||
/* signed normalized texture formats */
|
||||
case GL_RED_SNORM:
|
||||
case GL_R8_SNORM:
|
||||
case GL_R16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
return _mesa_has_EXT_texture_snorm(ctx) || _mesa_has_EXT_render_snorm(ctx)
|
||||
? GL_RED : 0;
|
||||
case GL_RED_SNORM:
|
||||
return _mesa_has_EXT_texture_snorm(ctx) ? GL_RED : 0;
|
||||
case GL_R16_SNORM:
|
||||
return _mesa_has_EXT_texture_snorm(ctx) ||
|
||||
(_mesa_has_EXT_render_snorm(ctx) &&
|
||||
_mesa_has_EXT_texture_norm16(ctx))
|
||||
? GL_RED : 0;
|
||||
case GL_RG_SNORM:
|
||||
case GL_RG8_SNORM:
|
||||
return _mesa_has_EXT_texture_snorm(ctx) || _mesa_has_EXT_render_snorm(ctx)
|
||||
? GL_RG : 0;
|
||||
case GL_RG_SNORM:
|
||||
_mesa_has_EXT_texture_snorm(ctx) ? GL_RG : 0;
|
||||
case GL_RG16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
return _mesa_has_EXT_texture_snorm(ctx) ||
|
||||
(_mesa_has_EXT_render_snorm(ctx) &&
|
||||
_mesa_has_EXT_texture_norm16(ctx))
|
||||
? GL_RG : 0;
|
||||
case GL_RGB_SNORM:
|
||||
case GL_RGB8_SNORM:
|
||||
case GL_RGB16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
? GL_RGB : 0;
|
||||
case GL_RGBA_SNORM:
|
||||
case GL_RGBA8_SNORM:
|
||||
return _mesa_has_EXT_texture_snorm(ctx) || _mesa_has_EXT_render_snorm(ctx)
|
||||
? GL_RGBA : 0;
|
||||
case GL_RGBA_SNORM:
|
||||
return _mesa_has_EXT_texture_snorm(ctx) ? GL_RGBA : 0;
|
||||
case GL_RGBA16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
return _mesa_has_EXT_texture_snorm(ctx) ||
|
||||
(_mesa_has_EXT_render_snorm(ctx) &&
|
||||
_mesa_has_EXT_texture_norm16(ctx))
|
||||
? GL_RGBA : 0;
|
||||
case GL_ALPHA_SNORM:
|
||||
case GL_ALPHA8_SNORM:
|
||||
|
|
|
|||
|
|
@ -3794,6 +3794,15 @@ _mesa_is_es3_color_renderable(const struct gl_context *ctx,
|
|||
case GL_RG16:
|
||||
case GL_RGBA16:
|
||||
return _mesa_has_EXT_texture_norm16(ctx);
|
||||
case GL_R8_SNORM:
|
||||
case GL_RG8_SNORM:
|
||||
case GL_RGBA8_SNORM:
|
||||
return _mesa_has_EXT_render_snorm(ctx);
|
||||
case GL_R16_SNORM:
|
||||
case GL_RG16_SNORM:
|
||||
case GL_RGBA16_SNORM:
|
||||
return _mesa_has_EXT_texture_norm16(ctx) &&
|
||||
_mesa_has_EXT_render_snorm(ctx);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4223,6 +4223,7 @@ struct gl_extensions
|
|||
GLboolean EXT_pixel_buffer_object;
|
||||
GLboolean EXT_point_parameters;
|
||||
GLboolean EXT_provoking_vertex;
|
||||
GLboolean EXT_render_snorm;
|
||||
GLboolean EXT_semaphore;
|
||||
GLboolean EXT_semaphore_fd;
|
||||
GLboolean EXT_shader_integer_mix;
|
||||
|
|
|
|||
|
|
@ -939,6 +939,25 @@ read_pixels_es3_error_check(struct gl_context *ctx, GLenum format, GLenum type,
|
|||
return GL_NO_ERROR;
|
||||
}
|
||||
}
|
||||
if (type == GL_SHORT) {
|
||||
switch (internalFormat) {
|
||||
case GL_R16_SNORM:
|
||||
case GL_RG16_SNORM:
|
||||
case GL_RGBA16_SNORM:
|
||||
if (_mesa_has_EXT_texture_norm16(ctx) &&
|
||||
_mesa_has_EXT_render_snorm(ctx))
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
}
|
||||
if (type == GL_BYTE) {
|
||||
switch (internalFormat) {
|
||||
case GL_R8_SNORM:
|
||||
case GL_RG8_SNORM:
|
||||
case GL_RGBA8_SNORM:
|
||||
if (_mesa_has_EXT_render_snorm(ctx))
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GL_BGRA:
|
||||
/* GL_EXT_read_format_bgra */
|
||||
|
|
|
|||
|
|
@ -2468,7 +2468,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
|
|||
* types for SNORM formats. Also, conversion to SNORM formats is not
|
||||
* allowed by Table 3.2 on Page 110.
|
||||
*/
|
||||
if (_mesa_is_enum_format_snorm(internalFormat)) {
|
||||
if (!_mesa_has_EXT_render_snorm(ctx) &&
|
||||
_mesa_is_enum_format_snorm(internalFormat)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(internalFormat=%s)", dimensions,
|
||||
_mesa_enum_to_string(internalFormat));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue