MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / BuildPipeline

Method BuildPipeline

tests/framework/ray_tracing_objects.cpp:2192–2321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2190}
2191
2192void Pipeline::BuildPipeline() {
2193 // Create push constant range
2194 VkPushConstantRange push_constant_range = {};
2195 push_constant_range.stageFlags = VK_SHADER_STAGE_RAYGEN_BIT_KHR;
2196 push_constant_range.offset = 0;
2197 push_constant_range.size = push_constant_range_size_;
2198
2199 // Create pipeline layout
2200 if (!pipeline_layout_.initialized() && (create_flags_2_.flags & VK_PIPELINE_CREATE_2_DESCRIPTOR_HEAP_BIT_EXT) == 0) {
2201 if (push_constant_range_size_ > 0) {
2202 pipeline_layout_ci_.pushConstantRangeCount = 1;
2203 pipeline_layout_ci_.pPushConstantRanges = &push_constant_range;
2204 }
2205 assert(!(desc_set_ && desc_indexing_set_));
2206 VkDescriptorSetLayout* desc_set = desc_set_ ? &desc_set_->layout_.handle()
2207 : desc_indexing_set_ ? &desc_indexing_set_->layout_.handle()
2208 : nullptr;
2209
2210 if (desc_set) {
2211 pipeline_layout_ci_.setLayoutCount = 1;
2212 pipeline_layout_ci_.pSetLayouts = desc_set;
2213 }
2214 pipeline_layout_.Init(*device_, pipeline_layout_ci_);
2215 }
2216
2217 // Assemble shaders information (stages and groups)
2218 // ----
2219 // ---------
2220 // DO NOT DARE CHANGE THE ORDER IN WHICH SHADERS ARE ADDED,
2221 // OR BE READY TO REDO SBT CREATION LOGIC
2222 // ---------
2223 // ----
2224 std::vector<VkPipelineShaderStageCreateInfo> pipeline_stage_cis;
2225 assert(shader_group_cis_.empty()); // For now this list is expected to be empty at this point
2226 for (const auto& ray_gen_shader : ray_gen_shaders_) {
2227 VkPipelineShaderStageCreateInfo raygen_stage_ci = vku::InitStructHelper();
2228 raygen_stage_ci.stage = VK_SHADER_STAGE_RAYGEN_BIT_KHR;
2229 raygen_stage_ci.module = ray_gen_shader->handle();
2230 raygen_stage_ci.pName = ray_gen_shader->GetStageCreateInfo().pName;
2231 raygen_stage_ci.pNext = ray_gen_shader->GetStageCreateInfo().pNext;
2232 pipeline_stage_cis.emplace_back(raygen_stage_ci);
2233
2234 VkRayTracingShaderGroupCreateInfoKHR raygen_group_ci = vku::InitStructHelper();
2235 raygen_group_ci.type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR;
2236 raygen_group_ci.generalShader = pipeline_stage_cis.size() - 1;
2237 raygen_group_ci.closestHitShader = VK_SHADER_UNUSED_KHR;
2238 raygen_group_ci.anyHitShader = VK_SHADER_UNUSED_KHR;
2239 raygen_group_ci.intersectionShader = VK_SHADER_UNUSED_KHR;
2240 shader_group_cis_.emplace_back(raygen_group_ci);
2241 }
2242 for (const auto& miss_shader : miss_shaders_) {
2243 VkPipelineShaderStageCreateInfo miss_stage_ci = vku::InitStructHelper();
2244 miss_stage_ci.stage = VK_SHADER_STAGE_MISS_BIT_KHR;
2245 miss_stage_ci.module = miss_shader->handle();
2246 miss_stage_ci.pName = miss_shader->GetStageCreateInfo().pName;
2247 miss_stage_ci.pNext = miss_shader->GetStageCreateInfo().pNext;
2248 pipeline_stage_cis.emplace_back(miss_stage_ci);
2249

Callers 2

TEST_FFunction · 0.80
TEST_FFunction · 0.80

Calls 11

size32Function · 0.85
DeferredOperationJoinKHRFunction · 0.85
initializedMethod · 0.80
emplace_backMethod · 0.80
InitDeferredMethod · 0.80
handleMethod · 0.45
InitMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected