mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-25 18:00:59 +01:00
video_core/engines/maxwell_3d: Simplify for loops into ranged for loops within InitializeRegisterDefaults()
Lessens the amount of code that needs to be read, and gets rid of the need to introduce an indexing variable. Instead, we just operate on the objects directly.
This commit is contained in:
parent
c4d549919f
commit
48ce5880a0
1 changed files with 15 additions and 15 deletions
|
@ -34,9 +34,9 @@ void Maxwell3D::InitializeRegisterDefaults() {
|
||||||
|
|
||||||
// Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is
|
// Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is
|
||||||
// needed for ARMS.
|
// needed for ARMS.
|
||||||
for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) {
|
for (auto& viewport : regs.viewports) {
|
||||||
regs.viewports[viewport].depth_range_near = 0.0f;
|
viewport.depth_range_near = 0.0f;
|
||||||
regs.viewports[viewport].depth_range_far = 1.0f;
|
viewport.depth_range_far = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Doom and Bomberman seems to use the uninitialized registers and just enable blend
|
// Doom and Bomberman seems to use the uninitialized registers and just enable blend
|
||||||
|
@ -47,13 +47,13 @@ void Maxwell3D::InitializeRegisterDefaults() {
|
||||||
regs.blend.equation_a = Regs::Blend::Equation::Add;
|
regs.blend.equation_a = Regs::Blend::Equation::Add;
|
||||||
regs.blend.factor_source_a = Regs::Blend::Factor::One;
|
regs.blend.factor_source_a = Regs::Blend::Factor::One;
|
||||||
regs.blend.factor_dest_a = Regs::Blend::Factor::Zero;
|
regs.blend.factor_dest_a = Regs::Blend::Factor::Zero;
|
||||||
for (std::size_t blend_index = 0; blend_index < Regs::NumRenderTargets; blend_index++) {
|
for (auto& blend : regs.independent_blend) {
|
||||||
regs.independent_blend[blend_index].equation_rgb = Regs::Blend::Equation::Add;
|
blend.equation_rgb = Regs::Blend::Equation::Add;
|
||||||
regs.independent_blend[blend_index].factor_source_rgb = Regs::Blend::Factor::One;
|
blend.factor_source_rgb = Regs::Blend::Factor::One;
|
||||||
regs.independent_blend[blend_index].factor_dest_rgb = Regs::Blend::Factor::Zero;
|
blend.factor_dest_rgb = Regs::Blend::Factor::Zero;
|
||||||
regs.independent_blend[blend_index].equation_a = Regs::Blend::Equation::Add;
|
blend.equation_a = Regs::Blend::Equation::Add;
|
||||||
regs.independent_blend[blend_index].factor_source_a = Regs::Blend::Factor::One;
|
blend.factor_source_a = Regs::Blend::Factor::One;
|
||||||
regs.independent_blend[blend_index].factor_dest_a = Regs::Blend::Factor::Zero;
|
blend.factor_dest_a = Regs::Blend::Factor::Zero;
|
||||||
}
|
}
|
||||||
regs.stencil_front_op_fail = Regs::StencilOp::Keep;
|
regs.stencil_front_op_fail = Regs::StencilOp::Keep;
|
||||||
regs.stencil_front_op_zfail = Regs::StencilOp::Keep;
|
regs.stencil_front_op_zfail = Regs::StencilOp::Keep;
|
||||||
|
@ -75,11 +75,11 @@ void Maxwell3D::InitializeRegisterDefaults() {
|
||||||
|
|
||||||
// TODO(bunnei): Some games do not initialize the color masks (e.g. Sonic Mania). Assuming a
|
// TODO(bunnei): Some games do not initialize the color masks (e.g. Sonic Mania). Assuming a
|
||||||
// default of enabled fixes rendering here.
|
// default of enabled fixes rendering here.
|
||||||
for (std::size_t color_mask = 0; color_mask < Regs::NumRenderTargets; color_mask++) {
|
for (auto& color_mask : regs.color_mask) {
|
||||||
regs.color_mask[color_mask].R.Assign(1);
|
color_mask.R.Assign(1);
|
||||||
regs.color_mask[color_mask].G.Assign(1);
|
color_mask.G.Assign(1);
|
||||||
regs.color_mask[color_mask].B.Assign(1);
|
color_mask.B.Assign(1);
|
||||||
regs.color_mask[color_mask].A.Assign(1);
|
color_mask.A.Assign(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commercial games seem to assume this value is enabled and nouveau sets this value manually.
|
// Commercial games seem to assume this value is enabled and nouveau sets this value manually.
|
||||||
|
|
Loading…
Reference in a new issue