Repository navigation
Expand file tree
/
Copy pathexamples.h
More file actions
517 lines (385 loc) · 14.4 KB
/
Copy pathexamples.h
File metadata and controls
517 lines (385 loc) · 14.4 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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
/*
* examples.h
*
* Copyright (c) 2016-2026 The Brenwill Workshop Ltd.
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*
*
* Loads the appropriate example code, as indicated by the appropriate compiler build setting below.
*
* To select an example to run, define one (and only one) of the macros below, either by
* adding a #define XXX statement at the top of this file, or more flexibily, by adding the
* macro value to the Apple Clang - Preprocessing -> Preprocessor Macros compiler setting.
*
* To add a compiler setting, select the examples project in the Xcode Project Navigator panel,
* select the Build Settings panel, and add the value to the Preprocessor Macros entry.
*
* For example, to run the pipelines example, you would add the MVK_pipelines define macro to the
* Preprocessor Macros entry of the MoltenVK examples project, overwriting any other value there.
*
* If you choose to add a #define statement to this file, be sure to clear the existing macro
* from the Preprocessor Macros compiler setting in the MoltenVK examples project.
*/
// In the list below, the comments indicate entries that,
// under certain conditions, that may not run as expected.
// Uncomment the next line and select example here if not using a Preprocessor Macro to define example
//#define MVK_vulkanscene
// COMMON - Include VulkanglTFModel.cpp in all examples other than ones that already include/customize tiny_gltf.h directly
#if !defined(MVK_gltfloading) && !defined(MVK_gltfskinning) && !defined(MVK_gltfscenerendering) && !defined(MVK_vertexattributes)
# include "../base/VulkanglTFModel.cpp"
#endif
// BASICS
#ifdef MVK_triangle
# include "../examples/triangle/triangle.cpp"
#endif
// Supported as of MoltenVK version 1.3.0 / Vulkan SDK 1.4.321.0
#ifdef MVK_trianglevulkan13
# include "../examples/trianglevulkan13/trianglevulkan13.cpp"
#endif
#ifdef MVK_pipelines
# include "../examples/pipelines/pipelines.cpp"
#endif
#ifdef MVK_descriptorsets
# include "../examples/descriptorsets/descriptorsets.cpp"
#endif
#ifdef MVK_dynamicuniformbuffer
# include "../examples/dynamicuniformbuffer/dynamicuniformbuffer.cpp"
#endif
#ifdef MVK_pushconstants
# include "../examples/pushconstants/pushconstants.cpp"
#endif
#ifdef MVK_specializationconstants
# include "../examples/specializationconstants/specializationconstants.cpp"
#endif
#ifdef MVK_texture
# include "../examples/texture/texture.cpp"
#endif
#ifdef MVK_texturearray
# include "../examples/texturearray/texturearray.cpp"
#endif
#ifdef MVK_texturecubemap
# include "../examples/texturecubemap/texturecubemap.cpp"
#endif
// Not supported on iOS Simulator which does not support cube map arrays.
#ifdef MVK_texturecubemaparray
# include "../examples/texturecubemaparray/texturecubemaparray.cpp"
#endif
#ifdef MVK_texture3d
# include "../examples/texture3d/texture3d.cpp"
#endif
#ifdef MVK_inputattachments
# include "../examples/inputattachments/inputattachments.cpp"
#endif
#ifdef MVK_subpasses
# include "../examples/subpasses/subpasses.cpp"
#endif
#ifdef MVK_offscreen
# include "../examples/offscreen/offscreen.cpp"
#endif
#ifdef MVK_particlesystem
# include "../examples/particlesystem/particlesystem.cpp"
#endif
#ifdef MVK_stencilbuffer
# include "../examples/stencilbuffer/stencilbuffer.cpp"
#endif
#ifdef MVK_vertexattributes
# include "../examples/vertexattributes/vertexattributes.cpp"
#endif
// glTF
#ifdef MVK_gltfloading
# include "../examples/gltfloading/gltfloading.cpp"
#endif
#ifdef MVK_gltfskinning
# include "../examples/gltfskinning/gltfskinning.cpp"
#endif
#ifdef MVK_gltfscenerendering
# include "../examples/gltfscenerendering/gltfscenerendering.cpp"
#endif
// ADVANCED
#ifdef MVK_multisampling
# include "../examples/multisampling/multisampling.cpp"
#endif
#ifdef MVK_multisamplingalphatocoverage
# include "../examples/multisamplingalphatocoverage/multisamplingalphatocoverage.cpp"
#endif
#ifdef MVK_hdr
# include "../examples/hdr/hdr.cpp"
#endif
#ifdef MVK_shadowmapping
# include "../examples/shadowmapping/shadowmapping.cpp"
#endif
// Not supported on iOS Simulator which does not support rendering to array (layered) attachments.
#ifdef MVK_shadowmappingcascade
# include "../examples/shadowmappingcascade/shadowmappingcascade.cpp"
#endif
// Not supported on iOS Simulator which does not support rendering to array (layered) attachments.
#ifdef MVK_shadowmappingomni
# include "../examples/shadowmappingomni/shadowmappingomni.cpp"
#endif
// Not supported on iOS Simulator which does not support arrays of samplers.
#ifdef MVK_texturemipmapgen
# include "../examples/texturemipmapgen/texturemipmapgen.cpp"
#endif
// Not supported on iOS Simulator which does not support blitting to linear tiled images.
#ifdef MVK_screenshot
# include "../examples/screenshot/screenshot.cpp"
#endif
// Not supported on iOS Simulator due to VkDeviceMemory resource limitations.
#ifdef MVK_oit
# include "../examples/oit/oit.cpp"
#endif
// PERFORMANCE
#ifdef MVK_multithreading
# include "../examples/multithreading/multithreading.cpp"
#endif
#ifdef MVK_instancing
# include "../examples/instancing/instancing.cpp"
#endif
// Not supported on iOS Simulator which does not support indirect drawing.
#ifdef MVK_indirectdraw
# include "../examples/indirectdraw/indirectdraw.cpp"
#endif
#ifdef MVK_occlusionquery
# include "../examples/occlusionquery/occlusionquery.cpp"
#endif
// Does not run. MoltenVK/Metal does not support pipeline statistics.
#ifdef MVK_pipelinestatistics
# include "../examples/pipelinestatistics/pipelinestatistics.cpp"
#endif
// Does not run. Sparse image binding and residency not supported by MoltenVK/Metal.
#ifdef MVK_texturesparseresidency
# include "../examples/texturesparseresidency/texturesparseresidency.cpp"
#endif
// PHYSICALLY BASED RENDERING
#ifdef MVK_pbrbasic
# include "../examples/pbrbasic/pbrbasic.cpp"
#endif
#ifdef MVK_pbribl
# include "../examples/pbribl/pbribl.cpp"
#endif
#ifdef MVK_pbrtexture
# include "../examples/pbrtexture/pbrtexture.cpp"
#endif
// DEFERRED
#ifdef MVK_deferred
# include "../examples/deferred/deferred.cpp"
#endif
#ifdef MVK_deferredmultisampling
# include "../examples/deferredmultisampling/deferredmultisampling.cpp"
#endif
// Does not run. MoltenVK/Metal does not support geometry shaders.
#ifdef MVK_deferredshadows
# include "../examples/deferredshadows/deferredshadows.cpp"
#endif
#ifdef MVK_ssao
# include "../examples/ssao/ssao.cpp"
#endif
// COMPUTE
#ifdef MVK_computeshader
# include "../examples/computeshader/computeshader.cpp"
#endif
#ifdef MVK_computeparticles
# include "../examples/computeparticles/computeparticles.cpp"
#endif
#ifdef MVK_computenbody
# include "../examples/computenbody/computenbody.cpp"
#endif
#ifdef MVK_computeraytracing
# include "../examples/computeraytracing/computeraytracing.cpp"
#endif
#ifdef MVK_computecloth
# include "../examples/computecloth/computecloth.cpp"
#endif
// Not supported on iOS Simulator which does not support indirect drawing.
#ifdef MVK_computecullandlod
# include "../examples/computecullandlod/computecullandlod.cpp"
#endif
// GEOMETRY SHADER
// Does not run. MoltenVK/Metal does not support geometry shaders.
#ifdef MVK_geometryshader
# include "../examples/geometryshader/geometryshader.cpp"
#endif
// Does not run. MoltenVK/Metal does not support geometry shaders.
#ifdef MVK_viewportarray
# include "../examples/viewportarray/viewportarray.cpp"
#endif
// TESSELLATION
// Not supported on iOS Simulator which does not support tessellation shaders.
#ifdef MVK_displacement
# include "../examples/displacement/displacement.cpp"
#endif
// Not supported on iOS Simulator which does not support tessellation shaders.
#ifdef MVK_terraintessellation
# include "../examples/terraintessellation/terraintessellation.cpp"
#endif
// Not supported on iOS Simulator which does not support tessellation shaders.
#ifdef MVK_tessellation
# include "../examples/tessellation/tessellation.cpp"
#endif
// RAY TRACING - Currently unsupported by MoltenVK/Metal
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingbasic
# include "../examples/raytracingbasic/raytracingbasic.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingshadows
# include "../examples/raytracingshadows/raytracingshadows.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingreflections
# include "../examples/raytracingreflections/raytracingreflections.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingtextures
# include "../examples/raytracingtextures/raytracingtextures.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingcallable
# include "../examples/raytracingcallable/raytracingcallable.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingintersection
# include "../examples/raytracingintersection/raytracingintersection.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracinggltf
# include "../examples/raytracinggltf/raytracinggltf.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_rayquery
# include "../examples/rayquery/rayquery.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingpositionfetch
# include "../examples/raytracingpositionfetch/raytracingpositionfetch.cpp"
#endif
// Does not run. Missing Vulkan extensions for ray tracing.
#ifdef MVK_raytracingsbtdata
# include "../examples/raytracingsbtdata/raytracingsbtdata.cpp"
#endif
// HEADLESS
// No headless target when using MoltenVK examples project, builds/runs fine using vulkanExamples project.
//#ifdef MVK_renderheadless
//# include "../examples/renderheadless/renderheadless.cpp"
//#endif
// No headless target when using MoltenVK examples project, builds/runs fine using vulkanExamples project.
//#ifdef MVK_computeheadless
//# include "../examples/computeheadless/computeheadless.cpp"
//#endif
// USER INTERFACE
#ifdef MVK_textoverlay
# include "../examples/textoverlay/textoverlay.cpp"
#endif
#ifdef MVK_distancefieldfonts
# include "../examples/distancefieldfonts/distancefieldfonts.cpp"
#endif
#ifdef MVK_imgui
# include "../examples/imgui/main.cpp"
#endif
// EXTENSIONS
// Does not run. Requires VK_EXT_conservative_rasterization.
#ifdef MVK_conservativeraster
# include "../examples/conservativeraster/conservativeraster.cpp"
#endif
#ifdef MVK_pushdescriptors
# include "../examples/pushdescriptors/pushdescriptors.cpp"
#endif
#ifdef MVK_inlineuniformblocks
# include "../examples/inlineuniformblocks/inlineuniformblocks.cpp"
#endif
// Not supported on iOS Simulator which does not support rendering to array (layered) attachments.
#ifdef MVK_multiview
# include "../examples/multiview/multiview.cpp"
#endif
// Does not run. Requires VK_EXT_conditional_rendering.
#ifdef MVK_conditionalrender
# include "../examples/conditionalrender/conditionalrender.cpp"
#endif
// Runs on MoltenVK 1.2.5 or later with VK_KHR_shader_non_semantic_info extension and VK_LAYER_KHRONOS_validation enabled.
// No VK_LAYER_KHRONOS_validation layer when using MoltenVK examples project, builds/runs fine using vulkanExamples project.
//#ifdef MVK_debugprintf
//# include "../examples/debugprintf/debugprintf.cpp"
//#endif
#ifdef MVK_debugutils
# include "../examples/debugutils/debugutils.cpp"
#endif
#ifdef MVK_negativeviewportheight
# include "../examples/negativeviewportheight/negativeviewportheight.cpp"
#endif
// Does not run. Requires VK_KHR_fragment_shading_rate.
#ifdef MVK_variablerateshading
# include "../examples/variablerateshading/variablerateshading.cpp"
#endif
// Runs on macOS 11.0 or later with Metal argument buffers enabled.
// Supported on iOS (not Simulator) as of MoltenVK version 1.2.10 / Vulkan SDK 1.3.290
#ifdef MVK_descriptorindexing
# include "../examples/descriptorindexing/descriptorindexing.cpp"
#endif
#ifdef MVK_dynamicrendering
# include "../examples/dynamicrendering/dynamicrendering.cpp"
#endif
#ifdef MVK_dynamicrenderinglocalread
# include "../examples/dynamicrenderinglocalread/dynamicrenderinglocalread.cpp"
#endif
#ifdef MVK_dynamicrenderingmultisampling
# include "../examples/dynamicrenderingmultisampling/dynamicrenderingmultisampling.cpp"
#endif
// Does not run. Requires VK_KHR_pipeline_library and VK_EXT_graphics_pipeline_library.
#ifdef MVK_graphicspipelinelibrary
# include "../examples/graphicspipelinelibrary/graphicspipelinelibrary.cpp"
#endif
// Does not run. Requires VK_EXT_mesh_shader.
#ifdef MVK_meshshader
# include "../examples/meshshader/meshshader.cpp"
#endif
// Does not run. Requires VK_EXT_descriptor_heap.
#ifdef MVK_descriptorheap
# include "../examples/descriptorheap/descriptorheap.cpp"
#endif
// Does not run. Requires VK_EXT_descriptor_buffer.
#ifdef MVK_descriptorbuffer
# include "../examples/descriptorbuffer/descriptorbuffer.cpp"
#endif
// Does not run. Requires VK_EXT_shader_object and VK_EXT_vertex_input_dynamic_state.
#ifdef MVK_shaderobjects
# include "../examples/shaderobjects/shaderobjects.cpp"
#endif
#ifdef MVK_hostimagecopy
# include "../examples/hostimagecopy/hostimagecopy.cpp"
#endif
// Not supported on iOS Simulator.
#ifdef MVK_bufferdeviceaddress
# include "../examples/bufferdeviceaddress/bufferdeviceaddress.cpp"
#endif
#ifdef MVK_timelinesemaphore
# include "../examples/timelinesemaphore/timelinesemaphore.cpp"
#endif
// Not supported on iOS Simulator.
#ifdef MVK_fragmentshaderbarycentrics
# include "../examples/fragmentshaderbarycentrics/fragmentshaderbarycentrics.cpp"
#endif
// Runs, but most VK_EXT_extended_dynamic_state3 features not supported on MoltenVK.
#ifdef MVK_dynamicstate
# include "../examples/dynamicstate/dynamicstate.cpp"
#endif
// EFFECTS
#ifdef MVK_radialblur
# include "../examples/radialblur/radialblur.cpp"
#endif
#ifdef MVK_bloom
# include "../examples/bloom/bloom.cpp"
#endif
#ifdef MVK_parallaxmapping
# include "../examples/parallaxmapping/parallaxmapping.cpp"
#endif
#ifdef MVK_sphericalenvmapping
# include "../examples/sphericalenvmapping/sphericalenvmapping.cpp"
#endif
// MISC
// Not supported on iOS Simulator which does not support indexed drawing with a non-zero base instance.
#ifdef MVK_gears
# include "../examples/gears/gears.cpp"
#endif
#ifdef MVK_vulkanscene
# include "../examples/vulkanscene/vulkanscene.cpp"
#endif