test(naga): add runtime_{f,i}32 to math-functions' sign cvg.

This commit is contained in:
Erich Gubler authored and mergify[bot] committed 2026-10-05 12:08:36 +00:00
1 parent 3a227342f2
commit 24cee9e495
7 files changed
+160 -107

No files matched your search

+5
View File
@@ -1,5 +1,7 @@
@fragment
fn main() {
var runtime_f32 = 1.0;
var runtime_i32 = 1;
let f = 1.0;
let v = vec4<f32>(0.0);
let a = degrees(f);
@@ -13,6 +15,9 @@ fn main() {
let sign_c = sign(-1.0);
let sign_d = sign(vec4(-1.0));
let sign_e = sign(vec4(0.0));
let sign_f = sign(runtime_f32);
let sign_g = sign(vec4(runtime_f32));
let sign_h = sign(runtime_i32);
let const_dot = dot(vec2<i32>(), vec2<i32>());
let first_leading_bit_abs = firstLeadingBit(abs(0u));
let flb_a = firstLeadingBit(-1);
@@ -55,6 +55,8 @@ _frexp_result_vec4_f32_ naga_frexp(vec4 arg) {
}
void main() {
float runtime_f32_ = 1.0;
int runtime_i32_ = 1;
vec4 v = vec4(0.0);
float a = degrees(1.0);
float b = radians(1.0);
@@ -65,6 +67,12 @@ void main() {
ivec4 sign_b = ivec4(-1, -1, -1, -1);
vec4 sign_d = vec4(-1.0, -1.0, -1.0, -1.0);
vec4 sign_e = vec4(0.0, 0.0, 0.0, 0.0);
float _e30 = runtime_f32_;
float sign_f = sign(_e30);
float _e32 = runtime_f32_;
vec4 sign_g = sign(vec4(_e32));
int _e35 = runtime_i32_;
int sign_h = sign(_e35);
ivec2 flb_b = ivec2(-1, -1);
uvec2 flb_c = uvec2(0u, 0u);
ivec2 ftb_c = ivec2(0, 0);
@@ -88,12 +96,12 @@ void main() {
int frexp_c = naga_frexp(1.5).exp_;
int frexp_d = naga_frexp(vec4(1.5, 1.5, 1.5, 1.5)).exp_.x;
float quantizeToF16_a = unpackHalf2x16(packHalf2x16(vec2(1.0))).x;
vec2 _e123 = vec2(1.0, 1.0);
vec2 quantizeToF16_b = unpackHalf2x16(packHalf2x16(_e123));
vec3 _e128 = vec3(1.0, 1.0, 1.0);
vec3 quantizeToF16_c = vec3(unpackHalf2x16(packHalf2x16(_e128.xy)), unpackHalf2x16(packHalf2x16(_e128.zz)).x);
vec4 _e134 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 quantizeToF16_d = vec4(unpackHalf2x16(packHalf2x16(_e134.xy)), unpackHalf2x16(packHalf2x16(_e134.zw)));
vec2 _e134 = vec2(1.0, 1.0);
vec2 quantizeToF16_b = unpackHalf2x16(packHalf2x16(_e134));
vec3 _e139 = vec3(1.0, 1.0, 1.0);
vec3 quantizeToF16_c = vec3(unpackHalf2x16(packHalf2x16(_e139.xy)), unpackHalf2x16(packHalf2x16(_e139.zz)).x);
vec4 _e145 = vec4(1.0, 1.0, 1.0, 1.0);
vec4 quantizeToF16_d = vec4(unpackHalf2x16(packHalf2x16(_e145.xy)), unpackHalf2x16(packHalf2x16(_e145.zw)));
return;
}
@@ -65,6 +65,9 @@ _frexp_result_vec4_f32_ naga_frexp(float4 arg) {
void main()
{
float runtime_f32_ = 1.0;
int runtime_i32_ = int(1);
float4 v = (0.0).xxxx;
float a = degrees(1.0);
float b = radians(1.0);
@@ -75,6 +78,12 @@ void main()
int4 sign_b = int4(int(-1), int(-1), int(-1), int(-1));
float4 sign_d = float4(-1.0, -1.0, -1.0, -1.0);
float4 sign_e = float4(0.0, 0.0, 0.0, 0.0);
float _e30 = runtime_f32_;
float sign_f = sign(_e30);
float _e32 = runtime_f32_;
float4 sign_g = sign((_e32).xxxx);
int _e35 = runtime_i32_;
int sign_h = sign(_e35);
int2 flb_b = int2(int(-1), int(-1));
uint2 flb_c = uint2(0u, 0u);
int2 ftb_c = int2(int(0), int(0));
@@ -57,6 +57,8 @@ _frexp_result_vec4_f32_ naga_frexp(metal::float4 arg) {
fragment void main_(
) {
float runtime_f32_ = 1.0;
int runtime_i32_ = 1;
metal::float4 v = metal::float4(0.0);
float a = ((1.0) * 57.295779513082322865);
float b = ((1.0) * 0.017453292519943295474);
@@ -67,6 +69,12 @@ fragment void main_(
metal::int4 sign_b = metal::int4(-1, -1, -1, -1);
metal::float4 sign_d = metal::float4(-1.0, -1.0, -1.0, -1.0);
metal::float4 sign_e = metal::float4(0.0, 0.0, 0.0, 0.0);
float _e30 = runtime_f32_;
float sign_f = metal::sign(_e30);
float _e32 = runtime_f32_;
metal::float4 sign_g = metal::sign(metal::float4(_e32));
int _e35 = runtime_i32_;
int sign_h = metal::select(metal::select(int(-1), int(1), (_e35 > 0)), int(0), (_e35 == 0));
metal::int2 flb_b = metal::int2(-1, -1);
metal::uint2 flb_c = metal::uint2(0u, 0u);
metal::int2 ftb_c = metal::int2(0, 0);
+85 -73
View File
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.1
; Generator: rspirv
; Bound: 86
; Bound: 98
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
@@ -19,88 +19,100 @@ OpMemberDecorate %15 0 Offset 0
OpMemberDecorate %15 1 Offset 16
%2 = OpTypeVoid
%3 = OpTypeFloat 32
%4 = OpTypeVector %3 4
%5 = OpTypeInt 32 1
%6 = OpTypeVector %5 4
%7 = OpTypeVector %5 2
%4 = OpTypeInt 32 1
%5 = OpTypeVector %3 4
%6 = OpTypeVector %4 4
%7 = OpTypeVector %4 2
%9 = OpTypeInt 32 0
%8 = OpTypeVector %9 2
%10 = OpTypeVector %3 2
%11 = OpTypeStruct %3 %3
%12 = OpTypeStruct %10 %10
%13 = OpTypeStruct %4 %4
%14 = OpTypeStruct %3 %5
%15 = OpTypeStruct %4 %6
%13 = OpTypeStruct %5 %5
%14 = OpTypeStruct %3 %4
%15 = OpTypeStruct %5 %6
%16 = OpTypeVector %3 3
%19 = OpTypeFunction %2
%20 = OpConstant %3 1
%21 = OpConstant %3 0
%22 = OpConstantComposite %4 %21 %21 %21 %21
%23 = OpConstant %5 -1
%24 = OpConstantComposite %6 %23 %23 %23 %23
%25 = OpConstant %3 -1
%26 = OpConstantComposite %4 %25 %25 %25 %25
%27 = OpConstantComposite %4 %21 %21 %21 %21
%28 = OpConstant %5 0
%29 = OpConstant %9 4294967295
%30 = OpConstantComposite %7 %23 %23
%31 = OpConstant %9 0
%32 = OpConstantComposite %8 %31 %31
%33 = OpConstantComposite %7 %28 %28
%34 = OpConstant %9 32
%35 = OpConstant %5 32
%36 = OpConstantComposite %8 %34 %34
%37 = OpConstantComposite %7 %35 %35
%38 = OpConstant %9 31
%39 = OpConstantComposite %8 %38 %38
%40 = OpConstant %5 2
%41 = OpConstant %3 2
%42 = OpConstantComposite %10 %20 %41
%43 = OpConstant %5 3
%44 = OpConstant %5 4
%45 = OpConstantComposite %7 %43 %44
%46 = OpConstant %3 1.5
%47 = OpConstantComposite %10 %46 %46
%48 = OpConstantComposite %4 %46 %46 %46 %46
%49 = OpConstantComposite %10 %20 %20
%50 = OpConstantComposite %16 %20 %20 %20
%51 = OpConstantComposite %4 %20 %20 %20 %20
%58 = OpConstantComposite %4 %20 %20 %20 %20
%21 = OpConstant %4 1
%22 = OpConstant %3 0
%23 = OpConstantComposite %5 %22 %22 %22 %22
%24 = OpConstant %4 -1
%25 = OpConstantComposite %6 %24 %24 %24 %24
%26 = OpConstant %3 -1
%27 = OpConstantComposite %5 %26 %26 %26 %26
%28 = OpConstantComposite %5 %22 %22 %22 %22
%29 = OpConstant %4 0
%30 = OpConstant %9 4294967295
%31 = OpConstantComposite %7 %24 %24
%32 = OpConstant %9 0
%33 = OpConstantComposite %8 %32 %32
%34 = OpConstantComposite %7 %29 %29
%35 = OpConstant %9 32
%36 = OpConstant %4 32
%37 = OpConstantComposite %8 %35 %35
%38 = OpConstantComposite %7 %36 %36
%39 = OpConstant %9 31
%40 = OpConstantComposite %8 %39 %39
%41 = OpConstant %4 2
%42 = OpConstant %3 2
%43 = OpConstantComposite %10 %20 %42
%44 = OpConstant %4 3
%45 = OpConstant %4 4
%46 = OpConstantComposite %7 %44 %45
%47 = OpConstant %3 1.5
%48 = OpConstantComposite %10 %47 %47
%49 = OpConstantComposite %5 %47 %47 %47 %47
%50 = OpConstantComposite %10 %20 %20
%51 = OpConstantComposite %16 %20 %20 %20
%52 = OpConstantComposite %5 %20 %20 %20 %20
%54 = OpTypePointer Function %3
%56 = OpTypePointer Function %4
%63 = OpConstantComposite %5 %20 %20 %20 %20
%18 = OpFunction %2 None %19
%17 = OpLabel
OpBranch %52
%52 = OpLabel
%53 = OpExtInst %3 %1 Degrees %20
%54 = OpExtInst %3 %1 Radians %20
%55 = OpExtInst %4 %1 Degrees %22
%56 = OpExtInst %4 %1 Radians %22
%57 = OpExtInst %4 %1 FClamp %22 %22 %58
%59 = OpExtInst %4 %1 Refract %22 %22 %20
%60 = OpExtInst %3 %1 Ldexp %20 %40
%61 = OpExtInst %10 %1 Ldexp %42 %45
%62 = OpExtInst %11 %1 ModfStruct %46
%63 = OpExtInst %11 %1 ModfStruct %46
%64 = OpCompositeExtract %3 %63 0
%65 = OpExtInst %11 %1 ModfStruct %46
%66 = OpCompositeExtract %3 %65 1
%67 = OpExtInst %12 %1 ModfStruct %47
%68 = OpExtInst %13 %1 ModfStruct %48
%69 = OpCompositeExtract %4 %68 1
%70 = OpCompositeExtract %3 %69 0
%71 = OpExtInst %12 %1 ModfStruct %47
%72 = OpCompositeExtract %10 %71 0
%73 = OpCompositeExtract %3 %72 1
%74 = OpExtInst %14 %1 FrexpStruct %46
%75 = OpExtInst %14 %1 FrexpStruct %46
%53 = OpVariable %54 Function %20
%55 = OpVariable %56 Function %21
OpBranch %57
%57 = OpLabel
%58 = OpExtInst %3 %1 Degrees %20
%59 = OpExtInst %3 %1 Radians %20
%60 = OpExtInst %5 %1 Degrees %23
%61 = OpExtInst %5 %1 Radians %23
%62 = OpExtInst %5 %1 FClamp %23 %23 %63
%64 = OpExtInst %5 %1 Refract %23 %23 %20
%65 = OpLoad %3 %53
%66 = OpExtInst %3 %1 FSign %65
%67 = OpLoad %3 %53
%68 = OpCompositeConstruct %5 %67 %67 %67 %67
%69 = OpExtInst %5 %1 FSign %68
%70 = OpLoad %4 %55
%71 = OpExtInst %4 %1 SSign %70
%72 = OpExtInst %3 %1 Ldexp %20 %41
%73 = OpExtInst %10 %1 Ldexp %43 %46
%74 = OpExtInst %11 %1 ModfStruct %47
%75 = OpExtInst %11 %1 ModfStruct %47
%76 = OpCompositeExtract %3 %75 0
%77 = OpExtInst %14 %1 FrexpStruct %46
%78 = OpCompositeExtract %5 %77 1
%79 = OpExtInst %15 %1 FrexpStruct %48
%80 = OpCompositeExtract %6 %79 1
%81 = OpCompositeExtract %5 %80 0
%82 = OpQuantizeToF16 %3 %20
%83 = OpQuantizeToF16 %10 %49
%84 = OpQuantizeToF16 %16 %50
%85 = OpQuantizeToF16 %4 %51
%77 = OpExtInst %11 %1 ModfStruct %47
%78 = OpCompositeExtract %3 %77 1
%79 = OpExtInst %12 %1 ModfStruct %48
%80 = OpExtInst %13 %1 ModfStruct %49
%81 = OpCompositeExtract %5 %80 1
%82 = OpCompositeExtract %3 %81 0
%83 = OpExtInst %12 %1 ModfStruct %48
%84 = OpCompositeExtract %10 %83 0
%85 = OpCompositeExtract %3 %84 1
%86 = OpExtInst %14 %1 FrexpStruct %47
%87 = OpExtInst %14 %1 FrexpStruct %47
%88 = OpCompositeExtract %3 %87 0
%89 = OpExtInst %14 %1 FrexpStruct %47
%90 = OpCompositeExtract %4 %89 1
%91 = OpExtInst %15 %1 FrexpStruct %49
%92 = OpCompositeExtract %6 %91 1
%93 = OpCompositeExtract %4 %92 0
%94 = OpQuantizeToF16 %3 %20
%95 = OpQuantizeToF16 %10 %50
%96 = OpQuantizeToF16 %16 %51
%97 = OpQuantizeToF16 %5 %52
OpReturn
OpFunctionEnd
@@ -32,33 +32,35 @@ struct _15
void main()
{
float _53 = degrees(1.0);
float _54 = radians(1.0);
vec4 _55 = degrees(vec4(0.0));
vec4 _56 = radians(vec4(0.0));
vec4 _57 = clamp(vec4(0.0), vec4(0.0), vec4(1.0));
vec4 _59 = refract(vec4(0.0), vec4(0.0), 1.0);
float _60 = ldexp(1.0, 2);
vec2 _61 = ldexp(vec2(1.0, 2.0), ivec2(3, 4));
_11 _62;
_62._m0 = modf(1.5, _62._m1);
_11 _63;
_63._m0 = modf(1.5, _63._m1);
_11 _65;
_65._m0 = modf(1.5, _65._m1);
_12 _67;
_67._m0 = modf(vec2(1.5), _67._m1);
_13 _68;
_68._m0 = modf(vec4(1.5), _68._m1);
_12 _71;
_71._m0 = modf(vec2(1.5), _71._m1);
_14 _74;
_74._m0 = frexp(1.5, _74._m1);
_14 _75;
_75._m0 = frexp(1.5, _75._m1);
_14 _77;
_77._m0 = frexp(1.5, _77._m1);
_15 _79;
_79._m0 = frexp(vec4(1.5), _79._m1);
float _53 = 1.0;
int _55 = 1;
float _58 = degrees(1.0);
float _59 = radians(1.0);
vec4 _60 = degrees(vec4(0.0));
vec4 _61 = radians(vec4(0.0));
vec4 _62 = clamp(vec4(0.0), vec4(0.0), vec4(1.0));
vec4 _64 = refract(vec4(0.0), vec4(0.0), 1.0);
float _72 = ldexp(1.0, 2);
vec2 _73 = ldexp(vec2(1.0, 2.0), ivec2(3, 4));
_11 _74;
_74._m0 = modf(1.5, _74._m1);
_11 _75;
_75._m0 = modf(1.5, _75._m1);
_11 _77;
_77._m0 = modf(1.5, _77._m1);
_12 _79;
_79._m0 = modf(vec2(1.5), _79._m1);
_13 _80;
_80._m0 = modf(vec4(1.5), _80._m1);
_12 _83;
_83._m0 = modf(vec2(1.5), _83._m1);
_14 _86;
_86._m0 = frexp(1.5, _86._m1);
_14 _87;
_87._m0 = frexp(1.5, _87._m1);
_14 _89;
_89._m0 = frexp(1.5, _89._m1);
_15 _91;
_91._m0 = frexp(vec4(1.5), _91._m1);
}
@@ -1,5 +1,8 @@
@fragment
fn main() {
var runtime_f32_: f32 = 1f;
var runtime_i32_: i32 = 1i;
let v = vec4(0f);
let a = degrees(1f);
let b = radians(1f);
@@ -10,6 +13,12 @@ fn main() {
let sign_b = vec4<i32>(-1i, -1i, -1i, -1i);
let sign_d = vec4<f32>(-1f, -1f, -1f, -1f);
let sign_e = vec4<f32>(0f, 0f, 0f, 0f);
let _e30 = runtime_f32_;
let sign_f = sign(_e30);
let _e32 = runtime_f32_;
let sign_g = sign(vec4(_e32));
let _e35 = runtime_i32_;
let sign_h = sign(_e35);
let flb_b = vec2<i32>(-1i, -1i);
let flb_c = vec2<u32>(0u, 0u);
let ftb_c = vec2<i32>(0i, 0i);