[Mesa-dev] [PATCH 02/10] radeonsi: fix instanced arrays with non-zero start instance
Marek Olšák
maraeo at gmail.com
Sun Feb 1 09:36:59 PST 2015
From: Marek Olšák <marek.olsak at amd.com>
Fixes piglit ARB_base_instance/arb_base_instance-drawarrays.
Cc: 10.3 10.4 <mesa-stable at lists.freedesktop.org>
---
src/gallium/drivers/radeonsi/si_shader.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index fb1419d..4b1279c 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -236,14 +236,14 @@ static LLVMValueRef get_instance_index_for_fetch(
LLVMValueRef result = LLVMGetParam(radeon_bld->main_fn,
si_shader_ctx->param_instance_id);
- result = LLVMBuildAdd(gallivm->builder, result, LLVMGetParam(
- radeon_bld->main_fn, SI_PARAM_START_INSTANCE), "");
+ /* The division must be done before START_INSTANCE is added. */
if (divisor > 1)
result = LLVMBuildUDiv(gallivm->builder, result,
lp_build_const_int32(gallivm, divisor), "");
- return result;
+ return LLVMBuildAdd(gallivm->builder, result, LLVMGetParam(
+ radeon_bld->main_fn, SI_PARAM_START_INSTANCE), "");
}
static void declare_input_vs(
--
2.1.0
More information about the mesa-dev
mailing list