summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-04-20 14:42:49 +0200
committerSamuel Pitoiset <[email protected]>2017-05-06 16:40:19 +0200
commit1f40343e9a2a7113d2ee406ceda267975b8e7c5b (patch)
tree549ca83b782d599878d253920030da6fac94fedc /src/compiler/glsl
parentbecc87b84a01d0b9c6efb5a979dfb44c53095c4d (diff)
glsl: make component_slots() returns 2 for samplers/images
Bindless samplers/images are 64-bit unsigned integers, which means they consume two components as specified by ARB_bindless_texture. It looks like we are not wasting uniform storage by changing this because default-block uniforms are not packed. So, if we use N uint uniforms, they occupy N * 16 bytes in the constant buffer. This is something that could be improved. Though, count_uniform_size needs to be adjusted to not count a sampler (or image) twice. As a side effect, this will probably break the cache if you have one because it will consider sampler/image types as two components. v3: - update the comments Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index c195e767e25..f6335b0f9eb 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -340,9 +340,13 @@ private:
if (type->contains_subroutine()) {
this->num_shader_subroutines += values;
} else if (type->contains_sampler()) {
- this->num_shader_samplers += values;
+ /* Samplers (bound or bindless) are counted as two components as
+ * specified by ARB_bindless_texture. */
+ this->num_shader_samplers += values / 2;
} else if (type->contains_image()) {
- this->num_shader_images += values;
+ /* Images (bound or bindless) are counted as two components as
+ * specified by ARB_bindless_texture. */
+ this->num_shader_images += values / 2;
/* As drivers are likely to represent image uniforms as
* scalar indices, count them against the limit of uniform