Updated spirv-cross.

This commit is contained in:
Бранимир Караџић 2019-10-28 19:55:41 -07:00
parent b8fa5e79b1
commit f3544e0b2c
297 changed files with 48026 additions and 2888 deletions

View File

@ -565,6 +565,16 @@ if (SPIRV_CROSS_CLI)
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-reflection
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-ue4
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
add_test(NAME spirv-cross-test-ue4-opt
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_shaders.py --msl --opt --parallel
${spirv-cross-externals}
${CMAKE_CURRENT_SOURCE_DIR}/shaders-ue4
WORKING_DIRECTORY $<TARGET_FILE_DIR:spirv-cross>)
endif()
elseif(NOT ${PYTHONINTERP_FOUND})
message(WARNING "Testing disabled. Could not find python3. If you have python3 installed try running "

View File

@ -514,6 +514,9 @@ struct CLIArguments
bool msl_domain_lower_left = false;
bool msl_argument_buffers = false;
bool msl_texture_buffer_native = false;
bool msl_framebuffer_fetch = false;
bool msl_invariant_float_math = false;
bool msl_emulate_cube_array = false;
bool msl_multiview = false;
bool msl_view_index_from_device_index = false;
bool msl_dispatch_base = false;
@ -598,6 +601,8 @@ static void print_help()
"\t[--msl-domain-lower-left]\n"
"\t[--msl-argument-buffers]\n"
"\t[--msl-texture-buffer-native]\n"
"\t[--msl-framebuffer-fetch]\n"
"\t[--msl-emulate-cube-array]\n"
"\t[--msl-discrete-descriptor-set <index>]\n"
"\t[--msl-device-argument-buffer <index>]\n"
"\t[--msl-multiview]\n"
@ -756,8 +761,13 @@ static string compile_iteration(const CLIArguments &args, std::vector<uint32_t>
msl_opts.msl_version = args.msl_version;
msl_opts.capture_output_to_buffer = args.msl_capture_output_to_buffer;
msl_opts.swizzle_texture_samples = args.msl_swizzle_texture_samples;
msl_opts.invariant_float_math = args.msl_invariant_float_math;
if (args.msl_ios)
{
msl_opts.platform = CompilerMSL::Options::iOS;
msl_opts.ios_use_framebuffer_fetch_subpasses = args.msl_framebuffer_fetch;
msl_opts.emulate_cube_array = args.msl_emulate_cube_array;
}
msl_opts.pad_fragment_output_components = args.msl_pad_fragment_output;
msl_opts.tess_domain_origin_lower_left = args.msl_domain_lower_left;
msl_opts.argument_buffers = args.msl_argument_buffers;
@ -1093,6 +1103,9 @@ static int main_inner(int argc, char *argv[])
cbs.add("--msl-device-argument-buffer",
[&args](CLIParser &parser) { args.msl_device_argument_buffers.push_back(parser.next_uint()); });
cbs.add("--msl-texture-buffer-native", [&args](CLIParser &) { args.msl_texture_buffer_native = true; });
cbs.add("--msl-framebuffer-fetch", [&args](CLIParser &) { args.msl_framebuffer_fetch = true; });
cbs.add("--msl-invariant-float-math", [&args](CLIParser &) { args.msl_invariant_float_math = true; });
cbs.add("--msl-emulate-cube-array", [&args](CLIParser &) { args.msl_emulate_cube_array = true; });
cbs.add("--msl-multiview", [&args](CLIParser &) { args.msl_multiview = true; });
cbs.add("--msl-view-index-from-device-index",
[&args](CLIParser &) { args.msl_view_index_from_device_index = true; });

View File

@ -1,22 +0,0 @@
RWByteAddressBuffer u0_counter : register(u1);
RWBuffer<uint> u0 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
uint _29;
u0_counter.InterlockedAdd(0, -1, _29);
u0[uint(asint(asfloat(_29))) + 0u] = uint(int(gl_GlobalInvocationID.x)).x;
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View File

@ -1,22 +0,0 @@
RWByteAddressBuffer u0_counter : register(u1);
RWBuffer<uint> u0 : register(u0);
static uint3 gl_GlobalInvocationID;
struct SPIRV_Cross_Input
{
uint3 gl_GlobalInvocationID : SV_DispatchThreadID;
};
void comp_main()
{
uint _29;
u0_counter.InterlockedAdd(0, 1, _29);
u0[uint(asint(asfloat(_29))) + 0u] = uint(int(gl_GlobalInvocationID.x)).x;
}
[numthreads(4, 1, 1)]
void main(SPIRV_Cross_Input stage_input)
{
gl_GlobalInvocationID = stage_input.gl_GlobalInvocationID;
comp_main();
}

View File

@ -13,7 +13,8 @@ struct u0_counters
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -13,7 +13,8 @@ struct u0_counters
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -11,7 +11,8 @@ struct cb5_struct
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -11,7 +11,8 @@ struct cb
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -1,13 +1,52 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float _46[16] = { 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 };
constant float4 _76[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
constant float4 _90[4] = { float4(20.0), float4(30.0), float4(50.0), float4(60.0) };
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant spvUnsafeArray<float, 16> _46 = spvUnsafeArray<float, 16>({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 });
constant spvUnsafeArray<float4, 4> _76 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
constant spvUnsafeArray<float4, 4> _90 = spvUnsafeArray<float4, 4>({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) });
struct main0_out
{
@ -19,64 +58,10 @@ struct main0_in
int index [[user(locn0)]];
};
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
fragment main0_out main0(main0_in in [[stage_in]])
{
float4 foobar[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
float4 baz[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
spvUnsafeArray<float4, 4> foobar = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
spvUnsafeArray<float4, 4> baz = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
main0_out out = {};
out.FragColor = _46[in.index];
if (in.index < 10)
@ -102,7 +87,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
}
int _37 = in.index & 3;
out.FragColor += foobar[_37].z;
spvArrayCopyFromConstantToStack1(baz, _90);
baz = _90;
out.FragColor += baz[_37].z;
return out;
}

View File

@ -1,17 +1,54 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct myType
{
float data;
};
constant myType _21[5] = { myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } };
struct main0_out
{
float4 o_color [[color(0)]];
@ -26,6 +63,8 @@ inline Tx mod(Tx x, Ty y)
fragment main0_out main0(float4 gl_FragCoord [[position]])
{
spvUnsafeArray<myType, 5> _21 = spvUnsafeArray<myType, 5>({ myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 }, myType{ 1.0 }, myType{ 0.0 } });
main0_out out = {};
if (_21[int(mod(gl_FragCoord.x, 4.0))].data > 0.0)
{

View File

@ -1,9 +1,50 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float4 _20[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant spvUnsafeArray<float4, 2> _20 = spvUnsafeArray<float4, 2>({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) });
struct main0_out
{
@ -15,7 +56,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
float4 FragColors[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
spvUnsafeArray<float4, 2> FragColors = spvUnsafeArray<float4, 2>({ float4(1.0, 2.0, 3.0, 4.0), float4(10.0) });
out.FragColor = float4(5.0);
out.FragColors_0 = FragColors[0];
out.FragColors_1 = FragColors[1];

View File

@ -0,0 +1,121 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wunused-variable"
#include <metal_stdlib>
#include <simd/simd.h>
#include <metal_atomic>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_StructuredBuffer_v4float
{
spvUnsafeArray<float4, 1> _m0;
};
struct type_Globals
{
uint2 ShadowTileListGroupSize;
};
constant float3 _70 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
struct main0_in
{
uint in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
uint2 _77 = uint2(gl_FragCoord.xy);
uint _78 = _77.y;
uint _83 = _77.x;
float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
float2 _93 = float2(_Globals.ShadowTileListGroupSize);
float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
float3 _102 = float3(_100.x, _100.y, _70.z);
_102.z = 1.0;
uint _103 = in.in_var_TEXCOORD0 * 5u;
uint _107 = _103 + 1u;
if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102))
{
float _122 = _96.x;
float _123 = _96.y;
spvUnsafeArray<float3, 8> _73;
_73[0] = float3(_122, _123, -1000.0);
float _126 = _100.x;
_73[1] = float3(_126, _123, -1000.0);
float _129 = _100.y;
_73[2] = float3(_122, _129, -1000.0);
_73[3] = float3(_126, _129, -1000.0);
_73[4] = float3(_122, _123, 1.0);
_73[5] = float3(_126, _123, 1.0);
_73[6] = float3(_122, _129, 1.0);
_73[7] = float3(_126, _129, 1.0);
float3 _155;
float3 _158;
_155 = float3(-500000.0);
_158 = float3(500000.0);
for (int _160 = 0; _160 < 8; )
{
float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz));
float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz));
_155 = fast::max(_155, _170);
_158 = fast::min(_158, _170);
_160++;
continue;
}
if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
{
uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
}
}
out.out_var_SV_Target0 = float4(0.0);
return out;
}

View File

@ -0,0 +1,122 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wunused-variable"
#include <metal_stdlib>
#include <simd/simd.h>
#include <metal_atomic>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_StructuredBuffer_v4float
{
spvUnsafeArray<float4, 1> _m0;
};
struct type_Globals
{
uint2 ShadowTileListGroupSize;
};
constant float3 _70 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
struct main0_in
{
uint in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0];
uint2 _77 = uint2(gl_FragCoord.xy);
uint _78 = _77.y;
uint _83 = _77.x;
float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
float2 _93 = float2(_Globals.ShadowTileListGroupSize);
float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
float3 _102 = float3(_100.x, _100.y, _70.z);
_102.z = 1.0;
uint _103 = in.in_var_TEXCOORD0 * 5u;
uint _186 = clamp(_103 + 1u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u);
if (all(CulledObjectBoxBounds._m0[_186].xy > _96.xy) && all(CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz < _102))
{
float _122 = _96.x;
float _123 = _96.y;
spvUnsafeArray<float3, 8> _73;
_73[0] = float3(_122, _123, -1000.0);
float _126 = _100.x;
_73[1] = float3(_126, _123, -1000.0);
float _129 = _100.y;
_73[2] = float3(_122, _129, -1000.0);
_73[3] = float3(_126, _129, -1000.0);
_73[4] = float3(_122, _123, 1.0);
_73[5] = float3(_126, _123, 1.0);
_73[6] = float3(_122, _129, 1.0);
_73[7] = float3(_126, _129, 1.0);
float3 _155;
float3 _158;
_155 = float3(-500000.0);
_158 = float3(500000.0);
for (int _160 = 0; _160 < 8; )
{
float3 _166 = _73[int(clamp(uint(_160), uint(0), uint(7)))] - (float3(0.5) * (CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz + CulledObjectBoxBounds._m0[_186].xyz));
float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 2u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 3u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 4u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz));
_155 = fast::max(_155, _170);
_158 = fast::min(_158, _170);
_160++;
continue;
}
if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
{
uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
}
}
out.out_var_SV_Target0 = float4(0.0);
return out;
}

View File

@ -1,10 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct VertexOutput
{
float4 pos;
@ -33,60 +72,6 @@ struct main0_in
float4 gl_Position [[attribute(1)]];
};
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
@ -95,12 +80,12 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 3)
return;
VertexOutput _223[3] = { VertexOutput{ gl_in[0].gl_Position, gl_in[0].VertexOutput_uv }, VertexOutput{ gl_in[1].gl_Position, gl_in[1].VertexOutput_uv }, VertexOutput{ gl_in[2].gl_Position, gl_in[2].VertexOutput_uv } };
VertexOutput param[3];
spvArrayCopyFromStackToStack1(param, _223);
spvUnsafeArray<VertexOutput, 3> _223 = spvUnsafeArray<VertexOutput, 3>({ VertexOutput{ gl_in[0].gl_Position, gl_in[0].VertexOutput_uv }, VertexOutput{ gl_in[1].gl_Position, gl_in[1].VertexOutput_uv }, VertexOutput{ gl_in[2].gl_Position, gl_in[2].VertexOutput_uv } });
spvUnsafeArray<VertexOutput, 3> param;
param = _223;
gl_out[gl_InvocationID].gl_Position = param[gl_InvocationID].pos;
gl_out[gl_InvocationID]._entryPointOutput.uv = param[gl_InvocationID].uv;
threadgroup_barrier(mem_flags::mem_device);
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (int(gl_InvocationID) == 0)
{
float2 _174 = float2(1.0) + gl_in[0].VertexOutput_uv;

View File

@ -0,0 +1,59 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct SSBO
{
float4x4 a;
uint index;
};
kernel void main0(device SSBO& _14 [[buffer(0)]])
{
spvUnsafeArray<float4x4, 2> _32 = spvUnsafeArray<float4x4, 2>({ float4x4(float4(1.0, 0.0, 0.0, 0.0), float4(0.0, 1.0, 0.0, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)), float4x4(float4(2.0, 0.0, 0.0, 0.0), float4(0.0, 2.0, 0.0, 0.0), float4(0.0, 0.0, 2.0, 0.0), float4(0.0, 0.0, 0.0, 2.0)) });
_14.a = _32[_14.index];
}

View File

@ -1,10 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Data
{
float a;
@ -27,67 +66,13 @@ struct SSBO
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(2u, 1u, 1u);
constant Data _25[2] = { Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } };
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
kernel void main0(device SSBO& _53 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_LocalInvocationID [[thread_position_in_threadgroup]])
{
Data _31[2] = { Data{ X, 2.0 }, Data{ 3.0, 5.0 } };
Data data2[2];
spvArrayCopyFromStackToStack1(data2, _31);
spvUnsafeArray<Data, 2> _25 = spvUnsafeArray<Data, 2>({ Data{ 1.0, 2.0 }, Data{ 3.0, 4.0 } });
spvUnsafeArray<Data, 2> _31 = spvUnsafeArray<Data, 2>({ Data{ X, 2.0 }, Data{ 3.0, 5.0 } });
spvUnsafeArray<Data, 2> data2;
data2 = _31;
_53.outdata[gl_WorkGroupID.x].a = _25[gl_LocalInvocationID.x].a + data2[gl_LocalInvocationID.x].a;
_53.outdata[gl_WorkGroupID.x].b = _25[gl_LocalInvocationID.x].b + data2[gl_LocalInvocationID.x].b;
}

View File

@ -1,10 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct SSBO0
{
float4 as[1];
@ -17,65 +56,11 @@ struct SSBO1
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
kernel void main0(device SSBO0& _16 [[buffer(0)]], device SSBO1& _32 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
{
float4 _37[2] = { _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] };
float4 values[2];
spvArrayCopyFromStackToStack1(values, _37);
spvUnsafeArray<float4, 2> _37 = spvUnsafeArray<float4, 2>({ _16.as[gl_GlobalInvocationID.x], _32.bs[gl_GlobalInvocationID.x] });
spvUnsafeArray<float4, 2> values;
values = _37;
_16.as[0] = values[gl_LocalInvocationIndex];
_32.bs[1] = float4(40.0);
}

View File

@ -22,20 +22,23 @@ struct MatrixIn
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
// Returns the determinant of a 2x2 matrix.
inline float spvDet2x2(float a1, float a2, float b1, float b2)
static inline __attribute__((always_inline))
float spvDet2x2(float a1, float a2, float b1, float b2)
{
return a1 * b2 - b1 * a2;
}
// Returns the determinant of a 3x3 matrix.
inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
static inline __attribute__((always_inline))
float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
{
return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float4x4 spvInverse4x4(float4x4 m)
static inline __attribute__((always_inline))
float4x4 spvInverse4x4(float4x4 m)
{
float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)
@ -70,7 +73,8 @@ inline float4x4 spvInverse4x4(float4x4 m)
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float3x3 spvInverse3x3(float3x3 m)
static inline __attribute__((always_inline))
float3x3 spvInverse3x3(float3x3 m)
{
float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
@ -97,7 +101,8 @@ inline float3x3 spvInverse3x3(float3x3 m)
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float2x2 spvInverse2x2(float2x2 m)
static inline __attribute__((always_inline))
float2x2 spvInverse2x2(float2x2 m)
{
float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
#ifndef SPIRV_CROSS_CONSTANT_ID_1
#define SPIRV_CROSS_CONSTANT_ID_1 2
#endif
@ -27,7 +68,7 @@ constant int _32 = (1 - a);
kernel void main0(device SSBO& _17 [[buffer(0)]])
{
int spec_const_array_size[b];
spvUnsafeArray<int, b> spec_const_array_size;
spec_const_array_size[a] = a;
_17.v[_30] = b + spec_const_array_size[_32];
}

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Sub
{
float4 f[2];
@ -20,16 +61,16 @@ constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
kernel void main0(device SSBO& _27 [[buffer(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
float _155[2];
spvUnsafeArray<float, 2> _155;
_155[0] = _27.sub[gl_WorkGroupID.x].f[0].x;
_155[1] = _27.sub[gl_WorkGroupID.x].f[1].x;
float2 _156[2];
spvUnsafeArray<float2, 2> _156;
_156[0] = _27.sub[gl_WorkGroupID.x].f2[0].xy;
_156[1] = _27.sub[gl_WorkGroupID.x].f2[1].xy;
float3 _157[2];
spvUnsafeArray<float3, 2> _157;
_157[0] = _27.sub[gl_WorkGroupID.x].f3[0];
_157[1] = _27.sub[gl_WorkGroupID.x].f3[1];
float4 _158[2];
spvUnsafeArray<float4, 2> _158;
_158[0] = _27.sub[gl_WorkGroupID.x].f4[0];
_158[1] = _27.sub[gl_WorkGroupID.x].f4[1];
_155[gl_GlobalInvocationID.x] += 1.0;

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float3 vVertex;
@ -10,7 +51,7 @@ struct main0_out
struct main0_patchOut
{
float3 vPatch[2];
spvUnsafeArray<float3, 2> vPatch;
};
struct main0_in
@ -28,7 +69,7 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
if (gl_InvocationID >= 4)
return;
gl_out[gl_InvocationID].vVertex = gl_in[gl_InvocationID].vInput + gl_in[gl_InvocationID ^ 1].vInput;
threadgroup_barrier(mem_flags::mem_device);
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (gl_InvocationID == 0)
{
patchOut.vPatch[0] = float3(10.0);

View File

@ -28,10 +28,8 @@ kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
Boo vInput_24;
vInput_24.a = gl_in[gl_InvocationID].Boo_a;
vInput_24.b = gl_in[gl_InvocationID].Boo_b;
gl_out[gl_InvocationID].vVertex = vInput_24;
Boo _25 = Boo{ gl_in[gl_InvocationID].Boo_a, gl_in[gl_InvocationID].Boo_b };
gl_out[gl_InvocationID].vVertex = _25;
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(2.0);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(3.0);

View File

@ -1,9 +1,50 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float _17[5] = { 1.0, 2.0, 3.0, 4.0, 5.0 };
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant spvUnsafeArray<float, 5> _17 = spvUnsafeArray<float, 5>({ 1.0, 2.0, 3.0, 4.0, 5.0 });
struct main0_out
{

View File

@ -0,0 +1,68 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant spvUnsafeArray<float, 3> _17 = spvUnsafeArray<float, 3>({ 1.0, 2.0, 3.0 });
constant spvUnsafeArray<float, 3> _21 = spvUnsafeArray<float, 3>({ 4.0, 5.0, 6.0 });
constant spvUnsafeArray<spvUnsafeArray<float, 3>, 2> _22 = spvUnsafeArray<spvUnsafeArray<float, 3>, 2>({ spvUnsafeArray<float, 3>({ 1.0, 2.0, 3.0 }), spvUnsafeArray<float, 3>({ 4.0, 5.0, 6.0 }) });
struct main0_out
{
float vOutput [[color(0)]];
};
struct main0_in
{
int vIndex1 [[user(locn0)]];
int vIndex2 [[user(locn1)]];
};
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
out.vOutput = _22[in.vIndex1][in.vIndex2];
return out;
}

View File

@ -11,7 +11,8 @@ struct main0_out
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -1,19 +1,59 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Foobar
{
float a;
float b;
};
constant float4 _37[3] = { float4(1.0), float4(2.0), float4(3.0) };
constant float4 _49[2] = { float4(1.0), float4(2.0) };
constant float4 _54[2] = { float4(8.0), float4(10.0) };
constant float4 _55[2][2] = { { float4(1.0), float4(2.0) }, { float4(8.0), float4(10.0) } };
constant Foobar _75[2] = { Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } };
constant spvUnsafeArray<float4, 3> _37 = spvUnsafeArray<float4, 3>({ float4(1.0), float4(2.0), float4(3.0) });
constant spvUnsafeArray<float4, 2> _49 = spvUnsafeArray<float4, 2>({ float4(1.0), float4(2.0) });
constant spvUnsafeArray<float4, 2> _54 = spvUnsafeArray<float4, 2>({ float4(8.0), float4(10.0) });
constant spvUnsafeArray<spvUnsafeArray<float4, 2>, 2> _55 = spvUnsafeArray<spvUnsafeArray<float4, 2>, 2>({ spvUnsafeArray<float4, 2>({ float4(1.0), float4(2.0) }), spvUnsafeArray<float4, 2>({ float4(8.0), float4(10.0) }) });
struct main0_out
{
@ -27,6 +67,8 @@ struct main0_in
fragment main0_out main0(main0_in in [[stage_in]])
{
spvUnsafeArray<Foobar, 2> _75 = spvUnsafeArray<Foobar, 2>({ Foobar{ 10.0, 40.0 }, Foobar{ 90.0, 70.0 } });
main0_out out = {};
out.FragColor = ((_37[in.index] + _55[in.index][in.index + 1]) + float4(30.0)) + float4(_75[in.index].a + _75[in.index].b);
return out;

View File

@ -1,16 +1,56 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Foo
{
float a;
float b;
};
constant float _16[4] = { 1.0, 4.0, 3.0, 2.0 };
constant Foo _28[2] = { Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } };
constant spvUnsafeArray<float, 4> _16 = spvUnsafeArray<float, 4>({ 1.0, 4.0, 3.0, 2.0 });
struct main0_out
{
@ -24,6 +64,8 @@ struct main0_in
fragment main0_out main0(main0_in in [[stage_in]])
{
spvUnsafeArray<Foo, 2> _28 = spvUnsafeArray<Foo, 2>({ Foo{ 10.0, 20.0 }, Foo{ 30.0, 40.0 } });
main0_out out = {};
out.FragColor = float4(_16[in.line]);
out.FragColor += float4(_28[in.line].a * _28[1 - in.line].a);

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 FragColors_0 [[color(0)]];
@ -19,7 +60,7 @@ struct main0_in
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float FragColors[2] = {};
spvUnsafeArray<float, 2> FragColors = {};
float2 FragColor2 = {};
float3 FragColor3 = {};
FragColors[0] = in.vColor.x;

View File

@ -1,13 +1,52 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float _16[16] = { 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 };
constant float4 _60[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
constant float4 _104[4] = { float4(20.0), float4(30.0), float4(50.0), float4(60.0) };
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant spvUnsafeArray<float, 16> _16 = spvUnsafeArray<float, 16>({ 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0 });
constant spvUnsafeArray<float4, 4> _60 = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
constant spvUnsafeArray<float4, 4> _104 = spvUnsafeArray<float4, 4>({ float4(20.0), float4(30.0), float4(50.0), float4(60.0) });
struct main0_out
{
@ -19,60 +58,6 @@ struct main0_in
int index [[user(locn0)]];
};
template<typename T, uint A>
inline void spvArrayCopyFromConstantToStack1(thread T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromConstantToThreadGroup1(threadgroup T (&dst)[A], constant T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToStack1(thread T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromStackToThreadGroup1(threadgroup T (&dst)[A], thread const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToStack1(thread T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
template<typename T, uint A>
inline void spvArrayCopyFromThreadGroupToThreadGroup1(threadgroup T (&dst)[A], threadgroup const T (&src)[A])
{
for (uint i = 0; i < A; i++)
{
dst[i] = src[i];
}
}
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
@ -94,7 +79,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
{
out.FragColor += _60[in.index & 1].x;
}
float4 foobar[4] = { float4(0.0), float4(1.0), float4(8.0), float4(5.0) };
spvUnsafeArray<float4, 4> foobar = spvUnsafeArray<float4, 4>({ float4(0.0), float4(1.0), float4(8.0), float4(5.0) });
if (_63)
{
foobar[1].z = 20.0;

View File

@ -1,10 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 FragColor_0 [[color(0)]];
@ -29,7 +68,7 @@ inline Tx mod(Tx x, Ty y)
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
float4 FragColor[4] = {};
spvUnsafeArray<float4, 4> FragColor = {};
FragColor[0] = mod(in.vA, in.vB);
FragColor[1] = in.vA + in.vB;
FragColor[2] = in.vA - in.vB;

View File

@ -0,0 +1,23 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float FragColor [[color(0)]];
};
struct main0_in
{
float3 vUV [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uTexture [[texture(0)]], sampler uSampler [[sampler(0)]], sampler uSamplerShadow [[sampler(1)]])
{
main0_out out = {};
out.FragColor = float4(uTexture.sample(uSampler, in.vUV.xy)).x;
out.FragColor += uTexture.sample_compare(uSamplerShadow, in.vUV.xy, in.vUV.z);
return out;
}

View File

@ -0,0 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 vUV [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], texturecube<float> cubeSampler [[texture(0)]], texturecube_array<float> cubeArraySampler [[texture(1)]], texture2d_array<float> texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]])
{
main0_out out = {};
out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, in.vUV.xyz, uint(round(in.vUV.w)))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(round(in.vUV.xyz.z)));
return out;
}

View File

@ -0,0 +1,58 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
};
struct main0_in
{
float4 vUV [[user(locn0)]];
};
static inline __attribute__((always_inline))
float3 spvCubemapTo2DArrayFace(float3 P)
{
float3 Coords = abs(P.xyz);
float CubeFace = 0;
float ProjectionAxis = 0;
float u = 0;
float v = 0;
if (Coords.x >= Coords.y && Coords.x >= Coords.z)
{
CubeFace = P.x >= 0 ? 0 : 1;
ProjectionAxis = Coords.x;
u = P.x >= 0 ? -P.z : P.z;
v = -P.y;
}
else if (Coords.y >= Coords.x && Coords.y >= Coords.z)
{
CubeFace = P.y >= 0 ? 2 : 3;
ProjectionAxis = Coords.y;
u = P.x;
v = P.y >= 0 ? P.z : -P.z;
}
else
{
CubeFace = P.z >= 0 ? 4 : 5;
ProjectionAxis = Coords.z;
u = P.z >= 0 ? P.x : -P.x;
v = -P.y;
}
u = 0.5 * (u/ProjectionAxis + 1);
v = 0.5 * (v/ProjectionAxis + 1);
return float3(u, v, CubeFace);
}
fragment main0_out main0(main0_in in [[stage_in]], texturecube<float> cubeSampler [[texture(0)]], texture2d_array<float> cubeArraySampler [[texture(1)]], texture2d_array<float> texArraySampler [[texture(2)]], sampler cubeSamplerSmplr [[sampler(0)]], sampler cubeArraySamplerSmplr [[sampler(1)]], sampler texArraySamplerSmplr [[sampler(2)]])
{
main0_out out = {};
out.FragColor = (cubeSampler.sample(cubeSamplerSmplr, in.vUV.xyz) + cubeArraySampler.sample(cubeArraySamplerSmplr, spvCubemapTo2DArrayFace(in.vUV.xyz).xy, uint(spvCubemapTo2DArrayFace(in.vUV.xyz).z) + (uint(round(in.vUV.w)) * 6u))) + texArraySampler.sample(texArraySamplerSmplr, in.vUV.xyz.xy, uint(round(in.vUV.xyz.z)));
return out;
}

View File

@ -0,0 +1,73 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4x4 vOutputs;
};
struct main0_in
{
float4 vInputs_0 [[attribute(0)]];
float4 vInputs_1 [[attribute(1)]];
float4 vInputs_2 [[attribute(2)]];
float4 vInputs_3 [[attribute(3)]];
};
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
spvUnsafeArray<float4x4, 32> _16 = spvUnsafeArray<float4x4, 32>({ float4x4(gl_in[0].vInputs_0, gl_in[0].vInputs_1, gl_in[0].vInputs_2, gl_in[0].vInputs_3), float4x4(gl_in[1].vInputs_0, gl_in[1].vInputs_1, gl_in[1].vInputs_2, gl_in[1].vInputs_3), float4x4(gl_in[2].vInputs_0, gl_in[2].vInputs_1, gl_in[2].vInputs_2, gl_in[2].vInputs_3), float4x4(gl_in[3].vInputs_0, gl_in[3].vInputs_1, gl_in[3].vInputs_2, gl_in[3].vInputs_3), float4x4(gl_in[4].vInputs_0, gl_in[4].vInputs_1, gl_in[4].vInputs_2, gl_in[4].vInputs_3), float4x4(gl_in[5].vInputs_0, gl_in[5].vInputs_1, gl_in[5].vInputs_2, gl_in[5].vInputs_3), float4x4(gl_in[6].vInputs_0, gl_in[6].vInputs_1, gl_in[6].vInputs_2, gl_in[6].vInputs_3), float4x4(gl_in[7].vInputs_0, gl_in[7].vInputs_1, gl_in[7].vInputs_2, gl_in[7].vInputs_3), float4x4(gl_in[8].vInputs_0, gl_in[8].vInputs_1, gl_in[8].vInputs_2, gl_in[8].vInputs_3), float4x4(gl_in[9].vInputs_0, gl_in[9].vInputs_1, gl_in[9].vInputs_2, gl_in[9].vInputs_3), float4x4(gl_in[10].vInputs_0, gl_in[10].vInputs_1, gl_in[10].vInputs_2, gl_in[10].vInputs_3), float4x4(gl_in[11].vInputs_0, gl_in[11].vInputs_1, gl_in[11].vInputs_2, gl_in[11].vInputs_3), float4x4(gl_in[12].vInputs_0, gl_in[12].vInputs_1, gl_in[12].vInputs_2, gl_in[12].vInputs_3), float4x4(gl_in[13].vInputs_0, gl_in[13].vInputs_1, gl_in[13].vInputs_2, gl_in[13].vInputs_3), float4x4(gl_in[14].vInputs_0, gl_in[14].vInputs_1, gl_in[14].vInputs_2, gl_in[14].vInputs_3), float4x4(gl_in[15].vInputs_0, gl_in[15].vInputs_1, gl_in[15].vInputs_2, gl_in[15].vInputs_3), float4x4(gl_in[16].vInputs_0, gl_in[16].vInputs_1, gl_in[16].vInputs_2, gl_in[16].vInputs_3), float4x4(gl_in[17].vInputs_0, gl_in[17].vInputs_1, gl_in[17].vInputs_2, gl_in[17].vInputs_3), float4x4(gl_in[18].vInputs_0, gl_in[18].vInputs_1, gl_in[18].vInputs_2, gl_in[18].vInputs_3), float4x4(gl_in[19].vInputs_0, gl_in[19].vInputs_1, gl_in[19].vInputs_2, gl_in[19].vInputs_3), float4x4(gl_in[20].vInputs_0, gl_in[20].vInputs_1, gl_in[20].vInputs_2, gl_in[20].vInputs_3), float4x4(gl_in[21].vInputs_0, gl_in[21].vInputs_1, gl_in[21].vInputs_2, gl_in[21].vInputs_3), float4x4(gl_in[22].vInputs_0, gl_in[22].vInputs_1, gl_in[22].vInputs_2, gl_in[22].vInputs_3), float4x4(gl_in[23].vInputs_0, gl_in[23].vInputs_1, gl_in[23].vInputs_2, gl_in[23].vInputs_3), float4x4(gl_in[24].vInputs_0, gl_in[24].vInputs_1, gl_in[24].vInputs_2, gl_in[24].vInputs_3), float4x4(gl_in[25].vInputs_0, gl_in[25].vInputs_1, gl_in[25].vInputs_2, gl_in[25].vInputs_3), float4x4(gl_in[26].vInputs_0, gl_in[26].vInputs_1, gl_in[26].vInputs_2, gl_in[26].vInputs_3), float4x4(gl_in[27].vInputs_0, gl_in[27].vInputs_1, gl_in[27].vInputs_2, gl_in[27].vInputs_3), float4x4(gl_in[28].vInputs_0, gl_in[28].vInputs_1, gl_in[28].vInputs_2, gl_in[28].vInputs_3), float4x4(gl_in[29].vInputs_0, gl_in[29].vInputs_1, gl_in[29].vInputs_2, gl_in[29].vInputs_3), float4x4(gl_in[30].vInputs_0, gl_in[30].vInputs_1, gl_in[30].vInputs_2, gl_in[30].vInputs_3), float4x4(gl_in[31].vInputs_0, gl_in[31].vInputs_1, gl_in[31].vInputs_2, gl_in[31].vInputs_3) });
spvUnsafeArray<float4x4, 32> tmp;
tmp = _16;
gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID];
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,70 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 vOutputs;
};
struct main0_in
{
float4 vInputs [[attribute(0)]];
};
kernel void main0(main0_in in [[stage_in]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 4];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 4)
return;
spvUnsafeArray<float4, 32> _15 = spvUnsafeArray<float4, 32>({ gl_in[0].vInputs, gl_in[1].vInputs, gl_in[2].vInputs, gl_in[3].vInputs, gl_in[4].vInputs, gl_in[5].vInputs, gl_in[6].vInputs, gl_in[7].vInputs, gl_in[8].vInputs, gl_in[9].vInputs, gl_in[10].vInputs, gl_in[11].vInputs, gl_in[12].vInputs, gl_in[13].vInputs, gl_in[14].vInputs, gl_in[15].vInputs, gl_in[16].vInputs, gl_in[17].vInputs, gl_in[18].vInputs, gl_in[19].vInputs, gl_in[20].vInputs, gl_in[21].vInputs, gl_in[22].vInputs, gl_in[23].vInputs, gl_in[24].vInputs, gl_in[25].vInputs, gl_in[26].vInputs, gl_in[27].vInputs, gl_in[28].vInputs, gl_in[29].vInputs, gl_in[30].vInputs, gl_in[31].vInputs });
spvUnsafeArray<float4, 32> tmp;
tmp = _15;
gl_out[gl_InvocationID].vOutputs = tmp[gl_InvocationID];
}

View File

@ -65,16 +65,12 @@ struct main0_patchIn
out.gl_Position += patchIn.vColors;
out.gl_Position += vFoo.a;
out.gl_Position += vFoo.b;
Foo vFoos_202;
vFoos_202.a = patchIn.gl_in[0].Foo_a;
vFoos_202.b = patchIn.gl_in[0].Foo_b;
out.gl_Position += vFoos_202.a;
out.gl_Position += vFoos_202.b;
Foo vFoos_216;
vFoos_216.a = patchIn.gl_in[1].Foo_a;
vFoos_216.b = patchIn.gl_in[1].Foo_b;
out.gl_Position += vFoos_216.a;
out.gl_Position += vFoos_216.b;
Foo _203 = Foo{ patchIn.gl_in[0].Foo_a, patchIn.gl_in[0].Foo_b };
out.gl_Position += _203.a;
out.gl_Position += _203.b;
Foo _217 = Foo{ patchIn.gl_in[1].Foo_a, patchIn.gl_in[1].Foo_b };
out.gl_Position += _217.a;
out.gl_Position += _217.b;
return out;
}

View File

@ -0,0 +1,85 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
};
struct main0_in
{
float4 vInputs_0 [[attribute(0)]];
float4 vInputs_1 [[attribute(1)]];
float4 vInputs_2 [[attribute(2)]];
float4 vInputs_3 [[attribute(3)]];
};
struct main0_patchIn
{
float4 vBoo_0 [[attribute(4)]];
float4 vBoo_1 [[attribute(5)]];
float4 vBoo_2 [[attribute(6)]];
float4 vBoo_3 [[attribute(7)]];
int vIndex [[attribute(8)]];
patch_control_point<main0_in> gl_in;
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float4, 4> vBoo = {};
vBoo[0] = patchIn.vBoo_0;
vBoo[1] = patchIn.vBoo_1;
vBoo[2] = patchIn.vBoo_2;
vBoo[3] = patchIn.vBoo_3;
float4x4 _57 = float4x4(patchIn.gl_in[0u].vInputs_0, patchIn.gl_in[0u].vInputs_1, patchIn.gl_in[0u].vInputs_2, patchIn.gl_in[0u].vInputs_3);
float4x4 _59 = float4x4(patchIn.gl_in[1u].vInputs_0, patchIn.gl_in[1u].vInputs_1, patchIn.gl_in[1u].vInputs_2, patchIn.gl_in[1u].vInputs_3);
float4x4 _47 = _57;
float4x4 _48 = _59;
out.gl_Position = (_47[patchIn.vIndex] + _48[patchIn.vIndex]) + vBoo[patchIn.vIndex];
return out;
}

View File

@ -0,0 +1,78 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
};
struct main0_in
{
float4 vInputs [[attribute(0)]];
};
struct main0_patchIn
{
float4 vBoo_0 [[attribute(1)]];
float4 vBoo_1 [[attribute(2)]];
float4 vBoo_2 [[attribute(3)]];
float4 vBoo_3 [[attribute(4)]];
int vIndex [[attribute(5)]];
patch_control_point<main0_in> gl_in;
};
[[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
{
main0_out out = {};
spvUnsafeArray<float4, 4> vBoo = {};
vBoo[0] = patchIn.vBoo_0;
vBoo[1] = patchIn.vBoo_1;
vBoo[2] = patchIn.vBoo_2;
vBoo[3] = patchIn.vBoo_3;
out.gl_Position = (patchIn.gl_in[0u].vInputs + patchIn.gl_in[1u].vInputs) + vBoo[patchIn.vIndex];
return out;
}

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 gl_Position [[position]];
@ -16,8 +57,8 @@ struct main0_patchIn
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], float3 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
float gl_TessLevelInner[2] = {};
float gl_TessLevelOuter[4] = {};
spvUnsafeArray<float, 2> gl_TessLevelInner = {};
spvUnsafeArray<float, 4> gl_TessLevelOuter = {};
gl_TessLevelInner[0] = patchIn.gl_TessLevel.w;
gl_TessLevelOuter[0] = patchIn.gl_TessLevel.x;
gl_TessLevelOuter[1] = patchIn.gl_TessLevel.y;

View File

@ -0,0 +1,137 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Matrices
{
float4x4 vpMatrix;
float4x4 wMatrix;
float4x3 wMatrix4x3;
float3x4 wMatrix3x4;
};
struct main0_out
{
float3 OutNormal [[user(locn0)]];
float4 OutWorldPos_0 [[user(locn1)]];
float4 OutWorldPos_1 [[user(locn2)]];
float4 OutWorldPos_2 [[user(locn3)]];
float4 OutWorldPos_3 [[user(locn4)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float3 InPos [[attribute(0)]];
float3 InNormal [[attribute(1)]];
};
template<typename T>
T spvFMul(T l, T r)
{
return fma(l, r, T(0));
}
template<typename T, int Cols, int Rows>
vec<T, Cols> spvFMulVectorMatrix(vec<T, Rows> v, matrix<T, Cols, Rows> m)
{
vec<T, Cols> res = vec<T, Cols>(0);
for (uint i = Rows; i > 0; --i)
{
vec<T, Cols> tmp(0);
for (uint j = 0; j < Cols; ++j)
{
tmp[j] = m[j][i - 1];
}
res = fma(tmp, vec<T, Cols>(v[i - 1]), res);
}
return res;
}
template<typename T, int Cols, int Rows>
vec<T, Rows> spvFMulMatrixVector(matrix<T, Cols, Rows> m, vec<T, Cols> v)
{
vec<T, Rows> res = vec<T, Rows>(0);
for (uint i = Cols; i > 0; --i)
{
res = fma(m[i - 1], vec<T, Rows>(v[i - 1]), res);
}
return res;
}
template<typename T, int LCols, int LRows, int RCols, int RRows>
matrix<T, RCols, LRows> spvFMulMatrixMatrix(matrix<T, LCols, LRows> l, matrix<T, RCols, RRows> r)
{
matrix<T, RCols, LRows> res;
for (uint i = 0; i < RCols; i++)
{
vec<T, RCols> tmp(0);
for (uint j = 0; j < LCols; j++)
{
tmp = fma(vec<T, RCols>(r[i][j]), l[j], tmp);
}
res[i] = tmp;
}
return res;
}
vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]])
{
main0_out out = {};
spvUnsafeArray<float4, 4> OutWorldPos = {};
float4 _37 = float4(in.InPos, 1.0);
out.gl_Position = spvFMulMatrixVector(spvFMulMatrixMatrix(_22.vpMatrix, _22.wMatrix), _37);
OutWorldPos[0] = spvFMulMatrixVector(_22.wMatrix, _37);
OutWorldPos[1] = spvFMulVectorMatrix(_37, _22.wMatrix);
OutWorldPos[2] = spvFMulMatrixVector(_22.wMatrix3x4, in.InPos);
OutWorldPos[3] = spvFMulVectorMatrix(in.InPos, _22.wMatrix4x3);
out.OutNormal = spvFMulMatrixVector(_22.wMatrix, float4(in.InNormal, 0.0)).xyz;
out.OutWorldPos_0 = OutWorldPos[0];
out.OutWorldPos_1 = OutWorldPos[1];
out.OutWorldPos_2 = OutWorldPos[2];
out.OutWorldPos_3 = OutWorldPos[3];
return out;
}

View File

@ -0,0 +1,88 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Matrices
{
float4x4 vpMatrix;
float4x4 wMatrix;
float4x3 wMatrix4x3;
float3x4 wMatrix3x4;
};
struct main0_out
{
float3 OutNormal [[user(locn0)]];
float4 OutWorldPos_0 [[user(locn1)]];
float4 OutWorldPos_1 [[user(locn2)]];
float4 OutWorldPos_2 [[user(locn3)]];
float4 OutWorldPos_3 [[user(locn4)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float3 InPos [[attribute(0)]];
float3 InNormal [[attribute(1)]];
};
vertex main0_out main0(main0_in in [[stage_in]], constant Matrices& _22 [[buffer(0)]])
{
main0_out out = {};
spvUnsafeArray<float4, 4> OutWorldPos = {};
float4 _37 = float4(in.InPos, 1.0);
out.gl_Position = (_22.vpMatrix * _22.wMatrix) * _37;
OutWorldPos[0] = _22.wMatrix * _37;
OutWorldPos[1] = _37 * _22.wMatrix;
OutWorldPos[2] = _22.wMatrix3x4 * in.InPos;
OutWorldPos[3] = in.InPos * _22.wMatrix4x3;
out.OutNormal = (_22.wMatrix * float4(in.InNormal, 0.0)).xyz;
out.OutWorldPos_0 = OutWorldPos[0];
out.OutWorldPos_1 = OutWorldPos[1];
out.OutWorldPos_2 = OutWorldPos[2];
out.OutWorldPos_3 = OutWorldPos[3];
return out;
}

View File

@ -59,20 +59,23 @@ inline T spvFindSMSB(T x)
}
// Returns the determinant of a 2x2 matrix.
inline float spvDet2x2(float a1, float a2, float b1, float b2)
static inline __attribute__((always_inline))
float spvDet2x2(float a1, float a2, float b1, float b2)
{
return a1 * b2 - b1 * a2;
}
// Returns the determinant of a 3x3 matrix.
inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
static inline __attribute__((always_inline))
float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
{
return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float4x4 spvInverse4x4(float4x4 m)
static inline __attribute__((always_inline))
float4x4 spvInverse4x4(float4x4 m)
{
float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct UBO
{
float4x4 projection;
@ -40,7 +81,7 @@ vertex main0_out main0(main0_in in [[stage_in]], constant UBO& ubo [[buffer(0)]]
{
main0_out out = {};
float4x4 outTransModel = {};
float4 colors[3] = {};
spvUnsafeArray<float4, 3> colors = {};
float4x4 inViewMat = {};
colors[0] = in.colors_0;
colors[1] = in.colors_1;

View File

@ -1,13 +1,54 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Vert
{
float3x3 wMatrix;
float4 wTmp;
float arr[4];
spvUnsafeArray<float, 4> arr;
};
struct main0_out

View File

@ -1,11 +1,52 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Vert
{
float arr[3];
spvUnsafeArray<float, 3> arr;
float3x3 wMatrix;
float4 wTmp;
};

View File

@ -11,7 +11,8 @@ struct main0_out
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct main0_out
{
float4 FragColor [[color(0)]];
@ -20,7 +61,7 @@ struct main0_in
fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvViewMask [[buffer(24)]], texture2d<float> uTex [[texture(0)]], sampler uTexSmplr [[sampler(0)]], uint gl_ViewIndex [[render_target_array_index]])
{
main0_out out = {};
float2 vTex[4] = {};
spvUnsafeArray<float2, 4> vTex = {};
vTex[0] = in.vTex_0;
vTex[1] = in.vTex_1;
vTex[2] = in.vTex_2;

View File

@ -0,0 +1,356 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_PrimitiveDither
{
float PrimitiveDither_LODFactor;
};
struct type_PrimitiveFade
{
float2 PrimitiveFade_FadeTimeScaleBias;
};
struct type_Material
{
float4 Material_VectorExpressions[9];
float4 Material_ScalarExpressions[3];
};
constant float _98 = {};
constant float _103 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
float gl_FragDepth [[depth(less)]];
};
struct main0_in
{
float4 in_var_TEXCOORD6 [[user(locn0)]];
float4 in_var_TEXCOORD7 [[user(locn1)]];
float4 in_var_TEXCOORD10_centroid [[user(locn2)]];
float4 in_var_TEXCOORD11_centroid [[user(locn3)]];
float4 in_var_TEXCOORD0_0 [[user(locn4)]];
};
static inline __attribute__((always_inline))
void _353()
{
discard_fragment();
}
fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d<float> Material_Texture2D_0 [[texture(0)]], texture2d<float> Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
spvUnsafeArray<float4, 1> in_var_TEXCOORD0 = {};
in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0;
float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy;
float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w);
float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
float3 _148 = _144.xyz / float3(_144.w);
float3 _149 = _148 - float3(View.View_PreViewTranslation);
float3 _151 = normalize(-_148);
float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz);
float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0));
float _172 = 1.0 / _170;
float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172);
float _180_copy;
float2 _183;
_183 = float2(0.0);
float _188;
float _211;
float2 _212;
float _180 = 1.0;
int _185 = 0;
float _187 = 1.0;
float _189 = 1.0;
for (;;)
{
if (float(_185) < (floor(_170) + 2.0))
{
_188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)), dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)))).y;
if (_180 < _188)
{
float _201 = _188 - _180;
float _203 = _201 / ((_189 - _187) + _201);
_211 = (_189 * _203) + (_180 * (1.0 - _203));
_212 = _183 - (float2(_203) * _174);
break;
}
_180_copy = _180;
_180 -= _172;
_183 += _174;
_185++;
_187 = _188;
_189 = _180_copy;
continue;
}
else
{
_211 = _98;
_212 = _183;
break;
}
}
float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias));
float2 _229 = _135 + float2(View.View_TemporalAAParams.x);
float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u);
float2 _238 = _135 * float2(0.015625);
float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x);
float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
float2 _276 = abs(_275);
float3 _279 = dfdx(_149);
float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
float2 _284 = abs(_283);
float3 _287 = dfdy(_149);
if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0)
{
if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875)
{
float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0);
if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0)
{
_353();
}
}
}
if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0)
{
_353();
}
float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875);
out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z);
out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y);
return out;
}

View File

@ -0,0 +1,314 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_Globals
{
float3 SoftTransitionScale;
float4x4 ShadowViewProjectionMatrices[6];
float InvShadowmapResolution;
float ShadowFadeFraction;
float ShadowSharpen;
float4 LightPositionAndInvRadius;
float2 ProjectionDepthBiasParameters;
float4 PointLightDepthBiasAndProjParameters;
};
constant float4 _453 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<float> SceneTexturesStruct_SceneDepthTexture [[texture(0)]], texture2d<float> SceneTexturesStruct_GBufferATexture [[texture(1)]], texture2d<float> SceneTexturesStruct_GBufferBTexture [[texture(2)]], texture2d<float> SceneTexturesStruct_GBufferDTexture [[texture(3)]], depthcube<float> ShadowDepthCubeTexture [[texture(4)]], texture2d<float> SSProfilesTexture [[texture(5)]], sampler SceneTexturesStruct_SceneDepthTextureSampler [[sampler(0)]], sampler SceneTexturesStruct_GBufferATextureSampler [[sampler(1)]], sampler SceneTexturesStruct_GBufferBTextureSampler [[sampler(2)]], sampler SceneTexturesStruct_GBufferDTextureSampler [[sampler(3)]], sampler ShadowDepthTextureSampler [[sampler(4)]], sampler ShadowDepthCubeTextureSampler [[sampler(5)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
float2 _114 = gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw;
float4 _118 = SceneTexturesStruct_SceneDepthTexture.sample(SceneTexturesStruct_SceneDepthTextureSampler, _114, level(0.0));
float _119 = _118.x;
float _133 = ((_119 * View.View_InvDeviceZToWorldZTransform.x) + View.View_InvDeviceZToWorldZTransform.y) + (1.0 / ((_119 * View.View_InvDeviceZToWorldZTransform.z) - View.View_InvDeviceZToWorldZTransform.w));
float4 _147 = View.View_ScreenToWorld * float4(((_114 - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_133), _133, 1.0);
float3 _148 = _147.xyz;
float3 _152 = _Globals.LightPositionAndInvRadius.xyz - _148;
float _158 = length(_152);
bool _160 = (_158 * _Globals.LightPositionAndInvRadius.w) < 1.0;
float _207;
if (_160)
{
float3 _165 = abs(_152);
float _166 = _165.x;
float _167 = _165.y;
float _168 = _165.z;
float _170 = fast::max(_166, fast::max(_167, _168));
int _189;
if (_170 == _166)
{
_189 = (_166 == _152.x) ? 0 : 1;
}
else
{
int _185;
if (_170 == _167)
{
_185 = (_167 == _152.y) ? 2 : 3;
}
else
{
_185 = (_168 == _152.z) ? 4 : 5;
}
_189 = _185;
}
float4 _196 = _Globals.ShadowViewProjectionMatrices[_189] * float4(_147.xyz, 1.0);
float _198 = _196.w;
_207 = ShadowDepthCubeTexture.sample_compare(ShadowDepthCubeTextureSampler, (_152 / float3(_158)), (_196.z / _198) + ((-_Globals.PointLightDepthBiasAndProjParameters.x) / _198), level(0.0));
}
else
{
_207 = 1.0;
}
float _213 = fast::clamp(((_207 - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
float _218 = sqrt(mix(1.0, _213 * _213, _Globals.ShadowFadeFraction));
float4 _219 = _453;
_219.z = _218;
float3 _236 = normalize((SceneTexturesStruct_GBufferATexture.sample(SceneTexturesStruct_GBufferATextureSampler, _114, level(0.0)).xyz * float3(2.0)) - float3(1.0));
uint _240 = uint(round(SceneTexturesStruct_GBufferBTexture.sample(SceneTexturesStruct_GBufferBTextureSampler, _114, level(0.0)).w * 255.0));
bool _248 = (_240 & 15u) == 5u;
float _448;
if (_248)
{
float4 _260 = SSProfilesTexture.read(uint2(int3(1, int(uint((select(float4(0.0), SceneTexturesStruct_GBufferDTexture.sample(SceneTexturesStruct_GBufferDTextureSampler, _114, level(0.0)), bool4(!(((_240 & 4294967280u) & 16u) != 0u))).x * 255.0) + 0.5)), 0).xy), 0);
float _263 = _260.y * 0.5;
float _274 = pow(fast::clamp(dot(-(_152 * float3(rsqrt(dot(_152, _152)))), _236), 0.0, 1.0), 1.0);
float _445;
if (_160)
{
float3 _278 = _152 / float3(_158);
float3 _280 = normalize(cross(_278, float3(0.0, 0.0, 1.0)));
float3 _284 = float3(_Globals.InvShadowmapResolution);
float3 _285 = _280 * _284;
float3 _286 = cross(_280, _278) * _284;
float3 _287 = abs(_278);
float _288 = _287.x;
float _289 = _287.y;
float _290 = _287.z;
float _292 = fast::max(_288, fast::max(_289, _290));
int _311;
if (_292 == _288)
{
_311 = (_288 == _278.x) ? 0 : 1;
}
else
{
int _307;
if (_292 == _289)
{
_307 = (_289 == _278.y) ? 2 : 3;
}
else
{
_307 = (_290 == _278.z) ? 4 : 5;
}
_311 = _307;
}
float4 _318 = _Globals.ShadowViewProjectionMatrices[_311] * float4(_148 - (_236 * float3(_263)), 1.0);
float _323 = _260.x * (10.0 / _Globals.LightPositionAndInvRadius.w);
float _329 = (1.0 / (((_318.z / _318.w) * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w;
float _342 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, (_278 + (_286 * float3(2.5))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
float _364 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(2.3776409626007080078125))) + (_286 * float3(0.77254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
float _387 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(1.46946299076080322265625))) + (_286 * float3(-2.0225429534912109375))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
float _410 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-1.46946299076080322265625))) + (_286 * float3(-2.02254199981689453125))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
float _433 = (_329 - ((1.0 / ((float4(ShadowDepthCubeTexture.sample(ShadowDepthTextureSampler, ((_278 + (_285 * float3(-2.3776409626007080078125))) + (_286 * float3(0.772543013095855712890625))), level(0.0))).x * _Globals.PointLightDepthBiasAndProjParameters.z) - _Globals.PointLightDepthBiasAndProjParameters.w)) * _Globals.LightPositionAndInvRadius.w)) * _323;
_445 = (((((fast::clamp(abs((_342 > 0.0) ? (_342 + _263) : fast::max(0.0, (_342 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25) + (fast::clamp(abs((_364 > 0.0) ? (_364 + _263) : fast::max(0.0, (_364 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_387 > 0.0) ? (_387 + _263) : fast::max(0.0, (_387 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_410 > 0.0) ? (_410 + _263) : fast::max(0.0, (_410 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) + (fast::clamp(abs((_433 > 0.0) ? (_433 + _263) : fast::max(0.0, (_433 * _274) + _263)), 0.1500000059604644775390625, 5.0) + 0.25)) * 0.20000000298023223876953125;
}
else
{
_445 = 1.0;
}
_448 = 1.0 - (_445 * 0.20000000298023223876953125);
}
else
{
_448 = 1.0;
}
float4 _451 = float4(float3(1.0).x, float3(1.0).y, _219.z, float3(1.0).z);
_451.w = _248 ? sqrt(_448) : _218;
out.out_var_SV_Target0 = _451;
return out;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,356 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_PrimitiveDither
{
float PrimitiveDither_LODFactor;
};
struct type_PrimitiveFade
{
float2 PrimitiveFade_FadeTimeScaleBias;
};
struct type_Material
{
float4 Material_VectorExpressions[9];
float4 Material_ScalarExpressions[3];
};
constant float _98 = {};
constant float _103 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
float gl_FragDepth [[depth(less)]];
};
struct main0_in
{
float4 in_var_TEXCOORD6 [[user(locn0)]];
float4 in_var_TEXCOORD7 [[user(locn1)]];
float4 in_var_TEXCOORD10_centroid [[user(locn2)]];
float4 in_var_TEXCOORD11_centroid [[user(locn3)]];
float4 in_var_TEXCOORD0_0 [[user(locn4)]];
};
static inline __attribute__((always_inline))
void _353()
{
discard_fragment();
}
fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_PrimitiveDither& PrimitiveDither [[buffer(1)]], constant type_PrimitiveFade& PrimitiveFade [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture2d<float> Material_Texture2D_0 [[texture(0)]], texture2d<float> Material_Texture2D_3 [[texture(1)]], sampler Material_Texture2D_0Sampler [[sampler(0)]], sampler Material_Texture2D_3Sampler [[sampler(1)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
spvUnsafeArray<float4, 1> in_var_TEXCOORD0 = {};
in_var_TEXCOORD0[0] = in.in_var_TEXCOORD0_0;
float2 _135 = gl_FragCoord.xy - View.View_ViewRectMin.xy;
float4 _140 = float4(_103, _103, gl_FragCoord.z, 1.0) * float4(gl_FragCoord.w);
float4 _144 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
float3 _148 = _144.xyz / float3(_144.w);
float3 _149 = _148 - float3(View.View_PreViewTranslation);
float3 _151 = normalize(-_148);
float3 _152 = _151 * float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz);
float _170 = mix(Material.Material_ScalarExpressions[0].y, Material.Material_ScalarExpressions[0].z, fast::min(fast::max(abs(dot(_151, in.in_var_TEXCOORD11_centroid.xyz)), 0.0), 1.0));
float _172 = 1.0 / _170;
float2 _174 = (float2(Material.Material_ScalarExpressions[0].x) * ((_152.xy * float2(-1.0)) / float2(_152.z))) * float2(_172);
float _180_copy;
float2 _183;
_183 = float2(0.0);
float _188;
float _211;
float2 _212;
float _180 = 1.0;
int _185 = 0;
float _187 = 1.0;
float _189 = 1.0;
for (;;)
{
if (float(_185) < (floor(_170) + 2.0))
{
_188 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _183), gradient2d(dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)), dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y)))).y;
if (_180 < _188)
{
float _201 = _188 - _180;
float _203 = _201 / ((_189 - _187) + _201);
_211 = (_189 * _203) + (_180 * (1.0 - _203));
_212 = _183 - (float2(_203) * _174);
break;
}
_180_copy = _180;
_180 -= _172;
_183 += _174;
_185++;
_187 = _188;
_189 = _180_copy;
continue;
}
else
{
_211 = _98;
_212 = _183;
break;
}
}
float4 _218 = Material_Texture2D_0.sample(Material_Texture2D_0Sampler, (float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y) + _212.xy), bias(View.View_MaterialTextureMipBias));
float2 _229 = _135 + float2(View.View_TemporalAAParams.x);
float _237 = float((uint(_229.x) + (2u * uint(_229.y))) % 5u);
float2 _238 = _135 * float2(0.015625);
float4 _242 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
float4 _254 = Material_Texture2D_3.sample(Material_Texture2D_3Sampler, _238, bias(View.View_MaterialTextureMipBias));
float3 _272 = float3(_212, (1.0 - _211) * Material.Material_ScalarExpressions[0].x);
float2 _275 = dfdx(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
float2 _276 = abs(_275);
float3 _279 = dfdx(_149);
float2 _283 = dfdy(float2(in_var_TEXCOORD0[0].x, in_var_TEXCOORD0[0].y));
float2 _284 = abs(_283);
float3 _287 = dfdy(_149);
if (PrimitiveDither.PrimitiveDither_LODFactor != 0.0)
{
if (abs(PrimitiveDither.PrimitiveDither_LODFactor) > 0.001000000047497451305389404296875)
{
float _317 = fract(cos(dot(floor(gl_FragCoord.xy), float2(347.834503173828125, 3343.28369140625))) * 1000.0);
if ((float((PrimitiveDither.PrimitiveDither_LODFactor < 0.0) ? ((PrimitiveDither.PrimitiveDither_LODFactor + 1.0) > _317) : (PrimitiveDither.PrimitiveDither_LODFactor < _317)) - 0.001000000047497451305389404296875) < 0.0)
{
_353();
}
}
}
if ((((_218.z + ((fast::min(fast::max(1.0 - (_218.x * Material.Material_ScalarExpressions[2].y), 0.0), 1.0) + ((_237 + (_242.x * Material.Material_ScalarExpressions[2].z)) * 0.16666667163372039794921875)) + (-0.5))) * ((fast::clamp((View.View_RealTime * PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.x) + PrimitiveFade.PrimitiveFade_FadeTimeScaleBias.y, 0.0, 1.0) + ((_237 + _254.x) * 0.16666667163372039794921875)) + (-0.5))) - 0.33329999446868896484375) < 0.0)
{
_353();
}
float2 _351 = ((((in.in_var_TEXCOORD6.xy / float2(in.in_var_TEXCOORD6.w)) - View.View_TemporalAAJitter.xy) - ((in.in_var_TEXCOORD7.xy / float2(in.in_var_TEXCOORD7.w)) - View.View_TemporalAAJitter.zw)) * float2(0.2495000064373016357421875)) + float2(0.49999237060546875);
out.gl_FragDepth = fast::min(_140.z / (_140.w + (sqrt(dot(_272, _272)) / (fast::max(sqrt(dot(_276, _276)) / sqrt(dot(_279, _279)), sqrt(dot(_284, _284)) / sqrt(dot(_287, _287))) / abs(dot(float3x3(View.View_ViewToTranslatedWorld[0].xyz, View.View_ViewToTranslatedWorld[1].xyz, View.View_ViewToTranslatedWorld[2].xyz) * float3(0.0, 0.0, 1.0), _151))))), gl_FragCoord.z);
out.out_var_SV_Target0 = float4(_351.x, _351.y, float2(0.0).x, float2(0.0).y);
return out;
}

View File

@ -0,0 +1,503 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_StructuredBuffer_v4float
{
float4 _m0[1];
};
struct type_TranslucentBasePass
{
uint TranslucentBasePass_Shared_Forward_NumLocalLights;
uint TranslucentBasePass_Shared_Forward_NumReflectionCaptures;
uint TranslucentBasePass_Shared_Forward_HasDirectionalLight;
uint TranslucentBasePass_Shared_Forward_NumGridCells;
packed_int3 TranslucentBasePass_Shared_Forward_CulledGridSize;
uint TranslucentBasePass_Shared_Forward_MaxCulledLightsPerCell;
uint TranslucentBasePass_Shared_Forward_LightGridPixelSizeShift;
uint PrePadding_TranslucentBasePass_Shared_Forward_36;
uint PrePadding_TranslucentBasePass_Shared_Forward_40;
uint PrePadding_TranslucentBasePass_Shared_Forward_44;
packed_float3 TranslucentBasePass_Shared_Forward_LightGridZParams;
float PrePadding_TranslucentBasePass_Shared_Forward_60;
packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightDirection;
float PrePadding_TranslucentBasePass_Shared_Forward_76;
packed_float3 TranslucentBasePass_Shared_Forward_DirectionalLightColor;
float TranslucentBasePass_Shared_Forward_DirectionalLightVolumetricScatteringIntensity;
uint TranslucentBasePass_Shared_Forward_DirectionalLightShadowMapChannelMask;
uint PrePadding_TranslucentBasePass_Shared_Forward_100;
float2 TranslucentBasePass_Shared_Forward_DirectionalLightDistanceFadeMAD;
uint TranslucentBasePass_Shared_Forward_NumDirectionalLightCascades;
uint PrePadding_TranslucentBasePass_Shared_Forward_116;
uint PrePadding_TranslucentBasePass_Shared_Forward_120;
uint PrePadding_TranslucentBasePass_Shared_Forward_124;
float4 TranslucentBasePass_Shared_Forward_CascadeEndDepths;
float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToShadowMatrix[4];
float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapMinMax[4];
float4 TranslucentBasePass_Shared_Forward_DirectionalLightShadowmapAtlasBufferSize;
float TranslucentBasePass_Shared_Forward_DirectionalLightDepthBias;
uint TranslucentBasePass_Shared_Forward_DirectionalLightUseStaticShadowing;
uint PrePadding_TranslucentBasePass_Shared_Forward_488;
uint PrePadding_TranslucentBasePass_Shared_Forward_492;
float4 TranslucentBasePass_Shared_Forward_DirectionalLightStaticShadowBufferSize;
float4x4 TranslucentBasePass_Shared_Forward_DirectionalLightWorldToStaticShadow;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_576;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_580;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_584;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_588;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_592;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_596;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_600;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_604;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_608;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_612;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_616;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_620;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_624;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_628;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_632;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_636;
uint TranslucentBasePass_Shared_ForwardISR_NumLocalLights;
uint TranslucentBasePass_Shared_ForwardISR_NumReflectionCaptures;
uint TranslucentBasePass_Shared_ForwardISR_HasDirectionalLight;
uint TranslucentBasePass_Shared_ForwardISR_NumGridCells;
packed_int3 TranslucentBasePass_Shared_ForwardISR_CulledGridSize;
uint TranslucentBasePass_Shared_ForwardISR_MaxCulledLightsPerCell;
uint TranslucentBasePass_Shared_ForwardISR_LightGridPixelSizeShift;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_676;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_680;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_684;
packed_float3 TranslucentBasePass_Shared_ForwardISR_LightGridZParams;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_700;
packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDirection;
float PrePadding_TranslucentBasePass_Shared_ForwardISR_716;
packed_float3 TranslucentBasePass_Shared_ForwardISR_DirectionalLightColor;
float TranslucentBasePass_Shared_ForwardISR_DirectionalLightVolumetricScatteringIntensity;
uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowMapChannelMask;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_740;
float2 TranslucentBasePass_Shared_ForwardISR_DirectionalLightDistanceFadeMAD;
uint TranslucentBasePass_Shared_ForwardISR_NumDirectionalLightCascades;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_756;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_760;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_764;
float4 TranslucentBasePass_Shared_ForwardISR_CascadeEndDepths;
float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToShadowMatrix[4];
float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapMinMax[4];
float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightShadowmapAtlasBufferSize;
float TranslucentBasePass_Shared_ForwardISR_DirectionalLightDepthBias;
uint TranslucentBasePass_Shared_ForwardISR_DirectionalLightUseStaticShadowing;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1128;
uint PrePadding_TranslucentBasePass_Shared_ForwardISR_1132;
float4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightStaticShadowBufferSize;
float4x4 TranslucentBasePass_Shared_ForwardISR_DirectionalLightWorldToStaticShadow;
float PrePadding_TranslucentBasePass_Shared_Reflection_1216;
float PrePadding_TranslucentBasePass_Shared_Reflection_1220;
float PrePadding_TranslucentBasePass_Shared_Reflection_1224;
float PrePadding_TranslucentBasePass_Shared_Reflection_1228;
float PrePadding_TranslucentBasePass_Shared_Reflection_1232;
float PrePadding_TranslucentBasePass_Shared_Reflection_1236;
float PrePadding_TranslucentBasePass_Shared_Reflection_1240;
float PrePadding_TranslucentBasePass_Shared_Reflection_1244;
float PrePadding_TranslucentBasePass_Shared_Reflection_1248;
float PrePadding_TranslucentBasePass_Shared_Reflection_1252;
float PrePadding_TranslucentBasePass_Shared_Reflection_1256;
float PrePadding_TranslucentBasePass_Shared_Reflection_1260;
float PrePadding_TranslucentBasePass_Shared_Reflection_1264;
float PrePadding_TranslucentBasePass_Shared_Reflection_1268;
float PrePadding_TranslucentBasePass_Shared_Reflection_1272;
float PrePadding_TranslucentBasePass_Shared_Reflection_1276;
float4 TranslucentBasePass_Shared_Reflection_SkyLightParameters;
float TranslucentBasePass_Shared_Reflection_SkyLightCubemapBrightness;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1300;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1304;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1308;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1312;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1316;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1320;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1324;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1328;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1332;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1336;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1340;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1344;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1348;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1352;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1356;
float4 TranslucentBasePass_Shared_PlanarReflection_ReflectionPlane;
float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionOrigin;
float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionXAxis;
float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionYAxis;
float3x4 TranslucentBasePass_Shared_PlanarReflection_InverseTransposeMirrorMatrix;
packed_float3 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1484;
float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionParameters2;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1496;
float PrePadding_TranslucentBasePass_Shared_PlanarReflection_1500;
float4x4 TranslucentBasePass_Shared_PlanarReflection_ProjectionWithExtraFOV[2];
float4 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenScaleBias[2];
float2 TranslucentBasePass_Shared_PlanarReflection_PlanarReflectionScreenBound;
uint TranslucentBasePass_Shared_PlanarReflection_bIsStereo;
float PrePadding_TranslucentBasePass_Shared_Fog_1676;
float PrePadding_TranslucentBasePass_Shared_Fog_1680;
float PrePadding_TranslucentBasePass_Shared_Fog_1684;
float PrePadding_TranslucentBasePass_Shared_Fog_1688;
float PrePadding_TranslucentBasePass_Shared_Fog_1692;
float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters;
float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters2;
float4 TranslucentBasePass_Shared_Fog_ExponentialFogColorParameter;
float4 TranslucentBasePass_Shared_Fog_ExponentialFogParameters3;
float4 TranslucentBasePass_Shared_Fog_InscatteringLightDirection;
float4 TranslucentBasePass_Shared_Fog_DirectionalInscatteringColor;
float2 TranslucentBasePass_Shared_Fog_SinCosInscatteringColorCubemapRotation;
float PrePadding_TranslucentBasePass_Shared_Fog_1800;
float PrePadding_TranslucentBasePass_Shared_Fog_1804;
packed_float3 TranslucentBasePass_Shared_Fog_FogInscatteringTextureParameters;
float TranslucentBasePass_Shared_Fog_ApplyVolumetricFog;
float PrePadding_TranslucentBasePass_1824;
float PrePadding_TranslucentBasePass_1828;
float PrePadding_TranslucentBasePass_1832;
float PrePadding_TranslucentBasePass_1836;
float PrePadding_TranslucentBasePass_1840;
float PrePadding_TranslucentBasePass_1844;
float PrePadding_TranslucentBasePass_1848;
float PrePadding_TranslucentBasePass_1852;
float PrePadding_TranslucentBasePass_1856;
float PrePadding_TranslucentBasePass_1860;
float PrePadding_TranslucentBasePass_1864;
float PrePadding_TranslucentBasePass_1868;
float PrePadding_TranslucentBasePass_1872;
float PrePadding_TranslucentBasePass_1876;
float PrePadding_TranslucentBasePass_1880;
float PrePadding_TranslucentBasePass_1884;
float PrePadding_TranslucentBasePass_1888;
float PrePadding_TranslucentBasePass_1892;
float PrePadding_TranslucentBasePass_1896;
float PrePadding_TranslucentBasePass_1900;
float PrePadding_TranslucentBasePass_1904;
float PrePadding_TranslucentBasePass_1908;
float PrePadding_TranslucentBasePass_1912;
float PrePadding_TranslucentBasePass_1916;
float PrePadding_TranslucentBasePass_1920;
float PrePadding_TranslucentBasePass_1924;
float PrePadding_TranslucentBasePass_1928;
float PrePadding_TranslucentBasePass_1932;
float PrePadding_TranslucentBasePass_1936;
float PrePadding_TranslucentBasePass_1940;
float PrePadding_TranslucentBasePass_1944;
float PrePadding_TranslucentBasePass_1948;
float PrePadding_TranslucentBasePass_1952;
float PrePadding_TranslucentBasePass_1956;
float PrePadding_TranslucentBasePass_1960;
float PrePadding_TranslucentBasePass_1964;
float PrePadding_TranslucentBasePass_1968;
float PrePadding_TranslucentBasePass_1972;
float PrePadding_TranslucentBasePass_1976;
float PrePadding_TranslucentBasePass_1980;
float PrePadding_TranslucentBasePass_1984;
float PrePadding_TranslucentBasePass_1988;
float PrePadding_TranslucentBasePass_1992;
float PrePadding_TranslucentBasePass_1996;
float PrePadding_TranslucentBasePass_2000;
float PrePadding_TranslucentBasePass_2004;
float PrePadding_TranslucentBasePass_2008;
float PrePadding_TranslucentBasePass_2012;
float PrePadding_TranslucentBasePass_2016;
float PrePadding_TranslucentBasePass_2020;
float PrePadding_TranslucentBasePass_2024;
float PrePadding_TranslucentBasePass_2028;
float PrePadding_TranslucentBasePass_2032;
float PrePadding_TranslucentBasePass_2036;
float PrePadding_TranslucentBasePass_2040;
float PrePadding_TranslucentBasePass_2044;
float PrePadding_TranslucentBasePass_2048;
float PrePadding_TranslucentBasePass_2052;
float PrePadding_TranslucentBasePass_2056;
float PrePadding_TranslucentBasePass_2060;
float PrePadding_TranslucentBasePass_2064;
float PrePadding_TranslucentBasePass_2068;
float PrePadding_TranslucentBasePass_2072;
float PrePadding_TranslucentBasePass_2076;
float PrePadding_TranslucentBasePass_2080;
float PrePadding_TranslucentBasePass_2084;
float PrePadding_TranslucentBasePass_2088;
float PrePadding_TranslucentBasePass_2092;
float PrePadding_TranslucentBasePass_2096;
float PrePadding_TranslucentBasePass_2100;
float PrePadding_TranslucentBasePass_2104;
float PrePadding_TranslucentBasePass_2108;
float PrePadding_TranslucentBasePass_2112;
float PrePadding_TranslucentBasePass_2116;
float PrePadding_TranslucentBasePass_2120;
float PrePadding_TranslucentBasePass_2124;
float PrePadding_TranslucentBasePass_2128;
float PrePadding_TranslucentBasePass_2132;
float PrePadding_TranslucentBasePass_2136;
float PrePadding_TranslucentBasePass_2140;
float4 TranslucentBasePass_HZBUvFactorAndInvFactor;
float4 TranslucentBasePass_PrevScreenPositionScaleBias;
float TranslucentBasePass_PrevSceneColorPreExposureInv;
};
struct type_Material
{
float4 Material_VectorExpressions[2];
float4 Material_ScalarExpressions[1];
};
constant float _108 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
uint gl_SampleMask [[sample_mask]];
};
struct main0_in
{
float4 in_var_TEXCOORD10_centroid [[user(locn0)]];
float4 in_var_TEXCOORD11_centroid [[user(locn1)]];
uint in_var_PRIMITIVE_ID [[user(locn2)]];
float4 in_var_TEXCOORD7 [[user(locn3)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], constant type_TranslucentBasePass& TranslucentBasePass [[buffer(2)]], constant type_Material& Material [[buffer(3)]], texture3d<float> TranslucentBasePass_Shared_Fog_IntegratedLightScattering [[texture(0)]], sampler View_SharedBilinearClampedSampler [[sampler(0)]], float4 gl_FragCoord [[position]], uint gl_SampleMaskIn [[sample_mask]])
{
main0_out out = {};
float4 _137 = View.View_SVPositionToTranslatedWorld * float4(gl_FragCoord.xyz, 1.0);
float3 _142 = (_137.xyz / float3(_137.w)) - float3(View.View_PreViewTranslation);
bool _165 = TranslucentBasePass.TranslucentBasePass_Shared_Fog_ApplyVolumetricFog > 0.0;
float4 _215;
if (_165)
{
float4 _172 = View.View_WorldToClip * float4(_142, 1.0);
float _173 = _172.w;
float4 _202;
if (_165)
{
_202 = TranslucentBasePass_Shared_Fog_IntegratedLightScattering.sample(View_SharedBilinearClampedSampler, float3(((_172.xy / float2(_173)).xy * float2(0.5, -0.5)) + float2(0.5), (log2((_173 * View.View_VolumetricFogGridZParams[0]) + View.View_VolumetricFogGridZParams[1]) * View.View_VolumetricFogGridZParams[2]) * View.View_VolumetricFogInvGridSize[2]), level(0.0));
}
else
{
_202 = float4(0.0, 0.0, 0.0, 1.0);
}
_215 = float4(_202.xyz + (in.in_var_TEXCOORD7.xyz * float3(_202.w)), _202.w * in.in_var_TEXCOORD7.w);
}
else
{
_215 = in.in_var_TEXCOORD7;
}
float3 _216 = fast::max(Material.Material_VectorExpressions[1].xyz * float3(((1.0 + dot(float3(-1.0, -1.5, 3.0) / float3(sqrt(12.25)), normalize(float3x3(in.in_var_TEXCOORD10_centroid.xyz, cross(in.in_var_TEXCOORD11_centroid.xyz, in.in_var_TEXCOORD10_centroid.xyz) * float3(in.in_var_TEXCOORD11_centroid.w), in.in_var_TEXCOORD11_centroid.xyz) * normalize((float3(0.0, 0.0, 1.0) * float3(View.View_NormalOverrideParameter.w)) + View.View_NormalOverrideParameter.xyz)))) * 0.5) + 0.20000000298023223876953125), float3(0.0));
float3 _246;
if (View.View_OutOfBoundsMask > 0.0)
{
uint _222 = in.in_var_PRIMITIVE_ID * 26u;
float3 _245;
if (any(abs(_142 - View_PrimitiveSceneData._m0[_222 + 5u].xyz) > (View_PrimitiveSceneData._m0[_222 + 19u].xyz + float3(1.0))))
{
_245 = mix(float3(1.0, 1.0, 0.0), float3(0.0, 1.0, 1.0), select(float3(0.0), float3(1.0), float3(fract(dot(_142, float3(0.57700002193450927734375)) * 0.00200000009499490261077880859375)) > float3(0.5)));
}
else
{
_245 = _216;
}
_246 = _245;
}
else
{
_246 = _216;
}
float4 _256 = float4((_246 * float3(_215.w)) + _215.xyz, _108);
_256.w = 1.0;
float4 _268;
uint _269;
if (View.View_NumSceneColorMSAASamples > 1)
{
_268 = _256 * float4(float(View.View_NumSceneColorMSAASamples) * 0.25);
_269 = gl_SampleMaskIn & 15u;
}
else
{
_268 = _256;
_269 = gl_SampleMaskIn;
}
out.out_var_SV_Target0 = _268;
out.gl_SampleMask = _269;
return out;
}

View File

@ -0,0 +1,213 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_Globals
{
float3 SoftTransitionScale;
float4 ShadowBufferSize;
float ShadowFadeFraction;
float ShadowSharpen;
float4 LightPositionAndInvRadius;
float4x4 ScreenToShadowMatrix;
float2 ProjectionDepthBiasParameters;
float4 ModulatedShadowColor;
float4 ShadowTileOffsetAndSize;
};
constant float4 _58 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
fragment main0_out main0(constant type_View& View [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], float4 _gl_LastFragData [[color(0)]], texture2d<float> ShadowDepthTexture [[texture(1)]], sampler ShadowDepthTextureSampler [[sampler(0)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
float4 _67 = _gl_LastFragData;
float _68 = _67.w;
float4 _82 = _Globals.ScreenToShadowMatrix * float4((((gl_FragCoord.xy * View.View_BufferSizeAndInvSize.zw) - View.View_ScreenPositionScaleBias.wz) / View.View_ScreenPositionScaleBias.xy) * float2(_68), _68, 1.0);
float _118 = fast::clamp(((fast::clamp((ShadowDepthTexture.sample(ShadowDepthTextureSampler, (((_82.xyz / float3(_82.w)).xy * _Globals.ShadowTileOffsetAndSize.zw).xy + _Globals.ShadowTileOffsetAndSize.xy).xy, level(0.0)).xxx * float3(_Globals.SoftTransitionScale.z)) - float3((fast::min(_82.z, 0.999989986419677734375) * _Globals.SoftTransitionScale.z) - 1.0), float3(0.0), float3(1.0)).x - 0.5) * _Globals.ShadowSharpen) + 0.5, 0.0, 1.0);
float3 _127 = mix(_Globals.ModulatedShadowColor.xyz, float3(1.0), float3(mix(1.0, _118 * _118, _Globals.ShadowFadeFraction)));
float4 _129 = float4(_127.x, _127.y, _127.z, _58.w);
_129.w = 0.0;
out.out_var_SV_Target0 = _129;
return out;
}

View File

@ -0,0 +1,121 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wunused-variable"
#include <metal_stdlib>
#include <simd/simd.h>
#include <metal_atomic>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_StructuredBuffer_v4float
{
float4 _m0[1];
};
struct type_Globals
{
uint2 ShadowTileListGroupSize;
};
constant float3 _70 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
struct main0_in
{
uint in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
uint2 _77 = uint2(gl_FragCoord.xy);
uint _78 = _77.y;
uint _83 = _77.x;
float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
float2 _93 = float2(_Globals.ShadowTileListGroupSize);
float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
float3 _102 = float3(_100.x, _100.y, _70.z);
_102.z = 1.0;
uint _103 = in.in_var_TEXCOORD0 * 5u;
uint _107 = _103 + 1u;
if (all(CulledObjectBoxBounds._m0[_107].xy > _96.xy) && all(CulledObjectBoxBounds._m0[_103].xyz < _102))
{
float _122 = _96.x;
float _123 = _96.y;
spvUnsafeArray<float3, 8> _73;
_73[0] = float3(_122, _123, -1000.0);
float _126 = _100.x;
_73[1] = float3(_126, _123, -1000.0);
float _129 = _100.y;
_73[2] = float3(_122, _129, -1000.0);
_73[3] = float3(_126, _129, -1000.0);
_73[4] = float3(_122, _123, 1.0);
_73[5] = float3(_126, _123, 1.0);
_73[6] = float3(_122, _129, 1.0);
_73[7] = float3(_126, _129, 1.0);
float3 _155;
float3 _158;
_155 = float3(-500000.0);
_158 = float3(500000.0);
for (int _160 = 0; _160 < 8; )
{
float3 _166 = _73[_160] - (float3(0.5) * (CulledObjectBoxBounds._m0[_103].xyz + CulledObjectBoxBounds._m0[_107].xyz));
float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[_103 + 2u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 3u].xyz), dot(_166, CulledObjectBoxBounds._m0[_103 + 4u].xyz));
_155 = fast::max(_155, _170);
_158 = fast::min(_158, _170);
_160++;
continue;
}
if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
{
uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
}
}
out.out_var_SV_Target0 = float4(0.0);
return out;
}

View File

@ -0,0 +1,122 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#pragma clang diagnostic ignored "-Wunused-variable"
#include <metal_stdlib>
#include <simd/simd.h>
#include <metal_atomic>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_StructuredBuffer_v4float
{
float4 _m0[1];
};
struct type_Globals
{
uint2 ShadowTileListGroupSize;
};
constant float3 _70 = {};
struct main0_out
{
float4 out_var_SV_Target0 [[color(0)]];
};
struct main0_in
{
uint in_var_TEXCOORD0 [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant uint* spvBufferSizeConstants [[buffer(25)]], const device type_StructuredBuffer_v4float& CulledObjectBoxBounds [[buffer(0)]], constant type_Globals& _Globals [[buffer(1)]], texture2d<uint> RWShadowTileNumCulledObjects [[texture(2)]], device atomic_uint* RWShadowTileNumCulledObjects_atomic [[buffer(2)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
constant uint& CulledObjectBoxBoundsBufferSize = spvBufferSizeConstants[0];
uint2 _77 = uint2(gl_FragCoord.xy);
uint _78 = _77.y;
uint _83 = _77.x;
float2 _91 = float2(float(_83), float((_Globals.ShadowTileListGroupSize.y - 1u) - _78));
float2 _93 = float2(_Globals.ShadowTileListGroupSize);
float2 _96 = ((_91 / _93) * float2(2.0)) - float2(1.0);
float2 _100 = (((_91 + float2(1.0)) / _93) * float2(2.0)) - float2(1.0);
float3 _102 = float3(_100.x, _100.y, _70.z);
_102.z = 1.0;
uint _103 = in.in_var_TEXCOORD0 * 5u;
uint _186 = clamp(_103 + 1u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u);
if (all(CulledObjectBoxBounds._m0[_186].xy > _96.xy) && all(CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz < _102))
{
float _122 = _96.x;
float _123 = _96.y;
spvUnsafeArray<float3, 8> _73;
_73[0] = float3(_122, _123, -1000.0);
float _126 = _100.x;
_73[1] = float3(_126, _123, -1000.0);
float _129 = _100.y;
_73[2] = float3(_122, _129, -1000.0);
_73[3] = float3(_126, _129, -1000.0);
_73[4] = float3(_122, _123, 1.0);
_73[5] = float3(_126, _123, 1.0);
_73[6] = float3(_122, _129, 1.0);
_73[7] = float3(_126, _129, 1.0);
float3 _155;
float3 _158;
_155 = float3(-500000.0);
_158 = float3(500000.0);
for (int _160 = 0; _160 < 8; )
{
float3 _166 = _73[int(clamp(uint(_160), uint(0), uint(7)))] - (float3(0.5) * (CulledObjectBoxBounds._m0[clamp(_103, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz + CulledObjectBoxBounds._m0[_186].xyz));
float3 _170 = float3(dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 2u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 3u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz), dot(_166, CulledObjectBoxBounds._m0[clamp(_103 + 4u, 0u, ((CulledObjectBoxBoundsBufferSize - 0) / 16) - 1u)].xyz));
_155 = fast::max(_155, _170);
_158 = fast::min(_158, _170);
_160++;
continue;
}
if (all(_158 < float3(1.0)) && all(_155 > float3(-1.0)))
{
uint _179 = atomic_fetch_add_explicit((device atomic_uint*)&RWShadowTileNumCulledObjects_atomic[(_78 * _Globals.ShadowTileListGroupSize.x) + _83], 1u, memory_order_relaxed);
}
}
out.out_var_SV_Target0 = float4(0.0);
return out;
}

View File

@ -0,0 +1,399 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct FVertexFactoryInterpolantsVSToPS
{
float4 TangentToWorld0;
float4 TangentToWorld2;
float4 Color;
spvUnsafeArray<float4, 1> TexCoords;
float4 LightMapCoordinate;
uint PrimitiveId;
uint LightmapDataIndex;
};
struct FVertexFactoryInterpolantsVSToDS
{
FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
};
struct FSharedBasePassInterpolants
{
};
struct FBasePassInterpolantsVSToDS
{
FSharedBasePassInterpolants _m0;
};
struct FBasePassVSToDS
{
FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
FBasePassInterpolantsVSToDS BasePassInterpolants;
float4 Position;
};
struct FPNTessellationHSToDS
{
FBasePassVSToDS PassSpecificData;
spvUnsafeArray<float4, 3> WorldPosition;
float3 DisplacementScale;
float TessellationMultiplier;
float WorldDisplacementMultiplier;
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_StructuredBuffer_v4float
{
float4 _m0[1];
};
constant float4 _600 = {};
struct main0_out
{
float4 out_var_COLOR0;
uint out_var_LIGHTMAP_ID;
float3 out_var_PN_DisplacementScales;
spvUnsafeArray<float4, 3> out_var_PN_POSITION;
float out_var_PN_TessellationMultiplier;
float out_var_PN_WorldDisplacementMultiplier;
uint out_var_PRIMITIVE_ID;
spvUnsafeArray<float4, 1> out_var_TEXCOORD0;
float4 out_var_TEXCOORD10_centroid;
float4 out_var_TEXCOORD11_centroid;
float4 out_var_TEXCOORD4;
float4 out_var_VS_To_DS_Position;
};
struct main0_patchOut
{
float4 out_var_PN_POSITION9;
};
struct main0_in
{
float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
float4 in_var_COLOR0 [[attribute(2)]];
float4 in_var_TEXCOORD0_0 [[attribute(3)]];
float4 in_var_TEXCOORD4 [[attribute(4)]];
uint in_var_PRIMITIVE_ID [[attribute(5)]];
uint in_var_LIGHTMAP_ID [[attribute(6)]];
float4 in_var_VS_To_DS_Position [[attribute(7)]];
};
kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], const device type_StructuredBuffer_v4float& View_PrimitiveSceneData [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 3)
return;
spvUnsafeArray<float4, 12> _144 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 12> _145 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid });
spvUnsafeArray<float4, 12> _146 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 });
spvUnsafeArray<spvUnsafeArray<float4, 1>, 12> _147 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 12>({ spvUnsafeArray<float4, 1>({ gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[2].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[3].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[4].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[5].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[6].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[7].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[8].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[9].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[10].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ gl_in[11].in_var_TEXCOORD0_0 }) });
spvUnsafeArray<float4, 12> _148 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD4, gl_in[1].in_var_TEXCOORD4, gl_in[2].in_var_TEXCOORD4, gl_in[3].in_var_TEXCOORD4, gl_in[4].in_var_TEXCOORD4, gl_in[5].in_var_TEXCOORD4, gl_in[6].in_var_TEXCOORD4, gl_in[7].in_var_TEXCOORD4, gl_in[8].in_var_TEXCOORD4, gl_in[9].in_var_TEXCOORD4, gl_in[10].in_var_TEXCOORD4, gl_in[11].in_var_TEXCOORD4 });
spvUnsafeArray<uint, 12> _149 = spvUnsafeArray<uint, 12>({ gl_in[0].in_var_PRIMITIVE_ID, gl_in[1].in_var_PRIMITIVE_ID, gl_in[2].in_var_PRIMITIVE_ID, gl_in[3].in_var_PRIMITIVE_ID, gl_in[4].in_var_PRIMITIVE_ID, gl_in[5].in_var_PRIMITIVE_ID, gl_in[6].in_var_PRIMITIVE_ID, gl_in[7].in_var_PRIMITIVE_ID, gl_in[8].in_var_PRIMITIVE_ID, gl_in[9].in_var_PRIMITIVE_ID, gl_in[10].in_var_PRIMITIVE_ID, gl_in[11].in_var_PRIMITIVE_ID });
spvUnsafeArray<uint, 12> _150 = spvUnsafeArray<uint, 12>({ gl_in[0].in_var_LIGHTMAP_ID, gl_in[1].in_var_LIGHTMAP_ID, gl_in[2].in_var_LIGHTMAP_ID, gl_in[3].in_var_LIGHTMAP_ID, gl_in[4].in_var_LIGHTMAP_ID, gl_in[5].in_var_LIGHTMAP_ID, gl_in[6].in_var_LIGHTMAP_ID, gl_in[7].in_var_LIGHTMAP_ID, gl_in[8].in_var_LIGHTMAP_ID, gl_in[9].in_var_LIGHTMAP_ID, gl_in[10].in_var_LIGHTMAP_ID, gl_in[11].in_var_LIGHTMAP_ID });
spvUnsafeArray<float4, 12> _259 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position });
spvUnsafeArray<FBasePassVSToDS, 12> _284 = spvUnsafeArray<FBasePassVSToDS, 12>({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[0], _145[0], _146[0], _147[0], _148[0], _149[0], _150[0] } }, FBasePassInterpolantsVSToDS{ { } }, _259[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[1], _145[1], _146[1], _147[1], _148[1], _149[1], _150[1] } }, FBasePassInterpolantsVSToDS{ { } }, _259[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[2], _145[2], _146[2], _147[2], _148[2], _149[2], _150[2] } }, FBasePassInterpolantsVSToDS{ { } }, _259[2] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[3], _145[3], _146[3], _147[3], _148[3], _149[3], _150[3] } }, FBasePassInterpolantsVSToDS{ { } }, _259[3] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[4], _145[4], _146[4], _147[4], _148[4], _149[4], _150[4] } }, FBasePassInterpolantsVSToDS{ { } }, _259[4] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[5], _145[5], _146[5], _147[5], _148[5], _149[5], _150[5] } }, FBasePassInterpolantsVSToDS{ { } }, _259[5] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[6], _145[6], _146[6], _147[6], _148[6], _149[6], _150[6] } }, FBasePassInterpolantsVSToDS{ { } }, _259[6] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[7], _145[7], _146[7], _147[7], _148[7], _149[7], _150[7] } }, FBasePassInterpolantsVSToDS{ { } }, _259[7] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[8], _145[8], _146[8], _147[8], _148[8], _149[8], _150[8] } }, FBasePassInterpolantsVSToDS{ { } }, _259[8] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[9], _145[9], _146[9], _147[9], _148[9], _149[9], _150[9] } }, FBasePassInterpolantsVSToDS{ { } }, _259[9] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[10], _145[10], _146[10], _147[10], _148[10], _149[10], _150[10] } }, FBasePassInterpolantsVSToDS{ { } }, _259[10] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _144[11], _145[11], _146[11], _147[11], _148[11], _149[11], _150[11] } }, FBasePassInterpolantsVSToDS{ { } }, _259[11] } });
spvUnsafeArray<FBasePassVSToDS, 12> param_var_I;
param_var_I = _284;
float4 _301 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float3 _310 = View_PrimitiveSceneData._m0[(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId * 26u) + 22u].xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
uint _313 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u;
uint _314 = 2u * gl_InvocationID;
uint _315 = 3u + _314;
uint _316 = _314 + 4u;
float4 _328 = float4(param_var_I[_313].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _336 = float4(param_var_I[_315].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _344 = float4(param_var_I[_316].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
spvUnsafeArray<float4, 3> _392 = spvUnsafeArray<float4, 3>({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_313].Position) - (float4(dot(param_var_I[_313].Position - param_var_I[gl_InvocationID].Position, _301)) * _301)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_315].Position) + param_var_I[_316].Position) - (float4(dot(param_var_I[_316].Position - param_var_I[_315].Position, _336)) * _336)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_313].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_313].Position, _328)) * _328)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_316].Position) + param_var_I[_315].Position) - (float4(dot(param_var_I[_315].Position - param_var_I[_316].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5) });
gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color;
gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords;
gl_out[gl_InvocationID].out_var_TEXCOORD4 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightMapCoordinate;
gl_out[gl_InvocationID].out_var_PRIMITIVE_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.PrimitiveId;
gl_out[gl_InvocationID].out_var_LIGHTMAP_ID = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.LightmapDataIndex;
gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
gl_out[gl_InvocationID].out_var_PN_POSITION = _392;
gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _310;
gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0;
gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0;
temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _392, _310, 1.0, 1.0 };
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (gl_InvocationID == 0u)
{
float4 _450 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875);
float4 _463 = _600;
_463.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _469 = _463;
_469.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
float4 _474 = _469;
_474.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
float4 _481 = _474;
_481.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _589;
for (;;)
{
float4 _489 = View.View_ViewToClip * float4(0.0);
float4 _494 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0);
float3 _495 = _494.xyz;
float3 _496 = _489.xyz;
float _498 = _494.w;
float _499 = _489.w;
float4 _516 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0);
float3 _517 = _516.xyz;
float _519 = _516.w;
float4 _537 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0);
float3 _538 = _537.xyz;
float _540 = _537.w;
if (any((((select(int3(0), int3(1), (_495 - _496) < float3(_498 + _499)) + (int3(2) * select(int3(0), int3(1), (_495 + _496) > float3((-_498) - _499)))) | (select(int3(0), int3(1), (_517 - _496) < float3(_519 + _499)) + (int3(2) * select(int3(0), int3(1), (_517 + _496) > float3((-_519) - _499))))) | (select(int3(0), int3(1), (_538 - _496) < float3(_540 + _499)) + (int3(2) * select(int3(0), int3(1), (_538 + _496) > float3((-_540) - _499))))) != int3(3)))
{
_589 = float4(0.0);
break;
}
float3 _558 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz;
float3 _559 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz;
float3 _560 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz;
float3 _563 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _566 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _569 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float _573 = sqrt(dot(_559, _559) / dot(_566, _566));
float _577 = sqrt(dot(_560, _560) / dot(_569, _569));
float _581 = sqrt(dot(_558, _558) / dot(_563, _563));
float4 _586 = float4(_573, _577, _581, 1.0);
_586.w = 0.333000004291534423828125 * ((_573 + _577) + _581);
_589 = float4(View.View_AdaptiveTessellationFactor) * _586;
break;
}
float4 _591 = fast::clamp(_481 * _589, float4(1.0), float4(15.0));
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_591.x);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_591.y);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_591.z);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_591.w);
patchOut.out_var_PN_POSITION9 = _450 + ((_450 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5));
}
}

View File

@ -0,0 +1,467 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct FVertexFactoryInterpolantsVSToPS
{
float4 TangentToWorld0;
float4 TangentToWorld2;
};
struct FVertexFactoryInterpolantsVSToDS
{
FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
};
struct FHitProxyVSToDS
{
FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
float4 Position;
uint VertexID;
};
struct FHullShaderConstantDominantVertexData
{
float2 UV;
float4 Normal;
float3 Tangent;
};
struct FHullShaderConstantDominantEdgeData
{
float2 UV0;
float2 UV1;
float4 Normal0;
float4 Normal1;
float3 Tangent0;
float3 Tangent1;
};
struct FPNTessellationHSToDS
{
FHitProxyVSToDS PassSpecificData;
spvUnsafeArray<float4, 3> WorldPosition;
float3 DisplacementScale;
float TessellationMultiplier;
float WorldDisplacementMultiplier;
FHullShaderConstantDominantVertexData DominantVertex;
FHullShaderConstantDominantEdgeData DominantEdge;
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_Primitive
{
float4x4 Primitive_LocalToWorld;
float4 Primitive_InvNonUniformScaleAndDeterminantSign;
float4 Primitive_ObjectWorldPositionAndRadius;
float4x4 Primitive_WorldToLocal;
float4x4 Primitive_PreviousLocalToWorld;
float4x4 Primitive_PreviousWorldToLocal;
packed_float3 Primitive_ActorWorldPosition;
float Primitive_UseSingleSampleShadowFromStationaryLights;
packed_float3 Primitive_ObjectBounds;
float Primitive_LpvBiasMultiplier;
float Primitive_DecalReceiverMask;
float Primitive_PerObjectGBufferData;
float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
float Primitive_DrawsVelocity;
float4 Primitive_ObjectOrientation;
float4 Primitive_NonUniformScale;
packed_float3 Primitive_LocalObjectBoundsMin;
uint Primitive_LightingChannelMask;
packed_float3 Primitive_LocalObjectBoundsMax;
uint Primitive_LightmapDataIndex;
packed_float3 Primitive_PreSkinnedLocalBounds;
int Primitive_SingleCaptureIndex;
uint Primitive_OutputVelocity;
uint PrePadding_Primitive_420;
uint PrePadding_Primitive_424;
uint PrePadding_Primitive_428;
float4 Primitive_CustomPrimitiveData[4];
};
constant float4 _611 = {};
struct main0_out
{
float3 out_var_PN_DisplacementScales;
float2 out_var_PN_DominantEdge;
float2 out_var_PN_DominantEdge1;
float4 out_var_PN_DominantEdge2;
float4 out_var_PN_DominantEdge3;
float3 out_var_PN_DominantEdge4;
float3 out_var_PN_DominantEdge5;
float2 out_var_PN_DominantVertex;
float4 out_var_PN_DominantVertex1;
float3 out_var_PN_DominantVertex2;
spvUnsafeArray<float4, 3> out_var_PN_POSITION;
float out_var_PN_TessellationMultiplier;
float out_var_PN_WorldDisplacementMultiplier;
float4 out_var_TEXCOORD10_centroid;
float4 out_var_TEXCOORD11_centroid;
float4 out_var_VS_To_DS_Position;
uint out_var_VS_To_DS_VertexID;
};
struct main0_patchOut
{
float4 out_var_PN_POSITION9;
};
struct main0_in
{
float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
float4 in_var_VS_To_DS_Position [[attribute(2)]];
uint in_var_VS_To_DS_VertexID [[attribute(3)]];
};
kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 3)
return;
spvUnsafeArray<float4, 12> _142 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 12> _143 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid });
spvUnsafeArray<float4, 12> _192 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position });
spvUnsafeArray<uint, 12> _193 = spvUnsafeArray<uint, 12>({ gl_in[0].in_var_VS_To_DS_VertexID, gl_in[1].in_var_VS_To_DS_VertexID, gl_in[2].in_var_VS_To_DS_VertexID, gl_in[3].in_var_VS_To_DS_VertexID, gl_in[4].in_var_VS_To_DS_VertexID, gl_in[5].in_var_VS_To_DS_VertexID, gl_in[6].in_var_VS_To_DS_VertexID, gl_in[7].in_var_VS_To_DS_VertexID, gl_in[8].in_var_VS_To_DS_VertexID, gl_in[9].in_var_VS_To_DS_VertexID, gl_in[10].in_var_VS_To_DS_VertexID, gl_in[11].in_var_VS_To_DS_VertexID });
spvUnsafeArray<FHitProxyVSToDS, 12> _230 = spvUnsafeArray<FHitProxyVSToDS, 12>({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[0], _143[0] } }, _192[0], _193[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[1], _143[1] } }, _192[1], _193[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[2], _143[2] } }, _192[2], _193[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[3], _143[3] } }, _192[3], _193[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[4], _143[4] } }, _192[4], _193[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[5], _143[5] } }, _192[5], _193[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[6], _143[6] } }, _192[6], _193[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[7], _143[7] } }, _192[7], _193[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[8], _143[8] } }, _192[8], _193[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[9], _143[9] } }, _192[9], _193[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[10], _143[10] } }, _192[10], _193[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _142[11], _143[11] } }, _192[11], _193[11] } });
spvUnsafeArray<FHitProxyVSToDS, 12> param_var_I;
param_var_I = _230;
float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u;
uint _255 = 2u * gl_InvocationID;
uint _256 = 3u + _255;
uint _257 = _255 + 4u;
uint _264 = (_254 < 2u) ? (_254 + 1u) : 0u;
uint _265 = 2u * _254;
uint _266 = 3u + _265;
uint _267 = _265 + 4u;
float4 _279 = float4(param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _315;
float4 _316;
float4 _317;
float4 _318;
if ((param_var_I[_266].VertexID < param_var_I[_254].VertexID) || ((param_var_I[_266].VertexID == param_var_I[_254].VertexID) && (param_var_I[_267].VertexID < param_var_I[_264].VertexID)))
{
_315 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
_316 = param_var_I[_267].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
_317 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
_318 = param_var_I[_266].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
}
else
{
_315 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
_316 = param_var_I[_264].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
_317 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
_318 = param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
}
float4 _324 = float4(_318.xyz, 0.0);
float4 _328 = float4(_316.xyz, 0.0);
float4 _336 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _344 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _352 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
spvUnsafeArray<float4, 3> _402 = spvUnsafeArray<float4, 3>({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _344)) * _344)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _336)) * _336)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _352)) * _352)) * float4(0.3333333432674407958984375))) * float4(0.5) });
gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
gl_out[gl_InvocationID].out_var_VS_To_DS_VertexID = param_var_I[gl_InvocationID].VertexID;
gl_out[gl_InvocationID].out_var_PN_POSITION = _402;
gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251;
gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0;
gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0;
gl_out[gl_InvocationID].out_var_PN_DominantVertex = float2(0.0);
gl_out[gl_InvocationID].out_var_PN_DominantVertex1 = _279;
gl_out[gl_InvocationID].out_var_PN_DominantVertex2 = param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz;
gl_out[gl_InvocationID].out_var_PN_DominantEdge = float2(0.0);
gl_out[gl_InvocationID].out_var_PN_DominantEdge1 = float2(0.0);
gl_out[gl_InvocationID].out_var_PN_DominantEdge2 = _324;
gl_out[gl_InvocationID].out_var_PN_DominantEdge3 = _328;
gl_out[gl_InvocationID].out_var_PN_DominantEdge4 = _317.xyz;
gl_out[gl_InvocationID].out_var_PN_DominantEdge5 = _315.xyz;
temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _402, _251, 1.0, 1.0, FHullShaderConstantDominantVertexData{ float2(0.0), _279, param_var_I[9u + gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz }, FHullShaderConstantDominantEdgeData{ float2(0.0), float2(0.0), _324, _328, _317.xyz, _315.xyz } };
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (gl_InvocationID == 0u)
{
float4 _461 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875);
float4 _474 = _611;
_474.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _480 = _474;
_480.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
float4 _485 = _480;
_485.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
float4 _492 = _485;
_492.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _600;
for (;;)
{
float4 _500 = View.View_ViewToClip * float4(0.0);
float4 _505 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0);
float3 _506 = _505.xyz;
float3 _507 = _500.xyz;
float _509 = _505.w;
float _510 = _500.w;
float4 _527 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0);
float3 _528 = _527.xyz;
float _530 = _527.w;
float4 _548 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0);
float3 _549 = _548.xyz;
float _551 = _548.w;
if (any((((select(int3(0), int3(1), (_506 - _507) < float3(_509 + _510)) + (int3(2) * select(int3(0), int3(1), (_506 + _507) > float3((-_509) - _510)))) | (select(int3(0), int3(1), (_528 - _507) < float3(_530 + _510)) + (int3(2) * select(int3(0), int3(1), (_528 + _507) > float3((-_530) - _510))))) | (select(int3(0), int3(1), (_549 - _507) < float3(_551 + _510)) + (int3(2) * select(int3(0), int3(1), (_549 + _507) > float3((-_551) - _510))))) != int3(3)))
{
_600 = float4(0.0);
break;
}
float3 _569 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz;
float3 _570 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz;
float3 _571 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz;
float3 _574 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _577 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _580 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float _584 = sqrt(dot(_570, _570) / dot(_577, _577));
float _588 = sqrt(dot(_571, _571) / dot(_580, _580));
float _592 = sqrt(dot(_569, _569) / dot(_574, _574));
float4 _597 = float4(_584, _588, _592, 1.0);
_597.w = 0.333000004291534423828125 * ((_584 + _588) + _592);
_600 = float4(View.View_AdaptiveTessellationFactor) * _597;
break;
}
float4 _602 = fast::clamp(_492 * _600, float4(1.0), float4(15.0));
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_602.x);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_602.y);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_602.z);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_602.w);
patchOut.out_var_PN_POSITION9 = _461 + ((_461 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5));
}
}

View File

@ -0,0 +1,411 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct FVertexFactoryInterpolantsVSToPS
{
float4 TangentToWorld0;
float4 TangentToWorld2;
float4 Color;
spvUnsafeArray<float2, 2> TexCoords;
};
struct FVertexFactoryInterpolantsVSToDS
{
FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
};
struct FHitProxyVSToDS
{
FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
float4 Position;
};
struct FPNTessellationHSToDS
{
FHitProxyVSToDS PassSpecificData;
spvUnsafeArray<float4, 3> WorldPosition;
float3 DisplacementScale;
float TessellationMultiplier;
float WorldDisplacementMultiplier;
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_Primitive
{
float4x4 Primitive_LocalToWorld;
float4 Primitive_InvNonUniformScaleAndDeterminantSign;
float4 Primitive_ObjectWorldPositionAndRadius;
float4x4 Primitive_WorldToLocal;
float4x4 Primitive_PreviousLocalToWorld;
float4x4 Primitive_PreviousWorldToLocal;
packed_float3 Primitive_ActorWorldPosition;
float Primitive_UseSingleSampleShadowFromStationaryLights;
packed_float3 Primitive_ObjectBounds;
float Primitive_LpvBiasMultiplier;
float Primitive_DecalReceiverMask;
float Primitive_PerObjectGBufferData;
float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
float Primitive_DrawsVelocity;
float4 Primitive_ObjectOrientation;
float4 Primitive_NonUniformScale;
packed_float3 Primitive_LocalObjectBoundsMin;
uint Primitive_LightingChannelMask;
packed_float3 Primitive_LocalObjectBoundsMax;
uint Primitive_LightmapDataIndex;
packed_float3 Primitive_PreSkinnedLocalBounds;
int Primitive_SingleCaptureIndex;
uint Primitive_OutputVelocity;
uint PrePadding_Primitive_420;
uint PrePadding_Primitive_424;
uint PrePadding_Primitive_428;
float4 Primitive_CustomPrimitiveData[4];
};
constant float4 _535 = {};
struct main0_out
{
float4 out_var_COLOR0;
float3 out_var_PN_DisplacementScales;
spvUnsafeArray<float4, 3> out_var_PN_POSITION;
float out_var_PN_TessellationMultiplier;
float out_var_PN_WorldDisplacementMultiplier;
spvUnsafeArray<float2, 2> out_var_TEXCOORD0;
float4 out_var_TEXCOORD10_centroid;
float4 out_var_TEXCOORD11_centroid;
float4 out_var_VS_To_DS_Position;
};
struct main0_patchOut
{
float4 out_var_PN_POSITION9;
};
struct main0_in
{
float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
float4 in_var_COLOR0 [[attribute(2)]];
float2 in_var_TEXCOORD0_0 [[attribute(3)]];
float2 in_var_TEXCOORD0_1 [[attribute(4)]];
float4 in_var_VS_To_DS_Position [[attribute(5)]];
};
kernel void main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device main0_patchOut* spvPatchOut [[buffer(27)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
threadgroup FPNTessellationHSToDS temp_var_hullMainRetVal[3];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
device main0_patchOut& patchOut = spvPatchOut[gl_PrimitiveID];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 3)
return;
spvUnsafeArray<float4, 12> _129 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid, gl_in[3].in_var_TEXCOORD10_centroid, gl_in[4].in_var_TEXCOORD10_centroid, gl_in[5].in_var_TEXCOORD10_centroid, gl_in[6].in_var_TEXCOORD10_centroid, gl_in[7].in_var_TEXCOORD10_centroid, gl_in[8].in_var_TEXCOORD10_centroid, gl_in[9].in_var_TEXCOORD10_centroid, gl_in[10].in_var_TEXCOORD10_centroid, gl_in[11].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 12> _130 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid, gl_in[3].in_var_TEXCOORD11_centroid, gl_in[4].in_var_TEXCOORD11_centroid, gl_in[5].in_var_TEXCOORD11_centroid, gl_in[6].in_var_TEXCOORD11_centroid, gl_in[7].in_var_TEXCOORD11_centroid, gl_in[8].in_var_TEXCOORD11_centroid, gl_in[9].in_var_TEXCOORD11_centroid, gl_in[10].in_var_TEXCOORD11_centroid, gl_in[11].in_var_TEXCOORD11_centroid });
spvUnsafeArray<float4, 12> _131 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_COLOR0, gl_in[1].in_var_COLOR0, gl_in[2].in_var_COLOR0, gl_in[3].in_var_COLOR0, gl_in[4].in_var_COLOR0, gl_in[5].in_var_COLOR0, gl_in[6].in_var_COLOR0, gl_in[7].in_var_COLOR0, gl_in[8].in_var_COLOR0, gl_in[9].in_var_COLOR0, gl_in[10].in_var_COLOR0, gl_in[11].in_var_COLOR0 });
spvUnsafeArray<spvUnsafeArray<float2, 2>, 12> _132 = spvUnsafeArray<spvUnsafeArray<float2, 2>, 12>({ spvUnsafeArray<float2, 2>({ gl_in[0].in_var_TEXCOORD0_0, gl_in[0].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[1].in_var_TEXCOORD0_0, gl_in[1].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[2].in_var_TEXCOORD0_0, gl_in[2].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[3].in_var_TEXCOORD0_0, gl_in[3].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[4].in_var_TEXCOORD0_0, gl_in[4].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[5].in_var_TEXCOORD0_0, gl_in[5].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[6].in_var_TEXCOORD0_0, gl_in[6].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[7].in_var_TEXCOORD0_0, gl_in[7].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[8].in_var_TEXCOORD0_0, gl_in[8].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[9].in_var_TEXCOORD0_0, gl_in[9].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[10].in_var_TEXCOORD0_0, gl_in[10].in_var_TEXCOORD0_1 }), spvUnsafeArray<float2, 2>({ gl_in[11].in_var_TEXCOORD0_0, gl_in[11].in_var_TEXCOORD0_1 }) });
spvUnsafeArray<float4, 12> _205 = spvUnsafeArray<float4, 12>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position, gl_in[3].in_var_VS_To_DS_Position, gl_in[4].in_var_VS_To_DS_Position, gl_in[5].in_var_VS_To_DS_Position, gl_in[6].in_var_VS_To_DS_Position, gl_in[7].in_var_VS_To_DS_Position, gl_in[8].in_var_VS_To_DS_Position, gl_in[9].in_var_VS_To_DS_Position, gl_in[10].in_var_VS_To_DS_Position, gl_in[11].in_var_VS_To_DS_Position });
spvUnsafeArray<FHitProxyVSToDS, 12> _230 = spvUnsafeArray<FHitProxyVSToDS, 12>({ FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[0], _130[0], _131[0], _132[0] } }, _205[0] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[1], _130[1], _131[1], _132[1] } }, _205[1] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[2], _130[2], _131[2], _132[2] } }, _205[2] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[3], _130[3], _131[3], _132[3] } }, _205[3] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[4], _130[4], _131[4], _132[4] } }, _205[4] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[5], _130[5], _131[5], _132[5] } }, _205[5] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[6], _130[6], _131[6], _132[6] } }, _205[6] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[7], _130[7], _131[7], _132[7] } }, _205[7] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[8], _130[8], _131[8], _132[8] } }, _205[8] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[9], _130[9], _131[9], _132[9] } }, _205[9] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[10], _130[10], _131[10], _132[10] } }, _205[10] }, FHitProxyVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _129[11], _130[11], _131[11], _132[11] } }, _205[11] } });
spvUnsafeArray<FHitProxyVSToDS, 12> param_var_I;
param_var_I = _230;
float4 _247 = float4(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float3 _251 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
uint _254 = (gl_InvocationID < 2u) ? (gl_InvocationID + 1u) : 0u;
uint _255 = 2u * gl_InvocationID;
uint _256 = 3u + _255;
uint _257 = _255 + 4u;
float4 _269 = float4(param_var_I[_254].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _277 = float4(param_var_I[_256].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
float4 _285 = float4(param_var_I[_257].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, 0.0);
spvUnsafeArray<float4, 3> _333 = spvUnsafeArray<float4, 3>({ param_var_I[gl_InvocationID].Position, (((((float4(2.0) * param_var_I[gl_InvocationID].Position) + param_var_I[_254].Position) - (float4(dot(param_var_I[_254].Position - param_var_I[gl_InvocationID].Position, _247)) * _247)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_256].Position) + param_var_I[_257].Position) - (float4(dot(param_var_I[_257].Position - param_var_I[_256].Position, _277)) * _277)) * float4(0.3333333432674407958984375))) * float4(0.5), (((((float4(2.0) * param_var_I[_254].Position) + param_var_I[gl_InvocationID].Position) - (float4(dot(param_var_I[gl_InvocationID].Position - param_var_I[_254].Position, _269)) * _269)) * float4(0.3333333432674407958984375)) + ((((float4(2.0) * param_var_I[_257].Position) + param_var_I[_256].Position) - (float4(dot(param_var_I[_256].Position - param_var_I[_257].Position, _285)) * _285)) * float4(0.3333333432674407958984375))) * float4(0.5) });
gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
gl_out[gl_InvocationID].out_var_COLOR0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.Color;
gl_out[gl_InvocationID].out_var_TEXCOORD0 = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TexCoords;
gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
gl_out[gl_InvocationID].out_var_PN_POSITION = _333;
gl_out[gl_InvocationID].out_var_PN_DisplacementScales = _251;
gl_out[gl_InvocationID].out_var_PN_TessellationMultiplier = 1.0;
gl_out[gl_InvocationID].out_var_PN_WorldDisplacementMultiplier = 1.0;
temp_var_hullMainRetVal[gl_InvocationID] = FPNTessellationHSToDS{ param_var_I[gl_InvocationID], _333, _251, 1.0, 1.0 };
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (gl_InvocationID == 0u)
{
float4 _385 = (((((temp_var_hullMainRetVal[0u].WorldPosition[1] + temp_var_hullMainRetVal[0u].WorldPosition[2]) + temp_var_hullMainRetVal[1u].WorldPosition[1]) + temp_var_hullMainRetVal[1u].WorldPosition[2]) + temp_var_hullMainRetVal[2u].WorldPosition[1]) + temp_var_hullMainRetVal[2u].WorldPosition[2]) * float4(0.16666667163372039794921875);
float4 _398 = _535;
_398.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _404 = _398;
_404.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
float4 _409 = _404;
_409.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
float4 _416 = _409;
_416.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _524;
for (;;)
{
float4 _424 = View.View_ViewToClip * float4(0.0);
float4 _429 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[0u].WorldPosition[0].xyz, 1.0);
float3 _430 = _429.xyz;
float3 _431 = _424.xyz;
float _433 = _429.w;
float _434 = _424.w;
float4 _451 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[1u].WorldPosition[0].xyz, 1.0);
float3 _452 = _451.xyz;
float _454 = _451.w;
float4 _472 = View.View_TranslatedWorldToClip * float4(temp_var_hullMainRetVal[2u].WorldPosition[0].xyz, 1.0);
float3 _473 = _472.xyz;
float _475 = _472.w;
if (any((((select(int3(0), int3(1), (_430 - _431) < float3(_433 + _434)) + (int3(2) * select(int3(0), int3(1), (_430 + _431) > float3((-_433) - _434)))) | (select(int3(0), int3(1), (_452 - _431) < float3(_454 + _434)) + (int3(2) * select(int3(0), int3(1), (_452 + _431) > float3((-_454) - _434))))) | (select(int3(0), int3(1), (_473 - _431) < float3(_475 + _434)) + (int3(2) * select(int3(0), int3(1), (_473 + _431) > float3((-_475) - _434))))) != int3(3)))
{
_524 = float4(0.0);
break;
}
float3 _493 = temp_var_hullMainRetVal[0u].WorldPosition[0].xyz - temp_var_hullMainRetVal[1u].WorldPosition[0].xyz;
float3 _494 = temp_var_hullMainRetVal[1u].WorldPosition[0].xyz - temp_var_hullMainRetVal[2u].WorldPosition[0].xyz;
float3 _495 = temp_var_hullMainRetVal[2u].WorldPosition[0].xyz - temp_var_hullMainRetVal[0u].WorldPosition[0].xyz;
float3 _498 = (float3(0.5) * (temp_var_hullMainRetVal[0u].WorldPosition[0].xyz + temp_var_hullMainRetVal[1u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _501 = (float3(0.5) * (temp_var_hullMainRetVal[1u].WorldPosition[0].xyz + temp_var_hullMainRetVal[2u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float3 _504 = (float3(0.5) * (temp_var_hullMainRetVal[2u].WorldPosition[0].xyz + temp_var_hullMainRetVal[0u].WorldPosition[0].xyz)) - float3(View.View_TranslatedWorldCameraOrigin);
float _508 = sqrt(dot(_494, _494) / dot(_501, _501));
float _512 = sqrt(dot(_495, _495) / dot(_504, _504));
float _516 = sqrt(dot(_493, _493) / dot(_498, _498));
float4 _521 = float4(_508, _512, _516, 1.0);
_521.w = 0.333000004291534423828125 * ((_508 + _512) + _516);
_524 = float4(View.View_AdaptiveTessellationFactor) * _521;
break;
}
float4 _526 = fast::clamp(_416 * _524, float4(1.0), float4(15.0));
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_526.x);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_526.y);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_526.z);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_526.w);
patchOut.out_var_PN_POSITION9 = _385 + ((_385 - (((temp_var_hullMainRetVal[2u].WorldPosition[0] + temp_var_hullMainRetVal[1u].WorldPosition[0]) + temp_var_hullMainRetVal[0u].WorldPosition[0]) * float4(0.3333333432674407958984375))) * float4(0.5));
}
}

View File

@ -0,0 +1,178 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct FVertexFactoryInterpolantsVSToPS
{
float4 TangentToWorld0;
float4 TangentToWorld2;
};
struct FVertexFactoryInterpolantsVSToDS
{
FVertexFactoryInterpolantsVSToPS InterpolantsVSToPS;
};
struct FSharedBasePassInterpolants
{
};
struct FBasePassInterpolantsVSToDS
{
FSharedBasePassInterpolants _m0;
};
struct FBasePassVSToDS
{
FVertexFactoryInterpolantsVSToDS FactoryInterpolants;
FBasePassInterpolantsVSToDS BasePassInterpolants;
float4 Position;
};
struct FFlatTessellationHSToDS
{
FBasePassVSToDS PassSpecificData;
float3 DisplacementScale;
float TessellationMultiplier;
float WorldDisplacementMultiplier;
};
struct type_Primitive
{
float4x4 Primitive_LocalToWorld;
float4 Primitive_InvNonUniformScaleAndDeterminantSign;
float4 Primitive_ObjectWorldPositionAndRadius;
float4x4 Primitive_WorldToLocal;
float4x4 Primitive_PreviousLocalToWorld;
float4x4 Primitive_PreviousWorldToLocal;
packed_float3 Primitive_ActorWorldPosition;
float Primitive_UseSingleSampleShadowFromStationaryLights;
packed_float3 Primitive_ObjectBounds;
float Primitive_LpvBiasMultiplier;
float Primitive_DecalReceiverMask;
float Primitive_PerObjectGBufferData;
float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
float Primitive_DrawsVelocity;
float4 Primitive_ObjectOrientation;
float4 Primitive_NonUniformScale;
packed_float3 Primitive_LocalObjectBoundsMin;
uint Primitive_LightingChannelMask;
packed_float3 Primitive_LocalObjectBoundsMax;
uint Primitive_LightmapDataIndex;
packed_float3 Primitive_PreSkinnedLocalBounds;
int Primitive_SingleCaptureIndex;
uint Primitive_OutputVelocity;
uint PrePadding_Primitive_420;
uint PrePadding_Primitive_424;
uint PrePadding_Primitive_428;
float4 Primitive_CustomPrimitiveData[4];
};
struct type_Material
{
float4 Material_VectorExpressions[3];
float4 Material_ScalarExpressions[1];
};
constant float4 _182 = {};
struct main0_out
{
float3 out_var_Flat_DisplacementScales;
float out_var_Flat_TessellationMultiplier;
float out_var_Flat_WorldDisplacementMultiplier;
float4 out_var_TEXCOORD10_centroid;
float4 out_var_TEXCOORD11_centroid;
float4 out_var_VS_To_DS_Position;
};
struct main0_in
{
float4 in_var_TEXCOORD10_centroid [[attribute(0)]];
float4 in_var_TEXCOORD11_centroid [[attribute(1)]];
float4 in_var_VS_To_DS_Position [[attribute(2)]];
};
kernel void main0(main0_in in [[stage_in]], constant type_Primitive& Primitive [[buffer(0)]], constant type_Material& Material [[buffer(1)]], uint gl_InvocationID [[thread_index_in_threadgroup]], uint gl_PrimitiveID [[threadgroup_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLTriangleTessellationFactorsHalf* spvTessLevel [[buffer(26)]], threadgroup main0_in* gl_in [[threadgroup(0)]])
{
threadgroup FFlatTessellationHSToDS temp_var_hullMainRetVal[3];
device main0_out* gl_out = &spvOut[gl_PrimitiveID * 3];
if (gl_InvocationID < spvIndirectParams[0])
gl_in[gl_InvocationID] = in;
threadgroup_barrier(mem_flags::mem_threadgroup);
if (gl_InvocationID >= 3)
return;
spvUnsafeArray<float4, 3> _90 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_TEXCOORD10_centroid, gl_in[1].in_var_TEXCOORD10_centroid, gl_in[2].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 3> _91 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_TEXCOORD11_centroid, gl_in[1].in_var_TEXCOORD11_centroid, gl_in[2].in_var_TEXCOORD11_centroid });
spvUnsafeArray<float4, 3> _104 = spvUnsafeArray<float4, 3>({ gl_in[0].in_var_VS_To_DS_Position, gl_in[1].in_var_VS_To_DS_Position, gl_in[2].in_var_VS_To_DS_Position });
spvUnsafeArray<FBasePassVSToDS, 3> _111 = spvUnsafeArray<FBasePassVSToDS, 3>({ FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[0], _91[0] } }, FBasePassInterpolantsVSToDS{ { } }, _104[0] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[1], _91[1] } }, FBasePassInterpolantsVSToDS{ { } }, _104[1] }, FBasePassVSToDS{ FVertexFactoryInterpolantsVSToDS{ FVertexFactoryInterpolantsVSToPS{ _90[2], _91[2] } }, FBasePassInterpolantsVSToDS{ { } }, _104[2] } });
spvUnsafeArray<FBasePassVSToDS, 3> param_var_I;
param_var_I = _111;
float3 _128 = Primitive.Primitive_NonUniformScale.xyz * float3x3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz, cross(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz, param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0.xyz) * float3(param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.w), param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2.xyz);
gl_out[gl_InvocationID].out_var_TEXCOORD10_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld0;
gl_out[gl_InvocationID].out_var_TEXCOORD11_centroid = param_var_I[gl_InvocationID].FactoryInterpolants.InterpolantsVSToPS.TangentToWorld2;
gl_out[gl_InvocationID].out_var_VS_To_DS_Position = param_var_I[gl_InvocationID].Position;
gl_out[gl_InvocationID].out_var_Flat_DisplacementScales = _128;
gl_out[gl_InvocationID].out_var_Flat_TessellationMultiplier = Material.Material_ScalarExpressions[0].x;
gl_out[gl_InvocationID].out_var_Flat_WorldDisplacementMultiplier = 1.0;
temp_var_hullMainRetVal[gl_InvocationID] = FFlatTessellationHSToDS{ param_var_I[gl_InvocationID], _128, Material.Material_ScalarExpressions[0].x, 1.0 };
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
if (gl_InvocationID == 0u)
{
float4 _154 = _182;
_154.x = 0.5 * (temp_var_hullMainRetVal[1u].TessellationMultiplier + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _160 = _154;
_160.y = 0.5 * (temp_var_hullMainRetVal[2u].TessellationMultiplier + temp_var_hullMainRetVal[0u].TessellationMultiplier);
float4 _165 = _160;
_165.z = 0.5 * (temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier);
float4 _172 = _165;
_172.w = 0.333000004291534423828125 * ((temp_var_hullMainRetVal[0u].TessellationMultiplier + temp_var_hullMainRetVal[1u].TessellationMultiplier) + temp_var_hullMainRetVal[2u].TessellationMultiplier);
float4 _173 = fast::clamp(_172, float4(1.0), float4(15.0));
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0u] = half(_173.x);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1u] = half(_173.y);
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2u] = half(_173.z);
spvTessLevel[gl_PrimitiveID].insideTessellationFactor = half(_173.w);
}
}

View File

@ -0,0 +1,419 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_ShadowDepthPass
{
float PrePadding_ShadowDepthPass_LPV_0;
float PrePadding_ShadowDepthPass_LPV_4;
float PrePadding_ShadowDepthPass_LPV_8;
float PrePadding_ShadowDepthPass_LPV_12;
float PrePadding_ShadowDepthPass_LPV_16;
float PrePadding_ShadowDepthPass_LPV_20;
float PrePadding_ShadowDepthPass_LPV_24;
float PrePadding_ShadowDepthPass_LPV_28;
float PrePadding_ShadowDepthPass_LPV_32;
float PrePadding_ShadowDepthPass_LPV_36;
float PrePadding_ShadowDepthPass_LPV_40;
float PrePadding_ShadowDepthPass_LPV_44;
float PrePadding_ShadowDepthPass_LPV_48;
float PrePadding_ShadowDepthPass_LPV_52;
float PrePadding_ShadowDepthPass_LPV_56;
float PrePadding_ShadowDepthPass_LPV_60;
float PrePadding_ShadowDepthPass_LPV_64;
float PrePadding_ShadowDepthPass_LPV_68;
float PrePadding_ShadowDepthPass_LPV_72;
float PrePadding_ShadowDepthPass_LPV_76;
float PrePadding_ShadowDepthPass_LPV_80;
float PrePadding_ShadowDepthPass_LPV_84;
float PrePadding_ShadowDepthPass_LPV_88;
float PrePadding_ShadowDepthPass_LPV_92;
float PrePadding_ShadowDepthPass_LPV_96;
float PrePadding_ShadowDepthPass_LPV_100;
float PrePadding_ShadowDepthPass_LPV_104;
float PrePadding_ShadowDepthPass_LPV_108;
float PrePadding_ShadowDepthPass_LPV_112;
float PrePadding_ShadowDepthPass_LPV_116;
float PrePadding_ShadowDepthPass_LPV_120;
float PrePadding_ShadowDepthPass_LPV_124;
float PrePadding_ShadowDepthPass_LPV_128;
float PrePadding_ShadowDepthPass_LPV_132;
float PrePadding_ShadowDepthPass_LPV_136;
float PrePadding_ShadowDepthPass_LPV_140;
float PrePadding_ShadowDepthPass_LPV_144;
float PrePadding_ShadowDepthPass_LPV_148;
float PrePadding_ShadowDepthPass_LPV_152;
float PrePadding_ShadowDepthPass_LPV_156;
float PrePadding_ShadowDepthPass_LPV_160;
float PrePadding_ShadowDepthPass_LPV_164;
float PrePadding_ShadowDepthPass_LPV_168;
float PrePadding_ShadowDepthPass_LPV_172;
float PrePadding_ShadowDepthPass_LPV_176;
float PrePadding_ShadowDepthPass_LPV_180;
float PrePadding_ShadowDepthPass_LPV_184;
float PrePadding_ShadowDepthPass_LPV_188;
float PrePadding_ShadowDepthPass_LPV_192;
float PrePadding_ShadowDepthPass_LPV_196;
float PrePadding_ShadowDepthPass_LPV_200;
float PrePadding_ShadowDepthPass_LPV_204;
float PrePadding_ShadowDepthPass_LPV_208;
float PrePadding_ShadowDepthPass_LPV_212;
float PrePadding_ShadowDepthPass_LPV_216;
float PrePadding_ShadowDepthPass_LPV_220;
float PrePadding_ShadowDepthPass_LPV_224;
float PrePadding_ShadowDepthPass_LPV_228;
float PrePadding_ShadowDepthPass_LPV_232;
float PrePadding_ShadowDepthPass_LPV_236;
float PrePadding_ShadowDepthPass_LPV_240;
float PrePadding_ShadowDepthPass_LPV_244;
float PrePadding_ShadowDepthPass_LPV_248;
float PrePadding_ShadowDepthPass_LPV_252;
float PrePadding_ShadowDepthPass_LPV_256;
float PrePadding_ShadowDepthPass_LPV_260;
float PrePadding_ShadowDepthPass_LPV_264;
float PrePadding_ShadowDepthPass_LPV_268;
float4x4 ShadowDepthPass_LPV_mRsmToWorld;
float4 ShadowDepthPass_LPV_mLightColour;
float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection;
float4 ShadowDepthPass_LPV_mEyePos;
packed_int3 ShadowDepthPass_LPV_mOldGridOffset;
int PrePadding_ShadowDepthPass_LPV_396;
packed_int3 ShadowDepthPass_LPV_mLpvGridOffset;
float ShadowDepthPass_LPV_ClearMultiplier;
float ShadowDepthPass_LPV_LpvScale;
float ShadowDepthPass_LPV_OneOverLpvScale;
float ShadowDepthPass_LPV_DirectionalOcclusionIntensity;
float ShadowDepthPass_LPV_DirectionalOcclusionRadius;
float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier;
float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier;
float ShadowDepthPass_LPV_SecondaryOcclusionStrength;
float ShadowDepthPass_LPV_SecondaryBounceStrength;
float ShadowDepthPass_LPV_VplInjectionBias;
float ShadowDepthPass_LPV_GeometryVolumeInjectionBias;
float ShadowDepthPass_LPV_EmissiveInjectionMultiplier;
int ShadowDepthPass_LPV_PropagationIndex;
float4x4 ShadowDepthPass_ProjectionMatrix;
float4x4 ShadowDepthPass_ViewMatrix;
float4 ShadowDepthPass_ShadowParams;
float ShadowDepthPass_bClampToNearPlane;
float PrePadding_ShadowDepthPass_612;
float PrePadding_ShadowDepthPass_616;
float PrePadding_ShadowDepthPass_620;
float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6];
float4x4 ShadowDepthPass_ShadowViewMatrices[6];
};
constant float4 _113 = {};
struct main0_out
{
float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
float4 out_var_COLOR0 [[user(locn2)]];
float4 out_var_TEXCOORD0_0 [[user(locn3)]];
uint out_var_PRIMITIVE_ID [[user(locn4)]];
float out_var_TEXCOORD6 [[user(locn5)]];
float out_var_TEXCOORD8 [[user(locn6)]];
float3 out_var_TEXCOORD7 [[user(locn7)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 in_var_COLOR0 [[attribute(0)]];
float4 in_var_PN_POSITION_0 [[attribute(2)]];
float4 in_var_PN_POSITION_1 [[attribute(3)]];
float4 in_var_PN_POSITION_2 [[attribute(4)]];
float in_var_PN_WorldDisplacementMultiplier [[attribute(7)]];
uint in_var_PRIMITIVE_ID [[attribute(8)]];
float4 in_var_TEXCOORD0_0 [[attribute(9)]];
float4 in_var_TEXCOORD10_centroid [[attribute(10)]];
float4 in_var_TEXCOORD11_centroid [[attribute(11)]];
};
struct main0_patchIn
{
float4 in_var_PN_POSITION9 [[attribute(5)]];
patch_control_point<main0_in> gl_in;
};
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(1)]], texture2d<float> Material_Texture2D_3 [[texture(0)]], sampler Material_Texture2D_3Sampler [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
spvUnsafeArray<float4, 1> out_var_TEXCOORD0 = {};
spvUnsafeArray<float4, 3> _117 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 3> _118 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
spvUnsafeArray<float4, 3> _119 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR0, patchIn.gl_in[1].in_var_COLOR0, patchIn.gl_in[2].in_var_COLOR0 });
spvUnsafeArray<spvUnsafeArray<float4, 1>, 3> _120 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 3>({ spvUnsafeArray<float4, 1>({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) });
spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _135 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
spvUnsafeArray<float, 3> _136 = spvUnsafeArray<float, 3>({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier });
float _157 = gl_TessCoord.x * gl_TessCoord.x;
float _158 = gl_TessCoord.y * gl_TessCoord.y;
float _159 = gl_TessCoord.z * gl_TessCoord.z;
float4 _165 = float4(gl_TessCoord.x);
float4 _169 = float4(gl_TessCoord.y);
float4 _174 = float4(gl_TessCoord.z);
float4 _177 = float4(_157 * 3.0);
float4 _181 = float4(_158 * 3.0);
float4 _188 = float4(_159 * 3.0);
float4 _202 = ((((((((((_135[0][0] * float4(_157)) * _165) + ((_135[1][0] * float4(_158)) * _169)) + ((_135[2][0] * float4(_159)) * _174)) + ((_135[0][1] * _177) * _169)) + ((_135[0][2] * _181) * _165)) + ((_135[1][1] * _181) * _174)) + ((_135[1][2] * _188) * _169)) + ((_135[2][1] * _188) * _165)) + ((_135[2][2] * _177) * _174)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _174) * _165) * _169);
float3 _226 = ((_117[0].xyz * float3(gl_TessCoord.x)) + (_117[1].xyz * float3(gl_TessCoord.y))).xyz + (_117[2].xyz * float3(gl_TessCoord.z));
float4 _229 = ((_118[0] * _165) + (_118[1] * _169)) + (_118[2] * _174);
float4 _231 = ((_119[0] * _165) + (_119[1] * _169)) + (_119[2] * _174);
float4 _233 = ((_120[0][0] * _165) + (_120[1][0] * _169)) + (_120[2][0] * _174);
spvUnsafeArray<float4, 1> _234 = spvUnsafeArray<float4, 1>({ _233 });
float3 _236 = _229.xyz;
float3 _264 = _202.xyz + (((float3((Material_Texture2D_3.sample(Material_Texture2D_3Sampler, (float2(View.View_GameTime * 0.20000000298023223876953125, View.View_GameTime * (-0.699999988079071044921875)) + (_233.zw * float2(1.0, 2.0))), level(-1.0)).x * 10.0) * (1.0 - _231.x)) * _236) * float3(0.5)) * float3(((_136[0] * gl_TessCoord.x) + (_136[1] * gl_TessCoord.y)) + (_136[2] * gl_TessCoord.z)));
float4 _270 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_264.x, _264.y, _264.z, _202.w);
float4 _281;
if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_270.z < 0.0))
{
float4 _279 = _270;
_279.z = 9.9999999747524270787835121154785e-07;
float4 _280 = _279;
_280.w = 1.0;
_281 = _280;
}
else
{
_281 = _270;
}
float _290 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _236));
out.out_var_TEXCOORD10_centroid = float4(_226.x, _226.y, _226.z, _113.w);
out.out_var_TEXCOORD11_centroid = _229;
out.out_var_COLOR0 = _231;
out_var_TEXCOORD0 = _234;
out.out_var_PRIMITIVE_ID = patchIn.gl_in[0u].in_var_PRIMITIVE_ID;
out.out_var_TEXCOORD6 = _281.z;
out.out_var_TEXCOORD8 = (ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_290) > 0.0) ? (sqrt(fast::clamp(1.0 - (_290 * _290), 0.0, 1.0)) / _290) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x;
out.out_var_TEXCOORD7 = _264.xyz;
out.gl_Position = _281;
out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0];
return out;
}

View File

@ -0,0 +1,415 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
float PrePadding_View_3048;
float PrePadding_View_3052;
float4x4 View_WorldToVirtualTexture;
float4 View_VirtualTextureParams;
float4 View_XRPassthroughCameraUVs[2];
};
struct type_Material
{
float4 Material_VectorExpressions[5];
float4 Material_ScalarExpressions[2];
};
constant float4 _118 = {};
struct main0_out
{
float4 out_var_TEXCOORD6 [[user(locn0)]];
float4 out_var_TEXCOORD7 [[user(locn1)]];
float4 out_var_TEXCOORD10_centroid [[user(locn2)]];
float4 out_var_TEXCOORD11_centroid [[user(locn3)]];
float gl_ClipDistance [[clip_distance]] [1];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 in_var_PN_DominantEdge2 [[attribute(3)]];
float4 in_var_PN_DominantEdge3 [[attribute(4)]];
float3 in_var_PN_DominantEdge4 [[attribute(5)]];
float3 in_var_PN_DominantEdge5 [[attribute(6)]];
float4 in_var_PN_DominantVertex1 [[attribute(8)]];
float3 in_var_PN_DominantVertex2 [[attribute(9)]];
float4 in_var_PN_POSITION_0 [[attribute(10)]];
float4 in_var_PN_POSITION_1 [[attribute(11)]];
float4 in_var_PN_POSITION_2 [[attribute(12)]];
float in_var_PN_WorldDisplacementMultiplier [[attribute(15)]];
float4 in_var_TEXCOORD10_centroid [[attribute(16)]];
float4 in_var_TEXCOORD11_centroid [[attribute(17)]];
float4 in_var_TEXCOORD6 [[attribute(18)]];
float4 in_var_TEXCOORD8 [[attribute(19)]];
};
struct main0_patchIn
{
float4 in_var_PN_POSITION9 [[attribute(13)]];
patch_control_point<main0_in> gl_in;
};
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Material& Material [[buffer(1)]], texture3d<float> View_GlobalDistanceFieldTexture0 [[texture(0)]], texture3d<float> View_GlobalDistanceFieldTexture1 [[texture(1)]], texture3d<float> View_GlobalDistanceFieldTexture2 [[texture(2)]], texture3d<float> View_GlobalDistanceFieldTexture3 [[texture(3)]], sampler View_GlobalDistanceFieldSampler0 [[sampler(0)]], float3 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
spvUnsafeArray<float4, 3> _120 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD6, patchIn.gl_in[1].in_var_TEXCOORD6, patchIn.gl_in[2].in_var_TEXCOORD6 });
spvUnsafeArray<float4, 3> _121 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD8, patchIn.gl_in[1].in_var_TEXCOORD8, patchIn.gl_in[2].in_var_TEXCOORD8 });
spvUnsafeArray<float4, 3> _128 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 3> _129 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _136 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
spvUnsafeArray<float, 3> _137 = spvUnsafeArray<float, 3>({ patchIn.gl_in[0].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[1].in_var_PN_WorldDisplacementMultiplier, patchIn.gl_in[2].in_var_PN_WorldDisplacementMultiplier });
spvUnsafeArray<float4, 3> _138 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantVertex1, patchIn.gl_in[1].in_var_PN_DominantVertex1, patchIn.gl_in[2].in_var_PN_DominantVertex1 });
spvUnsafeArray<float3, 3> _139 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantVertex2, patchIn.gl_in[1].in_var_PN_DominantVertex2, patchIn.gl_in[2].in_var_PN_DominantVertex2 });
spvUnsafeArray<float4, 3> _146 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge2, patchIn.gl_in[1].in_var_PN_DominantEdge2, patchIn.gl_in[2].in_var_PN_DominantEdge2 });
spvUnsafeArray<float4, 3> _147 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge3, patchIn.gl_in[1].in_var_PN_DominantEdge3, patchIn.gl_in[2].in_var_PN_DominantEdge3 });
spvUnsafeArray<float3, 3> _148 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge4, patchIn.gl_in[1].in_var_PN_DominantEdge4, patchIn.gl_in[2].in_var_PN_DominantEdge4 });
spvUnsafeArray<float3, 3> _149 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_PN_DominantEdge5, patchIn.gl_in[1].in_var_PN_DominantEdge5, patchIn.gl_in[2].in_var_PN_DominantEdge5 });
float _190 = gl_TessCoord.x * gl_TessCoord.x;
float _191 = gl_TessCoord.y * gl_TessCoord.y;
float _192 = gl_TessCoord.z * gl_TessCoord.z;
float4 _198 = float4(gl_TessCoord.x);
float4 _202 = float4(gl_TessCoord.y);
float4 _207 = float4(gl_TessCoord.z);
float4 _210 = float4(_190 * 3.0);
float4 _214 = float4(_191 * 3.0);
float4 _221 = float4(_192 * 3.0);
float4 _235 = ((((((((((_136[0][0] * float4(_190)) * _198) + ((_136[1][0] * float4(_191)) * _202)) + ((_136[2][0] * float4(_192)) * _207)) + ((_136[0][1] * _210) * _202)) + ((_136[0][2] * _214) * _198)) + ((_136[1][1] * _214) * _207)) + ((_136[1][2] * _221) * _202)) + ((_136[2][1] * _221) * _198)) + ((_136[2][2] * _210) * _207)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _207) * _198) * _202);
float3 _237 = float3(gl_TessCoord.x);
float3 _240 = float3(gl_TessCoord.y);
float3 _254 = float3(gl_TessCoord.z);
float3 _256 = ((_128[0].xyz * _237) + (_128[1].xyz * _240)).xyz + (_128[2].xyz * _254);
float4 _259 = ((_129[0] * _198) + (_129[1] * _202)) + (_129[2] * _207);
float3 _264 = _235.xyz;
float3 _265 = _256.xyz;
float3 _266 = _259.xyz;
float3 _272 = _264 + float3(View.View_WorldCameraOrigin);
float _279 = float(int(gl_TessCoord.x == 0.0));
float _282 = float(int(gl_TessCoord.y == 0.0));
float _285 = float(int(gl_TessCoord.z == 0.0));
float _286 = _279 + _282;
float _287 = _286 + _285;
float4 _387;
float3 _388;
if (float(int(_287 == 2.0)) == 1.0)
{
float _363 = float(int((_282 + _285) == 2.0));
float _367 = float(int((_285 + _279) == 2.0));
float _370 = float(int(_286 == 2.0));
_387 = ((float4(_363) * _138[0]) + (float4(_367) * _138[1])) + (float4(_370) * _138[2]);
_388 = ((float3(_363) * _139[0]) + (float3(_367) * _139[1])) + (float3(_370) * _139[2]);
}
else
{
float4 _358;
float3 _359;
if (float(int(_287 == 1.0)) != 0.0)
{
float4 _304 = float4(_279);
float4 _306 = float4(_282);
float4 _309 = float4(_285);
float4 _311 = ((_304 * _146[0]) + (_306 * _146[1])) + (_309 * _146[2]);
float4 _316 = ((_304 * _147[0]) + (_306 * _147[1])) + (_309 * _147[2]);
float3 _331 = float3(_279);
float3 _333 = float3(_282);
float3 _336 = float3(_285);
float3 _338 = ((_331 * _148[0]) + (_333 * _148[1])) + (_336 * _148[2]);
float3 _343 = ((_331 * _149[0]) + (_333 * _149[1])) + (_336 * _149[2]);
_358 = ((_304 * ((_202 * _311) + (_207 * _316))) + (_306 * ((_207 * _311) + (_198 * _316)))) + (_309 * ((_198 * _311) + (_202 * _316)));
_359 = ((_331 * ((_240 * _338) + (_254 * _343))) + (_333 * ((_254 * _338) + (_237 * _343)))) + (_336 * ((_237 * _338) + (_240 * _343)));
}
else
{
_358 = float4(_259.xyz, 0.0);
_359 = _265;
}
_387 = _358;
_388 = _359;
}
float3x3 _398;
if (float(int(_287 == 0.0)) == 0.0)
{
_398 = float3x3(_388, cross(_387.xyz, _388) * float3(_387.w), _387.xyz);
}
else
{
_398 = float3x3(_265, cross(_266, _265) * float3(_259.w), _266);
}
float3 _411 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[0].xyz) + View.View_GlobalVolumeCenterAndExtent[0].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[0].xyz + View.View_GlobalVolumeCenterAndExtent[0].www) - _272, float3(0.0)));
float _547;
if (fast::min(_411.x, fast::min(_411.y, _411.z)) > (View.View_GlobalVolumeCenterAndExtent[0].w * View.View_GlobalVolumeTexelSize))
{
_547 = View_GlobalDistanceFieldTexture0.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[0u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[0u].xyz), level(0.0)).x;
}
else
{
float3 _436 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[1].xyz) + View.View_GlobalVolumeCenterAndExtent[1].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[1].xyz + View.View_GlobalVolumeCenterAndExtent[1].www) - _272, float3(0.0)));
float _535;
if (fast::min(_436.x, fast::min(_436.y, _436.z)) > (View.View_GlobalVolumeCenterAndExtent[1].w * View.View_GlobalVolumeTexelSize))
{
_535 = View_GlobalDistanceFieldTexture1.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[1u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[1u].xyz), level(0.0)).x;
}
else
{
float3 _459 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[2].xyz) + View.View_GlobalVolumeCenterAndExtent[2].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[2].xyz + View.View_GlobalVolumeCenterAndExtent[2].www) - _272, float3(0.0)));
float3 _475 = fast::min(fast::max((_272 - View.View_GlobalVolumeCenterAndExtent[3].xyz) + View.View_GlobalVolumeCenterAndExtent[3].www, float3(0.0)), fast::max((View.View_GlobalVolumeCenterAndExtent[3].xyz + View.View_GlobalVolumeCenterAndExtent[3].www) - _272, float3(0.0)));
float _480 = fast::min(_475.x, fast::min(_475.y, _475.z));
float _523;
if (fast::min(_459.x, fast::min(_459.y, _459.z)) > (View.View_GlobalVolumeCenterAndExtent[2].w * View.View_GlobalVolumeTexelSize))
{
_523 = View_GlobalDistanceFieldTexture2.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[2u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[2u].xyz), level(0.0)).x;
}
else
{
float _511;
if (_480 > (View.View_GlobalVolumeCenterAndExtent[3].w * View.View_GlobalVolumeTexelSize))
{
_511 = mix(View.View_MaxGlobalDistance, View_GlobalDistanceFieldTexture3.sample(View_GlobalDistanceFieldSampler0, ((_272 * View.View_GlobalVolumeWorldToUVAddAndMul[3u].www) + View.View_GlobalVolumeWorldToUVAddAndMul[3u].xyz), level(0.0)).x, fast::clamp((_480 * 10.0) * View.View_GlobalVolumeWorldToUVAddAndMul[3].w, 0.0, 1.0));
}
else
{
_511 = View.View_MaxGlobalDistance;
}
_523 = _511;
}
_535 = _523;
}
_547 = _535;
}
float3 _565 = _264 + ((_398[2] * float3(fast::min(_547 + Material.Material_ScalarExpressions[0].z, 0.0) * Material.Material_ScalarExpressions[0].w)) * float3(((_137[0] * gl_TessCoord.x) + (_137[1] * gl_TessCoord.y)) + (_137[2] * gl_TessCoord.z)));
float4 _574 = View.View_TranslatedWorldToClip * float4(_565.x, _565.y, _565.z, _235.w);
float4 _579 = _574;
_579.z = _574.z + (0.001000000047497451305389404296875 * _574.w);
out.gl_Position = _579;
out.out_var_TEXCOORD6 = ((_120[0] * _198) + (_120[1] * _202)) + (_120[2] * _207);
out.out_var_TEXCOORD7 = ((_121[0] * _198) + (_121[1] * _202)) + (_121[2] * _207);
out.out_var_TEXCOORD10_centroid = float4(_256.x, _256.y, _256.z, _118.w);
out.out_var_TEXCOORD11_centroid = _259;
out.gl_ClipDistance[0u] = dot(View.View_GlobalClippingPlane, float4(_565.xyz - float3(View.View_PreViewTranslation), 1.0));
return out;
}

View File

@ -0,0 +1,216 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_ShadowDepthPass
{
float PrePadding_ShadowDepthPass_LPV_0;
float PrePadding_ShadowDepthPass_LPV_4;
float PrePadding_ShadowDepthPass_LPV_8;
float PrePadding_ShadowDepthPass_LPV_12;
float PrePadding_ShadowDepthPass_LPV_16;
float PrePadding_ShadowDepthPass_LPV_20;
float PrePadding_ShadowDepthPass_LPV_24;
float PrePadding_ShadowDepthPass_LPV_28;
float PrePadding_ShadowDepthPass_LPV_32;
float PrePadding_ShadowDepthPass_LPV_36;
float PrePadding_ShadowDepthPass_LPV_40;
float PrePadding_ShadowDepthPass_LPV_44;
float PrePadding_ShadowDepthPass_LPV_48;
float PrePadding_ShadowDepthPass_LPV_52;
float PrePadding_ShadowDepthPass_LPV_56;
float PrePadding_ShadowDepthPass_LPV_60;
float PrePadding_ShadowDepthPass_LPV_64;
float PrePadding_ShadowDepthPass_LPV_68;
float PrePadding_ShadowDepthPass_LPV_72;
float PrePadding_ShadowDepthPass_LPV_76;
float PrePadding_ShadowDepthPass_LPV_80;
float PrePadding_ShadowDepthPass_LPV_84;
float PrePadding_ShadowDepthPass_LPV_88;
float PrePadding_ShadowDepthPass_LPV_92;
float PrePadding_ShadowDepthPass_LPV_96;
float PrePadding_ShadowDepthPass_LPV_100;
float PrePadding_ShadowDepthPass_LPV_104;
float PrePadding_ShadowDepthPass_LPV_108;
float PrePadding_ShadowDepthPass_LPV_112;
float PrePadding_ShadowDepthPass_LPV_116;
float PrePadding_ShadowDepthPass_LPV_120;
float PrePadding_ShadowDepthPass_LPV_124;
float PrePadding_ShadowDepthPass_LPV_128;
float PrePadding_ShadowDepthPass_LPV_132;
float PrePadding_ShadowDepthPass_LPV_136;
float PrePadding_ShadowDepthPass_LPV_140;
float PrePadding_ShadowDepthPass_LPV_144;
float PrePadding_ShadowDepthPass_LPV_148;
float PrePadding_ShadowDepthPass_LPV_152;
float PrePadding_ShadowDepthPass_LPV_156;
float PrePadding_ShadowDepthPass_LPV_160;
float PrePadding_ShadowDepthPass_LPV_164;
float PrePadding_ShadowDepthPass_LPV_168;
float PrePadding_ShadowDepthPass_LPV_172;
float PrePadding_ShadowDepthPass_LPV_176;
float PrePadding_ShadowDepthPass_LPV_180;
float PrePadding_ShadowDepthPass_LPV_184;
float PrePadding_ShadowDepthPass_LPV_188;
float PrePadding_ShadowDepthPass_LPV_192;
float PrePadding_ShadowDepthPass_LPV_196;
float PrePadding_ShadowDepthPass_LPV_200;
float PrePadding_ShadowDepthPass_LPV_204;
float PrePadding_ShadowDepthPass_LPV_208;
float PrePadding_ShadowDepthPass_LPV_212;
float PrePadding_ShadowDepthPass_LPV_216;
float PrePadding_ShadowDepthPass_LPV_220;
float PrePadding_ShadowDepthPass_LPV_224;
float PrePadding_ShadowDepthPass_LPV_228;
float PrePadding_ShadowDepthPass_LPV_232;
float PrePadding_ShadowDepthPass_LPV_236;
float PrePadding_ShadowDepthPass_LPV_240;
float PrePadding_ShadowDepthPass_LPV_244;
float PrePadding_ShadowDepthPass_LPV_248;
float PrePadding_ShadowDepthPass_LPV_252;
float PrePadding_ShadowDepthPass_LPV_256;
float PrePadding_ShadowDepthPass_LPV_260;
float PrePadding_ShadowDepthPass_LPV_264;
float PrePadding_ShadowDepthPass_LPV_268;
float4x4 ShadowDepthPass_LPV_mRsmToWorld;
float4 ShadowDepthPass_LPV_mLightColour;
float4 ShadowDepthPass_LPV_GeometryVolumeCaptureLightDirection;
float4 ShadowDepthPass_LPV_mEyePos;
packed_int3 ShadowDepthPass_LPV_mOldGridOffset;
int PrePadding_ShadowDepthPass_LPV_396;
packed_int3 ShadowDepthPass_LPV_mLpvGridOffset;
float ShadowDepthPass_LPV_ClearMultiplier;
float ShadowDepthPass_LPV_LpvScale;
float ShadowDepthPass_LPV_OneOverLpvScale;
float ShadowDepthPass_LPV_DirectionalOcclusionIntensity;
float ShadowDepthPass_LPV_DirectionalOcclusionRadius;
float ShadowDepthPass_LPV_RsmAreaIntensityMultiplier;
float ShadowDepthPass_LPV_RsmPixelToTexcoordMultiplier;
float ShadowDepthPass_LPV_SecondaryOcclusionStrength;
float ShadowDepthPass_LPV_SecondaryBounceStrength;
float ShadowDepthPass_LPV_VplInjectionBias;
float ShadowDepthPass_LPV_GeometryVolumeInjectionBias;
float ShadowDepthPass_LPV_EmissiveInjectionMultiplier;
int ShadowDepthPass_LPV_PropagationIndex;
float4x4 ShadowDepthPass_ProjectionMatrix;
float4x4 ShadowDepthPass_ViewMatrix;
float4 ShadowDepthPass_ShadowParams;
float ShadowDepthPass_bClampToNearPlane;
float PrePadding_ShadowDepthPass_612;
float PrePadding_ShadowDepthPass_616;
float PrePadding_ShadowDepthPass_620;
float4x4 ShadowDepthPass_ShadowViewProjectionMatrices[6];
float4x4 ShadowDepthPass_ShadowViewMatrices[6];
};
constant float4 _90 = {};
struct main0_out
{
float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
float out_var_TEXCOORD6 [[user(locn2)]];
float3 out_var_TEXCOORD7 [[user(locn3)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 in_var_PN_POSITION_0 [[attribute(10)]];
float4 in_var_PN_POSITION_1 [[attribute(11)]];
float4 in_var_PN_POSITION_2 [[attribute(12)]];
float4 in_var_TEXCOORD10_centroid [[attribute(16)]];
float4 in_var_TEXCOORD11_centroid [[attribute(17)]];
};
struct main0_patchIn
{
float4 in_var_PN_POSITION9 [[attribute(13)]];
patch_control_point<main0_in> gl_in;
};
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_ShadowDepthPass& ShadowDepthPass [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
spvUnsafeArray<float4, 3> _93 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 3> _94 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
spvUnsafeArray<spvUnsafeArray<float4, 3>, 3> _101 = spvUnsafeArray<spvUnsafeArray<float4, 3>, 3>({ spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_PN_POSITION_0, patchIn.gl_in[0].in_var_PN_POSITION_1, patchIn.gl_in[0].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[1].in_var_PN_POSITION_0, patchIn.gl_in[1].in_var_PN_POSITION_1, patchIn.gl_in[1].in_var_PN_POSITION_2 }), spvUnsafeArray<float4, 3>({ patchIn.gl_in[2].in_var_PN_POSITION_0, patchIn.gl_in[2].in_var_PN_POSITION_1, patchIn.gl_in[2].in_var_PN_POSITION_2 }) });
float _119 = gl_TessCoord.x * gl_TessCoord.x;
float _120 = gl_TessCoord.y * gl_TessCoord.y;
float _121 = gl_TessCoord.z * gl_TessCoord.z;
float4 _127 = float4(gl_TessCoord.x);
float4 _131 = float4(gl_TessCoord.y);
float4 _136 = float4(gl_TessCoord.z);
float4 _139 = float4(_119 * 3.0);
float4 _143 = float4(_120 * 3.0);
float4 _150 = float4(_121 * 3.0);
float4 _164 = ((((((((((_101[0][0] * float4(_119)) * _127) + ((_101[1][0] * float4(_120)) * _131)) + ((_101[2][0] * float4(_121)) * _136)) + ((_101[0][1] * _139) * _131)) + ((_101[0][2] * _143) * _127)) + ((_101[1][1] * _143) * _136)) + ((_101[1][2] * _150) * _131)) + ((_101[2][1] * _150) * _127)) + ((_101[2][2] * _139) * _136)) + ((((patchIn.in_var_PN_POSITION9 * float4(6.0)) * _136) * _127) * _131);
float3 _179 = ((_93[0].xyz * float3(gl_TessCoord.x)) + (_93[1].xyz * float3(gl_TessCoord.y))).xyz + (_93[2].xyz * float3(gl_TessCoord.z));
float4 _182 = ((_94[0] * _127) + (_94[1] * _131)) + (_94[2] * _136);
float4 _189 = ShadowDepthPass.ShadowDepthPass_ProjectionMatrix * float4(_164.x, _164.y, _164.z, _164.w);
float4 _200;
if ((ShadowDepthPass.ShadowDepthPass_bClampToNearPlane > 0.0) && (_189.z < 0.0))
{
float4 _198 = _189;
_198.z = 9.9999999747524270787835121154785e-07;
float4 _199 = _198;
_199.w = 1.0;
_200 = _199;
}
else
{
_200 = _189;
}
float _209 = abs(dot(float3(ShadowDepthPass.ShadowDepthPass_ViewMatrix[0].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[1].z, ShadowDepthPass.ShadowDepthPass_ViewMatrix[2].z), _182.xyz));
float4 _234 = _200;
_234.z = ((_200.z * ShadowDepthPass.ShadowDepthPass_ShadowParams.w) + ((ShadowDepthPass.ShadowDepthPass_ShadowParams.y * fast::clamp((abs(_209) > 0.0) ? (sqrt(fast::clamp(1.0 - (_209 * _209), 0.0, 1.0)) / _209) : ShadowDepthPass.ShadowDepthPass_ShadowParams.z, 0.0, ShadowDepthPass.ShadowDepthPass_ShadowParams.z)) + ShadowDepthPass.ShadowDepthPass_ShadowParams.x)) * _200.w;
out.out_var_TEXCOORD10_centroid = float4(_179.x, _179.y, _179.z, _90.w);
out.out_var_TEXCOORD11_centroid = _182;
out.out_var_TEXCOORD6 = 0.0;
out.out_var_TEXCOORD7 = _164.xyz;
out.gl_Position = _234;
return out;
}

View File

@ -0,0 +1,318 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_ClipToWorld;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_908;
packed_float3 View_ViewUp;
float PrePadding_View_924;
packed_float3 View_ViewRight;
float PrePadding_View_940;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_956;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_972;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_1020;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_1036;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_1052;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1068;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1724;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1740;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1756;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2076;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2148;
float PrePadding_View_2152;
float PrePadding_View_2156;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2228;
float PrePadding_View_2232;
float PrePadding_View_2236;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2268;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2412;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
float View_AtmosphericFogSunDiscHalfApexAngleRadian;
float PrePadding_View_2492;
float4 View_AtmosphericFogSunDiscLuminance;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
uint PrePadding_View_2520;
uint PrePadding_View_2524;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2584;
float PrePadding_View_2588;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2744;
float PrePadding_View_2748;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float PrePadding_View_2908;
int2 View_CursorPosition;
float View_bCheckerboardSubsurfaceProfileRendering;
float PrePadding_View_2924;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2940;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2956;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2972;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2988;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_3004;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
float PrePadding_View_3048;
float PrePadding_View_3052;
float4x4 View_WorldToVirtualTexture;
float4 View_VirtualTextureParams;
float4 View_XRPassthroughCameraUVs[2];
};
constant float4 _68 = {};
struct main0_out
{
float4 out_var_TEXCOORD10_centroid [[user(locn0)]];
float4 out_var_TEXCOORD11_centroid [[user(locn1)]];
float4 out_var_TEXCOORD0_0 [[user(locn2)]];
float4 out_var_COLOR1 [[user(locn3)]];
float4 out_var_COLOR2 [[user(locn4)]];
float4 out_var_TEXCOORD6 [[user(locn5)]];
float3 out_var_TEXCOORD7 [[user(locn6)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 in_var_COLOR1 [[attribute(0)]];
float4 in_var_COLOR2 [[attribute(1)]];
float4 in_var_TEXCOORD0_0 [[attribute(5)]];
float4 in_var_TEXCOORD10_centroid [[attribute(6)]];
float4 in_var_TEXCOORD11_centroid [[attribute(7)]];
float3 in_var_TEXCOORD7 [[attribute(8)]];
float4 in_var_VS_To_DS_Position [[attribute(9)]];
};
struct main0_patchIn
{
patch_control_point<main0_in> gl_in;
};
[[ patch(triangle, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]], constant type_View& View [[buffer(0)]], float3 gl_TessCoord [[position_in_patch]])
{
main0_out out = {};
spvUnsafeArray<float4, 1> out_var_TEXCOORD0 = {};
spvUnsafeArray<float4, 3> _77 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD10_centroid, patchIn.gl_in[1].in_var_TEXCOORD10_centroid, patchIn.gl_in[2].in_var_TEXCOORD10_centroid });
spvUnsafeArray<float4, 3> _78 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_TEXCOORD11_centroid, patchIn.gl_in[1].in_var_TEXCOORD11_centroid, patchIn.gl_in[2].in_var_TEXCOORD11_centroid });
spvUnsafeArray<spvUnsafeArray<float4, 1>, 3> _79 = spvUnsafeArray<spvUnsafeArray<float4, 1>, 3>({ spvUnsafeArray<float4, 1>({ patchIn.gl_in[0].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[1].in_var_TEXCOORD0_0 }), spvUnsafeArray<float4, 1>({ patchIn.gl_in[2].in_var_TEXCOORD0_0 }) });
spvUnsafeArray<float4, 3> _80 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR1, patchIn.gl_in[1].in_var_COLOR1, patchIn.gl_in[2].in_var_COLOR1 });
spvUnsafeArray<float4, 3> _81 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_COLOR2, patchIn.gl_in[1].in_var_COLOR2, patchIn.gl_in[2].in_var_COLOR2 });
spvUnsafeArray<float4, 3> _97 = spvUnsafeArray<float4, 3>({ patchIn.gl_in[0].in_var_VS_To_DS_Position, patchIn.gl_in[1].in_var_VS_To_DS_Position, patchIn.gl_in[2].in_var_VS_To_DS_Position });
spvUnsafeArray<float3, 3> _98 = spvUnsafeArray<float3, 3>({ patchIn.gl_in[0].in_var_TEXCOORD7, patchIn.gl_in[1].in_var_TEXCOORD7, patchIn.gl_in[2].in_var_TEXCOORD7 });
float4 _111 = float4(gl_TessCoord.x);
float4 _113 = float4(gl_TessCoord.y);
float4 _116 = float4(gl_TessCoord.z);
float4 _118 = ((_97[0] * _111) + (_97[1] * _113)) + (_97[2] * _116);
spvUnsafeArray<float4, 1> _72;
_72 = _79[0];
spvUnsafeArray<float4, 1> _71;
_71 = _79[1];
float3 _120 = float3(gl_TessCoord.x);
float3 _123 = float3(gl_TessCoord.y);
spvUnsafeArray<float4, 1> _73;
for (int _133 = 0; _133 < 1; )
{
_73[_133] = (_72[_133] * _111) + (_71[_133] * _113);
_133++;
continue;
}
spvUnsafeArray<float4, 1> _75;
_75 = _73;
spvUnsafeArray<float4, 1> _74;
_74 = _79[2];
float3 _155 = float3(gl_TessCoord.z);
float3 _157 = ((_77[0].xyz * _120) + (_77[1].xyz * _123)).xyz + (_77[2].xyz * _155);
spvUnsafeArray<float4, 1> _76;
for (int _164 = 0; _164 < 1; )
{
_76[_164] = _75[_164] + (_74[_164] * _116);
_164++;
continue;
}
float4 _181 = float4(_118.x, _118.y, _118.z, _118.w);
out.out_var_TEXCOORD10_centroid = float4(_157.x, _157.y, _157.z, _68.w);
out.out_var_TEXCOORD11_centroid = ((_78[0] * _111) + (_78[1] * _113)) + (_78[2] * _116);
out_var_TEXCOORD0 = _76;
out.out_var_COLOR1 = ((_80[0] * _111) + (_80[1] * _113)) + (_80[2] * _116);
out.out_var_COLOR2 = ((_81[0] * _111) + (_81[1] * _113)) + (_81[2] * _116);
out.out_var_TEXCOORD6 = _181;
out.out_var_TEXCOORD7 = ((_98[0] * _120) + (_98[1] * _123)) + (_98[2] * _155);
out.gl_Position = View.View_TranslatedWorldToClip * _181;
out.out_var_TEXCOORD0_0 = out_var_TEXCOORD0[0];
return out;
}

View File

@ -0,0 +1,466 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_MobileBasePass
{
float4 MobileBasePass_Fog_ExponentialFogParameters;
float4 MobileBasePass_Fog_ExponentialFogParameters2;
float4 MobileBasePass_Fog_ExponentialFogColorParameter;
float4 MobileBasePass_Fog_ExponentialFogParameters3;
float4 MobileBasePass_Fog_InscatteringLightDirection;
float4 MobileBasePass_Fog_DirectionalInscatteringColor;
float2 MobileBasePass_Fog_SinCosInscatteringColorCubemapRotation;
float PrePadding_MobileBasePass_Fog_104;
float PrePadding_MobileBasePass_Fog_108;
packed_float3 MobileBasePass_Fog_FogInscatteringTextureParameters;
float MobileBasePass_Fog_ApplyVolumetricFog;
float PrePadding_MobileBasePass_PlanarReflection_128;
float PrePadding_MobileBasePass_PlanarReflection_132;
float PrePadding_MobileBasePass_PlanarReflection_136;
float PrePadding_MobileBasePass_PlanarReflection_140;
float PrePadding_MobileBasePass_PlanarReflection_144;
float PrePadding_MobileBasePass_PlanarReflection_148;
float PrePadding_MobileBasePass_PlanarReflection_152;
float PrePadding_MobileBasePass_PlanarReflection_156;
float4 MobileBasePass_PlanarReflection_ReflectionPlane;
float4 MobileBasePass_PlanarReflection_PlanarReflectionOrigin;
float4 MobileBasePass_PlanarReflection_PlanarReflectionXAxis;
float4 MobileBasePass_PlanarReflection_PlanarReflectionYAxis;
float3x4 MobileBasePass_PlanarReflection_InverseTransposeMirrorMatrix;
packed_float3 MobileBasePass_PlanarReflection_PlanarReflectionParameters;
float PrePadding_MobileBasePass_PlanarReflection_284;
float2 MobileBasePass_PlanarReflection_PlanarReflectionParameters2;
float PrePadding_MobileBasePass_PlanarReflection_296;
float PrePadding_MobileBasePass_PlanarReflection_300;
float4x4 MobileBasePass_PlanarReflection_ProjectionWithExtraFOV[2];
float4 MobileBasePass_PlanarReflection_PlanarReflectionScreenScaleBias[2];
float2 MobileBasePass_PlanarReflection_PlanarReflectionScreenBound;
uint MobileBasePass_PlanarReflection_bIsStereo;
};
struct type_Primitive
{
float4x4 Primitive_LocalToWorld;
float4 Primitive_InvNonUniformScaleAndDeterminantSign;
float4 Primitive_ObjectWorldPositionAndRadius;
float4x4 Primitive_WorldToLocal;
float4x4 Primitive_PreviousLocalToWorld;
float4x4 Primitive_PreviousWorldToLocal;
packed_float3 Primitive_ActorWorldPosition;
float Primitive_UseSingleSampleShadowFromStationaryLights;
packed_float3 Primitive_ObjectBounds;
float Primitive_LpvBiasMultiplier;
float Primitive_DecalReceiverMask;
float Primitive_PerObjectGBufferData;
float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
float Primitive_UseEditorDepthTest;
float4 Primitive_ObjectOrientation;
float4 Primitive_NonUniformScale;
packed_float3 Primitive_LocalObjectBoundsMin;
float PrePadding_Primitive_380;
packed_float3 Primitive_LocalObjectBoundsMax;
uint Primitive_LightingChannelMask;
uint Primitive_LightmapDataIndex;
int Primitive_SingleCaptureIndex;
};
struct type_LandscapeParameters
{
float4 LandscapeParameters_HeightmapUVScaleBias;
float4 LandscapeParameters_WeightmapUVScaleBias;
float4 LandscapeParameters_LandscapeLightmapScaleBias;
float4 LandscapeParameters_SubsectionSizeVertsLayerUVPan;
float4 LandscapeParameters_SubsectionOffsetParams;
float4 LandscapeParameters_LightmapSubsectionOffsetParams;
float4x4 LandscapeParameters_LocalToWorldNoScaling;
};
struct type_Globals
{
float4 LodBias;
float4 LodValues;
float4 SectionLods;
float4 NeighborSectionLod[4];
};
struct main0_out
{
float2 out_var_TEXCOORD0 [[user(locn0)]];
float2 out_var_TEXCOORD1 [[user(locn1)]];
float4 out_var_TEXCOORD2 [[user(locn2)]];
float4 out_var_TEXCOORD3 [[user(locn3)]];
float4 out_var_TEXCOORD8 [[user(locn4)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float4 in_var_ATTRIBUTE0 [[attribute(0)]];
float4 in_var_ATTRIBUTE1_0 [[attribute(1)]];
float4 in_var_ATTRIBUTE1_1 [[attribute(2)]];
};
vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_MobileBasePass& MobileBasePass [[buffer(1)]], constant type_Primitive& Primitive [[buffer(2)]], constant type_LandscapeParameters& LandscapeParameters [[buffer(3)]], constant type_Globals& _Globals [[buffer(4)]])
{
main0_out out = {};
spvUnsafeArray<float4, 2> in_var_ATTRIBUTE1 = {};
in_var_ATTRIBUTE1[0] = in.in_var_ATTRIBUTE1_0;
in_var_ATTRIBUTE1[1] = in.in_var_ATTRIBUTE1_1;
spvUnsafeArray<float4, 1> _97;
for (int _107 = 0; _107 < 1; )
{
_97[_107] = float4(0.0);
_107++;
continue;
}
float4 _115 = in.in_var_ATTRIBUTE0 * float4(255.0);
float2 _116 = _115.zw;
float2 _119 = fract(_116 * float2(0.5)) * float2(2.0);
float2 _121 = (_116 - _119) * float2(0.0039215688593685626983642578125);
float2 _122 = _115.xy;
float2 _126 = _122 * float2(_Globals.LodValues.w);
float _127 = _126.y;
float _128 = _126.x;
float4 _132 = float4(_127, _128, 1.0 - _128, 1.0 - _127) * float4(2.0);
float4 _186;
if (_119.y > 0.5)
{
float4 _161;
if (_119.x > 0.5)
{
_161 = (_132 * float4(_Globals.SectionLods.w)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[3]);
}
else
{
_161 = (_132 * float4(_Globals.SectionLods.z)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[2]);
}
_186 = _161;
}
else
{
float4 _185;
if (_119.x > 0.5)
{
_185 = (_132 * float4(_Globals.SectionLods.y)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[1]);
}
else
{
_185 = (_132 * float4(_Globals.SectionLods.x)) + ((float4(1.0) - _132) * _Globals.NeighborSectionLod[0]);
}
_186 = _185;
}
float _206;
if ((_128 + _127) > 1.0)
{
float _198;
if (_128 < _127)
{
_198 = _186.w;
}
else
{
_198 = _186.z;
}
_206 = _198;
}
else
{
float _205;
if (_128 < _127)
{
_205 = _186.y;
}
else
{
_205 = _186.x;
}
_206 = _205;
}
float _207 = floor(_206);
float _220 = _121.x;
float3 _235 = select(select(select(select(select(float3(0.03125, _121.yy), float3(0.0625, _220, _121.y), bool3(_207 < 5.0)), float3(0.125, in_var_ATTRIBUTE1[1].w, _220), bool3(_207 < 4.0)), float3(0.25, in_var_ATTRIBUTE1[1].zw), bool3(_207 < 3.0)), float3(0.5, in_var_ATTRIBUTE1[1].yz), bool3(_207 < 2.0)), float3(1.0, in_var_ATTRIBUTE1[1].xy), bool3(_207 < 1.0));
float _236 = _235.x;
float _245 = (((in_var_ATTRIBUTE1[0].x * 65280.0) + (in_var_ATTRIBUTE1[0].y * 255.0)) - 32768.0) * 0.0078125;
float _252 = (((in_var_ATTRIBUTE1[0].z * 65280.0) + (in_var_ATTRIBUTE1[0].w * 255.0)) - 32768.0) * 0.0078125;
float2 _257 = floor(_122 * float2(_236));
float2 _271 = float2((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * _236) - 1.0, fast::max((LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.x * 0.5) * _236, 2.0) - 1.0) * float2(LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.y);
float3 _287 = mix(float3(_257 / float2(_271.x), mix(_245, _252, _235.y)), float3(floor(_257 * float2(0.5)) / float2(_271.y), mix(_245, _252, _235.z)), float3(_206 - _207));
float2 _288 = _119.xy;
float2 _292 = _288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.ww;
float3 _296 = _287 + float3(_292, 0.0);
float4 _322 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _296.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _296.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _296.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0);
float2 _323 = _287.xy;
float4 _338 = float4(_322.x, _322.y, _322.z, _322.w);
float4 _339 = View.View_TranslatedWorldToClip * _338;
float3 _341 = _322.xyz - float3(View.View_TranslatedWorldCameraOrigin);
float _345 = dot(_341, _341);
float _346 = rsqrt(_345);
float _347 = _345 * _346;
float _354 = _341.z;
float _357 = fast::max(0.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.w);
float _393;
float _394;
float _395;
float _396;
if (_357 > 0.0)
{
float _361 = _357 * _346;
float _362 = _361 * _354;
float _365 = View.View_WorldCameraOrigin[2] + _362;
_393 = (1.0 - _361) * _347;
_394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.z * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.w)));
_395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.x * exp2(-fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * (_365 - MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.y)));
_396 = _354 - _362;
}
else
{
_393 = _347;
_394 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.x;
_395 = MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.x;
_396 = _354;
}
float _400 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters.y * _396);
float _405 = log(2.0);
float _407 = 0.5 * (_405 * _405);
float _417 = fast::max(-127.0, MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters2.y * _396);
float _428 = (_395 * ((abs(_400) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_400)) / _400) : (_405 - (_407 * _400)))) + (_394 * ((abs(_417) > 0.00999999977648258209228515625) ? ((1.0 - exp2(-_417)) / _417) : (_405 - (_407 * _417))));
float3 _459;
if (MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w >= 0.0)
{
_459 = (MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.xyz * float3(pow(fast::clamp(dot(_341 * float3(_346), MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.xyz), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_DirectionalInscatteringColor.w))) * float3(1.0 - fast::clamp(exp2(-(_428 * fast::max(_393 - MobileBasePass.MobileBasePass_Fog_InscatteringLightDirection.w, 0.0))), 0.0, 1.0));
}
else
{
_459 = float3(0.0);
}
bool _468 = (MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w > 0.0) && (_347 > MobileBasePass.MobileBasePass_Fog_ExponentialFogParameters3.w);
float _471 = _468 ? 1.0 : fast::max(fast::clamp(exp2(-(_428 * _393)), 0.0, 1.0), MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.w);
_97[0] = float4((MobileBasePass.MobileBasePass_Fog_ExponentialFogColorParameter.xyz * float3(1.0 - _471)) + select(_459, float3(0.0), bool3(_468)), _471);
float4 _482 = _338;
_482.w = _339.w;
out.out_var_TEXCOORD0 = ((_323 + LandscapeParameters.LandscapeParameters_SubsectionSizeVertsLayerUVPan.zw) + _292).xy;
out.out_var_TEXCOORD1 = ((_323 * LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.xy) + LandscapeParameters.LandscapeParameters_WeightmapUVScaleBias.zw) + (_288 * LandscapeParameters.LandscapeParameters_SubsectionOffsetParams.zz);
out.out_var_TEXCOORD2 = float4(float4(0.0).x, float4(0.0).y, _97[0].x, _97[0].y);
out.out_var_TEXCOORD3 = float4(float4(0.0).x, float4(0.0).y, _97[0].z, _97[0].w);
out.out_var_TEXCOORD8 = _482;
out.gl_Position = _339;
return out;
}

View File

@ -0,0 +1,122 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct type_Globals
{
float4 ViewportSize;
float ScatteringScaling;
float CocRadiusToCircumscribedRadius;
};
struct type_StructuredBuffer_v4float
{
float4 _m0[1];
};
struct main0_out
{
float2 out_var_TEXCOORD0 [[user(locn0)]];
float4 out_var_TEXCOORD1 [[user(locn1)]];
float4 out_var_TEXCOORD2 [[user(locn2)]];
float4 out_var_TEXCOORD3 [[user(locn3)]];
float4 out_var_TEXCOORD4 [[user(locn4)]];
float4 out_var_TEXCOORD5 [[user(locn5)]];
float4 out_var_TEXCOORD6 [[user(locn6)]];
float4 gl_Position [[position]];
};
vertex main0_out main0(constant type_Globals& _Globals [[buffer(0)]], const device type_StructuredBuffer_v4float& ScatterDrawList [[buffer(1)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
{
main0_out out = {};
uint _66 = gl_VertexIndex / 4u;
uint _68 = gl_VertexIndex - (_66 * 4u);
uint _70 = (16u * gl_InstanceIndex) + _66;
float _72;
_72 = 0.0;
spvUnsafeArray<float4, 4> _61;
spvUnsafeArray<float, 4> _62;
spvUnsafeArray<float2, 4> _63;
float _73;
uint _75 = 0u;
for (;;)
{
if (_75 < 4u)
{
uint _82 = ((5u * _70) + _75) + 1u;
_61[_75] = float4(ScatterDrawList._m0[_82].xyz, 0.0);
_62[_75] = ScatterDrawList._m0[_82].w;
if (_75 == 0u)
{
_73 = _62[_75];
}
else
{
_73 = fast::max(_72, _62[_75]);
}
_63[_75].x = (-0.5) / _62[_75];
_63[_75].y = (0.5 * _62[_75]) + 0.5;
_72 = _73;
_75++;
continue;
}
else
{
break;
}
}
float2 _144 = float2(_Globals.ScatteringScaling) * ScatterDrawList._m0[5u * _70].xy;
float2 _173 = (((float2((_72 * _Globals.CocRadiusToCircumscribedRadius) + 1.0) * ((float2(float(_68 % 2u), float(_68 / 2u)) * float2(2.0)) - float2(1.0))) + _144) + float2(0.5)) * _Globals.ViewportSize.zw;
out.out_var_TEXCOORD0 = _144;
out.out_var_TEXCOORD1 = float4(_61[0].xyz, _62[0]);
out.out_var_TEXCOORD2 = float4(_61[1].xyz, _62[1]);
out.out_var_TEXCOORD3 = float4(_61[2].xyz, _62[2]);
out.out_var_TEXCOORD4 = float4(_61[3].xyz, _62[3]);
out.out_var_TEXCOORD5 = float4(_63[0].x, _63[0].y, _63[1].x, _63[1].y);
out.out_var_TEXCOORD6 = float4(_63[2].x, _63[2].y, _63[3].x, _63[3].y);
out.gl_Position = float4((_173.x * 2.0) - 1.0, 1.0 - (_173.y * 2.0), 0.0, 1.0);
return out;
}

View File

@ -0,0 +1,387 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct type_View
{
float4x4 View_TranslatedWorldToClip;
float4x4 View_WorldToClip;
float4x4 View_TranslatedWorldToView;
float4x4 View_ViewToTranslatedWorld;
float4x4 View_TranslatedWorldToCameraView;
float4x4 View_CameraViewToTranslatedWorld;
float4x4 View_ViewToClip;
float4x4 View_ViewToClipNoAA;
float4x4 View_ClipToView;
float4x4 View_ClipToTranslatedWorld;
float4x4 View_SVPositionToTranslatedWorld;
float4x4 View_ScreenToWorld;
float4x4 View_ScreenToTranslatedWorld;
packed_float3 View_ViewForward;
float PrePadding_View_844;
packed_float3 View_ViewUp;
float PrePadding_View_860;
packed_float3 View_ViewRight;
float PrePadding_View_876;
packed_float3 View_HMDViewNoRollUp;
float PrePadding_View_892;
packed_float3 View_HMDViewNoRollRight;
float PrePadding_View_908;
float4 View_InvDeviceZToWorldZTransform;
float4 View_ScreenPositionScaleBias;
packed_float3 View_WorldCameraOrigin;
float PrePadding_View_956;
packed_float3 View_TranslatedWorldCameraOrigin;
float PrePadding_View_972;
packed_float3 View_WorldViewOrigin;
float PrePadding_View_988;
packed_float3 View_PreViewTranslation;
float PrePadding_View_1004;
float4x4 View_PrevProjection;
float4x4 View_PrevViewProj;
float4x4 View_PrevViewRotationProj;
float4x4 View_PrevViewToClip;
float4x4 View_PrevClipToView;
float4x4 View_PrevTranslatedWorldToClip;
float4x4 View_PrevTranslatedWorldToView;
float4x4 View_PrevViewToTranslatedWorld;
float4x4 View_PrevTranslatedWorldToCameraView;
float4x4 View_PrevCameraViewToTranslatedWorld;
packed_float3 View_PrevWorldCameraOrigin;
float PrePadding_View_1660;
packed_float3 View_PrevWorldViewOrigin;
float PrePadding_View_1676;
packed_float3 View_PrevPreViewTranslation;
float PrePadding_View_1692;
float4x4 View_PrevInvViewProj;
float4x4 View_PrevScreenToTranslatedWorld;
float4x4 View_ClipToPrevClip;
float4 View_TemporalAAJitter;
float4 View_GlobalClippingPlane;
float2 View_FieldOfViewWideAngles;
float2 View_PrevFieldOfViewWideAngles;
float4 View_ViewRectMin;
float4 View_ViewSizeAndInvSize;
float4 View_BufferSizeAndInvSize;
float4 View_BufferBilinearUVMinMax;
int View_NumSceneColorMSAASamples;
float View_PreExposure;
float View_OneOverPreExposure;
float PrePadding_View_2012;
float4 View_DiffuseOverrideParameter;
float4 View_SpecularOverrideParameter;
float4 View_NormalOverrideParameter;
float2 View_RoughnessOverrideParameter;
float View_PrevFrameGameTime;
float View_PrevFrameRealTime;
float View_OutOfBoundsMask;
float PrePadding_View_2084;
float PrePadding_View_2088;
float PrePadding_View_2092;
packed_float3 View_WorldCameraMovementSinceLastFrame;
float View_CullingSign;
float View_NearPlane;
float View_AdaptiveTessellationFactor;
float View_GameTime;
float View_RealTime;
float View_DeltaTime;
float View_MaterialTextureMipBias;
float View_MaterialTextureDerivativeMultiply;
uint View_Random;
uint View_FrameNumber;
uint View_StateFrameIndexMod8;
uint View_StateFrameIndex;
float View_CameraCut;
float View_UnlitViewmodeMask;
float PrePadding_View_2164;
float PrePadding_View_2168;
float PrePadding_View_2172;
float4 View_DirectionalLightColor;
packed_float3 View_DirectionalLightDirection;
float PrePadding_View_2204;
float4 View_TranslucencyLightingVolumeMin[2];
float4 View_TranslucencyLightingVolumeInvSize[2];
float4 View_TemporalAAParams;
float4 View_CircleDOFParams;
float View_DepthOfFieldSensorWidth;
float View_DepthOfFieldFocalDistance;
float View_DepthOfFieldScale;
float View_DepthOfFieldFocalLength;
float View_DepthOfFieldFocalRegion;
float View_DepthOfFieldNearTransitionRegion;
float View_DepthOfFieldFarTransitionRegion;
float View_MotionBlurNormalizedToPixel;
float View_bSubsurfacePostprocessEnabled;
float View_GeneralPurposeTweak;
float View_DemosaicVposOffset;
float PrePadding_View_2348;
packed_float3 View_IndirectLightingColorScale;
float View_HDR32bppEncodingMode;
packed_float3 View_AtmosphericFogSunDirection;
float View_AtmosphericFogSunPower;
float View_AtmosphericFogPower;
float View_AtmosphericFogDensityScale;
float View_AtmosphericFogDensityOffset;
float View_AtmosphericFogGroundOffset;
float View_AtmosphericFogDistanceScale;
float View_AtmosphericFogAltitudeScale;
float View_AtmosphericFogHeightScaleRayleigh;
float View_AtmosphericFogStartDistance;
float View_AtmosphericFogDistanceOffset;
float View_AtmosphericFogSunDiscScale;
uint View_AtmosphericFogRenderMask;
uint View_AtmosphericFogInscatterAltitudeSampleNum;
float4 View_AtmosphericFogSunColor;
packed_float3 View_NormalCurvatureToRoughnessScaleBias;
float View_RenderingReflectionCaptureMask;
float4 View_AmbientCubemapTint;
float View_AmbientCubemapIntensity;
float View_SkyLightParameters;
float PrePadding_View_2488;
float PrePadding_View_2492;
float4 View_SkyLightColor;
float4 View_SkyIrradianceEnvironmentMap[7];
float View_MobilePreviewMode;
float View_HMDEyePaddingOffset;
float View_ReflectionCubemapMaxMip;
float View_ShowDecalsMask;
uint View_DistanceFieldAOSpecularOcclusionMode;
float View_IndirectCapsuleSelfShadowingIntensity;
float PrePadding_View_2648;
float PrePadding_View_2652;
packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight;
int View_StereoPassIndex;
float4 View_GlobalVolumeCenterAndExtent[4];
float4 View_GlobalVolumeWorldToUVAddAndMul[4];
float View_GlobalVolumeDimension;
float View_GlobalVolumeTexelSize;
float View_MaxGlobalDistance;
float View_bCheckerboardSubsurfaceProfileRendering;
packed_float3 View_VolumetricFogInvGridSize;
float PrePadding_View_2828;
packed_float3 View_VolumetricFogGridZParams;
float PrePadding_View_2844;
float2 View_VolumetricFogSVPosToVolumeUV;
float View_VolumetricFogMaxDistance;
float PrePadding_View_2860;
packed_float3 View_VolumetricLightmapWorldToUVScale;
float PrePadding_View_2876;
packed_float3 View_VolumetricLightmapWorldToUVAdd;
float PrePadding_View_2892;
packed_float3 View_VolumetricLightmapIndirectionTextureSize;
float View_VolumetricLightmapBrickSize;
packed_float3 View_VolumetricLightmapBrickTexelSize;
float View_StereoIPD;
float View_IndirectLightingCacheShowFlag;
float View_EyeToPixelSpreadAngle;
};
struct type_Primitive
{
float4x4 Primitive_LocalToWorld;
float4 Primitive_InvNonUniformScaleAndDeterminantSign;
float4 Primitive_ObjectWorldPositionAndRadius;
float4x4 Primitive_WorldToLocal;
float4x4 Primitive_PreviousLocalToWorld;
float4x4 Primitive_PreviousWorldToLocal;
packed_float3 Primitive_ActorWorldPosition;
float Primitive_UseSingleSampleShadowFromStationaryLights;
packed_float3 Primitive_ObjectBounds;
float Primitive_LpvBiasMultiplier;
float Primitive_DecalReceiverMask;
float Primitive_PerObjectGBufferData;
float Primitive_UseVolumetricLightmapShadowFromStationaryLights;
float Primitive_UseEditorDepthTest;
float4 Primitive_ObjectOrientation;
float4 Primitive_NonUniformScale;
packed_float3 Primitive_LocalObjectBoundsMin;
float PrePadding_Primitive_380;
packed_float3 Primitive_LocalObjectBoundsMax;
uint Primitive_LightingChannelMask;
uint Primitive_LightmapDataIndex;
int Primitive_SingleCaptureIndex;
};
struct type_MobileShadowDepthPass
{
float PrePadding_MobileShadowDepthPass_0;
float PrePadding_MobileShadowDepthPass_4;
float PrePadding_MobileShadowDepthPass_8;
float PrePadding_MobileShadowDepthPass_12;
float PrePadding_MobileShadowDepthPass_16;
float PrePadding_MobileShadowDepthPass_20;
float PrePadding_MobileShadowDepthPass_24;
float PrePadding_MobileShadowDepthPass_28;
float PrePadding_MobileShadowDepthPass_32;
float PrePadding_MobileShadowDepthPass_36;
float PrePadding_MobileShadowDepthPass_40;
float PrePadding_MobileShadowDepthPass_44;
float PrePadding_MobileShadowDepthPass_48;
float PrePadding_MobileShadowDepthPass_52;
float PrePadding_MobileShadowDepthPass_56;
float PrePadding_MobileShadowDepthPass_60;
float PrePadding_MobileShadowDepthPass_64;
float PrePadding_MobileShadowDepthPass_68;
float PrePadding_MobileShadowDepthPass_72;
float PrePadding_MobileShadowDepthPass_76;
float4x4 MobileShadowDepthPass_ProjectionMatrix;
float2 MobileShadowDepthPass_ShadowParams;
float MobileShadowDepthPass_bClampToNearPlane;
float PrePadding_MobileShadowDepthPass_156;
float4x4 MobileShadowDepthPass_ShadowViewProjectionMatrices[6];
};
struct type_EmitterDynamicUniforms
{
float2 EmitterDynamicUniforms_LocalToWorldScale;
float EmitterDynamicUniforms_EmitterInstRandom;
float PrePadding_EmitterDynamicUniforms_12;
float4 EmitterDynamicUniforms_AxisLockRight;
float4 EmitterDynamicUniforms_AxisLockUp;
float4 EmitterDynamicUniforms_DynamicColor;
float4 EmitterDynamicUniforms_MacroUVParameters;
};
struct type_EmitterUniforms
{
float4 EmitterUniforms_ColorCurve;
float4 EmitterUniforms_ColorScale;
float4 EmitterUniforms_ColorBias;
float4 EmitterUniforms_MiscCurve;
float4 EmitterUniforms_MiscScale;
float4 EmitterUniforms_MiscBias;
float4 EmitterUniforms_SizeBySpeed;
float4 EmitterUniforms_SubImageSize;
float4 EmitterUniforms_TangentSelector;
packed_float3 EmitterUniforms_CameraFacingBlend;
float EmitterUniforms_RemoveHMDRoll;
float EmitterUniforms_RotationRateScale;
float EmitterUniforms_RotationBias;
float EmitterUniforms_CameraMotionBlurAmount;
float PrePadding_EmitterUniforms_172;
float2 EmitterUniforms_PivotOffset;
};
struct type_Globals
{
uint ParticleIndicesOffset;
};
struct main0_out
{
float out_var_TEXCOORD6 [[user(locn0)]];
float4 gl_Position [[position]];
};
struct main0_in
{
float2 in_var_ATTRIBUTE0 [[attribute(0)]];
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}
vertex main0_out main0(main0_in in [[stage_in]], constant type_View& View [[buffer(0)]], constant type_Primitive& Primitive [[buffer(1)]], constant type_MobileShadowDepthPass& MobileShadowDepthPass [[buffer(2)]], constant type_EmitterDynamicUniforms& EmitterDynamicUniforms [[buffer(3)]], constant type_EmitterUniforms& EmitterUniforms [[buffer(4)]], constant type_Globals& _Globals [[buffer(5)]], texture2d<float> ParticleIndices [[texture(0)]], texture2d<float> PositionTexture [[texture(1)]], texture2d<float> VelocityTexture [[texture(2)]], texture2d<float> AttributesTexture [[texture(3)]], texture2d<float> CurveTexture [[texture(4)]], sampler PositionTextureSampler [[sampler(0)]], sampler VelocityTextureSampler [[sampler(1)]], sampler AttributesTextureSampler [[sampler(2)]], sampler CurveTextureSampler [[sampler(3)]], uint gl_VertexIndex [[vertex_id]], uint gl_InstanceIndex [[instance_id]])
{
main0_out out = {};
float2 _133 = ParticleIndices.read(spvTexelBufferCoord((_Globals.ParticleIndicesOffset + ((gl_InstanceIndex * 16u) + (gl_VertexIndex / 4u))))).xy;
float4 _137 = PositionTexture.sample(PositionTextureSampler, _133, level(0.0));
float4 _145 = AttributesTexture.sample(AttributesTextureSampler, _133, level(0.0));
float _146 = _137.w;
float3 _158 = float3x3(Primitive.Primitive_LocalToWorld[0].xyz, Primitive.Primitive_LocalToWorld[1].xyz, Primitive.Primitive_LocalToWorld[2].xyz) * VelocityTexture.sample(VelocityTextureSampler, _133, level(0.0)).xyz;
float3 _160 = normalize(_158 + float3(0.0, 0.0, 9.9999997473787516355514526367188e-05));
float2 _204 = ((((_145.xy + float2((_145.x < 0.5) ? 0.0 : (-0.5), (_145.y < 0.5) ? 0.0 : (-0.5))) * float2(2.0)) * (((CurveTexture.sample(CurveTextureSampler, (EmitterUniforms.EmitterUniforms_MiscCurve.xy + (EmitterUniforms.EmitterUniforms_MiscCurve.zw * float2(_146))), level(0.0)) * EmitterUniforms.EmitterUniforms_MiscScale) + EmitterUniforms.EmitterUniforms_MiscBias).xy * EmitterDynamicUniforms.EmitterDynamicUniforms_LocalToWorldScale)) * fast::min(fast::max(EmitterUniforms.EmitterUniforms_SizeBySpeed.xy * float2(length(_158)), float2(1.0)), EmitterUniforms.EmitterUniforms_SizeBySpeed.zw)) * float2(step(_146, 1.0));
float3 _239 = float4((((Primitive.Primitive_LocalToWorld[0u].xyz * _137.xxx) + (Primitive.Primitive_LocalToWorld[1u].xyz * _137.yyy)) + (Primitive.Primitive_LocalToWorld[2u].xyz * _137.zzz)) + (Primitive.Primitive_LocalToWorld[3u].xyz + float3(View.View_PreViewTranslation)), 1.0).xyz;
float3 _242 = float3(EmitterUniforms.EmitterUniforms_RemoveHMDRoll);
float3 _251 = mix(mix(float3(View.View_ViewRight), float3(View.View_HMDViewNoRollRight), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.w));
float3 _259 = mix(-mix(float3(View.View_ViewUp), float3(View.View_HMDViewNoRollUp), _242), EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.xyz, float3(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockUp.w));
float3 _260 = float3(View.View_TranslatedWorldCameraOrigin) - _239;
float _261 = dot(_260, _260);
float3 _265 = _260 / float3(sqrt(fast::max(_261, 0.00999999977648258209228515625)));
float3 _335;
float3 _336;
if (EmitterUniforms.EmitterUniforms_CameraFacingBlend[0] > 0.0)
{
float3 _279 = cross(_265, float3(0.0, 0.0, 1.0));
float3 _284 = _279 / float3(sqrt(fast::max(dot(_279, _279), 0.00999999977648258209228515625)));
float3 _286 = float3(fast::clamp((_261 * EmitterUniforms.EmitterUniforms_CameraFacingBlend[1]) - EmitterUniforms.EmitterUniforms_CameraFacingBlend[2], 0.0, 1.0));
_335 = normalize(mix(_251, _284, _286));
_336 = normalize(mix(_259, cross(_265, _284), _286));
}
else
{
float3 _333;
float3 _334;
if (EmitterUniforms.EmitterUniforms_TangentSelector.y > 0.0)
{
float3 _297 = cross(_265, _160);
_333 = _297 / float3(sqrt(fast::max(dot(_297, _297), 0.00999999977648258209228515625)));
_334 = -_160;
}
else
{
float3 _331;
float3 _332;
if (EmitterUniforms.EmitterUniforms_TangentSelector.z > 0.0)
{
float3 _310 = cross(EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz, _265);
_331 = EmitterDynamicUniforms.EmitterDynamicUniforms_AxisLockRight.xyz;
_332 = -(_310 / float3(sqrt(fast::max(dot(_310, _310), 0.00999999977648258209228515625))));
}
else
{
float3 _329;
float3 _330;
if (EmitterUniforms.EmitterUniforms_TangentSelector.w > 0.0)
{
float3 _322 = cross(_265, float3(0.0, 0.0, 1.0));
float3 _327 = _322 / float3(sqrt(fast::max(dot(_322, _322), 0.00999999977648258209228515625)));
_329 = _327;
_330 = cross(_265, _327);
}
else
{
_329 = _251;
_330 = _259;
}
_331 = _329;
_332 = _330;
}
_333 = _331;
_334 = _332;
}
_335 = _333;
_336 = _334;
}
float _339 = ((_145.z + ((_145.w * EmitterUniforms.EmitterUniforms_RotationRateScale) * _146)) * 6.283185482025146484375) + EmitterUniforms.EmitterUniforms_RotationBias;
float3 _342 = float3(sin(_339));
float3 _344 = float3(cos(_339));
float4 _371 = float4(_239 + ((float3(_204.x * (in.in_var_ATTRIBUTE0.x + EmitterUniforms.EmitterUniforms_PivotOffset.x)) * ((_342 * _336) + (_344 * _335))) + (float3(_204.y * (in.in_var_ATTRIBUTE0.y + EmitterUniforms.EmitterUniforms_PivotOffset.y)) * ((_344 * _336) - (_342 * _335)))), 1.0);
float4 _375 = MobileShadowDepthPass.MobileShadowDepthPass_ProjectionMatrix * float4(_371.x, _371.y, _371.z, _371.w);
float4 _386;
if ((MobileShadowDepthPass.MobileShadowDepthPass_bClampToNearPlane > 0.0) && (_375.z < 0.0))
{
float4 _384 = _375;
_384.z = 9.9999999747524270787835121154785e-07;
float4 _385 = _384;
_385.w = 1.0;
_386 = _385;
}
else
{
_386 = _375;
}
float4 _396 = _386;
_396.z = ((_386.z * MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.y) + MobileShadowDepthPass.MobileShadowDepthPass_ShadowParams.x) * _386.w;
out.out_var_TEXCOORD6 = 0.0;
out.gl_Position = _396;
return out;
}

View File

@ -5,9 +5,9 @@ layout(binding = 1, rgba32f) uniform writeonly image2D outImageTexture;
void main()
{
int _27_copy;
int _30;
_30 = 7;
int _27_copy;
for (int _27 = 7; _27 >= 0; _27_copy = _27, _27--, _30 = _27_copy)
{
if (5.0 > float(_27))

View File

@ -0,0 +1,37 @@
struct EmptyStructTest
{
int empty_struct_member;
};
struct EmptyStruct2Test
{
EmptyStructTest _m0;
};
static const EmptyStructTest _30 = { 0 };
static const EmptyStruct2Test _20 = { { 0 } };
float GetValue(EmptyStruct2Test self)
{
return 0.0f;
}
float GetValue_1(EmptyStruct2Test self)
{
return 0.0f;
}
void frag_main()
{
EmptyStructTest _25 = { 0 };
EmptyStruct2Test _26 = { _25 };
EmptyStruct2Test emptyStruct;
float value = GetValue(emptyStruct);
value = GetValue_1(_26);
value = GetValue_1(_20);
}
void main()
{
frag_main();
}

View File

@ -15,7 +15,8 @@ struct SSBORead
float b;
};
inline void copy_out(device float& A, device const float& B)
static inline __attribute__((always_inline))
void copy_out(device float& A, device const float& B)
{
A = B;
}

View File

@ -22,17 +22,20 @@ struct baz
int e[128];
};
inline device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb)
static inline __attribute__((always_inline))
device int* select_buffer(device foo& buf, device baz& buf2, constant bar& cb)
{
return (cb.d != 0) ? &buf.a[0u] : &buf2.e[0u];
}
inline device int* select_buffer_null(device foo& buf, constant bar& cb)
static inline __attribute__((always_inline))
device int* select_buffer_null(device foo& buf, constant bar& cb)
{
return (cb.d != 0) ? &buf.a[0u] : nullptr;
}
inline threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128])
static inline __attribute__((always_inline))
threadgroup int* select_tgsm(constant bar& cb, threadgroup int (&tgsm)[128])
{
return (cb.d != 0) ? &tgsm[0u] : nullptr;
}

View File

@ -0,0 +1,35 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct EmptyStructTest
{
};
struct EmptyStruct2Test
{
EmptyStructTest _m0;
};
static inline __attribute__((always_inline))
float GetValue(thread const EmptyStruct2Test& self)
{
return 0.0;
}
static inline __attribute__((always_inline))
float GetValue_1(EmptyStruct2Test self)
{
return 0.0;
}
fragment void main0()
{
EmptyStruct2Test emptyStruct;
float value = GetValue(emptyStruct);
value = GetValue_1(EmptyStruct2Test{ EmptyStructTest{ } });
value = GetValue_1(EmptyStruct2Test{ { } });
}

View File

@ -1,235 +0,0 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct VertexOutput
{
float4 HPosition;
float4 Uv_EdgeDistance1;
float4 UvStuds_EdgeDistance2;
float4 Color;
float4 LightPosition_Fog;
float4 View_Depth;
float4 Normal_SpecPower;
float3 Tangent;
float4 PosLightSpace_Reflectance;
float studIndex;
};
struct Surface
{
float3 albedo;
float3 normal;
float specular;
float gloss;
float reflectance;
float opacity;
};
struct SurfaceInput
{
float4 Color;
float2 Uv;
float2 UvStuds;
};
struct Globals
{
float4x4 ViewProjection;
float4 ViewRight;
float4 ViewUp;
float4 ViewDir;
float3 CameraPosition;
float3 AmbientColor;
float3 Lamp0Color;
float3 Lamp0Dir;
float3 Lamp1Color;
float4 FogParams;
float3 FogColor;
float4 LightBorder;
float4 LightConfig0;
float4 LightConfig1;
float4 LightConfig2;
float4 LightConfig3;
float4 RefractionBias_FadeDistance_GlowFactor;
float4 OutlineBrightness_ShadowInfo;
float4 ShadowMatrix0;
float4 ShadowMatrix1;
float4 ShadowMatrix2;
};
struct CB0
{
Globals CB0;
};
struct Params
{
float4 LqmatFarTilingFactor;
};
struct CB2
{
Params CB2;
};
constant VertexOutput _121 = {};
constant SurfaceInput _122 = {};
constant float2 _123 = {};
constant float4 _124 = {};
constant Surface _125 = {};
constant float4 _192 = {};
constant float4 _219 = {};
constant float4 _297 = {};
struct main0_out
{
float4 _entryPointOutput [[color(0)]];
};
struct main0_in
{
float4 IN_Uv_EdgeDistance1 [[user(locn0)]];
float4 IN_UvStuds_EdgeDistance2 [[user(locn1)]];
float4 IN_Color [[user(locn2)]];
float4 IN_LightPosition_Fog [[user(locn3)]];
float4 IN_View_Depth [[user(locn4)]];
float4 IN_Normal_SpecPower [[user(locn5)]];
float3 IN_Tangent [[user(locn6)]];
float4 IN_PosLightSpace_Reflectance [[user(locn7)]];
float IN_studIndex [[user(locn8)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant CB0& _19 [[buffer(0)]], texture3d<float> LightMapTexture [[texture(0)]], texture2d<float> ShadowMapTexture [[texture(1)]], texturecube<float> EnvironmentMapTexture [[texture(2)]], texture2d<float> DiffuseMapTexture [[texture(3)]], texture2d<float> NormalMapTexture [[texture(4)]], texture2d<float> NormalDetailMapTexture [[texture(5)]], texture2d<float> StudsMapTexture [[texture(6)]], texture2d<float> SpecularMapTexture [[texture(7)]], sampler LightMapSampler [[sampler(0)]], sampler ShadowMapSampler [[sampler(1)]], sampler EnvironmentMapSampler [[sampler(2)]], sampler DiffuseMapSampler [[sampler(3)]], sampler NormalMapSampler [[sampler(4)]], sampler NormalDetailMapSampler [[sampler(5)]], sampler StudsMapSampler [[sampler(6)]], sampler SpecularMapSampler [[sampler(7)]], float4 gl_FragCoord [[position]])
{
main0_out out = {};
VertexOutput _128 = _121;
_128.HPosition = gl_FragCoord;
VertexOutput _130 = _128;
_130.Uv_EdgeDistance1 = in.IN_Uv_EdgeDistance1;
VertexOutput _132 = _130;
_132.UvStuds_EdgeDistance2 = in.IN_UvStuds_EdgeDistance2;
VertexOutput _134 = _132;
_134.Color = in.IN_Color;
VertexOutput _136 = _134;
_136.LightPosition_Fog = in.IN_LightPosition_Fog;
VertexOutput _138 = _136;
_138.View_Depth = in.IN_View_Depth;
VertexOutput _140 = _138;
_140.Normal_SpecPower = in.IN_Normal_SpecPower;
VertexOutput _142 = _140;
_142.Tangent = in.IN_Tangent;
VertexOutput _144 = _142;
_144.PosLightSpace_Reflectance = in.IN_PosLightSpace_Reflectance;
VertexOutput _146 = _144;
_146.studIndex = in.IN_studIndex;
SurfaceInput _147 = _122;
_147.Color = in.IN_Color;
SurfaceInput _149 = _147;
_149.Uv = in.IN_Uv_EdgeDistance1.xy;
SurfaceInput _151 = _149;
_151.UvStuds = in.IN_UvStuds_EdgeDistance2.xy;
SurfaceInput _156 = _151;
_156.UvStuds.y = (fract(_151.UvStuds.y) + in.IN_studIndex) * 0.25;
float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y;
float _165 = fast::clamp(1.0 - _163, 0.0, 1.0);
float2 _166 = in.IN_Uv_EdgeDistance1.xy * 1.0;
bool _173;
float4 _193;
for (;;)
{
_173 = 0.0 == 0.0;
if (_173)
{
_193 = DiffuseMapTexture.sample(DiffuseMapSampler, _166);
break;
}
else
{
float _180 = 1.0 / (1.0 - 0.0);
_193 = mix(DiffuseMapTexture.sample(DiffuseMapSampler, (_166 * 0.25)), DiffuseMapTexture.sample(DiffuseMapSampler, _166), float4(fast::clamp((fast::clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
break;
}
_193 = _192;
break;
}
float4 _220;
for (;;)
{
if (_173)
{
_220 = NormalMapTexture.sample(NormalMapSampler, _166);
break;
}
else
{
float _207 = 1.0 / (1.0 - 0.0);
_220 = mix(NormalMapTexture.sample(NormalMapSampler, (_166 * 0.25)), NormalMapTexture.sample(NormalMapSampler, _166), float4(fast::clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
break;
}
_220 = _219;
break;
}
float2 _223 = float2(1.0);
float2 _224 = (_220.wy * 2.0) - _223;
float3 _232 = float3(_224, sqrt(fast::clamp(1.0 + dot(-_224, _224), 0.0, 1.0)));
float2 _240 = (NormalDetailMapTexture.sample(NormalDetailMapSampler, (_166 * 0.0)).wy * 2.0) - _223;
float2 _252 = _232.xy + (float3(_240, sqrt(fast::clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0);
float3 _253 = float3(_252.x, _252.y, _232.z);
float2 _255 = _253.xy * _165;
float3 _256 = float3(_255.x, _255.y, _253.z);
float3 _271 = ((in.IN_Color.xyz * (_193 * 1.0).xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (StudsMapTexture.sample(StudsMapSampler, _156.UvStuds).x * 2.0);
float4 _298;
for (;;)
{
if (0.75 == 0.0)
{
_298 = SpecularMapTexture.sample(SpecularMapSampler, _166);
break;
}
else
{
float _285 = 1.0 / (1.0 - 0.75);
_298 = mix(SpecularMapTexture.sample(SpecularMapSampler, (_166 * 0.25)), SpecularMapTexture.sample(SpecularMapSampler, _166), float4(fast::clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
break;
}
_298 = _297;
break;
}
float2 _303 = mix(float2(0.800000011920928955078125, 120.0), (_298.xy * float2(2.0, 256.0)) + float2(0.0, 0.00999999977648258209228515625), float2(_165));
Surface _304 = _125;
_304.albedo = _271;
Surface _305 = _304;
_305.normal = _256;
float _306 = _303.x;
Surface _307 = _305;
_307.specular = _306;
float _308 = _303.y;
Surface _309 = _307;
_309.gloss = _308;
float _312 = (_298.xy.y * _165) * 0.0;
Surface _313 = _309;
_313.reflectance = _312;
float4 _318 = float4(_271, _146.Color.w);
float3 _329 = normalize(((in.IN_Tangent * _313.normal.x) + (cross(in.IN_Normal_SpecPower.xyz, in.IN_Tangent) * _313.normal.y)) + (in.IN_Normal_SpecPower.xyz * _313.normal.z));
float3 _332 = -_19.CB0.Lamp0Dir;
float _333 = dot(_329, _332);
float _357 = fast::clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(in.IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), float3(1.0)), 0.0, 1.0);
float4 _368 = mix(LightMapTexture.sample(LightMapSampler, (in.IN_LightPosition_Fog.xyz.yzx - (in.IN_LightPosition_Fog.xyz.yzx * _357))), _19.CB0.LightBorder, float4(_357));
float2 _376 = ShadowMapTexture.sample(ShadowMapSampler, in.IN_PosLightSpace_Reflectance.xyz.xy).xy;
float _392 = (1.0 - (((step(_376.x, in.IN_PosLightSpace_Reflectance.xyz.z) * fast::clamp(9.0 - (20.0 * abs(in.IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w;
float3 _403 = mix(_318.xyz, EnvironmentMapTexture.sample(EnvironmentMapSampler, reflect(-in.IN_View_Depth.xyz, _329)).xyz, float3(_312));
float4 _404 = float4(_403.x, _403.y, _403.z, _318.w);
float3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * fast::clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * fast::max(-_333, 0.0))) * _392)) + _368.xyz) * _404.xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(fast::clamp(dot(_329, normalize(_332 + normalize(in.IN_View_Depth.xyz))), 0.0, 1.0), _308)));
float4 _425 = float4(_422.x, _422.y, _422.z, _124.w);
_425.w = _404.w;
float2 _435 = fast::min(in.IN_Uv_EdgeDistance1.wz, in.IN_UvStuds_EdgeDistance2.wz);
float _439 = fast::min(_435.x, _435.y) / _163;
float3 _445 = _425.xyz * fast::clamp((fast::clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0);
float4 _446 = float4(_445.x, _445.y, _445.z, _425.w);
float3 _453 = mix(_19.CB0.FogColor, _446.xyz, float3(fast::clamp(_146.LightPosition_Fog.w, 0.0, 1.0)));
out._entryPointOutput = float4(_453.x, _453.y, _453.z, _446.w);
return out;
}

View File

@ -15,13 +15,15 @@ struct SSBO0
uint values0[1];
};
inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
static inline __attribute__((always_inline))
void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
{
int _31 = int(gl_FragCoord.x);
v_7.values1[_31]++;
}
inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
static inline __attribute__((always_inline))
void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
{
int _39 = int(gl_FragCoord.x);
v_9.values0[_39]++;

View File

@ -20,13 +20,15 @@ struct SSBO0
uint values0[1];
};
inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
static inline __attribute__((always_inline))
void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
{
int _44 = int(gl_FragCoord.x);
v_7.values1[_44]++;
}
inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
static inline __attribute__((always_inline))
void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
{
int _52 = int(gl_FragCoord.x);
v_9.values0[_52]++;
@ -36,7 +38,8 @@ inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0&
}
}
inline void _35(thread float4& gl_FragCoord, device _12& v_13)
static inline __attribute__((always_inline))
void _35(thread float4& gl_FragCoord, device _12& v_13)
{
v_13._m0[int(gl_FragCoord.x)] = 4u;
}

View File

@ -15,24 +15,28 @@ struct SSBO0
uint values0[1];
};
inline void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
static inline __attribute__((always_inline))
void callee2(thread float4& gl_FragCoord, device SSBO1& v_7)
{
int _37 = int(gl_FragCoord.x);
v_7.values1[_37]++;
}
inline void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
static inline __attribute__((always_inline))
void callee(thread float4& gl_FragCoord, device SSBO1& v_7, device SSBO0& v_9)
{
int _45 = int(gl_FragCoord.x);
v_9.values0[_45]++;
callee2(gl_FragCoord, v_7);
}
inline void _29()
static inline __attribute__((always_inline))
void _29()
{
}
inline void _31()
static inline __attribute__((always_inline))
void _31()
{
}

View File

@ -6,7 +6,8 @@
using namespace metal;
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -5,12 +5,9 @@ using namespace metal;
struct Test
{
int empty_struct_member;
};
vertex void main0()
{
Test _14 = Test{ 0 };
Test t = _14;
Test t = Test{ };
}

View File

@ -1,8 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant float _21 = {};
struct main0_out
@ -13,7 +54,7 @@ struct main0_out
vertex main0_out main0()
{
main0_out out = {};
float _23[2];
spvUnsafeArray<float, 2> _23;
for (int _25 = 0; _25 < 2; )
{
_23[_25] = 0.0;

View File

@ -1,10 +1,49 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 1u, 1u);
template<typename T, uint A>
@ -65,15 +104,15 @@ kernel void main0(uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
{
threadgroup float shared_group[8][8];
threadgroup float shared_group_alt[8][8];
float blob[8];
spvUnsafeArray<float, 8> blob;
for (int i = 0; i < 8; i++)
{
blob[i] = float(i);
}
spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob);
spvArrayCopyFromStackToThreadGroup1(shared_group[gl_LocalInvocationIndex], blob.elements);
threadgroup_barrier(mem_flags::mem_threadgroup);
float copied_blob[8];
spvArrayCopyFromThreadGroupToStack1(copied_blob, shared_group[gl_LocalInvocationIndex ^ 1u]);
spvUnsafeArray<float, 8> copied_blob;
spvArrayCopyFromThreadGroupToStack1(copied_blob.elements, shared_group[gl_LocalInvocationIndex ^ 1u]);
spvArrayCopyFromThreadGroupToThreadGroup1(shared_group_alt[gl_LocalInvocationIndex], shared_group[gl_LocalInvocationIndex]);
}

View File

@ -70,20 +70,23 @@ inline T sign(T x)
}
// Returns the determinant of a 2x2 matrix.
inline float spvDet2x2(float a1, float a2, float b1, float b2)
static inline __attribute__((always_inline))
float spvDet2x2(float a1, float a2, float b1, float b2)
{
return a1 * b2 - b1 * a2;
}
// Returns the determinant of a 3x3 matrix.
inline float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
static inline __attribute__((always_inline))
float spvDet3x3(float a1, float a2, float a3, float b1, float b2, float b3, float c1, float c2, float c3)
{
return a1 * spvDet2x2(b2, b3, c2, c3) - b1 * spvDet2x2(a2, a3, c2, c3) + c1 * spvDet2x2(a2, a3, b2, b3);
}
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float4x4 spvInverse4x4(float4x4 m)
static inline __attribute__((always_inline))
float4x4 spvInverse4x4(float4x4 m)
{
float4x4 adj; // The adjoint matrix (inverse after dividing by determinant)
@ -118,7 +121,8 @@ inline float4x4 spvInverse4x4(float4x4 m)
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float3x3 spvInverse3x3(float3x3 m)
static inline __attribute__((always_inline))
float3x3 spvInverse3x3(float3x3 m)
{
float3x3 adj; // The adjoint matrix (inverse after dividing by determinant)
@ -145,7 +149,8 @@ inline float3x3 spvInverse3x3(float3x3 m)
// Returns the inverse of a matrix, by using the algorithm of calculating the classical
// adjoint and dividing by the determinant. The contents of the matrix are changed.
inline float2x2 spvInverse2x2(float2x2 m)
static inline __attribute__((always_inline))
float2x2 spvInverse2x2(float2x2 m)
{
float2x2 adj; // The adjoint matrix (inverse after dividing by determinant)

View File

@ -15,13 +15,15 @@ struct SSBO0
uint values0[1];
};
inline void callee2(device SSBO1& v_14, thread float4& gl_FragCoord)
static inline __attribute__((always_inline))
void callee2(device SSBO1& v_14, thread float4& gl_FragCoord)
{
int _25 = int(gl_FragCoord.x);
v_14.values1[_25]++;
}
inline void callee(device SSBO1& v_14, thread float4& gl_FragCoord, device SSBO0& v_35)
static inline __attribute__((always_inline))
void callee(device SSBO1& v_14, thread float4& gl_FragCoord, device SSBO0& v_35)
{
int _38 = int(gl_FragCoord.x);
v_35.values0[_38]++;

View File

@ -6,7 +6,8 @@
using namespace metal;
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -6,7 +6,8 @@
using namespace metal;
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}
@ -131,7 +132,8 @@ inline vec<T, 4> spvGatherCompareSwizzle(const thread Tex<T>& t, sampler s, uint
return t.gather_compare(s, spvForward<Ts>(params)...);
}
inline float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d<float> tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d<float> tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube<float> texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array<float> tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array<float> texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d<float> depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube<float> depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array<float> depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array<float> depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d<float> texBuffer)
static inline __attribute__((always_inline))
float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr, constant uint& tex1dSwzl, thread texture2d<float> tex2d, thread const sampler tex2dSmplr, constant uint& tex2dSwzl, thread texture3d<float> tex3d, thread const sampler tex3dSmplr, constant uint& tex3dSwzl, thread texturecube<float> texCube, thread const sampler texCubeSmplr, constant uint& texCubeSwzl, thread texture2d_array<float> tex2dArray, thread const sampler tex2dArraySmplr, constant uint& tex2dArraySwzl, thread texturecube_array<float> texCubeArray, thread const sampler texCubeArraySmplr, constant uint& texCubeArraySwzl, thread depth2d<float> depth2d, thread const sampler depth2dSmplr, constant uint& depth2dSwzl, thread depthcube<float> depthCube, thread const sampler depthCubeSmplr, constant uint& depthCubeSwzl, thread depth2d_array<float> depth2dArray, thread const sampler depth2dArraySmplr, constant uint& depth2dArraySwzl, thread depthcube_array<float> depthCubeArray, thread const sampler depthCubeArraySmplr, constant uint& depthCubeArraySwzl, thread texture2d<float> texBuffer)
{
float4 c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl);
c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0)), tex2dSwzl);

View File

@ -6,7 +6,8 @@
using namespace metal;
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -6,7 +6,8 @@
using namespace metal;
// Returns 2D texture coords corresponding to 1D texel buffer coords
inline uint2 spvTexelBufferCoord(uint tc)
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO
{
packed_float3 v[16];
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
kernel void main0(device SSBO& _13 [[buffer(0)]])
{
_13.v[1] = float3(_13.v[0]);
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO
{
float4 v[16];
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
kernel void main0(device SSBO& _13 [[buffer(0)]])
{
_13.v[1] = _13.v[0];
}

View File

@ -19,46 +19,54 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x2 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x2 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(v_29.col_major0);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(v_41.row_major0);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
v_41.row_major0[1][1] = v_29.col_major0[1].y;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,52 +19,60 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x2 loaded = float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy);
v_29.col_major1[0].xy = loaded[0];
v_29.col_major1[1].xy = loaded[1];
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x2 loaded = transpose(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy));
v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]);
v_41.row_major0[1].xy = float2(loaded[0][1], loaded[1][1]);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0[0].xy = float2x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy)[0];
v_29.col_major0[1].xy = float2x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy)[1];
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0[0].xy = float2(float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[0][0], float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[1][0]);
v_41.row_major0[1].xy = float2(float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[0][1], float2x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy)[1][1]);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].xy = float2(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[0][0], float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[1][0]);
v_29.col_major0[1].xy = float2(float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[0][1], float2x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy)[1][1]);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0[0].xy = float2x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy)[0];
v_41.row_major0[1].xy = float2x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy)[1];
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
v_41.row_major0[1][1] = v_29.col_major0[1].y;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,46 +19,54 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x2 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x2 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(v_29.col_major0);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(v_41.row_major0);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
v_41.row_major0[1][1] = v_29.col_major0[1].y;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -21,42 +21,49 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x3 loaded = float2x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1]));
v_29.col_major1[0] = loaded[0];
v_29.col_major1[1] = loaded[1];
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x3 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0[0] = float2x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]))[0];
v_29.col_major0[1] = float2x3(float3(v_29.col_major1[0]), float3(v_29.col_major1[1]))[1];
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(float2x3(float3(v_29.col_major0[0]), float3(v_29.col_major0[1])));
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0] = float3(v_41.row_major0[0][0], v_41.row_major0[1][0], v_41.row_major0[2][0]);
v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]);
v_41.row_major0[0][1] = v_29.col_major0[1][0];
@ -64,7 +71,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[2][1] = v_29.col_major0[1][2];
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0][1u] = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0][1u];

View File

@ -19,13 +19,15 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x3 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x3 loaded = transpose(float3x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy));
v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]);
@ -33,31 +35,36 @@ inline void load_store_to_variable_row_major(device SSBORow& v_41)
v_41.row_major0[2].xy = float2(loaded[0][2], loaded[1][2]);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0[0].xy = float2(v_29.col_major0[0][0], v_29.col_major0[1][0]);
v_41.row_major0[1].xy = float2(v_29.col_major0[0][1], v_29.col_major0[1][1]);
v_41.row_major0[2].xy = float2(v_29.col_major0[0][2], v_29.col_major0[1][2]);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(float3x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy));
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0[0].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[0];
v_41.row_major0[1].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[1];
v_41.row_major0[2].xy = float3x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy)[2];
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
@ -65,7 +72,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[2][1] = v_29.col_major0[1].z;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,39 +19,46 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x3 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x3 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(v_29.col_major0);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(v_41.row_major0);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float3(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
@ -59,7 +66,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[2][1] = v_29.col_major0[1].z;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,39 +19,46 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x4 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x4 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(v_29.col_major0);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(v_41.row_major0);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
@ -60,7 +67,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[3][1] = v_29.col_major0[1].w;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,13 +19,15 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x4 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x4 loaded = transpose(float4x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy, v_41.row_major0[3].xy));
v_41.row_major0[0].xy = float2(loaded[0][0], loaded[1][0]);
@ -34,12 +36,14 @@ inline void load_store_to_variable_row_major(device SSBORow& v_41)
v_41.row_major0[3].xy = float2(loaded[0][3], loaded[1][3]);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0[0].xy = float2(v_29.col_major0[0][0], v_29.col_major0[1][0]);
v_41.row_major0[1].xy = float2(v_29.col_major0[0][1], v_29.col_major0[1][1]);
@ -47,12 +51,14 @@ inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_
v_41.row_major0[3].xy = float2(v_29.col_major0[0][3], v_29.col_major0[1][3]);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(float4x2(v_41.row_major0[0].xy, v_41.row_major0[1].xy, v_41.row_major0[2].xy, v_41.row_major0[3].xy));
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0[0].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[0];
v_41.row_major0[1].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[1];
@ -60,7 +66,8 @@ inline void copy_row_major_to_row_major(device SSBORow& v_41)
v_41.row_major0[3].xy = float4x2(v_41.row_major1[0].xy, v_41.row_major1[1].xy, v_41.row_major1[2].xy, v_41.row_major1[3].xy)[3];
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
@ -69,7 +76,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[3][1] = v_29.col_major0[1].w;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,39 +19,46 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float2x4 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float2x4 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(v_29.col_major0);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(v_41.row_major0);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float4(v_41.row_major0[0][1], v_41.row_major0[1][1], v_41.row_major0[2][1], v_41.row_major0[3][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
@ -60,7 +67,8 @@ inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
v_41.row_major0[3][1] = v_29.col_major0[1].w;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -21,49 +21,57 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float3x2 loaded = v_29.col_major0;
v_29.col_major1 = loaded;
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float3x2 loaded = transpose(float2x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1])));
v_41.row_major0[0] = float3(loaded[0][0], loaded[1][0], loaded[2][0]);
v_41.row_major0[1] = float3(loaded[0][1], loaded[1][1], loaded[2][1]);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0 = v_29.col_major1;
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0[0] = float3(v_29.col_major0[0][0], v_29.col_major0[1][0], v_29.col_major0[2][0]);
v_41.row_major0[1] = float3(v_29.col_major0[0][1], v_29.col_major0[1][1], v_29.col_major0[2][1]);
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0 = transpose(float2x3(float3(v_41.row_major0[0]), float3(v_41.row_major0[1])));
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0[0] = float2x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]))[0];
v_41.row_major0[1] = float2x3(float3(v_41.row_major1[0]), float3(v_41.row_major1[1]))[1];
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1] = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
v_41.row_major0[1][1] = v_29.col_major0[1].y;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

View File

@ -19,7 +19,8 @@ struct SSBORow
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
inline void load_store_to_variable_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void load_store_to_variable_col_major(device SSBOCol& v_29)
{
float3x2 loaded = float3x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy);
v_29.col_major1[0].xy = loaded[0];
@ -27,44 +28,51 @@ inline void load_store_to_variable_col_major(device SSBOCol& v_29)
v_29.col_major1[2].xy = loaded[2];
}
inline void load_store_to_variable_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void load_store_to_variable_row_major(device SSBORow& v_41)
{
float3x2 loaded = transpose(v_41.row_major0);
v_41.row_major0 = transpose(loaded);
}
inline void copy_col_major_to_col_major(device SSBOCol& v_29)
static inline __attribute__((always_inline))
void copy_col_major_to_col_major(device SSBOCol& v_29)
{
v_29.col_major0[0].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[0];
v_29.col_major0[1].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[1];
v_29.col_major0[2].xy = float3x2(v_29.col_major1[0].xy, v_29.col_major1[1].xy, v_29.col_major1[2].xy)[2];
}
inline void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_col_major_to_row_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_41.row_major0 = transpose(float3x2(v_29.col_major0[0].xy, v_29.col_major0[1].xy, v_29.col_major0[2].xy));
}
inline void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_col_major(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].xy = float2(v_41.row_major0[0][0], v_41.row_major0[1][0]);
v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_29.col_major0[2].xy = float2(v_41.row_major0[0][2], v_41.row_major0[1][2]);
}
inline void copy_row_major_to_row_major(device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_row_major_to_row_major(device SSBORow& v_41)
{
v_41.row_major0 = v_41.row_major1;
}
inline void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_columns(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[1].xy = float2(v_41.row_major0[0][1], v_41.row_major0[1][1]);
v_41.row_major0[0][1] = v_29.col_major0[1].x;
v_41.row_major0[1][1] = v_29.col_major0[1].y;
}
inline void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
static inline __attribute__((always_inline))
void copy_elements(device SSBOCol& v_29, device SSBORow& v_41)
{
v_29.col_major0[0].y = v_41.row_major0[1u][0];
v_41.row_major0[1u][0] = v_29.col_major0[0].y;

Some files were not shown because too many files have changed in this diff Show More