Implement Maxwell3D Front Face Flip

This commit is contained in:
PixelyIon 2022-01-22 04:03:42 +05:30
parent 40a3887695
commit 80ae7b255a
2 changed files with 18 additions and 3 deletions

View File

@ -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<vk::PipelineRasterizationStateCreateInfo>().frontFace = [face]() {
rasterizerState.get<vk::PipelineRasterizationStateCreateInfo>().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<vk::PipelineRasterizationStateCreateInfo>().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) {

View File

@ -308,6 +308,7 @@ namespace skyline::soc::gm20b::engine::maxwell3d {
MAXWELL3D_CASE(windowOriginMode, {
context.SetViewportOrigin(windowOriginMode.isOriginLowerLeft);
context.SetFrontFaceFlipEnabled(windowOriginMode.flipFrontFace);
})
MAXWELL3D_CASE(independentBlendEnable, {