summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-02-13 22:03:47 -0500
committerIlia Mirkin <[email protected]>2015-02-19 00:28:34 -0500
commit1ec715ce8b126da3cfe3b383054f9a176960c218 (patch)
treef0a7ce6b9c322843d2e2e4a64e11329e55bd8414 /src/glsl
parentfe23bb85baa22dc06638c3ea8cbe5e6ee17bfa4a (diff)
glsl: teach std140_base_alignment about samplers
These functions are about to be used more aggressively for determining uniform layout. Samplers may be inside of structs, and it's easier to reuse the existing base alignment logic. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glsl_types.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index be87b0a2d24..38b37a6a94b 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -1077,6 +1077,15 @@ glsl_type::std140_base_alignment(bool row_major) const
return base_alignment;
}
+ /* A sampler may never occur in a UBO (without bindless of some sort),
+ * however it is convenient to use this alignment function even with
+ * regular uniforms. This allows use of this function on uniform structs
+ * that contain samplers.
+ */
+ if (this->is_sampler()) {
+ return 0;
+ }
+
assert(!"not reached");
return -1;
}