diff --git a/gfx/drivers_shader/slang_process.cpp b/gfx/drivers_shader/slang_process.cpp index 569c221f3f..77374f0a1e 100644 --- a/gfx/drivers_shader/slang_process.cpp +++ b/gfx/drivers_shader/slang_process.cpp @@ -73,7 +73,8 @@ get_semantic_name(slang_reflection& reflection, "FrameCount", "FrameDirection", }; - if ((int)semantic < sizeof(names) / sizeof(*names)) + int size = sizeof(names) / sizeof(*names); + if ((int)semantic < size) return std::string(names[semantic]); return get_semantic_name(reflection.semantic_map, semantic, index); @@ -86,9 +87,11 @@ get_semantic_name(slang_reflection& reflection, static const char* names[] = { "Original", "Source", "OriginalHistory", "PassOutput", "PassFeedback", }; + int size; if ((int)semantic < (int)SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY) return std::string(names[semantic]); - else if ((int)semantic < sizeof(names) / sizeof(*names)) + size = sizeof(names) / sizeof(*names); + if ((int)semantic < size) return std::string(names[semantic]) + to_string(index); return get_semantic_name(reflection.texture_semantic_map, semantic, index); @@ -101,9 +104,11 @@ static string get_size_semantic_name( static const char* names[] = { "OriginalSize", "SourceSize", "OriginalHistorySize", "PassOutputSize", "PassFeedbackSize", }; + int size; if ((int)semantic < (int)SLANG_TEXTURE_SEMANTIC_ORIGINAL_HISTORY) return std::string(names[semantic]); - if ((int)semantic < sizeof(names) / sizeof(*names)) + size = sizeof(names) / sizeof(*names); + if ((int)semantic < size) return std::string(names[semantic]) + to_string(index); return get_semantic_name(reflection.texture_semantic_uniform_map, semantic, index);