mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 02:36:27 +01:00
D3D11: Ownership fixes for objects in D3DState
This commit is contained in:
parent
88db577c17
commit
77425ef83b
@ -347,10 +347,9 @@ ID3D11SamplerState* StateCache::Get(SamplerState state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID3D11SamplerState> res;
|
ComPtr<ID3D11SamplerState> res;
|
||||||
HRESULT hr = D3D::device->CreateSamplerState(&sampdc, &res);
|
HRESULT hr = D3D::device->CreateSamplerState(&sampdc, res.GetAddressOf());
|
||||||
CHECK(SUCCEEDED(hr), "Creating D3D sampler state failed");
|
CHECK(SUCCEEDED(hr), "Creating D3D sampler state failed");
|
||||||
m_sampler.emplace(state.hex, res);
|
return m_sampler.emplace(state.hex, std::move(res)).first->second.Get();
|
||||||
return res.Get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D11BlendState* StateCache::Get(BlendingState state)
|
ID3D11BlendState* StateCache::Get(BlendingState state)
|
||||||
@ -381,12 +380,11 @@ ID3D11BlendState* StateCache::Get(BlendingState state)
|
|||||||
tdesc.LogicOpEnable = TRUE;
|
tdesc.LogicOpEnable = TRUE;
|
||||||
tdesc.LogicOp = logic_ops[state.logicmode];
|
tdesc.LogicOp = logic_ops[state.logicmode];
|
||||||
|
|
||||||
ID3D11BlendState1* res;
|
ComPtr<ID3D11BlendState1> res;
|
||||||
HRESULT hr = D3D::device1->CreateBlendState1(&desc, &res);
|
HRESULT hr = D3D::device1->CreateBlendState1(&desc, res.GetAddressOf());
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
m_blend.emplace(state.hex, res);
|
return m_blend.emplace(state.hex, std::move(res)).first->second.Get();
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,10 +423,9 @@ ID3D11BlendState* StateCache::Get(BlendingState state)
|
|||||||
tdesc.BlendOpAlpha = state.subtractAlpha ? D3D11_BLEND_OP_REV_SUBTRACT : D3D11_BLEND_OP_ADD;
|
tdesc.BlendOpAlpha = state.subtractAlpha ? D3D11_BLEND_OP_REV_SUBTRACT : D3D11_BLEND_OP_ADD;
|
||||||
|
|
||||||
ComPtr<ID3D11BlendState> res;
|
ComPtr<ID3D11BlendState> res;
|
||||||
HRESULT hr = D3D::device->CreateBlendState(&desc, &res);
|
HRESULT hr = D3D::device->CreateBlendState(&desc, res.GetAddressOf());
|
||||||
CHECK(SUCCEEDED(hr), "Creating D3D blend state failed");
|
CHECK(SUCCEEDED(hr), "Creating D3D blend state failed");
|
||||||
m_blend.emplace(state.hex, res);
|
return m_blend.emplace(state.hex, std::move(res)).first->second.Get();
|
||||||
return res.Get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D11RasterizerState* StateCache::Get(RasterizationState state)
|
ID3D11RasterizerState* StateCache::Get(RasterizationState state)
|
||||||
@ -447,10 +444,9 @@ ID3D11RasterizerState* StateCache::Get(RasterizationState state)
|
|||||||
desc.ScissorEnable = TRUE;
|
desc.ScissorEnable = TRUE;
|
||||||
|
|
||||||
ComPtr<ID3D11RasterizerState> res;
|
ComPtr<ID3D11RasterizerState> res;
|
||||||
HRESULT hr = D3D::device->CreateRasterizerState(&desc, &res);
|
HRESULT hr = D3D::device->CreateRasterizerState(&desc, res.GetAddressOf());
|
||||||
CHECK(SUCCEEDED(hr), "Creating D3D rasterizer state failed");
|
CHECK(SUCCEEDED(hr), "Creating D3D rasterizer state failed");
|
||||||
m_raster.emplace(state.hex, res);
|
return m_raster.emplace(state.hex, std::move(res)).first->second.Get();
|
||||||
return res.Get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D11DepthStencilState* StateCache::Get(DepthState state)
|
ID3D11DepthStencilState* StateCache::Get(DepthState state)
|
||||||
@ -490,10 +486,9 @@ ID3D11DepthStencilState* StateCache::Get(DepthState state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID3D11DepthStencilState> res;
|
ComPtr<ID3D11DepthStencilState> res;
|
||||||
HRESULT hr = D3D::device->CreateDepthStencilState(&depthdc, &res);
|
HRESULT hr = D3D::device->CreateDepthStencilState(&depthdc, res.GetAddressOf());
|
||||||
CHECK(SUCCEEDED(hr), "Creating D3D depth stencil state failed");
|
CHECK(SUCCEEDED(hr), "Creating D3D depth stencil state failed");
|
||||||
m_depth.emplace(state.hex, res);
|
return m_depth.emplace(state.hex, std::move(res)).first->second.Get();
|
||||||
return res.Get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D11_PRIMITIVE_TOPOLOGY StateCache::GetPrimitiveTopology(PrimitiveType primitive)
|
D3D11_PRIMITIVE_TOPOLOGY StateCache::GetPrimitiveTopology(PrimitiveType primitive)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user