Skip to content

New texture overlay

baldurk edited this page Apr 17, 2014 · 1 revision

The texture overlays (depth test, stencil test, wireframe etc) are a fairly simple application of replaying a log and doing some simple analysis on it.

These are implemented by configuring the TextureDisplay passed to the ReplayOutput corresponding to the texture viewer's output. In it you can set the overlay member to one of the enum values. This then gets implemented wherever the driver implements it (handled by the RemoteDriver).

The replay layer does some handling of dirty states and flags to avoid re-rendering the overlay as much as possible. Only when necessary does it call RenderOverlay to avoid having to do potentially expensive work when nothing has changed that would affect the overlay - things like zooming, changing ranges or channel masks, etc. The implementation of RenderOverlay returns a ResourceId that corresponds to a texture which can be rendered with ``RenderTexture` to display the overlay on an output.

D3D11

The implementation lives in d3d11_analyse.cpp. Not all of the overlays diverge - e.g. depth & stencil overlays work very similarly. Essentially we replay the log up to the drawcall, save off the depthstencil target contents, then run the drawcall twice with different depth tests and a pixel shader that outputs a solid colour each time.

The depth test renders failing pixels first then overdraws with passing pixels, as this convention tends to make more intuitive sense - for pixels that have fragments both passing and failing, both red or green are slightly misleading.

Clone this wiki locally