mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 01:55:21 +03:00
feat(gx): handle shader render state in d3d backend
This commit is contained in:
parent
69282c0c94
commit
434fba0e86
@ -745,6 +745,20 @@ void CGxDeviceD3d::IRsSendToHw(EGxRenderState which) {
|
||||
break;
|
||||
}
|
||||
|
||||
case GxRs_VertexShader: {
|
||||
auto shader = static_cast<CGxShader*>(static_cast<void*>(state->m_value));
|
||||
this->IShaderBindVertex(shader);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case GxRs_PixelShader: {
|
||||
auto shader = static_cast<CGxShader*>(static_cast<void*>(state->m_value));
|
||||
this->IShaderBindPixel(shader);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1000,6 +1014,37 @@ void CGxDeviceD3d::ISetVertexBuffer(uint32_t stream, LPDIRECT3DVERTEXBUFFER9 buf
|
||||
}
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::IShaderBindPixel(CGxShader* shader) {
|
||||
if (!shader) {
|
||||
this->m_d3dDevice->SetPixelShader(nullptr);
|
||||
|
||||
// TODO FFP handling
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shader->loaded) {
|
||||
this->IShaderCreatePixel(shader);
|
||||
}
|
||||
|
||||
auto d3dShader = static_cast<LPDIRECT3DPIXELSHADER9>(shader->apiSpecific);
|
||||
this->m_d3dDevice->SetPixelShader(d3dShader);
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::IShaderBindVertex(CGxShader* shader) {
|
||||
if (!shader) {
|
||||
this->m_d3dDevice->SetVertexShader(nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shader->loaded) {
|
||||
this->IShaderCreateVertex(shader);
|
||||
}
|
||||
|
||||
auto d3dShader = static_cast<LPDIRECT3DVERTEXSHADER9>(shader->apiSpecific);
|
||||
this->m_d3dDevice->SetVertexShader(d3dShader);
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::IShaderConstantsFlush() {
|
||||
// TODO
|
||||
}
|
||||
|
@ -270,6 +270,8 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
void ISetCaps(const CGxFormat& format);
|
||||
void ISetTexture(uint32_t tmu, CGxTex* texId);
|
||||
void ISetVertexBuffer(uint32_t stream, LPDIRECT3DVERTEXBUFFER9 buffer, uint32_t offset, uint32_t stride);
|
||||
void IShaderBindPixel(CGxShader* shader);
|
||||
void IShaderBindVertex(CGxShader* shader);
|
||||
void IShaderConstantsFlush();
|
||||
void IShaderCreatePixel(CGxShader* shader);
|
||||
void IShaderCreateVertex(CGxShader* shader);
|
||||
|
Loading…
Reference in New Issue
Block a user