GPU: Use a texture directly for MakePixelTexture.

This makes it easier to do things with it.
This commit is contained in:
Unknown W. Brackets 2020-05-11 09:47:26 -07:00
parent 2653e50200
commit 762b656ea2
20 changed files with 317 additions and 315 deletions

View file

@ -662,11 +662,16 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
draw_->SetScissorRect(0, 0, pixelWidth_, pixelHeight_);
}
MakePixelTexture(srcPixels, srcPixelFormat, srcStride, width, height, u1, v1);
Draw::Texture *pixelsTex = MakePixelTexture(srcPixels, srcPixelFormat, srcStride, width, height, u1, v1);
if (pixelsTex) {
draw_->BindTextures(0, 1, &pixelsTex);
Bind2DShader();
DrawActiveTexture(dstX, dstY, width, height, vfb->bufferWidth, vfb->bufferHeight, u0, v0, u1, v1, ROTATION_LOCKED_HORIZONTAL, flags);
gpuStats.numUploads++;
Bind2DShader();
DrawActiveTexture(dstX, dstY, width, height, vfb->bufferWidth, vfb->bufferHeight, u0, v0, u1, v1, ROTATION_LOCKED_HORIZONTAL, flags);
gpuStats.numUploads++;
pixelsTex->Release();
}
}
void FramebufferManagerCommon::CopyFramebufferForColorTexture(VirtualFramebuffer *dst, VirtualFramebuffer *src, int flags) {
@ -701,7 +706,10 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
float u0 = 0.0f, u1 = 480.0f / 512.0f;
float v0 = 0.0f, v1 = 1.0f;
MakePixelTexture(srcPixels, srcPixelFormat, srcStride, 512, 272, u1, v1);
Draw::Texture *pixelsTex = MakePixelTexture(srcPixels, srcPixelFormat, srcStride, 512, 272, u1, v1);
if (!pixelsTex)
return;
draw_->BindTextures(0, 1, &pixelsTex);
int uvRotation = useBufferedRendering_ ? g_Config.iInternalScreenRotation : ROTATION_LOCKED_HORIZONTAL;
// TODO: Currently we can't access the texture from Draw.
@ -712,6 +720,9 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
Bind2DShader();
if (needBackBufferYSwap_)
std::swap(v0, v1);
DrawTextureFlags flags = g_Config.iBufFilter == SCALE_LINEAR ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
flags = flags | DRAWTEX_TO_BACKBUFFER;
SetViewport2D(0, 0, pixelWidth_, pixelHeight_);
@ -735,6 +746,8 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
presentation_->CopyToOutput(flags, uvRotation, u0, v0, u1, v1, uniforms);
}*/
pixelsTex->Release();
// PresentationCommon sets all kinds of state, we can't rely on anything.
gstate_c.Dirty(DIRTY_ALL);
}