amd/llvm: fix handling of unsupported vec3 loads on gfx6
VMEM loads promoted from vec3 to vec4 didn't trim the vector, thus
returning vec4 on gfx6 and vec3 on later generations, which callers
don't expect.
SMEM loads were adding an extra component on gfx6, causing same issues.
Fixes: 82919e2d - amd: lower subdword UBO loads in NIR
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8693
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22117>
This commit is contained in:
@@ -1330,8 +1330,11 @@ static LLVMValueRef ac_build_buffer_load_common(struct ac_llvm_context *ctx, LLV
|
||||
snprintf(name, sizeof(name), "llvm.amdgcn.%s.buffer.load.%s", indexing_kind, type_name);
|
||||
}
|
||||
|
||||
return ac_build_intrinsic(ctx, name, type, args, idx,
|
||||
can_speculate ? AC_ATTR_INVARIANT_LOAD : 0);
|
||||
LLVMValueRef result = ac_build_intrinsic(ctx, name, type, args, idx,
|
||||
can_speculate ? AC_ATTR_INVARIANT_LOAD : 0);
|
||||
if (func > num_channels)
|
||||
result = ac_trim_vector(ctx, result, num_channels);
|
||||
return result;
|
||||
}
|
||||
|
||||
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
||||
@@ -1369,8 +1372,6 @@ LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
||||
if (num_channels == 1)
|
||||
return result[0];
|
||||
|
||||
if (num_channels == 3 && !ac_has_vec3_support(ctx->gfx_level, false))
|
||||
result[num_channels++] = LLVMGetUndef(channel_type);
|
||||
return ac_build_gather_values(ctx, result, num_channels);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user