Fixing alpha testing.
This commit is contained in:
parent
704077d543
commit
494e918496
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue