diff options
11 files changed, 301 insertions, 0 deletions
diff --git a/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp b/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..d3c281d1 --- /dev/null +++ b/reference/opt/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,34 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +static const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +static const uint _22 = SPIRV_CROSS_CONSTANT_ID_10; +static const uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u); +static const uint _27 = gl_WorkGroupSize.x; +static const uint _28 = (_21 + _27); +static const uint _29 = gl_WorkGroupSize.y; +static const uint _30 = (_28 + _29); +static const int _32 = (1 - a); + +RWByteAddressBuffer _17 : register(u0); + +void comp_main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.Store(_30 * 4 + 0, uint(b + spec_const_array_size[_32])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, 1)] +void main() +{ + comp_main(); +} diff --git a/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp b/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..e46ab893 --- /dev/null +++ b/reference/opt/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,33 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; +constant int a_tmp [[function_constant(0)]]; +constant int a = is_function_constant_defined(a_tmp) ? a_tmp : 1; +constant uint _21 = (uint(a) + 0u); +constant uint _22_tmp [[function_constant(10)]]; +constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u; +constant uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u); +constant uint _27 = gl_WorkGroupSize.x; +constant uint _28 = (_21 + _27); +constant uint _29 = gl_WorkGroupSize.y; +constant uint _30 = (_28 + _29); +constant int _32 = (1 - a); + +struct SSBO +{ + int v[1]; +}; + +kernel void main0(device SSBO& _17 [[buffer(0)]]) +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 00000000..888f4b16 --- /dev/null +++ b/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,34 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk b/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk new file mode 100644 index 00000000..bdf72dff --- /dev/null +++ b/reference/opt/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20, local_size_z = 1) in; + +layout(constant_id = 1) const int b = 2; +layout(constant_id = 0) const int a = 1; +const uint _21 = (uint(a) + 0u); +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(set = 1, binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp b/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..d3c281d1 --- /dev/null +++ b/reference/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,34 @@ +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +static const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +static const int a = SPIRV_CROSS_CONSTANT_ID_0; +static const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +static const uint _22 = SPIRV_CROSS_CONSTANT_ID_10; +static const uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u); +static const uint _27 = gl_WorkGroupSize.x; +static const uint _28 = (_21 + _27); +static const uint _29 = gl_WorkGroupSize.y; +static const uint _30 = (_28 + _29); +static const int _32 = (1 - a); + +RWByteAddressBuffer _17 : register(u0); + +void comp_main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.Store(_30 * 4 + 0, uint(b + spec_const_array_size[_32])); +} + +[numthreads(SPIRV_CROSS_CONSTANT_ID_10, 20, 1)] +void main() +{ + comp_main(); +} diff --git a/reference/shaders-msl/comp/spec-constant-work-group-size.comp b/reference/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..e46ab893 --- /dev/null +++ b/reference/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,33 @@ +#include <metal_stdlib> +#include <simd/simd.h> + +using namespace metal; + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +constant int b = SPIRV_CROSS_CONSTANT_ID_1; +constant int a_tmp [[function_constant(0)]]; +constant int a = is_function_constant_defined(a_tmp) ? a_tmp : 1; +constant uint _21 = (uint(a) + 0u); +constant uint _22_tmp [[function_constant(10)]]; +constant uint _22 = is_function_constant_defined(_22_tmp) ? _22_tmp : 1u; +constant uint3 gl_WorkGroupSize = uint3(_22, 20u, 1u); +constant uint _27 = gl_WorkGroupSize.x; +constant uint _28 = (_21 + _27); +constant uint _29 = gl_WorkGroupSize.y; +constant uint _30 = (_28 + _29); +constant int _32 = (1 - a); + +struct SSBO +{ + int v[1]; +}; + +kernel void main0(device SSBO& _17 [[buffer(0)]]) +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 00000000..888f4b16 --- /dev/null +++ b/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,34 @@ +#version 450 + +#ifndef SPIRV_CROSS_CONSTANT_ID_1 +#define SPIRV_CROSS_CONSTANT_ID_1 2 +#endif +const int b = SPIRV_CROSS_CONSTANT_ID_1; +#ifndef SPIRV_CROSS_CONSTANT_ID_0 +#define SPIRV_CROSS_CONSTANT_ID_0 1 +#endif +const int a = SPIRV_CROSS_CONSTANT_ID_0; +const uint _21 = (uint(a) + 0u); +#ifndef SPIRV_CROSS_CONSTANT_ID_10 +#define SPIRV_CROSS_CONSTANT_ID_10 1u +#endif +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(local_size_x = SPIRV_CROSS_CONSTANT_ID_10, local_size_y = 20, local_size_z = 1) in; + +layout(binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk b/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk new file mode 100644 index 00000000..bdf72dff --- /dev/null +++ b/reference/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp.vk @@ -0,0 +1,24 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20, local_size_z = 1) in; + +layout(constant_id = 1) const int b = 2; +layout(constant_id = 0) const int a = 1; +const uint _21 = (uint(a) + 0u); +const uint _27 = gl_WorkGroupSize.x; +const uint _28 = (_21 + _27); +const uint _29 = gl_WorkGroupSize.y; +const uint _30 = (_28 + _29); +const int _32 = (1 - a); + +layout(set = 1, binding = 0, std430) writeonly buffer SSBO +{ + int v[]; +} _17; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + _17.v[_30] = b + spec_const_array_size[_32]; +} + diff --git a/shaders-hlsl/comp/spec-constant-work-group-size.comp b/shaders-hlsl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..09b65dc9 --- /dev/null +++ b/shaders-hlsl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y] = b + spec_const_array_size[1 - a]; +} diff --git a/shaders-msl/comp/spec-constant-work-group-size.comp b/shaders-msl/comp/spec-constant-work-group-size.comp new file mode 100644 index 00000000..09b65dc9 --- /dev/null +++ b/shaders-msl/comp/spec-constant-work-group-size.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y] = b + spec_const_array_size[1 - a]; +} diff --git a/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp b/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp new file mode 100644 index 00000000..09b65dc9 --- /dev/null +++ b/shaders/vulkan/comp/spec-constant-work-group-size.vk.comp @@ -0,0 +1,17 @@ +#version 450 +layout(local_size_x_id = 10, local_size_y = 20) in; + +layout(constant_id = 0) const int a = 1; +layout(constant_id = 1) const int b = 2; + +layout(set = 1, binding = 0) writeonly buffer SSBO +{ + int v[]; +}; + +void main() +{ + int spec_const_array_size[b]; + spec_const_array_size[a] = a; + v[a + gl_WorkGroupSize.x + gl_WorkGroupSize.y] = b + spec_const_array_size[1 - a]; +} |