mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Improve overlay format handling
This commit is contained in:
@@ -816,6 +816,7 @@ void D3D11VARenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||||||
|
|
||||||
// Create a texture with our pixel data
|
// Create a texture with our pixel data
|
||||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||||
|
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||||
|
|
||||||
D3D11_TEXTURE2D_DESC texDesc = {};
|
D3D11_TEXTURE2D_DESC texDesc = {};
|
||||||
texDesc.Width = newSurface->w;
|
texDesc.Width = newSurface->w;
|
||||||
|
|||||||
@@ -834,19 +834,9 @@ void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSurface->pitch == lockedRect.Pitch) {
|
// Copy (and convert, if necessary) the surface pixels to the texture
|
||||||
// If the pitch matches, we can take the fast path and use a single copy to transfer the pixels
|
SDL_ConvertPixels(newSurface->w, newSurface->h, newSurface->format->format, newSurface->pixels,
|
||||||
RtlCopyMemory(lockedRect.pBits, newSurface->pixels, newSurface->pitch * newSurface->h);
|
newSurface->pitch, SDL_PIXELFORMAT_ARGB8888, lockedRect.pBits, lockedRect.Pitch);
|
||||||
}
|
|
||||||
else {
|
|
||||||
// If the pitch doesn't match, we'll need to copy each row separately
|
|
||||||
int pitch = SDL_min(newSurface->pitch, lockedRect.Pitch);
|
|
||||||
for (int i = 0; i < newSurface->h; i++) {
|
|
||||||
RtlCopyMemory(((PUCHAR)lockedRect.pBits) + (lockedRect.Pitch * i),
|
|
||||||
((PUCHAR)newSurface->pixels) + (newSurface->pitch * i),
|
|
||||||
pitch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newTexture->UnlockRect(0);
|
newTexture->UnlockRect(0);
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ void EGLRenderer::renderOverlay(Overlay::OverlayType type)
|
|||||||
SDL_Surface* newSurface = Session::get()->getOverlayManager().getUpdatedOverlaySurface(type);
|
SDL_Surface* newSurface = Session::get()->getOverlayManager().getUpdatedOverlaySurface(type);
|
||||||
if (newSurface != nullptr) {
|
if (newSurface != nullptr) {
|
||||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||||
|
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, m_OverlayTextures[type]);
|
glBindTexture(GL_TEXTURE_2D, m_OverlayTextures[type]);
|
||||||
|
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ void VDPAURenderer::notifyOverlayUpdated(Overlay::OverlayType type)
|
|||||||
|
|
||||||
if (newSurface != nullptr) {
|
if (newSurface != nullptr) {
|
||||||
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
SDL_assert(!SDL_MUSTLOCK(newSurface));
|
||||||
|
SDL_assert(newSurface->format->format == SDL_PIXELFORMAT_ARGB8888);
|
||||||
|
|
||||||
VdpBitmapSurface newBitmapSurface = 0;
|
VdpBitmapSurface newBitmapSurface = 0;
|
||||||
status = m_VdpBitmapSurfaceCreate(m_Device,
|
status = m_VdpBitmapSurfaceCreate(m_Device,
|
||||||
|
|||||||
Reference in New Issue
Block a user