mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-16 08:58:30 +02:00
llvmpipe: fix incorrect image 64bit fetch return value type
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38316>
This commit is contained in:
parent
d1421e3a1c
commit
9fcbaf5d89
4 changed files with 32 additions and 17 deletions
|
|
@ -449,6 +449,10 @@ lp_bld_llvm_image_soa_emit_op(const struct lp_build_image_soa *base,
|
|||
{
|
||||
LLVMBuilderRef builder = gallivm->builder;
|
||||
|
||||
uint32_t flags = params->packed_op / LP_IMAGE_OP_COUNT;
|
||||
bool ms = flags & LP_IMAGE_OP_MS;
|
||||
bool is64 = flags & LP_IMAGE_OP_64;
|
||||
|
||||
if (params->resource) {
|
||||
const struct util_format_description *desc = util_format_description(params->format);
|
||||
struct lp_type texel_type = lp_build_texel_type(params->type, desc);
|
||||
|
|
@ -480,10 +484,6 @@ lp_bld_llvm_image_soa_emit_op(const struct lp_build_image_soa *base,
|
|||
gallivm, params->resource, offsetof(struct lp_descriptor, functions),
|
||||
offsetof(struct lp_texture_functions, image_functions));
|
||||
|
||||
uint32_t flags = params->packed_op / LP_IMAGE_OP_COUNT;
|
||||
bool ms = flags & LP_IMAGE_OP_MS;
|
||||
bool is64 = flags & LP_IMAGE_OP_64;
|
||||
|
||||
LLVMTypeRef image_function_type = lp_build_image_function_type(gallivm, params, ms, is64);
|
||||
LLVMTypeRef image_function_ptr_type = LLVMPointerType(image_function_type, 0);
|
||||
LLVMTypeRef image_functions_type = LLVMPointerType(image_function_ptr_type, 0);
|
||||
|
|
@ -578,13 +578,13 @@ lp_bld_llvm_image_soa_emit_op(const struct lp_build_image_soa *base,
|
|||
for (unsigned i = 0; i < image->nr_images; i++) {
|
||||
lp_build_image_op_array_case(&switch_info, i,
|
||||
&image->dynamic_state.static_state[i].image_state,
|
||||
&image->dynamic_state.base);
|
||||
&image->dynamic_state.base, is64);
|
||||
}
|
||||
lp_build_image_op_array_fini_soa(&switch_info);
|
||||
} else {
|
||||
lp_build_img_op_soa(&image->dynamic_state.static_state[image_index].image_state,
|
||||
&image->dynamic_state.base,
|
||||
gallivm, params, params->outdata);
|
||||
gallivm, params, is64, params->outdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -862,6 +862,7 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
|
|||
struct lp_sampler_dynamic_state *dynamic_state,
|
||||
struct gallivm_state *gallivm,
|
||||
const struct lp_img_params *params,
|
||||
bool is64,
|
||||
LLVMValueRef *outdata);
|
||||
|
||||
void
|
||||
|
|
@ -892,7 +893,8 @@ void
|
|||
lp_build_image_op_array_case(struct lp_build_img_op_array_switch *switch_info,
|
||||
int idx,
|
||||
const struct lp_static_texture_state *static_texture_state,
|
||||
struct lp_sampler_dynamic_state *dynamic_state);
|
||||
struct lp_sampler_dynamic_state *dynamic_state,
|
||||
bool is64);
|
||||
|
||||
void
|
||||
lp_build_image_op_array_fini_soa(struct lp_build_img_op_array_switch *switch_info);
|
||||
|
|
|
|||
|
|
@ -4641,18 +4641,28 @@ lp_build_do_atomic_soa(struct gallivm_state *gallivm,
|
|||
static void
|
||||
lp_build_img_op_no_format(struct gallivm_state *gallivm,
|
||||
const struct lp_img_params *params,
|
||||
bool is64,
|
||||
LLVMValueRef outdata[4])
|
||||
{
|
||||
/*
|
||||
* If there's nothing bound, format is NONE, and we must return
|
||||
* all zero as mandated by d3d10 in this case.
|
||||
*/
|
||||
if (params->img_op != LP_IMG_STORE) {
|
||||
LLVMValueRef zero = lp_build_zero(gallivm, params->type);
|
||||
for (unsigned chan = 0; chan < (params->img_op == LP_IMG_LOAD ? 4 : 1);
|
||||
chan++) {
|
||||
outdata[chan] = zero;
|
||||
}
|
||||
if (params->img_op == LP_IMG_STORE) {
|
||||
return;
|
||||
}
|
||||
|
||||
enum pipe_format format = params->format;
|
||||
if (is64 && format == PIPE_FORMAT_NONE)
|
||||
format = PIPE_FORMAT_R64G64B64A64_UINT;
|
||||
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
const struct lp_type component_type = lp_build_texel_type(params->type, desc);
|
||||
|
||||
LLVMValueRef zero = lp_build_zero(gallivm, component_type);
|
||||
for (unsigned chan = 0; chan < (params->img_op == LP_IMG_LOAD ? 4 : 1);
|
||||
chan++) {
|
||||
outdata[chan] = zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4662,6 +4672,7 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
|
|||
struct lp_sampler_dynamic_state *dynamic_state,
|
||||
struct gallivm_state *gallivm,
|
||||
const struct lp_img_params *params,
|
||||
bool is64,
|
||||
LLVMValueRef *outdata)
|
||||
{
|
||||
const enum pipe_texture_target target = params->target;
|
||||
|
|
@ -4680,7 +4691,7 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
|
|||
lp_build_context_init(&int_coord_bld, gallivm, int_coord_type);
|
||||
|
||||
if (static_texture_state->format == PIPE_FORMAT_NONE) {
|
||||
lp_build_img_op_no_format(gallivm, params, outdata);
|
||||
lp_build_img_op_no_format(gallivm, params, is64, outdata);
|
||||
return;
|
||||
|
||||
}
|
||||
|
|
@ -4968,7 +4979,8 @@ void
|
|||
lp_build_image_op_array_case(struct lp_build_img_op_array_switch *switch_info,
|
||||
int idx,
|
||||
const struct lp_static_texture_state *static_texture_state,
|
||||
struct lp_sampler_dynamic_state *dynamic_state)
|
||||
struct lp_sampler_dynamic_state *dynamic_state,
|
||||
bool is64)
|
||||
{
|
||||
struct gallivm_state *gallivm = switch_info->gallivm;
|
||||
LLVMBasicBlockRef this_block = lp_build_insert_new_block(gallivm, "img");
|
||||
|
|
@ -4981,7 +4993,8 @@ lp_build_image_op_array_case(struct lp_build_img_op_array_switch *switch_info,
|
|||
switch_info->params.image_index = idx;
|
||||
|
||||
lp_build_img_op_soa(static_texture_state, dynamic_state,
|
||||
switch_info->gallivm, &switch_info->params, tex_ret);
|
||||
switch_info->gallivm, &switch_info->params, is64,
|
||||
tex_ret);
|
||||
|
||||
if (switch_info->params.img_op != LP_IMG_STORE) {
|
||||
for (unsigned i = 0;
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ compile_image_function(struct llvmpipe_context *ctx, struct lp_static_texture_st
|
|||
LLVMPositionBuilderAtEnd(gallivm->builder, block);
|
||||
|
||||
LLVMValueRef outdata[5] = { 0 };
|
||||
lp_build_img_op_soa(&local_texture, lp_build_image_soa_dynamic_state(image_soa), gallivm, ¶ms, outdata);
|
||||
lp_build_img_op_soa(&local_texture, lp_build_image_soa_dynamic_state(image_soa), gallivm, ¶ms, is64, outdata);
|
||||
|
||||
for (uint32_t i = 1; i < 4; i++)
|
||||
if (!outdata[i])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue