forked from KhronosGroup/Vulkan-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhpp_instancing.cpp
More file actions
482 lines (394 loc) · 21 KB
/
hpp_instancing.cpp
File metadata and controls
482 lines (394 loc) · 21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Instanced mesh rendering, uses a separate vertex buffer for instanced data, using vulkan.hpp
*/
#include "hpp_instancing.h"
#include <benchmark_mode/benchmark_mode.h>
#include <random>
HPPInstancing::HPPInstancing()
{
title = "HPP instanced mesh rendering";
}
HPPInstancing::~HPPInstancing()
{
if (get_device() && get_device()->get_handle())
{
vk::Device device = get_device()->get_handle();
device.destroyPipeline(pipelines.instanced_rocks);
device.destroyPipeline(pipelines.planet);
device.destroyPipeline(pipelines.starfield);
device.destroyPipelineLayout(pipeline_layout);
device.destroyDescriptorSetLayout(descriptor_set_layout);
device.destroyBuffer(instance_buffer.buffer);
device.freeMemory(instance_buffer.memory);
device.destroySampler(textures.rocks.sampler);
device.destroySampler(textures.planet.sampler);
}
}
void HPPInstancing::request_gpu_features(vkb::core::HPPPhysicalDevice &gpu)
{
auto & requested_features = gpu.get_mutable_requested_features();
auto const &features = gpu.get_features();
// Enable anisotropic filtering if supported
if (features.samplerAnisotropy)
{
requested_features.samplerAnisotropy = true;
}
// Enable texture compression
if (features.textureCompressionBC)
{
requested_features.textureCompressionBC = true;
}
else if (features.textureCompressionASTC_LDR)
{
requested_features.textureCompressionASTC_LDR = true;
}
else if (features.textureCompressionETC2)
{
requested_features.textureCompressionETC2 = true;
}
};
void HPPInstancing::build_command_buffers()
{
vk::CommandBufferBeginInfo command_buffer_begin_info;
std::array<vk::ClearValue, 2> clear_values =
{{vk::ClearColorValue(std::array<float, 4>({{0.0f, 0.0f, 0.033f, 0.0f}})),
vk::ClearDepthStencilValue(0.0f, 0)}};
vk::RenderPassBeginInfo render_pass_begin_info(render_pass, {}, {{0, 0}, extent}, clear_values);
for (int32_t i = 0; i < draw_cmd_buffers.size(); ++i)
{
// Set target frame buffer
render_pass_begin_info.framebuffer = framebuffers[i];
auto command_buffer = draw_cmd_buffers[i];
command_buffer.begin(command_buffer_begin_info);
command_buffer.beginRenderPass(render_pass_begin_info, vk::SubpassContents::eInline);
vk::Viewport viewport(0.0f, 0.0f, static_cast<float>(extent.width), static_cast<float>(extent.height), 0.0f, 1.0f);
command_buffer.setViewport(0, viewport);
vk::Rect2D scissor({0, 0}, extent);
command_buffer.setScissor(0, scissor);
vk::DeviceSize offset = 0;
// Star field
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, pipeline_layout, 0, descriptor_sets.planet, {});
command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipelines.starfield);
command_buffer.draw(4, 1, 0, 0);
// Planet
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, pipeline_layout, 0, descriptor_sets.planet, {});
command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipelines.planet);
command_buffer.bindVertexBuffers(0, models.planet->get_vertex_buffer("vertex_buffer").get_handle(), offset);
command_buffer.bindIndexBuffer(models.planet->get_index_buffer().get_handle(), 0, vk::IndexType::eUint32);
command_buffer.drawIndexed(models.planet->vertex_indices, 1, 0, 0, 0);
// Instanced rocks
command_buffer.bindDescriptorSets(vk::PipelineBindPoint::eGraphics, pipeline_layout, 0, descriptor_sets.instanced_rocks, {});
command_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipelines.instanced_rocks);
// Binding point 0 : Mesh vertex buffer
command_buffer.bindVertexBuffers(0, models.rock->get_vertex_buffer("vertex_buffer").get_handle(), offset);
// Binding point 1 : Instance data buffer
command_buffer.bindVertexBuffers(1, instance_buffer.buffer, offset);
command_buffer.bindIndexBuffer(models.rock->get_index_buffer().get_handle(), 0, vk::IndexType::eUint32);
// Render instances
command_buffer.drawIndexed(models.rock->vertex_indices, INSTANCE_COUNT, 0, 0, 0);
draw_ui(command_buffer);
command_buffer.endRenderPass();
command_buffer.end();
}
}
void HPPInstancing::load_assets()
{
models.rock = load_model("scenes/rock.gltf");
models.planet = load_model("scenes/planet.gltf");
textures.rocks = load_texture_array("textures/texturearray_rocks_color_rgba.ktx", vkb::sg::Image::Color);
textures.planet = load_texture("textures/lavaplanet_color_rgba.ktx", vkb::sg::Image::Color);
}
void HPPInstancing::setup_descriptor_pool()
{
// Example uses one ubo
std::array<vk::DescriptorPoolSize, 2> pool_sizes = {{{vk::DescriptorType::eUniformBuffer, 2}, {vk::DescriptorType::eCombinedImageSampler, 2}}};
vk::DescriptorPoolCreateInfo descriptor_pool_create_info({}, 2, pool_sizes);
descriptor_pool = get_device()->get_handle().createDescriptorPool(descriptor_pool_create_info);
}
void HPPInstancing::setup_descriptor_set_layout()
{
std::array<vk::DescriptorSetLayoutBinding, 2> set_layout_bindings = {
{{0, vk::DescriptorType::eUniformBuffer, 1, vk::ShaderStageFlagBits::eVertex}, // Binding 0 : Vertex shader uniform buffer
{1, vk::DescriptorType::eCombinedImageSampler, 1, vk::ShaderStageFlagBits::eFragment}}}; // Binding 1 : Fragment shader combined sampler
vk::DescriptorSetLayoutCreateInfo descriptor_layout_create_info({}, set_layout_bindings);
descriptor_set_layout = get_device()->get_handle().createDescriptorSetLayout(descriptor_layout_create_info);
#if defined(ANDROID)
vk::PipelineLayoutCreateInfo pipeline_layout_create_info({}, 1, &descriptor_set_layout);
#else
vk::PipelineLayoutCreateInfo pipeline_layout_create_info({}, descriptor_set_layout);
#endif
pipeline_layout = get_device()->get_handle().createPipelineLayout(pipeline_layout_create_info);
}
void HPPInstancing::setup_descriptor_set()
{
#if defined(ANDROID)
vk::DescriptorSetAllocateInfo descriptor_set_alloc_info(descriptor_pool, 1, &descriptor_set_layout);
#else
vk::DescriptorSetAllocateInfo descriptor_set_alloc_info(descriptor_pool, descriptor_set_layout);
#endif
// Instanced rocks
descriptor_sets.instanced_rocks = get_device()->get_handle().allocateDescriptorSets(descriptor_set_alloc_info).front();
vk::DescriptorBufferInfo buffer_descriptor(uniform_buffers.scene->get_handle(), 0, VK_WHOLE_SIZE);
vk::DescriptorImageInfo image_descriptor(
textures.rocks.sampler,
textures.rocks.image->get_vk_image_view().get_handle(),
descriptor_type_to_image_layout(vk::DescriptorType::eCombinedImageSampler, textures.rocks.image->get_vk_image_view().get_format()));
std::array<vk::WriteDescriptorSet, 2> write_descriptor_sets = {
{{descriptor_sets.instanced_rocks, 0, 0, vk::DescriptorType::eUniformBuffer, {}, buffer_descriptor}, // Binding 0 : Vertex shader uniform buffer
{descriptor_sets.instanced_rocks, 1, 0, vk::DescriptorType::eCombinedImageSampler, image_descriptor}}}; // Binding 1 : Color map
get_device()->get_handle().updateDescriptorSets(write_descriptor_sets, {});
// Planet
descriptor_sets.planet = get_device()->get_handle().allocateDescriptorSets(descriptor_set_alloc_info).front();
image_descriptor = {textures.planet.sampler,
textures.planet.image->get_vk_image_view().get_handle(),
descriptor_type_to_image_layout(vk::DescriptorType::eCombinedImageSampler, textures.planet.image->get_vk_image_view().get_format())};
write_descriptor_sets = {
{{descriptor_sets.planet, 0, 0, vk::DescriptorType::eUniformBuffer, {}, buffer_descriptor}, // Binding 0 : Vertex shader uniform buffer
{descriptor_sets.planet, 1, 0, vk::DescriptorType::eCombinedImageSampler, image_descriptor}}}; // Binding 1 : Color map
get_device()->get_handle().updateDescriptorSets(write_descriptor_sets, {});
}
void HPPInstancing::prepare_pipelines()
{
// Load shaders: Instancing pipeline
std::array<vk::PipelineShaderStageCreateInfo, 2> shader_stages{
load_shader("instancing/instancing.vert", vk::ShaderStageFlagBits::eVertex),
load_shader("instancing/instancing.frag", vk::ShaderStageFlagBits::eFragment)};
// This example uses two different input states, one for the instanced part and one for non-instanced rendering
// Vertex input bindings
// The instancing pipeline uses a vertex input state with two bindings
std::array<vk::VertexInputBindingDescription, 2> binding_descriptions = {
{{0, sizeof(HPPVertex), vk::VertexInputRate::eVertex}, // Binding point 0: Mesh vertex layout description at per-vertex rate
{1, sizeof(InstanceData), vk::VertexInputRate::eInstance}}}; // Binding point 1: Instanced data at per-instance rate
// Vertex attribute bindings
// Note that the shader declaration for per-vertex and per-instance attributes is the same, the different input rates are only stored in the bindings:
// instanced.vert:
// layout (location = 0) in vec3 inPos; Per-Vertex
// ...
// layout (location = 4) in vec3 instancePos; Per-Instance
std::array<vk::VertexInputAttributeDescription, 7> attribute_descriptions = {
{ // Per-vertex attributees
// These are advanced for each vertex fetched by the vertex shader
{0, 0, vk::Format::eR32G32B32Sfloat, 0}, // Location 0: Position
{1, 0, vk::Format::eR32G32B32Sfloat, 3 * sizeof(float)}, // Location 1: Normal
{2, 0, vk::Format::eR32G32Sfloat, 6 * sizeof(float)}, // Location 2: Texture coordinates
// Per-Instance attributes
// These are fetched for each instance rendered
{3, 1, vk::Format::eR32G32B32Sfloat, 0}, // Location 3: Position
{4, 1, vk::Format::eR32G32B32Sfloat, 3 * sizeof(float)}, // Location 4: Rotation
{5, 1, vk::Format::eR32Sfloat, 6 * sizeof(float)}, // Location 5: Scale
{6, 1, vk::Format::eR32Sint, 7 * sizeof(float)}}}; // Location 6: Texture array layer index
// Use all input bindings and attribute descriptions
vk::PipelineVertexInputStateCreateInfo input_state({}, binding_descriptions, attribute_descriptions);
vk::PipelineInputAssemblyStateCreateInfo input_assembly_state({}, vk::PrimitiveTopology::eTriangleList, false);
vk::PipelineViewportStateCreateInfo viewport_state({}, 1, nullptr, 1, nullptr);
vk::PipelineRasterizationStateCreateInfo rasterization_state;
rasterization_state.polygonMode = vk::PolygonMode::eFill;
rasterization_state.cullMode = vk::CullModeFlagBits::eBack;
rasterization_state.frontFace = vk::FrontFace::eClockwise;
rasterization_state.lineWidth = 1.0f;
vk::PipelineMultisampleStateCreateInfo multisample_state({}, vk::SampleCountFlagBits::e1);
// Note: Using Reversed depth-buffer for increased precision, so Greater depth values are kept
vk::PipelineDepthStencilStateCreateInfo depth_stencil_state;
depth_stencil_state.depthCompareOp = vk::CompareOp::eGreater;
depth_stencil_state.depthTestEnable = true;
depth_stencil_state.depthWriteEnable = true;
depth_stencil_state.back.compareOp = vk::CompareOp::eAlways;
depth_stencil_state.front = depth_stencil_state.back;
vk::PipelineColorBlendAttachmentState blend_attachment_state;
blend_attachment_state.colorWriteMask =
vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eB | vk::ColorComponentFlagBits::eA;
vk::PipelineColorBlendStateCreateInfo color_blend_state({}, false, {}, blend_attachment_state);
std::array<vk::DynamicState, 2> dynamic_state_enables = {vk::DynamicState::eViewport, vk::DynamicState::eScissor};
vk::PipelineDynamicStateCreateInfo dynamic_state({}, dynamic_state_enables);
vk::GraphicsPipelineCreateInfo pipeline_create_info({},
shader_stages,
&input_state,
&input_assembly_state,
{},
&viewport_state,
&rasterization_state,
&multisample_state,
&depth_stencil_state,
&color_blend_state,
&dynamic_state,
pipeline_layout,
render_pass,
{},
{},
-1);
vk::Result result;
std::tie(result, pipelines.instanced_rocks) = get_device()->get_handle().createGraphicsPipeline(pipeline_cache, pipeline_create_info);
assert(result == vk::Result::eSuccess);
// Planet rendering pipeline
shader_stages = {load_shader("instancing/planet.vert", vk::ShaderStageFlagBits::eVertex),
load_shader("instancing/planet.frag", vk::ShaderStageFlagBits::eFragment)};
// Only use the non-instanced input bindings and attribute descriptions
input_state.vertexBindingDescriptionCount = 1;
input_state.vertexAttributeDescriptionCount = 3;
std::tie(result, pipelines.planet) = get_device()->get_handle().createGraphicsPipeline(pipeline_cache, pipeline_create_info);
assert(result == vk::Result::eSuccess);
// Star field pipeline
rasterization_state.cullMode = vk::CullModeFlagBits::eNone;
depth_stencil_state.depthWriteEnable = false;
depth_stencil_state.depthTestEnable = false;
shader_stages = {load_shader("instancing/starfield.vert", vk::ShaderStageFlagBits::eVertex),
load_shader("instancing/starfield.frag", vk::ShaderStageFlagBits::eFragment)};
// Vertices are generated in the vertex shader
input_state.vertexBindingDescriptionCount = 0;
input_state.vertexAttributeDescriptionCount = 0;
std::tie(result, pipelines.starfield) = get_device()->get_handle().createGraphicsPipeline(pipeline_cache, pipeline_create_info);
assert(result == vk::Result::eSuccess);
}
void HPPInstancing::prepare_instance_data()
{
std::vector<InstanceData> instance_data;
instance_data.resize(INSTANCE_COUNT);
std::default_random_engine rnd_generator(platform->using_plugin<::plugins::BenchmarkMode>() ? 0 : (unsigned) time(nullptr));
std::uniform_real_distribution<float> uniform_dist(0.0, 1.0);
std::uniform_int_distribution<uint32_t> rnd_texture_index(0, textures.rocks.image->get_vk_image().get_array_layer_count());
// Distribute rocks randomly on two different rings
for (auto i = 0; i < INSTANCE_COUNT / 2; i++)
{
glm::vec2 ring0{7.0f, 11.0f};
glm::vec2 ring1{14.0f, 18.0f};
float rho, theta;
// Inner ring
rho = sqrt((pow(ring0[1], 2.0f) - pow(ring0[0], 2.0f)) * uniform_dist(rnd_generator) + pow(ring0[0], 2.0f));
theta = 2.0f * glm::pi<float>() * uniform_dist(rnd_generator);
instance_data[i].pos = glm::vec3(rho * cos(theta), uniform_dist(rnd_generator) * 0.5f - 0.25f, rho * sin(theta));
instance_data[i].rot = glm::vec3(glm::pi<float>() * uniform_dist(rnd_generator), glm::pi<float>() * uniform_dist(rnd_generator), glm::pi<float>() * uniform_dist(rnd_generator));
instance_data[i].scale = 1.5f + uniform_dist(rnd_generator) - uniform_dist(rnd_generator);
instance_data[i].texIndex = rnd_texture_index(rnd_generator);
instance_data[i].scale *= 0.75f;
// Outer ring
rho = sqrt((pow(ring1[1], 2.0f) - pow(ring1[0], 2.0f)) * uniform_dist(rnd_generator) + pow(ring1[0], 2.0f));
theta = 2.0f * glm::pi<float>() * uniform_dist(rnd_generator);
instance_data[static_cast<size_t>(i + INSTANCE_COUNT / 2)].pos = glm::vec3(rho * cos(theta), uniform_dist(rnd_generator) * 0.5f - 0.25f, rho * sin(theta));
instance_data[static_cast<size_t>(i + INSTANCE_COUNT / 2)].rot = glm::vec3(glm::pi<float>() * uniform_dist(rnd_generator), glm::pi<float>() * uniform_dist(rnd_generator), glm::pi<float>() * uniform_dist(rnd_generator));
instance_data[static_cast<size_t>(i + INSTANCE_COUNT / 2)].scale = 1.5f + uniform_dist(rnd_generator) - uniform_dist(rnd_generator);
instance_data[static_cast<size_t>(i + INSTANCE_COUNT / 2)].texIndex = rnd_texture_index(rnd_generator);
instance_data[static_cast<size_t>(i + INSTANCE_COUNT / 2)].scale *= 0.75f;
}
instance_buffer.size = instance_data.size() * sizeof(InstanceData);
// Staging
// Instanced data is static, copy to device local memory
// On devices with separate memory types for host visible and device local memory this will result in better performance
// On devices with unified memory types (DEVICE_LOCAL_BIT and HOST_VISIBLE_BIT supported at once) this isn't necessary and you could skip the staging
struct
{
vk::DeviceMemory memory;
vk::Buffer buffer;
} staging_buffer;
std::tie(staging_buffer.buffer, staging_buffer.memory) =
get_device()->create_buffer(vk::BufferUsageFlagBits::eTransferSrc,
vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent,
instance_buffer.size,
instance_data.data());
std::tie(instance_buffer.buffer, instance_buffer.memory) =
get_device()->create_buffer(vk::BufferUsageFlagBits::eVertexBuffer | vk::BufferUsageFlagBits::eTransferDst,
vk::MemoryPropertyFlagBits::eDeviceLocal,
instance_buffer.size);
// Copy to staging buffer
vk::CommandBuffer copy_command = device->create_command_buffer(vk::CommandBufferLevel::ePrimary, true);
vk::BufferCopy copy_region(0, 0, instance_buffer.size);
copy_command.copyBuffer(staging_buffer.buffer, instance_buffer.buffer, copy_region);
device->flush_command_buffer(copy_command, queue, true);
instance_buffer.descriptor.range = instance_buffer.size;
instance_buffer.descriptor.buffer = instance_buffer.buffer;
instance_buffer.descriptor.offset = 0;
// Destroy staging resources
get_device()->get_handle().destroyBuffer(staging_buffer.buffer);
get_device()->get_handle().freeMemory(staging_buffer.memory);
}
void HPPInstancing::prepare_uniform_buffers()
{
uniform_buffers.scene =
std::make_unique<vkb::core::HPPBuffer>(*get_device(), sizeof(ubo_vs), vk::BufferUsageFlagBits::eUniformBuffer, VMA_MEMORY_USAGE_CPU_TO_GPU);
update_uniform_buffer(0.0f);
}
void HPPInstancing::update_uniform_buffer(float delta_time)
{
ubo_vs.projection = camera.matrices.perspective;
ubo_vs.view = camera.matrices.view;
if (!paused)
{
ubo_vs.loc_speed += delta_time * 0.35f;
ubo_vs.glob_speed += delta_time * 0.01f;
}
uniform_buffers.scene->convert_and_update(ubo_vs);
}
void HPPInstancing::draw()
{
HPPApiVulkanSample::prepare_frame();
// Command buffer to be sumitted to the queue
submit_info.setCommandBuffers(draw_cmd_buffers[current_buffer]);
// Submit to queue
queue.submit(submit_info);
HPPApiVulkanSample::submit_frame();
}
bool HPPInstancing::prepare(vkb::platform::HPPPlatform &platform)
{
if (!HPPApiVulkanSample::prepare(platform))
{
return false;
}
// Note: Using Revsered depth-buffer for increased precision, so Znear and Zfar are flipped
camera.type = vkb::CameraType::LookAt;
camera.set_perspective(60.0f, (float) extent.width / (float) extent.height, 256.0f, 0.1f);
camera.set_rotation(glm::vec3(-17.2f, -4.7f, 0.0f));
camera.set_translation(glm::vec3(5.5f, -1.85f, -18.5f));
load_assets();
prepare_instance_data();
prepare_uniform_buffers();
setup_descriptor_set_layout();
prepare_pipelines();
setup_descriptor_pool();
setup_descriptor_set();
build_command_buffers();
prepared = true;
return true;
}
void HPPInstancing::render(float delta_time)
{
if (prepared)
{
draw();
if (!paused || camera.updated)
{
update_uniform_buffer(delta_time);
}
}
}
void HPPInstancing::on_update_ui_overlay(vkb::HPPDrawer &drawer)
{
if (drawer.header("Statistics"))
{
drawer.text("Instances: %d", INSTANCE_COUNT);
}
}
bool HPPInstancing::resize(const uint32_t width, const uint32_t height)
{
HPPApiVulkanSample::resize(width, height);
build_command_buffers();
return true;
}
std::unique_ptr<vkb::Application> create_hpp_instancing()
{
return std::make_unique<HPPInstancing>();
}