diff options
author | Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> | 2020-09-14 21:08:29 +0200 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2020-09-23 20:41:21 +0200 |
commit | 819be690c04ece3ef9adb10c1086510dcf78ce3b (patch) | |
tree | d21986f106ec625f246a15060f48e2889e6696a3 | |
parent | c2c53b9e6302ce139cd4121553accd89a33fe25c (diff) |
mesa: fix glUniform* when a struct contains a bindless sampler
Small example from #3271:
layout (bindless_sampler) uniform;
struct SamplerSparse {
sampler2D tex;
vec4 size;
[...]
};
uniform SamplerSparse foo;
'foo' will be marked as bindless but we should only take the assign-as-GLuint64 path for 'tex'.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3271
Fixes: 990c8d15ac3 ("mesa: fix setting uniform variables for bindless samplers/images")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6730>
(cherry picked from commit 090fc593b44d41e5613b04931bbf46d268fca666)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json index 92f70d56cce..0eb40bfc08d 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1327,7 +1327,7 @@ "description": "mesa: fix glUniform* when a struct contains a bindless sampler", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "990c8d15ac3de8623940b32b662ef956703cc6bc" }, diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index db2f173dd2f..2b1fc8668f4 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -1043,10 +1043,12 @@ copy_uniforms_to_storage(gl_constant_value *storage, const unsigned offset, const unsigned components, enum glsl_base_type basicType) { - if (!uni->type->is_boolean() && !uni->is_bindless) { + bool copy_as_uint64 = uni->is_bindless && + (uni->type->is_sampler() || uni->type->is_image()); + if (!uni->type->is_boolean() && !copy_as_uint64) { memcpy(storage, values, sizeof(storage[0]) * components * count * size_mul); - } else if (uni->is_bindless) { + } else if (copy_as_uint64) { const union gl_constant_value *src = (const union gl_constant_value *) values; GLuint64 *dst = (GLuint64 *)&storage->i; |