Skip to content

Commit 7b1f766

Browse files
committed
Fix dxGetTexturePixels/dxSetTexturePixels failing on browser elements
1 parent 543b4e1 commit 7b1f766

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Client/core/Graphics/CPixelsManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ bool CPixelsManager::GetTexturePixels(IDirect3DBaseTexture9* pD3DBaseTexture, CP
126126
bResult = SetPlainDimensions(outPixels, uiPixelsWidth, uiPixelsHeight);
127127
}
128128
}
129-
else if (Desc.Usage == 0)
129+
// Handle any non-rendertarget usage so D3DUSAGE_DYNAMIC textures (e.g. CEF browsers since PR #4634) go through the lockable path.
130+
else if ((Desc.Usage & D3DUSAGE_RENDERTARGET) == 0)
130131
{
131132
if (pixelsFormat != EPixelsFormat::PLAIN)
132133
return D3DXGetSurfacePixels(pD3DSurface, outPixels, pixelsFormat, renderFormat, bMipMaps, pRect);
@@ -204,7 +205,8 @@ bool CPixelsManager::SetTexturePixels(IDirect3DBaseTexture9* pD3DBaseTexture, co
204205
if (FAILED(D3DXLoadSurfaceFromSurface(pD3DSurface, NULL, NULL, pLockableSurface, NULL, NULL, D3DX_FILTER_NONE, 0)))
205206
return false;
206207
}
207-
else if (Desc.Usage == 0)
208+
// Handle any non-rendertarget usage so D3DUSAGE_DYNAMIC textures (e.g. CEF browsers since PR #4634) go through the lockable path.
209+
else if ((Desc.Usage & D3DUSAGE_RENDERTARGET) == 0)
208210
{
209211
if (Desc.Format == D3DFMT_A8R8G8B8 || Desc.Format == D3DFMT_X8R8G8B8 || Desc.Format == D3DFMT_R5G6B5)
210212
{

0 commit comments

Comments
 (0)