You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's currently illegal to have a variable (local or global) with an opaque type, e.g., sampler2D or image2D. Being able to do so would have a number of advantages, particularly for bindless renderers where all resources may reside in array descriptors. The main one would be the ability to make type-safe aliases of resources.
One way to deal with this issue is to use macros that refer to specific indices of a descriptor array:
Infinite scope (unless explicitly #undef'd at some point)
Can cause confusing error messages or surprising bugs due to being simple text replacement
Being able to make a variable that refers to an object of an opaque type would generally make it easier to do logic on resources without having to add a layer of "indirection" (e.g., an if-else chain or switch statement in a bindful renderer).
While it's mostly a quality-of-life feature, it seems odd for it to be missing in the first place.
P.S. HLSL allows declaring locals and return values of opaque types, but they must be guaranteed to map to one unique resource (so no conditionally assigning them).
It's currently illegal to have a variable (local or global) with an opaque type, e.g.,
sampler2D
orimage2D
. Being able to do so would have a number of advantages, particularly for bindless renderers where all resources may reside in array descriptors. The main one would be the ability to make type-safe aliases of resources.One way to deal with this issue is to use macros that refer to specific indices of a descriptor array:
But macros have several issues:
#undef
'd at some point)Being able to make a variable that refers to an object of an opaque type would generally make it easier to do logic on resources without having to add a layer of "indirection" (e.g., an if-else chain or switch statement in a bindful renderer).
While it's mostly a quality-of-life feature, it seems odd for it to be missing in the first place.
P.S. HLSL allows declaring locals and return values of opaque types, but they must be guaranteed to map to one unique resource (so no conditionally assigning them).
Related issues:
The text was updated successfully, but these errors were encountered: