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. --- reference/shaders-msl/frag/separate-image-sampler-argument.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'reference/shaders-msl/frag/separate-image-sampler-argument.frag') 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)); } -- cgit v1.2.3