Skip to content

mesa/st: Normalize wrap modes for seamless cubes

Alyssa Rosenzweig requested to merge alyssa/mesa:mesa-st/normalize-wrap into main

The OpenGL specification requires that seamless cube maps ignore the wrap mode, but some hardware may try to respect the wrap mode even for seamless cubes contrary to the spec. Since OpenGL maps samplers 1:1 to textures (at least without bindless texture support...), it's easy to override the wrap mode for seamless cubes to something sane for the hardware.

I'm not sure if there is value in gating this behaviour behind a CAP. On one hand, there is a tiny bit of extra CPU overhead added to change samplers. On the other hand, normalizing wrap modes might improve CSO caching, and normalizing to a non-BORDER mode avoids the expensive border colour code later in the function.

We will need a different workaround in our Vulkan driver. Potentially, we'll have to duplicate every sampler to have a cubemap version and a non-cubemap version, selecting a sampler in the shader based on the texture opcode. That sucks and implementing it would depend on subtle details of how we implement descriptor sets, so it's not like we would share that code with the GL driver anyway. In the mean time, let's get this right for GL without the performance hit of duplication.

Fixes dEQP-GLES3.functional.texture.filtering.cube.* on Asahi.


I'm so sorry.

Merge request reports