diff options
author | Bill Hollings <bill.hollings@brenwill.com> | 2021-09-05 23:51:04 +0300 |
---|---|---|
committer | Bill Hollings <bill.hollings@brenwill.com> | 2021-09-05 23:51:04 +0300 |
commit | 472f9d4f6d647c8af7a9e3b7516624fe2c0b5d6f (patch) | |
tree | b6b940525207b21a6cf7e28fd3f7c28fa6b6be08 | |
parent | 5fb1ca4f0d04f2b169086e1a48a465bc2dc29169 (diff) |
Add tests for OpSpecConstantOp ops OpQuantizeToF16 and OpSRem.
Tests provided by @cdavis5e.
8 files changed, 68 insertions, 56 deletions
diff --git a/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert index ed5c5f9a..2ee6cd76 100644 --- a/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert +++ b/reference/opt/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -9,9 +9,10 @@ constant int _20 = (_7 + 2); constant uint _8_tmp [[function_constant(202)]]; constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u; constant uint _25 = (_8 % 5u); -constant int4 _30 = int4(20, 30, _20, _20); -constant int2 _32 = int2(_30.y, _30.x); -constant int _33 = _30.y; +constant int _30 = _7 - (-3) * (_7 / (-3)); +constant int4 _32 = int4(20, 30, _20, _30); +constant int2 _34 = int2(_32.y, _32.x); +constant int _35 = _32.y; struct main0_out { @@ -22,14 +23,14 @@ struct main0_out vertex main0_out main0() { main0_out out = {}; - float4 _63 = float4(0.0); - _63.y = float(_20); - float4 _66 = _63; - _66.z = float(_25); - float4 _52 = _66 + float4(_30); - float2 _56 = _52.xy + float2(_32); - out.gl_Position = float4(_56.x, _56.y, _52.z, _52.w); - out.m_4 = _33; + float4 _66 = float4(0.0); + _66.y = float(_20); + float4 _69 = _66; + _69.z = float(_25); + float4 _55 = _69 + float4(_32); + float2 _59 = _55.xy + float2(_34); + out.gl_Position = float4(_59.x, _59.y, _55.z, _55.w); + out.m_4 = _35; return out; } diff --git a/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert index 2608c1d5..bf3e0114 100644 --- a/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert +++ b/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -10,21 +10,22 @@ const int _20 = (_7 + 2); #endif const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; const uint _25 = (_8 % 5u); -const ivec4 _30 = ivec4(20, 30, _20, _20); -const ivec2 _32 = ivec2(_30.y, _30.x); -const int _33 = _30.y; +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; layout(location = 0) flat out int _4; void main() { - vec4 _63 = vec4(0.0); - _63.y = float(_20); - vec4 _66 = _63; - _66.z = float(_25); - vec4 _52 = _66 + vec4(_30); - vec2 _56 = _52.xy + vec2(_32); - gl_Position = vec4(_56.x, _56.y, _52.z, _52.w); - _4 = _33; + vec4 _65 = vec4(0.0); + _65.y = float(_20); + vec4 _68 = _65; + _68.z = float(_25); + vec4 _54 = _68 + vec4(_32); + vec2 _58 = _54.xy + vec2(_34); + gl_Position = vec4(_58.x, _58.y, _54.z, _54.w); + _4 = _35; } diff --git a/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk b/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk index 10da8f4b..b53f800a 100644 --- a/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk +++ b/reference/opt/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk @@ -4,21 +4,22 @@ layout(constant_id = 201) const int _7 = -10; const int _20 = (_7 + 2); layout(constant_id = 202) const uint _8 = 100u; const uint _25 = (_8 % 5u); -const ivec4 _30 = ivec4(20, 30, _20, _20); -const ivec2 _32 = ivec2(_30.y, _30.x); -const int _33 = _30.y; +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; layout(location = 0) flat out int _4; void main() { - vec4 _63 = vec4(0.0); - _63.y = float(_20); - vec4 _66 = _63; - _66.z = float(_25); - vec4 _52 = _66 + vec4(_30); - vec2 _56 = _52.xy + vec2(_32); - gl_Position = vec4(_56.x, _56.y, _52.z, _52.w); - _4 = _33; + vec4 _65 = vec4(0.0); + _65.y = float(_20); + vec4 _68 = _65; + _68.z = float(_25); + vec4 _54 = _68 + vec4(_32); + vec2 _58 = _54.xy + vec2(_34); + gl_Position = vec4(_58.x, _58.y, _54.z, _54.w); + _4 = _35; } diff --git a/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert index 05a69e48..8a2ab2e2 100644 --- a/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert +++ b/reference/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -9,11 +9,13 @@ constant int _20 = (_7 + 2); constant uint _8_tmp [[function_constant(202)]]; constant uint _8 = is_function_constant_defined(_8_tmp) ? _8_tmp : 100u; constant uint _25 = (_8 % 5u); -constant int4 _30 = int4(20, 30, _20, _20); -constant int2 _32 = int2(_30.y, _30.x); -constant int _33 = _30.y; +constant int _30 = _7 - (-3) * (_7 / (-3)); +constant int4 _32 = int4(20, 30, _20, _30); +constant int2 _34 = int2(_32.y, _32.x); +constant int _35 = _32.y; constant float _9_tmp [[function_constant(200)]]; constant float _9 = is_function_constant_defined(_9_tmp) ? _9_tmp : 3.141590118408203125; +constant float _41 = float(half(_9)); struct main0_out { @@ -27,11 +29,11 @@ vertex main0_out main0() float4 pos = float4(0.0); pos.y += float(_20); pos.z += float(_25); - pos += float4(_30); - float2 _56 = pos.xy + float2(_32); - pos = float4(_56.x, _56.y, pos.z, pos.w); + pos += float4(_32); + float2 _59 = pos.xy + float2(_34); + pos = float4(_59.x, _59.y, pos.z, pos.w); out.gl_Position = pos; - out.m_4 = _33; + out.m_4 = _35; return out; } diff --git a/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert index fdba2a26..daf0071a 100644 --- a/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert +++ b/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -10,9 +10,10 @@ const int _20 = (_7 + 2); #endif const uint _8 = SPIRV_CROSS_CONSTANT_ID_202; const uint _25 = (_8 % 5u); -const ivec4 _30 = ivec4(20, 30, _20, _20); -const ivec2 _32 = ivec2(_30.y, _30.x); -const int _33 = _30.y; +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; #ifndef SPIRV_CROSS_CONSTANT_ID_200 #define SPIRV_CROSS_CONSTANT_ID_200 3.141590118408203125 #endif @@ -25,10 +26,10 @@ void main() vec4 pos = vec4(0.0); pos.y += float(_20); pos.z += float(_25); - pos += vec4(_30); - vec2 _56 = pos.xy + vec2(_32); - pos = vec4(_56.x, _56.y, pos.z, pos.w); + pos += vec4(_32); + vec2 _58 = pos.xy + vec2(_34); + pos = vec4(_58.x, _58.y, pos.z, pos.w); gl_Position = pos; - _4 = _33; + _4 = _35; } diff --git a/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk b/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk index 02c3e312..94643ec1 100644 --- a/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk +++ b/reference/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert.vk @@ -4,9 +4,10 @@ layout(constant_id = 201) const int _7 = -10; const int _20 = (_7 + 2); layout(constant_id = 202) const uint _8 = 100u; const uint _25 = (_8 % 5u); -const ivec4 _30 = ivec4(20, 30, _20, _20); -const ivec2 _32 = ivec2(_30.y, _30.x); -const int _33 = _30.y; +const int _30 = _7 - (-3) * (_7 / (-3)); +const ivec4 _32 = ivec4(20, 30, _20, _30); +const ivec2 _34 = ivec2(_32.y, _32.x); +const int _35 = _32.y; layout(constant_id = 200) const float _9 = 3.141590118408203125; layout(location = 0) flat out int _4; @@ -16,10 +17,10 @@ void main() vec4 pos = vec4(0.0); pos.y += float(_20); pos.z += float(_25); - pos += vec4(_30); - vec2 _56 = pos.xy + vec2(_32); - pos = vec4(_56.x, _56.y, pos.z, pos.w); + pos += vec4(_32); + vec2 _58 = pos.xy + vec2(_34); + pos = vec4(_58.x, _58.y, pos.z, pos.w); gl_Position = pos; - _4 = _33; + _4 = _35; } diff --git a/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert b/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert index b566a3d1..64f6c92c 100644 --- a/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert +++ b/shaders-msl/asm/vert/spec-constant-op-composite.asm.vert @@ -49,8 +49,10 @@ %28 = OpConstant %17 2
%33 = OpConstant %12 20
%34 = OpConstant %12 30
+ %int_3 = OpConstant %12 -3
+ %bar = OpSpecConstantOp %12 SRem %13 %int_3
%35 = OpTypeVector %12 4
- %36 = OpSpecConstantComposite %35 %33 %34 %15 %15
+ %36 = OpSpecConstantComposite %35 %33 %34 %15 %bar
%40 = OpTypeVector %12 2
%41 = OpSpecConstantOp %40 VectorShuffle %36 %36 1 0
%foo = OpSpecConstantOp %12 CompositeExtract %36 1
@@ -63,6 +65,7 @@ %53 = OpConstant %12 0
%55 = OpTypePointer Output %7
%57 = OpSpecConstant %6 3.14159
+ %baz = OpSpecConstantOp %6 QuantizeToF16 %57
%4 = OpFunction %2 None %3
%5 = OpLabel
%9 = OpVariable %8 Function
diff --git a/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert b/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert index b566a3d1..1ff67798 100644 --- a/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert +++ b/shaders/asm/vert/spec-constant-op-composite.asm.vk.vert @@ -49,8 +49,10 @@ %28 = OpConstant %17 2
%33 = OpConstant %12 20
%34 = OpConstant %12 30
+ %int_3 = OpConstant %12 -3
+ %bar = OpSpecConstantOp %12 SRem %13 %int_3
%35 = OpTypeVector %12 4
- %36 = OpSpecConstantComposite %35 %33 %34 %15 %15
+ %36 = OpSpecConstantComposite %35 %33 %34 %15 %bar
%40 = OpTypeVector %12 2
%41 = OpSpecConstantOp %40 VectorShuffle %36 %36 1 0
%foo = OpSpecConstantOp %12 CompositeExtract %36 1
|