mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
dxgsg9: Implement ability to get screenshot from multisample backbuffer
Fixes #1225
This commit is contained in:
parent
ce0d020cfd
commit
ecc6fb6b0c
@ -2070,6 +2070,35 @@ do_framebuffer_copy_to_ram(Texture *tex, int view, int z,
|
|||||||
|
|
||||||
backbuffer -> GetDesc (&surface_description);
|
backbuffer -> GetDesc (&surface_description);
|
||||||
|
|
||||||
|
// We can't directly call GetRenderTargetData on a multisampled buffer.
|
||||||
|
// Instead, blit it into a temporary target.
|
||||||
|
if (surface_description.MultiSampleType != D3DMULTISAMPLE_NONE) {
|
||||||
|
IDirect3DSurface9 *resolved;
|
||||||
|
hr = _d3d_device->CreateRenderTarget(surface_description.Width,
|
||||||
|
surface_description.Height,
|
||||||
|
surface_description.Format,
|
||||||
|
D3DMULTISAMPLE_NONE, 0, FALSE,
|
||||||
|
&resolved, nullptr);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
dxgsg9_cat.error()
|
||||||
|
<< "CreateRenderTarget failed" << D3DERRORSTRING(hr) << "\n";
|
||||||
|
backbuffer->Release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_d3d_device->StretchRect(backbuffer, nullptr, resolved, nullptr, D3DTEXF_NONE);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
dxgsg9_cat.error()
|
||||||
|
<< "StretchRect failed" << D3DERRORSTRING(hr) << "\n";
|
||||||
|
backbuffer->Release();
|
||||||
|
resolved->Release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
backbuffer->Release();
|
||||||
|
backbuffer = resolved;
|
||||||
|
}
|
||||||
|
|
||||||
pool = D3DPOOL_SYSTEMMEM;
|
pool = D3DPOOL_SYSTEMMEM;
|
||||||
hr = _d3d_device->CreateOffscreenPlainSurface(
|
hr = _d3d_device->CreateOffscreenPlainSurface(
|
||||||
surface_description.Width,
|
surface_description.Width,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user