tev: Use primary color for previous source in first stage (#6921)
This commit is contained in:
parent
04aeecabcf
commit
8b218e1b7d
|
@ -1485,7 +1485,7 @@ vec4 secondary_fragment_color = vec4(0.0);
|
|||
|
||||
out += "vec4 combiner_buffer = vec4(0.0);\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) {
|
||||
WriteTevStage(out, config, static_cast<u32>(index));
|
||||
|
|
|
@ -422,8 +422,8 @@ void RasterizerSoftware::ProcessTriangle(const Vertex& v0, const Vertex& v1, con
|
|||
}
|
||||
|
||||
// Write the TEV stages.
|
||||
WriteTevConfig(texture_color, tev_stages, primary_color, primary_fragment_color,
|
||||
secondary_fragment_color);
|
||||
auto combiner_output = WriteTevConfig(texture_color, tev_stages, primary_color,
|
||||
primary_fragment_color, secondary_fragment_color);
|
||||
|
||||
const auto& output_merger = regs.framebuffer.output_merger;
|
||||
if (output_merger.fragment_operation_mode ==
|
||||
|
@ -663,7 +663,7 @@ Common::Vec4<u8> RasterizerSoftware::PixelColor(u16 x, u16 y,
|
|||
return result;
|
||||
}
|
||||
|
||||
void RasterizerSoftware::WriteTevConfig(
|
||||
Common::Vec4<u8> RasterizerSoftware::WriteTevConfig(
|
||||
std::span<const Common::Vec4<u8>, 4> texture_color,
|
||||
std::span<const Pica::TexturingRegs::TevStageConfig, 6> tev_stages,
|
||||
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
|
||||
* analogously.
|
||||
**/
|
||||
Common::Vec4<u8> combiner_output = primary_color;
|
||||
Common::Vec4<u8> combiner_buffer = {0, 0, 0, 0};
|
||||
Common::Vec4<u8> next_combiner_buffer =
|
||||
Common::MakeVec(regs.texturing.tev_combiner_buffer_color.r.Value(),
|
||||
|
@ -766,6 +767,8 @@ void RasterizerSoftware::WriteTevConfig(
|
|||
next_combiner_buffer.a() = combiner_output.a();
|
||||
}
|
||||
}
|
||||
|
||||
return combiner_output;
|
||||
}
|
||||
|
||||
void RasterizerSoftware::WriteFog(Common::Vec4<u8>& combiner_output, float depth) const {
|
||||
|
|
|
@ -55,7 +55,8 @@ private:
|
|||
Common::Vec4<u8> PixelColor(u16 x, u16 y, Common::Vec4<u8>& combiner_output) const;
|
||||
|
||||
/// 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,
|
||||
Common::Vec4<u8> primary_color, Common::Vec4<u8> primary_fragment_color,
|
||||
Common::Vec4<u8> secondary_fragment_color);
|
||||
|
@ -74,9 +75,6 @@ private:
|
|||
Pica::State& state;
|
||||
const Pica::Regs& regs;
|
||||
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
|
||||
|
|
|
@ -1527,7 +1527,7 @@ vec4 secondary_fragment_color = vec4(0.0);
|
|||
|
||||
out += "vec4 combiner_buffer = vec4(0.0);\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"
|
||||
"vec3 color_results_2 = vec3(0.0);\n"
|
||||
|
|
Reference in New Issue