mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-24 09:33:00 +00:00
Merge pull request #517 from bunnei/blend-factors
Pica: Implement blend factors.
This commit is contained in:
commit
e1f9f9ea04
|
@ -334,9 +334,19 @@ struct Regs {
|
||||||
enum BlendFactor : u32 {
|
enum BlendFactor : u32 {
|
||||||
Zero = 0,
|
Zero = 0,
|
||||||
One = 1,
|
One = 1,
|
||||||
|
SourceColor = 2,
|
||||||
|
OneMinusSourceColor = 3,
|
||||||
|
DestColor = 4,
|
||||||
|
OneMinusDestColor = 5,
|
||||||
SourceAlpha = 6,
|
SourceAlpha = 6,
|
||||||
OneMinusSourceAlpha = 7,
|
OneMinusSourceAlpha = 7,
|
||||||
|
DestAlpha = 8,
|
||||||
|
OneMinusDestAlpha = 9,
|
||||||
|
ConstantColor = 10,
|
||||||
|
OneMinusConstantColor = 11,
|
||||||
|
ConstantAlpha = 12,
|
||||||
|
OneMinusConstantAlpha = 13,
|
||||||
|
SourceAlphaSaturate = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
BitField< 0, 8, BlendEquation> blend_equation_rgb;
|
BitField< 0, 8, BlendEquation> blend_equation_rgb;
|
||||||
|
@ -357,7 +367,12 @@ struct Regs {
|
||||||
BitField<0, 4, Op> op;
|
BitField<0, 4, Op> op;
|
||||||
} logic_op;
|
} logic_op;
|
||||||
|
|
||||||
INSERT_PADDING_WORDS(0x1);
|
union {
|
||||||
|
BitField< 0, 8, u32> r;
|
||||||
|
BitField< 8, 8, u32> g;
|
||||||
|
BitField<16, 8, u32> b;
|
||||||
|
BitField<24, 8, u32> a;
|
||||||
|
} blend_const;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
BitField< 0, 1, u32> enable;
|
BitField< 0, 1, u32> enable;
|
||||||
|
|
|
@ -535,12 +535,42 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
||||||
case params.One:
|
case params.One:
|
||||||
return Math::Vec3<u8>(255, 255, 255);
|
return Math::Vec3<u8>(255, 255, 255);
|
||||||
|
|
||||||
|
case params.SourceColor:
|
||||||
|
return combiner_output.rgb();
|
||||||
|
|
||||||
|
case params.OneMinusSourceColor:
|
||||||
|
return Math::Vec3<u8>(255 - combiner_output.r(), 255 - combiner_output.g(), 255 - combiner_output.b());
|
||||||
|
|
||||||
|
case params.DestColor:
|
||||||
|
return dest.rgb();
|
||||||
|
|
||||||
|
case params.OneMinusDestColor:
|
||||||
|
return Math::Vec3<u8>(255 - dest.r(), 255 - dest.g(), 255 - dest.b());
|
||||||
|
|
||||||
case params.SourceAlpha:
|
case params.SourceAlpha:
|
||||||
return Math::MakeVec(combiner_output.a(), combiner_output.a(), combiner_output.a());
|
return Math::Vec3<u8>(combiner_output.a(), combiner_output.a(), combiner_output.a());
|
||||||
|
|
||||||
case params.OneMinusSourceAlpha:
|
case params.OneMinusSourceAlpha:
|
||||||
return Math::Vec3<u8>(255 - combiner_output.a(), 255 - combiner_output.a(), 255 - combiner_output.a());
|
return Math::Vec3<u8>(255 - combiner_output.a(), 255 - combiner_output.a(), 255 - combiner_output.a());
|
||||||
|
|
||||||
|
case params.DestAlpha:
|
||||||
|
return Math::Vec3<u8>(dest.a(), dest.a(), dest.a());
|
||||||
|
|
||||||
|
case params.OneMinusDestAlpha:
|
||||||
|
return Math::Vec3<u8>(255 - dest.a(), 255 - dest.a(), 255 - dest.a());
|
||||||
|
|
||||||
|
case params.ConstantColor:
|
||||||
|
return Math::Vec3<u8>(registers.output_merger.blend_const.r, registers.output_merger.blend_const.g, registers.output_merger.blend_const.b);
|
||||||
|
|
||||||
|
case params.OneMinusConstantColor:
|
||||||
|
return Math::Vec3<u8>(255 - registers.output_merger.blend_const.r, 255 - registers.output_merger.blend_const.g, 255 - registers.output_merger.blend_const.b);
|
||||||
|
|
||||||
|
case params.ConstantAlpha:
|
||||||
|
return Math::Vec3<u8>(registers.output_merger.blend_const.a, registers.output_merger.blend_const.a, registers.output_merger.blend_const.a);
|
||||||
|
|
||||||
|
case params.OneMinusConstantAlpha:
|
||||||
|
return Math::Vec3<u8>(255 - registers.output_merger.blend_const.a, 255 - registers.output_merger.blend_const.a, 255 - registers.output_merger.blend_const.a);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unknown color blend factor %x", factor);
|
LOG_CRITICAL(HW_GPU, "Unknown color blend factor %x", factor);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -562,6 +592,18 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
||||||
case params.OneMinusSourceAlpha:
|
case params.OneMinusSourceAlpha:
|
||||||
return 255 - combiner_output.a();
|
return 255 - combiner_output.a();
|
||||||
|
|
||||||
|
case params.DestAlpha:
|
||||||
|
return dest.a();
|
||||||
|
|
||||||
|
case params.OneMinusDestAlpha:
|
||||||
|
return 255 - dest.a();
|
||||||
|
|
||||||
|
case params.ConstantAlpha:
|
||||||
|
return registers.output_merger.blend_const.a;
|
||||||
|
|
||||||
|
case params.OneMinusConstantAlpha:
|
||||||
|
return 255 - registers.output_merger.blend_const.a;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(HW_GPU, "Unknown alpha blend factor %x", factor);
|
LOG_CRITICAL(HW_GPU, "Unknown alpha blend factor %x", factor);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
Loading…
Reference in a new issue