Skip to content

Commit

Permalink
Do not create various RT pipelines without RT support
Browse files Browse the repository at this point in the history
For now we'll keep the shading code RT-only: to make it functional
without RT we need to do odd layout transitions, and we might decide we
need to trace rays from that CS in the future again for some other
reason.
  • Loading branch information
zeux committed Dec 8, 2024
1 parent d16520b commit d39824c
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions src/niagara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,16 @@ int main(int argc, const char** argv)
}

Program blitProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["blit.comp"] }, sizeof(vec4));
Program shadeProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shade.comp"] }, sizeof(ShadeData));
Program shadowProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shadow.comp"] }, sizeof(ShadowData));
Program shadowblurProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shadowblur.comp"] }, sizeof(vec4));

Program shadeProgram = {};
Program shadowProgram = {};
Program shadowblurProgram = {};
if (raytracingSupported)
{
shadeProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shade.comp"] }, sizeof(ShadeData));
shadowProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shadow.comp"] }, sizeof(ShadowData));
shadowblurProgram = createProgram(device, VK_PIPELINE_BIND_POINT_COMPUTE, { &shaders["shadowblur.comp"] }, sizeof(vec4));
}

VkPipeline drawcullPipeline = 0;
VkPipeline drawculllatePipeline = 0;
Expand Down Expand Up @@ -700,9 +707,13 @@ int main(int argc, const char** argv)
}

replace(blitPipeline, createComputePipeline(device, pipelineCache, blitProgram));
replace(shadePipeline, createComputePipeline(device, pipelineCache, shadeProgram));
replace(shadowPipeline, createComputePipeline(device, pipelineCache, shadowProgram));
replace(shadowblurPipeline, createComputePipeline(device, pipelineCache, shadowblurProgram));

if (raytracingSupported)
{
replace(shadePipeline, createComputePipeline(device, pipelineCache, shadeProgram));
replace(shadowPipeline, createComputePipeline(device, pipelineCache, shadowProgram));
replace(shadowblurPipeline, createComputePipeline(device, pipelineCache, shadowblurProgram));
}
};

pipelines();
Expand Down Expand Up @@ -1821,14 +1832,16 @@ int main(int argc, const char** argv)
vkDestroyPipeline(device, blitPipeline, 0);
destroyProgram(device, blitProgram);

vkDestroyPipeline(device, shadePipeline, 0);
destroyProgram(device, shadeProgram);

vkDestroyPipeline(device, shadowPipeline, 0);
destroyProgram(device, shadowProgram);
if (raytracingSupported)
{
vkDestroyPipeline(device, shadePipeline, 0);
destroyProgram(device, shadeProgram);

vkDestroyPipeline(device, shadowblurPipeline, 0);
destroyProgram(device, shadowblurProgram);
vkDestroyPipeline(device, shadowPipeline, 0);
vkDestroyPipeline(device, shadowblurPipeline, 0);
destroyProgram(device, shadowProgram);
destroyProgram(device, shadowblurProgram);
}

vkDestroyDescriptorSetLayout(device, textureSetLayout, 0);

Expand Down

0 comments on commit d39824c

Please sign in to comment.