From 7e2bc8e06f61d554bae9bbebc1db0302eb3f1d8a Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 26 Jul 2024 19:42:15 -0700 Subject: Allow passing sized array to unsized array parameter. (#4744) --- source/slang/slang-emit.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/slang/slang-emit.cpp') diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 03d1b932c..8f7b5f66f 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -947,13 +947,13 @@ Result linkAndOptimizeIR( specializeResourceUsage(codeGenContext, irModule); specializeFuncsForBufferLoadArgs(codeGenContext, irModule); - // For GLSL targets, we also want to specialize calls to functions that - // takes array parameters if possible, to avoid performance issues on - // those platforms. - if (isKhronosTarget(targetRequest)) - { - specializeArrayParameters(codeGenContext, irModule); - } + // We also want to specialize calls to functions that + // takes unsized array parameters if possible. + // Moreover, for Khronos targets, we also want to specialize calls to functions + // that takes arrays/structs containing arrays as parameters with the actual + // global array object to avoid loading big arrays into SSA registers, which seems + // to cause performance issues. + specializeArrayParameters(codeGenContext, irModule); #if 0 dumpIRIfEnabled(codeGenContext, irModule, "AFTER RESOURCE SPECIALIZATION"); -- cgit v1.2.3