summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-04-03 14:22:16 -0400
committerMarek Olšák <[email protected]>2019-04-04 19:28:52 -0400
commit4e1e8f684bf57df90afd60b460d65d9c09ab0d08 (patch)
tree1b331853a3919a1ce4728217b68fb8889fd82664 /src/compiler
parent66a82ec6f0fa3586fecee001da6bae1fc33f12d1 (diff)
glsl: remember which SSBOs are not read-only and pass it to gallium
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp11
-rw-r--r--src/compiler/glsl/serialize.cpp2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index 8ca140dcaa8..ef124111991 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -504,6 +504,7 @@ public:
this->next_bindless_image = 0;
free(this->bindless_access);
this->bindless_access = NULL;
+ this->shader_storage_blocks_write_access = 0;
}
void set_and_process(ir_variable *var)
@@ -542,6 +543,10 @@ public:
}
assert(buffer_block_index != -1);
+ if (var->is_in_shader_storage_block() &&
+ !var->data.memory_read_only)
+ shader_storage_blocks_write_access |= 1 << buffer_block_index;
+
/* Uniform blocks that were specified with an instance name must be
* handled a little bit differently. The name of the variable is the
* name used to reference the uniform block instead of being the name
@@ -1021,6 +1026,10 @@ public:
*/
GLenum *bindless_access;
+ /**
+ * Bitmask of shader storage blocks not declared as read-only.
+ */
+ unsigned shader_storage_blocks_write_access;
};
static bool
@@ -1382,6 +1391,8 @@ link_assign_uniform_storage(struct gl_context *ctx,
shader->Program->SamplersUsed = parcel.shader_samplers_used;
shader->shadow_samplers = parcel.shader_shadow_samplers;
+ shader->Program->sh.ShaderStorageBlocksWriteAccess =
+ parcel.shader_storage_blocks_write_access;
if (parcel.num_bindless_samplers > 0) {
shader->Program->sh.NumBindlessSamplers = parcel.num_bindless_samplers;
diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp
index ad258f8bcb1..47e535842fa 100644
--- a/src/compiler/glsl/serialize.cpp
+++ b/src/compiler/glsl/serialize.cpp
@@ -1065,6 +1065,7 @@ write_shader_metadata(struct blob *metadata, gl_linked_shader *shader)
sizeof(glprog->sh.SamplerTargets));
blob_write_uint32(metadata, glprog->ShadowSamplers);
blob_write_uint32(metadata, glprog->ExternalSamplersUsed);
+ blob_write_uint32(metadata, glprog->sh.ShaderStorageBlocksWriteAccess);
blob_write_bytes(metadata, glprog->sh.ImageAccess,
sizeof(glprog->sh.ImageAccess));
@@ -1119,6 +1120,7 @@ read_shader_metadata(struct blob_reader *metadata,
sizeof(glprog->sh.SamplerTargets));
glprog->ShadowSamplers = blob_read_uint32(metadata);
glprog->ExternalSamplersUsed = blob_read_uint32(metadata);
+ glprog->sh.ShaderStorageBlocksWriteAccess = blob_read_uint32(metadata);
blob_copy_bytes(metadata, (uint8_t *) glprog->sh.ImageAccess,
sizeof(glprog->sh.ImageAccess));