mesa/es: Validate glTexSubImage format and type in Mesa code rather than the ES wrapper
v2: Add proper GLES3 filtering. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
409620e477
commit
9848e86af0
|
@ -1455,85 +1455,6 @@
|
||||||
<param name="type" type="GLenum"/>
|
<param name="type" type="GLenum"/>
|
||||||
<param name="pixels" type="const GLvoid *"/>
|
<param name="pixels" type="const GLvoid *"/>
|
||||||
</proto>
|
</proto>
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_ALPHA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_RGB"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_5_6_5"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_RGBA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
<value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_LUMINANCE"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_LUMINANCE_ALPHA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format" category="OES_depth_texture">
|
|
||||||
<value name="GL_DEPTH_COMPONENT"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_SHORT"/>
|
|
||||||
<value name="GL_UNSIGNED_INT"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format" category="OES_packed_depth_stencil">
|
|
||||||
<value name="GL_DEPTH_STENCIL_OES"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_INT_24_8_OES"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format" category="EXT_texture_format_BGRA8888">
|
|
||||||
<value name="GL_BGRA_EXT"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="BindTexture">
|
<template name="BindTexture">
|
||||||
|
@ -1624,60 +1545,6 @@
|
||||||
<param name="type" type="GLenum"/>
|
<param name="type" type="GLenum"/>
|
||||||
<param name="pixels" type="const GLvoid *"/>
|
<param name="pixels" type="const GLvoid *"/>
|
||||||
</proto>
|
</proto>
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_ALPHA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_RGB"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_5_6_5"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_RGBA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
|
|
||||||
<value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
<value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_LUMINANCE"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
|
|
||||||
<desc name="format">
|
|
||||||
<value name="GL_LUMINANCE_ALPHA"/>
|
|
||||||
|
|
||||||
<desc name="type" error="GL_INVALID_OPERATION">
|
|
||||||
<value name="GL_UNSIGNED_BYTE"/>
|
|
||||||
<value name="GL_FLOAT" category="OES_texture_float"/>
|
|
||||||
<value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
|
|
||||||
</desc>
|
|
||||||
</desc>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="CopyTexSubImage3D">
|
<template name="CopyTexSubImage3D">
|
||||||
|
|
|
@ -1927,6 +1927,23 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
|
||||||
|
* combinations of format and type that can be used. Formats and types
|
||||||
|
* that require additional extensions (e.g., GL_FLOAT requires
|
||||||
|
* GL_OES_texture_float) are filtered elsewhere.
|
||||||
|
*/
|
||||||
|
if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
|
||||||
|
err = _mesa_es_error_check_format_and_type(format, type, dimensions);
|
||||||
|
if (err != GL_NO_ERROR) {
|
||||||
|
_mesa_error(ctx, err,
|
||||||
|
"glTexSubImage%dD(format = %s, type = %s)",
|
||||||
|
dimensions,
|
||||||
|
_mesa_lookup_enum_by_nr(format),
|
||||||
|
_mesa_lookup_enum_by_nr(type));
|
||||||
|
return GL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = _mesa_error_check_format_and_type(ctx, format, type);
|
err = _mesa_error_check_format_and_type(ctx, format, type);
|
||||||
if (err != GL_NO_ERROR) {
|
if (err != GL_NO_ERROR) {
|
||||||
_mesa_error(ctx, err,
|
_mesa_error(ctx, err,
|
||||||
|
|
Loading…
Reference in New Issue