diff --git a/src/xenia/gpu/gl4/command_processor.cc b/src/xenia/gpu/gl4/command_processor.cc index f41bec3dd..49f3c480d 100644 --- a/src/xenia/gpu/gl4/command_processor.cc +++ b/src/xenia/gpu/gl4/command_processor.cc @@ -2081,7 +2081,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateBlendState() { // if(ALPHATESTENABLE && frag_out.a [<=/ALPHAFUNC] ALPHAREF) discard; uint32_t color_control = reg_file[XE_GPU_REG_RB_COLORCONTROL].u32; draw_batcher_.set_alpha_test((color_control & 0x4) != 0, // ALPAHTESTENABLE - color_control & 0x3, // ALPHAFUNC + color_control & 0x7, // ALPHAFUNC reg_file[XE_GPU_REG_RB_ALPHA_REF].f32); bool dirty = false; diff --git a/src/xenia/gpu/gl4/gl4_shader.cc b/src/xenia/gpu/gl4/gl4_shader.cc index 3f255869e..e9fb2b3dd 100644 --- a/src/xenia/gpu/gl4/gl4_shader.cc +++ b/src/xenia/gpu/gl4/gl4_shader.cc @@ -253,16 +253,18 @@ bool GL4Shader::PreparePixelShader( "layout(location = 0) out vec4 oC[4];\n" "void processFragment(const in StateData state);\n" "void applyAlphaTest(int alpha_func, float alpha_ref) {\n" + " bool passes = false;\n" " switch (alpha_func) {\n" - " case 0: discard;\n" - " case 1: if (oC[0].a < alpha_ref) discard; break;\n" - " case 2: if (oC[0].a == alpha_ref) discard; break;\n" - " case 3: if (oC[0].a <= alpha_ref) discard; break;\n" - " case 4: if (oC[0].a > alpha_ref) discard; break;\n" - " case 5: if (oC[0].a != alpha_ref) discard; break;\n" - " case 6: if (oC[0].a >= alpha_ref) discard; break;\n" - " case 7: break;\n" + " case 0: break;\n" + " case 1: if (oC[0].a < alpha_ref) passes = true; break;\n" + " case 2: if (oC[0].a == alpha_ref) passes = true; break;\n" + " case 3: if (oC[0].a <= alpha_ref) passes = true; break;\n" + " case 4: if (oC[0].a > alpha_ref) passes = true; break;\n" + " case 5: if (oC[0].a != alpha_ref) passes = true; break;\n" + " case 6: if (oC[0].a >= alpha_ref) passes = true; break;\n" + " case 7: passes = true; break;\n" " };\n" + " if (!passes) discard;\n" "}\n" "void main() {\n" + " const StateData state = states[draw_id];\n" diff --git a/src/xenia/gpu/trace_viewer_main.cc b/src/xenia/gpu/trace_viewer_main.cc index 57ced0818..51dbea269 100644 --- a/src/xenia/gpu/trace_viewer_main.cc +++ b/src/xenia/gpu/trace_viewer_main.cc @@ -1675,8 +1675,8 @@ void DrawStateUI(xe::ui::MainWindow* window, TracePlayer& player, // if(ALPHATESTENABLE && frag_out.a [<=/ALPHAFUNC] ALPHAREF) discard; uint32_t color_control = regs[XE_GPU_REG_RB_COLORCONTROL].u32; if ((color_control & 0x4) != 0) { - ImGui::BulletText("Alpha Test: discard if %s %.2f", - kCompareFuncNames[color_control & 0x3], + ImGui::BulletText("Alpha Test: %s %.2f", + kCompareFuncNames[color_control & 0x7], regs[XE_GPU_REG_RB_ALPHA_REF].f32); } else { ImGui::PushStyleColor(ImGuiCol_Text, kColorIgnored);