MoltenVK
MoltenVK copied to clipboard
Bindless textures not always work with 1.2.10 on mac
Hello. Thank you so much for the recent fixes to argument buffers and especially argument buffers for iOS support! Unfortunately I still have some issues with bindless textures which prevents me from upgrading from version 1.2.4 which was the last one I could use.
Short version: In some renderer passes sampling bindless textures returns 0s with 1.2.10 where it has worked just fine with MoltenVK 1.2.4. macOS 14.5, Macbook 1m Max
Long version: I have an array of textures (the one with update-after-bind flag), and an array of materials where texture index is an index in that array of textures for every material. So, in some cases sampling a texture returns only 0s - e.g. in shadow map pass I get 0s, while in GBuffer pass I get valid values for the same mask texture.
What is different in 1.2.10 compared to 1.2.4 is that in Xcode shader debugger, array of textures is shown to have only one item, while with version 1.2.4 it shows it's complete size with valid textures in all the used indices. It's spvDescriptorSet1
on the screenshot:
Textures addressed by the indices > 0 in this shader return only 0s while sampling. If I hardcode index 0, sampling returns expected values for the texture with index 0. But this happens only in some render passes, although they share the same code for binding resources and binding declaration in shaders with the other render passes that work. Shader debugger shows only one element in array of textures in working passes too though, and it also shows 0s returned by sampling but in the end values are correct. So I don't trust Xcode shader debugger any more.
Interesting is that Xcode capture memory viewer displays the array with textures as expected - they are all present there in 1.2.10. But not in 1.2.4 - although all render passes work, memory viewer shows only a couple on nulls in the array.
Summary:
- Argument buffer with textures has only 1 element in shader debugger
- This argument buffer has correct contents with 62 textures in memory view
- Some render passes access data with index > 0 from that argument buffer work, some not
- The ones that don't work still can sample texture at index 0 if hardcoded
- Both working and broken render passes share the same code for render pass bindings setup and the same shader code for resources access
Help. I don't have a repro case code I can publish unfortunately.