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)
}
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
*/
GLenum *bindless_access;
+ /**
+ * Bitmask of shader storage blocks not declared as read-only.
+ */
+ unsigned shader_storage_blocks_write_access;
};
static bool
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;
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));
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));
struct gl_uniform_block **UniformBlocks;
struct gl_uniform_block **ShaderStorageBlocks;
+ /**
+ * Bitmask of shader storage blocks not declared as read-only.
+ */
+ unsigned ShaderStorageBlocksWriteAccess;
+
/** Which texture target is being sampled
* (TEXTURE_1D/2D/3D/etc_INDEX)
*/
}
}
st->pipe->set_shader_buffers(st->pipe, shader_type, buffer_base,
- prog->info.num_ssbos, buffers, ~0);
+ prog->info.num_ssbos, buffers,
+ prog->sh.ShaderStorageBlocksWriteAccess);
/* clear out any stale shader buffers */
if (prog->info.num_ssbos < c->MaxShaderStorageBlocks)
st->pipe->set_shader_buffers(