vrend: handle GL_INVALID_ENUM when trying format.

It seems under some GPU/profile, GL_INVALID_ENUM is generated
instead of GL_INVALID_VALUE for unsupported internal format.
This is even conflicted in reference documents. Just handle
them at same time.

From:
https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexImage2D.xhtml

GL_INVALID_ENUM is generated if internalFormat is not one of the accepted
resolution and format symbolic constants.

From:
https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glTexImage2D.xhtml

GL_INVALID_VALUE is generated if internalFormat is not one of the accepted
resolution and format symbolic constants.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
macos/master
Lepton Wu 7 years ago committed by Dave Airlie
parent 01d02cee1b
commit fd0ed16337
  1. 2
      src/vrend_formats.c

@ -286,7 +286,7 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
glTexImage2D(GL_TEXTURE_2D, 0, table[i].internalformat, 32, 32, 0, table[i].glformat, table[i].gltype, NULL);
status = glGetError();
if (status == GL_INVALID_VALUE) {
if (status == GL_INVALID_VALUE || status == GL_INVALID_ENUM) {
struct vrend_format_table *entry = NULL;
uint8_t swizzle[4];
binding = VREND_BIND_SAMPLER | VREND_BIND_RENDER | VREND_BIND_NEED_SWIZZLE;

Loading…
Cancel
Save