do not allow invalid texture-format enums

Submitted by Erik Faye-Lund on Nov. 19, 2018, 12:14 p.m.

Details

Reviewer None
Submitted Nov. 19, 2018, 12:14 p.m.
Last Updated Dec. 3, 2018, 5:47 p.m.
Revision 4

Cover Letter(s)

Revision 1
      Here's a lengthy patch-series that aims to fix a few simple bugs, where
invalid enums for texture formats were allowed when they shouldn't be.

In general, this is a pattern of checking ctx->Extensions.FOO_bar
instead of _mesa_has_FOO_bar(ctx). The difference is that the former is
really just a driver capability, whereas the latter checks if the API is
of the right profile and version as well.

Generally, this has lead to enums being incorrectly accepted on older
versions of the APIs, or in the wrong profile. In particular OpenGL ES
1.x and 2.0 allowed a lot of enums where there's no corresponding
extension enabling it.

The last five patches are slightly different; they are fixups to version
and extension requirements. These were simply noticed while working on
this series.

I've run this through piglit on i965, and found no regressions. One test
was fixed, namely oes_packed_depth_stencil-depth-stencil-texture_gles1.

I don't think this is worth back-porting to old releases, as this only
prevents broken code from incorrectly working, not the other way around.

Erik Faye-Lund (30):
  mesa/main: make _mesa_has_tessellation return bool
  mesa/main: rename format-check function
  mesa/main: clean up S3_s3tc check
  mesa/main: clean up OES_texture_float_linear check
  mesa/main: clean up ES2_compatibility check
  mesa/main: clean up integer texture check
  mesa/main: use _mesa_has_FOO_bar for compressed format checks
  mesa/main: do not allow s3tc enums on gles1
  mesa/main: do not allow etc2 enums on gles1
  mesa/main: do not allow astc enums on gles1
  mesa/main: do not allow depth-texture enums on gles1
  mesa/main: do not allow stencil-texture enums on gles1
  mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3
  mesa/main: do not allow integer-texture enums before gles3
  mesa/main: do not allow ARB_depth_buffer_float enums before gles3
  mesa/main: do not allow EXT_packed_float enums before gles3
  mesa/main: do not allow rg-textures enums before gles3
  mesa/main: do not allow EXT_texture_shared_exponent enums before gles3
  mesa/main: do not allow MESA_ycbcr_texture enums on gles
  mesa/main: do not allow type_2_10_10_10_REV enums before gles3
  mesa/main: do not allow floating-point texture enums on gles1
  mesa/main: do not allow snorm-texture enums before gles3
  mesa/main: do not allow sRGB texture enums before gles3
  mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3
  mesa/main: split float-texture support checking in two
  mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3
  mesa/main: require EXT_texture_sRGB for gles3
  mesa/st: do not probe for the same texture-formats twice
  mesa/main: do not require float-texture filtering for es3
  mesa/st: require linear interpolation for ARB_texture_float

 src/mesa/main/context.h                |  59 ++++++-
 src/mesa/main/glformats.c              | 221 +++++++++++++------------
 src/mesa/main/glformats.h              |   6 +-
 src/mesa/main/teximage.c               |   4 +-
 src/mesa/main/version.c                |   8 +-
 src/mesa/state_tracker/st_extensions.c |  10 +-
 6 files changed, 188 insertions(+), 120 deletions(-)
    

Revisions

Patches download mbox

# Name Submitter State A F R T
[01/30] mesa/main: make _mesa_has_tessellation return bool Erik Faye-Lund Accepted
[02/30] mesa/main: rename format-check function Erik Faye-Lund Accepted
[03/30] mesa/main: clean up S3_s3tc check Erik Faye-Lund New 1
[04/30] mesa/main: clean up OES_texture_float_linear check Erik Faye-Lund Accepted
[05/30] mesa/main: clean up ES2_compatibility check Erik Faye-Lund Accepted
[06/30] mesa/main: clean up integer texture check Erik Faye-Lund Accepted
[07/30] mesa/main: use _mesa_has_FOO_bar for compressed format checks Erik Faye-Lund New
[08/30] mesa/main: do not allow s3tc enums on gles1 Erik Faye-Lund New
[09/30] mesa/main: do not allow etc2 enums on gles1 Erik Faye-Lund Accepted
[10/30] mesa/main: do not allow astc enums on gles1 Erik Faye-Lund Accepted
[11/30] mesa/main: do not allow depth-texture enums on gles1 Erik Faye-Lund Accepted
[12/30] mesa/main: do not allow stencil-texture enums on gles1 Erik Faye-Lund Accepted
[13/30] mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3 Erik Faye-Lund Accepted
[14/30] mesa/main: do not allow integer-texture enums before gles3 Erik Faye-Lund Accepted
[15/30] mesa/main: do not allow ARB_depth_buffer_float enums before gles3 Erik Faye-Lund Accepted
[16/30] mesa/main: do not allow EXT_packed_float enums before gles3 Erik Faye-Lund Accepted
[17/30] mesa/main: do not allow rg-textures enums before gles3 Erik Faye-Lund Accepted
[18/30] mesa/main: do not allow EXT_texture_shared_exponent enums before gles3 Erik Faye-Lund Accepted
[19/30] mesa/main: do not allow MESA_ycbcr_texture enums on gles Erik Faye-Lund Accepted
[20/30] mesa/main: do not allow type_2_10_10_10_REV enums before gles3 Erik Faye-Lund Accepted
[21/30] mesa/main: do not allow floating-point texture enums on gles1 Erik Faye-Lund Accepted
[22/30] mesa/main: do not allow snorm-texture enums before gles3 Erik Faye-Lund Accepted
[23/30] mesa/main: do not allow sRGB texture enums before gles3 Erik Faye-Lund Accepted
[24/30] mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3 Erik Faye-Lund Accepted 1
[25/30] mesa/main: split float-texture support checking in two Erik Faye-Lund New
[26/30] mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3 Erik Faye-Lund Accepted
[27/30] mesa/main: require EXT_texture_sRGB for gles3 Erik Faye-Lund Accepted
[28/30] mesa/st: do not probe for the same texture-formats twice Erik Faye-Lund Accepted
[29/30] mesa/main: do not require float-texture filtering for es3 Erik Faye-Lund Accepted
[30/30] mesa/st: require linear interpolation for ARB_texture_float Erik Faye-Lund New
SERIES REVISION LOOKS STRANGE. Please double-check patch list and the ordering before proceeding.

Patches download mbox

# Name Submitter State A F R T
[01/30] mesa/main: make _mesa_has_tessellation return bool Erik Faye-Lund Accepted
[02/30] mesa/main: rename format-check function Erik Faye-Lund Accepted
[03/30] mesa/main: clean up S3_s3tc check Erik Faye-Lund New 1
[04/30] mesa/main: clean up OES_texture_float_linear check Erik Faye-Lund Accepted
[05/30] mesa/main: clean up ES2_compatibility check Erik Faye-Lund Accepted
[06/30] mesa/main: clean up integer texture check Erik Faye-Lund Accepted
[07/30] mesa/main: use _mesa_has_FOO_bar for compressed format checks Erik Faye-Lund New
[08/30] mesa/main: do not allow s3tc enums on gles1 Erik Faye-Lund New
[09/30] mesa/main: do not allow etc2 enums on gles1 Erik Faye-Lund Accepted
[10/30] mesa/main: do not allow astc enums on gles1 Erik Faye-Lund Accepted
[11/30] mesa/main: do not allow depth-texture enums on gles1 Erik Faye-Lund Accepted
[12/30] mesa/main: do not allow stencil-texture enums on gles1 Erik Faye-Lund Accepted
[13/30] mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3 Erik Faye-Lund Accepted
[14/30] mesa/main: do not allow integer-texture enums before gles3 Erik Faye-Lund Accepted
[15/30] mesa/main: do not allow ARB_depth_buffer_float enums before gles3 Erik Faye-Lund Accepted
[16/30] mesa/main: do not allow EXT_packed_float enums before gles3 Erik Faye-Lund Accepted
[17/30] mesa/main: do not allow rg-textures enums before gles3 Erik Faye-Lund Accepted
[18/30] mesa/main: do not allow EXT_texture_shared_exponent enums before gles3 Erik Faye-Lund Accepted
[19/30] mesa/main: do not allow MESA_ycbcr_texture enums on gles Erik Faye-Lund Accepted
[20/30] mesa/main: do not allow type_2_10_10_10_REV enums before gles3 Erik Faye-Lund Accepted
[21/30] mesa/main: do not allow floating-point texture enums on gles1 Erik Faye-Lund Accepted
[22/30] mesa/main: do not allow snorm-texture enums before gles3 Erik Faye-Lund Accepted
[23/30] mesa/main: do not allow sRGB texture enums before gles3 Erik Faye-Lund Accepted
[24/30] mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3 Erik Faye-Lund Accepted 1
[25/30] mesa/main: split float-texture support checking in two Erik Faye-Lund New
[26/30] mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3 Erik Faye-Lund Accepted
[27/30] mesa/main: require EXT_texture_sRGB for gles3 Erik Faye-Lund Accepted
[28/30] mesa/st: do not probe for the same texture-formats twice Erik Faye-Lund Accepted
[29/30] mesa/main: do not require float-texture filtering for es3 Erik Faye-Lund Accepted
[30/30] mesa/st: require linear interpolation for ARB_texture_float Erik Faye-Lund New
SERIES REVISION LOOKS STRANGE. Please double-check patch list and the ordering before proceeding.

Patches download mbox

# Name Submitter State A F R T
[01/30] mesa/main: make _mesa_has_tessellation return bool Erik Faye-Lund Accepted
[02/30] mesa/main: rename format-check function Erik Faye-Lund Accepted
[v2,03/29] mesa/main: clean up S3_s3tc check Erik Faye-Lund New
[04/30] mesa/main: clean up OES_texture_float_linear check Erik Faye-Lund Accepted
[05/30] mesa/main: clean up ES2_compatibility check Erik Faye-Lund Accepted
[06/30] mesa/main: clean up integer texture check Erik Faye-Lund Accepted
[07/30] mesa/main: use _mesa_has_FOO_bar for compressed format checks Erik Faye-Lund New
[08/30] mesa/main: do not allow s3tc enums on gles1 Erik Faye-Lund New
[09/30] mesa/main: do not allow etc2 enums on gles1 Erik Faye-Lund Accepted
[10/30] mesa/main: do not allow astc enums on gles1 Erik Faye-Lund Accepted
[11/30] mesa/main: do not allow depth-texture enums on gles1 Erik Faye-Lund Accepted
[12/30] mesa/main: do not allow stencil-texture enums on gles1 Erik Faye-Lund Accepted
[13/30] mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3 Erik Faye-Lund Accepted
[14/30] mesa/main: do not allow integer-texture enums before gles3 Erik Faye-Lund Accepted
[15/30] mesa/main: do not allow ARB_depth_buffer_float enums before gles3 Erik Faye-Lund Accepted
[16/30] mesa/main: do not allow EXT_packed_float enums before gles3 Erik Faye-Lund Accepted
[17/30] mesa/main: do not allow rg-textures enums before gles3 Erik Faye-Lund Accepted
[18/30] mesa/main: do not allow EXT_texture_shared_exponent enums before gles3 Erik Faye-Lund Accepted
[19/30] mesa/main: do not allow MESA_ycbcr_texture enums on gles Erik Faye-Lund Accepted
[20/30] mesa/main: do not allow type_2_10_10_10_REV enums before gles3 Erik Faye-Lund Accepted
[21/30] mesa/main: do not allow floating-point texture enums on gles1 Erik Faye-Lund Accepted
[22/30] mesa/main: do not allow snorm-texture enums before gles3 Erik Faye-Lund Accepted
[23/30] mesa/main: do not allow sRGB texture enums before gles3 Erik Faye-Lund Accepted
[24/30] mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3 Erik Faye-Lund Accepted 1
[25/30] mesa/main: split float-texture support checking in two Erik Faye-Lund New
[26/30] mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3 Erik Faye-Lund Accepted
[27/30] mesa/main: require EXT_texture_sRGB for gles3 Erik Faye-Lund Accepted
[28/30] mesa/st: do not probe for the same texture-formats twice Erik Faye-Lund Accepted
[29/30] mesa/main: do not require float-texture filtering for es3 Erik Faye-Lund Accepted
[30/30] mesa/st: require linear interpolation for ARB_texture_float Erik Faye-Lund New
SERIES REVISION LOOKS STRANGE. Please double-check patch list and the ordering before proceeding.

Patches download mbox

# Name Submitter State A F R T
[01/30] mesa/main: make _mesa_has_tessellation return bool Erik Faye-Lund Accepted
[02/30] mesa/main: rename format-check function Erik Faye-Lund Accepted
[v2,03/29] mesa/main: clean up S3_s3tc check Erik Faye-Lund New
[04/30] mesa/main: clean up OES_texture_float_linear check Erik Faye-Lund Accepted
[v2,05/29] mesa/main: clean up ES2_compatibility check Erik Faye-Lund New 1
[06/30] mesa/main: clean up integer texture check Erik Faye-Lund Accepted
[07/30] mesa/main: use _mesa_has_FOO_bar for compressed format checks Erik Faye-Lund New
[08/30] mesa/main: do not allow s3tc enums on gles1 Erik Faye-Lund New
[09/30] mesa/main: do not allow etc2 enums on gles1 Erik Faye-Lund Accepted
[10/30] mesa/main: do not allow astc enums on gles1 Erik Faye-Lund Accepted
[11/30] mesa/main: do not allow depth-texture enums on gles1 Erik Faye-Lund Accepted
[12/30] mesa/main: do not allow stencil-texture enums on gles1 Erik Faye-Lund Accepted
[13/30] mesa/main: do not allow ARB_texture_rgb10_a2ui enums before gles3 Erik Faye-Lund Accepted
[14/30] mesa/main: do not allow integer-texture enums before gles3 Erik Faye-Lund Accepted
[15/30] mesa/main: do not allow ARB_depth_buffer_float enums before gles3 Erik Faye-Lund Accepted
[16/30] mesa/main: do not allow EXT_packed_float enums before gles3 Erik Faye-Lund Accepted
[17/30] mesa/main: do not allow rg-textures enums before gles3 Erik Faye-Lund Accepted
[18/30] mesa/main: do not allow EXT_texture_shared_exponent enums before gles3 Erik Faye-Lund Accepted
[19/30] mesa/main: do not allow MESA_ycbcr_texture enums on gles Erik Faye-Lund Accepted
[20/30] mesa/main: do not allow type_2_10_10_10_REV enums before gles3 Erik Faye-Lund Accepted
[21/30] mesa/main: do not allow floating-point texture enums on gles1 Erik Faye-Lund Accepted
[22/30] mesa/main: do not allow snorm-texture enums before gles3 Erik Faye-Lund Accepted
[23/30] mesa/main: do not allow sRGB texture enums before gles3 Erik Faye-Lund Accepted
[24/30] mesa/main: do not allow EXT_texture_sRGB_R8 enums before gles3 Erik Faye-Lund Accepted 1
[25/30] mesa/main: split float-texture support checking in two Erik Faye-Lund New
[26/30] mesa/main: require EXT_texture_type_2_10_10_10_REV for gles3 Erik Faye-Lund Accepted
[27/30] mesa/main: require EXT_texture_sRGB for gles3 Erik Faye-Lund Accepted
[28/30] mesa/st: do not probe for the same texture-formats twice Erik Faye-Lund Accepted
[29/30] mesa/main: do not require float-texture filtering for es3 Erik Faye-Lund Accepted
[30/30] mesa/st: require linear interpolation for ARB_texture_float Erik Faye-Lund New