Skip to content

d3d12: ARB_transform_feedback2 and ARB_transform_feedback3

Jesse Natalie requested to merge jenatali/mesa:d3d12-xfb into main

I was planning to hold off until I added ARB_gpu_shader_fp64 to this, but looks like that's going to be trickier than I thought so I'll send it separately. This is 2 of the remaining 3 extensions required for GL4.0.

The first series of patches robustify our support for manipulating data via compute shaders without bringing it back to the CPU. Since ARB_transform_feedback2 includes support for DrawTransformFeedback (aka DrawAuto in D3D parlance), rather than hacking around and implementing it with CPU readback "for now," let's do it the right way. There's still plenty of CPU readback cases (e.g. prepping a predication buffer, or primconvert) left to go, but let's not add to that debt. Related, it moves the stream output copy-back for handling wide points and edge flags into a compute shader too. This is going to be broken for queries, but not really more/less broken than it is today.

The last piece before ARB_transform_feedback2 is working is fixing how PIPE_QUERY_PRIMITIVES_GENERATED is handled. It wasn't correctly catching the xfb enabled/disabled transitions, and also didn't work correctly in the GS-enabled-but-XFB-disabled scenario.

For ARB_transform_feedback3, this actually starts lighting up multiple GS output streams, even though ARB_gpu_shader5 should've done that first. So, we have to fix a bunch of stuff to actually handle streams. Notably, D3D doesn't support a single varying having components belonging to different streams, so we split up the variables to handle that.

Edited by Jesse Natalie

Merge request reports