citra-emu
/
citra-canary
Archived
1
0
Fork 0

tev: Use primary color for previous source in first stage (#6921)

This commit is contained in:
GPUCode 2023-08-28 09:59:32 +03:00 committed by GitHub
parent 04aeecabcf
commit 8b218e1b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 12 deletions

View File

@ -1485,7 +1485,7 @@ vec4 secondary_fragment_color = vec4(0.0);
out += "vec4 combiner_buffer = vec4(0.0);\n" out += "vec4 combiner_buffer = vec4(0.0);\n"
"vec4 next_combiner_buffer = tev_combiner_buffer_color;\n" "vec4 next_combiner_buffer = tev_combiner_buffer_color;\n"
"vec4 last_tex_env_out = vec4(0.0);\n"; "vec4 last_tex_env_out = rounded_primary_color;\n";
for (std::size_t index = 0; index < state.tev_stages.size(); ++index) { for (std::size_t index = 0; index < state.tev_stages.size(); ++index) {
WriteTevStage(out, config, static_cast<u32>(index)); WriteTevStage(out, config, static_cast<u32>(index));

View File

@ -422,8 +422,8 @@ void RasterizerSoftware::ProcessTriangle(const Vertex& v0, const Vertex& v1, con
} }
// Write the TEV stages. // Write the TEV stages.
WriteTevConfig(texture_color, tev_stages, primary_color, primary_fragment_color, auto combiner_output = WriteTevConfig(texture_color, tev_stages, primary_color,
secondary_fragment_color); primary_fragment_color, secondary_fragment_color);
const auto& output_merger = regs.framebuffer.output_merger; const auto& output_merger = regs.framebuffer.output_merger;
if (output_merger.fragment_operation_mode == if (output_merger.fragment_operation_mode ==
@ -663,7 +663,7 @@ Common::Vec4<u8> RasterizerSoftware::PixelColor(u16 x, u16 y,
return result; return result;
} }
void RasterizerSoftware::WriteTevConfig( Common::Vec4<u8> RasterizerSoftware::WriteTevConfig(
std::span<const Common::Vec4<u8>, 4> texture_color, std::span<const Common::Vec4<u8>, 4> texture_color,
std::span<const Pica::TexturingRegs::TevStageConfig, 6> tev_stages, std::span<const Pica::TexturingRegs::TevStageConfig, 6> tev_stages,
Common::Vec4<u8> primary_color, Common::Vec4<u8> primary_fragment_color, Common::Vec4<u8> primary_color, Common::Vec4<u8> primary_fragment_color,
@ -676,6 +676,7 @@ void RasterizerSoftware::WriteTevConfig(
* with some basic arithmetic. Alpha combiners can be configured separately but work * with some basic arithmetic. Alpha combiners can be configured separately but work
* analogously. * analogously.
**/ **/
Common::Vec4<u8> combiner_output = primary_color;
Common::Vec4<u8> combiner_buffer = {0, 0, 0, 0}; Common::Vec4<u8> combiner_buffer = {0, 0, 0, 0};
Common::Vec4<u8> next_combiner_buffer = Common::Vec4<u8> next_combiner_buffer =
Common::MakeVec(regs.texturing.tev_combiner_buffer_color.r.Value(), Common::MakeVec(regs.texturing.tev_combiner_buffer_color.r.Value(),
@ -766,6 +767,8 @@ void RasterizerSoftware::WriteTevConfig(
next_combiner_buffer.a() = combiner_output.a(); next_combiner_buffer.a() = combiner_output.a();
} }
} }
return combiner_output;
} }
void RasterizerSoftware::WriteFog(Common::Vec4<u8>& combiner_output, float depth) const { void RasterizerSoftware::WriteFog(Common::Vec4<u8>& combiner_output, float depth) const {

View File

@ -55,7 +55,8 @@ private:
Common::Vec4<u8> PixelColor(u16 x, u16 y, Common::Vec4<u8>& combiner_output) const; Common::Vec4<u8> PixelColor(u16 x, u16 y, Common::Vec4<u8>& combiner_output) const;
/// Emulates the TEV configuration and returns the combiner output. /// Emulates the TEV configuration and returns the combiner output.
void WriteTevConfig(std::span<const Common::Vec4<u8>, 4> texture_color, Common::Vec4<u8> WriteTevConfig(
std::span<const Common::Vec4<u8>, 4> texture_color,
std::span<const Pica::TexturingRegs::TevStageConfig, 6> tev_stages, std::span<const Pica::TexturingRegs::TevStageConfig, 6> tev_stages,
Common::Vec4<u8> primary_color, Common::Vec4<u8> primary_fragment_color, Common::Vec4<u8> primary_color, Common::Vec4<u8> primary_fragment_color,
Common::Vec4<u8> secondary_fragment_color); Common::Vec4<u8> secondary_fragment_color);
@ -74,9 +75,6 @@ private:
Pica::State& state; Pica::State& state;
const Pica::Regs& regs; const Pica::Regs& regs;
Framebuffer fb; Framebuffer fb;
// Kirby Blowout Blast relies on the combiner output of a previous draw
// in order to render the sky correctly.
Common::Vec4<u8> combiner_output{};
}; };
} // namespace SwRenderer } // namespace SwRenderer

View File

@ -1527,7 +1527,7 @@ vec4 secondary_fragment_color = vec4(0.0);
out += "vec4 combiner_buffer = vec4(0.0);\n" out += "vec4 combiner_buffer = vec4(0.0);\n"
"vec4 next_combiner_buffer = tev_combiner_buffer_color;\n" "vec4 next_combiner_buffer = tev_combiner_buffer_color;\n"
"vec4 last_tex_env_out = vec4(0.0);\n"; "vec4 last_tex_env_out = rounded_primary_color;\n";
out += "vec3 color_results_1 = vec3(0.0);\n" out += "vec3 color_results_1 = vec3(0.0);\n"
"vec3 color_results_2 = vec3(0.0);\n" "vec3 color_results_2 = vec3(0.0);\n"