Skip to content

[WIP] An attempt to allow Vulkan secondary command buffers to be encoded as Metal IndirectCommandBuffers#2481

Open
EricAtPlanGrid wants to merge 3 commits intoKhronosGroup:mainfrom
EricAtPlanGrid:eric/icb-for-2ndary-command-buffers
Open

[WIP] An attempt to allow Vulkan secondary command buffers to be encoded as Metal IndirectCommandBuffers#2481
EricAtPlanGrid wants to merge 3 commits intoKhronosGroup:mainfrom
EricAtPlanGrid:eric/icb-for-2ndary-command-buffers

Conversation

@EricAtPlanGrid
Copy link

@EricAtPlanGrid EricAtPlanGrid commented Apr 11, 2025

Following on from #2247 I finally took a very naive stab at this. Things appear to be more or less working aside from having the correct bindings (in this case, of my uniform buffers) inherited during ICB execution.

Currently what I see is that the uniform buffers (from my descriptor set 0) are all "n/a" when inspected in the vertex debugger … I'm not sure why this would be the case since if I don't use ICBs and issue draw commands directly, they seem to be set correctly. On the other hand, I now know that when I execute an ICB, instead of using setVertexBuffer I'll need to put those buffers into the argbuffer, which I am not sure how to do yet :)

There are several deficiencies with the code I'm submitting here -- my eyes are wide open, I assure you -- and that's discounting all the problems I don't even know that I have yet ;)

@CLAassistant
Copy link

CLAassistant commented Apr 11, 2025

CLA assistant check
All committers have signed the CLA.

@EricAtPlanGrid EricAtPlanGrid force-pushed the eric/icb-for-2ndary-command-buffers branch from 152094c to 52c7365 Compare April 11, 2025 23:33
@EricAtPlanGrid EricAtPlanGrid force-pushed the eric/icb-for-2ndary-command-buffers branch from 52c7365 to ee0d699 Compare April 11, 2025 23:37
/** Encodes this command on the specified command encoder. */
virtual void encode(MVKCommandEncoder* cmdEncoder) = 0;

virtual void encodeToICB(id<MTLIndirectCommandBuffer> icb) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this could be useful, but I believe we'd need to have an additional context object provided with it so individual commands could look up relevant index/vertex/other buffers.

id<MTLRenderPipelineState> MVKCommandResourceFactory::newMTLRenderPipelineState(MTLRenderPipelineDescriptor* plDesc,
MVKVulkanAPIDeviceObject* owner) {
MVKRenderPipelineCompiler* plc = new MVKRenderPipelineCompiler(owner);
plDesc.supportIndirectCommandBuffers = YES;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a lot of spray-and-pray of this :)

@EricAtPlanGrid
Copy link
Author

Hello! I finally signed the CLA :) I am hoping to get some assistance in figuring out how to get the appropriate buffers registered in the argbuffers rather than using setVertexBuffer etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants