Implementation of SamplerTexture2D is incomplete
My engine relies on combined texture samplers in Vulkan to do texturing, but the implementation in Slang appears to be missing some functionality - mainly, attempting to sample from a SamplerTexture2D using the texture function gives the following error:
core.meta.slang(689): internal error 99999: unimplemented feature in Slang compiler: unexpected IR opcode during code emit
Thanks for posting this as its own issue. I can probably try to tackle this, but I'm wondering what kind of timeline you have on when you'd need the implementation for this to be useful.
I'm not in any particular hurry for what it's worth, since right now this is just for my own projects, but it is a blocker for remaining work on the rendering pipeline in the engine.
I'm starting to work on this and have made some positive steps toward getting things fixed in my branch. When this stuff lands the names and signatures are likely to be different than what you are working with right now, so I will try to document stuff in this issue when that time comes.
PR #1894 should fix up a lot of the compiler's behavior around these combined types, and those fixes should be available in the v0.19.0 and later releases. However, the change completely overhauls how combined texture/sampler type are written in input code.
Now, given an existing HLSL texture type like Texture2D the equivalent combined texture/sampler type has a name with Sampler in place of Texture. So the equivalent of Texture2D is the combined texture/sampler type Sampler2D.
Similarly, for any operations on a given Texture* type, the equivalent Sampler* type should have the same operations, just with any SamplerState parameter removed.
So if you would write the following with separate textures and samplers:
Texture2D t;
SamplerState s;
float4 test(float2 uv) { return t.Sample(s, uv); }
you would instead write the following to use the new combined types:
Sampler2D s;
float4 test(float2 uv) { return s.Sample(uv); }
Hopefully this large change doesn't cause too much disruption for your codebase @GlaireDaggers. Please feel free to let me know of any issues you run into with the newly re-enabled functionality. It is entirely possible that I've missed some important cases.
Ah, sorry I've been silent for a bit. Been on vacation, just got back last night. Will take a look at this hopefully later tonight or tomorrow! Thanks for looking into it :)