mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 07:24:15 +01:00
[dxvk] Refactor command buffer allocation
This commit is contained in:
parent
8a79699ae3
commit
69d562e701
@ -226,7 +226,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Execute transfer command buffer, if any
|
// Execute transfer command buffer, if any
|
||||||
if (cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer))
|
if (cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer))
|
||||||
m_commandSubmission.executeCommandBuffer(cmd.sdmaBuffer);
|
m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::SdmaBuffer)]);
|
||||||
|
|
||||||
// If we had either a transfer command or a semaphore wait, submit to the
|
// If we had either a transfer command or a semaphore wait, submit to the
|
||||||
// transfer queue so that all subsequent commands get stalled as necessary.
|
// transfer queue so that all subsequent commands get stalled as necessary.
|
||||||
@ -250,10 +250,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
// Submit graphics commands
|
// Submit graphics commands
|
||||||
if (cmd.usedFlags.test(DxvkCmdBuffer::InitBuffer))
|
if (cmd.usedFlags.test(DxvkCmdBuffer::InitBuffer))
|
||||||
m_commandSubmission.executeCommandBuffer(cmd.initBuffer);
|
m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::InitBuffer)]);
|
||||||
|
|
||||||
if (cmd.usedFlags.test(DxvkCmdBuffer::ExecBuffer))
|
if (cmd.usedFlags.test(DxvkCmdBuffer::ExecBuffer))
|
||||||
m_commandSubmission.executeCommandBuffer(cmd.execBuffer);
|
m_commandSubmission.executeCommandBuffer(cmd.cmdBuffers[uint32_t(DxvkCmdBuffer::ExecBuffer)]);
|
||||||
|
|
||||||
if (isLast) {
|
if (isLast) {
|
||||||
// Signal per-command list semaphores on the final submission
|
// Signal per-command list semaphores on the final submission
|
||||||
@ -306,9 +306,8 @@ namespace dxvk {
|
|||||||
m_cmd = DxvkCommandSubmissionInfo();
|
m_cmd = DxvkCommandSubmissionInfo();
|
||||||
|
|
||||||
// Grab a fresh set of command buffers from the pools
|
// Grab a fresh set of command buffers from the pools
|
||||||
m_cmd.execBuffer = m_graphicsPool->getCommandBuffer();
|
for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++)
|
||||||
m_cmd.initBuffer = m_graphicsPool->getCommandBuffer();
|
m_cmd.cmdBuffers[i] = allocateCommandBuffer(DxvkCmdBuffer(i));
|
||||||
m_cmd.sdmaBuffer = m_transferPool->getCommandBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -318,9 +317,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
// For consistency, end all command buffers here,
|
// For consistency, end all command buffers here,
|
||||||
// regardless of whether they have been used.
|
// regardless of whether they have been used.
|
||||||
this->endCommandBuffer(m_cmd.execBuffer);
|
for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++)
|
||||||
this->endCommandBuffer(m_cmd.initBuffer);
|
endCommandBuffer(m_cmd.cmdBuffers[i]);
|
||||||
this->endCommandBuffer(m_cmd.sdmaBuffer);
|
|
||||||
|
|
||||||
// Reset all command buffer handles
|
// Reset all command buffer handles
|
||||||
m_cmd = DxvkCommandSubmissionInfo();
|
m_cmd = DxvkCommandSubmissionInfo();
|
||||||
@ -336,19 +334,11 @@ namespace dxvk {
|
|||||||
m_cmdSubmissions.push_back(m_cmd);
|
m_cmdSubmissions.push_back(m_cmd);
|
||||||
|
|
||||||
// Only replace used command buffer to save resources
|
// Only replace used command buffer to save resources
|
||||||
if (m_cmd.usedFlags.test(DxvkCmdBuffer::ExecBuffer)) {
|
for (uint32_t i = 0; i < m_cmd.cmdBuffers.size(); i++) {
|
||||||
this->endCommandBuffer(m_cmd.execBuffer);
|
if (m_cmd.usedFlags.test(DxvkCmdBuffer(i))) {
|
||||||
m_cmd.execBuffer = m_graphicsPool->getCommandBuffer();
|
endCommandBuffer(m_cmd.cmdBuffers[i]);
|
||||||
|
m_cmd.cmdBuffers[i] = allocateCommandBuffer(DxvkCmdBuffer(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_cmd.usedFlags.test(DxvkCmdBuffer::InitBuffer)) {
|
|
||||||
this->endCommandBuffer(m_cmd.initBuffer);
|
|
||||||
m_cmd.initBuffer = m_graphicsPool->getCommandBuffer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_cmd.usedFlags.test(DxvkCmdBuffer::SdmaBuffer)) {
|
|
||||||
this->endCommandBuffer(m_cmd.sdmaBuffer);
|
|
||||||
m_cmd.sdmaBuffer = m_transferPool->getCommandBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cmd.syncSdma = VK_FALSE;
|
m_cmd.syncSdma = VK_FALSE;
|
||||||
@ -399,4 +389,11 @@ namespace dxvk {
|
|||||||
throw DxvkError("DxvkCommandList: Failed to end command buffer");
|
throw DxvkError("DxvkCommandList: Failed to end command buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VkCommandBuffer DxvkCommandList::allocateCommandBuffer(DxvkCmdBuffer type) {
|
||||||
|
return type == DxvkCmdBuffer::SdmaBuffer
|
||||||
|
? m_transferPool->getCommandBuffer()
|
||||||
|
: m_graphicsPool->getCommandBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,11 @@ namespace dxvk {
|
|||||||
* the command buffers need to be submitted.
|
* the command buffers need to be submitted.
|
||||||
*/
|
*/
|
||||||
enum class DxvkCmdBuffer : uint32_t {
|
enum class DxvkCmdBuffer : uint32_t {
|
||||||
InitBuffer = 0,
|
ExecBuffer,
|
||||||
ExecBuffer = 1,
|
InitBuffer,
|
||||||
SdmaBuffer = 2,
|
SdmaBuffer,
|
||||||
|
|
||||||
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
using DxvkCmdBufferFlags = Flags<DxvkCmdBuffer>;
|
using DxvkCmdBufferFlags = Flags<DxvkCmdBuffer>;
|
||||||
@ -138,11 +140,10 @@ namespace dxvk {
|
|||||||
struct DxvkCommandSubmissionInfo {
|
struct DxvkCommandSubmissionInfo {
|
||||||
DxvkCmdBufferFlags usedFlags = 0;
|
DxvkCmdBufferFlags usedFlags = 0;
|
||||||
VkBool32 syncSdma = VK_FALSE;
|
VkBool32 syncSdma = VK_FALSE;
|
||||||
VkCommandBuffer execBuffer = VK_NULL_HANDLE;
|
|
||||||
VkCommandBuffer initBuffer = VK_NULL_HANDLE;
|
|
||||||
VkCommandBuffer sdmaBuffer = VK_NULL_HANDLE;
|
|
||||||
VkBool32 sparseBind = VK_FALSE;
|
VkBool32 sparseBind = VK_FALSE;
|
||||||
uint32_t sparseCmd = 0;
|
uint32_t sparseCmd = 0;
|
||||||
|
|
||||||
|
std::array<VkCommandBuffer, uint32_t(DxvkCmdBuffer::Count)> cmdBuffers = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -404,8 +405,7 @@ namespace dxvk {
|
|||||||
VkQueryControlFlags flags) {
|
VkQueryControlFlags flags) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdBeginQuery(m_cmd.execBuffer,
|
m_vkd->vkCmdBeginQuery(getCmdBuffer(), queryPool, query, flags);
|
||||||
queryPool, query, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -416,8 +416,8 @@ namespace dxvk {
|
|||||||
uint32_t index) {
|
uint32_t index) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdBeginQueryIndexedEXT(
|
m_vkd->vkCmdBeginQueryIndexedEXT(getCmdBuffer(),
|
||||||
m_cmd.execBuffer, queryPool, query, flags, index);
|
queryPool, query, flags, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -425,7 +425,7 @@ namespace dxvk {
|
|||||||
const VkRenderingInfo* pRenderingInfo) {
|
const VkRenderingInfo* pRenderingInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdBeginRendering(m_cmd.execBuffer, pRenderingInfo);
|
m_vkd->vkCmdBeginRendering(getCmdBuffer(), pRenderingInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ namespace dxvk {
|
|||||||
uint32_t bufferCount,
|
uint32_t bufferCount,
|
||||||
const VkBuffer* counterBuffers,
|
const VkBuffer* counterBuffers,
|
||||||
const VkDeviceSize* counterOffsets) {
|
const VkDeviceSize* counterOffsets) {
|
||||||
m_vkd->vkCmdBeginTransformFeedbackEXT(m_cmd.execBuffer,
|
m_vkd->vkCmdBeginTransformFeedbackEXT(getCmdBuffer(),
|
||||||
firstBuffer, bufferCount, counterBuffers, counterOffsets);
|
firstBuffer, bufferCount, counterBuffers, counterOffsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ namespace dxvk {
|
|||||||
VkBuffer buffer,
|
VkBuffer buffer,
|
||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
VkIndexType indexType) {
|
VkIndexType indexType) {
|
||||||
m_vkd->vkCmdBindIndexBuffer(m_cmd.execBuffer,
|
m_vkd->vkCmdBindIndexBuffer(getCmdBuffer(),
|
||||||
buffer, offset, indexType);
|
buffer, offset, indexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
VkDeviceSize size,
|
VkDeviceSize size,
|
||||||
VkIndexType indexType) {
|
VkIndexType indexType) {
|
||||||
m_vkd->vkCmdBindIndexBuffer2KHR(m_cmd.execBuffer,
|
m_vkd->vkCmdBindIndexBuffer2KHR(getCmdBuffer(),
|
||||||
buffer, offset, size, indexType);
|
buffer, offset, size, indexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ namespace dxvk {
|
|||||||
const VkBuffer* pBuffers,
|
const VkBuffer* pBuffers,
|
||||||
const VkDeviceSize* pOffsets,
|
const VkDeviceSize* pOffsets,
|
||||||
const VkDeviceSize* pSizes) {
|
const VkDeviceSize* pSizes) {
|
||||||
m_vkd->vkCmdBindTransformFeedbackBuffersEXT(m_cmd.execBuffer,
|
m_vkd->vkCmdBindTransformFeedbackBuffersEXT(getCmdBuffer(),
|
||||||
firstBinding, bindingCount, pBuffers, pOffsets, pSizes);
|
firstBinding, bindingCount, pBuffers, pOffsets, pSizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ namespace dxvk {
|
|||||||
const VkDeviceSize* pOffsets,
|
const VkDeviceSize* pOffsets,
|
||||||
const VkDeviceSize* pSizes,
|
const VkDeviceSize* pSizes,
|
||||||
const VkDeviceSize* pStrides) {
|
const VkDeviceSize* pStrides) {
|
||||||
m_vkd->vkCmdBindVertexBuffers2(m_cmd.execBuffer,
|
m_vkd->vkCmdBindVertexBuffers2(getCmdBuffer(),
|
||||||
firstBinding, bindingCount, pBuffers, pOffsets,
|
firstBinding, bindingCount, pBuffers, pOffsets,
|
||||||
pSizes, pStrides);
|
pSizes, pStrides);
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ namespace dxvk {
|
|||||||
void cmdLaunchCuKernel(VkCuLaunchInfoNVX launchInfo) {
|
void cmdLaunchCuKernel(VkCuLaunchInfoNVX launchInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdCuLaunchKernelNVX(m_cmd.execBuffer, &launchInfo);
|
m_vkd->vkCmdCuLaunchKernelNVX(getCmdBuffer(), &launchInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ namespace dxvk {
|
|||||||
const VkBlitImageInfo2* pBlitInfo) {
|
const VkBlitImageInfo2* pBlitInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdBlitImage2(m_cmd.execBuffer, pBlitInfo);
|
m_vkd->vkCmdBlitImage2(getCmdBuffer(), pBlitInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -538,9 +538,8 @@ namespace dxvk {
|
|||||||
const VkClearAttachment* pAttachments,
|
const VkClearAttachment* pAttachments,
|
||||||
uint32_t rectCount,
|
uint32_t rectCount,
|
||||||
const VkClearRect* pRects) {
|
const VkClearRect* pRects) {
|
||||||
m_vkd->vkCmdClearAttachments(m_cmd.execBuffer,
|
m_vkd->vkCmdClearAttachments(getCmdBuffer(),
|
||||||
attachmentCount, pAttachments,
|
attachmentCount, pAttachments, rectCount, pRects);
|
||||||
rectCount, pRects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -653,7 +652,7 @@ namespace dxvk {
|
|||||||
uint32_t instanceCount,
|
uint32_t instanceCount,
|
||||||
uint32_t firstVertex,
|
uint32_t firstVertex,
|
||||||
uint32_t firstInstance) {
|
uint32_t firstInstance) {
|
||||||
m_vkd->vkCmdDraw(m_cmd.execBuffer,
|
m_vkd->vkCmdDraw(getCmdBuffer(),
|
||||||
vertexCount, instanceCount,
|
vertexCount, instanceCount,
|
||||||
firstVertex, firstInstance);
|
firstVertex, firstInstance);
|
||||||
}
|
}
|
||||||
@ -664,7 +663,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
uint32_t drawCount,
|
uint32_t drawCount,
|
||||||
uint32_t stride) {
|
uint32_t stride) {
|
||||||
m_vkd->vkCmdDrawIndirect(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndirect(getCmdBuffer(),
|
||||||
buffer, offset, drawCount, stride);
|
buffer, offset, drawCount, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -676,7 +675,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize countOffset,
|
VkDeviceSize countOffset,
|
||||||
uint32_t maxDrawCount,
|
uint32_t maxDrawCount,
|
||||||
uint32_t stride) {
|
uint32_t stride) {
|
||||||
m_vkd->vkCmdDrawIndirectCount(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndirectCount(getCmdBuffer(),
|
||||||
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
|
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -687,7 +686,7 @@ namespace dxvk {
|
|||||||
uint32_t firstIndex,
|
uint32_t firstIndex,
|
||||||
int32_t vertexOffset,
|
int32_t vertexOffset,
|
||||||
uint32_t firstInstance) {
|
uint32_t firstInstance) {
|
||||||
m_vkd->vkCmdDrawIndexed(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndexed(getCmdBuffer(),
|
||||||
indexCount, instanceCount,
|
indexCount, instanceCount,
|
||||||
firstIndex, vertexOffset,
|
firstIndex, vertexOffset,
|
||||||
firstInstance);
|
firstInstance);
|
||||||
@ -699,7 +698,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize offset,
|
VkDeviceSize offset,
|
||||||
uint32_t drawCount,
|
uint32_t drawCount,
|
||||||
uint32_t stride) {
|
uint32_t stride) {
|
||||||
m_vkd->vkCmdDrawIndexedIndirect(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndexedIndirect(getCmdBuffer(),
|
||||||
buffer, offset, drawCount, stride);
|
buffer, offset, drawCount, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +710,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize countOffset,
|
VkDeviceSize countOffset,
|
||||||
uint32_t maxDrawCount,
|
uint32_t maxDrawCount,
|
||||||
uint32_t stride) {
|
uint32_t stride) {
|
||||||
m_vkd->vkCmdDrawIndexedIndirectCount(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndexedIndirectCount(getCmdBuffer(),
|
||||||
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
|
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -723,7 +722,7 @@ namespace dxvk {
|
|||||||
VkDeviceSize counterBufferOffset,
|
VkDeviceSize counterBufferOffset,
|
||||||
uint32_t counterOffset,
|
uint32_t counterOffset,
|
||||||
uint32_t vertexStride) {
|
uint32_t vertexStride) {
|
||||||
m_vkd->vkCmdDrawIndirectByteCountEXT(m_cmd.execBuffer,
|
m_vkd->vkCmdDrawIndirectByteCountEXT(getCmdBuffer(),
|
||||||
instanceCount, firstInstance, counterBuffer,
|
instanceCount, firstInstance, counterBuffer,
|
||||||
counterBufferOffset, counterOffset, vertexStride);
|
counterBufferOffset, counterOffset, vertexStride);
|
||||||
}
|
}
|
||||||
@ -732,7 +731,7 @@ namespace dxvk {
|
|||||||
void cmdEndQuery(
|
void cmdEndQuery(
|
||||||
VkQueryPool queryPool,
|
VkQueryPool queryPool,
|
||||||
uint32_t query) {
|
uint32_t query) {
|
||||||
m_vkd->vkCmdEndQuery(m_cmd.execBuffer, queryPool, query);
|
m_vkd->vkCmdEndQuery(getCmdBuffer(), queryPool, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -740,13 +739,13 @@ namespace dxvk {
|
|||||||
VkQueryPool queryPool,
|
VkQueryPool queryPool,
|
||||||
uint32_t query,
|
uint32_t query,
|
||||||
uint32_t index) {
|
uint32_t index) {
|
||||||
m_vkd->vkCmdEndQueryIndexedEXT(
|
m_vkd->vkCmdEndQueryIndexedEXT(getCmdBuffer(),
|
||||||
m_cmd.execBuffer, queryPool, query, index);
|
queryPool, query, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdEndRendering() {
|
void cmdEndRendering() {
|
||||||
m_vkd->vkCmdEndRendering(m_cmd.execBuffer);
|
m_vkd->vkCmdEndRendering(getCmdBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -755,7 +754,7 @@ namespace dxvk {
|
|||||||
uint32_t bufferCount,
|
uint32_t bufferCount,
|
||||||
const VkBuffer* counterBuffers,
|
const VkBuffer* counterBuffers,
|
||||||
const VkDeviceSize* counterOffsets) {
|
const VkDeviceSize* counterOffsets) {
|
||||||
m_vkd->vkCmdEndTransformFeedbackEXT(m_cmd.execBuffer,
|
m_vkd->vkCmdEndTransformFeedbackEXT(getCmdBuffer(),
|
||||||
firstBuffer, bufferCount, counterBuffers, counterOffsets);
|
firstBuffer, bufferCount, counterBuffers, counterOffsets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,7 +809,7 @@ namespace dxvk {
|
|||||||
const VkResolveImageInfo2* resolveInfo) {
|
const VkResolveImageInfo2* resolveInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdResolveImage2(m_cmd.execBuffer, resolveInfo);
|
m_vkd->vkCmdResolveImage2(getCmdBuffer(), resolveInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -829,24 +828,24 @@ namespace dxvk {
|
|||||||
|
|
||||||
void cmdSetAlphaToCoverageState(
|
void cmdSetAlphaToCoverageState(
|
||||||
VkBool32 alphaToCoverageEnable) {
|
VkBool32 alphaToCoverageEnable) {
|
||||||
m_vkd->vkCmdSetAlphaToCoverageEnableEXT(m_cmd.execBuffer, alphaToCoverageEnable);
|
m_vkd->vkCmdSetAlphaToCoverageEnableEXT(getCmdBuffer(), alphaToCoverageEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetBlendConstants(const float blendConstants[4]) {
|
void cmdSetBlendConstants(const float blendConstants[4]) {
|
||||||
m_vkd->vkCmdSetBlendConstants(m_cmd.execBuffer, blendConstants);
|
m_vkd->vkCmdSetBlendConstants(getCmdBuffer(), blendConstants);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetDepthBiasState(
|
void cmdSetDepthBiasState(
|
||||||
VkBool32 depthBiasEnable) {
|
VkBool32 depthBiasEnable) {
|
||||||
m_vkd->vkCmdSetDepthBiasEnable(m_cmd.execBuffer, depthBiasEnable);
|
m_vkd->vkCmdSetDepthBiasEnable(getCmdBuffer(), depthBiasEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetDepthClipState(
|
void cmdSetDepthClipState(
|
||||||
VkBool32 depthClipEnable) {
|
VkBool32 depthClipEnable) {
|
||||||
m_vkd->vkCmdSetDepthClipEnableEXT(m_cmd.execBuffer, depthClipEnable);
|
m_vkd->vkCmdSetDepthClipEnableEXT(getCmdBuffer(), depthClipEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -854,7 +853,7 @@ namespace dxvk {
|
|||||||
float depthBiasConstantFactor,
|
float depthBiasConstantFactor,
|
||||||
float depthBiasClamp,
|
float depthBiasClamp,
|
||||||
float depthBiasSlopeFactor) {
|
float depthBiasSlopeFactor) {
|
||||||
m_vkd->vkCmdSetDepthBias(m_cmd.execBuffer,
|
m_vkd->vkCmdSetDepthBias(getCmdBuffer(),
|
||||||
depthBiasConstantFactor,
|
depthBiasConstantFactor,
|
||||||
depthBiasClamp,
|
depthBiasClamp,
|
||||||
depthBiasSlopeFactor);
|
depthBiasSlopeFactor);
|
||||||
@ -863,14 +862,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
void cmdSetDepthBias2(
|
void cmdSetDepthBias2(
|
||||||
const VkDepthBiasInfoEXT *depthBiasInfo) {
|
const VkDepthBiasInfoEXT *depthBiasInfo) {
|
||||||
m_vkd->vkCmdSetDepthBias2EXT(m_cmd.execBuffer, depthBiasInfo);
|
m_vkd->vkCmdSetDepthBias2EXT(getCmdBuffer(), depthBiasInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetDepthBounds(
|
void cmdSetDepthBounds(
|
||||||
float minDepthBounds,
|
float minDepthBounds,
|
||||||
float maxDepthBounds) {
|
float maxDepthBounds) {
|
||||||
m_vkd->vkCmdSetDepthBounds(m_cmd.execBuffer,
|
m_vkd->vkCmdSetDepthBounds(getCmdBuffer(),
|
||||||
minDepthBounds,
|
minDepthBounds,
|
||||||
maxDepthBounds);
|
maxDepthBounds);
|
||||||
}
|
}
|
||||||
@ -878,7 +877,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
void cmdSetDepthBoundsState(
|
void cmdSetDepthBoundsState(
|
||||||
VkBool32 depthBoundsTestEnable) {
|
VkBool32 depthBoundsTestEnable) {
|
||||||
m_vkd->vkCmdSetDepthBoundsTestEnable(m_cmd.execBuffer, depthBoundsTestEnable);
|
m_vkd->vkCmdSetDepthBoundsTestEnable(getCmdBuffer(), depthBoundsTestEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -886,14 +885,15 @@ namespace dxvk {
|
|||||||
VkBool32 depthTestEnable,
|
VkBool32 depthTestEnable,
|
||||||
VkBool32 depthWriteEnable,
|
VkBool32 depthWriteEnable,
|
||||||
VkCompareOp depthCompareOp) {
|
VkCompareOp depthCompareOp) {
|
||||||
m_vkd->vkCmdSetDepthTestEnable(m_cmd.execBuffer, depthTestEnable);
|
VkCommandBuffer cmdBuffer = getCmdBuffer();
|
||||||
|
m_vkd->vkCmdSetDepthTestEnable(cmdBuffer, depthTestEnable);
|
||||||
|
|
||||||
if (depthTestEnable) {
|
if (depthTestEnable) {
|
||||||
m_vkd->vkCmdSetDepthWriteEnable(m_cmd.execBuffer, depthWriteEnable);
|
m_vkd->vkCmdSetDepthWriteEnable(cmdBuffer, depthWriteEnable);
|
||||||
m_vkd->vkCmdSetDepthCompareOp(m_cmd.execBuffer, depthCompareOp);
|
m_vkd->vkCmdSetDepthCompareOp(cmdBuffer, depthCompareOp);
|
||||||
} else {
|
} else {
|
||||||
m_vkd->vkCmdSetDepthWriteEnable(m_cmd.execBuffer, VK_FALSE);
|
m_vkd->vkCmdSetDepthWriteEnable(cmdBuffer, VK_FALSE);
|
||||||
m_vkd->vkCmdSetDepthCompareOp(m_cmd.execBuffer, VK_COMPARE_OP_ALWAYS);
|
m_vkd->vkCmdSetDepthCompareOp(cmdBuffer, VK_COMPARE_OP_ALWAYS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -903,31 +903,34 @@ namespace dxvk {
|
|||||||
const VkDependencyInfo* dependencyInfo) {
|
const VkDependencyInfo* dependencyInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vkd->vkCmdSetEvent2(m_cmd.execBuffer, event, dependencyInfo);
|
m_vkd->vkCmdSetEvent2(getCmdBuffer(), event, dependencyInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetMultisampleState(
|
void cmdSetMultisampleState(
|
||||||
VkSampleCountFlagBits sampleCount,
|
VkSampleCountFlagBits sampleCount,
|
||||||
VkSampleMask sampleMask) {
|
VkSampleMask sampleMask) {
|
||||||
m_vkd->vkCmdSetRasterizationSamplesEXT(m_cmd.execBuffer, sampleCount);
|
VkCommandBuffer cmdBuffer = getCmdBuffer();
|
||||||
m_vkd->vkCmdSetSampleMaskEXT(m_cmd.execBuffer, sampleCount, &sampleMask);
|
|
||||||
|
m_vkd->vkCmdSetRasterizationSamplesEXT(cmdBuffer, sampleCount);
|
||||||
|
m_vkd->vkCmdSetSampleMaskEXT(cmdBuffer, sampleCount, &sampleMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetRasterizerState(
|
void cmdSetRasterizerState(
|
||||||
VkCullModeFlags cullMode,
|
VkCullModeFlags cullMode,
|
||||||
VkFrontFace frontFace) {
|
VkFrontFace frontFace) {
|
||||||
m_vkd->vkCmdSetCullMode(m_cmd.execBuffer, cullMode);
|
VkCommandBuffer cmdBuffer = getCmdBuffer();
|
||||||
m_vkd->vkCmdSetFrontFace(m_cmd.execBuffer, frontFace);
|
|
||||||
|
m_vkd->vkCmdSetCullMode(cmdBuffer, cullMode);
|
||||||
|
m_vkd->vkCmdSetFrontFace(cmdBuffer, frontFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetScissor(
|
void cmdSetScissor(
|
||||||
uint32_t scissorCount,
|
uint32_t scissorCount,
|
||||||
const VkRect2D* scissors) {
|
const VkRect2D* scissors) {
|
||||||
m_vkd->vkCmdSetScissorWithCount(
|
m_vkd->vkCmdSetScissorWithCount(getCmdBuffer(), scissorCount, scissors);
|
||||||
m_cmd.execBuffer, scissorCount, scissors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -935,33 +938,35 @@ namespace dxvk {
|
|||||||
VkBool32 enableStencilTest,
|
VkBool32 enableStencilTest,
|
||||||
const VkStencilOpState& front,
|
const VkStencilOpState& front,
|
||||||
const VkStencilOpState& back) {
|
const VkStencilOpState& back) {
|
||||||
|
VkCommandBuffer cmdBuffer = getCmdBuffer();
|
||||||
|
|
||||||
m_vkd->vkCmdSetStencilTestEnable(
|
m_vkd->vkCmdSetStencilTestEnable(
|
||||||
m_cmd.execBuffer, enableStencilTest);
|
cmdBuffer, enableStencilTest);
|
||||||
|
|
||||||
if (enableStencilTest) {
|
if (enableStencilTest) {
|
||||||
m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilOp(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_BIT, front.failOp,
|
VK_STENCIL_FACE_FRONT_BIT, front.failOp,
|
||||||
front.passOp, front.depthFailOp, front.compareOp);
|
front.passOp, front.depthFailOp, front.compareOp);
|
||||||
m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilCompareMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_BIT, front.compareMask);
|
VK_STENCIL_FACE_FRONT_BIT, front.compareMask);
|
||||||
m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilWriteMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_BIT, front.writeMask);
|
VK_STENCIL_FACE_FRONT_BIT, front.writeMask);
|
||||||
|
|
||||||
m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilOp(cmdBuffer,
|
||||||
VK_STENCIL_FACE_BACK_BIT, back.failOp,
|
VK_STENCIL_FACE_BACK_BIT, back.failOp,
|
||||||
back.passOp, back.depthFailOp, back.compareOp);
|
back.passOp, back.depthFailOp, back.compareOp);
|
||||||
m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilCompareMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_BACK_BIT, back.compareMask);
|
VK_STENCIL_FACE_BACK_BIT, back.compareMask);
|
||||||
m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilWriteMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_BACK_BIT, back.writeMask);
|
VK_STENCIL_FACE_BACK_BIT, back.writeMask);
|
||||||
} else {
|
} else {
|
||||||
m_vkd->vkCmdSetStencilOp(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilOp(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_AND_BACK,
|
VK_STENCIL_FACE_FRONT_AND_BACK,
|
||||||
VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP,
|
VK_STENCIL_OP_KEEP, VK_STENCIL_OP_KEEP,
|
||||||
VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS);
|
VK_STENCIL_OP_KEEP, VK_COMPARE_OP_ALWAYS);
|
||||||
m_vkd->vkCmdSetStencilCompareMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilCompareMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_AND_BACK, 0x0);
|
VK_STENCIL_FACE_FRONT_AND_BACK, 0x0);
|
||||||
m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilWriteMask(cmdBuffer,
|
||||||
VK_STENCIL_FACE_FRONT_AND_BACK, 0x0);
|
VK_STENCIL_FACE_FRONT_AND_BACK, 0x0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -970,7 +975,7 @@ namespace dxvk {
|
|||||||
void cmdSetStencilReference(
|
void cmdSetStencilReference(
|
||||||
VkStencilFaceFlags faceMask,
|
VkStencilFaceFlags faceMask,
|
||||||
uint32_t reference) {
|
uint32_t reference) {
|
||||||
m_vkd->vkCmdSetStencilReference(m_cmd.execBuffer,
|
m_vkd->vkCmdSetStencilReference(getCmdBuffer(),
|
||||||
faceMask, reference);
|
faceMask, reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -978,15 +983,14 @@ namespace dxvk {
|
|||||||
void cmdSetStencilWriteMask(
|
void cmdSetStencilWriteMask(
|
||||||
VkStencilFaceFlags faceMask,
|
VkStencilFaceFlags faceMask,
|
||||||
uint32_t writeMask) {
|
uint32_t writeMask) {
|
||||||
m_vkd->vkCmdSetStencilWriteMask(m_cmd.execBuffer, faceMask, writeMask);
|
m_vkd->vkCmdSetStencilWriteMask(getCmdBuffer(), faceMask, writeMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdSetViewport(
|
void cmdSetViewport(
|
||||||
uint32_t viewportCount,
|
uint32_t viewportCount,
|
||||||
const VkViewport* viewports) {
|
const VkViewport* viewports) {
|
||||||
m_vkd->vkCmdSetViewportWithCount(
|
m_vkd->vkCmdSetViewportWithCount(getCmdBuffer(), viewportCount, viewports);
|
||||||
m_cmd.execBuffer, viewportCount, viewports);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1006,14 +1010,14 @@ namespace dxvk {
|
|||||||
VkDebugUtilsLabelEXT* pLabelInfo) {
|
VkDebugUtilsLabelEXT* pLabelInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vki->vkCmdBeginDebugUtilsLabelEXT(m_cmd.execBuffer, pLabelInfo);
|
m_vki->vkCmdBeginDebugUtilsLabelEXT(getCmdBuffer(), pLabelInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmdEndDebugUtilsLabel() {
|
void cmdEndDebugUtilsLabel() {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vki->vkCmdEndDebugUtilsLabelEXT(m_cmd.execBuffer);
|
m_vki->vkCmdEndDebugUtilsLabelEXT(getCmdBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1021,7 +1025,7 @@ namespace dxvk {
|
|||||||
VkDebugUtilsLabelEXT* pLabelInfo) {
|
VkDebugUtilsLabelEXT* pLabelInfo) {
|
||||||
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
m_cmd.usedFlags.set(DxvkCmdBuffer::ExecBuffer);
|
||||||
|
|
||||||
m_vki->vkCmdInsertDebugUtilsLabelEXT(m_cmd.execBuffer, pLabelInfo);
|
m_vki->vkCmdInsertDebugUtilsLabelEXT(getCmdBuffer(), pLabelInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1098,11 +1102,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
std::vector<DxvkGraphicsPipeline*> m_pipelines;
|
std::vector<DxvkGraphicsPipeline*> m_pipelines;
|
||||||
|
|
||||||
VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer) const {
|
force_inline VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer = DxvkCmdBuffer::ExecBuffer) const {
|
||||||
if (cmdBuffer == DxvkCmdBuffer::ExecBuffer) return m_cmd.execBuffer;
|
return m_cmd.cmdBuffers[uint32_t(cmdBuffer)];
|
||||||
if (cmdBuffer == DxvkCmdBuffer::InitBuffer) return m_cmd.initBuffer;
|
|
||||||
if (cmdBuffer == DxvkCmdBuffer::SdmaBuffer) return m_cmd.sdmaBuffer;
|
|
||||||
return VK_NULL_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DxvkSparseBindSubmission& getSparseBindSubmission() {
|
DxvkSparseBindSubmission& getSparseBindSubmission() {
|
||||||
@ -1117,6 +1118,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
void endCommandBuffer(VkCommandBuffer cmdBuffer);
|
void endCommandBuffer(VkCommandBuffer cmdBuffer);
|
||||||
|
|
||||||
|
VkCommandBuffer allocateCommandBuffer(DxvkCmdBuffer type);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user