diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index 72276baa..b859c293 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -1043,6 +1043,7 @@ namespace skyline::gpu::interconnect { vk::CullModeFlags cullMode{}; //!< The current cull mode regardless of it being enabled or disabled vk::PipelineRasterizationProvokingVertexStateCreateInfoEXT provokingVertexState{}; bool depthBiasPoint{}, depthBiasLine{}, depthBiasFill{}; + bool frontFaceFlip{}; //!< If the front face has to be flipped from what is supplied in SetFrontFace() public: void SetDepthClampEnabled(bool enabled) { @@ -1078,16 +1079,29 @@ namespace skyline::gpu::interconnect { } void SetFrontFace(maxwell3d::FrontFace face) { - rasterizerState.get().frontFace = [face]() { + rasterizerState.get().frontFace = [&]() { switch (face) { case maxwell3d::FrontFace::Clockwise: - return vk::FrontFace::eClockwise; + return frontFaceFlip ? vk::FrontFace::eCounterClockwise : vk::FrontFace::eClockwise; case maxwell3d::FrontFace::CounterClockwise: - return vk::FrontFace::eCounterClockwise; + return frontFaceFlip ? vk::FrontFace::eClockwise : vk::FrontFace::eCounterClockwise; } }(); } + void SetFrontFaceFlipEnabled(bool enabled) { + if (enabled != frontFaceFlip) { + auto &face{rasterizerState.get().frontFace}; + if (face == vk::FrontFace::eClockwise) + face = vk::FrontFace::eCounterClockwise; + else if (face == vk::FrontFace::eCounterClockwise) + face = vk::FrontFace::eClockwise; + + UpdateRuntimeInformation(runtimeInfo.y_negate, enabled, maxwell3d::PipelineStage::Vertex, maxwell3d::PipelineStage::Fragment); + frontFaceFlip = enabled; + } + } + void SetCullFace(maxwell3d::CullFace face) { cullMode = [face]() -> vk::CullModeFlags { switch (face) { diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp index 2a737df9..3a502dc3 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp @@ -308,6 +308,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d { MAXWELL3D_CASE(windowOriginMode, { context.SetViewportOrigin(windowOriginMode.isOriginLowerLeft); + context.SetFrontFaceFlipEnabled(windowOriginMode.flipFrontFace); }) MAXWELL3D_CASE(independentBlendEnable, {