summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2019-09-04 11:04:13 +0200
committerIago Toral <[email protected]>2019-09-12 06:40:04 +0000
commit544b156968e7adf507b8e8e6f59821675fa25054 (patch)
treeab38aa56486a6115a7f34a45e3648871a48a06bc /src/compiler
parent7f0b4a803c0d5f03ff119671f6c1952d86de6e04 (diff)
nir/lower_point_size: assume scalar PSIZ
Reviewed-by: Erik Faye-Lund <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_lower_point_size.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/compiler/nir/nir_lower_point_size.c b/src/compiler/nir/nir_lower_point_size.c
index d614bb21ec5..0b5a2aa1482 100644
--- a/src/compiler/nir/nir_lower_point_size.c
+++ b/src/compiler/nir/nir_lower_point_size.c
@@ -41,12 +41,9 @@ lower_point_size_instr(nir_builder *b, nir_instr *psiz_instr,
nir_intrinsic_instr *instr = nir_instr_as_intrinsic(psiz_instr);
- /* Some fixed function vertex programs generate PSIZ as a vec4
- * instead of a scalar, where the actual point size is stored in the
- * first component.
- */
assert(instr->src[1].is_ssa);
- nir_ssa_def *psiz = nir_channel(b, instr->src[1].ssa, 0);
+ assert(instr->src[1].ssa->num_components == 1);
+ nir_ssa_def *psiz = instr->src[1].ssa;
if (min > 0.0f)
psiz = nir_fmax(b, psiz, nir_imm_float(b, min));
@@ -54,15 +51,7 @@ lower_point_size_instr(nir_builder *b, nir_instr *psiz_instr,
if (max > 0.0f)
psiz = nir_fmin(b, psiz, nir_imm_float(b, max));
- nir_ssa_def *src_chans[4];
- src_chans[0] = psiz;
- for (int i = 1; i < instr->src[1].ssa->num_components; i++)
- src_chans[i] = nir_channel(b, instr->src[1].ssa, i);
- nir_ssa_def *lowered_src =
- nir_vec(b, src_chans, instr->src[1].ssa->num_components);
-
- nir_instr_rewrite_src(&instr->instr, &instr->src[1],
- nir_src_for_ssa(lowered_src));
+ nir_instr_rewrite_src(&instr->instr, &instr->src[1], nir_src_for_ssa(psiz));
}
static bool