From f749fcfa9f42cda679ff7f4288c8418d2b56b08d Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 8 Feb 2021 15:22:10 -0800 Subject: Convert CPMemory to BitField and enum class Additionally, VCacheEnhance has been added to UVAT_group1. According to YAGCD, this field is always 1. TVtxDesc also now has separate low and high fields whose hex values correspond with the proper registers, instead of having one 33-bit value. This change was made in a way that should be backwards-compatible. --- Source/Core/VideoCommon/VertexShaderManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 9c82d9b431..121d6f1a21 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -618,9 +618,9 @@ void VertexShaderManager::SetVertexFormat(u32 components) // The default alpha channel seems to depend on the number of components in the vertex format. // If the vertex attribute has an alpha channel, zero is used, otherwise one. - const u32 color_chan_alpha = - (g_main_cp_state.vtx_attr[g_main_cp_state.last_id].g0.Color0Elements ^ 1) | - ((g_main_cp_state.vtx_attr[g_main_cp_state.last_id].g0.Color1Elements ^ 1) << 1); + const auto g0 = g_main_cp_state.vtx_attr[g_main_cp_state.last_id].g0; + const u32 color_chan_alpha = (g0.Color0Elements == ColorComponentCount::RGB ? 1 : 0) | + (g0.Color1Elements == ColorComponentCount::RGB ? 2 : 0); if (color_chan_alpha != constants.color_chan_alpha) { constants.color_chan_alpha = color_chan_alpha; -- cgit v1.2.3 From aab81d5aa0a1bd6a467c91d0dbba04a9dc40998f Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Wed, 10 Feb 2021 16:01:42 -0800 Subject: Convert XFMemory to BitField and enum class Additionally a new ClipDisable union has been added (though it is not currently used by Dolphin). --- Source/Core/VideoCommon/VertexShaderManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp') diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 121d6f1a21..8047714f61 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -353,7 +353,7 @@ void VertexShaderManager::SetConstants() switch (xfmem.projection.type) { - case GX_PERSPECTIVE: + case ProjectionType::Perspective: { const Common::Vec2 fov = g_freelook_camera.IsActive() ? g_freelook_camera.GetFieldOfView() : Common::Vec2{1, 1}; @@ -382,7 +382,7 @@ void VertexShaderManager::SetConstants() } break; - case GX_ORTHOGRAPHIC: + case ProjectionType::Orthographic: { g_fProjectionMatrix[0] = rawProjection[0]; g_fProjectionMatrix[1] = 0.0f; @@ -419,7 +419,7 @@ void VertexShaderManager::SetConstants() auto corrected_matrix = s_viewportCorrection * Common::Matrix44::FromArray(g_fProjectionMatrix); - if (g_freelook_camera.IsActive() && xfmem.projection.type == GX_PERSPECTIVE) + if (g_freelook_camera.IsActive() && xfmem.projection.type == ProjectionType::Perspective) corrected_matrix *= g_freelook_camera.GetView(); memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4)); -- cgit v1.2.3