diff --git a/samples/api/texture_loading/CMakeLists.txt b/samples/api/texture_loading/CMakeLists.txt index 2403f27..4d057b4 100644 --- a/samples/api/texture_loading/CMakeLists.txt +++ b/samples/api/texture_loading/CMakeLists.txt @@ -34,6 +34,8 @@ add_sample_with_tags( "texture_loading/glsl/pointcloud.frag" "texture_loading/glsl/point_line.vert" "texture_loading/glsl/point_line.frag" + "texture_loading/glsl/point_line_solid.vert" + "texture_loading/glsl/point_line_solid.frag" SHADER_FILES_HLSL "texture_loading/hlsl/texture.vert.hlsl" "texture_loading/hlsl/texture.frag.hlsl") \ No newline at end of file diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index 72a9aae..7405395 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -1312,7 +1312,7 @@ void TextureLoading::prepare_pipeline_point_line() // 顶点输入绑定描述 (告诉 Vulkan 顶点数据的格式) VkVertexInputBindingDescription vertex_input_binding_description{}; vertex_input_binding_description.binding = 0; // 绑定点 - vertex_input_binding_description.stride = sizeof(PointVertex); // 每个顶点的字节大小 + vertex_input_binding_description.stride = sizeof(LineVertex); // 每个顶点的字节大小 vertex_input_binding_description.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; // 顶点输入属性描述 (告诉 Vulkan 每个属性在顶点结构中的位置) @@ -1321,12 +1321,12 @@ void TextureLoading::prepare_pipeline_point_line() // VkVertexInputAttributeDescription{1, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(PointVertex, r)} // 颜色 //}; - std::array vertex_input_attributes{}; + std::array vertex_input_attributes{}; vertex_input_attributes[0] = { 0, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, position) }; - vertex_input_attributes[1] = { 1, 1, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, color) }; - vertex_input_attributes[2] = { 2, 2, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, lineStart) }; - vertex_input_attributes[3] = { 3, 3, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, lineEnd) }; + vertex_input_attributes[1] = { 1, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, color) }; + vertex_input_attributes[2] = { 2, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, lineStart) }; + vertex_input_attributes[3] = { 3, 0, VK_FORMAT_R32G32B32_SFLOAT, offsetof(LineVertex, lineEnd) }; VkPipelineVertexInputStateCreateInfo vertex_input_state{ VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO }; vertex_input_state.vertexBindingDescriptionCount = 1; @@ -1381,8 +1381,10 @@ void TextureLoading::prepare_pipeline_point_line() // 加载着色器 std::array shader_stages; - shader_stages[0] = load_shader("texture_loading", "point_line.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); - shader_stages[1] = load_shader("texture_loading", "point_line.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); + //shader_stages[0] = load_shader("texture_loading", "point_line.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); + //shader_stages[1] = load_shader("texture_loading", "point_line.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); + shader_stages[0] = load_shader("texture_loading", "point_line_solid.vert.spv", VK_SHADER_STAGE_VERTEX_BIT); + shader_stages[1] = load_shader("texture_loading", "point_line_solid.frag.spv", VK_SHADER_STAGE_FRAGMENT_BIT); // 创建图形管线 VkGraphicsPipelineCreateInfo pipeline_create_info{ VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO };