Skip to content

Commit ad8b7de

Browse files
committed
Wire up some missing calls for pushdescriptors
1 parent e396c3d commit ad8b7de

5 files changed

Lines changed: 59 additions & 10 deletions

File tree

scripts/vkconfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ def validate_funcs(lst):
135135
validate_funcs(replay_post_calls)
136136
replay_postprocess_calls = [ 'vkCmdPushConstants', 'vkCmdPushConstants2KHR', 'vkCreateRayTracingPipelinesKHR', 'vkCreateGraphicsPipelines',
137137
'vkCreateComputePipelines', 'vkCmdBindPipeline', 'vkQueueSubmit', 'vkQueueSubmit2', 'vkQueueSubmit2KHR', 'vkCmdBindDescriptorSets2KHR',
138-
'vkCmdBindDescriptorSets', 'vkCmdBindDescriptorSets2' ]
138+
'vkCmdBindDescriptorSets', 'vkCmdBindDescriptorSets2', 'vkCmdPushDescriptorSet2KHR', 'vkCmdPushDescriptorSet2', 'vkCmdPushDescriptorSetKHR' ]
139139
validate_funcs(replay_postprocess_calls)
140140
trace_pre_calls = [ 'vkQueueSubmit', 'vkCreateInstance', 'vkCreateDevice', 'vkFreeMemory', 'vkQueueSubmit2', 'vkQueueSubmit2KHR' ]
141141
validate_funcs(trace_pre_calls)
142142
trace_post_calls = [ 'vkCreateInstance', 'vkCreateDevice', 'vkDestroyInstance', 'vkGetPhysicalDeviceFeatures', 'vkGetPhysicalDeviceProperties',
143143
'vkGetPhysicalDeviceSurfaceCapabilitiesKHR', 'vkBindImageMemory', 'vkBindBufferMemory', 'vkBindImageMemory2', 'vkBindImageMemory2KHR',
144144
'vkBindBufferMemory2', 'vkUpdateDescriptorSets', 'vkFlushMappedMemoryRanges', 'vkQueuePresentKHR', 'vkMapMemory2KHR', 'vkMapMemory2',
145-
'vkMapMemory', 'vkCmdBindDescriptorSets', 'vkBindBufferMemory2KHR', 'vkCmdPushDescriptorSet2KHR',
145+
'vkMapMemory', 'vkCmdBindDescriptorSets', 'vkBindBufferMemory2KHR', 'vkCmdPushDescriptorSet2KHR', 'vkCmdPushDescriptorSet2',
146146
'vkGetImageMemoryRequirements', 'vkGetPipelineCacheData', 'vkAcquireNextImageKHR', 'vkAcquireNextImage2KHR',
147147
'vkGetBufferMemoryRequirements', 'vkGetBufferMemoryRequirements2', 'vkGetImageMemoryRequirements2', 'vkGetPhysicalDeviceMemoryProperties',
148148
'vkGetPhysicalDeviceFormatProperties', 'vkGetPhysicalDeviceFormatProperties2', 'vkCmdPushDescriptorSetKHR', 'vkCreateSwapchainKHR',

src/execute_commands.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ static bool execute_commands(lava_file_reader& reader, VkCommandBuffer commandBu
145145
else if (c.data.bind_pipeline.pipelineBindPoint == VK_PIPELINE_BIND_POINT_COMPUTE) compute_pipeline_bound = c.data.bind_pipeline.pipeline_index;
146146
else if (c.data.bind_pipeline.pipelineBindPoint == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) raytracing_pipeline_bound = c.data.bind_pipeline.pipeline_index;
147147
break;
148+
case VKCMDPUSHDESCRIPTORSETKHR:
149+
assert(false); // TBD
150+
break;
148151
case VKCMDDISPATCH: // proxy for all compute commands
149152
{
150153
const auto& pipeline_data = VkPipeline_index.at(compute_pipeline_bound);

src/hardcode_read.cpp

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,18 +1330,51 @@ static void handle_VkCopyDescriptorSets(lava_file_reader& reader, uint32_t descr
13301330

13311331
void replay_postprocess_vkCmdPushDescriptorSetKHR(lava_file_reader& reader, VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites)
13321332
{
1333-
assert(false);
1334-
//trackedcommand cmd { VKCMDPUSHDESCRIPTORSETKHR };
1335-
// TBD - need to delay
1336-
// handle_VkWriteDescriptorSets(writer, descriptorWriteCount, pDescriptorWrites, false);
1333+
const uint32_t cmdbuffer_index = index_to_VkCommandBuffer.index(commandBuffer);
1334+
auto& cmdbuffer_data = VkCommandBuffer_index.at(cmdbuffer_index);
1335+
trackedcommand cmd { VKCMDPUSHDESCRIPTORSETKHR };
1336+
cmd.data.push_descriptorset.pipelineBindPoint = pipelineBindPoint;
1337+
cmd.data.push_descriptorset.layout = layout;
1338+
cmd.data.push_descriptorset.set = set;
1339+
// TBD handle pDescriptorWrites here
1340+
cmdbuffer_data.commands.push_back(cmd);
13371341
}
13381342

13391343
void replay_postprocess_vkCmdPushDescriptorSet2KHR(lava_file_reader& reader, VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfoKHR* pPushDescriptorSetInfo)
13401344
{
1341-
assert(false);
1342-
//trackedcommand cmd { VKCMDPUSHDESCRIPTORSET2KHR };
1343-
// TBD - need to delay
1344-
//handle_VkWriteDescriptorSets(writer, pPushDescriptorSetInfo->descriptorWriteCount, pPushDescriptorSetInfo->pDescriptorWrites, false);
1345+
const uint32_t cmdbuffer_index = index_to_VkCommandBuffer.index(commandBuffer);
1346+
auto& cmdbuffer_data = VkCommandBuffer_index.at(cmdbuffer_index);
1347+
1348+
// "If stageFlags specifies a subset of all stages corresponding to one or more pipeline bind points, the binding operation still affects all stages corresponding to
1349+
// the given pipeline bind point(s) as if the equivalent original version of this command had been called with the same parameters. For example, specifying a
1350+
// stageFlags value of VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_COMPUTE_BIT is equivalent to calling the original version of this
1351+
// command once with VK_PIPELINE_BIND_POINT_GRAPHICS and once with VK_PIPELINE_BIND_POINT_COMPUTE."
1352+
1353+
if (pPushDescriptorSetInfo->stageFlags & (VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT))
1354+
{
1355+
trackedcommand cmd { VKCMDPUSHDESCRIPTORSETKHR };
1356+
cmd.data.push_descriptorset.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
1357+
cmd.data.push_descriptorset.layout = pPushDescriptorSetInfo->layout;
1358+
cmd.data.push_descriptorset.set = pPushDescriptorSetInfo->set;
1359+
cmd.data.push_descriptorset.descriptorWriteCount = pPushDescriptorSetInfo->descriptorWriteCount;
1360+
// TBD handle pDescriptorWrites here
1361+
cmdbuffer_data.commands.push_back(cmd);
1362+
}
1363+
if (pPushDescriptorSetInfo->stageFlags & VK_SHADER_STAGE_COMPUTE_BIT)
1364+
{
1365+
trackedcommand cmd { VKCMDPUSHDESCRIPTORSETKHR };
1366+
cmd.data.push_descriptorset.pipelineBindPoint = VK_PIPELINE_BIND_POINT_COMPUTE;
1367+
cmd.data.push_descriptorset.layout = pPushDescriptorSetInfo->layout;
1368+
cmd.data.push_descriptorset.set = pPushDescriptorSetInfo->set;
1369+
cmd.data.push_descriptorset.descriptorWriteCount = pPushDescriptorSetInfo->descriptorWriteCount;
1370+
// TBD handle pDescriptorWrites here
1371+
cmdbuffer_data.commands.push_back(cmd);
1372+
}
1373+
}
1374+
1375+
void replay_postprocess_vkCmdPushDescriptorSet2(lava_file_reader& reader, VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo)
1376+
{
1377+
replay_postprocess_vkCmdPushDescriptorSet2KHR(reader, commandBuffer, pPushDescriptorSetInfo);
13451378
}
13461379

13471380
void replay_postprocess_vkUpdateDescriptorSets(lava_file_reader& reader, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)

src/hardcode_write.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,11 @@ static void trace_post_vkCmdPushDescriptorSet2KHR(lava_file_writer& writer, VkCo
672672
handle_VkWriteDescriptorSets(writer, pPushDescriptorSetInfo->descriptorWriteCount, pPushDescriptorSetInfo->pDescriptorWrites, false, true);
673673
}
674674

675+
static void trace_post_vkCmdPushDescriptorSet2(lava_file_writer& writer, VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo)
676+
{
677+
handle_VkWriteDescriptorSets(writer, pPushDescriptorSetInfo->descriptorWriteCount, pPushDescriptorSetInfo->pDescriptorWrites, false, true);
678+
}
679+
675680
static void trace_post_vkUpdateDescriptorSets(lava_file_writer& writer, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
676681
{
677682
handle_VkWriteDescriptorSets(writer, descriptorWriteCount, pDescriptorWrites, true, false);

src/lavatube.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@ struct trackedcommand // does _not_ inherit trackable
512512
uint32_t dynamicOffsetCount;
513513
uint32_t* pDynamicOffsets;
514514
} bind_descriptorsets;
515+
struct push_descriptorset
516+
{
517+
VkPipelineBindPoint pipelineBindPoint;
518+
VkPipelineLayout layout;
519+
uint32_t set;
520+
uint32_t descriptorWriteCount;
521+
// TBD pDescriptorWrites copy here
522+
} push_descriptorset;
515523
struct bind_pipeline
516524
{
517525
VkPipelineBindPoint pipelineBindPoint;

0 commit comments

Comments
 (0)