Assert that multiple render targets are not set while alpha testing

This commit is contained in:
FernandoS27 2018-10-11 20:29:11 -04:00
parent 59a004f915
commit 8e1239fbc5
3 changed files with 17 additions and 3 deletions

View File

@ -574,6 +574,7 @@ void RasterizerOpenGL::DrawArrays() {
// Alpha Testing is synced on shaders. // Alpha Testing is synced on shaders.
SyncTransformFeedback(); SyncTransformFeedback();
SyncPointState(); SyncPointState();
CheckAlphaTests();
// 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
@ -1041,4 +1042,15 @@ void RasterizerOpenGL::SyncPointState() {
state.point.size = regs.point_size == 0 ? 1 : regs.point_size; state.point.size = regs.point_size == 0 ? 1 : regs.point_size;
} }
void RasterizerOpenGL::CheckAlphaTests() {
const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs;
if (regs.alpha_test_enabled != 0 && regs.rt_control.count > 1) {
LOG_CRITICAL(
Render_OpenGL,
"Alpha Testing is enabled with Multiple Render Targets, this behavior is undefined.");
UNREACHABLE();
}
}
} // namespace OpenGL } // namespace OpenGL

View File

@ -171,6 +171,9 @@ private:
/// Syncs the point state to match the guest state /// Syncs the point state to match the guest state
void SyncPointState(); void SyncPointState();
/// Check asserts for alpha testing.
void CheckAlphaTests();
bool has_ARB_direct_state_access = false; bool has_ARB_direct_state_access = false;
bool has_ARB_multi_bind = false; bool has_ARB_multi_bind = false;
bool has_ARB_separate_shader_objects = false; bool has_ARB_separate_shader_objects = false;

View File

@ -1276,8 +1276,7 @@ private:
header.ps.IsColorComponentOutputEnabled(render_target, 1) || header.ps.IsColorComponentOutputEnabled(render_target, 1) ||
header.ps.IsColorComponentOutputEnabled(render_target, 2) || header.ps.IsColorComponentOutputEnabled(render_target, 2) ||
header.ps.IsColorComponentOutputEnabled(render_target, 3)) { header.ps.IsColorComponentOutputEnabled(render_target, 3)) {
shader.AddLine(fmt::format( shader.AddLine(fmt::format("if (!AlphaFunc({})) discard;",
"if (AlphaFunc({})) discard;",
regs.GetRegisterAsFloat(current_reg))); regs.GetRegisterAsFloat(current_reg)));
current_reg += 4; current_reg += 4;
} }