void Smoke::attach_shell(Shell &sh) { Game::attach_shell(sh); const Shell::Context &ctx = sh.context(); physical_dev_ = ctx.physical_dev; dev_ = ctx.dev; queue_ = ctx.game_queue; queue_family_ = ctx.game_queue_family; format_ = ctx.format.format; vk::GetPhysicalDeviceProperties(physical_dev_, &physical_dev_props_); if (use_push_constants_ && sizeof(ShaderParamBlock) > physical_dev_props_.limits.maxPushConstantsSize) { shell_->log(Shell::LOG_WARN, "cannot enable push constants"); use_push_constants_ = false; } VkPhysicalDeviceMemoryProperties mem_props; vk::GetPhysicalDeviceMemoryProperties(physical_dev_, &mem_props); mem_flags_.reserve(mem_props.memoryTypeCount); for (uint32_t i = 0; i < mem_props.memoryTypeCount; i++) mem_flags_.push_back(mem_props.memoryTypes[i].propertyFlags); meshes_ = new Meshes(dev_, mem_flags_); create_render_pass(); create_shader_modules(); create_descriptor_set_layout(); create_pipeline_layout(); create_pipeline(); create_frame_data(2); render_pass_begin_info_.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO; render_pass_begin_info_.renderPass = render_pass_; render_pass_begin_info_.clearValueCount = 1; render_pass_begin_info_.pClearValues = &render_pass_clear_value_; primary_cmd_begin_info_.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; primary_cmd_begin_info_.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; // we will render to the swapchain images primary_cmd_submit_wait_stages_ = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; primary_cmd_submit_info_.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; primary_cmd_submit_info_.waitSemaphoreCount = 1; primary_cmd_submit_info_.pWaitDstStageMask = &primary_cmd_submit_wait_stages_; primary_cmd_submit_info_.commandBufferCount = 1; primary_cmd_submit_info_.signalSemaphoreCount = 1; if (multithread_) { for (auto &worker : workers_) worker->start(); } }
XCamReturn VKComputePipeline::ensure_layouts () { if (!XCAM_IS_VALID_VK_ID (_desc_layout)) { _desc_layout = create_desc_set_layout (_bindings); } XCAM_FAIL_RETURN ( ERROR, XCAM_IS_VALID_VK_ID(_desc_layout), XCAM_RETURN_ERROR_VULKAN, "vk compute pipeline create desc layout failed"); if (!XCAM_IS_VALID_VK_ID (_pipe_layout)) { _pipe_layout = create_pipeline_layout (_desc_layout, _push_consts); } XCAM_FAIL_RETURN ( ERROR, XCAM_IS_VALID_VK_ID(_pipe_layout), XCAM_RETURN_ERROR_VULKAN, "vk compute pipeline create pipeline layout failed"); return XCAM_RETURN_NO_ERROR; }