Test if active render target is back buffer
Hi,
What is the proper way to test if the active render target is the back buffer?
Thanks,
james
D3D9:
Use IDirect3DDevice9::GetRenderTarget() to get the currently set render target(s). Then use IDirect3DDevice9::GetBackBuffer() to get the back buffer. Compare the two surfaces (just the pointers will do), if they're equal then the currently set render target is the back buffer.
I'm not sure how to do it in D3D10, since I don't think it makes any particular distinctions between the back buffer and other render targets. Your best bet would probably be to just store the backbuffer's render target view when you create it, and use that for comparisons later on.
Use IDirect3DDevice9::GetRenderTarget() to get the currently set render target(s). Then use IDirect3DDevice9::GetBackBuffer() to get the back buffer. Compare the two surfaces (just the pointers will do), if they're equal then the currently set render target is the back buffer.
I'm not sure how to do it in D3D10, since I don't think it makes any particular distinctions between the back buffer and other render targets. Your best bet would probably be to just store the backbuffer's render target view when you create it, and use that for comparisons later on.
I'd suggest that if possible you track which render target is active yourself. Normally this is possible, since you set them, and would be the fastest and most compatible method of doing this.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement