diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index ecd3b58..f28d78a 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -502,16 +502,16 @@ void TextureLoading::build_command_buffers() vkCmdBindPipeline(draw_cmd_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.background); vkCmdDraw(draw_cmd_buffers[i], 6, 1, 0, 0); - //vkCmdBindDescriptorSets(draw_cmd_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1, &descriptor_set, 0, NULL); - //vkCmdBindPipeline(draw_cmd_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.solid); + vkCmdBindDescriptorSets(draw_cmd_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1, &descriptor_set, 0, NULL); + vkCmdBindPipeline(draw_cmd_buffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.solid); - //VkDeviceSize offsets[1] = { 0 }; - //vkCmdBindVertexBuffers(draw_cmd_buffers[i], 0, 1, vertex_buffer->get(), offsets); - //vkCmdBindIndexBuffer(draw_cmd_buffers[i], index_buffer->get_handle(), 0, VK_INDEX_TYPE_UINT32); + VkDeviceSize offsets[1] = { 0 }; + vkCmdBindVertexBuffers(draw_cmd_buffers[i], 0, 1, vertex_buffer->get(), offsets); + vkCmdBindIndexBuffer(draw_cmd_buffers[i], index_buffer->get_handle(), 0, VK_INDEX_TYPE_UINT32); - //vkCmdDrawIndexed(draw_cmd_buffers[i], index_count, 1, 0, 0, 0); + vkCmdDrawIndexed(draw_cmd_buffers[i], index_count, 1, 0, 0, 0); - draw_point_cloud(draw_cmd_buffers[i]); + //draw_point_cloud(draw_cmd_buffers[i]); draw_ui(draw_cmd_buffers[i]); @@ -582,14 +582,14 @@ void TextureLoading::setup_descriptor_pool() // Example uses one ubo and one image sampler std::vector pool_sizes = { - vkb::initializers::descriptor_pool_size(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1), - vkb::initializers::descriptor_pool_size(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 2) }; + vkb::initializers::descriptor_pool_size(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 4), + vkb::initializers::descriptor_pool_size(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 4) }; VkDescriptorPoolCreateInfo descriptor_pool_create_info = vkb::initializers::descriptor_pool_create_info( static_cast(pool_sizes.size()), pool_sizes.data(), - 2); + 4); VK_CHECK(vkCreateDescriptorPool(get_device().get_handle(), &descriptor_pool_create_info, nullptr, &descriptor_pool)); } @@ -938,11 +938,14 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) setup_descriptor_pool(); setup_descriptor_set(); setup_descriptor_set_bg(); + + setup_point_descriptor_set_layout(); + prepare_point_pipeline(); + setup_point_descriptor_set(); + + build_command_buffers(); - setup_point_descriptor_set_layout(); - setup_point_descriptor_set(); - prepare_point_pipeline(); prepared = true; //start(); return true; @@ -1402,8 +1405,9 @@ void TextureLoading::prepare_point_pipeline() // 加载着色器 std::array shader_stages; - shader_stages[0] = load_shader("pointcloud.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); - shader_stages[1] = load_shader("pointcloud.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); + shader_stages[0] = load_shader("texture_loading", "pointcloud.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); + shader_stages[1] = load_shader("texture_loading", "pointcloud.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); + // 顶点输入绑定描述 (告诉 Vulkan 顶点数据的格式) VkVertexInputBindingDescription vertex_input_binding_description{}; diff --git a/samples/api/texture_loading/texture_loading.h b/samples/api/texture_loading/texture_loading.h index 818ae1a..96de18f 100644 --- a/samples/api/texture_loading/texture_loading.h +++ b/samples/api/texture_loading/texture_loading.h @@ -56,7 +56,6 @@ public: void prepare_point_pipeline(); void update_point_vertex_buffer(float* pos, int pointCount); void draw_point_cloud(VkCommandBuffer command_buffer); - void ReceiveFacePoint(float* pos, int pointCount, int width, int height); void update_point_descriptor_set();