mesa/get: fix enum16 big-endian getting.
authorDave Airlie <airlied@redhat.com>
Mon, 29 Jun 2020 19:04:19 +0000 (05:04 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 30 Jun 2020 23:52:56 +0000 (09:52 +1000)
These values were getting casted up to 32-bit, but then extracted
via 16-bit pointer later. Just store via 16-bit.

Fixes a lot of piglit on s390

Fixes: f96a69f916ae ("mesa: replace GLenum with GLenum16 in common structures (v4)");
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5679>

src/mesa/main/get.c

index 6bd583473ecd5e88cdcdd3645cfd0c886cfbf68a..a1199e5ad53156aeeaaf79398986aa17760d0bf7 100644 (file)
@@ -228,6 +228,7 @@ union value {
    GLint value_int_4[4];
    GLint64 value_int64;
    GLenum value_enum;
+   GLenum16 value_enum16;
    GLubyte value_ubyte;
    GLshort value_short;
    GLuint value_uint;
@@ -744,7 +745,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
       break;
 
    case GL_READ_BUFFER:
-      v->value_enum = ctx->ReadBuffer->ColorReadBuffer;
+      v->value_enum16 = ctx->ReadBuffer->ColorReadBuffer;
       break;
 
    case GL_MAP2_GRID_DOMAIN:
@@ -843,11 +844,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
       break;
    case GL_LIST_MODE:
       if (!ctx->CompileFlag)
-         v->value_enum = 0;
+         v->value_enum16 = 0;
       else if (ctx->ExecuteFlag)
-         v->value_enum = GL_COMPILE_AND_EXECUTE;
+         v->value_enum16 = GL_COMPILE_AND_EXECUTE;
       else
-         v->value_enum = GL_COMPILE;
+         v->value_enum16 = GL_COMPILE;
       break;
 
    case GL_VIEWPORT:
@@ -863,20 +864,20 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
       break;
 
    case GL_ACTIVE_STENCIL_FACE_EXT:
-      v->value_enum = ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT;
+      v->value_enum16 = ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT;
       break;
 
    case GL_STENCIL_FAIL:
-      v->value_enum = ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace];
+      v->value_enum16 = ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace];
       break;
    case GL_STENCIL_FUNC:
-      v->value_enum = ctx->Stencil.Function[ctx->Stencil.ActiveFace];
+      v->value_enum16 = ctx->Stencil.Function[ctx->Stencil.ActiveFace];
       break;
    case GL_STENCIL_PASS_DEPTH_FAIL:
-      v->value_enum = ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace];
+      v->value_enum16 = ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace];
       break;
    case GL_STENCIL_PASS_DEPTH_PASS:
-      v->value_enum = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace];
+      v->value_enum16 = ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace];
       break;
    case GL_STENCIL_REF:
       v->value_int = _mesa_get_stencil_ref(ctx, ctx->Stencil.ActiveFace);