feat(gx): set default d3d states after creating d3d device

This commit is contained in:
fallenoak 2023-03-17 09:21:34 -05:00
parent 6135d7c37b
commit c0bf0d58e0
2 changed files with 39 additions and 0 deletions

View File

@ -840,6 +840,10 @@ int32_t CGxDeviceD3d::ICreateD3dDevice(const CGxFormat& format) {
this->ISetCaps(format);
// TODO logs
this->IStateSetD3dDefaults();
// TODO
return 1;
@ -1453,6 +1457,40 @@ void CGxDeviceD3d::IShaderCreateVertex(CGxShader* shader) {
}
}
void CGxDeviceD3d::IStateSetD3dDefaults() {
this->m_d3dDevice->SetRenderState(D3DRS_ZENABLE, 1);
this->m_d3dDevice->SetRenderState(D3DRS_LOCALVIEWER, 1);
this->m_d3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
this->m_d3dDevice->SetRenderState(D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR);
this->m_d3dDevice->SetRenderState(D3DRS_FOGDENSITY, 0);
for (uint32_t tmu = 0; tmu < 16; tmu++) {
this->m_d3dDevice->SetSamplerState(tmu, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP);
}
// TODO
this->IRsSync(0);
this->m_primVertexDirty = -1;
this->m_primIndexDirty = 0;
this->m_d3dDevice->SetIndices(nullptr);
this->m_d3dCurrentVertexDecl = nullptr;
this->m_d3dCurrentIndexBuf = nullptr;
for (uint32_t i = 0; i < 8; i++) {
this->m_d3dVertexStreamBuf[i] = nullptr;
this->m_d3dVertexStreamOfs[i] = -1;
this->m_d3dVertexStreamStride[i] = -1;
}
// TODO
this->ISceneBegin();
}
void CGxDeviceD3d::IStateSync() {
// TODO

View File

@ -284,6 +284,7 @@ class CGxDeviceD3d : public CGxDevice {
void IShaderConstantsFlush();
void IShaderCreatePixel(CGxShader* shader);
void IShaderCreateVertex(CGxShader* shader);
void IStateSetD3dDefaults();
void IStateSync();
void IStateSyncEnables();
void IStateSyncIndexPtr();