summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2015-05-06 08:11:02 +0200
committerSamuel Iglesias Gonsalvez <[email protected]>2015-09-25 08:39:23 +0200
commit9b477ad49d3f82503a1b8ba23dedfc05cd848fe8 (patch)
treeb446e9e00b8ed22c73d6b80a0e152fd4dd491b7f /src/glsl
parent0f18945cb612493d787377d8cbb138c18738f683 (diff)
main: Add SHADER_STORAGE_BLOCK and BUFFER_VARIABLE support for ARB_program_interface_query
Including TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE queries. v2: - Use std430_array_stride() to get top level array stride following std430's rules. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/ir_uniform.h5
-rw-r--r--src/glsl/link_uniforms.cpp3
-rw-r--r--src/glsl/linker.cpp10
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;
}