diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir_uniform.h | 5 | ||||
-rw-r--r-- | src/glsl/link_uniforms.cpp | 3 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 10 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h index 0b6f7201a20..858a7da6bb9 100644 --- a/src/glsl/ir_uniform.h +++ b/src/glsl/ir_uniform.h @@ -194,6 +194,11 @@ struct gl_uniform_storage { * This is a built-in uniform that should not be modified through any gl API. */ bool builtin; + + /** + * This is a shader storage buffer variable, not an uniform. + */ + bool is_shader_storage; }; #ifdef __cplusplus diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 50a80732d73..1c901e2cecb 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -794,6 +794,9 @@ private: if (!this->uniforms[id].builtin) this->uniforms[id].storage = this->values; + this->uniforms[id].is_shader_storage = + current_var->is_in_shader_storage_block(); + if (this->ubo_block_index != -1) { this->uniforms[id].block_index = this->ubo_block_index; diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index aebf2560dab..9d419ac9d39 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -3406,14 +3406,18 @@ build_program_resource_list(struct gl_shader_program *shProg) } } - if (!add_program_resource(shProg, GL_UNIFORM, + bool is_shader_storage = shProg->UniformStorage[i].is_shader_storage; + GLenum type = is_shader_storage ? GL_BUFFER_VARIABLE : GL_UNIFORM; + if (!add_program_resource(shProg, type, &shProg->UniformStorage[i], stageref)) return; } - /* Add program uniform blocks. */ + /* Add program uniform blocks and shader storage blocks. */ for (unsigned i = 0; i < shProg->NumUniformBlocks; i++) { - if (!add_program_resource(shProg, GL_UNIFORM_BLOCK, + bool is_shader_storage = shProg->UniformBlocks[i].IsShaderStorage; + GLenum type = is_shader_storage ? GL_SHADER_STORAGE_BLOCK : GL_UNIFORM_BLOCK; + if (!add_program_resource(shProg, type, &shProg->UniformBlocks[i], 0)) return; } |