Skip to content

zink: fix sampler array collision in `nir_to_spirv`

Antonino Maniscalco requested to merge antonino/mesa:bindlessfix into main

nir_to_spirv has flat arrays to map driver_location to sampler variables.

Now when bindless textures are used together with non binless textures the sampler vars are in different descriptor sets and the binding can be the same between different descriptor sets, this causes a collision in arrays.

This patches chamges nir_to_spirv to also index the array by whether the texture is bindless.

This patch is marked as a draft because I wasn't sure on what the best solution would be. I'd apreciate some feedback. Also if the solution of indexing the array by whether the texture is bindless is acceptable the code needs to be improved. Right now in some places it just checks whether the type is array, assuming that the only time sampler array are used are for emulating bindless. this is an hack.

This fixes a bug in this quake engine https://github.com/andrei-drexler/ironwail which uses regular textures for light maps and bindless textures for albedo (called fullbright in quake terms).

On zink the lightmap would either appear as black or glitcy.

Closes: #8364 (closed)

Edited by Antonino Maniscalco

Merge request reports