Merge pull request #3996 from ReinUsesLisp/front-faces
fixed_pipeline_state,gl_rasterizer: Swap negative viewport checks for front faces
This commit is contained in:
commit
6c0b1a9ee2
|
@ -1020,6 +1020,26 @@ void RasterizerOpenGL::SyncViewport() {
|
||||||
const auto& regs = gpu.regs;
|
const auto& regs = gpu.regs;
|
||||||
|
|
||||||
const bool dirty_viewport = flags[Dirty::Viewports];
|
const bool dirty_viewport = flags[Dirty::Viewports];
|
||||||
|
const bool dirty_clip_control = flags[Dirty::ClipControl];
|
||||||
|
|
||||||
|
if (dirty_clip_control || flags[Dirty::FrontFace]) {
|
||||||
|
flags[Dirty::FrontFace] = false;
|
||||||
|
|
||||||
|
GLenum mode = MaxwellToGL::FrontFace(regs.front_face);
|
||||||
|
if (regs.screen_y_control.triangle_rast_flip != 0 &&
|
||||||
|
regs.viewport_transform[0].scale_y < 0.0f) {
|
||||||
|
switch (mode) {
|
||||||
|
case GL_CW:
|
||||||
|
mode = GL_CCW;
|
||||||
|
break;
|
||||||
|
case GL_CCW:
|
||||||
|
mode = GL_CW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glFrontFace(mode);
|
||||||
|
}
|
||||||
|
|
||||||
if (dirty_viewport || flags[Dirty::ClipControl]) {
|
if (dirty_viewport || flags[Dirty::ClipControl]) {
|
||||||
flags[Dirty::ClipControl] = false;
|
flags[Dirty::ClipControl] = false;
|
||||||
|
|
||||||
|
@ -1117,11 +1137,6 @@ void RasterizerOpenGL::SyncCullMode() {
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags[Dirty::FrontFace]) {
|
|
||||||
flags[Dirty::FrontFace] = false;
|
|
||||||
glFrontFace(MaxwellToGL::FrontFace(regs.front_face));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
void RasterizerOpenGL::SyncPrimitiveRestart() {
|
||||||
|
|
|
@ -71,8 +71,7 @@ void FixedPipelineState::Rasterizer::Fill(const Maxwell& regs) noexcept {
|
||||||
const u32 topology_index = static_cast<u32>(regs.draw.topology.Value());
|
const u32 topology_index = static_cast<u32>(regs.draw.topology.Value());
|
||||||
|
|
||||||
u32 packed_front_face = PackFrontFace(regs.front_face);
|
u32 packed_front_face = PackFrontFace(regs.front_face);
|
||||||
if (regs.screen_y_control.triangle_rast_flip != 0 &&
|
if (regs.screen_y_control.triangle_rast_flip != 0) {
|
||||||
regs.viewport_transform[0].scale_y > 0.0f) {
|
|
||||||
// Flip front face
|
// Flip front face
|
||||||
packed_front_face = 1 - packed_front_face;
|
packed_front_face = 1 - packed_front_face;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue