Skip to content

Fetching pixel data

baldurk edited this page Apr 17, 2014 · 1 revision

Assuming that you have a ReplayRenderer pointer then you can fetch the current (relative to the current event) contents of a texture by using the ReplayOutput_PickPixel function, which takes a texture ID and location to specify. You can also choose to include or not include the results of the custom shader that's currently set to that output.

D3D11

This is implemented by calling into RenderTexture with raw unmodified, unclamped etc settings while outputting to a 1x1 texture, which we then map back to CPU side and readback to return to the caller.

The RenderTexture function is also used for displaying textures onto output windows, and does a lot of work to determine how to best bind the texture and set up the texture display shader. The meat of this work is done inside D3D11DebugManager::GetShaderDetails.

The D3D11DebugManager::GetShaderDetails function finds the texture specified by an ID and generates SRVs and a struct containing the metadata that's used to configure the shader. In the case of textures that can't be bound directly for SRV it will generate a preview resource and copy the data in. It also makes sure to handle any format conversions including picking an appropriate typed format when it encounters a typeless texture.

Clone this wiki locally