[RADV] slice 1 stencil of depth/stencil 2D array textures with mips is corrupted
If I create a depth/stencil texture with array slices and mips, the stencil in slice 1 seems to come out as corrupted. Sometimes it will contain garbage, other times just black.
The demo does roughly:
- Set up FB/RP to render to depth/stencil of one slice at once.
- Render to each slice, with LOAD_OP=CLEAR, draw two quads with different stencil refs that each discard half of the quad. Each slice has different stencil ref pairs (and clear colour).
- Loop, displaying the stencil of each slice to the screen.
It should look like this:
but it will look like this instead:
or sometimes just black.
Even though mips don't take part in the writing/reading (all views are base=0 mipcount=1) the bug does not repro if the image has no mips.
I've modified one of my test programs which should be hopefully easy to compile. If you have trouble I can extract it out into a standalone project. This patch: vk_corrupt_stencil_slice1.patch will apply over latest renderdoc git (82745ce), then you can build the cmake project in util/test/demos/
and run ./demos_x64 VK_Simple_Triangle
. You'll need either one of glslc
or glslangValidator
in your path to compile the shaders, but then it will run as above.
In case it's more convenient, I've attached a renderdoc capture: vk_corrupt_stencil_slice1_repro.rdc of the demo from Polaris. This is a capture of the initialisation & first frame render, so if you open it in renderdoc you'll see the depth-only pass, and the second render pass to slice 1 shows inconsistent data for the stencil.
Tested on mesa git @ 02dd1fb8 on an AMD RX 480.