mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[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:
parent
b33a897ae4
commit
14b24e5b75
3 changed files with 15 additions and 27 deletions
|
@ -292,8 +292,6 @@ typedef struct qfv_pipeline_s {
|
|||
|
||||
VkViewport viewport;
|
||||
VkRect2D scissor;
|
||||
struct qfv_push_constants_s *push_constants;
|
||||
uint32_t num_push_constants;
|
||||
uint32_t num_descriptorsets;
|
||||
uint32_t first_descriptorset;
|
||||
VkDescriptorSet *descriptorsets;
|
||||
|
|
|
@ -111,11 +111,6 @@ run_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd, vulkan_ctx_t *ctx)
|
|||
pipeline->descriptorsets,
|
||||
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/
|
||||
|
@ -200,11 +195,6 @@ run_compute_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd,
|
|||
pipeline->descriptorsets,
|
||||
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;
|
||||
dfunc->vkCmdDispatch (cmd, d[0], d[1], d[2]);
|
||||
}
|
||||
|
|
|
@ -873,22 +873,22 @@ init_job (vulkan_ctx_t *ctx, objcount_t *counts, objstate_t s)
|
|||
|
||||
size_t size = sizeof (qfv_job_t);
|
||||
|
||||
size += counts->num_renderpasses * sizeof (VkRenderPass);
|
||||
size += counts->num_graph_pipelines * sizeof (VkPipeline);
|
||||
size += counts->num_comp_pipelines * sizeof (VkPipeline);
|
||||
size += s.inds.num_layouts * sizeof (VkPipelineLayout);
|
||||
size += sizeof (VkRenderPass [counts->num_renderpasses]);
|
||||
size += sizeof (VkPipeline [counts->num_graph_pipelines]);
|
||||
size += sizeof (VkPipeline [counts->num_comp_pipelines]);
|
||||
size += sizeof (VkPipelineLayout [s.inds.num_layouts]);
|
||||
|
||||
size += counts->num_steps * sizeof (qfv_step_t);
|
||||
size += counts->num_render * sizeof (qfv_render_t);
|
||||
size += counts->num_compute * sizeof (qfv_compute_t);
|
||||
size += counts->num_process * sizeof (qfv_process_t);
|
||||
size += counts->num_renderpasses * sizeof (qfv_renderpass_t);
|
||||
size += counts->num_attachments * sizeof (VkClearValue);
|
||||
size += counts->num_subpasses * sizeof (qfv_subpass_t);
|
||||
size += counts->num_graph_pipelines * sizeof (qfv_pipeline_t);
|
||||
size += counts->num_comp_pipelines * sizeof (qfv_pipeline_t);
|
||||
size += counts->num_tasks * sizeof (qfv_taskinfo_t);
|
||||
size += counts->num_descriptorsets * sizeof (VkDescriptorSet);
|
||||
size += sizeof (qfv_step_t [counts->num_steps]);
|
||||
size += sizeof (qfv_render_t [counts->num_render]);
|
||||
size += sizeof (qfv_compute_t [counts->num_compute]);
|
||||
size += sizeof (qfv_process_t [counts->num_process]);
|
||||
size += sizeof (qfv_renderpass_t [counts->num_renderpasses]);
|
||||
size += sizeof (VkClearValue [counts->num_attachments]);
|
||||
size += sizeof (qfv_subpass_t [counts->num_subpasses]);
|
||||
size += sizeof (qfv_pipeline_t [counts->num_graph_pipelines]);
|
||||
size += sizeof (qfv_pipeline_t [counts->num_comp_pipelines]);
|
||||
size += sizeof (qfv_taskinfo_t [counts->num_tasks]);
|
||||
size += sizeof (VkDescriptorSet [counts->num_descriptorsets]);
|
||||
|
||||
rctx->job = malloc (size);
|
||||
__auto_type job = rctx->job;
|
||||
|
|
Loading…
Reference in a new issue