mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-18 21:27:52 +00:00
Avoid rotating the image when DrawActiveTexture is used for other things than drawing to the backbuffer.
This commit is contained in:
parent
ee294251c9
commit
b5ad92b9ef
@ -725,6 +725,7 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
|
||||
float u0 = 0.0f, u1 = 1.0f;
|
||||
float v0 = 0.0f, v1 = 1.0f;
|
||||
|
||||
DrawTextureFlags flags = (vfb || g_Config.iBufFilter == SCALE_LINEAR) ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
if (useBufferedRendering_ && vfb && vfb->fbo) {
|
||||
draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::KEEP, Draw::RPAction::KEEP, Draw::RPAction::KEEP });
|
||||
SetViewport2D(0, 0, vfb->renderWidth, vfb->renderHeight);
|
||||
@ -733,6 +734,7 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
|
||||
// We are drawing to the back buffer so need to flip.
|
||||
if (needBackBufferYSwap_)
|
||||
std::swap(v0, v1);
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
float x, y, w, h;
|
||||
CenterDisplayOutputRect(&x, &y, &w, &h, 480.0f, 272.0f, (float)pixelWidth_, (float)pixelHeight_, ROTATION_LOCKED_HORIZONTAL);
|
||||
SetViewport2D(x, y, w, h);
|
||||
@ -741,7 +743,6 @@ void FramebufferManagerCommon::DrawPixels(VirtualFramebuffer *vfb, int dstX, int
|
||||
|
||||
MakePixelTexture(srcPixels, srcPixelFormat, srcStride, width, height, u1, v1);
|
||||
|
||||
DrawTextureFlags flags = (vfb || g_Config.iBufFilter == SCALE_LINEAR) ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
Bind2DShader();
|
||||
DrawActiveTexture(dstX, dstY, width, height, vfb->bufferWidth, vfb->bufferHeight, u0, v0, u1, v1, ROTATION_LOCKED_HORIZONTAL, flags);
|
||||
gpuStats.numUploads++;
|
||||
@ -808,6 +809,7 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, GEBu
|
||||
std::swap(v0, v1);
|
||||
|
||||
DrawTextureFlags flags = g_Config.iBufFilter == SCALE_LINEAR ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
if (cardboardSettings.enabled) {
|
||||
// Left Eye Image
|
||||
SetViewport2D(cardboardSettings.leftEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight);
|
||||
@ -975,10 +977,11 @@ void FramebufferManagerCommon::CopyDisplayToOutput() {
|
||||
draw_->BindFramebufferAsRenderTarget(nullptr, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR });
|
||||
draw_->BindFramebufferAsTexture(vfb->fbo, 0, Draw::FB_COLOR_BIT, 0);
|
||||
draw_->SetScissorRect(0, 0, pixelWidth_, pixelHeight_);
|
||||
Bind2DShader();
|
||||
DrawTextureFlags flags = g_Config.iBufFilter == SCALE_LINEAR ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
// We are doing the DrawActiveTexture call directly to the backbuffer here. Hence, we must
|
||||
// flip V.
|
||||
Bind2DShader();
|
||||
if (needBackBufferYSwap_)
|
||||
std::swap(v0, v1);
|
||||
if (cardboardSettings.enabled) {
|
||||
@ -1007,6 +1010,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput() {
|
||||
CalculatePostShaderUniforms(vfb->bufferWidth, vfb->bufferHeight, renderWidth_, renderHeight_, &uniforms);
|
||||
BindPostShader(uniforms);
|
||||
DrawTextureFlags flags = g_Config.iBufFilter == SCALE_LINEAR ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
DrawActiveTexture(0, 0, fbo_w, fbo_h, fbo_w, fbo_h, 0.0f, 0.0f, 1.0f, 1.0f, ROTATION_LOCKED_HORIZONTAL, flags);
|
||||
|
||||
draw_->SetScissorRect(0, 0, pixelWidth_, pixelHeight_);
|
||||
@ -1026,6 +1030,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput() {
|
||||
std::swap(v0, v1);
|
||||
Bind2DShader();
|
||||
flags = (!postShaderIsUpscalingFilter_ && g_Config.iBufFilter == SCALE_LINEAR) ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
if (g_Config.bEnableCardboard) {
|
||||
// Left Eye Image
|
||||
SetViewport2D(cardboardSettings.leftEyeXPosition, cardboardSettings.screenYPosition, cardboardSettings.screenWidth, cardboardSettings.screenHeight);
|
||||
@ -1049,6 +1054,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput() {
|
||||
if (needBackBufferYSwap_)
|
||||
std::swap(v0, v1);
|
||||
DrawTextureFlags flags = (!postShaderIsUpscalingFilter_ && g_Config.iBufFilter == SCALE_LINEAR) ? DRAWTEX_LINEAR : DRAWTEX_NEAREST;
|
||||
flags = (DrawTextureFlags)(flags | DRAWTEX_TO_BACKBUFFER);
|
||||
|
||||
PostShaderUniforms uniforms{};
|
||||
CalculatePostShaderUniforms(vfb->bufferWidth, vfb->bufferHeight, vfb->renderWidth, vfb->renderHeight, &uniforms);
|
||||
|
@ -155,6 +155,7 @@ enum DrawTextureFlags {
|
||||
DRAWTEX_LINEAR = 1,
|
||||
DRAWTEX_KEEP_TEX = 2,
|
||||
DRAWTEX_KEEP_STENCIL_ALPHA = 4,
|
||||
DRAWTEX_TO_BACKBUFFER = 8,
|
||||
};
|
||||
|
||||
enum class TempFBO {
|
||||
|
@ -303,7 +303,7 @@ void FramebufferManagerVulkan::DrawActiveTexture(float x, float y, float w, floa
|
||||
vtx[i].y = vtx[i].y * invDestH - 1.0f;
|
||||
}
|
||||
|
||||
if (g_display_rotation != DisplayRotation::ROTATE_0) {
|
||||
if ((flags & DRAWTEX_TO_BACKBUFFER) && g_display_rotation != DisplayRotation::ROTATE_0) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
// backwards notation, should fix that...
|
||||
Vec3 v(vtx[i].x, vtx[i].y, 0.0f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user