1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-01 10:54:14 +01:00

[d3d11] Minor CPU savings

This commit is contained in:
Philip Rebohle 2019-05-01 03:00:23 +02:00
parent 7e1b0ef8e6
commit f76fd8fa5d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

@ -3067,9 +3067,9 @@ namespace dxvk {
// but the viewport coordinates are aligned to the top-left // but the viewport coordinates are aligned to the top-left
// corner so we can get away with flipping the viewport. // corner so we can get away with flipping the viewport.
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[i];
viewports.at(i) = VkViewport { viewports[i] = VkViewport {
vp.TopLeftX, vp.Height + vp.TopLeftY, vp.TopLeftX, vp.Height + vp.TopLeftY,
vp.Width, -vp.Height, vp.Width, -vp.Height,
vp.MinDepth, vp.MaxDepth, vp.MinDepth, vp.MaxDepth,
@ -3089,7 +3089,7 @@ namespace dxvk {
for (uint32_t i = 0; i < m_state.rs.numViewports; i++) { for (uint32_t i = 0; i < m_state.rs.numViewports; i++) {
if (enableScissorTest && (i < m_state.rs.numScissors)) { if (enableScissorTest && (i < m_state.rs.numScissors)) {
D3D11_RECT sr = m_state.rs.scissors.at(i); D3D11_RECT sr = m_state.rs.scissors[i];
VkOffset2D srPosA; VkOffset2D srPosA;
srPosA.x = std::max<int32_t>(0, sr.left); srPosA.x = std::max<int32_t>(0, sr.left);
@ -3103,9 +3103,9 @@ namespace dxvk {
srSize.width = uint32_t(srPosB.x - srPosA.x); srSize.width = uint32_t(srPosB.x - srPosA.x);
srSize.height = uint32_t(srPosB.y - srPosA.y); srSize.height = uint32_t(srPosB.y - srPosA.y);
scissors.at(i) = VkRect2D { srPosA, srSize }; scissors[i] = VkRect2D { srPosA, srSize };
} else { } else {
scissors.at(i) = VkRect2D { scissors[i] = VkRect2D {
VkOffset2D { 0, 0 }, VkOffset2D { 0, 0 },
VkExtent2D { VkExtent2D {
D3D11_VIEWPORT_BOUNDS_MAX, D3D11_VIEWPORT_BOUNDS_MAX,
@ -3172,10 +3172,10 @@ namespace dxvk {
// so we'll just create a new one every time the render // so we'll just create a new one every time the render
// target bindings are updated. Set up the attachments. // target bindings are updated. Set up the attachments.
for (UINT i = 0; i < m_state.om.renderTargetViews.size(); i++) { for (UINT i = 0; i < m_state.om.renderTargetViews.size(); i++) {
if (m_state.om.renderTargetViews.at(i) != nullptr) { if (m_state.om.renderTargetViews[i] != nullptr) {
attachments.color[i] = { attachments.color[i] = {
m_state.om.renderTargetViews.at(i)->GetImageView(), m_state.om.renderTargetViews[i]->GetImageView(),
m_state.om.renderTargetViews.at(i)->GetRenderLayout() }; m_state.om.renderTargetViews[i]->GetRenderLayout() };
} }
} }
@ -3529,7 +3529,7 @@ namespace dxvk {
return; return;
for (UINT i = 0; i < m_state.om.renderTargetViews.size(); i++) { for (UINT i = 0; i < m_state.om.renderTargetViews.size(); i++) {
m_state.om.renderTargetViews.at(i) = i < NumViews m_state.om.renderTargetViews[i] = i < NumViews
? static_cast<D3D11RenderTargetView*>(ppRenderTargetViews[i]) ? static_cast<D3D11RenderTargetView*>(ppRenderTargetViews[i])
: nullptr; : nullptr;
} }