mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-24 19:45:35 +00:00
Fixed bug 2685 - SDL_RenderReadPixels() doesn't work with offscreen targets
Andreas Falkenhahn SDL_RenderReadPixels() doesn't seem to work when trying to read pixels from a texture that has been created using SDL_TEXTUREACCESS_TARGET and has been selected as the render target using SDL_SetRenderTarget(). I am attaching a small program that demonstrates the issue. I get the following result here: READ PIXEL RETURN: 0 --- COLOR CHECK: ff000000 But it should be: READ PIXEL RETURN: 0 --- COLOR CHECK: ffff0000 Tested with SDL 2.0.3 on Windows 7.
This commit is contained in:
parent
2e3c778ef5
commit
de3d381cb6
|
@ -1831,9 +1831,10 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
D3DLOCKED_RECT locked;
|
||||
HRESULT result;
|
||||
|
||||
result = IDirect3DDevice9_GetBackBuffer(data->device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("GetBackBuffer()", result);
|
||||
if (data->currentRenderTarget) {
|
||||
backBuffer = data->currentRenderTarget;
|
||||
} else {
|
||||
backBuffer = data->defaultRenderTarget;
|
||||
}
|
||||
|
||||
result = IDirect3DSurface9_GetDesc(backBuffer, &desc);
|
||||
|
@ -1874,7 +1875,6 @@ D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|||
IDirect3DSurface9_UnlockRect(surface);
|
||||
|
||||
IDirect3DSurface9_Release(surface);
|
||||
IDirect3DSurface9_Release(backBuffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue