glsl: Fix the precision of atomic counter builtin function args.

More special-casing dropped from GLSL lower_precision.

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:
Emma Anholt 2023-03-02 13:10:06 -08:00 committed by Marge Bot
parent b251f94e15
commit 4a51944639
2 changed files with 12 additions and 9 deletions

View file

@ -7991,11 +7991,16 @@ builtin_builder::_interpolateAtSample(const glsl_type *type)
return sig;
}
/* The highp isn't specified in the built-in function descriptions, but in the
* atomic counter description: "The default precision of all atomic types is
* highp. It is an error to declare an atomic type with a different precision or
* to specify the default precision for an atomic type to be lowp or mediump."
*/
ir_function_signature *
builtin_builder::_atomic_counter_intrinsic(builtin_available_predicate avail,
enum ir_intrinsic_id id)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "counter");
MAKE_INTRINSIC(glsl_type::uint_type, id, avail, 1, counter);
return sig;
}
@ -8004,7 +8009,7 @@ ir_function_signature *
builtin_builder::_atomic_counter_intrinsic1(builtin_available_predicate avail,
enum ir_intrinsic_id id)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "counter");
ir_variable *data = in_var(glsl_type::uint_type, "data");
MAKE_INTRINSIC(glsl_type::uint_type, id, avail, 2, counter, data);
return sig;
@ -8014,7 +8019,7 @@ ir_function_signature *
builtin_builder::_atomic_counter_intrinsic2(builtin_available_predicate avail,
enum ir_intrinsic_id id)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "counter");
ir_variable *compare = in_var(glsl_type::uint_type, "compare");
ir_variable *data = in_var(glsl_type::uint_type, "data");
MAKE_INTRINSIC(glsl_type::uint_type, id, avail, 3, counter, compare, data);
@ -8048,7 +8053,7 @@ ir_function_signature *
builtin_builder::_atomic_counter_op(const char *intrinsic,
builtin_available_predicate avail)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "atomic_counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "atomic_counter");
MAKE_SIG(glsl_type::uint_type, avail, 1, counter);
ir_variable *retval = body.make_temp(glsl_type::uint_type, "atomic_retval");
@ -8062,7 +8067,7 @@ ir_function_signature *
builtin_builder::_atomic_counter_op1(const char *intrinsic,
builtin_available_predicate avail)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "atomic_counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "atomic_counter");
ir_variable *data = in_var(glsl_type::uint_type, "data");
MAKE_SIG(glsl_type::uint_type, avail, 2, counter, data);
@ -8103,7 +8108,7 @@ ir_function_signature *
builtin_builder::_atomic_counter_op2(const char *intrinsic,
builtin_available_predicate avail)
{
ir_variable *counter = in_var(glsl_type::atomic_uint_type, "atomic_counter");
ir_variable *counter = in_highp_var(glsl_type::atomic_uint_type, "atomic_counter");
ir_variable *compare = in_var(glsl_type::uint_type, "compare");
ir_variable *data = in_var(glsl_type::uint_type, "data");
MAKE_SIG(glsl_type::uint_type, avail, 3, counter, compare, data);

View file

@ -485,9 +485,7 @@ handle_call(ir_call *ir, const struct set *lowerable_rvalues)
!strcmp(ir->callee_name(), "floatBitsToInt") ||
!strcmp(ir->callee_name(), "floatBitsToUint") ||
!strcmp(ir->callee_name(), "intBitsToFloat") ||
!strcmp(ir->callee_name(), "uintBitsToFloat") ||
/* Atomic functions are not lowered. */
strstr(ir->callee_name(), "atomic") == ir->callee_name())
!strcmp(ir->callee_name(), "uintBitsToFloat"))
return GLSL_PRECISION_HIGH;
/* Number of parameters to check if they are lowerable. */