1
1

GLShaderInterface: Fix SSBO using the ubo mask

This might head lead to a crash when a shader uses both ubo and ssbo.
This commit is contained in:
2022-02-05 13:22:30 +01:00
parent 835dd95046
commit e5af6a0d0f
2 changed files with 3 additions and 1 deletions

View File

@@ -68,6 +68,7 @@ class ShaderInterface {
uint16_t enabled_ubo_mask_ = 0;
uint8_t enabled_ima_mask_ = 0;
uint64_t enabled_tex_mask_ = 0;
uint16_t enabled_ssbo_mask_ = 0;
/** Location of builtin uniforms. Fast access, no lookup needed. */
int32_t builtins_[GPU_NUM_UNIFORMS];
int32_t builtin_blocks_[GPU_NUM_UNIFORM_BLOCKS];

View File

@@ -319,6 +319,7 @@ GLShaderInterface::GLShaderInterface(GLuint program)
input->binding = input->location = binding;
name_buffer_offset += this->set_input_name(input, name, name_len);
enabled_ssbo_mask_ |= (input->binding != -1) ? (1lu << input->binding) : 0lu;
}
/* Builtin Uniforms */
@@ -476,7 +477,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
if (res.bind_type == ShaderCreateInfo::Resource::BindType::STORAGE_BUFFER) {
copy_input_name(input, res.storagebuf.name, name_buffer_, name_buffer_offset);
input->location = input->binding = res.slot;
enabled_ubo_mask_ |= (1 << input->binding);
enabled_ssbo_mask_ |= (1 << input->binding);
input++;
}
}