保存一下代码。
This commit is contained in:
@@ -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")
|
||||
@@ -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<VkVertexInputAttributeDescription, 5> vertex_input_attributes{};
|
||||
std::array<VkVertexInputAttributeDescription, 4> 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<VkPipelineShaderStageCreateInfo, 2> 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 };
|
||||
|
||||
Reference in New Issue
Block a user