From: Nicolai Hähnle <nicolai.haeh...@amd.com>

ARB_shader_ballot introduces 7 new system values that can be used
in all shader stages.
---
 src/gallium/drivers/radeonsi/si_shader.c          | 2 ++
 src/gallium/drivers/radeonsi/si_shader_internal.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 874535a..4682a8e 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1386,20 +1386,22 @@ static void declare_system_value(
        struct si_shader_context *radeon_bld,
        unsigned index,
        const struct tgsi_full_declaration *decl)
 {
        struct si_shader_context *ctx =
                si_shader_context(&radeon_bld->bld_base);
        struct lp_build_context *bld = &radeon_bld->bld_base.base;
        struct gallivm_state *gallivm = &radeon_bld->gallivm;
        LLVMValueRef value = 0;
 
+       assert(index < RADEON_LLVM_MAX_SYSTEM_VALUES);
+
        switch (decl->Semantic.Name) {
        case TGSI_SEMANTIC_INSTANCEID:
                value = LLVMGetParam(radeon_bld->main_fn,
                                     ctx->param_instance_id);
                break;
 
        case TGSI_SEMANTIC_VERTEXID:
                value = LLVMBuildAdd(gallivm->builder,
                                     LLVMGetParam(radeon_bld->main_fn,
                                                  ctx->param_vertex_id),
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h 
b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 47aeb5d..fd7deec 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -36,21 +36,21 @@
 
 struct pipe_debug_callback;
 struct ac_shader_binary;
 
 #define RADEON_LLVM_MAX_INPUT_SLOTS 32
 #define RADEON_LLVM_MAX_INPUTS 32 * 4
 #define RADEON_LLVM_MAX_OUTPUTS 32 * 4
 
 #define RADEON_LLVM_INITIAL_CF_DEPTH 4
 
-#define RADEON_LLVM_MAX_SYSTEM_VALUES 4
+#define RADEON_LLVM_MAX_SYSTEM_VALUES 11
 #define RADEON_LLVM_MAX_ADDRS 16
 
 struct si_llvm_flow;
 
 struct si_shader_context {
        struct lp_build_tgsi_context bld_base;
        struct gallivm_state gallivm;
        struct ac_llvm_context ac;
        struct si_shader *shader;
        struct si_screen *screen;
-- 
2.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to