From d6cada50cdfb1cd4a347d7bdfa1c93dfd63ffba4 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sat, 11 Mar 2023 16:20:42 -0600 Subject: [PATCH] feat(gx): handle alpha ref render state in d3d backend --- src/gx/d3d/CGxDeviceD3d.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gx/d3d/CGxDeviceD3d.cpp b/src/gx/d3d/CGxDeviceD3d.cpp index e1d5e03..8687c23 100644 --- a/src/gx/d3d/CGxDeviceD3d.cpp +++ b/src/gx/d3d/CGxDeviceD3d.cpp @@ -771,6 +771,19 @@ void CGxDeviceD3d::IRsSendToHw(EGxRenderState which) { switch (which) { // TODO handle all render states + case GxRs_AlphaRef: { + auto alphaRef = static_cast(state->m_value); + + if (alphaRef <= 0) { + this->DsSet(Ds_AlphaTestEnable, 0); + } else { + this->DsSet(Ds_AlphaRef, alphaRef); + this->DsSet(Ds_AlphaTestEnable, 1); + } + + break; + } + case GxRs_DepthTest: case GxRs_DepthFunc: { auto depthTest = static_cast((&this->m_appRenderStates[GxRs_DepthTest])->m_value);