renderdoc
renderdoc copied to clipboard
Buffer Contents Mesh Preview
It'd be neat if we could preview buffers as a mesh after filling out the struct declaration. Maybe a "Preview as Mesh" button above the apply button?
In Xenia, we've moved from using vertex attributes to dynamic fetches from a shader storage buffer, and that makes RenderDoc's mesh input view unusable :(
I may tackle this myself if I end up really needing this feature.
There's an easy mode and a hard mode for this. Easy mode is just adding direct rendering of the buffer - the core code already is completely abstracted, it just takes a configuration struct like "render a mesh from this buffer with given format, stride, offset etc, with these indices (optionally)", and the UI window is already sharing most of its code between them, it'd just be a matter of un-hiding the preview window and hooking up any code that only activates when in mesh output mode like vertex picking etc.
Hard mode is if you want indices, which I assume in most cases you do. This then becomes really ugly because you have a simple direct single-buffer viewer, which now needs to optionally pull in another buffer. It would need to be explicit rather than implicit, with a button to just import the current index buffer settings or something. Either way it ends up being potentially confusing and complex.
I honestly wonder if it'd be better to do the reverse - allow some way to override the vertex input source used for the 'real' mesh view from the normal pipeline inputs to some other buffer and use the same format specifier. Doing that though you have to wonder whether you'd have to re-specify some offset or something every new drawcall you select.
It's a reasonable request and the technical implementation is super simple, but it ends up being quite a lot of awkward UI questions.
Yeah - it does raise some awkward questions. I would want to pull in indices and it'll get a bit complicated because the buffer contents window is "separate" from the current drawcall.
I had a thought just recently - what if we can use debug tags in Vulkan to specify the (known in advance) layout of a buffer and maybe use it with your third idea? In our case it may be a bit complicated, because we're uploading all vertex data to a single staging buffer, so tags would have to cover certain ranges.
Or - I don't know if this is valid but I thought of just specifying the vertex input layout in the pipeline but not actually using any of that stuff. It was almost working but RenderDoc didn't want to display the data probably because the SPIR-V shader wasn't using any of it.
Yeh, RenderDoc will trim to only those inputs that are actually used.
This could be solved a number of ways if you're willing to add markup code, the debug object tag is probably the simplest way to do that. We could either define a tag on either the pipeline or the shader module that just flips a switch saying 'treat all inputs as used' and then you could specify the vertex input layout and have it appear. Although I don't know what kind of perf impact that has, it's probably minimal and I guess you'd have this as a debug-time option that goes away in release? Otherwise we could always just pass a whole copy of the VkPipelineVertexInputStateCreateInfo
struct as the tag on a pipeline saying "here's what I would have declared", and have RenderDoc pick that up.
Ideally though there'd be a solution that didn't require any special custom code, I'm just not sure what it would look like. It's also a tradeoff since it requires manual configuration at analysis time which might be more repetitive than just implementing some custom code...
One option would be to have a 'show disabled' button in the mesh output window similar to what the pipeline state does, and that would show configured but unused vertex inputs. That wouldn't need any custom markup technically - it just relies on the user over-specifying the pipeline for no reason except to have it available to RenderDoc or other tools.