I have encountered a synchronization or corruption bug which seems to be a driver issue (on 3080 12GB, Windows 11). This only happens when descriptor buffers are used.
Some resources written to at the start of frame flash to black every now and then. There are a couple of ways to stop this:
- Use normal descriptor sets, this should not change anything if it was a user error, but it does.
- In my case, enabling async compute fixes it too, presumably since then timeline semaphores are used for synchronization and that properly synchronizes.
I have tried multiple driver versions: 616.92, 616.64 and the one before that, all have the issue. If I go back further: 595.71 also has the issue, 581.80 also has, but this one actually crashes with something like:
```
Address Info (0):
Address Type: VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_FAULT_EXT
Reported Address: 0x1701278b10
Address Precision: 0x10
Address Range (computed from address and precision): [0x1701278b10, 0x1701278b1f]
```
The shader shows compute @ (the address) but the shader type says: [NVIDIA Internal]
560.94 also crashes the same way.
If I make sure to wait on all GPU work to be done before submitting a frame it also seems to be gone, however adding ALL_COMMANDS memory barriers between usage and creation of the resources does not help at all, even though they are all submitted on the same queue. There are already a sufficient amount of barriers for synchronization, but even with the ALL_COMMANDS on top, it does not fix it. The synchronization + GPU-assisted validation layers also show no synchronization issues.
I also tried switching to a stable descriptor buffer (one that contains all global resources), which means that it does not get filled wth resources every frame, and using an index to access that resource, but that did not change anything.
What makes me more sure this is a driver bug is (aside from that normal descriptor sets do not have this issue), although very rarely, sometimes it also flickers when these resources come from external (IBL) resources, which are created on application load and never written to again, so there should be no synchronization issues there. And these resources are also the only thing that causes flicker in the entire frame, as when not used (still put in a descriptor, but just their contribution in the shader to 0) then it does not flash or flicker anymore, all other resources (even ones that are made later in the frame) are all fine.
Capturing the recording with RenderDoc or NSight Graphics also shows the flashing to black, when captured the tumbnail also shows the blacked out final result, but when debugging it pretends that the flashing to black did not happen, although NSIght Graphics, when displaying the color attachment, actually flickers too, but not to black:
(NSight Graphics tumbnail)
Capturing actually did not work for some time due to the descriptor buffer capture replay bug, however it worked again this time. However, after I found out I was using sub-optimal memory type for descriptor buffers, (USING HOST_CACHED) I changed that and the capture replay bug (at least in RenderDoc) came back, which was not an issue when I went back to driver 581.80.
If the capture or crash dump is wanted I can share that privately.
