From 5b952d2cbfe38fe34c76b5f3daace8b579e4f9c0 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 18 Jan 2022 14:34:00 +0100 Subject: MSL: Rethink how opaque descriptors are passed to leaf functions. We were passing arrays by value which the compiler fails to optimize, causing abyssal performance. To fix this, we need to consider that descriptors can be in constant or const device address spaces. Also, lone descriptors are passed by value, so we explicitly remove address space qualifiers. One failure case is when shader passes a texture/sampler array as an argument. It's all UniformConstant in SPIR-V, but in MSL it might be thread, const device or constant, so that won't work ... Global variable use works fine though, and that should cover 99.9999999% of use cases. --- .../asm/comp/image-load-store-short-vector.invalid.asm.comp | 2 +- .../shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag | 4 ++-- .../shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag | 4 ++-- reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag | 4 ++-- reference/shaders-msl/frag/argument-buffers.msl2.argument.frag | 4 ++-- ...-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag | 4 ++-- .../array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag | 4 ++-- .../array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag | 6 +++--- .../shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag | 4 ++-- reference/shaders-msl/frag/helper-invocation.msl21.frag | 2 +- .../huge-argument-buffer.device-argument-buffer.argument.msl2.frag | 4 ++-- reference/shaders-msl/frag/image-query-lod.msl22.frag | 2 +- .../shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag | 2 +- reference/shaders-msl/frag/input-attachment-ms.frag | 2 +- reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag | 2 +- reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag | 2 +- reference/shaders-msl/frag/input-attachment.frag | 2 +- reference/shaders-msl/frag/input-attachment.multiview.frag | 2 +- .../frag/sample-depth-propagate-state-from-resource.frag | 6 +++--- reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag | 4 ++-- reference/shaders-msl/frag/sampler-image-arrays.msl2.frag | 6 +++--- reference/shaders-msl/frag/sampler.frag | 2 +- reference/shaders-msl/frag/separate-image-sampler-argument.frag | 2 +- reference/shaders-msl/tese/water_tess.tese | 2 +- reference/shaders-msl/vert/resource-arrays-leaf.ios.vert | 2 +- 25 files changed, 40 insertions(+), 40 deletions(-) (limited to 'reference/shaders-msl') diff --git a/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp b/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp index fca572e3..53655639 100644 --- a/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp +++ b/reference/shaders-msl/asm/comp/image-load-store-short-vector.invalid.asm.comp @@ -6,7 +6,7 @@ using namespace metal; static inline __attribute__((always_inline)) -void _main(thread const uint3& id, thread texture2d TargetTexture) +void _main(thread const uint3& id, texture2d TargetTexture) { float2 loaded = TargetTexture.read(uint2(id.xy)).xy; float2 storeTemp = loaded + float2(1.0); diff --git a/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag b/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag index 01c670d9..46bdd3e4 100644 --- a/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag +++ b/reference/shaders-msl/asm/frag/depth-image-color-format-fetch.asm.frag @@ -21,14 +21,14 @@ struct main0_in }; static inline __attribute__((always_inline)) -void _108(int _109, thread texture2d v_8, device _7& v_10) +void _108(int _109, texture2d v_8, device _7& v_10) { int2 _113 = int2(_109 - 8 * (_109 / 8), _109 / 8); v_10._m0[_109] = v_8.read(uint2(_113), 0); } static inline __attribute__((always_inline)) -float4 _98(float4 _119, thread texture2d v_8, device _7& v_10) +float4 _98(float4 _119, texture2d v_8, device _7& v_10) { for (int _121 = 0; _121 < 64; _121++) { diff --git a/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag b/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag index 9e374c0a..df9f8f43 100644 --- a/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag +++ b/reference/shaders-msl/asm/frag/depth-image-color-format-sampled.asm.frag @@ -21,13 +21,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -void _108(int _109, thread texture2d v_8, thread sampler v_9, device _7& v_10) +void _108(int _109, texture2d v_8, sampler v_9, device _7& v_10) { v_10._m0[_109] = v_8.sample(v_9, (float2(int2(_109 - 8 * (_109 / 8), _109 / 8)) / float2(8.0)), level(0.0)); } static inline __attribute__((always_inline)) -float4 _98(float4 _121, thread texture2d v_8, thread sampler v_9, device _7& v_10) +float4 _98(float4 _121, texture2d v_8, sampler v_9, device _7& v_10) { for (int _123 = 0; _123 < 64; _123++) { diff --git a/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag b/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag index 01a0e5a7..e512bdca 100644 --- a/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag +++ b/reference/shaders-msl/asm/frag/unknown-depth-state.asm.frag @@ -16,13 +16,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -float sample_combined(thread float3& vUV, thread depth2d uShadow, thread const sampler uShadowSmplr) +float sample_combined(thread float3& vUV, depth2d uShadow, sampler uShadowSmplr) { return uShadow.sample_compare(uShadowSmplr, vUV.xy, vUV.z); } static inline __attribute__((always_inline)) -float sample_separate(thread float3& vUV, thread depth2d uTexture, thread sampler uSampler) +float sample_separate(thread float3& vUV, depth2d uTexture, sampler uSampler) { return uTexture.sample_compare(uSampler, vUV.xy, vUV.z); } diff --git a/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag b/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag index b7005ff9..fd0a3def 100644 --- a/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag +++ b/reference/shaders-msl/frag/argument-buffers.msl2.argument.frag @@ -63,7 +63,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_function2(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) +float4 sample_in_function2(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers) { float4 ret = uTexture.sample(uTextureSmplr, vUV); ret += uTexture2[2].sample(uSampler[1], vUV); @@ -75,7 +75,7 @@ float4 sample_in_function2(thread texture2d uTexture, thread const sample } static inline __attribute__((always_inline)) -float4 sample_in_function(thread texture2d uTexture, thread const sampler uTextureSmplr, thread float2& vUV, thread const array, 4> uTexture2, thread const array uSampler, thread const array, 2> uTextures, thread const array uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& v_90, constant UBOs* constant (&ubos)[4]) +float4 sample_in_function(texture2d uTexture, sampler uTextureSmplr, thread float2& vUV, constant array, 4>& uTexture2, constant array& uSampler, constant array, 2>& uTextures, constant array& uTexturesSmplr, device SSBO& v_60, const device SSBOs* constant (&ssbos)[2], constant Push& registers, constant UBO& v_90, constant UBOs* constant (&ubos)[4]) { float4 ret = sample_in_function2(uTexture, uTextureSmplr, vUV, uTexture2, uSampler, uTextures, uTexturesSmplr, v_60, ssbos, registers); ret += v_90.ubo; diff --git a/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag b/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag index 3e8ce2df..9c02d302 100644 --- a/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag +++ b/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.argument.discrete.swizzle.frag @@ -95,13 +95,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_func(thread const array, 4> uSampler, thread const array uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) +float4 sample_in_func(constant array, 4>& uSampler, constant array& uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) { return spvTextureSwizzle(uSampler[uUBO.index].sample(uSamplerSmplr[uUBO.index], vUV), uSamplerSwzl[uUBO.index]); } static inline __attribute__((always_inline)) -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag b/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag index 87d33039..978ecbe1 100644 --- a/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag +++ b/reference/shaders-msl/frag/array-of-texture-swizzle-nonconstant-uniform.msl2.swizzle.frag @@ -86,13 +86,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_func(thread const array, 4> uSampler, thread const array uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) +float4 sample_in_func(thread const array, 4>& uSampler, thread const array& uSamplerSmplr, constant uint* uSamplerSwzl, constant UBO& uUBO, thread float2& vUV) { return spvTextureSwizzle(uSampler[uUBO.index].sample(uSamplerSmplr[uUBO.index], vUV), uSamplerSwzl[uUBO.index]); } static inline __attribute__((always_inline)) -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag b/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag index 9336688d..43a61e1f 100644 --- a/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag +++ b/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.argument.discrete.swizzle.frag @@ -83,19 +83,19 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_func_1(thread const array, 4> uSampler0, thread const array uSampler0Smplr, constant uint* uSampler0Swzl, thread float2& vUV) +float4 sample_in_func_1(constant array, 4>& uSampler0, constant array& uSampler0Smplr, constant uint* uSampler0Swzl, thread float2& vUV) { return spvTextureSwizzle(uSampler0[2].sample(uSampler0Smplr[2], vUV), uSampler0Swzl[2]); } static inline __attribute__((always_inline)) -float4 sample_in_func_2(thread float2& vUV, thread texture2d uSampler1, thread const sampler uSampler1Smplr, constant uint& uSampler1Swzl) +float4 sample_in_func_2(thread float2& vUV, texture2d uSampler1, sampler uSampler1Smplr, constant uint& uSampler1Swzl) { return spvTextureSwizzle(uSampler1.sample(uSampler1Smplr, vUV), uSampler1Swzl); } static inline __attribute__((always_inline)) -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag b/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag index e1cb4525..1db803c5 100644 --- a/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag +++ b/reference/shaders-msl/frag/array-of-texture-swizzle.msl2.swizzle.frag @@ -76,13 +76,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_in_func(thread const array, 4> uSampler, thread const array uSamplerSmplr, constant uint* uSamplerSwzl, thread float2& vUV) +float4 sample_in_func(thread const array, 4>& uSampler, thread const array& uSamplerSmplr, constant uint* uSamplerSwzl, thread float2& vUV) { return spvTextureSwizzle(uSampler[2].sample(uSamplerSmplr[2], vUV), uSamplerSwzl[2]); } static inline __attribute__((always_inline)) -float4 sample_single_in_func(thread const texture2d s, thread const sampler sSmplr, constant uint& sSwzl, thread float2& vUV) +float4 sample_single_in_func(texture2d s, sampler sSmplr, constant uint& sSwzl, thread float2& vUV) { return spvTextureSwizzle(s.sample(sSmplr, vUV), sSwzl); } diff --git a/reference/shaders-msl/frag/helper-invocation.msl21.frag b/reference/shaders-msl/frag/helper-invocation.msl21.frag index 97d69e19..7cf97a25 100644 --- a/reference/shaders-msl/frag/helper-invocation.msl21.frag +++ b/reference/shaders-msl/frag/helper-invocation.msl21.frag @@ -16,7 +16,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 foo(thread bool& gl_HelperInvocation, thread texture2d uSampler, thread const sampler uSamplerSmplr, thread float2& vUV) +float4 foo(thread bool& gl_HelperInvocation, texture2d uSampler, sampler uSamplerSmplr, thread float2& vUV) { float4 color; if (!gl_HelperInvocation) diff --git a/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag b/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag index 0e35c248..a3583584 100644 --- a/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag +++ b/reference/shaders-msl/frag/huge-argument-buffer.device-argument-buffer.argument.msl2.frag @@ -38,13 +38,13 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 samp_array(thread const array, 10000> uSamplers, thread const array uSamplersSmplr, thread float2& vUV, constant UBO* const device (&vs)[10000]) +float4 samp_array(const device array, 10000>& uSamplers, const device array& uSamplersSmplr, thread float2& vUV, constant UBO* const device (&vs)[10000]) { return uSamplers[9999].sample(uSamplersSmplr[9999], vUV) + vs[5000]->v; } static inline __attribute__((always_inline)) -float4 samp_single(thread float2& vUV, thread texture2d uSampler, thread const sampler uSamplerSmplr) +float4 samp_single(thread float2& vUV, texture2d uSampler, sampler uSamplerSmplr) { return uSampler.sample(uSamplerSmplr, vUV); } diff --git a/reference/shaders-msl/frag/image-query-lod.msl22.frag b/reference/shaders-msl/frag/image-query-lod.msl22.frag index 6e7991f2..2362597f 100644 --- a/reference/shaders-msl/frag/image-query-lod.msl22.frag +++ b/reference/shaders-msl/frag/image-query-lod.msl22.frag @@ -16,7 +16,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -void from_function(thread float2& FragColor, thread texture2d uSampler2D, thread const sampler uSampler2DSmplr, thread float3& vUV, thread texture3d uSampler3D, thread const sampler uSampler3DSmplr, thread texturecube uSamplerCube, thread const sampler uSamplerCubeSmplr, thread texture2d uTexture2D, thread sampler uSampler, thread texture3d uTexture3D, thread texturecube uTextureCube) +void from_function(thread float2& FragColor, texture2d uSampler2D, sampler uSampler2DSmplr, thread float3& vUV, texture3d uSampler3D, sampler uSampler3DSmplr, texturecube uSamplerCube, sampler uSamplerCubeSmplr, texture2d uTexture2D, sampler uSampler, texture3d uTexture3D, texturecube uTextureCube) { float2 _22; _22.x = uSampler2D.calculate_clamped_lod(uSampler2DSmplr, vUV.xy); diff --git a/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag b/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag index f7b1441f..3f91c2c4 100644 --- a/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag +++ b/reference/shaders-msl/frag/input-attachment-ms.arrayed-subpass.msl21.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_Layer) +float4 load_subpasses(texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_Layer) { float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_Layer, gl_SampleID); return _24; diff --git a/reference/shaders-msl/frag/input-attachment-ms.frag b/reference/shaders-msl/frag/input-attachment-ms.frag index 5e1f504a..97629d8e 100644 --- a/reference/shaders-msl/frag/input-attachment-ms.frag +++ b/reference/shaders-msl/frag/input-attachment-ms.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d_ms uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord) +float4 load_subpasses(texture2d_ms uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord) { float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_SampleID); return _24; diff --git a/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag b/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag index 5e8c5339..1b6b9f6a 100644 --- a/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag +++ b/reference/shaders-msl/frag/input-attachment-ms.multiview.msl21.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) +float4 load_subpasses(texture2d_ms_array uInput, thread uint& gl_SampleID, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) { float4 _24 = uInput.read(uint2(gl_FragCoord.xy), gl_ViewIndex, gl_SampleID); return _24; diff --git a/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag b/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag index 76d0a3cf..934abd58 100644 --- a/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag +++ b/reference/shaders-msl/frag/input-attachment.arrayed-subpass.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_Layer) +float4 load_subpasses(texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_Layer) { return uInput.read(uint2(gl_FragCoord.xy), gl_Layer); } diff --git a/reference/shaders-msl/frag/input-attachment.frag b/reference/shaders-msl/frag/input-attachment.frag index 93bbaec0..0643acfa 100644 --- a/reference/shaders-msl/frag/input-attachment.frag +++ b/reference/shaders-msl/frag/input-attachment.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d uInput, thread float4& gl_FragCoord) +float4 load_subpasses(texture2d uInput, thread float4& gl_FragCoord) { return uInput.read(uint2(gl_FragCoord.xy)); } diff --git a/reference/shaders-msl/frag/input-attachment.multiview.frag b/reference/shaders-msl/frag/input-attachment.multiview.frag index 931790b8..6ba24216 100644 --- a/reference/shaders-msl/frag/input-attachment.multiview.frag +++ b/reference/shaders-msl/frag/input-attachment.multiview.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 load_subpasses(thread const texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) +float4 load_subpasses(texture2d_array uInput, thread float4& gl_FragCoord, thread uint& gl_ViewIndex) { return uInput.read(uint2(gl_FragCoord.xy), gl_ViewIndex); } diff --git a/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag b/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag index a093d3f4..f0bf396c 100644 --- a/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag +++ b/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag @@ -16,19 +16,19 @@ struct main0_in }; static inline __attribute__((always_inline)) -float sample_normal2(thread const depth2d tex, thread sampler uSampler, thread float3& vUV) +float sample_normal2(depth2d tex, sampler uSampler, thread float3& vUV) { return float4(tex.sample(uSampler, vUV.xy)).x; } static inline __attribute__((always_inline)) -float sample_normal(thread const depth2d tex, thread sampler uSampler, thread float3& vUV) +float sample_normal(depth2d tex, sampler uSampler, thread float3& vUV) { return sample_normal2(tex, uSampler, vUV); } static inline __attribute__((always_inline)) -float sample_comp(thread const depth2d tex, thread float3& vUV, thread sampler uSamplerShadow) +float sample_comp(depth2d tex, thread float3& vUV, sampler uSamplerShadow) { return tex.sample_compare(uSamplerShadow, vUV.xy, vUV.z); } diff --git a/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag b/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag index 115ed9fa..27653a06 100644 --- a/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag +++ b/reference/shaders-msl/frag/sample-depth-separate-image-sampler.frag @@ -11,13 +11,13 @@ struct main0_out }; static inline __attribute__((always_inline)) -float sample_depth_from_function(thread const depth2d uT, thread const sampler uS) +float sample_depth_from_function(depth2d uT, sampler uS) { return uT.sample_compare(uS, float3(0.5).xy, 0.5); } static inline __attribute__((always_inline)) -float sample_color_from_function(thread const texture2d uT, thread const sampler uS) +float sample_color_from_function(texture2d uT, sampler uS) { return uT.sample(uS, float2(0.5)).x; } diff --git a/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag b/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag index dec6d051..8d1934d4 100644 --- a/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag +++ b/reference/shaders-msl/frag/sampler-image-arrays.msl2.frag @@ -17,19 +17,19 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_from_global(thread int& vIndex, thread float2& vTex, thread const array, 4> uSampler, thread const array uSamplerSmplr) +float4 sample_from_global(thread int& vIndex, thread float2& vTex, thread const array, 4>& uSampler, thread const array& uSamplerSmplr) { return uSampler[vIndex].sample(uSamplerSmplr[vIndex], (vTex + float2(0.100000001490116119384765625))); } static inline __attribute__((always_inline)) -float4 sample_from_argument(thread const array, 4> samplers, thread const array samplersSmplr, thread int& vIndex, thread float2& vTex) +float4 sample_from_argument(thread const array, 4>& samplers, thread const array& samplersSmplr, thread int& vIndex, thread float2& vTex) { return samplers[vIndex].sample(samplersSmplr[vIndex], (vTex + float2(0.20000000298023223876953125))); } static inline __attribute__((always_inline)) -float4 sample_single_from_argument(thread const texture2d samp, thread const sampler sampSmplr, thread float2& vTex) +float4 sample_single_from_argument(texture2d samp, sampler sampSmplr, thread float2& vTex) { return samp.sample(sampSmplr, (vTex + float2(0.300000011920928955078125))); } diff --git a/reference/shaders-msl/frag/sampler.frag b/reference/shaders-msl/frag/sampler.frag index 6484161b..84743fbd 100644 --- a/reference/shaders-msl/frag/sampler.frag +++ b/reference/shaders-msl/frag/sampler.frag @@ -17,7 +17,7 @@ struct main0_in }; static inline __attribute__((always_inline)) -float4 sample_texture(thread const texture2d tex, thread const sampler texSmplr, thread const float2& uv) +float4 sample_texture(texture2d tex, sampler texSmplr, thread const float2& uv) { return tex.sample(texSmplr, uv); } diff --git a/reference/shaders-msl/frag/separate-image-sampler-argument.frag b/reference/shaders-msl/frag/separate-image-sampler-argument.frag index d196243d..208f5d90 100644 --- a/reference/shaders-msl/frag/separate-image-sampler-argument.frag +++ b/reference/shaders-msl/frag/separate-image-sampler-argument.frag @@ -11,7 +11,7 @@ struct main0_out }; static inline __attribute__((always_inline)) -float4 samp(thread const texture2d t, thread const sampler s) +float4 samp(texture2d t, sampler s) { return t.sample(s, float2(0.5)); } diff --git a/reference/shaders-msl/tese/water_tess.tese b/reference/shaders-msl/tese/water_tess.tese index 7ecbb166..5f63d94f 100644 --- a/reference/shaders-msl/tese/water_tess.tese +++ b/reference/shaders-msl/tese/water_tess.tese @@ -45,7 +45,7 @@ float2 lod_factor(thread const float2& tess_coord, thread float4& vPatchLods) } static inline __attribute__((always_inline)) -float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, thread texture2d uHeightmapDisplacement, thread const sampler uHeightmapDisplacementSmplr) +float3 sample_height_displacement(thread const float2& uv, thread const float2& off, thread const float2& lod, texture2d uHeightmapDisplacement, sampler uHeightmapDisplacementSmplr) { return mix(uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 0.5)), level(lod.x)).xyz, uHeightmapDisplacement.sample(uHeightmapDisplacementSmplr, (uv + (off * 1.0)), level(lod.x + 1.0)).xyz, float3(lod.y)); } diff --git a/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert b/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert index 8ab252f5..fad06d6a 100644 --- a/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert +++ b/reference/shaders-msl/vert/resource-arrays-leaf.ios.vert @@ -23,7 +23,7 @@ struct constant_block constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0; static inline __attribute__((always_inline)) -void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array, 3> images) +void doWork(device storage_block* (&storage)[2], constant constant_block* (&constants)[4], thread const array, 3>& images) { storage[0]->baz = uint4(constants[3]->foo); storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy; -- cgit v1.2.3