summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <[email protected]>2017-02-27 09:44:48 +0100
committerBas Nieuwenhuizen <[email protected]>2017-02-28 20:48:10 +0100
commit500e6e40f683fbad09f38360bb79f8a12442c408 (patch)
tree68451576e44852a950286ef7e4947893fc5751b7
parentdd2a0c7aef0887554a36134fc2fa762afa90287b (diff)
radv: Detect if all immutable samplers for a binding are equal.
We can then use constants for indexed loads. Signed-off-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
-rw-r--r--src/amd/vulkan/radv_descriptor_set.c5
-rw-r--r--src/amd/vulkan/radv_descriptor_set.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index b24ff91d3ed..d8399574f2a 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -132,10 +132,15 @@ VkResult radv_CreateDescriptorSetLayout(
if (binding->pImmutableSamplers) {
set_layout->binding[b].immutable_samplers = samplers;
+ set_layout->binding[b].immutable_samplers_equal = true;
samplers += 4 * binding->descriptorCount;
for (uint32_t i = 0; i < binding->descriptorCount; i++)
memcpy(set_layout->binding[b].immutable_samplers + 4 * i, &radv_sampler_from_handle(binding->pImmutableSamplers[i])->state, 16);
+ for (uint32_t i = 1; i < binding->descriptorCount; i++)
+ if (memcmp(set_layout->binding[b].immutable_samplers + 4 * i,
+ set_layout->binding[b].immutable_samplers, 16) != 0)
+ set_layout->binding[b].immutable_samplers_equal = false;
} else {
set_layout->binding[b].immutable_samplers = NULL;
}
diff --git a/src/amd/vulkan/radv_descriptor_set.h b/src/amd/vulkan/radv_descriptor_set.h
index 8849d053121..c373489ccb3 100644
--- a/src/amd/vulkan/radv_descriptor_set.h
+++ b/src/amd/vulkan/radv_descriptor_set.h
@@ -45,6 +45,7 @@ struct radv_descriptor_set_binding_layout {
/* Immutable samplers (or NULL if no immutable samplers) */
uint32_t *immutable_samplers;
+ bool immutable_samplers_equal;
};
struct radv_descriptor_set_layout {