diff options
author | Kasireddy, Vivek <[email protected]> | 2019-02-12 16:02:20 -0800 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2019-02-26 13:08:51 +0000 |
commit | 78fb3fd17ec8cccaa2a0072487f5a89fffd8f8e3 (patch) | |
tree | 7b7bf3d20249522b3c0c9520791f6a5d0f912a67 | |
parent | 913d711e0f3ff2a565dadc0bd994b404b3f4cbc3 (diff) |
nir/lower_tex: Add support for XYUV lowering
The memory layout associated with this format would be:
Byte: 0 1 2 3
Component: V U Y X
Signed-off-by: Vivek Kasireddy <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]>
-rw-r--r-- | src/compiler/nir/nir.h | 1 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_tex.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 190b7af7c28..3403f841939 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3058,6 +3058,7 @@ typedef struct nir_lower_tex_options { unsigned lower_yx_xuxv_external; unsigned lower_xy_uxvx_external; unsigned lower_ayuv_external; + unsigned lower_xyuv_external; /** * To emulate certain texture wrap modes, this can be used diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index c9fe0d74f6c..7c6eafed2f9 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -451,6 +451,21 @@ lower_ayuv_external(nir_builder *b, nir_tex_instr *tex, nir_channel(b, ayuv, 3)); } +static void +lower_xyuv_external(nir_builder *b, nir_tex_instr *tex, + const nir_lower_tex_options *options) +{ + b->cursor = nir_after_instr(&tex->instr); + + nir_ssa_def *xyuv = sample_plane(b, tex, 0, options); + + convert_yuv_to_rgb(b, tex, + nir_channel(b, xyuv, 2), + nir_channel(b, xyuv, 1), + nir_channel(b, xyuv, 0), + nir_imm_float(b, 1.0f)); +} + /* * Converts a nir_texop_txd instruction to nir_texop_txl with the given lod * computed from the gradients. @@ -958,6 +973,11 @@ nir_lower_tex_block(nir_block *block, nir_builder *b, progress = true; } + if ((1 << tex->texture_index) & options->lower_xyuv_external) { + lower_xyuv_external(b, tex, options); + progress = true; + } + if (sat_mask) { saturate_src(b, tex, sat_mask); progress = true; |