[virglrenderer-devel] [PATCH] vrend: handle GL_INVALID_ENUM when trying format.

Lepton Wu lepton at chromium.org
Fri May 18 16:19:06 UTC 2018


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 at chromium.org>
---
 src/vrend_formats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vrend_formats.c b/src/vrend_formats.c
index aea634a..73b65a6 100644
--- a/src/vrend_formats.c
+++ b/src/vrend_formats.c
@@ -279,7 +279,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;
-- 
2.17.0.441.gb46fe60e1d-goog



More information about the virglrenderer-devel mailing list