mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-18 02:52:47 +03:00
feat(gx): handle cull mode state in d3d backend
This commit is contained in:
parent
af59a58fa2
commit
99691860d6
@ -11,6 +11,12 @@ D3DCMPFUNC CGxDeviceD3d::s_cmpFunc[] = {
|
||||
D3DCMP_LESS,
|
||||
};
|
||||
|
||||
D3DCULL CGxDeviceD3d::s_cullMode[] = {
|
||||
D3DCULL_NONE,
|
||||
D3DCULL_CW,
|
||||
D3DCULL_CCW,
|
||||
};
|
||||
|
||||
D3DBLEND CGxDeviceD3d::s_dstBlend[] = {
|
||||
D3DBLEND_ZERO, // GxBlend_Opaque
|
||||
D3DBLEND_ZERO, // GxBlend_AlphaKey
|
||||
@ -609,6 +615,11 @@ void CGxDeviceD3d::DsSet(EDeviceState state, uint32_t val) {
|
||||
break;
|
||||
}
|
||||
|
||||
case Ds_CullMode: {
|
||||
this->m_d3dDevice->SetRenderState(D3DRS_CULLMODE, val);
|
||||
break;
|
||||
}
|
||||
|
||||
case Ds_ZFunc: {
|
||||
this->m_d3dDevice->SetRenderState(D3DRS_ZFUNC, val);
|
||||
break;
|
||||
@ -934,6 +945,22 @@ void CGxDeviceD3d::IRsSendToHw(EGxRenderState which) {
|
||||
break;
|
||||
}
|
||||
|
||||
case GxRs_Culling: {
|
||||
auto cullMode = static_cast<int32_t>(state->m_value);
|
||||
|
||||
if (!this->MasterEnable(GxMasterEnable_Culling)) {
|
||||
cullMode = 0;
|
||||
}
|
||||
|
||||
if (cullMode > 2) {
|
||||
cullMode = 2;
|
||||
}
|
||||
|
||||
this->DsSet(Ds_CullMode, CGxDeviceD3d::s_cullMode[cullMode]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GxRs_ScissorTest: {
|
||||
auto scissorTestEnable = static_cast<uint32_t>(state->m_value) != 0;
|
||||
this->m_d3dDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, scissorTestEnable);
|
||||
|
@ -197,6 +197,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
|
||||
// Static variables
|
||||
static D3DCMPFUNC s_cmpFunc[];
|
||||
static D3DCULL s_cullMode[];
|
||||
static D3DBLEND s_dstBlend[];
|
||||
static D3DCUBEMAP_FACES s_faceTypes[];
|
||||
static D3DTEXTUREFILTERTYPE s_filterModes[GxTexFilters_Last][3];
|
||||
|
Loading…
Reference in New Issue
Block a user