Merge pull request #336 from KhronosGroup/fix-334
Add full testing for spirv-opt output.
This commit is contained in:
commit
5989540f3e
@ -10,7 +10,7 @@ dist: trusty
|
|||||||
|
|
||||||
# We check out glslang and SPIRV-Tools at specific revisions to avoid test output mismatches
|
# We check out glslang and SPIRV-Tools at specific revisions to avoid test output mismatches
|
||||||
env:
|
env:
|
||||||
- GLSLANG_REV=698bf7547a96b6feb7291e8ddc0d5d16475dbae2 SPIRV_TOOLS_REV=40e9c60ffea56f45f388835e6945b01d4d8b022d
|
- GLSLANG_REV=698bf7547a96b6feb7291e8ddc0d5d16475dbae2 SPIRV_TOOLS_REV=e28edd458b729da7bbfd51e375feb33103709e6f
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install python3; fi
|
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install python3; fi
|
||||||
@ -28,3 +28,6 @@ script:
|
|||||||
- ./test_shaders.py shaders
|
- ./test_shaders.py shaders
|
||||||
- ./test_shaders.py --msl shaders-msl
|
- ./test_shaders.py --msl shaders-msl
|
||||||
- ./test_shaders.py --hlsl shaders-hlsl
|
- ./test_shaders.py --hlsl shaders-hlsl
|
||||||
|
- ./test_shaders.py shaders --opt
|
||||||
|
- ./test_shaders.py --msl shaders-msl --opt
|
||||||
|
- ./test_shaders.py --hlsl shaders-hlsl --opt
|
||||||
|
@ -129,6 +129,15 @@ if (${PYTHONINTERP_FOUND})
|
|||||||
add_test(NAME spirv-cross-test-hlsl
|
add_test(NAME spirv-cross-test-hlsl
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
|
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
|
||||||
|
add_test(NAME spirv-cross-test-opt
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --opt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/shaders)
|
||||||
|
add_test(NAME spirv-cross-test-metal-opt
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --metal --opt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/shaders-msl)
|
||||||
|
add_test(NAME spirv-cross-test-hlsl-opt
|
||||||
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --hlsl --opt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/shaders-hlsl)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "Testing disabled. Could not find python3. If you have python3 installed try running "
|
message(WARNING "Testing disabled. Could not find python3. If you have python3 installed try running "
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
static const uint _5 = 9u;
|
||||||
|
static const uint _6 = 4u;
|
||||||
|
static const uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||||
|
|
||||||
|
RWByteAddressBuffer _4 : register(u0);
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
_4.Store(0, asuint(asfloat(_4.Load(0)) + 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(9, 20, 4)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
static const uint _3 = 1u;
|
||||||
|
static const uint _4 = 3u;
|
||||||
|
static const uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||||
|
|
||||||
|
RWByteAddressBuffer _8 : register(u0);
|
||||||
|
RWByteAddressBuffer _9 : register(u1);
|
||||||
|
|
||||||
|
static uint3 gl_WorkGroupID;
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
uint3 gl_WorkGroupID : SV_GroupID;
|
||||||
|
};
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
_8.Store(gl_WorkGroupID.x * 4 + 0, asuint(asfloat(_9.Load(gl_WorkGroupID.x * 4 + 0)) + asfloat(_8.Load(gl_WorkGroupID.x * 4 + 0))));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 2, 3)]
|
||||||
|
void main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_WorkGroupID = stage_input.gl_WorkGroupID;
|
||||||
|
comp_main();
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
cbuffer _5 : register(b0)
|
||||||
|
{
|
||||||
|
column_major float2x4 _4_m0 : packoffset(c0);
|
||||||
|
float4 _4_m1 : packoffset(c4);
|
||||||
|
};
|
||||||
|
|
||||||
|
static float2 _3;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float2 _3 : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
_3 = mul(_4_m0, _4_m1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output._3 = _3;
|
||||||
|
return stage_output;
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
}
|
21
reference/opt/shaders-hlsl/comp/access-chains.comp
Normal file
21
reference/opt/shaders-hlsl/comp/access-chains.comp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
RWByteAddressBuffer wo : register(u1);
|
||||||
|
ByteAddressBuffer ro : register(u0);
|
||||||
|
|
||||||
|
static uint3 gl_GlobalInvocationID;
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||||
|
};
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
wo.Store4(gl_GlobalInvocationID.x * 64 + 272, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 64 + 160))));
|
||||||
|
wo.Store4(gl_GlobalInvocationID.x * 16 + 480, asuint(asfloat(ro.Load4(gl_GlobalInvocationID.x * 16 + 480))));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||||
|
comp_main();
|
||||||
|
}
|
15
reference/opt/shaders-hlsl/comp/address-buffers.comp
Normal file
15
reference/opt/shaders-hlsl/comp/address-buffers.comp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
RWByteAddressBuffer WriteOnly : register(u2);
|
||||||
|
ByteAddressBuffer ReadOnly : register(u0);
|
||||||
|
RWByteAddressBuffer ReadWrite : register(u1);
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
WriteOnly.Store4(0, asuint(asfloat(ReadOnly.Load4(0))));
|
||||||
|
ReadWrite.Store4(0, asuint(asfloat(ReadWrite.Load4(0)) + float4(10.0f, 10.0f, 10.0f, 10.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
90
reference/opt/shaders-hlsl/comp/atomic.comp
Normal file
90
reference/opt/shaders-hlsl/comp/atomic.comp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
RWByteAddressBuffer ssbo : register(u2);
|
||||||
|
RWTexture2D<uint> uImage : register(u0);
|
||||||
|
RWTexture2D<int> iImage : register(u1);
|
||||||
|
|
||||||
|
groupshared int int_atomic;
|
||||||
|
groupshared uint uint_atomic;
|
||||||
|
groupshared int int_atomic_array[1];
|
||||||
|
groupshared uint uint_atomic_array[1];
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
uint _19;
|
||||||
|
InterlockedAdd(uImage[int2(1, 5)], 1u, _19);
|
||||||
|
uint _27;
|
||||||
|
InterlockedAdd(uImage[int2(1, 5)], 1u, _27);
|
||||||
|
int _28 = int(_27);
|
||||||
|
iImage[int2(1, 6)] = int4(_28, _28, _28, _28).x;
|
||||||
|
uint _32;
|
||||||
|
InterlockedOr(uImage[int2(1, 5)], 1u, _32);
|
||||||
|
uint _34;
|
||||||
|
InterlockedXor(uImage[int2(1, 5)], 1u, _34);
|
||||||
|
uint _36;
|
||||||
|
InterlockedAnd(uImage[int2(1, 5)], 1u, _36);
|
||||||
|
uint _38;
|
||||||
|
InterlockedMin(uImage[int2(1, 5)], 1u, _38);
|
||||||
|
uint _40;
|
||||||
|
InterlockedMax(uImage[int2(1, 5)], 1u, _40);
|
||||||
|
uint _44;
|
||||||
|
InterlockedCompareExchange(uImage[int2(1, 5)], 10u, 2u, _44);
|
||||||
|
int _47;
|
||||||
|
InterlockedAdd(iImage[int2(1, 6)], 1, _47);
|
||||||
|
int _49;
|
||||||
|
InterlockedOr(iImage[int2(1, 6)], 1, _49);
|
||||||
|
int _51;
|
||||||
|
InterlockedXor(iImage[int2(1, 6)], 1, _51);
|
||||||
|
int _53;
|
||||||
|
InterlockedAnd(iImage[int2(1, 6)], 1, _53);
|
||||||
|
int _55;
|
||||||
|
InterlockedMin(iImage[int2(1, 6)], 1, _55);
|
||||||
|
int _57;
|
||||||
|
InterlockedMax(iImage[int2(1, 6)], 1, _57);
|
||||||
|
int _61;
|
||||||
|
InterlockedCompareExchange(iImage[int2(1, 5)], 10, 2, _61);
|
||||||
|
uint _68;
|
||||||
|
ssbo.InterlockedAdd(0, 1u, _68);
|
||||||
|
uint _70;
|
||||||
|
ssbo.InterlockedOr(0, 1u, _70);
|
||||||
|
uint _72;
|
||||||
|
ssbo.InterlockedXor(0, 1u, _72);
|
||||||
|
uint _74;
|
||||||
|
ssbo.InterlockedAnd(0, 1u, _74);
|
||||||
|
uint _76;
|
||||||
|
ssbo.InterlockedMin(0, 1u, _76);
|
||||||
|
uint _78;
|
||||||
|
ssbo.InterlockedMax(0, 1u, _78);
|
||||||
|
uint _80;
|
||||||
|
ssbo.InterlockedExchange(0, 1u, _80);
|
||||||
|
uint _82;
|
||||||
|
ssbo.InterlockedCompareExchange(0, 10u, 2u, _82);
|
||||||
|
int _85;
|
||||||
|
ssbo.InterlockedAdd(4, 1, _85);
|
||||||
|
int _87;
|
||||||
|
ssbo.InterlockedOr(4, 1, _87);
|
||||||
|
int _89;
|
||||||
|
ssbo.InterlockedXor(4, 1, _89);
|
||||||
|
int _91;
|
||||||
|
ssbo.InterlockedAnd(4, 1, _91);
|
||||||
|
int _93;
|
||||||
|
ssbo.InterlockedMin(4, 1, _93);
|
||||||
|
int _95;
|
||||||
|
ssbo.InterlockedMax(4, 1, _95);
|
||||||
|
int _97;
|
||||||
|
ssbo.InterlockedExchange(4, 1, _97);
|
||||||
|
int _99;
|
||||||
|
ssbo.InterlockedCompareExchange(4, 10, 2, _99);
|
||||||
|
int _102;
|
||||||
|
InterlockedAdd(int_atomic, 10, _102);
|
||||||
|
uint _105;
|
||||||
|
InterlockedAdd(uint_atomic, 10u, _105);
|
||||||
|
int _110;
|
||||||
|
InterlockedAdd(int_atomic_array[0], 10, _110);
|
||||||
|
uint _115;
|
||||||
|
InterlockedAdd(uint_atomic_array[0], 10u, _115);
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
9
reference/opt/shaders-hlsl/comp/builtins.comp
Normal file
9
reference/opt/shaders-hlsl/comp/builtins.comp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(8, 4, 2)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
53
reference/opt/shaders-hlsl/comp/image.comp
Normal file
53
reference/opt/shaders-hlsl/comp/image.comp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
RWTexture2D<float> uImageInF : register(u0);
|
||||||
|
RWTexture2D<float> uImageOutF : register(u1);
|
||||||
|
RWTexture2D<int> uImageInI : register(u2);
|
||||||
|
RWTexture2D<int> uImageOutI : register(u3);
|
||||||
|
RWTexture2D<uint> uImageInU : register(u4);
|
||||||
|
RWTexture2D<uint> uImageOutU : register(u5);
|
||||||
|
RWBuffer<float> uImageInBuffer : register(u6);
|
||||||
|
RWBuffer<float> uImageOutBuffer : register(u7);
|
||||||
|
RWTexture2D<float2> uImageInF2 : register(u0);
|
||||||
|
RWTexture2D<float2> uImageOutF2 : register(u1);
|
||||||
|
RWTexture2D<int2> uImageInI2 : register(u2);
|
||||||
|
RWTexture2D<int2> uImageOutI2 : register(u3);
|
||||||
|
RWTexture2D<uint2> uImageInU2 : register(u4);
|
||||||
|
RWTexture2D<uint2> uImageOutU2 : register(u5);
|
||||||
|
RWBuffer<float2> uImageInBuffer2 : register(u6);
|
||||||
|
RWBuffer<float2> uImageOutBuffer2 : register(u7);
|
||||||
|
RWTexture2D<float4> uImageInF4 : register(u0);
|
||||||
|
RWTexture2D<float4> uImageOutF4 : register(u1);
|
||||||
|
RWTexture2D<int4> uImageInI4 : register(u2);
|
||||||
|
RWTexture2D<int4> uImageOutI4 : register(u3);
|
||||||
|
RWTexture2D<uint4> uImageInU4 : register(u4);
|
||||||
|
RWTexture2D<uint4> uImageOutU4 : register(u5);
|
||||||
|
RWBuffer<float4> uImageInBuffer4 : register(u6);
|
||||||
|
RWBuffer<float4> uImageOutBuffer4 : register(u7);
|
||||||
|
|
||||||
|
static uint3 gl_GlobalInvocationID;
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||||
|
};
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
uImageOutF[int2(gl_GlobalInvocationID.xy)] = float4(uImageInF[int2(gl_GlobalInvocationID.xy)]).x;
|
||||||
|
uImageOutI[int2(gl_GlobalInvocationID.xy)] = int4(uImageInI[int2(gl_GlobalInvocationID.xy)]).x;
|
||||||
|
uImageOutU[int2(gl_GlobalInvocationID.xy)] = uint4(uImageInU[int2(gl_GlobalInvocationID.xy)]).x;
|
||||||
|
uImageOutBuffer[int(gl_GlobalInvocationID.x)] = float4(uImageInBuffer[int(gl_GlobalInvocationID.x)]).x;
|
||||||
|
uImageOutF2[int2(gl_GlobalInvocationID.xy)] = uImageInF2[int2(gl_GlobalInvocationID.xy)].xyyy.xy;
|
||||||
|
uImageOutI2[int2(gl_GlobalInvocationID.xy)] = uImageInI2[int2(gl_GlobalInvocationID.xy)].xyyy.xy;
|
||||||
|
uImageOutU2[int2(gl_GlobalInvocationID.xy)] = uImageInU2[int2(gl_GlobalInvocationID.xy)].xyyy.xy;
|
||||||
|
uImageOutBuffer2[int(gl_GlobalInvocationID.x)] = uImageInBuffer2[int(gl_GlobalInvocationID.x)].xyyy.xy;
|
||||||
|
uImageOutF4[int2(gl_GlobalInvocationID.xy)] = uImageInF4[int2(gl_GlobalInvocationID.xy)];
|
||||||
|
uImageOutI4[int2(gl_GlobalInvocationID.xy)] = uImageInI4[int2(gl_GlobalInvocationID.xy)];
|
||||||
|
uImageOutU4[int2(gl_GlobalInvocationID.xy)] = uImageInU4[int2(gl_GlobalInvocationID.xy)];
|
||||||
|
uImageOutBuffer4[int(gl_GlobalInvocationID.x)] = uImageInBuffer4[int(gl_GlobalInvocationID.x)];
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||||
|
comp_main();
|
||||||
|
}
|
90
reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp
Normal file
90
reference/opt/shaders-hlsl/comp/rwbuffer-matrix.comp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
RWByteAddressBuffer _28 : register(u0);
|
||||||
|
cbuffer _68 : register(b1)
|
||||||
|
{
|
||||||
|
int UBO_index0 : packoffset(c0);
|
||||||
|
int UBO_index1 : packoffset(c0.y);
|
||||||
|
};
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
float4x4 _253 = asfloat(uint4x4(_28.Load(64), _28.Load(80), _28.Load(96), _28.Load(112), _28.Load(68), _28.Load(84), _28.Load(100), _28.Load(116), _28.Load(72), _28.Load(88), _28.Load(104), _28.Load(120), _28.Load(76), _28.Load(92), _28.Load(108), _28.Load(124)));
|
||||||
|
_28.Store4(0, asuint(_253[0]));
|
||||||
|
_28.Store4(16, asuint(_253[1]));
|
||||||
|
_28.Store4(32, asuint(_253[2]));
|
||||||
|
_28.Store4(48, asuint(_253[3]));
|
||||||
|
float2x2 _256 = asfloat(uint2x2(_28.Load(144), _28.Load(152), _28.Load(148), _28.Load(156)));
|
||||||
|
_28.Store2(128, asuint(_256[0]));
|
||||||
|
_28.Store2(136, asuint(_256[1]));
|
||||||
|
float2x3 _259 = asfloat(uint2x3(_28.Load(192), _28.Load(200), _28.Load(208), _28.Load(196), _28.Load(204), _28.Load(212)));
|
||||||
|
_28.Store3(160, asuint(_259[0]));
|
||||||
|
_28.Store3(176, asuint(_259[1]));
|
||||||
|
float3x2 _262 = asfloat(uint3x2(_28.Load(240), _28.Load(256), _28.Load(244), _28.Load(260), _28.Load(248), _28.Load(264)));
|
||||||
|
_28.Store2(216, asuint(_262[0]));
|
||||||
|
_28.Store2(224, asuint(_262[1]));
|
||||||
|
_28.Store2(232, asuint(_262[2]));
|
||||||
|
float4x4 _265 = asfloat(uint4x4(_28.Load4(0), _28.Load4(16), _28.Load4(32), _28.Load4(48)));
|
||||||
|
_28.Store(64, asuint(_265[0].x));
|
||||||
|
_28.Store(68, asuint(_265[1].x));
|
||||||
|
_28.Store(72, asuint(_265[2].x));
|
||||||
|
_28.Store(76, asuint(_265[3].x));
|
||||||
|
_28.Store(80, asuint(_265[0].y));
|
||||||
|
_28.Store(84, asuint(_265[1].y));
|
||||||
|
_28.Store(88, asuint(_265[2].y));
|
||||||
|
_28.Store(92, asuint(_265[3].y));
|
||||||
|
_28.Store(96, asuint(_265[0].z));
|
||||||
|
_28.Store(100, asuint(_265[1].z));
|
||||||
|
_28.Store(104, asuint(_265[2].z));
|
||||||
|
_28.Store(108, asuint(_265[3].z));
|
||||||
|
_28.Store(112, asuint(_265[0].w));
|
||||||
|
_28.Store(116, asuint(_265[1].w));
|
||||||
|
_28.Store(120, asuint(_265[2].w));
|
||||||
|
_28.Store(124, asuint(_265[3].w));
|
||||||
|
float2x2 _268 = asfloat(uint2x2(_28.Load2(128), _28.Load2(136)));
|
||||||
|
_28.Store(144, asuint(_268[0].x));
|
||||||
|
_28.Store(148, asuint(_268[1].x));
|
||||||
|
_28.Store(152, asuint(_268[0].y));
|
||||||
|
_28.Store(156, asuint(_268[1].y));
|
||||||
|
float2x3 _271 = asfloat(uint2x3(_28.Load3(160), _28.Load3(176)));
|
||||||
|
_28.Store(192, asuint(_271[0].x));
|
||||||
|
_28.Store(196, asuint(_271[1].x));
|
||||||
|
_28.Store(200, asuint(_271[0].y));
|
||||||
|
_28.Store(204, asuint(_271[1].y));
|
||||||
|
_28.Store(208, asuint(_271[0].z));
|
||||||
|
_28.Store(212, asuint(_271[1].z));
|
||||||
|
float3x2 _274 = asfloat(uint3x2(_28.Load2(216), _28.Load2(224), _28.Load2(232)));
|
||||||
|
_28.Store(240, asuint(_274[0].x));
|
||||||
|
_28.Store(244, asuint(_274[1].x));
|
||||||
|
_28.Store(248, asuint(_274[2].x));
|
||||||
|
_28.Store(256, asuint(_274[0].y));
|
||||||
|
_28.Store(260, asuint(_274[1].y));
|
||||||
|
_28.Store(264, asuint(_274[2].y));
|
||||||
|
_28.Store(UBO_index0 * 4 + UBO_index1 * 16 + 64, asuint(1.0f));
|
||||||
|
_28.Store(UBO_index0 * 4 + UBO_index1 * 8 + 144, asuint(2.0f));
|
||||||
|
_28.Store(UBO_index0 * 4 + UBO_index1 * 8 + 192, asuint(3.0f));
|
||||||
|
_28.Store(UBO_index0 * 4 + UBO_index1 * 16 + 240, asuint(4.0f));
|
||||||
|
_28.Store(UBO_index0 * 4 + 64, asuint(float4(1.0f, 1.0f, 1.0f, 1.0f).x));
|
||||||
|
_28.Store(UBO_index0 * 4 + 80, asuint(float4(1.0f, 1.0f, 1.0f, 1.0f).y));
|
||||||
|
_28.Store(UBO_index0 * 4 + 96, asuint(float4(1.0f, 1.0f, 1.0f, 1.0f).z));
|
||||||
|
_28.Store(UBO_index0 * 4 + 112, asuint(float4(1.0f, 1.0f, 1.0f, 1.0f).w));
|
||||||
|
_28.Store(UBO_index0 * 4 + 144, asuint(float2(2.0f, 2.0f).x));
|
||||||
|
_28.Store(UBO_index0 * 4 + 152, asuint(float2(2.0f, 2.0f).y));
|
||||||
|
_28.Store(UBO_index0 * 4 + 192, asuint(float3(3.0f, 3.0f, 3.0f).x));
|
||||||
|
_28.Store(UBO_index0 * 4 + 200, asuint(float3(3.0f, 3.0f, 3.0f).y));
|
||||||
|
_28.Store(UBO_index0 * 4 + 208, asuint(float3(3.0f, 3.0f, 3.0f).z));
|
||||||
|
_28.Store(UBO_index0 * 4 + 240, asuint(float2(4.0f, 4.0f).x));
|
||||||
|
_28.Store(UBO_index0 * 4 + 256, asuint(float2(4.0f, 4.0f).y));
|
||||||
|
_28.Store(UBO_index0 * 16 + UBO_index1 * 4 + 0, asuint(1.0f));
|
||||||
|
_28.Store(UBO_index0 * 8 + UBO_index1 * 4 + 128, asuint(2.0f));
|
||||||
|
_28.Store(UBO_index0 * 16 + UBO_index1 * 4 + 160, asuint(3.0f));
|
||||||
|
_28.Store(UBO_index0 * 8 + UBO_index1 * 4 + 216, asuint(4.0f));
|
||||||
|
_28.Store4(UBO_index0 * 16 + 0, asuint(float4(1.0f, 1.0f, 1.0f, 1.0f)));
|
||||||
|
_28.Store2(UBO_index0 * 8 + 128, asuint(float2(2.0f, 2.0f)));
|
||||||
|
_28.Store3(UBO_index0 * 16 + 160, asuint(float3(3.0f, 3.0f, 3.0f)));
|
||||||
|
_28.Store2(UBO_index0 * 8 + 216, asuint(float2(4.0f, 4.0f)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
29
reference/opt/shaders-hlsl/comp/shared.comp
Normal file
29
reference/opt/shaders-hlsl/comp/shared.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
static const uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||||
|
|
||||||
|
ByteAddressBuffer _22 : register(u0);
|
||||||
|
RWByteAddressBuffer _44 : register(u1);
|
||||||
|
|
||||||
|
static uint3 gl_GlobalInvocationID;
|
||||||
|
static uint gl_LocalInvocationIndex;
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
|
||||||
|
uint gl_LocalInvocationIndex : SV_GroupIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
groupshared float sShared[4];
|
||||||
|
|
||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
sShared[gl_LocalInvocationIndex] = asfloat(_22.Load(gl_GlobalInvocationID.x * 4 + 0));
|
||||||
|
GroupMemoryBarrierWithGroupSync();
|
||||||
|
_44.Store(gl_GlobalInvocationID.x * 4 + 0, asuint(sShared[(4u - gl_LocalInvocationIndex) - 1u]));
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(4, 1, 1)]
|
||||||
|
void main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
|
||||||
|
gl_LocalInvocationIndex = stage_input.gl_LocalInvocationIndex;
|
||||||
|
comp_main();
|
||||||
|
}
|
9
reference/opt/shaders-hlsl/comp/ssbo-array.comp
Normal file
9
reference/opt/shaders-hlsl/comp/ssbo-array.comp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
void comp_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[numthreads(1, 1, 1)]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
comp_main();
|
||||||
|
}
|
32
reference/opt/shaders-hlsl/frag/basic.frag
Normal file
32
reference/opt/shaders-hlsl/frag/basic.frag
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
Texture2D<float4> uTex : register(t0);
|
||||||
|
SamplerState _uTex_sampler : register(s0);
|
||||||
|
|
||||||
|
static float4 FragColor;
|
||||||
|
static float4 vColor;
|
||||||
|
static float2 vTex;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 vColor : TEXCOORD0;
|
||||||
|
float2 vTex : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = vColor * uTex.Sample(_uTex_sampler, vTex);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
vColor = stage_input.vColor;
|
||||||
|
vTex = stage_input.vTex;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
26
reference/opt/shaders-hlsl/frag/bit-conversions.frag
Normal file
26
reference/opt/shaders-hlsl/frag/bit-conversions.frag
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
static float2 value;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float2 value : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = float4(1.0f, 0.0f, asfloat(asint(value.x)), 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
value = stage_input.value;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
28
reference/opt/shaders-hlsl/frag/boolean-mix.frag
Normal file
28
reference/opt/shaders-hlsl/frag/boolean-mix.frag
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
static float2 FragColor;
|
||||||
|
static float2 x0;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float2 x0 : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float2 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
bool _21 = x0.x > x0.y;
|
||||||
|
bool2 _27 = bool2(_21, _21);
|
||||||
|
FragColor = float2(_27.x ? float2(1.0f, 0.0f).x : float2(0.0f, 1.0f).x, _27.y ? float2(1.0f, 0.0f).y : float2(0.0f, 1.0f).y);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
x0 = stage_input.x0;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
33
reference/opt/shaders-hlsl/frag/builtins.frag
Normal file
33
reference/opt/shaders-hlsl/frag/builtins.frag
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
static float4 gl_FragCoord;
|
||||||
|
static float gl_FragDepth;
|
||||||
|
static float4 FragColor;
|
||||||
|
static float4 vColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 vColor : TEXCOORD0;
|
||||||
|
float4 gl_FragCoord : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
float gl_FragDepth : SV_Depth;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = gl_FragCoord + vColor;
|
||||||
|
gl_FragDepth = 0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_FragCoord = stage_input.gl_FragCoord;
|
||||||
|
vColor = stage_input.vColor;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_FragDepth = gl_FragDepth;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
27
reference/opt/shaders-hlsl/frag/bvec-operations.frag
Normal file
27
reference/opt/shaders-hlsl/frag/bvec-operations.frag
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
static float2 value;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float2 value : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
bool2 _25 = bool2(value.x == 0.0f, value.y == 0.0f);
|
||||||
|
FragColor = float4(1.0f, 0.0f, float(bool2(!_25.x, !_25.y).x), float(bool2(value.x <= float2(1.5f, 0.5f).x, value.y <= float2(1.5f, 0.5f).y).x));
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
value = stage_input.value;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
Texture2D<float4> uSampler : register(t1);
|
||||||
|
SamplerState _uSampler_sampler : register(s1);
|
||||||
|
Texture2D<float4> uSamplerShadow : register(t1);
|
||||||
|
SamplerComparisonState _uSamplerShadow_sampler : register(s1);
|
||||||
|
|
||||||
|
static float FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = (uSampler.Sample(_uSampler_sampler, float2(1.0f, 1.0f)) + uSampler.Load(int3(int2(10, 10), 0))).x + uSamplerShadow.SampleCmp(_uSamplerShadow_sampler, float3(1.0f, 1.0f, 1.0f).xy, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
Texture2D<float4> uDepth : register(t2);
|
||||||
|
SamplerComparisonState uSampler : register(s0);
|
||||||
|
SamplerState uSampler1 : register(s1);
|
||||||
|
|
||||||
|
static float FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = uDepth.SampleCmp(uSampler, float3(1.0f, 1.0f, 1.0f).xy, 1.0f) + uDepth.Sample(uSampler1, float2(1.0f, 1.0f)).x;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
struct CBO_1
|
||||||
|
{
|
||||||
|
float4 a;
|
||||||
|
float4 b;
|
||||||
|
float4 c;
|
||||||
|
float4 d;
|
||||||
|
};
|
||||||
|
|
||||||
|
ConstantBuffer<CBO_1> cbo[2][4] : register(b4, space0);
|
||||||
|
cbuffer push
|
||||||
|
{
|
||||||
|
float4 PushMe_a : packoffset(c0);
|
||||||
|
float4 PushMe_b : packoffset(c1);
|
||||||
|
float4 PushMe_c : packoffset(c2);
|
||||||
|
float4 PushMe_d : packoffset(c3);
|
||||||
|
};
|
||||||
|
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = cbo[1][2].a;
|
||||||
|
FragColor += cbo[1][2].b;
|
||||||
|
FragColor += cbo[1][2].c;
|
||||||
|
FragColor += cbo[1][2].d;
|
||||||
|
FragColor += PushMe_a;
|
||||||
|
FragColor += PushMe_b;
|
||||||
|
FragColor += PushMe_c;
|
||||||
|
FragColor += PushMe_d;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
9
reference/opt/shaders-hlsl/frag/early-fragment-test.frag
Normal file
9
reference/opt/shaders-hlsl/frag/early-fragment-test.frag
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[earlydepthstencil]
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
}
|
29
reference/opt/shaders-hlsl/frag/image-query-selective.frag
Normal file
29
reference/opt/shaders-hlsl/frag/image-query-selective.frag
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Texture1D<uint4> uSampler1DUint : register(t0);
|
||||||
|
SamplerState _uSampler1DUint_sampler : register(s0);
|
||||||
|
Texture1D<int4> uSampler1DInt : register(t0);
|
||||||
|
SamplerState _uSampler1DInt_sampler : register(s0);
|
||||||
|
|
||||||
|
uint SPIRV_Cross_textureSize(Texture1D<int4> Tex, uint Level, out uint Param)
|
||||||
|
{
|
||||||
|
uint ret;
|
||||||
|
Tex.GetDimensions(Level, ret.x, Param);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint SPIRV_Cross_textureSize(Texture1D<uint4> Tex, uint Level, out uint Param)
|
||||||
|
{
|
||||||
|
uint ret;
|
||||||
|
Tex.GetDimensions(Level, ret.x, Param);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
uint _17_dummy_parameter;
|
||||||
|
uint _24_dummy_parameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
}
|
8
reference/opt/shaders-hlsl/frag/image-query.frag
Normal file
8
reference/opt/shaders-hlsl/frag/image-query.frag
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
}
|
28
reference/opt/shaders-hlsl/frag/io-block.frag
Normal file
28
reference/opt/shaders-hlsl/frag/io-block.frag
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct VertexOut
|
||||||
|
{
|
||||||
|
float4 a : TEXCOORD1;
|
||||||
|
float4 b : TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
|
static VertexOut _12;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = _12.a + _12.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(in VertexOut stage_input_12)
|
||||||
|
{
|
||||||
|
_12 = stage_input_12;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
26
reference/opt/shaders-hlsl/frag/matrix-input.frag
Normal file
26
reference/opt/shaders-hlsl/frag/matrix-input.frag
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
static float4 FragColor;
|
||||||
|
static float4x4 m;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4x4 m : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = ((m[0] + m[1]) + m[2]) + m[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
m = stage_input.m;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
68
reference/opt/shaders-hlsl/frag/mod.frag
Normal file
68
reference/opt/shaders-hlsl/frag/mod.frag
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
static float4 a4;
|
||||||
|
static float4 b4;
|
||||||
|
static float3 a3;
|
||||||
|
static float3 b3;
|
||||||
|
static float2 a2;
|
||||||
|
static float2 b2;
|
||||||
|
static float a1;
|
||||||
|
static float b1;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 a4 : TEXCOORD0;
|
||||||
|
float3 a3 : TEXCOORD1;
|
||||||
|
float2 a2 : TEXCOORD2;
|
||||||
|
float a1 : TEXCOORD3;
|
||||||
|
float4 b4 : TEXCOORD4;
|
||||||
|
float3 b3 : TEXCOORD5;
|
||||||
|
float2 b2 : TEXCOORD6;
|
||||||
|
float b1 : TEXCOORD7;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float mod(float x, float y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float2 mod(float2 x, float2 y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 mod(float3 x, float3 y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
float4 mod(float4 x, float4 y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
float _41 = mod(a1, b1);
|
||||||
|
FragColor = ((mod(a4, b4) + mod(a3, b3).xyzx) + mod(a2, b2).xyxy) + float4(_41, _41, _41, _41);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
a4 = stage_input.a4;
|
||||||
|
b4 = stage_input.b4;
|
||||||
|
a3 = stage_input.a3;
|
||||||
|
b3 = stage_input.b3;
|
||||||
|
a2 = stage_input.a2;
|
||||||
|
b2 = stage_input.b2;
|
||||||
|
a1 = stage_input.a1;
|
||||||
|
b1 = stage_input.b1;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
31
reference/opt/shaders-hlsl/frag/mrt.frag
Normal file
31
reference/opt/shaders-hlsl/frag/mrt.frag
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
static float4 RT0;
|
||||||
|
static float4 RT1;
|
||||||
|
static float4 RT2;
|
||||||
|
static float4 RT3;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 RT0 : SV_Target0;
|
||||||
|
float4 RT1 : SV_Target1;
|
||||||
|
float4 RT2 : SV_Target2;
|
||||||
|
float4 RT3 : SV_Target3;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
RT0 = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
RT1 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||||
|
RT2 = float4(3.0f, 3.0f, 3.0f, 3.0f);
|
||||||
|
RT3 = float4(4.0f, 4.0f, 4.0f, 4.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.RT0 = RT0;
|
||||||
|
stage_output.RT1 = RT1;
|
||||||
|
stage_output.RT2 = RT2;
|
||||||
|
stage_output.RT3 = RT3;
|
||||||
|
return stage_output;
|
||||||
|
}
|
8
reference/opt/shaders-hlsl/frag/no-return.frag
Normal file
8
reference/opt/shaders-hlsl/frag/no-return.frag
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
}
|
16
reference/opt/shaders-hlsl/frag/no-return2.frag
Normal file
16
reference/opt/shaders-hlsl/frag/no-return2.frag
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
static float4 vColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 vColor : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
vColor = stage_input.vColor;
|
||||||
|
frag_main();
|
||||||
|
}
|
14
reference/opt/shaders-hlsl/frag/partial-write-preserve.frag
Normal file
14
reference/opt/shaders-hlsl/frag/partial-write-preserve.frag
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
struct B
|
||||||
|
{
|
||||||
|
float a;
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
}
|
39
reference/opt/shaders-hlsl/frag/resources.frag
Normal file
39
reference/opt/shaders-hlsl/frag/resources.frag
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
cbuffer cbuf : register(b3)
|
||||||
|
{
|
||||||
|
float4 CBuffer_a : packoffset(c0);
|
||||||
|
};
|
||||||
|
cbuffer registers
|
||||||
|
{
|
||||||
|
float4 PushMe_d : packoffset(c0);
|
||||||
|
};
|
||||||
|
Texture2D<float4> uSampledImage : register(t4);
|
||||||
|
SamplerState _uSampledImage_sampler : register(s4);
|
||||||
|
Texture2D<float4> uTexture : register(t5);
|
||||||
|
SamplerState uSampler : register(s6);
|
||||||
|
|
||||||
|
static float2 vTex;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float2 vTex : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = (uSampledImage.Sample(_uSampledImage_sampler, vTex) + uTexture.Sample(uSampler, vTex)) + (CBuffer_a + PushMe_d);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
vTex = stage_input.vTex;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
34
reference/opt/shaders-hlsl/frag/spec-constant.frag
Normal file
34
reference/opt/shaders-hlsl/frag/spec-constant.frag
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
static const float a = 1.0f;
|
||||||
|
static const float b = 2.0f;
|
||||||
|
static const int c = 3;
|
||||||
|
static const int d = 4;
|
||||||
|
|
||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
float elems[(d + 2)];
|
||||||
|
};
|
||||||
|
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float _146[(c + 2)];
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
float _113 = a + b;
|
||||||
|
float vec0[(c + 3)][8];
|
||||||
|
Foo foo;
|
||||||
|
FragColor = ((float4(_113, _113, _113, _113) + float4(vec0[0][0], vec0[0][0], vec0[0][0], vec0[0][0])) + float4(_146[0], _146[0], _146[0], _146[0])) + float4(foo.elems[c], foo.elems[c], foo.elems[c], foo.elems[c]);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
87
reference/opt/shaders-hlsl/frag/tex-sampling.frag
Normal file
87
reference/opt/shaders-hlsl/frag/tex-sampling.frag
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
Texture1D<float4> tex1d;
|
||||||
|
SamplerState _tex1d_sampler;
|
||||||
|
Texture2D<float4> tex2d;
|
||||||
|
SamplerState _tex2d_sampler;
|
||||||
|
Texture3D<float4> tex3d;
|
||||||
|
SamplerState _tex3d_sampler;
|
||||||
|
TextureCube<float4> texCube;
|
||||||
|
SamplerState _texCube_sampler;
|
||||||
|
Texture1D<float4> tex1dShadow;
|
||||||
|
SamplerComparisonState _tex1dShadow_sampler;
|
||||||
|
Texture2D<float4> tex2dShadow;
|
||||||
|
SamplerComparisonState _tex2dShadow_sampler;
|
||||||
|
TextureCube<float4> texCubeShadow;
|
||||||
|
SamplerComparisonState _texCubeShadow_sampler;
|
||||||
|
Texture1DArray<float4> tex1dArray;
|
||||||
|
SamplerState _tex1dArray_sampler;
|
||||||
|
Texture2DArray<float4> tex2dArray;
|
||||||
|
SamplerState _tex2dArray_sampler;
|
||||||
|
TextureCubeArray<float4> texCubeArray;
|
||||||
|
SamplerState _texCubeArray_sampler;
|
||||||
|
Texture2D<float4> separateTex2d;
|
||||||
|
SamplerState samplerNonDepth;
|
||||||
|
Texture2D<float4> separateTex2dDepth;
|
||||||
|
SamplerComparisonState samplerDepth;
|
||||||
|
|
||||||
|
static float texCoord1d;
|
||||||
|
static float2 texCoord2d;
|
||||||
|
static float3 texCoord3d;
|
||||||
|
static float4 texCoord4d;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float texCoord1d : TEXCOORD0;
|
||||||
|
float2 texCoord2d : TEXCOORD1;
|
||||||
|
float3 texCoord3d : TEXCOORD2;
|
||||||
|
float4 texCoord4d : TEXCOORD3;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
|
||||||
|
{
|
||||||
|
return coord.x / coord.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
|
||||||
|
{
|
||||||
|
return float2(coord.x, coord.y) / coord.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
|
||||||
|
{
|
||||||
|
return float3(coord.x, coord.y, coord.z) / coord.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)))) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)))) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)))) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f);
|
||||||
|
float _178 = _162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f);
|
||||||
|
float4 _327 = _162;
|
||||||
|
_327.w = _178;
|
||||||
|
float _193 = _178 + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f);
|
||||||
|
float4 _331 = _327;
|
||||||
|
_331.w = _193;
|
||||||
|
float4 _335 = _331;
|
||||||
|
_335.w = _193 + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f);
|
||||||
|
float4 _308 = ((((((((((((((_335 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d);
|
||||||
|
float4 _339 = _308;
|
||||||
|
_339.w = _308.w + separateTex2dDepth.SampleCmp(samplerDepth, texCoord3d.xy, texCoord3d.z);
|
||||||
|
FragColor = _339;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
texCoord1d = stage_input.texCoord1d;
|
||||||
|
texCoord2d = stage_input.texCoord2d;
|
||||||
|
texCoord3d = stage_input.texCoord3d;
|
||||||
|
texCoord4d = stage_input.texCoord4d;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
66
reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag
Normal file
66
reference/opt/shaders-hlsl/frag/texture-proj-shadow.frag
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
Texture1D<float4> uShadow1D : register(t0);
|
||||||
|
SamplerComparisonState _uShadow1D_sampler : register(s0);
|
||||||
|
Texture2D<float4> uShadow2D : register(t1);
|
||||||
|
SamplerComparisonState _uShadow2D_sampler : register(s1);
|
||||||
|
Texture1D<float4> uSampler1D : register(t2);
|
||||||
|
SamplerState _uSampler1D_sampler : register(s2);
|
||||||
|
Texture2D<float4> uSampler2D : register(t3);
|
||||||
|
SamplerState _uSampler2D_sampler : register(s3);
|
||||||
|
Texture3D<float4> uSampler3D : register(t4);
|
||||||
|
SamplerState _uSampler3D_sampler : register(s4);
|
||||||
|
|
||||||
|
static float FragColor;
|
||||||
|
static float4 vClip4;
|
||||||
|
static float2 vClip2;
|
||||||
|
static float3 vClip3;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float3 vClip3 : TEXCOORD0;
|
||||||
|
float4 vClip4 : TEXCOORD1;
|
||||||
|
float2 vClip2 : TEXCOORD2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
|
||||||
|
{
|
||||||
|
return coord.x / coord.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
|
||||||
|
{
|
||||||
|
return float2(coord.x, coord.y) / coord.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
|
||||||
|
{
|
||||||
|
return float3(coord.x, coord.y, coord.z) / coord.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
float4 _20 = vClip4;
|
||||||
|
_20.y = vClip4.w;
|
||||||
|
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, SPIRV_Cross_projectTextureCoordinate(_20.xy), vClip4.z);
|
||||||
|
float4 _30 = vClip4;
|
||||||
|
_30.z = vClip4.w;
|
||||||
|
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, SPIRV_Cross_projectTextureCoordinate(_30.xyz), vClip4.z);
|
||||||
|
FragColor = uSampler1D.Sample(_uSampler1D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip2)).x;
|
||||||
|
FragColor = uSampler2D.Sample(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip3)).x;
|
||||||
|
FragColor = uSampler3D.Sample(_uSampler3D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip4)).x;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
vClip4 = stage_input.vClip4;
|
||||||
|
vClip2 = stage_input.vClip2;
|
||||||
|
vClip3 = stage_input.vClip3;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
29
reference/opt/shaders-hlsl/frag/unary-enclose.frag
Normal file
29
reference/opt/shaders-hlsl/frag/unary-enclose.frag
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
static float4 FragColor;
|
||||||
|
static float4 vIn;
|
||||||
|
static int4 vIn1;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 vIn : TEXCOORD0;
|
||||||
|
nointerpolation int4 vIn1 : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = -(-vIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
vIn = stage_input.vIn;
|
||||||
|
vIn1 = stage_input.vIn1;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
26
reference/opt/shaders-hlsl/frag/various-glsl-ops.frag
Normal file
26
reference/opt/shaders-hlsl/frag/various-glsl-ops.frag
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
static float2 interpolant;
|
||||||
|
static float4 FragColor;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float2 interpolant : TEXCOORD0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 FragColor : SV_Target0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void frag_main()
|
||||||
|
{
|
||||||
|
FragColor = float4(0.0f, 0.0f, 0.0f, EvaluateAttributeSnapped(interpolant, float2(0.100000001490116119384765625f, 0.100000001490116119384765625f)).x) + float4(0.0f, 0.0f, 0.0f, ddx_coarse(interpolant.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
interpolant = stage_input.interpolant;
|
||||||
|
frag_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.FragColor = FragColor;
|
||||||
|
return stage_output;
|
||||||
|
}
|
38
reference/opt/shaders-hlsl/vert/basic.vert
Normal file
38
reference/opt/shaders-hlsl/vert/basic.vert
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
cbuffer _16
|
||||||
|
{
|
||||||
|
row_major float4x4 UBO_uMVP : packoffset(c0);
|
||||||
|
};
|
||||||
|
|
||||||
|
static float4 gl_Position;
|
||||||
|
static float4 aVertex;
|
||||||
|
static float3 vNormal;
|
||||||
|
static float3 aNormal;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 aVertex : TEXCOORD0;
|
||||||
|
float3 aNormal : TEXCOORD1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float3 vNormal : TEXCOORD0;
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = mul(aVertex, UBO_uMVP);
|
||||||
|
vNormal = aNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
aVertex = stage_input.aVertex;
|
||||||
|
aNormal = stage_input.aNormal;
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
stage_output.vNormal = vNormal;
|
||||||
|
return stage_output;
|
||||||
|
}
|
29
reference/opt/shaders-hlsl/vert/instancing.vert
Normal file
29
reference/opt/shaders-hlsl/vert/instancing.vert
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
static int gl_VertexIndex;
|
||||||
|
static int gl_InstanceIndex;
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
uint gl_VertexIndex : SV_VertexID;
|
||||||
|
uint gl_InstanceIndex : SV_InstanceID;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
float _19 = float(gl_VertexIndex + gl_InstanceIndex);
|
||||||
|
gl_Position = float4(_19, _19, _19, _19);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
gl_VertexIndex = int(stage_input.gl_VertexIndex);
|
||||||
|
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
79
reference/opt/shaders-hlsl/vert/locations.vert
Normal file
79
reference/opt/shaders-hlsl/vert/locations.vert
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
float3 a;
|
||||||
|
float3 b;
|
||||||
|
float3 c;
|
||||||
|
};
|
||||||
|
|
||||||
|
static float4 gl_Position;
|
||||||
|
static float4 Input2;
|
||||||
|
static float4 Input4;
|
||||||
|
static float4 Input0;
|
||||||
|
static float vLocation0;
|
||||||
|
static float vLocation1;
|
||||||
|
static float vLocation2[2];
|
||||||
|
static Foo vLocation4;
|
||||||
|
static float vLocation9;
|
||||||
|
|
||||||
|
struct VertexOut
|
||||||
|
{
|
||||||
|
float3 color : TEXCOORD7;
|
||||||
|
float3 foo : TEXCOORD8;
|
||||||
|
};
|
||||||
|
|
||||||
|
static VertexOut vout;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float4 Input0 : TEXCOORD0;
|
||||||
|
float4 Input2 : TEXCOORD2;
|
||||||
|
float4 Input4 : TEXCOORD4;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float vLocation0 : TEXCOORD0;
|
||||||
|
float vLocation1 : TEXCOORD1;
|
||||||
|
float vLocation2[2] : TEXCOORD2;
|
||||||
|
Foo vLocation4 : TEXCOORD4;
|
||||||
|
float vLocation9 : TEXCOORD9;
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
Foo _70;
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = ((float4(1.0f, 1.0f, 1.0f, 1.0f) + Input2) + Input4) + Input0;
|
||||||
|
vLocation0 = 0.0f;
|
||||||
|
vLocation1 = 1.0f;
|
||||||
|
vLocation2[0] = 2.0f;
|
||||||
|
vLocation2[1] = 2.0f;
|
||||||
|
Foo _65 = _70;
|
||||||
|
_65.a = float3(1.0f, 1.0f, 1.0f);
|
||||||
|
Foo _67 = _65;
|
||||||
|
_67.b = float3(1.0f, 1.0f, 1.0f);
|
||||||
|
Foo _69 = _67;
|
||||||
|
_69.c = float3(1.0f, 1.0f, 1.0f);
|
||||||
|
vLocation4 = _69;
|
||||||
|
vLocation9 = 9.0f;
|
||||||
|
vout.color = float3(2.0f, 2.0f, 2.0f);
|
||||||
|
vout.foo = float3(4.0f, 4.0f, 4.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input, out VertexOut stage_outputvout)
|
||||||
|
{
|
||||||
|
Input2 = stage_input.Input2;
|
||||||
|
Input4 = stage_input.Input4;
|
||||||
|
Input0 = stage_input.Input0;
|
||||||
|
vert_main();
|
||||||
|
stage_outputvout = vout;
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
stage_output.vLocation0 = vLocation0;
|
||||||
|
stage_output.vLocation1 = vLocation1;
|
||||||
|
stage_output.vLocation2 = vLocation2;
|
||||||
|
stage_output.vLocation4 = vLocation4;
|
||||||
|
stage_output.vLocation9 = vLocation9;
|
||||||
|
return stage_output;
|
||||||
|
}
|
35
reference/opt/shaders-hlsl/vert/matrix-attribute.vert
Normal file
35
reference/opt/shaders-hlsl/vert/matrix-attribute.vert
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
static float4x4 m;
|
||||||
|
static float3 pos;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Input
|
||||||
|
{
|
||||||
|
float3 pos : TEXCOORD0;
|
||||||
|
float4 m_0 : TEXCOORD1_0;
|
||||||
|
float4 m_1 : TEXCOORD1_1;
|
||||||
|
float4 m_2 : TEXCOORD1_2;
|
||||||
|
float4 m_3 : TEXCOORD1_3;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = mul(float4(pos, 1.0f), m);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
|
||||||
|
{
|
||||||
|
m[0] = stage_input.m_0;
|
||||||
|
m[1] = stage_input.m_1;
|
||||||
|
m[2] = stage_input.m_2;
|
||||||
|
m[3] = stage_input.m_3;
|
||||||
|
pos = stage_input.pos;
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
23
reference/opt/shaders-hlsl/vert/matrix-output.vert
Normal file
23
reference/opt/shaders-hlsl/vert/matrix-output.vert
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
static float4x4 m;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4x4 m : TEXCOORD0;
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
m = float4x4(float4(1.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 1.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 1.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
stage_output.m = m;
|
||||||
|
return stage_output;
|
||||||
|
}
|
18
reference/opt/shaders-hlsl/vert/no-input.vert
Normal file
18
reference/opt/shaders-hlsl/vert/no-input.vert
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
20
reference/opt/shaders-hlsl/vert/point-size-compat.vert
Normal file
20
reference/opt/shaders-hlsl/vert/point-size-compat.vert
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
static float gl_PointSize;
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
gl_PointSize = 10.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
50
reference/opt/shaders-hlsl/vert/qualifiers.vert
Normal file
50
reference/opt/shaders-hlsl/vert/qualifiers.vert
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
static float4 gl_Position;
|
||||||
|
static float vFlat;
|
||||||
|
static float vCentroid;
|
||||||
|
static float vSample;
|
||||||
|
static float vNoperspective;
|
||||||
|
|
||||||
|
struct Block
|
||||||
|
{
|
||||||
|
nointerpolation float vFlat : TEXCOORD4;
|
||||||
|
centroid float vCentroid : TEXCOORD5;
|
||||||
|
sample float vSample : TEXCOORD6;
|
||||||
|
noperspective float vNoperspective : TEXCOORD7;
|
||||||
|
};
|
||||||
|
|
||||||
|
static Block vout;
|
||||||
|
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
nointerpolation float vFlat : TEXCOORD0;
|
||||||
|
centroid float vCentroid : TEXCOORD1;
|
||||||
|
sample float vSample : TEXCOORD2;
|
||||||
|
noperspective float vNoperspective : TEXCOORD3;
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
vFlat = 0.0f;
|
||||||
|
vCentroid = 1.0f;
|
||||||
|
vSample = 2.0f;
|
||||||
|
vNoperspective = 3.0f;
|
||||||
|
vout.vFlat = 0.0f;
|
||||||
|
vout.vCentroid = 1.0f;
|
||||||
|
vout.vSample = 2.0f;
|
||||||
|
vout.vNoperspective = 3.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main(out Block stage_outputvout)
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
stage_outputvout = vout;
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
stage_output.vFlat = vFlat;
|
||||||
|
stage_output.vCentroid = vCentroid;
|
||||||
|
stage_output.vSample = vSample;
|
||||||
|
stage_output.vNoperspective = vNoperspective;
|
||||||
|
return stage_output;
|
||||||
|
}
|
22
reference/opt/shaders-hlsl/vert/sampler-buffers.vert
Normal file
22
reference/opt/shaders-hlsl/vert/sampler-buffers.vert
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Buffer<float4> uFloatSampler : register(t1);
|
||||||
|
Buffer<int4> uIntSampler : register(t2);
|
||||||
|
Buffer<uint4> uUintSampler : register(t3);
|
||||||
|
|
||||||
|
static float4 gl_Position;
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = (uFloatSampler.Load(20) + asfloat(uIntSampler.Load(40))) + asfloat(uUintSampler.Load(60));
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
21
reference/opt/shaders-hlsl/vert/texture_buffer.vert
Normal file
21
reference/opt/shaders-hlsl/vert/texture_buffer.vert
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Buffer<float4> uSamp : register(t4);
|
||||||
|
RWBuffer<float4> uSampo : register(u5);
|
||||||
|
|
||||||
|
static float4 gl_Position;
|
||||||
|
struct SPIRV_Cross_Output
|
||||||
|
{
|
||||||
|
float4 gl_Position : SV_Position;
|
||||||
|
};
|
||||||
|
|
||||||
|
void vert_main()
|
||||||
|
{
|
||||||
|
gl_Position = uSamp.Load(10) + uSampo[100];
|
||||||
|
}
|
||||||
|
|
||||||
|
SPIRV_Cross_Output main()
|
||||||
|
{
|
||||||
|
vert_main();
|
||||||
|
SPIRV_Cross_Output stage_output;
|
||||||
|
stage_output.gl_Position = gl_Position;
|
||||||
|
return stage_output;
|
||||||
|
}
|
29
reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp
Normal file
29
reference/opt/shaders-msl/asm/comp/bitcast_iadd.asm.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _3
|
||||||
|
{
|
||||||
|
int4 _m0;
|
||||||
|
uint4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _4
|
||||||
|
{
|
||||||
|
uint4 _m0;
|
||||||
|
int4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_6._m0 = _5._m1 + uint4(_5._m0);
|
||||||
|
_6._m0 = uint4(_5._m0) + _5._m1;
|
||||||
|
_6._m0 = _5._m1 + _5._m1;
|
||||||
|
_6._m0 = uint4(_5._m0 + _5._m0);
|
||||||
|
_6._m1 = int4(_5._m1 + _5._m1);
|
||||||
|
_6._m1 = _5._m0 + _5._m0;
|
||||||
|
_6._m1 = int4(_5._m1) + _5._m0;
|
||||||
|
_6._m1 = _5._m0 + int4(_5._m1);
|
||||||
|
}
|
||||||
|
|
29
reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp
Normal file
29
reference/opt/shaders-msl/asm/comp/bitcast_sar.asm.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _3
|
||||||
|
{
|
||||||
|
int4 _m0;
|
||||||
|
uint4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _4
|
||||||
|
{
|
||||||
|
uint4 _m0;
|
||||||
|
int4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_6._m0 = uint4(int4(_5._m1) >> _5._m0);
|
||||||
|
_6._m0 = uint4(_5._m0 >> int4(_5._m1));
|
||||||
|
_6._m0 = uint4(int4(_5._m1) >> int4(_5._m1));
|
||||||
|
_6._m0 = uint4(_5._m0 >> _5._m0);
|
||||||
|
_6._m1 = int4(_5._m1) >> int4(_5._m1);
|
||||||
|
_6._m1 = _5._m0 >> _5._m0;
|
||||||
|
_6._m1 = int4(_5._m1) >> _5._m0;
|
||||||
|
_6._m1 = _5._m0 >> int4(_5._m1);
|
||||||
|
}
|
||||||
|
|
29
reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp
Normal file
29
reference/opt/shaders-msl/asm/comp/bitcast_sdiv.asm.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _3
|
||||||
|
{
|
||||||
|
int4 _m0;
|
||||||
|
uint4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _4
|
||||||
|
{
|
||||||
|
uint4 _m0;
|
||||||
|
int4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_6._m0 = uint4(int4(_5._m1) / _5._m0);
|
||||||
|
_6._m0 = uint4(_5._m0 / int4(_5._m1));
|
||||||
|
_6._m0 = uint4(int4(_5._m1) / int4(_5._m1));
|
||||||
|
_6._m0 = uint4(_5._m0 / _5._m0);
|
||||||
|
_6._m1 = int4(_5._m1) / int4(_5._m1);
|
||||||
|
_6._m1 = _5._m0 / _5._m0;
|
||||||
|
_6._m1 = int4(_5._m1) / _5._m0;
|
||||||
|
_6._m1 = _5._m0 / int4(_5._m1);
|
||||||
|
}
|
||||||
|
|
29
reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp
Normal file
29
reference/opt/shaders-msl/asm/comp/bitcast_slr.asm.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _3
|
||||||
|
{
|
||||||
|
int4 _m0;
|
||||||
|
uint4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _4
|
||||||
|
{
|
||||||
|
uint4 _m0;
|
||||||
|
int4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device _3& _5 [[buffer(0)]], device _4& _6 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_6._m0 = _5._m1 >> uint4(_5._m0);
|
||||||
|
_6._m0 = uint4(_5._m0) >> _5._m1;
|
||||||
|
_6._m0 = _5._m1 >> _5._m1;
|
||||||
|
_6._m0 = uint4(_5._m0) >> uint4(_5._m0);
|
||||||
|
_6._m1 = int4(_5._m1 >> _5._m1);
|
||||||
|
_6._m1 = int4(uint4(_5._m0) >> uint4(_5._m0));
|
||||||
|
_6._m1 = int4(_5._m1 >> uint4(_5._m0));
|
||||||
|
_6._m1 = int4(uint4(_5._m0) >> _5._m1);
|
||||||
|
}
|
||||||
|
|
29
reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp
Normal file
29
reference/opt/shaders-msl/asm/comp/multiple-entry.asm.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _6
|
||||||
|
{
|
||||||
|
int4 _m0;
|
||||||
|
uint4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _7
|
||||||
|
{
|
||||||
|
uint4 _m0;
|
||||||
|
int4 _m1;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device _6& _8 [[buffer(0)]], device _7& _9 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_9._m0 = _8._m1 + uint4(_8._m0);
|
||||||
|
_9._m0 = uint4(_8._m0) + _8._m1;
|
||||||
|
_9._m0 = _8._m1 + _8._m1;
|
||||||
|
_9._m0 = uint4(_8._m0 + _8._m0);
|
||||||
|
_9._m1 = int4(_8._m1 + _8._m1);
|
||||||
|
_9._m1 = _8._m0 + _8._m0;
|
||||||
|
_9._m1 = int4(_8._m1) + _8._m0;
|
||||||
|
_9._m1 = _8._m0 + int4(_8._m1);
|
||||||
|
}
|
||||||
|
|
21
reference/opt/shaders-msl/asm/comp/quantize.asm.comp
Normal file
21
reference/opt/shaders-msl/asm/comp/quantize.asm.comp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO0
|
||||||
|
{
|
||||||
|
float scalar;
|
||||||
|
float2 vec2_val;
|
||||||
|
float3 vec3_val;
|
||||||
|
float4 vec4_val;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO0& _4 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
_4.scalar = float(half(_4.scalar));
|
||||||
|
_4.vec2_val = float2(half2(_4.vec2_val));
|
||||||
|
_4.vec3_val = float3(half3(_4.vec3_val));
|
||||||
|
_4.vec4_val = float4(half4(_4.vec4_val));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant uint _5_tmp [[function_constant(10)]];
|
||||||
|
constant uint _5 = is_function_constant_defined(_5_tmp) ? _5_tmp : 9u;
|
||||||
|
constant uint _6_tmp [[function_constant(12)]];
|
||||||
|
constant uint _6 = is_function_constant_defined(_6_tmp) ? _6_tmp : 4u;
|
||||||
|
constant uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float a;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _4 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
_4.a += 1.0;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant uint _3_tmp [[function_constant(0)]];
|
||||||
|
constant uint _3 = is_function_constant_defined(_3_tmp) ? _3_tmp : 1u;
|
||||||
|
constant uint _4_tmp [[function_constant(2)]];
|
||||||
|
constant uint _4 = is_function_constant_defined(_4_tmp) ? _4_tmp : 3u;
|
||||||
|
constant uint3 gl_WorkGroupSize = uint3(_3, 2u, _4);
|
||||||
|
|
||||||
|
struct _6
|
||||||
|
{
|
||||||
|
float _m0[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], device _6& _8 [[buffer(0)]], device _6& _9 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_8._m0[gl_WorkGroupID.x] = _9._m0[gl_WorkGroupID.x] + _8._m0[gl_WorkGroupID.x];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct _9
|
||||||
|
{
|
||||||
|
float _m0;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _10
|
||||||
|
{
|
||||||
|
float _m0;
|
||||||
|
float _m1;
|
||||||
|
float _m2;
|
||||||
|
float _m3;
|
||||||
|
float _m4;
|
||||||
|
float _m5;
|
||||||
|
float _m6;
|
||||||
|
float _m7;
|
||||||
|
float _m8;
|
||||||
|
float _m9;
|
||||||
|
float _m10;
|
||||||
|
float _m11;
|
||||||
|
_9 _m12;
|
||||||
|
};
|
||||||
|
|
||||||
|
constant _10 _51 = _10();
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 m_3 [[color(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment main0_out main0()
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.m_3 = float4(_51._m0, _51._m1, _51._m2, _51._m3);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
23
reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag
Normal file
23
reference/opt/shaders-msl/asm/frag/op-constant-null.asm.frag
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct D
|
||||||
|
{
|
||||||
|
float4 a;
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float FragColor [[color(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment main0_out main0()
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.FragColor = 0.0;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
fragment void main0()
|
||||||
|
{
|
||||||
|
int _16;
|
||||||
|
int _23;
|
||||||
|
for (int _22 = 35; _22 >= 0; _23 = _22 - 1, _22 = _23)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant float4 _38 = float4(0);
|
||||||
|
constant float4 _50 = float4(0);
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 _entryPointOutput [[color(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment main0_out main0()
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
float4 _20;
|
||||||
|
float4 _21;
|
||||||
|
float4 _51;
|
||||||
|
float4 _52;
|
||||||
|
_51 = _50;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (0.0 != 0.0)
|
||||||
|
{
|
||||||
|
_52 = float4(1.0, 0.0, 0.0, 1.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_52 = float4(1.0, 1.0, 0.0, 1.0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_52 = _38;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
out._entryPointOutput = _52;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
vertex void main0()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
36
reference/opt/shaders-msl/comp/atomic.comp
Normal file
36
reference/opt/shaders-msl/comp/atomic.comp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
#include <metal_atomic>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
uint u32;
|
||||||
|
int i32;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& ssbo [[buffer(0)]])
|
||||||
|
{
|
||||||
|
uint _16 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _18 = atomic_fetch_or_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _20 = atomic_fetch_xor_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _22 = atomic_fetch_and_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _24 = atomic_fetch_min_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _26 = atomic_fetch_max_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _28 = atomic_exchange_explicit((volatile device atomic_uint*)&(ssbo.u32), 1u, memory_order_relaxed);
|
||||||
|
uint _30 = 10u;
|
||||||
|
uint _32 = atomic_compare_exchange_weak_explicit((volatile device atomic_uint*)&(ssbo.u32), &(_30), 2u, memory_order_relaxed, memory_order_relaxed);
|
||||||
|
int _36 = atomic_fetch_add_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _38 = atomic_fetch_or_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _40 = atomic_fetch_xor_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _42 = atomic_fetch_and_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _44 = atomic_fetch_min_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _46 = atomic_fetch_max_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _48 = atomic_exchange_explicit((volatile device atomic_int*)&(ssbo.i32), 1, memory_order_relaxed);
|
||||||
|
int _50 = 10;
|
||||||
|
int _52 = atomic_compare_exchange_weak_explicit((volatile device atomic_int*)&(ssbo.i32), &(_50), 2, memory_order_relaxed, memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
22
reference/opt/shaders-msl/comp/bake_gradient.comp
Normal file
22
reference/opt/shaders-msl/comp/bake_gradient.comp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant uint3 gl_WorkGroupSize = uint3(8u, 8u, 1u);
|
||||||
|
|
||||||
|
struct UBO
|
||||||
|
{
|
||||||
|
float4 uInvSize;
|
||||||
|
float4 uScale;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], constant UBO& _46 [[buffer(0)]], texture2d<float> uHeight [[texture(0)]], sampler uHeightSmplr [[sampler(0)]], texture2d<float> uDisplacement [[texture(1)]], sampler uDisplacementSmplr [[sampler(1)]], texture2d<float, access::write> iHeightDisplacement [[texture(2)]], texture2d<float, access::write> iGradJacobian [[texture(3)]])
|
||||||
|
{
|
||||||
|
float4 _59 = (float2(gl_GlobalInvocationID.xy) * _46.uInvSize.xy).xyxy + (_46.uInvSize * 0.5);
|
||||||
|
float2 _157 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(1, 0)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(-1, 0)).xy) * 0.60000002384185791015625) * _46.uScale.z;
|
||||||
|
float2 _161 = ((uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, 1)).xy - uDisplacement.sample(uDisplacementSmplr, _59.zw, level(0.0), int2(0, -1)).xy) * 0.60000002384185791015625) * _46.uScale.z;
|
||||||
|
iHeightDisplacement.write(float4(uHeight.sample(uHeightSmplr, _59.xy, level(0.0)).x, 0.0, 0.0, 0.0), uint2(int2(gl_GlobalInvocationID.xy)));
|
||||||
|
iGradJacobian.write(float4((_46.uScale.xy * 0.5) * float2(uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(1, 0)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(-1, 0)).x, uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, 1)).x - uHeight.sample(uHeightSmplr, _59.xy, level(0.0), int2(0, -1)).x), ((1.0 + _157.x) * (1.0 + _161.y)) - (_157.y * _161.x), 0.0), uint2(int2(gl_GlobalInvocationID.xy)));
|
||||||
|
}
|
||||||
|
|
33
reference/opt/shaders-msl/comp/basic.comp
Normal file
33
reference/opt/shaders-msl/comp/basic.comp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
#include <metal_atomic>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO3
|
||||||
|
{
|
||||||
|
uint counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _45 [[buffer(1)]], device SSBO3& _48 [[buffer(2)]])
|
||||||
|
{
|
||||||
|
float4 _29 = _23.in_data[gl_GlobalInvocationID.x];
|
||||||
|
if (dot(_29, float4(1.0, 5.0, 6.0, 2.0)) > 8.19999980926513671875)
|
||||||
|
{
|
||||||
|
uint _52 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(_48.counter), 1u, memory_order_relaxed);
|
||||||
|
_45.out_data[_52] = _29;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
9
reference/opt/shaders-msl/comp/builtins.comp
Normal file
9
reference/opt/shaders-msl/comp/builtins.comp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], uint3 gl_NumWorkGroups [[threadgroups_per_grid]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]])
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
kernel void main0()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
15
reference/opt/shaders-msl/comp/coherent-block.comp
Normal file
15
reference/opt/shaders-msl/comp/coherent-block.comp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 value;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _10 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
_10.value = float4(20.0);
|
||||||
|
}
|
||||||
|
|
15
reference/opt/shaders-msl/comp/coherent-image.comp
Normal file
15
reference/opt/shaders-msl/comp/coherent-image.comp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
int4 value;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _10 [[buffer(0)]], texture2d<int> uImage [[texture(0)]])
|
||||||
|
{
|
||||||
|
_10.value = uImage.read(uint2(int2(10)));
|
||||||
|
}
|
||||||
|
|
35
reference/opt/shaders-msl/comp/culling.comp
Normal file
35
reference/opt/shaders-msl/comp/culling.comp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wunused-variable"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
#include <metal_atomic>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO3
|
||||||
|
{
|
||||||
|
uint count;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], device SSBO2& _38 [[buffer(1)]], device SSBO3& _41 [[buffer(2)]])
|
||||||
|
{
|
||||||
|
float _28 = _22.in_data[gl_GlobalInvocationID.x];
|
||||||
|
if (_28 > 12.0)
|
||||||
|
{
|
||||||
|
uint _45 = atomic_fetch_add_explicit((volatile device atomic_uint*)&(_41.count), 1u, memory_order_relaxed);
|
||||||
|
_38.out_data[_45] = _28;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
21
reference/opt/shaders-msl/comp/defer-parens.comp
Normal file
21
reference/opt/shaders-msl/comp/defer-parens.comp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 data;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _13 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
float4 _17 = _13.data;
|
||||||
|
_13.data = float4(_17.x, _17.yz + float2(10.0), _17.w);
|
||||||
|
_13.data = (_17 + _17) + _17;
|
||||||
|
_13.data = (_17.yz + float2(10.0)).xxyy;
|
||||||
|
_13.data = float4((_17.yz + float2(10.0)).y);
|
||||||
|
_13.data = float4((_17.zw + float2(10.0))[_13.index]);
|
||||||
|
}
|
||||||
|
|
41
reference/opt/shaders-msl/comp/dowhile.comp
Normal file
41
reference/opt/shaders-msl/comp/dowhile.comp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4x4 mvp;
|
||||||
|
float4 in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _28 [[buffer(0)]], device SSBO2& _52 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
float4 _33;
|
||||||
|
float4 _42;
|
||||||
|
int i = 0;
|
||||||
|
_33 = _28.in_data[gl_GlobalInvocationID.x];
|
||||||
|
float4 _56;
|
||||||
|
_56 = _33;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
_42 = _28.mvp * _56;
|
||||||
|
i++;
|
||||||
|
if (i < 16)
|
||||||
|
{
|
||||||
|
_56 = _42;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_52.out_data[gl_GlobalInvocationID.x] = _42;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct myBlock
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
float b[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||||
|
{
|
||||||
|
myStorage.a = (myStorage.a + 1) % 256;
|
||||||
|
myStorage.b[gl_GlobalInvocationID.x] = mod(myStorage.b[gl_GlobalInvocationID.x] + 0.0199999995529651641845703125, 1.0);
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/global-invocation-id.comp
Normal file
26
reference/opt/shaders-msl/comp/global-invocation-id.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct myBlock
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
float b[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||||
|
{
|
||||||
|
myStorage.a = (myStorage.a + 1) % 256;
|
||||||
|
myStorage.b[gl_GlobalInvocationID.x] = mod(myStorage.b[gl_GlobalInvocationID.x] + 0.0199999995529651641845703125, 1.0);
|
||||||
|
}
|
||||||
|
|
10
reference/opt/shaders-msl/comp/image.comp
Normal file
10
reference/opt/shaders-msl/comp/image.comp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
kernel void main0(texture2d<float> uImageIn [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], texture2d<float, access::write> uImageOut [[texture(1)]])
|
||||||
|
{
|
||||||
|
uImageOut.write(uImageIn.read(uint2((int2(gl_GlobalInvocationID.xy) + int2(uImageIn.get_width(), uImageIn.get_height())))), uint2(int2(gl_GlobalInvocationID.xy)));
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/insert.comp
Normal file
26
reference/opt/shaders-msl/comp/insert.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
constant float4 _52 = float4(0);
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||||
|
{
|
||||||
|
float4 _45 = _52;
|
||||||
|
_45.x = 10.0;
|
||||||
|
float4 _47 = _45;
|
||||||
|
_47.y = 30.0;
|
||||||
|
float4 _49 = _47;
|
||||||
|
_49.z = 70.0;
|
||||||
|
float4 _51 = _49;
|
||||||
|
_51.w = 90.0;
|
||||||
|
_27.out_data[gl_GlobalInvocationID.x] = _51;
|
||||||
|
_27.out_data[gl_GlobalInvocationID.x].y = 20.0;
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/local-invocation-id.comp
Normal file
26
reference/opt/shaders-msl/comp/local-invocation-id.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct myBlock
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
float b[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(device myBlock& myStorage [[buffer(0)]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
|
||||||
|
{
|
||||||
|
myStorage.a = (myStorage.a + 1) % 256;
|
||||||
|
myStorage.b[gl_LocalInvocationID.x] = mod(myStorage.b[gl_LocalInvocationID.x] + 0.0199999995529651641845703125, 1.0);
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/local-invocation-index.comp
Normal file
26
reference/opt/shaders-msl/comp/local-invocation-index.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct myBlock
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
float b[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(device myBlock& myStorage [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
|
||||||
|
{
|
||||||
|
myStorage.a = (myStorage.a + 1) % 256;
|
||||||
|
myStorage.b[gl_LocalInvocationIndex] = mod(myStorage.b[gl_LocalInvocationIndex] + 0.0199999995529651641845703125, 1.0);
|
||||||
|
}
|
||||||
|
|
15
reference/opt/shaders-msl/comp/mat3.comp
Normal file
15
reference/opt/shaders-msl/comp/mat3.comp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float3x3 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _22 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
_22.out_data[gl_GlobalInvocationID.x] = float3x3(float3(10.0), float3(20.0), float3(40.0));
|
||||||
|
}
|
||||||
|
|
31
reference/opt/shaders-msl/comp/mod.comp
Normal file
31
reference/opt/shaders-msl/comp/mod.comp
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _33 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_33.out_data[gl_GlobalInvocationID.x] = mod(_23.in_data[gl_GlobalInvocationID.x], _33.out_data[gl_GlobalInvocationID.x]);
|
||||||
|
_33.out_data[gl_GlobalInvocationID.x] = as_type<float4>(as_type<uint4>(_23.in_data[gl_GlobalInvocationID.x]) % as_type<uint4>(_33.out_data[gl_GlobalInvocationID.x]));
|
||||||
|
_33.out_data[gl_GlobalInvocationID.x] = as_type<float4>(as_type<int4>(_23.in_data[gl_GlobalInvocationID.x]) % as_type<int4>(_33.out_data[gl_GlobalInvocationID.x]));
|
||||||
|
}
|
||||||
|
|
22
reference/opt/shaders-msl/comp/modf.comp
Normal file
22
reference/opt/shaders-msl/comp/modf.comp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4 in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(0)]], device SSBO2& _35 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
float4 i;
|
||||||
|
float4 _31 = modf(_23.in_data[gl_GlobalInvocationID.x], i);
|
||||||
|
_35.out_data[gl_GlobalInvocationID.x] = _31;
|
||||||
|
}
|
||||||
|
|
29
reference/opt/shaders-msl/comp/read-write-only.comp
Normal file
29
reference/opt/shaders-msl/comp/read-write-only.comp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 data4;
|
||||||
|
float4 data5;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO0
|
||||||
|
{
|
||||||
|
float4 data0;
|
||||||
|
float4 data1;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO1
|
||||||
|
{
|
||||||
|
float4 data2;
|
||||||
|
float4 data3;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO2& _10 [[buffer(0)]], device SSBO0& _15 [[buffer(1)]], device SSBO1& _21 [[buffer(2)]])
|
||||||
|
{
|
||||||
|
_10.data4 = _15.data0 + _21.data2;
|
||||||
|
_10.data5 = _15.data1 + _21.data3;
|
||||||
|
}
|
||||||
|
|
35
reference/opt/shaders-msl/comp/return.comp
Normal file
35
reference/opt/shaders-msl/comp/return.comp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
constant int _69 = int(0);
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _27 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
int _29;
|
||||||
|
int _65;
|
||||||
|
if (gl_GlobalInvocationID.x == 2u)
|
||||||
|
{
|
||||||
|
_27.out_data[gl_GlobalInvocationID.x] = float4(20.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gl_GlobalInvocationID.x == 4u)
|
||||||
|
{
|
||||||
|
_27.out_data[gl_GlobalInvocationID.x] = float4(10.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int _68 = 0; _68 < 20; _65 = _69 + 1, _68 = _65)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_27.out_data[gl_GlobalInvocationID.x] = float4(10.0);
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/rmw-opt.comp
Normal file
26
reference/opt/shaders-msl/comp/rmw-opt.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO& _9 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
_9.a += 10;
|
||||||
|
_9.a -= 10;
|
||||||
|
_9.a *= 10;
|
||||||
|
_9.a /= 10;
|
||||||
|
_9.a = _9.a << 2;
|
||||||
|
_9.a = _9.a >> 3;
|
||||||
|
_9.a &= 40;
|
||||||
|
_9.a ^= 10;
|
||||||
|
_9.a %= 40;
|
||||||
|
_9.a |= 1;
|
||||||
|
bool _65 = false && true;
|
||||||
|
_9.a = int(_65 && (true || _65));
|
||||||
|
}
|
||||||
|
|
25
reference/opt/shaders-msl/comp/shared.comp
Normal file
25
reference/opt/shaders-msl/comp/shared.comp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
constant uint3 gl_WorkGroupSize = uint3(4u, 1u, 1u);
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _22 [[buffer(0)]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]], device SSBO2& _44 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
threadgroup float sShared[4];
|
||||||
|
sShared[gl_LocalInvocationIndex] = _22.in_data[gl_GlobalInvocationID.x];
|
||||||
|
threadgroup_barrier(mem_flags::mem_threadgroup);
|
||||||
|
_44.out_data[gl_GlobalInvocationID.x] = sShared[(4u - gl_LocalInvocationIndex) - 1u];
|
||||||
|
}
|
||||||
|
|
25
reference/opt/shaders-msl/comp/struct-layout.comp
Normal file
25
reference/opt/shaders-msl/comp/struct-layout.comp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct Foo
|
||||||
|
{
|
||||||
|
float4x4 m;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
Foo out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
Foo in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO2& _23 [[buffer(0)]], device SSBO& _30 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_23.out_data[gl_GlobalInvocationID.x].m = _30.in_data[gl_GlobalInvocationID.x].m * _30.in_data[gl_GlobalInvocationID.x].m;
|
||||||
|
}
|
||||||
|
|
100
reference/opt/shaders-msl/comp/struct-packing.comp
Normal file
100
reference/opt/shaders-msl/comp/struct-packing.comp
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct S0
|
||||||
|
{
|
||||||
|
float2 a[1];
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct S1
|
||||||
|
{
|
||||||
|
packed_float3 a;
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct S2
|
||||||
|
{
|
||||||
|
float3 a[1];
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct S3
|
||||||
|
{
|
||||||
|
float2 a;
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct S4
|
||||||
|
{
|
||||||
|
float2 c;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Content
|
||||||
|
{
|
||||||
|
S0 m0s[1];
|
||||||
|
S1 m1s[1];
|
||||||
|
S2 m2s[1];
|
||||||
|
S0 m0;
|
||||||
|
S1 m1;
|
||||||
|
S2 m2;
|
||||||
|
S3 m3;
|
||||||
|
char pad7[4];
|
||||||
|
float m4;
|
||||||
|
S4 m3s[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO1
|
||||||
|
{
|
||||||
|
Content content;
|
||||||
|
Content content1[2];
|
||||||
|
Content content2;
|
||||||
|
char pad3[8];
|
||||||
|
float2x2 m0;
|
||||||
|
float2x2 m1;
|
||||||
|
float2x3 m2[4];
|
||||||
|
float3x2 m3;
|
||||||
|
float2x2 m4;
|
||||||
|
float2x2 m5[9];
|
||||||
|
float2x3 m6[4][2];
|
||||||
|
float3x2 m7;
|
||||||
|
float array[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO0
|
||||||
|
{
|
||||||
|
Content content;
|
||||||
|
Content content1[2];
|
||||||
|
Content content2;
|
||||||
|
float array[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO1& ssbo_430 [[buffer(0)]], device SSBO0& ssbo_140 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
ssbo_430.content.m0s[0].a[0] = ssbo_140.content.m0s[0].a[0];
|
||||||
|
ssbo_430.content.m0s[0].b = ssbo_140.content.m0s[0].b;
|
||||||
|
ssbo_430.content.m1s[0].a = ssbo_140.content.m1s[0].a;
|
||||||
|
ssbo_430.content.m1s[0].b = ssbo_140.content.m1s[0].b;
|
||||||
|
ssbo_430.content.m2s[0].a[0] = ssbo_140.content.m2s[0].a[0];
|
||||||
|
ssbo_430.content.m2s[0].b = ssbo_140.content.m2s[0].b;
|
||||||
|
ssbo_430.content.m0.a[0] = ssbo_140.content.m0.a[0];
|
||||||
|
ssbo_430.content.m0.b = ssbo_140.content.m0.b;
|
||||||
|
ssbo_430.content.m1.a = ssbo_140.content.m1.a;
|
||||||
|
ssbo_430.content.m1.b = ssbo_140.content.m1.b;
|
||||||
|
ssbo_430.content.m2.a[0] = ssbo_140.content.m2.a[0];
|
||||||
|
ssbo_430.content.m2.b = ssbo_140.content.m2.b;
|
||||||
|
ssbo_430.content.m3.a = ssbo_140.content.m3.a;
|
||||||
|
ssbo_430.content.m3.b = ssbo_140.content.m3.b;
|
||||||
|
ssbo_430.content.m4 = ssbo_140.content.m4;
|
||||||
|
ssbo_430.content.m3s[0].c = ssbo_140.content.m3s[0].c;
|
||||||
|
ssbo_430.content.m3s[1].c = ssbo_140.content.m3s[1].c;
|
||||||
|
ssbo_430.content.m3s[2].c = ssbo_140.content.m3s[2].c;
|
||||||
|
ssbo_430.content.m3s[3].c = ssbo_140.content.m3s[3].c;
|
||||||
|
ssbo_430.content.m3s[4].c = ssbo_140.content.m3s[4].c;
|
||||||
|
ssbo_430.content.m3s[5].c = ssbo_140.content.m3s[5].c;
|
||||||
|
ssbo_430.content.m3s[6].c = ssbo_140.content.m3s[6].c;
|
||||||
|
ssbo_430.content.m3s[7].c = ssbo_140.content.m3s[7].c;
|
||||||
|
}
|
||||||
|
|
85
reference/opt/shaders-msl/comp/torture-loop.comp
Normal file
85
reference/opt/shaders-msl/comp/torture-loop.comp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
float4x4 mvp;
|
||||||
|
float4 in_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 out_data[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
constant uint _98 = uint(0);
|
||||||
|
|
||||||
|
kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
float4 _30;
|
||||||
|
float4 _46;
|
||||||
|
int _33;
|
||||||
|
int _48;
|
||||||
|
int _40;
|
||||||
|
int _77;
|
||||||
|
uint _12;
|
||||||
|
uint _75;
|
||||||
|
float4 _71;
|
||||||
|
uint _73;
|
||||||
|
int _83;
|
||||||
|
_30 = _24.in_data[gl_GlobalInvocationID.x];
|
||||||
|
float4 _93;
|
||||||
|
int _94;
|
||||||
|
_93 = _30;
|
||||||
|
_94 = 0;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
_40 = _94 + 1;
|
||||||
|
if (_40 < 10)
|
||||||
|
{
|
||||||
|
_46 = _93 * 2.0;
|
||||||
|
_48 = _40 + 1;
|
||||||
|
_93 = _46;
|
||||||
|
_94 = _48;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float4 _95;
|
||||||
|
int _96;
|
||||||
|
_95 = _93;
|
||||||
|
_96 = _40;
|
||||||
|
float4 _100;
|
||||||
|
uint _101;
|
||||||
|
for (uint _97 = 0u, _99 = _98; _97 < 16u; _75 = _97 + uint(1), _77 = _96 + 1, _95 = _100, _96 = _77, _97 = _75, _99 = _101)
|
||||||
|
{
|
||||||
|
_100 = _95;
|
||||||
|
_101 = 0u;
|
||||||
|
for (; _101 < 30u; _73 = _101 + uint(1), _100 = _71, _101 = _73)
|
||||||
|
{
|
||||||
|
_71 = _24.mvp * _100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int _102;
|
||||||
|
_102 = _96;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
_83 = _102 + 1;
|
||||||
|
if (_83 > 10)
|
||||||
|
{
|
||||||
|
_102 = _83;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_89.out_data[gl_GlobalInvocationID.x] = _95;
|
||||||
|
}
|
||||||
|
|
35
reference/opt/shaders-msl/comp/type-alias.comp
Normal file
35
reference/opt/shaders-msl/comp/type-alias.comp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct S0
|
||||||
|
{
|
||||||
|
float4 a;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct S1
|
||||||
|
{
|
||||||
|
float4 a;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO0
|
||||||
|
{
|
||||||
|
S0 s0s[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO1
|
||||||
|
{
|
||||||
|
S1 s1s[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
float4 outputs[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO0& _36 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO1& _55 [[buffer(1)]], device SSBO2& _66 [[buffer(2)]])
|
||||||
|
{
|
||||||
|
_66.outputs[gl_GlobalInvocationID.x] = _36.s0s[gl_GlobalInvocationID.x].a + _55.s1s[gl_GlobalInvocationID.x].a;
|
||||||
|
}
|
||||||
|
|
20
reference/opt/shaders-msl/comp/udiv.comp
Normal file
20
reference/opt/shaders-msl/comp/udiv.comp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct SSBO2
|
||||||
|
{
|
||||||
|
uint outputs[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SSBO
|
||||||
|
{
|
||||||
|
uint inputs[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
kernel void main0(device SSBO2& _10 [[buffer(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device SSBO& _23 [[buffer(1)]])
|
||||||
|
{
|
||||||
|
_10.outputs[gl_GlobalInvocationID.x] = _23.inputs[gl_GlobalInvocationID.x] / 29u;
|
||||||
|
}
|
||||||
|
|
26
reference/opt/shaders-msl/comp/writable-ssbo.comp
Normal file
26
reference/opt/shaders-msl/comp/writable-ssbo.comp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
|
|
||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct myBlock
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
float b;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Implementation of the GLSL mod() function, which is slightly different than Metal fmod()
|
||||||
|
template<typename Tx, typename Ty>
|
||||||
|
Tx mod(Tx x, Ty y)
|
||||||
|
{
|
||||||
|
return x - y * floor(x / y);
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel void main0(device myBlock& myStorage [[buffer(0)]])
|
||||||
|
{
|
||||||
|
myStorage.a = (myStorage.a + 1) % 256;
|
||||||
|
myStorage.b = mod(myStorage.b + 0.0199999995529651641845703125, 1.0);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
fragment void main0(texture2d_ms<float> uImageMS [[texture(0)]], texture2d_array<float, access::read_write> uImageArray [[texture(1)]], texture2d<float, access::write> uImage [[texture(2)]])
|
||||||
|
{
|
||||||
|
uImage.write(uImageMS.read(uint2(int2(1, 2)), 2), uint2(int2(2, 3)));
|
||||||
|
uImageArray.write(uImageArray.read(uint2(int3(1, 2, 4).xy), uint(int3(1, 2, 4).z)), uint2(int3(2, 3, 7).xy), uint(int3(2, 3, 7).z));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 FragColor [[color(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment main0_out main0(texture2d<float> uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.FragColor = float4(float(int(uSampler.get_num_mip_levels())));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 FragColor [[color(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
fragment main0_out main0(texture2d_ms<float> uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]], texture2d_ms<float> uSamplerArray [[texture(1)]], sampler uSamplerArraySmplr [[sampler(1)]], texture2d_ms<float> uImage [[texture(2)]], texture2d_ms<float> uImageArray [[texture(3)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.FragColor = float4(float(((int(uSampler.get_num_samples()) + int(uSamplerArray.get_num_samples())) + int(uImage.get_num_samples())) + int(uImageArray.get_num_samples())));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
30
reference/opt/shaders-msl/flatten/basic.flatten.vert
Normal file
30
reference/opt/shaders-msl/flatten/basic.flatten.vert
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct UBO
|
||||||
|
{
|
||||||
|
float4x4 uMVP;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_in
|
||||||
|
{
|
||||||
|
float3 aNormal [[attribute(1)]];
|
||||||
|
float4 aVertex [[attribute(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float3 vNormal [[user(locn0)]];
|
||||||
|
float4 gl_Position [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _16 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.gl_Position = _16.uMVP * in.aVertex;
|
||||||
|
out.vNormal = in.aNormal;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
27
reference/opt/shaders-msl/flatten/multiindex.flatten.vert
Normal file
27
reference/opt/shaders-msl/flatten/multiindex.flatten.vert
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct UBO
|
||||||
|
{
|
||||||
|
float4 Data[3][5];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_in
|
||||||
|
{
|
||||||
|
int2 aIndex [[attribute(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 gl_Position [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _20 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.gl_Position = _20.Data[in.aIndex.x][in.aIndex.y];
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
32
reference/opt/shaders-msl/flatten/push-constant.flatten.vert
Normal file
32
reference/opt/shaders-msl/flatten/push-constant.flatten.vert
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct PushMe
|
||||||
|
{
|
||||||
|
float4x4 MVP;
|
||||||
|
float2x2 Rot;
|
||||||
|
float Arr[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_in
|
||||||
|
{
|
||||||
|
float4 Pos [[attribute(1)]];
|
||||||
|
float2 Rot [[attribute(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float2 vRot [[user(locn0)]];
|
||||||
|
float4 gl_Position [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex main0_out main0(main0_in in [[stage_in]], constant PushMe& registers [[buffer(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.gl_Position = registers.MVP * in.Pos;
|
||||||
|
out.vRot = (registers.Rot * in.Rot) + float2(registers.Arr[2]);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
40
reference/opt/shaders-msl/flatten/struct.flatten.vert
Normal file
40
reference/opt/shaders-msl/flatten/struct.flatten.vert
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct Light
|
||||||
|
{
|
||||||
|
packed_float3 Position;
|
||||||
|
float Radius;
|
||||||
|
float4 Color;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UBO
|
||||||
|
{
|
||||||
|
float4x4 uMVP;
|
||||||
|
Light light;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_in
|
||||||
|
{
|
||||||
|
float3 aNormal [[attribute(1)]];
|
||||||
|
float4 aVertex [[attribute(0)]];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 vColor [[user(locn0)]];
|
||||||
|
float4 gl_Position [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex main0_out main0(main0_in in [[stage_in]], constant UBO& _18 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.gl_Position = _18.uMVP * in.aVertex;
|
||||||
|
out.vColor = float4(0.0);
|
||||||
|
float3 _39 = in.aVertex.xyz - _18.light.Position;
|
||||||
|
out.vColor += ((_18.light.Color * clamp(1.0 - (length(_39) / _18.light.Radius), 0.0, 1.0)) * dot(in.aNormal, normalize(_39)));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
47
reference/opt/shaders-msl/flatten/swizzle.flatten.vert
Normal file
47
reference/opt/shaders-msl/flatten/swizzle.flatten.vert
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include <metal_stdlib>
|
||||||
|
#include <simd/simd.h>
|
||||||
|
|
||||||
|
using namespace metal;
|
||||||
|
|
||||||
|
struct UBO
|
||||||
|
{
|
||||||
|
float4 A;
|
||||||
|
float2 B0;
|
||||||
|
float2 B1;
|
||||||
|
float C0;
|
||||||
|
float3 C1;
|
||||||
|
packed_float3 D0;
|
||||||
|
float D1;
|
||||||
|
float E0;
|
||||||
|
float E1;
|
||||||
|
float E2;
|
||||||
|
float E3;
|
||||||
|
float F0;
|
||||||
|
float2 F1;
|
||||||
|
float F2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct main0_out
|
||||||
|
{
|
||||||
|
float4 oA [[user(locn0)]];
|
||||||
|
float4 oB [[user(locn1)]];
|
||||||
|
float4 oC [[user(locn2)]];
|
||||||
|
float4 oD [[user(locn3)]];
|
||||||
|
float4 oE [[user(locn4)]];
|
||||||
|
float4 oF [[user(locn5)]];
|
||||||
|
float4 gl_Position [[position]];
|
||||||
|
};
|
||||||
|
|
||||||
|
vertex main0_out main0(constant UBO& _22 [[buffer(0)]])
|
||||||
|
{
|
||||||
|
main0_out out = {};
|
||||||
|
out.gl_Position = float4(0.0);
|
||||||
|
out.oA = _22.A;
|
||||||
|
out.oB = float4(_22.B0, _22.B1);
|
||||||
|
out.oC = float4(_22.C0, _22.C1);
|
||||||
|
out.oD = float4(_22.D0, _22.D1);
|
||||||
|
out.oE = float4(_22.E0, _22.E1, _22.E2, _22.E3);
|
||||||
|
out.oF = float4(_22.F0, _22.F1, _22.F2);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user