diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-10-24 13:22:30 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2019-10-24 13:22:30 +0300 |
commit | d1479f871afedc4006acaaa6e6bf7e46517979fa (patch) | |
tree | 8fdcb5692229a885f31739b18b7dbd4cd9eee40d /reference/shaders-ue4/asm/frag/depth-compare.asm.frag | |
parent | b433836b080b37c8202e398f3448a9bfc602dafa (diff) |
MSL: Do not generate UnsafeArray<> for any array inside buffer objects.
This avoids a lot of huge code changes.
Arrays generally cannot be copied in and out of buffers, at least no
compiler frontend seems to do it.
Also avoids a lot of issues surrounding packed vectors and matrices.
Diffstat (limited to 'reference/shaders-ue4/asm/frag/depth-compare.asm.frag')
-rw-r--r-- | reference/shaders-ue4/asm/frag/depth-compare.asm.frag | 53 |
1 files changed, 6 insertions, 47 deletions
diff --git a/reference/shaders-ue4/asm/frag/depth-compare.asm.frag b/reference/shaders-ue4/asm/frag/depth-compare.asm.frag index 9a6c1949..bdeccc2f 100644 --- a/reference/shaders-ue4/asm/frag/depth-compare.asm.frag +++ b/reference/shaders-ue4/asm/frag/depth-compare.asm.frag @@ -1,49 +1,8 @@ -#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; @@ -141,8 +100,8 @@ struct type_View float4 View_DirectionalLightColor; packed_float3 View_DirectionalLightDirection; float PrePadding_View_2204; - spvUnsafeArray<float4, 2> View_TranslucencyLightingVolumeMin; - spvUnsafeArray<float4, 2> View_TranslucencyLightingVolumeInvSize; + float4 View_TranslucencyLightingVolumeMin[2]; + float4 View_TranslucencyLightingVolumeInvSize[2]; float4 View_TemporalAAParams; float4 View_CircleDOFParams; float View_DepthOfFieldSensorWidth; @@ -182,7 +141,7 @@ struct type_View float PrePadding_View_2488; float PrePadding_View_2492; float4 View_SkyLightColor; - spvUnsafeArray<float4, 7> View_SkyIrradianceEnvironmentMap; + float4 View_SkyIrradianceEnvironmentMap[7]; float View_MobilePreviewMode; float View_HMDEyePaddingOffset; float View_ReflectionCubemapMaxMip; @@ -193,8 +152,8 @@ struct type_View float PrePadding_View_2652; packed_float3 View_ReflectionEnvironmentRoughnessMixingScaleBiasAndLargestWeight; int View_StereoPassIndex; - spvUnsafeArray<float4, 4> View_GlobalVolumeCenterAndExtent; - spvUnsafeArray<float4, 4> View_GlobalVolumeWorldToUVAddAndMul; + float4 View_GlobalVolumeCenterAndExtent[4]; + float4 View_GlobalVolumeWorldToUVAddAndMul[4]; float View_GlobalVolumeDimension; float View_GlobalVolumeTexelSize; float View_MaxGlobalDistance; @@ -221,7 +180,7 @@ struct type_View struct type_Globals { float3 SoftTransitionScale; - spvUnsafeArray<float4x4, 6> ShadowViewProjectionMatrices; + float4x4 ShadowViewProjectionMatrices[6]; float InvShadowmapResolution; float ShadowFadeFraction; float ShadowSharpen; |