gallivm/lp: reduce image descriptor size.

Reduce the image descriptor size alongside the texture one.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25398>
This commit is contained in:
Dave Airlie 2023-09-27 15:55:17 +10:00 committed by Marge Bot
parent 749a4fff86
commit 344fa0895e
3 changed files with 12 additions and 6 deletions

View file

@ -242,13 +242,13 @@ lp_build_create_jit_image_type(struct gallivm_state *gallivm)
LLVMContextRef lc = gallivm->context;
LLVMTypeRef image_type;
LLVMTypeRef elem_types[LP_JIT_IMAGE_NUM_FIELDS];
elem_types[LP_JIT_IMAGE_WIDTH] =
elem_types[LP_JIT_IMAGE_WIDTH] = LLVMInt32TypeInContext(lc);
elem_types[LP_JIT_IMAGE_HEIGHT] =
elem_types[LP_JIT_IMAGE_DEPTH] = LLVMInt32TypeInContext(lc);
elem_types[LP_JIT_IMAGE_DEPTH] = LLVMInt16TypeInContext(lc);
elem_types[LP_JIT_IMAGE_NUM_SAMPLES] = LLVMInt8TypeInContext(lc);
elem_types[LP_JIT_IMAGE_BASE] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
elem_types[LP_JIT_IMAGE_ROW_STRIDE] =
elem_types[LP_JIT_IMAGE_IMG_STRIDE] =
elem_types[LP_JIT_IMAGE_NUM_SAMPLES] =
elem_types[LP_JIT_IMAGE_SAMPLE_STRIDE] = LLVMInt32TypeInContext(lc);
image_type = LLVMStructTypeInContext(lc, elem_types,

View file

@ -112,9 +112,9 @@ struct lp_jit_image
{
const void *base;
uint32_t width; /* same as number of elements */
uint32_t height;
uint32_t depth;
uint32_t num_samples;
uint16_t height;
uint16_t depth;
uint8_t num_samples;
uint32_t sample_stride;
uint32_t row_stride;
uint32_t img_stride;

View file

@ -4921,10 +4921,14 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
params->resources_type,
params->resources_ptr,
params->image_index, NULL);
height = LLVMBuildZExt(gallivm->builder, height,
int_coord_bld.elem_type, "");
LLVMValueRef depth = dynamic_state->depth(gallivm,
params->resources_type,
params->resources_ptr,
params->image_index, NULL);
depth = LLVMBuildZExt(gallivm->builder, depth,
int_coord_bld.elem_type, "");
bool layer_coord = has_layer_coord(target);
width = lp_build_scale_view_dim(gallivm, width, res_format_desc->block.width,
@ -4965,6 +4969,8 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
params->resources_type,
params->resources_ptr,
params->image_index, NULL);
num_samples = LLVMBuildZExt(gallivm->builder, num_samples,
int_coord_bld.elem_type, "");
LLVMValueRef sample_stride = dynamic_state->sample_stride(gallivm,
params->resources_type,
params->resources_ptr,