Open fknfilewalker opened 2 months ago
There is a way to specify the ID by explicitly linking a TypeConformance
object to your linked program when you are using the COM API to compile your shader.
See ISession::createTypeConformanceComponentType
:
virtual SLANG_NO_THROW SlangResult SLANG_MCALL createTypeConformanceComponentType(
slang::TypeReflection* type,
slang::TypeReflection* interfaceType,
ITypeConformance** outConformance,
SlangInt conformanceIdOverride,
ISlangBlob** outDiagnostics) = 0;
This function returns you a IComponentType* that you can include in your program as part of a CompositeComponentType
.
However, there is no way to specify this ID directly in the source code. Please let us know if the API is sufficient for your needs.
I think that should work. Is there also a way to get the byte size of the behind the scenes used Interface union using the COM API?
We currently don't have this in our reflection API, but should be easy to add.
Lining up the reflection API request for later down the line, as we've some fairly high priority stuff allocated near term already. Please let me know if this issue is a critical blocker for you.
It would be nice to have but for now I can just track the individual struct sizes to calculate the max size.
Is it possible to set/fix the index that is used to cast an Interface var to some struct implementing the interface?
Based on the following example: is-as-dynamic.slang In your test case you show that it is possible to set a fixed size for the Interface with
[anyValueSize(8)]
.Impl1
andImpl2
use indices 0 and 1 for differentiation. WhenImpl1
is not used, it gets removed andImpl2
gets index 0. Is there a way to fix Impl2 to always use index 1?