Revert "Convert the pre-rotation to just the matrix multiplication."

After the previous commit, the optimization is no longer needed, and
unnecessarily bloats the uniform buffer.

This reverts commit 62bcb1785e809649ba88b49e24c5217f457fa040.
This commit is contained in:
Henrik Rydgård committed 2026-05-17 11:02:35 +02:00
1 parent 4b93a870db
commit d243737c11
4 files changed
+13 -10

No files matched your search

+4 -2
View File
@@ -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
+3 -5
View File
@@ -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
+6 -2
View File
@@ -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;
-1
View File
@@ -152,7 +152,6 @@ private:
Path cbufferPath_;
VulkanBuffer textureScaleCBuffer_;
bool cbufferInited_ = true;
bool cbufferFailed_ = false;
};
VkFormat getClutDestFormatVulkan(GEPaletteFormat format);