summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar bunnei2020-05-08 15:16:53 -0400
committerGravatar GitHub2020-05-08 15:16:53 -0400
commit50c27d5ae1bfe6cff6f091f07d68ab7b8e394d9d (patch)
tree594f42eb18464e5370917bfad61694ecce7a050b /src/video_core/engines
parentMerge pull request #3879 from lioncash/global2 (diff)
parentvk_graphics_pipeline: Implement viewport swizzles with NV_viewport_swizzle (diff)
downloadyuzu-50c27d5ae1bfe6cff6f091f07d68ab7b8e394d9d.tar.gz
yuzu-50c27d5ae1bfe6cff6f091f07d68ab7b8e394d9d.tar.xz
yuzu-50c27d5ae1bfe6cff6f091f07d68ab7b8e394d9d.zip
Merge pull request #3885 from ReinUsesLisp/viewport-swizzles
video_core: Implement viewport swizzles with NV_viewport_swizzle
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp6
-rw-r--r--src/video_core/engines/maxwell_3d.h20
2 files changed, 25 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 33936e209..024c9e43b 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -44,6 +44,12 @@ void Maxwell3D::InitializeRegisterDefaults() {
44 viewport.depth_range_near = 0.0f; 44 viewport.depth_range_near = 0.0f;
45 viewport.depth_range_far = 1.0f; 45 viewport.depth_range_far = 1.0f;
46 } 46 }
47 for (auto& viewport : regs.viewport_transform) {
48 viewport.swizzle.x.Assign(Regs::ViewportSwizzle::PositiveX);
49 viewport.swizzle.y.Assign(Regs::ViewportSwizzle::PositiveY);
50 viewport.swizzle.z.Assign(Regs::ViewportSwizzle::PositiveZ);
51 viewport.swizzle.w.Assign(Regs::ViewportSwizzle::PositiveW);
52 }
47 53
48 // Doom and Bomberman seems to use the uninitialized registers and just enable blend 54 // Doom and Bomberman seems to use the uninitialized registers and just enable blend
49 // so initialize blend registers with sane values 55 // 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 1a5df05ce..05dd6b39b 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -576,6 +576,17 @@ public:
576 Replay = 3, 576 Replay = 3,
577 }; 577 };
578 578
579 enum class ViewportSwizzle : u32 {
580 PositiveX = 0,
581 NegativeX = 1,
582 PositiveY = 2,
583 NegativeY = 3,
584 PositiveZ = 4,
585 NegativeZ = 5,
586 PositiveW = 6,
587 NegativeW = 7,
588 };
589
579 struct RenderTargetConfig { 590 struct RenderTargetConfig {
580 u32 address_high; 591 u32 address_high;
581 u32 address_low; 592 u32 address_low;
@@ -619,7 +630,14 @@ public:
619 f32 translate_x; 630 f32 translate_x;
620 f32 translate_y; 631 f32 translate_y;
621 f32 translate_z; 632 f32 translate_z;
622 INSERT_UNION_PADDING_WORDS(2); 633 union {
634 u32 raw;
635 BitField<0, 3, ViewportSwizzle> x;
636 BitField<4, 3, ViewportSwizzle> y;
637 BitField<8, 3, ViewportSwizzle> z;
638 BitField<12, 3, ViewportSwizzle> w;
639 } swizzle;
640 INSERT_UNION_PADDING_WORDS(1);
623 641
624 Common::Rectangle<f32> GetRect() const { 642 Common::Rectangle<f32> GetRect() const {
625 return { 643 return {