[vulkan] Clean up job allocation size calculation

It does the same thing, but it's just nicer to read (thanks for the
idea, HomelikeBrick42).
This commit is contained in:
Bill Currie 2023-06-16 22:39:49 +09:00
parent b33a897ae4
commit 14b24e5b75
3 changed files with 15 additions and 27 deletions

View file

@ -292,8 +292,6 @@ typedef struct qfv_pipeline_s {
VkViewport viewport; VkViewport viewport;
VkRect2D scissor; VkRect2D scissor;
struct qfv_push_constants_s *push_constants;
uint32_t num_push_constants;
uint32_t num_descriptorsets; uint32_t num_descriptorsets;
uint32_t first_descriptorset; uint32_t first_descriptorset;
VkDescriptorSet *descriptorsets; VkDescriptorSet *descriptorsets;

View file

@ -111,11 +111,6 @@ run_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd, vulkan_ctx_t *ctx)
pipeline->descriptorsets, pipeline->descriptorsets,
0, 0); 0, 0);
} }
if (pipeline->num_push_constants) {
QFV_PushConstants (device, cmd, pipeline->layout,
pipeline->num_push_constants,
pipeline->push_constants);
}
} }
// https://themaister.net/blog/2019/08/14/yet-another-blog-explaining-vulkan-synchronization/ // https://themaister.net/blog/2019/08/14/yet-another-blog-explaining-vulkan-synchronization/
@ -200,11 +195,6 @@ run_compute_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd,
pipeline->descriptorsets, pipeline->descriptorsets,
0, 0); 0, 0);
} }
if (pipeline->num_push_constants) {
QFV_PushConstants (device, cmd, pipeline->layout,
pipeline->num_push_constants,
pipeline->push_constants);
}
vec4u_t d = pipeline->dispatch; vec4u_t d = pipeline->dispatch;
dfunc->vkCmdDispatch (cmd, d[0], d[1], d[2]); dfunc->vkCmdDispatch (cmd, d[0], d[1], d[2]);
} }

View file

@ -873,22 +873,22 @@ init_job (vulkan_ctx_t *ctx, objcount_t *counts, objstate_t s)
size_t size = sizeof (qfv_job_t); size_t size = sizeof (qfv_job_t);
size += counts->num_renderpasses * sizeof (VkRenderPass); size += sizeof (VkRenderPass [counts->num_renderpasses]);
size += counts->num_graph_pipelines * sizeof (VkPipeline); size += sizeof (VkPipeline [counts->num_graph_pipelines]);
size += counts->num_comp_pipelines * sizeof (VkPipeline); size += sizeof (VkPipeline [counts->num_comp_pipelines]);
size += s.inds.num_layouts * sizeof (VkPipelineLayout); size += sizeof (VkPipelineLayout [s.inds.num_layouts]);
size += counts->num_steps * sizeof (qfv_step_t); size += sizeof (qfv_step_t [counts->num_steps]);
size += counts->num_render * sizeof (qfv_render_t); size += sizeof (qfv_render_t [counts->num_render]);
size += counts->num_compute * sizeof (qfv_compute_t); size += sizeof (qfv_compute_t [counts->num_compute]);
size += counts->num_process * sizeof (qfv_process_t); size += sizeof (qfv_process_t [counts->num_process]);
size += counts->num_renderpasses * sizeof (qfv_renderpass_t); size += sizeof (qfv_renderpass_t [counts->num_renderpasses]);
size += counts->num_attachments * sizeof (VkClearValue); size += sizeof (VkClearValue [counts->num_attachments]);
size += counts->num_subpasses * sizeof (qfv_subpass_t); size += sizeof (qfv_subpass_t [counts->num_subpasses]);
size += counts->num_graph_pipelines * sizeof (qfv_pipeline_t); size += sizeof (qfv_pipeline_t [counts->num_graph_pipelines]);
size += counts->num_comp_pipelines * sizeof (qfv_pipeline_t); size += sizeof (qfv_pipeline_t [counts->num_comp_pipelines]);
size += counts->num_tasks * sizeof (qfv_taskinfo_t); size += sizeof (qfv_taskinfo_t [counts->num_tasks]);
size += counts->num_descriptorsets * sizeof (VkDescriptorSet); size += sizeof (VkDescriptorSet [counts->num_descriptorsets]);
rctx->job = malloc (size); rctx->job = malloc (size);
__auto_type job = rctx->job; __auto_type job = rctx->job;