Skip to content

Commit

Permalink
more comprehensively handle maxColorAttachments < 8
Browse files Browse the repository at this point in the history
and remove the abort() this time

ref #14
  • Loading branch information
zmike committed Jan 11, 2023
1 parent e0242a8 commit 5ae3a31
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ create_multirt_pipeline(VkRenderPass render_pass, VkPipelineLayout layout)
create_shader_module(multirt_frag_spirv, multirt_frag_spirv_len),
};

return create_pipeline_helper(layout, render_pass, modules, 8);
return create_pipeline_helper(layout, render_pass, modules, dev->info.props.limits.maxColorAttachments == 8 ? 8 : 4);
}

VkPipeline
Expand Down
5 changes: 0 additions & 5 deletions src/renderpass.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ create_renderpass(unsigned num_rts, bool clear)
VkPipelineStageFlags dep_pipeline = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
VkAccessFlags dep_access = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;

if (dev->info.props.limits.maxColorAttachments < 8) {
fprintf(stderr, "maxColorAttachments >= 8 required!\n");
abort();
}

for (unsigned i = 0; i < MAX_RTS; i++) {
attachment[i].sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2;
attachment[i].format = VK_FORMAT_R32G32B32A32_SFLOAT;
Expand Down
2 changes: 1 addition & 1 deletion src/vkoverhead.c
Original file line number Diff line number Diff line change
Expand Up @@ -2887,7 +2887,7 @@ main(int argc, char *argv[])
parse_args(argc, (const char**)argv);
util_cpu_detect();
dev = vk_device_create();
max_rts = MIN2(dev->info.props.limits.maxColorAttachments, 8);
max_rts = dev->info.props.limits.maxColorAttachments == 8 ? 8 : 4;
init_cmdbufs();
render_pass_clear = create_renderpass(1, true);
render_pass_dontcare = create_renderpass(1, false);
Expand Down

0 comments on commit 5ae3a31

Please sign in to comment.