From 975c5db3f0a71bc93369a321318e7d3b43001ff5 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 17 Jul 2020 16:38:18 -0400 Subject: Disable specializing function calls if they have a struct param, that contains an array (#1448) * This code is disabled, it was part of the optimization `Specialize function calls involving array arguments. (#1389)` on github. It is disabled here because it causes a problem when a struct is passed to a function that contains a structured buffer *and* an array. It is specialized on the struct type, and so those types become parameters to the function. If the struct contains a structured buffer this is a problem on GLSL/VK based targets because currently structured buffers cannot be function parameters. The fix for now is to just disable this optimization. * Fix typo in name of test expected values. --- source/slang/slang-ir-specialize-resources.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source') diff --git a/source/slang/slang-ir-specialize-resources.cpp b/source/slang/slang-ir-specialize-resources.cpp index 60439abeb..2d84cfd8c 100644 --- a/source/slang/slang-ir-specialize-resources.cpp +++ b/source/slang/slang-ir-specialize-resources.cpp @@ -230,8 +230,20 @@ struct ResourceParameterSpecializationContext return true; if(as(type)) return true; + +#if 0 + // This code is disabled, and is part of the optimization `Specialize function calls involving array arguments. (#1389)` on github. + // + // It is disabled here because it causes a problem when a struct is passed to a function that contains a structured buffer *and* + // an array. It is specialized on the struct type, and so those types become parameters to the function. + // If the struct contains a structured buffer this is a problem on GLSL/VK based targets because currently + // structured buffers cannot be function parameters. + // + // The fix for now is to just disable this optimization. + if (isStructTypeWithArray(type)) return true; +#endif } // For now, we will not treat any other parameters as -- cgit v1.2.3