1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Fixed initial context state setup and viewport orientation

This commit is contained in:
Philip Rebohle 2017-12-07 18:38:54 +01:00
parent b7e263fc73
commit 2a2e179b91

View File

@ -42,7 +42,10 @@ namespace dxvk {
m_defaultCbState = new DxvkBlendState( m_defaultCbState = new DxvkBlendState(
VK_FALSE, VK_LOGIC_OP_CLEAR, 0, nullptr); VK_FALSE, VK_LOGIC_OP_CLEAR, 0, nullptr);
this->ClearState(); m_context->setRasterizerState(m_defaultRsState);
m_context->setMultisampleState(m_defaultMsState);
m_context->setDepthStencilState(m_defaultDsState);
m_context->setBlendState(m_defaultCbState);
} }
@ -115,8 +118,8 @@ namespace dxvk {
// this->CSSetSamplers (0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, nullptr); // this->CSSetSamplers (0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT, nullptr);
this->OMSetRenderTargets(0, nullptr, nullptr); this->OMSetRenderTargets(0, nullptr, nullptr);
this->OMSetBlendState(nullptr, nullptr, D3D11_DEFAULT_SAMPLE_MASK); // this->OMSetBlendState(nullptr, nullptr, D3D11_DEFAULT_SAMPLE_MASK);
this->OMSetDepthStencilState(nullptr, 0); // this->OMSetDepthStencilState(nullptr, 0);
this->RSSetState(nullptr); this->RSSetState(nullptr);
this->RSSetViewports(0, nullptr); this->RSSetViewports(0, nullptr);
@ -1080,8 +1083,6 @@ namespace dxvk {
const FLOAT BlendFactor[4], const FLOAT BlendFactor[4],
UINT SampleMask) { UINT SampleMask) {
Logger::err("D3D11DeviceContext::OMSetBlendState: Not implemented"); Logger::err("D3D11DeviceContext::OMSetBlendState: Not implemented");
m_context->setBlendState(m_defaultCbState);
m_context->setMultisampleState(m_defaultMsState);
} }
@ -1089,7 +1090,6 @@ namespace dxvk {
ID3D11DepthStencilState* pDepthStencilState, ID3D11DepthStencilState* pDepthStencilState,
UINT StencilRef) { UINT StencilRef) {
Logger::err("D3D11DeviceContext::OMSetDepthStencilState: Not implemented"); Logger::err("D3D11DeviceContext::OMSetDepthStencilState: Not implemented");
m_context->setDepthStencilState(m_defaultDsState);
} }
@ -1259,14 +1259,13 @@ namespace dxvk {
std::array<VkViewport, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports; std::array<VkViewport, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> viewports;
std::array<VkRect2D, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors; std::array<VkRect2D, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors;
// TODO find out if we need to flip the viewports vertically
for (uint32_t i = 0; i < m_state.rs.numViewports; i++) { for (uint32_t i = 0; i < m_state.rs.numViewports; i++) {
const D3D11_VIEWPORT& vp = m_state.rs.viewports.at(i); const D3D11_VIEWPORT& vp = m_state.rs.viewports.at(i);
viewports.at(i) = VkViewport { viewports.at(i) = VkViewport {
vp.TopLeftX, vp.TopLeftY, vp.TopLeftX, vp.Height - vp.TopLeftY,
vp.Width, vp.Height, vp.Width, -vp.Height,
vp.MaxDepth, vp.MinDepth, vp.MinDepth, vp.MaxDepth,
}; };
} }