summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-08-14 09:23:41 +1000
committerTimothy Arceri <[email protected]>2017-08-24 11:18:48 +1000
commit4009370232f87227655f8f41949e9a56650fb1f5 (patch)
treeb0bfef2f112aab951e6afad71166e0f650c48bbf /src
parenta6618afd2740f997cc23bd75de712af6452589a7 (diff)
glsl: stop adding pointers from bindless structs to the cache
This is so we always create reproducible cache entries. Consistency is required for verification of any third party distributed shaders. Reviewed-by: Samuel Pitoiset <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/shader_cache.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index aa63bdcf012..aa6c067d041 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -1219,18 +1219,20 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader)
blob_write_bytes(metadata, glprog->sh.ImageUnits,
sizeof(glprog->sh.ImageUnits));
+ size_t ptr_size = sizeof(GLvoid *);
+
blob_write_uint32(metadata, glprog->sh.NumBindlessSamplers);
blob_write_uint32(metadata, glprog->sh.HasBoundBindlessSampler);
for (i = 0; i < glprog->sh.NumBindlessSamplers; i++) {
blob_write_bytes(metadata, &glprog->sh.BindlessSamplers[i],
- sizeof(struct gl_bindless_sampler));
+ sizeof(struct gl_bindless_sampler) - ptr_size);
}
blob_write_uint32(metadata, glprog->sh.NumBindlessImages);
blob_write_uint32(metadata, glprog->sh.HasBoundBindlessImage);
for (i = 0; i < glprog->sh.NumBindlessImages; i++) {
blob_write_bytes(metadata, &glprog->sh.BindlessImages[i],
- sizeof(struct gl_bindless_image));
+ sizeof(struct gl_bindless_image) - ptr_size);
}
write_shader_parameters(metadata, glprog->Parameters);
@@ -1258,6 +1260,8 @@ read_shader_metadata(struct blob_reader *metadata,
blob_copy_bytes(metadata, (uint8_t *) glprog->sh.ImageUnits,
sizeof(glprog->sh.ImageUnits));
+ size_t ptr_size = sizeof(GLvoid *);
+
glprog->sh.NumBindlessSamplers = blob_read_uint32(metadata);
glprog->sh.HasBoundBindlessSampler = blob_read_uint32(metadata);
if (glprog->sh.NumBindlessSamplers > 0) {
@@ -1267,7 +1271,7 @@ read_shader_metadata(struct blob_reader *metadata,
for (i = 0; i < glprog->sh.NumBindlessSamplers; i++) {
blob_copy_bytes(metadata, (uint8_t *) &glprog->sh.BindlessSamplers[i],
- sizeof(struct gl_bindless_sampler));
+ sizeof(struct gl_bindless_sampler) - ptr_size);
}
}
@@ -1280,7 +1284,7 @@ read_shader_metadata(struct blob_reader *metadata,
for (i = 0; i < glprog->sh.NumBindlessImages; i++) {
blob_copy_bytes(metadata, (uint8_t *) &glprog->sh.BindlessImages[i],
- sizeof(struct gl_bindless_image));
+ sizeof(struct gl_bindless_image) - ptr_size);
}
}