summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2019-08-30 10:30:00 +1000
committerDave Airlie <[email protected]>2019-10-11 00:32:15 +0000
commit1e65757f4e8283f136924f7594485ea4440c7e78 (patch)
treec32b0efd2d4f43bc6aeea688884805ee92cd594a /src
parent5084e9785b805108fad3a64cf8741d8d83f9b52c (diff)
gallivm/sample: add gather component selection to the key.
This allows for component selection to work as per ARB_gpu_shader5/GLES3.1 Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample.h3
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
index 8509179d08f..0e4d95623c8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h
@@ -96,6 +96,8 @@ enum lp_sampler_op_type {
#define LP_SAMPLER_LOD_CONTROL_MASK (3 << 4)
#define LP_SAMPLER_LOD_PROPERTY_SHIFT 6
#define LP_SAMPLER_LOD_PROPERTY_MASK (3 << 6)
+#define LP_SAMPLER_GATHER_COMP_SHIFT 8
+#define LP_SAMPLER_GATHER_COMP_MASK (3 << 8)
struct lp_sampler_params
{
@@ -345,6 +347,7 @@ struct lp_build_sample_context
/** number of lod values (valid are 1, length/4, length) */
unsigned num_lods;
+ unsigned gather_comp;
boolean no_quad_lod;
boolean no_brilinear;
boolean no_rho_approx;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 48d98bb617a..964818bebed 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -1033,6 +1033,17 @@ lp_build_sample_image_linear(struct lp_build_sample_context *bld,
boolean seamless_cube_filter, accurate_cube_corners;
unsigned chan_swiz = bld->static_texture_state->swizzle_r;
+ if (is_gather) {
+ switch (bld->gather_comp) {
+ case 0: chan_swiz = bld->static_texture_state->swizzle_r; break;
+ case 1: chan_swiz = bld->static_texture_state->swizzle_g; break;
+ case 2: chan_swiz = bld->static_texture_state->swizzle_b; break;
+ case 3: chan_swiz = bld->static_texture_state->swizzle_a; break;
+ default:
+ break;
+ }
+ }
+
seamless_cube_filter = (bld->static_texture_state->target == PIPE_TEXTURE_CUBE ||
bld->static_texture_state->target == PIPE_TEXTURE_CUBE_ARRAY) &&
bld->static_sampler_state->seamless_cube_map;
@@ -2978,7 +2989,8 @@ lp_build_sample_soa_code(struct gallivm_state *gallivm,
bld.num_lods = num_quads;
}
-
+ if (op_is_gather)
+ bld.gather_comp = (sample_key & LP_SAMPLER_GATHER_COMP_MASK) >> LP_SAMPLER_GATHER_COMP_SHIFT;
bld.lodf_type = type;
/* we want native vector size to be able to use our intrinsics */
if (bld.num_lods != type.length) {