diff options
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/maxwell_to_gl.h | 63 |
4 files changed, 61 insertions, 37 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 5ae836aca..d1777b25b 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -53,6 +53,19 @@ void Maxwell3D::InitializeRegisterDefaults() { | |||
| 53 | regs.independent_blend[blend_index].factor_source_a = Regs::Blend::Factor::One; | 53 | regs.independent_blend[blend_index].factor_source_a = Regs::Blend::Factor::One; |
| 54 | regs.independent_blend[blend_index].factor_dest_a = Regs::Blend::Factor::Zero; | 54 | regs.independent_blend[blend_index].factor_dest_a = Regs::Blend::Factor::Zero; |
| 55 | } | 55 | } |
| 56 | regs.stencil_front_op_fail = Regs::StencilOp::Keep; | ||
| 57 | regs.stencil_front_op_zfail = Regs::StencilOp::Keep; | ||
| 58 | regs.stencil_front_op_zpass = Regs::StencilOp::Keep; | ||
| 59 | regs.stencil_front_func_func = Regs::ComparisonOp::Always; | ||
| 60 | regs.stencil_front_func_mask = 0xFFFFFFFF; | ||
| 61 | regs.stencil_front_mask = 0xFFFFFFFF; | ||
| 62 | regs.stencil_two_side_enable = 1; | ||
| 63 | regs.stencil_back_op_fail = Regs::StencilOp::Keep; | ||
| 64 | regs.stencil_back_op_zfail = Regs::StencilOp::Keep; | ||
| 65 | regs.stencil_back_op_zpass = Regs::StencilOp::Keep; | ||
| 66 | regs.stencil_back_func_func = Regs::ComparisonOp::Always; | ||
| 67 | regs.stencil_back_func_mask = 0xFFFFFFFF; | ||
| 68 | regs.stencil_back_mask = 0xFFFFFFFF; | ||
| 56 | } | 69 | } |
| 57 | 70 | ||
| 58 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { | 71 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 557795d0f..91ca57883 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -345,6 +345,14 @@ public: | |||
| 345 | Invert = 6, | 345 | Invert = 6, |
| 346 | IncrWrap = 7, | 346 | IncrWrap = 7, |
| 347 | DecrWrap = 8, | 347 | DecrWrap = 8, |
| 348 | KeepOGL = 0x1E00, | ||
| 349 | ZeroOGL = 0, | ||
| 350 | ReplaceOGL = 0x1E01, | ||
| 351 | IncrOGL = 0x1E02, | ||
| 352 | DecrOGL = 0x1E03, | ||
| 353 | InvertOGL = 0x150A, | ||
| 354 | IncrWrapOGL = 0x8507, | ||
| 355 | DecrWrapOGL = 0x8508, | ||
| 348 | }; | 356 | }; |
| 349 | 357 | ||
| 350 | enum class MemoryLayout : u32 { | 358 | enum class MemoryLayout : u32 { |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 40f474e07..8dd7bd514 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -996,9 +996,6 @@ void RasterizerOpenGL::SyncStencilTestState() { | |||
| 996 | return; | 996 | return; |
| 997 | } | 997 | } |
| 998 | 998 | ||
| 999 | // TODO(bunnei): Verify behavior when this is not set | ||
| 1000 | ASSERT(regs.stencil_two_side_enable); | ||
| 1001 | |||
| 1002 | state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func); | 999 | state.stencil.front.test_func = MaxwellToGL::ComparisonOp(regs.stencil_front_func_func); |
| 1003 | state.stencil.front.test_ref = regs.stencil_front_func_ref; | 1000 | state.stencil.front.test_ref = regs.stencil_front_func_ref; |
| 1004 | state.stencil.front.test_mask = regs.stencil_front_func_mask; | 1001 | state.stencil.front.test_mask = regs.stencil_front_func_mask; |
| @@ -1006,7 +1003,7 @@ void RasterizerOpenGL::SyncStencilTestState() { | |||
| 1006 | state.stencil.front.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_front_op_zfail); | 1003 | state.stencil.front.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_front_op_zfail); |
| 1007 | state.stencil.front.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_front_op_zpass); | 1004 | state.stencil.front.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_front_op_zpass); |
| 1008 | state.stencil.front.write_mask = regs.stencil_front_mask; | 1005 | state.stencil.front.write_mask = regs.stencil_front_mask; |
| 1009 | 1006 | if (regs.stencil_two_side_enable) { | |
| 1010 | state.stencil.back.test_func = MaxwellToGL::ComparisonOp(regs.stencil_back_func_func); | 1007 | state.stencil.back.test_func = MaxwellToGL::ComparisonOp(regs.stencil_back_func_func); |
| 1011 | state.stencil.back.test_ref = regs.stencil_back_func_ref; | 1008 | state.stencil.back.test_ref = regs.stencil_back_func_ref; |
| 1012 | state.stencil.back.test_mask = regs.stencil_back_func_mask; | 1009 | state.stencil.back.test_mask = regs.stencil_back_func_mask; |
| @@ -1014,6 +1011,15 @@ void RasterizerOpenGL::SyncStencilTestState() { | |||
| 1014 | state.stencil.back.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_zfail); | 1011 | state.stencil.back.action_depth_fail = MaxwellToGL::StencilOp(regs.stencil_back_op_zfail); |
| 1015 | state.stencil.back.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_back_op_zpass); | 1012 | state.stencil.back.action_depth_pass = MaxwellToGL::StencilOp(regs.stencil_back_op_zpass); |
| 1016 | state.stencil.back.write_mask = regs.stencil_back_mask; | 1013 | state.stencil.back.write_mask = regs.stencil_back_mask; |
| 1014 | } else { | ||
| 1015 | state.stencil.back.test_func = GL_ALWAYS; | ||
| 1016 | state.stencil.back.test_ref = 0; | ||
| 1017 | state.stencil.back.test_mask = 0xFFFFFFFF; | ||
| 1018 | state.stencil.back.write_mask = 0xFFFFFFFF; | ||
| 1019 | state.stencil.back.action_stencil_fail = GL_KEEP; | ||
| 1020 | state.stencil.back.action_depth_fail = GL_KEEP; | ||
| 1021 | state.stencil.back.action_depth_pass = GL_KEEP; | ||
| 1022 | } | ||
| 1017 | } | 1023 | } |
| 1018 | 1024 | ||
| 1019 | void RasterizerOpenGL::SyncColorMask() { | 1025 | void RasterizerOpenGL::SyncColorMask() { |
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 87d511c38..32dc158e4 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h | |||
| @@ -159,10 +159,9 @@ inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, | |||
| 159 | } | 159 | } |
| 160 | } | 160 | } |
| 161 | } | 161 | } |
| 162 | LOG_CRITICAL(Render_OpenGL, "Unimplemented texture filter mode={}", | 162 | LOG_ERROR(Render_OpenGL, "Unimplemented texture filter mode={}", |
| 163 | static_cast<u32>(filter_mode)); | 163 | static_cast<u32>(filter_mode)); |
| 164 | UNREACHABLE(); | 164 | return GL_LINEAR; |
| 165 | return {}; | ||
| 166 | } | 165 | } |
| 167 | 166 | ||
| 168 | inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { | 167 | inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { |
| @@ -183,9 +182,8 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) { | |||
| 183 | case Tegra::Texture::WrapMode::MirrorOnceClampToEdge: | 182 | case Tegra::Texture::WrapMode::MirrorOnceClampToEdge: |
| 184 | return GL_MIRROR_CLAMP_TO_EDGE; | 183 | return GL_MIRROR_CLAMP_TO_EDGE; |
| 185 | } | 184 | } |
| 186 | LOG_CRITICAL(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode)); | 185 | LOG_ERROR(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode)); |
| 187 | UNREACHABLE(); | 186 | return GL_REPEAT; |
| 188 | return {}; | ||
| 189 | } | 187 | } |
| 190 | 188 | ||
| 191 | inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { | 189 | inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { |
| @@ -207,10 +205,9 @@ inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { | |||
| 207 | case Tegra::Texture::DepthCompareFunc::Always: | 205 | case Tegra::Texture::DepthCompareFunc::Always: |
| 208 | return GL_ALWAYS; | 206 | return GL_ALWAYS; |
| 209 | } | 207 | } |
| 210 | LOG_CRITICAL(Render_OpenGL, "Unimplemented texture depth compare function ={}", | 208 | LOG_ERROR(Render_OpenGL, "Unimplemented texture depth compare function ={}", |
| 211 | static_cast<u32>(func)); | 209 | static_cast<u32>(func)); |
| 212 | UNREACHABLE(); | 210 | return GL_GREATER; |
| 213 | return {}; | ||
| 214 | } | 211 | } |
| 215 | 212 | ||
| 216 | inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { | 213 | inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { |
| @@ -226,9 +223,8 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { | |||
| 226 | case Maxwell::Blend::Equation::Max: | 223 | case Maxwell::Blend::Equation::Max: |
| 227 | return GL_MAX; | 224 | return GL_MAX; |
| 228 | } | 225 | } |
| 229 | LOG_CRITICAL(Render_OpenGL, "Unimplemented blend equation={}", static_cast<u32>(equation)); | 226 | LOG_ERROR(Render_OpenGL, "Unimplemented blend equation={}", static_cast<u32>(equation)); |
| 230 | UNREACHABLE(); | 227 | return GL_FUNC_ADD; |
| 231 | return {}; | ||
| 232 | } | 228 | } |
| 233 | 229 | ||
| 234 | inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { | 230 | inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { |
| @@ -291,9 +287,8 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { | |||
| 291 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: | 287 | case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: |
| 292 | return GL_ONE_MINUS_CONSTANT_ALPHA; | 288 | return GL_ONE_MINUS_CONSTANT_ALPHA; |
| 293 | } | 289 | } |
| 294 | LOG_CRITICAL(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor)); | 290 | LOG_ERROR(Render_OpenGL, "Unimplemented blend factor={}", static_cast<u32>(factor)); |
| 295 | UNREACHABLE(); | 291 | return GL_ZERO; |
| 296 | return {}; | ||
| 297 | } | 292 | } |
| 298 | 293 | ||
| 299 | inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { | 294 | inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { |
| @@ -312,9 +307,8 @@ inline GLenum SwizzleSource(Tegra::Texture::SwizzleSource source) { | |||
| 312 | case Tegra::Texture::SwizzleSource::OneFloat: | 307 | case Tegra::Texture::SwizzleSource::OneFloat: |
| 313 | return GL_ONE; | 308 | return GL_ONE; |
| 314 | } | 309 | } |
| 315 | LOG_CRITICAL(Render_OpenGL, "Unimplemented swizzle source={}", static_cast<u32>(source)); | 310 | LOG_ERROR(Render_OpenGL, "Unimplemented swizzle source={}", static_cast<u32>(source)); |
| 316 | UNREACHABLE(); | 311 | return GL_ZERO; |
| 317 | return {}; | ||
| 318 | } | 312 | } |
| 319 | 313 | ||
| 320 | inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { | 314 | inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { |
| @@ -344,33 +338,39 @@ inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { | |||
| 344 | case Maxwell::ComparisonOp::AlwaysOld: | 338 | case Maxwell::ComparisonOp::AlwaysOld: |
| 345 | return GL_ALWAYS; | 339 | return GL_ALWAYS; |
| 346 | } | 340 | } |
| 347 | LOG_CRITICAL(Render_OpenGL, "Unimplemented comparison op={}", static_cast<u32>(comparison)); | 341 | LOG_ERROR(Render_OpenGL, "Unimplemented comparison op={}", static_cast<u32>(comparison)); |
| 348 | UNREACHABLE(); | 342 | return GL_ALWAYS; |
| 349 | return {}; | ||
| 350 | } | 343 | } |
| 351 | 344 | ||
| 352 | inline GLenum StencilOp(Maxwell::StencilOp stencil) { | 345 | inline GLenum StencilOp(Maxwell::StencilOp stencil) { |
| 353 | switch (stencil) { | 346 | switch (stencil) { |
| 354 | case Maxwell::StencilOp::Keep: | 347 | case Maxwell::StencilOp::Keep: |
| 348 | case Maxwell::StencilOp::KeepOGL: | ||
| 355 | return GL_KEEP; | 349 | return GL_KEEP; |
| 356 | case Maxwell::StencilOp::Zero: | 350 | case Maxwell::StencilOp::Zero: |
| 351 | case Maxwell::StencilOp::ZeroOGL: | ||
| 357 | return GL_ZERO; | 352 | return GL_ZERO; |
| 358 | case Maxwell::StencilOp::Replace: | 353 | case Maxwell::StencilOp::Replace: |
| 354 | case Maxwell::StencilOp::ReplaceOGL: | ||
| 359 | return GL_REPLACE; | 355 | return GL_REPLACE; |
| 360 | case Maxwell::StencilOp::Incr: | 356 | case Maxwell::StencilOp::Incr: |
| 357 | case Maxwell::StencilOp::IncrOGL: | ||
| 361 | return GL_INCR; | 358 | return GL_INCR; |
| 362 | case Maxwell::StencilOp::Decr: | 359 | case Maxwell::StencilOp::Decr: |
| 360 | case Maxwell::StencilOp::DecrOGL: | ||
| 363 | return GL_DECR; | 361 | return GL_DECR; |
| 364 | case Maxwell::StencilOp::Invert: | 362 | case Maxwell::StencilOp::Invert: |
| 363 | case Maxwell::StencilOp::InvertOGL: | ||
| 365 | return GL_INVERT; | 364 | return GL_INVERT; |
| 366 | case Maxwell::StencilOp::IncrWrap: | 365 | case Maxwell::StencilOp::IncrWrap: |
| 366 | case Maxwell::StencilOp::IncrWrapOGL: | ||
| 367 | return GL_INCR_WRAP; | 367 | return GL_INCR_WRAP; |
| 368 | case Maxwell::StencilOp::DecrWrap: | 368 | case Maxwell::StencilOp::DecrWrap: |
| 369 | case Maxwell::StencilOp::DecrWrapOGL: | ||
| 369 | return GL_DECR_WRAP; | 370 | return GL_DECR_WRAP; |
| 370 | } | 371 | } |
| 371 | LOG_CRITICAL(Render_OpenGL, "Unimplemented stencil op={}", static_cast<u32>(stencil)); | 372 | LOG_ERROR(Render_OpenGL, "Unimplemented stencil op={}", static_cast<u32>(stencil)); |
| 372 | UNREACHABLE(); | 373 | return GL_KEEP; |
| 373 | return {}; | ||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | inline GLenum FrontFace(Maxwell::Cull::FrontFace front_face) { | 376 | inline GLenum FrontFace(Maxwell::Cull::FrontFace front_face) { |
| @@ -380,9 +380,8 @@ inline GLenum FrontFace(Maxwell::Cull::FrontFace front_face) { | |||
| 380 | case Maxwell::Cull::FrontFace::CounterClockWise: | 380 | case Maxwell::Cull::FrontFace::CounterClockWise: |
| 381 | return GL_CCW; | 381 | return GL_CCW; |
| 382 | } | 382 | } |
| 383 | LOG_CRITICAL(Render_OpenGL, "Unimplemented front face cull={}", static_cast<u32>(front_face)); | 383 | LOG_ERROR(Render_OpenGL, "Unimplemented front face cull={}", static_cast<u32>(front_face)); |
| 384 | UNREACHABLE(); | 384 | return GL_CCW; |
| 385 | return {}; | ||
| 386 | } | 385 | } |
| 387 | 386 | ||
| 388 | inline GLenum CullFace(Maxwell::Cull::CullFace cull_face) { | 387 | inline GLenum CullFace(Maxwell::Cull::CullFace cull_face) { |
| @@ -394,9 +393,8 @@ inline GLenum CullFace(Maxwell::Cull::CullFace cull_face) { | |||
| 394 | case Maxwell::Cull::CullFace::FrontAndBack: | 393 | case Maxwell::Cull::CullFace::FrontAndBack: |
| 395 | return GL_FRONT_AND_BACK; | 394 | return GL_FRONT_AND_BACK; |
| 396 | } | 395 | } |
| 397 | LOG_CRITICAL(Render_OpenGL, "Unimplemented cull face={}", static_cast<u32>(cull_face)); | 396 | LOG_ERROR(Render_OpenGL, "Unimplemented cull face={}", static_cast<u32>(cull_face)); |
| 398 | UNREACHABLE(); | 397 | return GL_BACK; |
| 399 | return {}; | ||
| 400 | } | 398 | } |
| 401 | 399 | ||
| 402 | inline GLenum LogicOp(Maxwell::LogicOperation operation) { | 400 | inline GLenum LogicOp(Maxwell::LogicOperation operation) { |
| @@ -434,9 +432,8 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) { | |||
| 434 | case Maxwell::LogicOperation::Set: | 432 | case Maxwell::LogicOperation::Set: |
| 435 | return GL_SET; | 433 | return GL_SET; |
| 436 | } | 434 | } |
| 437 | LOG_CRITICAL(Render_OpenGL, "Unimplemented logic operation={}", static_cast<u32>(operation)); | 435 | LOG_ERROR(Render_OpenGL, "Unimplemented logic operation={}", static_cast<u32>(operation)); |
| 438 | UNREACHABLE(); | 436 | return GL_COPY; |
| 439 | return {}; | ||
| 440 | } | 437 | } |
| 441 | 438 | ||
| 442 | } // namespace MaxwellToGL | 439 | } // namespace MaxwellToGL |