summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2012-08-29 10:48:01 +0200
committerChristian König <[email protected]>2012-09-04 10:51:32 +0200
commit88a4fd8fe6b47b4685e3fb5e36047d27f764703b (patch)
treeb6726f88a60e8c203cad4342a41d5e48234cfb6d
parentde7d3825a0a2e4144e0b38a0d8fef759819af64a (diff)
radeonsi: stop big offsets from hanging the GPU v2
v2: rebased of radeon/llvm fix. Signed-off-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 9734ab3ad0d..8c9214933ff 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -357,6 +357,7 @@ static LLVMValueRef fetch_constant(
unsigned swizzle)
{
struct lp_build_context * base = &bld_base->base;
+ unsigned idx;
LLVMValueRef const_ptr;
LLVMValueRef offset;
@@ -376,8 +377,14 @@ static LLVMValueRef fetch_constant(
/* XXX: This assumes that the constant buffer is not packed, so
* CONST[0].x will have an offset of 0 and CONST[1].x will have an
* offset of 4. */
- offset = lp_build_const_int32(base->gallivm,
- (reg->Register.Index * 4) + swizzle);
+ idx = (reg->Register.Index * 4) + swizzle;
+
+ /* index loads above 255 are currently not supported */
+ if (idx > 255) {
+ assert(0);
+ idx = 0;
+ }
+ offset = lp_build_const_int32(base->gallivm, idx);
load = build_indexed_load(base->gallivm, const_ptr, offset);
return bitcast(bld_base, type, load);