From 32043a48b6503fe3e493082c33eac02865503031 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 21 Jul 2023 16:28:01 -0400 Subject: Better handling of bindings with multiple resource kind "aliases" for GLSL emit (#3009) * A more way robust way to handle resource consumption might use multiple `kind`s on GLSL emit. * Improve method naming and some comments. * Small consistency fix. --- source/slang/slang-ir.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 2fc1a9466..a27bf8658 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -1047,6 +1047,20 @@ namespace Slang return findOffsetAttr(kind) != nullptr; } + bool IRVarLayout::usesResourceFromKinds(LayoutResourceKindFlags kindFlags) + { + // Like usesResourceKind this works because there is an offset stored even if it's 0. + if (kindFlags) + { + for (auto offsetAttr : getOffsetAttrs()) + { + if (LayoutResourceKindFlag::make(offsetAttr->getResourceKind()) & kindFlags ) + return true; + } + } + return false; + } + IRSystemValueSemanticAttr* IRVarLayout::findSystemValueSemanticAttr() { return findAttr(); -- cgit v1.2.3