mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-30 09:43:45 +01:00
UWP: Fix screen rotation in non-buffered rendering mode
This commit is contained in:
1 parent
234e3b10bd
commit
474db602ca
5 files changed
+22
-12
No files matched your search
@@ -18,6 +18,8 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
#include "base/display.h"
|
||||
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "ShaderUniforms.h"
|
||||
#include "base/display.h"
|
||||
#include "math/dataconv.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "math/math_util.h"
|
||||
@@ -8,6 +9,7 @@
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/Math3D.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/Config.h"
|
||||
|
||||
static void ConvertProjMatrixToVulkan(Matrix4x4 &in) {
|
||||
const Vec3 trans(0, 0, gstate_c.vpZOffset * 0.5f + 0.5f);
|
||||
@@ -78,6 +80,11 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
||||
} else {
|
||||
ConvertProjMatrixToVulkan(flippedMatrix);
|
||||
}
|
||||
|
||||
if (g_Config.iRenderingMode == 0 && g_display_rotation != DisplayRotation::ROTATE_0) {
|
||||
flippedMatrix = flippedMatrix * g_display_rot_matrix;
|
||||
}
|
||||
|
||||
CopyMatrix4x4(ub->proj, flippedMatrix.getReadPtr());
|
||||
}
|
||||
|
||||
@@ -88,6 +95,9 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView
|
||||
} else {
|
||||
proj_through.setOrthoVulkan(0.0f, gstate_c.curRTWidth, 0, gstate_c.curRTHeight, 0, 1);
|
||||
}
|
||||
if (g_Config.iRenderingMode == 0 && g_display_rotation != DisplayRotation::ROTATE_0) {
|
||||
proj_through = proj_through * g_display_rot_matrix;
|
||||
}
|
||||
CopyMatrix4x4(ub->proj_through, proj_through.getReadPtr());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
#include "Globals.h"
|
||||
#include "GPU/Common/ShaderCommon.h"
|
||||
#include "GPU/Common/ShaderId.h"
|
||||
// #include "GPU/DX9/VertexShaderGeneratorD3D11.h"
|
||||
// #include "GPU/DX9/FragmentShaderGeneratorD3D11.h"
|
||||
#include "math/lin/matrix4x4.h"
|
||||
#include "GPU/Common/ShaderUniforms.h"
|
||||
|
||||
class D3D11Context;
|
||||
|
||||
@@ -320,7 +320,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
gstate_c.Dirty(DIRTY_DEPTHRANGE);
|
||||
}
|
||||
|
||||
D3D11_VIEWPORT &vp = dynState_.viewport;
|
||||
Draw::Viewport &vp = dynState_.viewport;
|
||||
vp.TopLeftX = vpAndScissor.viewportX;
|
||||
vp.TopLeftY = vpAndScissor.viewportY;
|
||||
vp.Width = vpAndScissor.viewportW;
|
||||
@@ -443,19 +443,20 @@ void DrawEngineD3D11::ApplyDrawStateLate(bool applyStencilRef, uint8_t stencilRe
|
||||
if (!gstate.isModeClear()) {
|
||||
if (fboTexNeedBind_) {
|
||||
framebufferManager_->BindFramebufferAsColorTexture(1, framebufferManager_->GetCurrentRenderVFB(), BINDFBCOLOR_MAY_COPY);
|
||||
// No sampler required, we do a Load in the pixel shader
|
||||
// context_->PSSetSamplers(1, 1, &stockD3D11.samplerPoint2DClamp);
|
||||
// No sampler required, we do a plain Load in the pixel shader.
|
||||
fboTexBound_ = true;
|
||||
fboTexNeedBind_ = false;
|
||||
}
|
||||
textureCache_->ApplyTexture();
|
||||
}
|
||||
|
||||
// Need to do this AFTER ApplyTexture because the process of depalettization can ruin the blend state.
|
||||
// Need to do this AFTER ApplyTexture because the process of depallettization can ruin the blend state.
|
||||
float blendColor[4];
|
||||
Uint8x4ToFloat4(blendColor, dynState_.blendColor);
|
||||
context_->RSSetViewports(1, &dynState_.viewport);
|
||||
context_->RSSetScissorRects(1, &dynState_.scissor);
|
||||
|
||||
// we go through Draw here because it automatically handles screen rotation, as needed in UWP on mobiles.
|
||||
draw_->SetViewports(1, &dynState_.viewport);
|
||||
draw_->SetScissorRect(dynState_.scissor.left, dynState_.scissor.top, dynState_.scissor.right - dynState_.scissor.left, dynState_.scissor.bottom - dynState_.scissor.top);
|
||||
context_->RSSetState(rasterState_);
|
||||
if (device1_) {
|
||||
context1_->OMSetBlendState(blendState1_, blendColor, 0xFFFFFFFF);
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include <cstdint>
|
||||
#include <d3d11.h>
|
||||
|
||||
#include "thin3d/thin3d.h"
|
||||
|
||||
// TODO: Do this more progressively. No need to compute the entire state if the entire state hasn't changed.
|
||||
// In Vulkan, we simply collect all the state together into a "pipeline key" - we don't actually set any state here
|
||||
// (the caller is responsible for setting the little dynamic state that is supported, dynState).
|
||||
|
||||
struct D3D11BlendKey {
|
||||
union {
|
||||
@@ -67,6 +67,6 @@ struct D3D11DynamicState {
|
||||
uint32_t blendColor;
|
||||
bool useStencil;
|
||||
uint8_t stencilRef;
|
||||
D3D11_VIEWPORT viewport;
|
||||
Draw::Viewport viewport;
|
||||
D3D11_RECT scissor;
|
||||
};
|
||||
Reference in new issue
Block a user