radeonsi: add an assertion that only two-dimensional constant references are used
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 23 Aug 2017 16:14:32 +0000 (18:14 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 4 Sep 2017 11:44:09 +0000 (13:44 +0200)
v2: remove some redundant checks

Acked-by: Roland Scheidegger <sroland@vmware.com> (v1)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> (v1)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeonsi/si_shader.c

index 450676c597f777ffc3ae2c4c4b06a898115d6ba7..0e89ccac09db902f4d1a55fb72f308a0f6120233 100644 (file)
@@ -1851,10 +1851,11 @@ static LLVMValueRef fetch_constant(
                return lp_build_gather_values(&ctx->gallivm, values, 4);
        }
 
-       buf = reg->Register.Dimension ? reg->Dimension.Index : 0;
+       assert(reg->Register.Dimension);
+       buf = reg->Dimension.Index;
        idx = reg->Register.Index * 4 + swizzle;
 
-       if (reg->Register.Dimension && reg->Dimension.Indirect) {
+       if (reg->Dimension.Indirect) {
                LLVMValueRef ptr = LLVMGetParam(ctx->main_fn, ctx->param_const_and_shader_buffers);
                LLVMValueRef index;
                index = si_get_bounded_indirect_index(ctx, &reg->DimIndirect,