[Mesa-dev] [PATCH 4/6] radeonsi: stop big offsets from hanging the GPU

Christian König deathsimple at vodafone.de
Thu Aug 30 10:00:48 PDT 2012


Signed-off-by: Christian König <deathsimple at vodafone.de>
---
 src/gallium/drivers/radeonsi/radeonsi_shader.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index e89ca7d..fc1e890 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 127 are currently not supported */
+	if (idx > 127) {
+		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);
-- 
1.7.9.5



More information about the mesa-dev mailing list