summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Sebastian Valle2019-05-19 09:01:19 -0500
committerGravatar GitHub2019-05-19 09:01:19 -0500
commita6ed792ac43a882d579cd951734d858b9614c31a (patch)
tree9fe684bc42539ca7fda6ad447bb28c8eed32d990 /src
parentMerge pull request #2487 from lioncash/service-return (diff)
parentvideo_core/engines/maxwell3d: Get rid of three magic values in CallMethod() (diff)
downloadyuzu-a6ed792ac43a882d579cd951734d858b9614c31a.tar.gz
yuzu-a6ed792ac43a882d579cd951734d858b9614c31a.tar.xz
yuzu-a6ed792ac43a882d579cd951734d858b9614c31a.zip
Merge pull request #2470 from lioncash/ranged-for
video_core/engines/maxwell_3d: Simplify for loops into ranged for loops within InitializeRegisterDefaults()
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index d7b586db9..241245c59 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -34,9 +34,9 @@ void Maxwell3D::InitializeRegisterDefaults() {
34 34
35 // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is 35 // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is
36 // needed for ARMS. 36 // needed for ARMS.
37 for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) { 37 for (auto& viewport : regs.viewports) {
38 regs.viewports[viewport].depth_range_near = 0.0f; 38 viewport.depth_range_near = 0.0f;
39 regs.viewports[viewport].depth_range_far = 1.0f; 39 viewport.depth_range_far = 1.0f;
40 } 40 }
41 41
42 // Doom and Bomberman seems to use the uninitialized registers and just enable blend 42 // Doom and Bomberman seems to use the uninitialized registers and just enable blend
@@ -47,13 +47,13 @@ void Maxwell3D::InitializeRegisterDefaults() {
47 regs.blend.equation_a = Regs::Blend::Equation::Add; 47 regs.blend.equation_a = Regs::Blend::Equation::Add;
48 regs.blend.factor_source_a = Regs::Blend::Factor::One; 48 regs.blend.factor_source_a = Regs::Blend::Factor::One;
49 regs.blend.factor_dest_a = Regs::Blend::Factor::Zero; 49 regs.blend.factor_dest_a = Regs::Blend::Factor::Zero;
50 for (std::size_t blend_index = 0; blend_index < Regs::NumRenderTargets; blend_index++) { 50 for (auto& blend : regs.independent_blend) {
51 regs.independent_blend[blend_index].equation_rgb = Regs::Blend::Equation::Add; 51 blend.equation_rgb = Regs::Blend::Equation::Add;
52 regs.independent_blend[blend_index].factor_source_rgb = Regs::Blend::Factor::One; 52 blend.factor_source_rgb = Regs::Blend::Factor::One;
53 regs.independent_blend[blend_index].factor_dest_rgb = Regs::Blend::Factor::Zero; 53 blend.factor_dest_rgb = Regs::Blend::Factor::Zero;
54 regs.independent_blend[blend_index].equation_a = Regs::Blend::Equation::Add; 54 blend.equation_a = Regs::Blend::Equation::Add;
55 regs.independent_blend[blend_index].factor_source_a = Regs::Blend::Factor::One; 55 blend.factor_source_a = Regs::Blend::Factor::One;
56 regs.independent_blend[blend_index].factor_dest_a = Regs::Blend::Factor::Zero; 56 blend.factor_dest_a = Regs::Blend::Factor::Zero;
57 } 57 }
58 regs.stencil_front_op_fail = Regs::StencilOp::Keep; 58 regs.stencil_front_op_fail = Regs::StencilOp::Keep;
59 regs.stencil_front_op_zfail = Regs::StencilOp::Keep; 59 regs.stencil_front_op_zfail = Regs::StencilOp::Keep;
@@ -75,11 +75,11 @@ void Maxwell3D::InitializeRegisterDefaults() {
75 75
76 // TODO(bunnei): Some games do not initialize the color masks (e.g. Sonic Mania). Assuming a 76 // TODO(bunnei): Some games do not initialize the color masks (e.g. Sonic Mania). Assuming a
77 // default of enabled fixes rendering here. 77 // default of enabled fixes rendering here.
78 for (std::size_t color_mask = 0; color_mask < Regs::NumRenderTargets; color_mask++) { 78 for (auto& color_mask : regs.color_mask) {
79 regs.color_mask[color_mask].R.Assign(1); 79 color_mask.R.Assign(1);
80 regs.color_mask[color_mask].G.Assign(1); 80 color_mask.G.Assign(1);
81 regs.color_mask[color_mask].B.Assign(1); 81 color_mask.B.Assign(1);
82 regs.color_mask[color_mask].A.Assign(1); 82 color_mask.A.Assign(1);
83 } 83 }
84 84
85 // Commercial games seem to assume this value is enabled and nouveau sets this value manually. 85 // Commercial games seem to assume this value is enabled and nouveau sets this value manually.
@@ -178,13 +178,13 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) {
178 178
179 // Vertex buffer 179 // Vertex buffer
180 if (method >= MAXWELL3D_REG_INDEX(vertex_array) && 180 if (method >= MAXWELL3D_REG_INDEX(vertex_array) &&
181 method < MAXWELL3D_REG_INDEX(vertex_array) + 4 * 32) { 181 method < MAXWELL3D_REG_INDEX(vertex_array) + 4 * Regs::NumVertexArrays) {
182 dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array)) >> 2); 182 dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array)) >> 2);
183 } else if (method >= MAXWELL3D_REG_INDEX(vertex_array_limit) && 183 } else if (method >= MAXWELL3D_REG_INDEX(vertex_array_limit) &&
184 method < MAXWELL3D_REG_INDEX(vertex_array_limit) + 2 * 32) { 184 method < MAXWELL3D_REG_INDEX(vertex_array_limit) + 2 * Regs::NumVertexArrays) {
185 dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array_limit)) >> 1); 185 dirty_flags.vertex_array.set((method - MAXWELL3D_REG_INDEX(vertex_array_limit)) >> 1);
186 } else if (method >= MAXWELL3D_REG_INDEX(instanced_arrays) && 186 } else if (method >= MAXWELL3D_REG_INDEX(instanced_arrays) &&
187 method < MAXWELL3D_REG_INDEX(instanced_arrays) + 32) { 187 method < MAXWELL3D_REG_INDEX(instanced_arrays) + Regs::NumVertexArrays) {
188 dirty_flags.vertex_array.set(method - MAXWELL3D_REG_INDEX(instanced_arrays)); 188 dirty_flags.vertex_array.set(method - MAXWELL3D_REG_INDEX(instanced_arrays));
189 } 189 }
190 } 190 }