diff options
| author | 2018-11-13 20:13:16 -0300 | |
|---|---|---|
| committer | 2018-11-17 19:59:32 -0300 | |
| commit | 1881e86c434edfc17f78f68f07443bef1120cda1 (patch) | |
| tree | 3694a8acdc510e4d17e124b0c4285c99c14ccfd4 /src/video_core/engines | |
| parent | Merge pull request #1722 from MysticExile/enable-applictation-crash-report (diff) | |
| download | yuzu-1881e86c434edfc17f78f68f07443bef1120cda1.tar.gz yuzu-1881e86c434edfc17f78f68f07443bef1120cda1.tar.xz yuzu-1881e86c434edfc17f78f68f07443bef1120cda1.zip | |
fix viewport and scissor behavior
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 26 |
2 files changed, 18 insertions, 12 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 6de07ea56..58b598c7f 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -34,8 +34,8 @@ void Maxwell3D::InitializeRegisterDefaults() { | |||
| 34 | // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is | 34 | // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is |
| 35 | // needed for ARMS. | 35 | // needed for ARMS. |
| 36 | for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) { | 36 | for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) { |
| 37 | regs.viewport[viewport].depth_range_near = 0.0f; | 37 | regs.viewports[viewport].depth_range_near = 0.0f; |
| 38 | regs.viewport[viewport].depth_range_far = 1.0f; | 38 | regs.viewports[viewport].depth_range_far = 1.0f; |
| 39 | } | 39 | } |
| 40 | // Doom and Bomberman seems to use the uninitialized registers and just enable blend | 40 | // Doom and Bomberman seems to use the uninitialized registers and just enable blend |
| 41 | // so initialize blend registers with sane values | 41 | // so initialize blend registers with sane values |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 91ca57883..32780fa9a 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -505,9 +505,9 @@ public: | |||
| 505 | 505 | ||
| 506 | INSERT_PADDING_WORDS(0x2E); | 506 | INSERT_PADDING_WORDS(0x2E); |
| 507 | 507 | ||
| 508 | RenderTargetConfig rt[NumRenderTargets]; | 508 | std::array<RenderTargetConfig, NumRenderTargets> rt; |
| 509 | 509 | ||
| 510 | struct { | 510 | struct ViewportTransform { |
| 511 | f32 scale_x; | 511 | f32 scale_x; |
| 512 | f32 scale_y; | 512 | f32 scale_y; |
| 513 | f32 scale_z; | 513 | f32 scale_z; |
| @@ -540,9 +540,11 @@ public: | |||
| 540 | s32 GetHeight() const { | 540 | s32 GetHeight() const { |
| 541 | return static_cast<s32>(translate_y + std::fabs(scale_y)) - GetY(); | 541 | return static_cast<s32>(translate_y + std::fabs(scale_y)) - GetY(); |
| 542 | } | 542 | } |
| 543 | } viewport_transform[NumViewports]; | 543 | }; |
| 544 | 544 | ||
| 545 | struct { | 545 | std::array<ViewportTransform, NumViewports> viewport_transform; |
| 546 | |||
| 547 | struct ViewPort { | ||
| 546 | union { | 548 | union { |
| 547 | BitField<0, 16, u32> x; | 549 | BitField<0, 16, u32> x; |
| 548 | BitField<16, 16, u32> width; | 550 | BitField<16, 16, u32> width; |
| @@ -553,7 +555,9 @@ public: | |||
| 553 | }; | 555 | }; |
| 554 | float depth_range_near; | 556 | float depth_range_near; |
| 555 | float depth_range_far; | 557 | float depth_range_far; |
| 556 | } viewport[NumViewports]; | 558 | }; |
| 559 | |||
| 560 | std::array<ViewPort, NumViewports> viewports; | ||
| 557 | 561 | ||
| 558 | INSERT_PADDING_WORDS(0x1D); | 562 | INSERT_PADDING_WORDS(0x1D); |
| 559 | 563 | ||
| @@ -571,7 +575,7 @@ public: | |||
| 571 | 575 | ||
| 572 | INSERT_PADDING_WORDS(0x17); | 576 | INSERT_PADDING_WORDS(0x17); |
| 573 | 577 | ||
| 574 | struct { | 578 | struct ScissorTest { |
| 575 | u32 enable; | 579 | u32 enable; |
| 576 | union { | 580 | union { |
| 577 | BitField<0, 16, u32> min_x; | 581 | BitField<0, 16, u32> min_x; |
| @@ -581,9 +585,11 @@ public: | |||
| 581 | BitField<0, 16, u32> min_y; | 585 | BitField<0, 16, u32> min_y; |
| 582 | BitField<16, 16, u32> max_y; | 586 | BitField<16, 16, u32> max_y; |
| 583 | }; | 587 | }; |
| 584 | } scissor_test; | 588 | u32 fill; |
| 589 | }; | ||
| 590 | std::array<ScissorTest, NumViewports> scissor_test; | ||
| 585 | 591 | ||
| 586 | INSERT_PADDING_WORDS(0x52); | 592 | INSERT_PADDING_WORDS(0x15); |
| 587 | 593 | ||
| 588 | s32 stencil_back_func_ref; | 594 | s32 stencil_back_func_ref; |
| 589 | u32 stencil_back_mask; | 595 | u32 stencil_back_mask; |
| @@ -1100,8 +1106,8 @@ private: | |||
| 1100 | ASSERT_REG_POSITION(macros, 0x45); | 1106 | ASSERT_REG_POSITION(macros, 0x45); |
| 1101 | ASSERT_REG_POSITION(tfb_enabled, 0x1D1); | 1107 | ASSERT_REG_POSITION(tfb_enabled, 0x1D1); |
| 1102 | ASSERT_REG_POSITION(rt, 0x200); | 1108 | ASSERT_REG_POSITION(rt, 0x200); |
| 1103 | ASSERT_REG_POSITION(viewport_transform[0], 0x280); | 1109 | ASSERT_REG_POSITION(viewport_transform, 0x280); |
| 1104 | ASSERT_REG_POSITION(viewport, 0x300); | 1110 | ASSERT_REG_POSITION(viewports, 0x300); |
| 1105 | ASSERT_REG_POSITION(vertex_buffer, 0x35D); | 1111 | ASSERT_REG_POSITION(vertex_buffer, 0x35D); |
| 1106 | ASSERT_REG_POSITION(clear_color[0], 0x360); | 1112 | ASSERT_REG_POSITION(clear_color[0], 0x360); |
| 1107 | ASSERT_REG_POSITION(clear_depth, 0x364); | 1113 | ASSERT_REG_POSITION(clear_depth, 0x364); |