Module: Mesa Branch: main Commit: 344fa0895ee8ca2daa6c38b9f2157eb7830722e3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=344fa0895ee8ca2daa6c38b9f2157eb7830722e3
Author: Dave Airlie <airl...@redhat.com> Date: Wed Sep 27 15:55:17 2023 +1000 gallivm/lp: reduce image descriptor size. Reduce the image descriptor size alongside the texture one. Reviewed-by: Roland Scheidegger <srol...@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25398> --- src/gallium/auxiliary/gallivm/lp_bld_jit_types.c | 6 +++--- src/gallium/auxiliary/gallivm/lp_bld_jit_types.h | 6 +++--- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_jit_types.c b/src/gallium/auxiliary/gallivm/lp_bld_jit_types.c index fd5534165c8..e819c82aada 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_jit_types.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_jit_types.c @@ -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, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_jit_types.h b/src/gallium/auxiliary/gallivm/lp_bld_jit_types.h index 33d9fb207a5..dd768209555 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_jit_types.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_jit_types.h @@ -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; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 64aa9738865..66ebe6ba951 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -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,