8 #define LineVertex450 (VK_SHADER_STAGE_VERTEX_BIT | (1 << 6))
9 #define LineFragment450 (VK_SHADER_STAGE_FRAGMENT_BIT | (1 << 7))
13 { VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
14 { { 0, { 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT,
nullptr } } },
15 { 0, 2 *
sizeof(float), VK_VERTEX_INPUT_RATE_VERTEX },
16 { { 0, 0, VK_FORMAT_R32G32_SFLOAT, 0 } },
17 { VK_SHADER_STAGE_VERTEX_BIT, 0,
sizeof(
PushBuffer) } }
20 { VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
33 "#extension GL_ARB_separate_shader_objects : enable\n"
34 "layout(set = 0, binding = 0) uniform Projection { mat4 projection; } proj;\n"
35 "layout(push_constant) uniform ComboBuffer {\n"
39 "layout(location = 0) in vec2 fragPosition;\n"
40 "layout(location = 0) out vec4 fragColor;\n"
42 " gl_Position = proj.projection * cb.transform * vec4(fragPosition, 0.0, 1.0);\n"
43 " fragColor = cb.color;\n"
46 0x07230203, 0x00010300, 0x00080008, 0x0000002F,
47 0x00000000, 0x00020011, 0x00000001, 0x0006000B,
48 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E,
49 0x00000000, 0x0003000E, 0x00000000, 0x00000001,
50 0x0008000F, 0x00000000, 0x00000004, 0x6E69616D,
51 0x00000000, 0x0000000D, 0x00000020, 0x0000002A,
52 0x00030003, 0x00000002, 0x000001C2, 0x00090004,
53 0x415F4C47, 0x735F4252, 0x72617065, 0x5F657461,
54 0x64616873, 0x6F5F7265, 0x63656A62, 0x00007374,
55 0x00040005, 0x00000004, 0x6E69616D, 0x00000000,
56 0x00060005, 0x0000000B, 0x505F6C67, 0x65567265,
57 0x78657472, 0x00000000, 0x00060006, 0x0000000B,
58 0x00000000, 0x505F6C67, 0x7469736F, 0x006E6F69,
59 0x00070006, 0x0000000B, 0x00000001, 0x505F6C67,
60 0x746E696F, 0x657A6953, 0x00000000, 0x00070006,
61 0x0000000B, 0x00000002, 0x435F6C67, 0x4470696C,
62 0x61747369, 0x0065636E, 0x00070006, 0x0000000B,
63 0x00000003, 0x435F6C67, 0x446C6C75, 0x61747369,
64 0x0065636E, 0x00030005, 0x0000000D, 0x00000000,
65 0x00050005, 0x00000011, 0x6A6F7250, 0x69746365,
66 0x00006E6F, 0x00060006, 0x00000011, 0x00000000,
67 0x6A6F7270, 0x69746365, 0x00006E6F, 0x00040005,
68 0x00000013, 0x6A6F7270, 0x00000000, 0x00050005,
69 0x00000017, 0x626D6F43, 0x6675426F, 0x00726566,
70 0x00060006, 0x00000017, 0x00000000, 0x6E617274,
71 0x726F6673, 0x0000006D, 0x00050006, 0x00000017,
72 0x00000001, 0x6F6C6F63, 0x00000072, 0x00030005,
73 0x00000019, 0x00006263, 0x00060005, 0x00000020,
74 0x67617266, 0x69736F50, 0x6E6F6974, 0x00000000,
75 0x00050005, 0x0000002A, 0x67617266, 0x6F6C6F43,
76 0x00000072, 0x00050048, 0x0000000B, 0x00000000,
77 0x0000000B, 0x00000000, 0x00050048, 0x0000000B,
78 0x00000001, 0x0000000B, 0x00000001, 0x00050048,
79 0x0000000B, 0x00000002, 0x0000000B, 0x00000003,
80 0x00050048, 0x0000000B, 0x00000003, 0x0000000B,
81 0x00000004, 0x00030047, 0x0000000B, 0x00000002,
82 0x00040048, 0x00000011, 0x00000000, 0x00000005,
83 0x00050048, 0x00000011, 0x00000000, 0x00000023,
84 0x00000000, 0x00050048, 0x00000011, 0x00000000,
85 0x00000007, 0x00000010, 0x00030047, 0x00000011,
86 0x00000002, 0x00040047, 0x00000013, 0x00000022,
87 0x00000000, 0x00040047, 0x00000013, 0x00000021,
88 0x00000000, 0x00040048, 0x00000017, 0x00000000,
89 0x00000005, 0x00050048, 0x00000017, 0x00000000,
90 0x00000023, 0x00000000, 0x00050048, 0x00000017,
91 0x00000000, 0x00000007, 0x00000010, 0x00050048,
92 0x00000017, 0x00000001, 0x00000023, 0x00000040,
93 0x00030047, 0x00000017, 0x00000002, 0x00040047,
94 0x00000020, 0x0000001E, 0x00000000, 0x00040047,
95 0x0000002A, 0x0000001E, 0x00000000, 0x00020013,
96 0x00000002, 0x00030021, 0x00000003, 0x00000002,
97 0x00030016, 0x00000006, 0x00000020, 0x00040017,
98 0x00000007, 0x00000006, 0x00000004, 0x00040015,
99 0x00000008, 0x00000020, 0x00000000, 0x0004002B,
100 0x00000008, 0x00000009, 0x00000001, 0x0004001C,
101 0x0000000A, 0x00000006, 0x00000009, 0x0006001E,
102 0x0000000B, 0x00000007, 0x00000006, 0x0000000A,
103 0x0000000A, 0x00040020, 0x0000000C, 0x00000003,
104 0x0000000B, 0x0004003B, 0x0000000C, 0x0000000D,
105 0x00000003, 0x00040015, 0x0000000E, 0x00000020,
106 0x00000001, 0x0004002B, 0x0000000E, 0x0000000F,
107 0x00000000, 0x00040018, 0x00000010, 0x00000007,
108 0x00000004, 0x0003001E, 0x00000011, 0x00000010,
109 0x00040020, 0x00000012, 0x00000002, 0x00000011,
110 0x0004003B, 0x00000012, 0x00000013, 0x00000002,
111 0x00040020, 0x00000014, 0x00000002, 0x00000010,
112 0x0004001E, 0x00000017, 0x00000010, 0x00000007,
113 0x00040020, 0x00000018, 0x00000009, 0x00000017,
114 0x0004003B, 0x00000018, 0x00000019, 0x00000009,
115 0x00040020, 0x0000001A, 0x00000009, 0x00000010,
116 0x00040017, 0x0000001E, 0x00000006, 0x00000002,
117 0x00040020, 0x0000001F, 0x00000001, 0x0000001E,
118 0x0004003B, 0x0000001F, 0x00000020, 0x00000001,
119 0x0004002B, 0x00000006, 0x00000022, 0x00000000,
120 0x0004002B, 0x00000006, 0x00000023, 0x3F800000,
121 0x00040020, 0x00000028, 0x00000003, 0x00000007,
122 0x0004003B, 0x00000028, 0x0000002A, 0x00000003,
123 0x0004002B, 0x0000000E, 0x0000002B, 0x00000001,
124 0x00040020, 0x0000002C, 0x00000009, 0x00000007,
125 0x00050036, 0x00000002, 0x00000004, 0x00000000,
126 0x00000003, 0x000200F8, 0x00000005, 0x00050041,
127 0x00000014, 0x00000015, 0x00000013, 0x0000000F,
128 0x0004003D, 0x00000010, 0x00000016, 0x00000015,
129 0x00050041, 0x0000001A, 0x0000001B, 0x00000019,
130 0x0000000F, 0x0004003D, 0x00000010, 0x0000001C,
131 0x0000001B, 0x00050092, 0x00000010, 0x0000001D,
132 0x00000016, 0x0000001C, 0x0004003D, 0x0000001E,
133 0x00000021, 0x00000020, 0x00050051, 0x00000006,
134 0x00000024, 0x00000021, 0x00000000, 0x00050051,
135 0x00000006, 0x00000025, 0x00000021, 0x00000001,
136 0x00070050, 0x00000007, 0x00000026, 0x00000024,
137 0x00000025, 0x00000022, 0x00000023, 0x00050091,
138 0x00000007, 0x00000027, 0x0000001D, 0x00000026,
139 0x00050041, 0x00000028, 0x00000029, 0x0000000D,
140 0x0000000F, 0x0003003E, 0x00000029, 0x00000027,
141 0x00050041, 0x0000002C, 0x0000002D, 0x00000019,
142 0x0000002B, 0x0004003D, 0x00000007, 0x0000002E,
143 0x0000002D, 0x0003003E, 0x0000002A, 0x0000002E,
144 0x000100FD, 0x00010038
150 "#extension GL_ARB_separate_shader_objects : enable\n"
151 "layout(location = 0) in vec4 lineColor;\n"
152 "layout(location = 0) out vec4 fragColor;\n"
154 " fragColor = lineColor;\n"
157 0x07230203, 0x00010300, 0x00080008, 0x0000000D,
158 0x00000000, 0x00020011, 0x00000001, 0x0006000B,
159 0x00000001, 0x4C534C47, 0x6474732E, 0x3035342E,
160 0x00000000, 0x0003000E, 0x00000000, 0x00000001,
161 0x0007000F, 0x00000004, 0x00000004, 0x6E69616D,
162 0x00000000, 0x00000009, 0x0000000B, 0x00030010,
163 0x00000004, 0x00000007, 0x00030003, 0x00000002,
164 0x000001C2, 0x00090004, 0x415F4C47, 0x735F4252,
165 0x72617065, 0x5F657461, 0x64616873, 0x6F5F7265,
166 0x63656A62, 0x00007374, 0x00040005, 0x00000004,
167 0x6E69616D, 0x00000000, 0x00050005, 0x00000009,
168 0x67617266, 0x6F6C6F43, 0x00000072, 0x00050005,
169 0x0000000B, 0x656E696C, 0x6F6C6F43, 0x00000072,
170 0x00040047, 0x00000009, 0x0000001E, 0x00000000,
171 0x00040047, 0x0000000B, 0x0000001E, 0x00000000,
172 0x00020013, 0x00000002, 0x00030021, 0x00000003,
173 0x00000002, 0x00030016, 0x00000006, 0x00000020,
174 0x00040017, 0x00000007, 0x00000006, 0x00000004,
175 0x00040020, 0x00000008, 0x00000003, 0x00000007,
176 0x0004003B, 0x00000008, 0x00000009, 0x00000003,
177 0x00040020, 0x0000000A, 0x00000001, 0x00000007,
178 0x0004003B, 0x0000000A, 0x0000000B, 0x00000001,
179 0x00050036, 0x00000002, 0x00000004, 0x00000000,
180 0x00000003, 0x000200F8, 0x00000005, 0x0004003D,
181 0x00000007, 0x0000000C, 0x0000000B, 0x0003003E,
182 0x00000009, 0x0000000C, 0x000100FD, 0x00010038
189 { VK_DYNAMIC_STATE_LINE_WIDTH },
193 m_needsPrepare =
true;
212 float fade = 1.0F - (
m_rate / 150.0F);
213 float zoom = 1.0F - (
m_rate / 4000.0F);
216 state.second[1] *= fade;
217 state.second[2] *= zoom;
228 vertex.second[0] =
m_hue;
229 vertex.second[1] = 1.0;
230 vertex.second[2] = 1.0;
231 auto * buffer = vertex.first->GetMappedMemory();
234 vertex.first->Update(
nullptr);
253 m_vulkanFuncs->vkCmdBindDescriptorSets(currentcmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS,
258 float centrex =
m_area.left() + (
m_area.width() / 2.0F);
259 float centrey =
m_area.top() + (
m_area.height() / 2.0F);
264 VkDeviceSize offset = 0;
265 VkBuffer vbos { vertex.first->GetBuffer() };
266 m_vulkanFuncs->vkCmdBindVertexBuffers(currentcmdbuf, 0, 1, &vbos, &offset);
273 QMatrix4x4 transform;
276 transform.translate(centrex, centrey);
277 transform.scale(vertex.second[2]);
278 transform.translate(-centrex, -centrey);
281 auto color = QColor::fromHsvF(
static_cast<qreal
>(vertex.second[0]), 1.0,
282 static_cast<qreal
>(vertex.second[1]));
290 m_vulkanFuncs->vkCmdPushConstants(currentcmdbuf, layout, VK_SHADER_STAGE_VERTEX_BIT,
333 int size =
m_fade ? 8 : 1;