1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[dxvk] Add command list parameter to cmdPushConstants

We want to be able to invoke compute shaders during init commands.
This commit is contained in:
Philip Rebohle 2024-10-01 14:38:00 +02:00 committed by Philip Rebohle
parent 207e15eb24
commit aa162365ce
3 changed files with 27 additions and 35 deletions

View File

@ -778,12 +778,13 @@ namespace dxvk {
void cmdPushConstants( void cmdPushConstants(
DxvkCmdBuffer cmdBuffer,
VkPipelineLayout layout, VkPipelineLayout layout,
VkShaderStageFlags stageFlags, VkShaderStageFlags stageFlags,
uint32_t offset, uint32_t offset,
uint32_t size, uint32_t size,
const void* pValues) { const void* pValues) {
m_vkd->vkCmdPushConstants(m_cmd.execBuffer, m_vkd->vkCmdPushConstants(getCmdBuffer(cmdBuffer),
layout, stageFlags, offset, size, pValues); layout, stageFlags, offset, size, pValues);
} }

View File

@ -314,9 +314,8 @@ namespace dxvk {
VK_PIPELINE_BIND_POINT_COMPUTE, VK_PIPELINE_BIND_POINT_COMPUTE,
pipeInfo.pipeLayout, descriptorSet, pipeInfo.pipeLayout, descriptorSet,
0, nullptr); 0, nullptr);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(pushArgs), &pushArgs); 0, sizeof(pushArgs), &pushArgs);
m_cmd->cmdDispatch( m_cmd->cmdDispatch(
workgroups.width, workgroups.width,
@ -822,9 +821,8 @@ namespace dxvk {
pipeInfo.pipeLayout, dset, pipeInfo.pipeLayout, dset,
0, nullptr); 0, nullptr);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(args), &args); 0, sizeof(args), &args);
m_cmd->cmdDispatch( m_cmd->cmdDispatch(
@ -990,9 +988,8 @@ namespace dxvk {
pipeInfo.pipeLayout, descriptorSet, pipeInfo.pipeLayout, descriptorSet,
0, nullptr); 0, nullptr);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(args), &args); 0, sizeof(args), &args);
m_cmd->cmdDispatch( m_cmd->cmdDispatch(
@ -1132,9 +1129,8 @@ namespace dxvk {
pipeInfo.pipeLayout, dset, pipeInfo.pipeLayout, dset,
0, nullptr); 0, nullptr);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(args), &args); 0, sizeof(args), &args);
m_cmd->cmdDispatch( m_cmd->cmdDispatch(
@ -1818,11 +1814,9 @@ namespace dxvk {
m_cmd->cmdSetViewport(1, &viewport); m_cmd->cmdSetViewport(1, &viewport);
m_cmd->cmdSetScissor(1, &scissor); m_cmd->cmdSetScissor(1, &scissor);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(pushConstants), &pushConstants);
0, sizeof(pushConstants),
&pushConstants);
m_cmd->cmdDraw(3, passExtent.depth, 0, 0); m_cmd->cmdDraw(3, passExtent.depth, 0, 0);
m_cmd->cmdEndRendering(); m_cmd->cmdEndRendering();
@ -3239,11 +3233,9 @@ namespace dxvk {
float(srcOffsetsAdjusted[1].z) / float(srcExtent.depth) }; float(srcOffsetsAdjusted[1].z) / float(srcExtent.depth) };
pushConstants.layerCount = dstView->info().layerCount; pushConstants.layerCount = dstView->info().layerCount;
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_FRAGMENT_BIT,
VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(pushConstants), &pushConstants);
0, sizeof(pushConstants),
&pushConstants);
m_cmd->cmdDraw(3, pushConstants.layerCount, 0, 0); m_cmd->cmdDraw(3, pushConstants.layerCount, 0, 0);
m_cmd->cmdEndRendering(); m_cmd->cmdEndRendering();
@ -3677,9 +3669,8 @@ namespace dxvk {
VK_PIPELINE_BIND_POINT_COMPUTE, VK_PIPELINE_BIND_POINT_COMPUTE,
pipeInfo.pipeLayout, descriptorSet, pipeInfo.pipeLayout, descriptorSet,
0, nullptr); 0, nullptr);
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
pipeInfo.pipeLayout, pipeInfo.pipeLayout, VK_SHADER_STAGE_COMPUTE_BIT,
VK_SHADER_STAGE_COMPUTE_BIT,
0, sizeof(pushArgs), &pushArgs); 0, sizeof(pushArgs), &pushArgs);
m_cmd->cmdDispatch( m_cmd->cmdDispatch(
workgroups.width, workgroups.width,
@ -3989,10 +3980,9 @@ namespace dxvk {
srcOffset.x - dstOffset.x, srcOffset.x - dstOffset.x,
srcOffset.y - dstOffset.y }; srcOffset.y - dstOffset.y };
m_cmd->cmdPushConstants(pipeInfo.pipeLayout, m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
VK_SHADER_STAGE_FRAGMENT_BIT, pipeInfo.pipeLayout, VK_SHADER_STAGE_FRAGMENT_BIT,
0, sizeof(srcCoordOffset), 0, sizeof(srcCoordOffset), &srcCoordOffset);
&srcCoordOffset);
m_cmd->cmdDraw(3, dstSubresource.layerCount, 0, 0); m_cmd->cmdDraw(3, dstSubresource.layerCount, 0, 0);
m_cmd->cmdEndRendering(); m_cmd->cmdEndRendering();
@ -4650,8 +4640,8 @@ namespace dxvk {
pipeInfo.pipeLayout, descriptorSet, 0, nullptr); pipeInfo.pipeLayout, descriptorSet, 0, nullptr);
m_cmd->cmdSetViewport(1, &viewport); m_cmd->cmdSetViewport(1, &viewport);
m_cmd->cmdSetScissor(1, &scissor); m_cmd->cmdSetScissor(1, &scissor);
m_cmd->cmdPushConstants(pipeInfo.pipeLayout, m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
VK_SHADER_STAGE_FRAGMENT_BIT, pipeInfo.pipeLayout, VK_SHADER_STAGE_FRAGMENT_BIT,
0, sizeof(srcOffset), &srcOffset); 0, sizeof(srcOffset), &srcOffset);
m_cmd->cmdDraw(3, region.dstSubresource.layerCount, 0, 0); m_cmd->cmdDraw(3, region.dstSubresource.layerCount, 0, 0);
m_cmd->cmdEndRendering(); m_cmd->cmdEndRendering();
@ -6069,7 +6059,7 @@ namespace dxvk {
if (!pushConstRange.size) if (!pushConstRange.size)
return; return;
m_cmd->cmdPushConstants( m_cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
bindings->getPipelineLayout(independentSets), bindings->getPipelineLayout(independentSets),
pushConstRange.stageFlags, pushConstRange.stageFlags,
pushConstRange.offset, pushConstRange.offset,

View File

@ -153,8 +153,9 @@ namespace dxvk {
args.srcExtent = srcRect.extent; args.srcExtent = srcRect.extent;
args.dstOffset = dstRect.offset; args.dstOffset = dstRect.offset;
ctx.cmd->cmdPushConstants(m_pipelineLayout, ctx.cmd->cmdPushConstants(DxvkCmdBuffer::ExecBuffer,
VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(args), &args); m_pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT,
0, sizeof(args), &args);
ctx.cmd->cmdDraw(3, 1, 0, 0); ctx.cmd->cmdDraw(3, 1, 0, 0);