Description
I prototyped a hack that replaces textures with checkerboard pattern for DirectX 11. A lot of people showed interest in this and I decided it's worth making a feature request.
The way it works in my hack is by supporting a set of replaced ResourceIds and a cache for ResourceId->SRV and then checking for that mapping in places like this for VS, CS and PS. The result is that the replacement texture now appears on all render targets and on the thumbnails. It doesn't alter the UAVs and RTVs, just SRV replacement.
I don't have enough experience with the sources so I don't know what is the best architecture for such a feature. But I do have an approximate list of UI knobs:
- Select the checkerboard parameters: 1st value, 2nd value, step in pixels
- Not sure how to set up values for different types. In my example I restricted to 32bit per pixel
- Select the checkerboard format i.e. R32_FLOAT, R8G8B8A8_UNORM etc
- A button to remove all replacements
- A button to update all replacements with new parameters
- A context menu item for the selected texture
A more advanced approach would be to dispatch a compute shader and bind the copied texture as a UAV, in that way the user can choose it's own pattern or even replace only part of the texture without being restricted to the checkerboard. This is similar to the custom visualization shaders with an extra step of replacement.
Thanks
Example(the captured frame is unrelevant):
https://youtu.be/mwFNchuA4jc