Module: Mesa
Branch: master
Commit: da2b841798bd9378b62fe750c5d499a2258494e4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da2b841798bd9378b62fe750c5d499a2258494e4

Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Nov  5 10:44:03 2020 -0500

zink: properly handle null bufferview descriptor states

now that we have this state properly stored we can use it for more accurate
hashing and caching

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>

---

 src/gallium/drivers/zink/zink_context.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index 3db132187e6..7296694f019 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -117,7 +117,10 @@ calc_descriptor_state_hash_sampler(struct zink_context 
*ctx, struct zink_shader
    for (unsigned k = 0; k < 
zs->bindings[ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW][i].size; k++) {
       struct zink_sampler_view *sampler_view = 
zink_sampler_view(ctx->sampler_views[shader][idx + k]);
       if (!sampler_view) {
-         hash = XXH32(&screen->null_descriptor_hashes.image_view, 
sizeof(uint32_t), hash);
+         uint32_t val = 
zs->bindings[ZINK_DESCRIPTOR_TYPE_SAMPLER_VIEW][i].type == 
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ?
+                        screen->null_descriptor_hashes.buffer_view :
+                        screen->null_descriptor_hashes.image_view;
+         hash = XXH32(&val, sizeof(uint32_t), hash);
          continue;
       }
       uint32_t sv_hash = get_sampler_view_hash(sampler_view);
@@ -136,15 +139,13 @@ calc_descriptor_state_hash_sampler(struct zink_context 
*ctx, struct zink_shader
 static uint32_t
 calc_descriptor_state_hash_image(struct zink_context *ctx, struct zink_shader 
*zs, enum pipe_shader_type shader, int i, int idx, uint32_t hash)
 {
-   void *hash_data;
-   size_t data_size;
-
    for (unsigned k = 0; k < zs->bindings[ZINK_DESCRIPTOR_TYPE_IMAGE][i].size; 
k++) {
       if (!get_resource_for_descriptor(ctx, ZINK_DESCRIPTOR_TYPE_IMAGE, 
shader, idx + k)) {
-         VkDescriptorImageInfo null_info = {0};
-         hash_data = &null_info;
-         data_size = sizeof(VkDescriptorImageInfo);
-         hash = XXH32(hash_data, data_size, hash);
+         struct zink_screen *screen = zink_screen(ctx->base.screen);
+         uint32_t val = zs->bindings[ZINK_DESCRIPTOR_TYPE_IMAGE][i].type == 
VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER ?
+                        screen->null_descriptor_hashes.buffer_view :
+                        screen->null_descriptor_hashes.image_view;
+         hash = XXH32(&val, sizeof(uint32_t), hash);
          break;
       }
       uint32_t iv_hash = get_image_view_hash(&ctx->image_views[shader][idx + 
k]);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to