Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2022-07-04 22:03:20 +0300
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2022-07-07 17:16:51 +0300
commitfcadaec1296848242f391f131dc149ec5bcf5859 (patch)
tree67e87e3bfb65dedc28585aee9d5bf3cd1ce119ca
parentd71e85785c8f2913b4fa6c781b71e23fe6ace29c (diff)
[dxvk] Store clear values inside render pass opsdynamic-rendering
The previous model was designed around vkCmdBeginRenderPass, which was somewhat clunky regarding attachment clears. This is no longer needed.
-rw-r--r--src/dxvk/dxvk_context.cpp22
-rw-r--r--src/dxvk/dxvk_context.h4
-rw-r--r--src/dxvk/dxvk_context_state.h2
-rw-r--r--src/dxvk/dxvk_renderpass.h2
4 files changed, 11 insertions, 19 deletions
diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp
index e017cf94..a4e30fe4 100644
--- a/src/dxvk/dxvk_context.cpp
+++ b/src/dxvk/dxvk_context.cpp
@@ -2046,17 +2046,17 @@ namespace dxvk {
if (m_state.om.renderPassOps.colorOps[colorIndex].loadOp != VK_ATTACHMENT_LOAD_OP_LOAD && !is3D)
m_state.om.renderPassOps.colorOps[colorIndex].loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
- m_state.om.clearValues[attachmentIndex].color = clearValue.color;
+ m_state.om.renderPassOps.colorOps[colorIndex].clearValue = clearValue.color;
}
if ((clearAspects | discardAspects) & VK_IMAGE_ASPECT_DEPTH_BIT) {
m_state.om.renderPassOps.depthOps.loadOpD = depthOp.loadOpD;
- m_state.om.clearValues[attachmentIndex].depthStencil.depth = clearValue.depthStencil.depth;
+ m_state.om.renderPassOps.depthOps.clearValue.depth = clearValue.depthStencil.depth;
}
if ((clearAspects | discardAspects) & VK_IMAGE_ASPECT_STENCIL_BIT) {
m_state.om.renderPassOps.depthOps.loadOpS = depthOp.loadOpS;
- m_state.om.clearValues[attachmentIndex].depthStencil.stencil = clearValue.depthStencil.stencil;
+ m_state.om.renderPassOps.depthOps.clearValue.stencil = clearValue.depthStencil.stencil;
}
if ((clearAspects | discardAspects) & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
@@ -4010,9 +4010,7 @@ namespace dxvk {
this->renderPassBindFramebuffer(
m_state.om.framebufferInfo,
- m_state.om.renderPassOps,
- m_state.om.framebufferInfo.numAttachments(),
- m_state.om.clearValues.data());
+ m_state.om.renderPassOps);
// Track the final layout of each render target
this->applyRenderTargetStoreLayouts();
@@ -4207,15 +4205,12 @@ namespace dxvk {
void DxvkContext::renderPassBindFramebuffer(
const DxvkFramebufferInfo& framebufferInfo,
- const DxvkRenderPassOps& ops,
- uint32_t clearValueCount,
- const VkClearValue* clearValues) {
+ const DxvkRenderPassOps& ops) {
const DxvkFramebufferSize fbSize = framebufferInfo.size();
this->renderPassEmitInitBarriers(framebufferInfo, ops);
this->renderPassEmitPostBarriers(framebufferInfo, ops);
- uint32_t clearValueIndex = 0;
uint32_t colorInfoCount = 0;
std::array<VkRenderingAttachmentInfoKHR, MaxNumRenderTargets> colorInfos;
@@ -4231,9 +4226,8 @@ namespace dxvk {
colorInfos[i].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
if (ops.colorOps[i].loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
- colorInfos[i].clearValue = clearValues[clearValueIndex];
+ colorInfos[i].clearValue.color = ops.colorOps[i].clearValue;
- clearValueIndex += 1;
colorInfoCount = i + 1;
}
}
@@ -4250,7 +4244,7 @@ namespace dxvk {
depthInfo.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
if (ops.depthOps.loadOpD == VK_ATTACHMENT_LOAD_OP_CLEAR)
- depthInfo.clearValue = clearValues[clearValueIndex];
+ depthInfo.clearValue.depthStencil.depth = ops.depthOps.clearValue.depth;
}
VkRenderingAttachmentInfoKHR stencilInfo = depthInfo;
@@ -4260,7 +4254,7 @@ namespace dxvk {
stencilInfo.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
if (ops.depthOps.loadOpS == VK_ATTACHMENT_LOAD_OP_CLEAR)
- stencilInfo.clearValue = clearValues[clearValueIndex];
+ stencilInfo.clearValue.depthStencil.stencil = ops.depthOps.clearValue.stencil;
}
VkRenderingInfoKHR renderingInfo = { VK_STRUCTURE_TYPE_RENDERING_INFO_KHR };
diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h
index 738ecb49..29a07155 100644
--- a/src/dxvk/dxvk_context.h
+++ b/src/dxvk/dxvk_context.h
@@ -1297,9 +1297,7 @@ namespace dxvk {
void renderPassBindFramebuffer(
const DxvkFramebufferInfo& framebufferInfo,
- const DxvkRenderPassOps& ops,
- uint32_t clearValueCount,
- const VkClearValue* clearValues);
+ const DxvkRenderPassOps& ops);
void renderPassUnbindFramebuffer();
diff --git a/src/dxvk/dxvk_context_state.h b/src/dxvk/dxvk_context_state.h
index 7ca7b25d..762b1ab1 100644
--- a/src/dxvk/dxvk_context_state.h
+++ b/src/dxvk/dxvk_context_state.h
@@ -97,8 +97,6 @@ namespace dxvk {
struct DxvkOutputMergerState {
- std::array<VkClearValue, MaxNumRenderTargets + 1> clearValues = { };
-
DxvkRenderTargets renderTargets;
DxvkRenderPassOps renderPassOps;
DxvkFramebufferInfo framebufferInfo;
diff --git a/src/dxvk/dxvk_renderpass.h b/src/dxvk/dxvk_renderpass.h
index 5688946c..64971650 100644
--- a/src/dxvk/dxvk_renderpass.h
+++ b/src/dxvk/dxvk_renderpass.h
@@ -24,6 +24,7 @@ namespace dxvk {
VkAttachmentLoadOp loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
VkImageLayout loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout storeLayout = VK_IMAGE_LAYOUT_GENERAL;
+ VkClearColorValue clearValue = VkClearColorValue();
};
@@ -38,6 +39,7 @@ namespace dxvk {
VkAttachmentLoadOp loadOpS = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
VkImageLayout loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
VkImageLayout storeLayout = VK_IMAGE_LAYOUT_GENERAL;
+ VkClearDepthStencilValue clearValue = VkClearDepthStencilValue();
};