mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
glsl/lower_precision: Drop most special-casing of builtin arg precision.
bitCount is still special in that our lowering would try to demote its arg based on the precision of its output, and it shouldn't do that. But the other special cases now have appropriate qualifiers on them at the IR level. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21666>
This commit is contained in:
parent
18e096769c
commit
b251f94e15
1 changed files with 9 additions and 16 deletions
|
|
@ -408,17 +408,6 @@ find_lowerable_rvalues_visitor::visit_enter(ir_expression *ir)
|
|||
return visit_continue;
|
||||
}
|
||||
|
||||
static bool
|
||||
function_always_returns_mediump_or_lowp(const char *name)
|
||||
{
|
||||
return !strcmp(name, "bitCount") ||
|
||||
!strcmp(name, "findLSB") ||
|
||||
!strcmp(name, "findMSB") ||
|
||||
!strcmp(name, "unpackHalf2x16") ||
|
||||
!strcmp(name, "unpackUnorm4x8") ||
|
||||
!strcmp(name, "unpackSnorm4x8");
|
||||
}
|
||||
|
||||
static unsigned
|
||||
handle_call(ir_call *ir, const struct set *lowerable_rvalues)
|
||||
{
|
||||
|
|
@ -896,13 +885,17 @@ find_precision_visitor::map_builtin(ir_function_signature *sig)
|
|||
ir_function_signature *lowered_sig =
|
||||
sig->clone(lowered_builtin_mem_ctx, clone_ht);
|
||||
|
||||
/* Functions that always return mediump or lowp should keep their
|
||||
* parameters intact, because they can be highp. NIR can lower
|
||||
* the up-conversion for parameters if needed.
|
||||
/* If we're lowering the output precision of the function, then also lower
|
||||
* the precision of its inputs unless they have a specific qualifier. The
|
||||
* exception is bitCount, which doesn't declare its arguments highp but
|
||||
* should not be lowering the args to mediump just because the output is
|
||||
* lowp.
|
||||
*/
|
||||
if (!function_always_returns_mediump_or_lowp(sig->function_name())) {
|
||||
if (strcmp(sig->function_name(), "bitCount") != 0) {
|
||||
foreach_in_list(ir_variable, param, &lowered_sig->parameters) {
|
||||
param->data.precision = GLSL_PRECISION_MEDIUM;
|
||||
/* Demote the precision of unqualified function arguments. */
|
||||
if (param->data.precision == GLSL_PRECISION_NONE)
|
||||
param->data.precision = GLSL_PRECISION_MEDIUM;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue