summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-09-05 15:39:57 +0200
committerMarek Olšák <[email protected]>2013-09-13 01:08:03 +0200
commitf317ce5c5d339b380e3f6740c167e082a3da752e (patch)
tree8bd0ee90d35d1946188a7a5cfdc5b30c78f9b5a6
parent9c75d2f65b5cb18a25c95fb139361402d17db807 (diff)
radeonsi: fix gl_InstanceID with non-zero start_instance
start_instance doesn't affect gl_InstanceID. There's no piglit test, but it's kinda obvious the code was wrong. Reviewed-by: Christian König <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 80dd773c10c..867a38598db 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -122,7 +122,7 @@ static LLVMValueRef build_indexed_load(
return result;
}
-static LLVMValueRef get_instance_index(
+static LLVMValueRef get_instance_index_for_fetch(
struct radeon_llvm_context * radeon_bld,
unsigned divisor)
{
@@ -174,7 +174,7 @@ static void declare_input_vs(
if (divisor) {
/* Build index from instance ID, start instance and divisor */
si_shader_ctx->shader->shader.uses_instanceid = true;
- buffer_index = get_instance_index(&si_shader_ctx->radeon_bld, divisor);
+ buffer_index = get_instance_index_for_fetch(&si_shader_ctx->radeon_bld, divisor);
} else {
/* Load the buffer index, which is always stored in VGPR0
* for Vertex Shaders */
@@ -414,7 +414,8 @@ static void declare_system_value(
switch (decl->Semantic.Name) {
case TGSI_SEMANTIC_INSTANCEID:
- value = get_instance_index(radeon_bld, 1);
+ value = LLVMGetParam(radeon_bld->main_fn,
+ si_shader_ctx->param_instance_id);
break;
case TGSI_SEMANTIC_VERTEXID: