aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-06-16 17:18:36 +1000
committerMarge Bot <[email protected]>2020-07-02 04:12:17 +0000
commitbc1ac7dc3f36ee8a0f5741ea01767dcfe18a22cc (patch)
tree724649f0eef7130b619167c59aafb9bd2116529a /src/gallium/auxiliary
parent6e25a5a3756546b49bfaf53a2b16cc9b6d313928 (diff)
gallivm/img: refactor out the texel return type (v2)
v2: refactor to just pass type as pointed out by Roland. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3778>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index a852490f041..b6af6015d80 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -4110,6 +4110,22 @@ lp_build_img_op_no_format(struct gallivm_state *gallivm,
}
}
+static struct lp_type
+lp_build_img_texel_type(struct gallivm_state *gallivm,
+ struct lp_type texel_type,
+ const struct util_format_description *format_desc)
+{
+ if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB &&
+ format_desc->channel[0].pure_integer) {
+ if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
+ texel_type = lp_type_int_vec(texel_type.width, texel_type.width * texel_type.length);
+ } else if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) {
+ texel_type = lp_type_uint_vec(texel_type.width, texel_type.width * texel_type.length);
+ }
+ }
+ return texel_type;
+}
+
void
lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
struct lp_sampler_dynamic_state *dynamic_state,
@@ -4196,15 +4212,7 @@ lp_build_img_op_soa(const struct lp_static_texture_state *static_texture_state,
ms_index));
}
if (params->img_op == LP_IMG_LOAD) {
- struct lp_type texel_type = params->type;
- if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB &&
- format_desc->channel[0].pure_integer) {
- if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_SIGNED) {
- texel_type = lp_type_int_vec(params->type.width, params->type.width * params->type.length);
- } else if (format_desc->channel[0].type == UTIL_FORMAT_TYPE_UNSIGNED) {
- texel_type = lp_type_uint_vec(params->type.width, params->type.width * params->type.length);
- }
- }
+ struct lp_type texel_type = lp_build_img_texel_type(gallivm, params->type, format_desc);
offset = lp_build_andnot(&int_coord_bld, offset, out_of_bounds);
struct lp_build_context texel_bld;