mesa: fix mismatch when returning 64-bit bindless uniform handles
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 25 Jul 2017 19:39:20 +0000 (21:39 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 28 Jul 2017 09:20:39 +0000 (11:20 +0200)
The slower convert-and-copy process performs a bad conversion
because it converts the value to signed 64-bit integer, but
bindless uniform handles are considered unsigned 64-bit.

This fixes "Check glUniform*() with mixed texture units/handles"
from arb_bindless_texture-uniform piglit.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/uniform_query.cpp

index 928d3ce4fd65d1e37224bdbe4789eb37368a20dd..a48b6d292188f0203954cda922ebbc147d24edf9 100644 (file)
@@ -358,7 +358,8 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
        */
       if (returnType == uni->type->base_type ||
           ((returnType == GLSL_TYPE_INT || returnType == GLSL_TYPE_UINT) &&
-           (uni->type->is_sampler() || uni->type->is_image()))) {
+           (uni->type->is_sampler() || uni->type->is_image())) ||
+          (returnType == GLSL_TYPE_UINT64 && uni->is_bindless)) {
          memcpy(paramsOut, src, bytes);
       } else {
          union gl_constant_value *const dst =