summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorLionel Landwerlin <[email protected]>2018-11-09 10:33:37 +0000
committerLionel Landwerlin <[email protected]>2018-11-12 13:22:54 +0000
commit0a30c33e837c1aa36398950190ccd856111bbfbc (patch)
tree312d9de7b0d4c8044f79b186861a2062408d7b54 /src/compiler
parent97fb1a02fd5724028a485516d19f8803d023dec8 (diff)
nir/lower_tex: add alpha channel parameter for yuv lowering
We're about to introduce AYUV support which provides its own alpha channel. So give alpha as a parameter and set it to 1 on exising formats. Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_tex.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index dc40d82b27f..c16a32f54e8 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -261,7 +261,8 @@ sample_plane(nir_builder *b, nir_tex_instr *tex, int plane)
static void
convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
- nir_ssa_def *y, nir_ssa_def *u, nir_ssa_def *v)
+ nir_ssa_def *y, nir_ssa_def *u, nir_ssa_def *v,
+ nir_ssa_def *a)
{
nir_const_value m[3] = {
{ .f32 = { 1.0f, 0.0f, 1.59602678f, 0.0f } },
@@ -281,7 +282,7 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
nir_ssa_def *green = nir_fdot4(b, yuv, nir_build_imm(b, 4, 32, m[1]));
nir_ssa_def *blue = nir_fdot4(b, yuv, nir_build_imm(b, 4, 32, m[2]));
- nir_ssa_def *result = nir_vec4(b, red, green, blue, nir_imm_float(b, 1.0f));
+ nir_ssa_def *result = nir_vec4(b, red, green, blue, a);
nir_ssa_def_rewrite_uses(&tex->dest.ssa, nir_src_for_ssa(result));
}
@@ -297,7 +298,8 @@ lower_y_uv_external(nir_builder *b, nir_tex_instr *tex)
convert_yuv_to_rgb(b, tex,
nir_channel(b, y, 0),
nir_channel(b, uv, 0),
- nir_channel(b, uv, 1));
+ nir_channel(b, uv, 1),
+ nir_imm_float(b, 1.0f));
}
static void
@@ -312,7 +314,8 @@ lower_y_u_v_external(nir_builder *b, nir_tex_instr *tex)
convert_yuv_to_rgb(b, tex,
nir_channel(b, y, 0),
nir_channel(b, u, 0),
- nir_channel(b, v, 0));
+ nir_channel(b, v, 0),
+ nir_imm_float(b, 1.0f));
}
static void
@@ -326,7 +329,8 @@ lower_yx_xuxv_external(nir_builder *b, nir_tex_instr *tex)
convert_yuv_to_rgb(b, tex,
nir_channel(b, y, 0),
nir_channel(b, xuxv, 1),
- nir_channel(b, xuxv, 3));
+ nir_channel(b, xuxv, 3),
+ nir_imm_float(b, 1.0f));
}
static void
@@ -340,7 +344,8 @@ lower_xy_uxvx_external(nir_builder *b, nir_tex_instr *tex)
convert_yuv_to_rgb(b, tex,
nir_channel(b, y, 1),
nir_channel(b, uxvx, 0),
- nir_channel(b, uxvx, 2));
+ nir_channel(b, uxvx, 2),
+ nir_imm_float(b, 1.0f));
}
/*