Open Makogan opened 1 year ago
I don't want to double down on the vk::combinedImageSampler attribute. After updating inline spir-v, I'll see how we can handle this. As I work through the inline spr-v, I'll make one of my goals to be able to define a class that can be made available in a header file that will be a combined image sampler.
Then I would to deprecate vk::combinedImageSampler
.
I was a little surprised this doesn't work. I guess it's not trivial. Any idea on when this will be supported?
We are close to finishing the implementation for vk::SpirvOpaqueType
. Once that is done, we will try to implement combined image sampler using that. It should allow for arrays.
The problem with the current design for the vk::combinedImageSampler is that it relies one SPIR-V opt to be able to guess as which textures and samplers should be combined, and there are a lot of corner cases where we cannot get it correct.
@cassiebeckley Once the vk::SpirvOpaqueType
lands please provide the syntax for people to use to define an array of combined texture samplers, and then close the issue.
@s-perron I made this in godbolt https://godbolt.org/z/sxejh1q7W
I'll get @Przemog1 to reimplement GLSL-style samplerXXX
and texture...
functions and they'll live in an Apache licensed header here: https://github.com/Devsh-Graphics-Programming/Nabla/blob/master/include/nbl/builtin/hlsl/glsl_compat/core.hlsl
However I've found a bug in the implementationProp 0011, one can't "nest" vk::SpirvOpaqueType
inside each other, this is a blocker because:
OpTypeImage
OpTypeSampledImage
from (1)OpTypePointer
in the UniformConstant storage class, and thats the actual type you declare your variable withThe error I get is that apparently vk::SpirvOpaqueType
is an object and not a type
is an object and cannot be used as a type parameter
Should I open a separate issue about that?
Should I open a separate issue about that?
Yes please do that.
We are looking into supporting combined texture samplers through the recently added vk::SpirvOpaqueType. When that is done, the arrays should work.
Consider the following GLSL code:
An attempt to translate this into HLSL could look like:
However, DXC does not support declaring combined image sampler arrays like this. I have also compiled the HLSL version with shaderc and it produced a shader that rendered the correct/expected output. That might be non-compliance or a bug on the end of shaderc, but that indicates that it is possible to compile this shader down into an homologous spirv representation as the GLSL version.
Among other things this would make it easier for developers to port existing GLSL codebases targetting vulkan into HLSL.