mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
glsl: fix glsl to nir support for lower precision builtins
When we switch to the full nir based glsl linker in an upcomming merge request this is required for existing tests from8fcf8e7fd4to continue to pass, this is because they never exercised glsl to nir so the missing support went unnoticed. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11456 Fixes:8fcf8e7fd4("glsl: lower builtins to mediump that ignore precision of certain parameters ") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30395>
This commit is contained in:
parent
50ce777edd
commit
140ca7e5d7
1 changed files with 21 additions and 3 deletions
|
|
@ -1730,10 +1730,24 @@ nir_visitor::visit(ir_expression *ir)
|
|||
case ir_binop_interpolate_at_sample: {
|
||||
ir_dereference *deref = ir->operands[0]->as_dereference();
|
||||
ir_swizzle *swizzle = NULL;
|
||||
ir_expression *precision_op = NULL;
|
||||
if (!deref) {
|
||||
swizzle = ir->operands[0]->as_swizzle();
|
||||
assert(swizzle);
|
||||
deref = swizzle->val->as_dereference();
|
||||
precision_op = ir->operands[0]->as_expression();
|
||||
if (precision_op) {
|
||||
/* For some builtins precision is lowered to mediump for certain
|
||||
* parameters that ignore precision. For example for Interpolation
|
||||
* and Bitfield functions.
|
||||
*/
|
||||
assert(precision_op->operation == ir_unop_f2fmp);
|
||||
deref = precision_op->operands[0]->as_dereference();
|
||||
}
|
||||
|
||||
if (!deref) {
|
||||
swizzle = ir->operands[0]->as_swizzle();
|
||||
assert(swizzle);
|
||||
deref = swizzle->val->as_dereference();
|
||||
}
|
||||
|
||||
assert(deref);
|
||||
}
|
||||
|
||||
|
|
@ -1775,6 +1789,10 @@ nir_visitor::visit(ir_expression *ir)
|
|||
swizzle->type->vector_elements);
|
||||
}
|
||||
|
||||
if (precision_op) {
|
||||
result = nir_build_alu(&b, nir_op_f2fmp, result, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue