summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/radeonsi_shader.c
diff options
context:
space:
mode:
authorChristian König <[email protected]>2013-03-21 18:30:23 +0100
committerChristian König <[email protected]>2013-04-02 13:01:43 +0200
commitcf9b31f78a545ede480c2dc25937a07a96cf6656 (patch)
tree1588dee47b989df76d6f876087a473dadf40e038 /src/gallium/drivers/radeonsi/radeonsi_shader.c
parente4ed58763ab6e948a20d6e66a54d10466dd0c4cc (diff)
radeonsi: add start instance support
This works different than on R600, we need to add the start instance manually. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Tested-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_shader.c')
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 62f478e1300..05125289a1f 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -351,11 +351,15 @@ static void declare_system_value(
unsigned index,
const struct tgsi_full_declaration *decl)
{
+ struct gallivm_state * gallivm = radeon_bld->soa.bld_base.base.gallivm;
+
LLVMValueRef value = 0;
switch (decl->Semantic.Name) {
case TGSI_SEMANTIC_INSTANCEID:
value = LLVMGetParam(radeon_bld->main_fn, SI_PARAM_INSTANCE_ID);
+ value = LLVMBuildAdd(gallivm->builder, value,
+ LLVMGetParam(radeon_bld->main_fn, SI_PARAM_START_INSTANCE), "");
break;
case TGSI_SEMANTIC_VERTEXID:
@@ -963,11 +967,12 @@ static void create_function(struct si_shader_context *si_shader_ctx)
if (si_shader_ctx->type == TGSI_PROCESSOR_VERTEX) {
params[SI_PARAM_VERTEX_BUFFER] = params[SI_PARAM_SAMPLER];
+ params[SI_PARAM_START_INSTANCE] = i32;
params[SI_PARAM_VERTEX_ID] = i32;
params[SI_PARAM_DUMMY_0] = i32;
params[SI_PARAM_DUMMY_1] = i32;
params[SI_PARAM_INSTANCE_ID] = i32;
- radeon_llvm_create_func(&si_shader_ctx->radeon_bld, params, 8);
+ radeon_llvm_create_func(&si_shader_ctx->radeon_bld, params, 9);
} else {
params[SI_PARAM_PRIM_MASK] = i32;
@@ -995,6 +1000,12 @@ static void create_function(struct si_shader_context *si_shader_ctx)
LLVMValueRef P = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn, i);
LLVMAddAttribute(P, LLVMInRegAttribute);
}
+
+ if (si_shader_ctx->type == TGSI_PROCESSOR_VERTEX) {
+ LLVMValueRef P = LLVMGetParam(si_shader_ctx->radeon_bld.main_fn,
+ SI_PARAM_START_INSTANCE);
+ LLVMAddAttribute(P, LLVMInRegAttribute);
+ }
}
static void preload_constants(struct si_shader_context *si_shader_ctx)