nir,glsl_to_nir: use nir_fdot()
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8056>
This commit is contained in:
parent
f6f9000f84
commit
cfc4433015
|
@ -2273,13 +2273,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
}
|
||||
break;
|
||||
case ir_binop_dot:
|
||||
switch (ir->operands[0]->type->vector_elements) {
|
||||
case 2: result = nir_fdot2(&b, srcs[0], srcs[1]); break;
|
||||
case 3: result = nir_fdot3(&b, srcs[0], srcs[1]); break;
|
||||
case 4: result = nir_fdot4(&b, srcs[0], srcs[1]); break;
|
||||
default:
|
||||
unreachable("not reached");
|
||||
}
|
||||
result = nir_fdot(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_vector_extract: {
|
||||
result = nir_channel(&b, srcs[0], 0);
|
||||
|
|
|
@ -54,16 +54,7 @@ nir_cross4(nir_builder *b, nir_ssa_def *x, nir_ssa_def *y)
|
|||
nir_ssa_def*
|
||||
nir_fast_length(nir_builder *b, nir_ssa_def *vec)
|
||||
{
|
||||
switch (vec->num_components) {
|
||||
case 1: return nir_fsqrt(b, nir_fmul(b, vec, vec));
|
||||
case 2: return nir_fsqrt(b, nir_fdot2(b, vec, vec));
|
||||
case 3: return nir_fsqrt(b, nir_fdot3(b, vec, vec));
|
||||
case 4: return nir_fsqrt(b, nir_fdot4(b, vec, vec));
|
||||
case 8: return nir_fsqrt(b, nir_fdot8(b, vec, vec));
|
||||
case 16: return nir_fsqrt(b, nir_fdot16(b, vec, vec));
|
||||
default:
|
||||
unreachable("Invalid number of components");
|
||||
}
|
||||
return nir_fsqrt(b, nir_fdot(b, vec, vec));
|
||||
}
|
||||
|
||||
nir_ssa_def*
|
||||
|
|
|
@ -131,9 +131,9 @@ nir_convert_ycbcr_to_rgb(nir_builder *b,
|
|||
ycbcr_model_to_rgb_matrix(model);
|
||||
|
||||
nir_ssa_def *converted_channels[] = {
|
||||
nir_fdot4(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[0])),
|
||||
nir_fdot4(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[1])),
|
||||
nir_fdot4(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[2]))
|
||||
nir_fdot(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[0])),
|
||||
nir_fdot(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[1])),
|
||||
nir_fdot(b, expanded_channels, nir_build_imm(b, 4, 32, conversion_matrix->v[2]))
|
||||
};
|
||||
|
||||
return nir_vec4(b,
|
||||
|
|
|
@ -258,7 +258,7 @@ lower_clip_outputs(nir_builder *b, nir_variable *position,
|
|||
nir_ssa_def *ucp = get_ucp(b, plane, clipplane_state_tokens);
|
||||
|
||||
/* calculate clipdist[plane] - dot(ucp, cv): */
|
||||
clipdist[plane] = nir_fdot4(b, ucp, cv);
|
||||
clipdist[plane] = nir_fdot(b, ucp, cv);
|
||||
} else {
|
||||
/* 0.0 == don't-clip == disabled: */
|
||||
clipdist[plane] = nir_imm_float(b, 0.0);
|
||||
|
|
Loading…
Reference in New Issue