diff options
author | Samuel Pitoiset <[email protected]> | 2017-05-11 17:26:49 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-06-14 10:04:36 +0200 |
commit | 9e756de7d19307044c9b4a08b285836fbe128589 (patch) | |
tree | 5f3487297525d20c3fdcf3ae92905e65fb247df1 /src/compiler/glsl/shader_cache.cpp | |
parent | 444b703a88f8a9c6487db278e8e4331e9fb87d12 (diff) |
glsl: process uniform samplers declared bindless
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/compiler/glsl/shader_cache.cpp')
-rw-r--r-- | src/compiler/glsl/shader_cache.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 1ad8fdd62a4..8220c85f276 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -1129,6 +1129,7 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader) { assert(shader->Program); struct gl_program *glprog = shader->Program; + unsigned i; blob_write_bytes(metadata, glprog->TexturesUsed, sizeof(glprog->TexturesUsed)); @@ -1145,6 +1146,13 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader) blob_write_bytes(metadata, glprog->sh.ImageUnits, sizeof(glprog->sh.ImageUnits)); + 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)); + } + write_shader_parameters(metadata, glprog->Parameters); } @@ -1153,6 +1161,8 @@ read_shader_metadata(struct blob_reader *metadata, struct gl_program *glprog, gl_linked_shader *linked) { + unsigned i; + blob_copy_bytes(metadata, (uint8_t *) glprog->TexturesUsed, sizeof(glprog->TexturesUsed)); glprog->SamplersUsed = blob_read_uint64(metadata); @@ -1168,6 +1178,19 @@ read_shader_metadata(struct blob_reader *metadata, blob_copy_bytes(metadata, (uint8_t *) glprog->sh.ImageUnits, sizeof(glprog->sh.ImageUnits)); + glprog->sh.NumBindlessSamplers = blob_read_uint32(metadata); + glprog->sh.HasBoundBindlessSampler = blob_read_uint32(metadata); + if (glprog->sh.NumBindlessSamplers > 0) { + glprog->sh.BindlessSamplers = + rzalloc_array(glprog, gl_bindless_sampler, + glprog->sh.NumBindlessSamplers); + + for (i = 0; i < glprog->sh.NumBindlessSamplers; i++) { + blob_copy_bytes(metadata, (uint8_t *) &glprog->sh.BindlessSamplers[i], + sizeof(struct gl_bindless_sampler)); + } + } + glprog->Parameters = _mesa_new_parameter_list(); read_shader_parameters(metadata, glprog->Parameters); } |