1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d8] State block recording validations

This commit is contained in:
WinterSnowfall 2024-10-13 23:20:10 +03:00 committed by Robin Kertels
parent 0e6be8a48b
commit 11d5f9ee36

View File

@ -1074,6 +1074,10 @@ namespace dxvk {
if (unlikely(pToken == nullptr)) if (unlikely(pToken == nullptr))
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
// Applications cannot create a state block while another is being recorded
if (unlikely(ShouldRecord()))
return D3DERR_INVALIDCALL;
Com<d3d9::IDirect3DStateBlock9> pStateBlock9; Com<d3d9::IDirect3DStateBlock9> pStateBlock9;
HRESULT res = GetD3D9()->CreateStateBlock(d3d9::D3DSTATEBLOCKTYPE(Type), &pStateBlock9); HRESULT res = GetD3D9()->CreateStateBlock(d3d9::D3DSTATEBLOCKTYPE(Type), &pStateBlock9);
@ -1094,6 +1098,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D8Device::CaptureStateBlock(DWORD Token) { HRESULT STDMETHODCALLTYPE D3D8Device::CaptureStateBlock(DWORD Token) {
D3D8DeviceLock lock = LockDevice(); D3D8DeviceLock lock = LockDevice();
// Applications cannot capture a state block while another is being recorded
if (unlikely(ShouldRecord()))
return D3DERR_INVALIDCALL;
auto stateBlockIter = m_stateBlocks.find(Token); auto stateBlockIter = m_stateBlocks.find(Token);
if (unlikely(stateBlockIter == m_stateBlocks.end())) { if (unlikely(stateBlockIter == m_stateBlocks.end())) {
@ -1107,6 +1115,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D8Device::ApplyStateBlock(DWORD Token) { HRESULT STDMETHODCALLTYPE D3D8Device::ApplyStateBlock(DWORD Token) {
D3D8DeviceLock lock = LockDevice(); D3D8DeviceLock lock = LockDevice();
// Applications cannot apply a state block while another is being recorded
if (unlikely(ShouldRecord()))
return D3DERR_INVALIDCALL;
StateChange(); StateChange();
auto stateBlockIter = m_stateBlocks.find(Token); auto stateBlockIter = m_stateBlocks.find(Token);
@ -1122,7 +1134,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D8Device::DeleteStateBlock(DWORD Token) { HRESULT STDMETHODCALLTYPE D3D8Device::DeleteStateBlock(DWORD Token) {
D3D8DeviceLock lock = LockDevice(); D3D8DeviceLock lock = LockDevice();
// "Applications cannot delete a device-state block while another is being recorded" // Applications cannot delete a state block while another is being recorded
if (unlikely(ShouldRecord())) if (unlikely(ShouldRecord()))
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;