mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Merge pull request #548 from Subv/blend
GPU: Fixed ghosting when drawing with blending disabled
This commit is contained in:
commit
c116b220e9
3 changed files with 47 additions and 47 deletions
|
@ -318,6 +318,7 @@ public:
|
||||||
Equation equation_a;
|
Equation equation_a;
|
||||||
Factor factor_source_a;
|
Factor factor_source_a;
|
||||||
Factor factor_dest_a;
|
Factor factor_dest_a;
|
||||||
|
INSERT_PADDING_WORDS(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
union {
|
union {
|
||||||
|
@ -432,7 +433,27 @@ public:
|
||||||
};
|
};
|
||||||
} rt_control;
|
} rt_control;
|
||||||
|
|
||||||
INSERT_PADDING_WORDS(0xCF);
|
INSERT_PADDING_WORDS(0x31);
|
||||||
|
|
||||||
|
u32 independent_blend_enable;
|
||||||
|
|
||||||
|
INSERT_PADDING_WORDS(0x15);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
u32 separate_alpha;
|
||||||
|
Blend::Equation equation_rgb;
|
||||||
|
Blend::Factor factor_source_rgb;
|
||||||
|
Blend::Factor factor_dest_rgb;
|
||||||
|
Blend::Equation equation_a;
|
||||||
|
Blend::Factor factor_source_a;
|
||||||
|
INSERT_PADDING_WORDS(1);
|
||||||
|
Blend::Factor factor_dest_a;
|
||||||
|
|
||||||
|
u32 enable_common;
|
||||||
|
u32 enable[NumRenderTargets];
|
||||||
|
} blend;
|
||||||
|
|
||||||
|
INSERT_PADDING_WORDS(0x77);
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u32 tsc_address_high;
|
u32 tsc_address_high;
|
||||||
|
@ -557,9 +578,7 @@ public:
|
||||||
|
|
||||||
} vertex_array[NumVertexArrays];
|
} vertex_array[NumVertexArrays];
|
||||||
|
|
||||||
Blend blend;
|
Blend independent_blend[NumRenderTargets];
|
||||||
|
|
||||||
INSERT_PADDING_WORDS(0x39);
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u32 limit_high;
|
u32 limit_high;
|
||||||
|
@ -722,6 +741,8 @@ ASSERT_REG_POSITION(vertex_buffer, 0x35D);
|
||||||
ASSERT_REG_POSITION(zeta, 0x3F8);
|
ASSERT_REG_POSITION(zeta, 0x3F8);
|
||||||
ASSERT_REG_POSITION(vertex_attrib_format[0], 0x458);
|
ASSERT_REG_POSITION(vertex_attrib_format[0], 0x458);
|
||||||
ASSERT_REG_POSITION(rt_control, 0x487);
|
ASSERT_REG_POSITION(rt_control, 0x487);
|
||||||
|
ASSERT_REG_POSITION(independent_blend_enable, 0x4B9);
|
||||||
|
ASSERT_REG_POSITION(blend, 0x4CF);
|
||||||
ASSERT_REG_POSITION(tsc, 0x557);
|
ASSERT_REG_POSITION(tsc, 0x557);
|
||||||
ASSERT_REG_POSITION(tic, 0x55D);
|
ASSERT_REG_POSITION(tic, 0x55D);
|
||||||
ASSERT_REG_POSITION(code_address, 0x582);
|
ASSERT_REG_POSITION(code_address, 0x582);
|
||||||
|
@ -729,7 +750,7 @@ ASSERT_REG_POSITION(draw, 0x585);
|
||||||
ASSERT_REG_POSITION(index_array, 0x5F2);
|
ASSERT_REG_POSITION(index_array, 0x5F2);
|
||||||
ASSERT_REG_POSITION(query, 0x6C0);
|
ASSERT_REG_POSITION(query, 0x6C0);
|
||||||
ASSERT_REG_POSITION(vertex_array[0], 0x700);
|
ASSERT_REG_POSITION(vertex_array[0], 0x700);
|
||||||
ASSERT_REG_POSITION(blend, 0x780);
|
ASSERT_REG_POSITION(independent_blend, 0x780);
|
||||||
ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0);
|
ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0);
|
||||||
ASSERT_REG_POSITION(shader_config[0], 0x800);
|
ASSERT_REG_POSITION(shader_config[0], 0x800);
|
||||||
ASSERT_REG_POSITION(const_buffer, 0x8E0);
|
ASSERT_REG_POSITION(const_buffer, 0x8E0);
|
||||||
|
|
|
@ -349,6 +349,9 @@ void RasterizerOpenGL::DrawArrays() {
|
||||||
// Sync the viewport
|
// Sync the viewport
|
||||||
SyncViewport(surfaces_rect, res_scale);
|
SyncViewport(surfaces_rect, res_scale);
|
||||||
|
|
||||||
|
// Sync the blend state registers
|
||||||
|
SyncBlendState();
|
||||||
|
|
||||||
// TODO(bunnei): Sync framebuffer_scale uniform here
|
// TODO(bunnei): Sync framebuffer_scale uniform here
|
||||||
// TODO(bunnei): Sync scissorbox uniform(s) here
|
// TODO(bunnei): Sync scissorbox uniform(s) here
|
||||||
|
|
||||||
|
@ -455,32 +458,7 @@ void RasterizerOpenGL::DrawArrays() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::NotifyMaxwellRegisterChanged(u32 method) {
|
void RasterizerOpenGL::NotifyMaxwellRegisterChanged(u32 method) {}
|
||||||
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
|
|
||||||
switch (method) {
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.separate_alpha):
|
|
||||||
ASSERT_MSG(false, "unimplemented");
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.equation_rgb):
|
|
||||||
state.blend.rgb_equation = MaxwellToGL::BlendEquation(regs.blend.equation_rgb);
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.factor_source_rgb):
|
|
||||||
state.blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_rgb);
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.factor_dest_rgb):
|
|
||||||
state.blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_rgb);
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.equation_a):
|
|
||||||
state.blend.a_equation = MaxwellToGL::BlendEquation(regs.blend.equation_a);
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.factor_source_a):
|
|
||||||
state.blend.src_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_source_a);
|
|
||||||
break;
|
|
||||||
case MAXWELL3D_REG_INDEX(blend.factor_dest_a):
|
|
||||||
state.blend.dst_a_func = MaxwellToGL::BlendFunc(regs.blend.factor_dest_a);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RasterizerOpenGL::FlushAll() {
|
void RasterizerOpenGL::FlushAll() {
|
||||||
MICROPROFILE_SCOPE(OpenGL_CacheManagement);
|
MICROPROFILE_SCOPE(OpenGL_CacheManagement);
|
||||||
|
@ -760,14 +738,21 @@ void RasterizerOpenGL::SyncDepthOffset() {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncBlendEnabled() {
|
void RasterizerOpenGL::SyncBlendState() {
|
||||||
UNREACHABLE();
|
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
|
||||||
}
|
ASSERT_MSG(regs.independent_blend_enable == 1, "Only independent blending is implemented");
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncBlendFuncs() {
|
// TODO(Subv): Support more than just render target 0.
|
||||||
UNREACHABLE();
|
state.blend.enabled = regs.blend.enable[0] != 0;
|
||||||
}
|
|
||||||
|
|
||||||
void RasterizerOpenGL::SyncBlendColor() {
|
if (!state.blend.enabled)
|
||||||
UNREACHABLE();
|
return;
|
||||||
|
|
||||||
|
ASSERT_MSG(!regs.independent_blend[0].separate_alpha, "Unimplemented");
|
||||||
|
state.blend.rgb_equation = MaxwellToGL::BlendEquation(regs.independent_blend[0].equation_rgb);
|
||||||
|
state.blend.src_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_source_rgb);
|
||||||
|
state.blend.dst_rgb_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_dest_rgb);
|
||||||
|
state.blend.a_equation = MaxwellToGL::BlendEquation(regs.independent_blend[0].equation_a);
|
||||||
|
state.blend.src_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_source_a);
|
||||||
|
state.blend.dst_a_func = MaxwellToGL::BlendFunc(regs.independent_blend[0].factor_dest_a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,14 +121,8 @@ private:
|
||||||
/// Syncs the depth offset to match the guest state
|
/// Syncs the depth offset to match the guest state
|
||||||
void SyncDepthOffset();
|
void SyncDepthOffset();
|
||||||
|
|
||||||
/// Syncs the blend enabled status to match the guest state
|
/// Syncs the blend state to match the guest state
|
||||||
void SyncBlendEnabled();
|
void SyncBlendState();
|
||||||
|
|
||||||
/// Syncs the blend functions to match the guest state
|
|
||||||
void SyncBlendFuncs();
|
|
||||||
|
|
||||||
/// Syncs the blend color to match the guest state
|
|
||||||
void SyncBlendColor();
|
|
||||||
|
|
||||||
bool has_ARB_buffer_storage;
|
bool has_ARB_buffer_storage;
|
||||||
bool has_ARB_direct_state_access;
|
bool has_ARB_direct_state_access;
|
||||||
|
|
Loading…
Reference in a new issue