diff --git a/GPU/Common/ShaderUniforms.cpp b/GPU/Common/ShaderUniforms.cpp index c8b3d6c66d..75e9fd1344 100644 --- a/GPU/Common/ShaderUniforms.cpp +++ b/GPU/Common/ShaderUniforms.cpp @@ -146,7 +146,8 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView FlipProjMatrix(flippedMatrix); ConvertProjMatrixToZeroToOneDepth(flippedMatrix); CopyMatrix4x4(ub->proj, flippedMatrix.getReadPtr()); - UpdateRotation(ub->rotation, useBufferedRendering); // TODO: This can be done a lot less often. + + ub->rotation = useBufferedRendering ? 0 : (float)g_display.rotation; } if (dirtyUniforms & DIRTY_PROJTHROUGHMATRIX) { @@ -160,7 +161,8 @@ void BaseUpdateUniforms(UB_VS_FS_Base *ub, uint64_t dirtyUniforms, bool flipView } CopyMatrix4x4(ub->proj_through, proj_through.getReadPtr()); - UpdateRotation(ub->rotation, useBufferedRendering); // TODO: This can be done a lot less often. + + ub->rotation = useBufferedRendering ? 0 : (float)g_display.rotation; } // Transform diff --git a/GPU/Common/ShaderUniforms.h b/GPU/Common/ShaderUniforms.h index 2a019c9db6..a63b12e2e0 100644 --- a/GPU/Common/ShaderUniforms.h +++ b/GPU/Common/ShaderUniforms.h @@ -25,7 +25,6 @@ struct alignas(16) UB_VS_FS_Base { float view[12]; float world[12]; float tex[12]; - float rotation[4]; float uvScaleOffset[4]; float depthRange[4]; float matAmbient[4]; @@ -40,11 +39,11 @@ struct alignas(16) UB_VS_FS_Base { float texClamp[4]; float texClampOffset[2]; float fogCoef[2]; float blendFixA[3]; float stencilReplaceValue; - float blendFixB[3]; float padding3; + float blendFixB[3]; float rotation; // VR stuff is to go here, later. For normal drawing, we can then get away // with just uploading the first 448 bytes of the struct (up to and including fogCoef). }; -static_assert(sizeof(UB_VS_FS_Base) == 496, "UB_VS_FS_Base should be 496 bytes"); +static_assert(sizeof(UB_VS_FS_Base) == 480, "UB_VS_FS_Base should be 480 bytes"); static const char * const ub_baseStr = R"( mat4 u_proj; @@ -52,7 +51,6 @@ R"( mat4 u_proj; mat3x4 u_view; mat3x4 u_world; mat3x4 u_texmtx; - vec4 u_rotation; vec4 u_uvscaleoffset; vec4 u_depthRange; vec4 u_matambientalpha; @@ -68,7 +66,7 @@ R"( mat4 u_proj; vec4 u_texclamp; vec2 u_texclampoff; vec2 u_fogcoef; vec3 u_blendFixA; float u_stencilReplaceValue; - vec3 u_blendFixB; float pad3; + vec3 u_blendFixB; float u_rotation; )"; // 512 bytes. Would like to shrink more. Some colors only have 8-bit precision and we expand diff --git a/GPU/Common/VertexShaderGenerator.cpp b/GPU/Common/VertexShaderGenerator.cpp index f2540a5fc1..52295fb9c2 100644 --- a/GPU/Common/VertexShaderGenerator.cpp +++ b/GPU/Common/VertexShaderGenerator.cpp @@ -1264,8 +1264,12 @@ bool GenerateVertexShader(const VShaderID &id, char *buffer, const ShaderLanguag if (compat.shaderLanguage == GLSL_VULKAN && gstate_c.Use(GPU_USE_PRE_ROTATION)) { // Apply rotation from the uniform. - // TODO: This is only needed on platforms that support pre-rotation, and only in skip buffer effects mode. - WRITE(p, " outPos.xy = mul(mat2(u_rotation), outPos.xy);\n"); + WRITE(p, " mat2 displayRotation = mat2(\n"); + WRITE(p, " u_rotation == 0.0 ? 1.0 : (u_rotation == 2.0 ? -1.0 : 0.0), u_rotation == 1.0 ? 1.0 : (u_rotation == 3.0 ? -1.0 : 0.0),\n"); + WRITE(p, " u_rotation == 3.0 ? 1.0 : (u_rotation == 1.0 ? -1.0 : 0.0), u_rotation == 0.0 ? 1.0 : (u_rotation == 2.0 ? -1.0 : 0.0)\n"); + WRITE(p, " );\n"); + + WRITE(p, " outPos.xy = mul(displayRotation, outPos.xy);\n"); } bool flipY = strlen(compat.viewportYSign) > 0; diff --git a/GPU/Vulkan/TextureCacheVulkan.h b/GPU/Vulkan/TextureCacheVulkan.h index b1d5abd8db..20c5bbe299 100644 --- a/GPU/Vulkan/TextureCacheVulkan.h +++ b/GPU/Vulkan/TextureCacheVulkan.h @@ -152,7 +152,6 @@ private: Path cbufferPath_; VulkanBuffer textureScaleCBuffer_; bool cbufferInited_ = true; - bool cbufferFailed_ = false; }; VkFormat getClutDestFormatVulkan(GEPaletteFormat format);