summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-reflection.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-09-11 13:21:10 -0700
committerGitHub <noreply@github.com>2020-09-11 13:21:10 -0700
commit459e788e2d2b6d21b0bed95cf3046bb8d0e6b8f3 (patch)
tree710184234b0ee4411798dec0561bad1e08e781de /source/slang/slang-reflection.cpp
parente5b796db188416dfc414dab27b92c86b0b53de2b (diff)
Remove some "do what I mean" logic from reflection API (#1539)
The reflection API had a bit of DWIM (Do What I Mean) logic in that a client could query the resource usage/bindings of a `ParameterBlock<X>` and see not only the register `space` or descriptor `set` for the block itself, but also the constant buffer `register` or `binding` for its default constant buffer (if any). The reason for this behavior was that there was existing client code in Falcor that relied on that behavior for parameter blocks, and even after changing the way that parameter block layouts were computed and stored we sought to maintain backwards compatibility with that client code. The trouble is that the weird behavior then goes on to cause confusion for other clients of the Slang reflection API. This change removes the special-case logic, and fixes up our reflection tests to mirror the new (correct) information that we return. When this change is released, it will be a breaking change for any client code that still relies on the old behavior. We will need to coordinate with client application developers to fix their reflection logic. Note that all the same information can still be accessed, simply by using new reflection API that we have added.
Diffstat (limited to 'source/slang/slang-reflection.cpp')
-rw-r--r--source/slang/slang-reflection.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index 6d53e1a89..1daec501d 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -831,27 +831,11 @@ static SlangParameterCategory getParameterCategory(
return SLANG_PARAMETER_CATEGORY_MIXED;
}
-static TypeLayout* maybeGetContainerLayout(TypeLayout* typeLayout)
-{
- if (auto parameterGroupTypeLayout = as<ParameterGroupTypeLayout>(typeLayout))
- {
- auto containerTypeLayout = parameterGroupTypeLayout->containerVarLayout->typeLayout;
- if (containerTypeLayout->resourceInfos.getCount() != 0)
- {
- return containerTypeLayout;
- }
- }
-
- return typeLayout;
-}
-
SLANG_API SlangParameterCategory spReflectionTypeLayout_GetParameterCategory(SlangReflectionTypeLayout* inTypeLayout)
{
auto typeLayout = convert(inTypeLayout);
if(!typeLayout) return SLANG_PARAMETER_CATEGORY_NONE;
- typeLayout = maybeGetContainerLayout(typeLayout);
-
return getParameterCategory(typeLayout);
}
@@ -860,8 +844,6 @@ SLANG_API unsigned spReflectionTypeLayout_GetCategoryCount(SlangReflectionTypeLa
auto typeLayout = convert(inTypeLayout);
if(!typeLayout) return 0;
- typeLayout = maybeGetContainerLayout(typeLayout);
-
return (unsigned) typeLayout->resourceInfos.getCount();
}
@@ -870,8 +852,6 @@ SLANG_API SlangParameterCategory spReflectionTypeLayout_GetCategoryByIndex(Slang
auto typeLayout = convert(inTypeLayout);
if(!typeLayout) return SLANG_PARAMETER_CATEGORY_NONE;
- typeLayout = maybeGetContainerLayout(typeLayout);
-
return typeLayout->resourceInfos[index].kind;
}