aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_tex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir/nir_lower_tex.c')
-rw-r--r--src/compiler/nir/nir_lower_tex.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index c16a32f54e8..e10d4ea62f6 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -348,6 +348,20 @@ lower_xy_uxvx_external(nir_builder *b, nir_tex_instr *tex)
nir_imm_float(b, 1.0f));
}
+static void
+lower_ayuv_external(nir_builder *b, nir_tex_instr *tex)
+{
+ b->cursor = nir_after_instr(&tex->instr);
+
+ nir_ssa_def *ayuv = sample_plane(b, tex, 0);
+
+ convert_yuv_to_rgb(b, tex,
+ nir_channel(b, ayuv, 2),
+ nir_channel(b, ayuv, 1),
+ nir_channel(b, ayuv, 0),
+ nir_channel(b, ayuv, 3));
+}
+
/*
* Emits a textureLod operation used to replace an existing
* textureGrad instruction.
@@ -793,6 +807,11 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
progress = true;
}
+ if ((1 << tex->texture_index) & options->lower_ayuv_external) {
+ lower_ayuv_external(b, tex);
+ progress = true;
+ }
+
if (sat_mask) {
saturate_src(b, tex, sat_mask);
progress = true;