2017-04-14 12:00:05 -04:00
|
|
|
/*
|
2017-06-22 14:53:49 -04:00
|
|
|
* examples.h
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2016-2017 The Brenwill Workshop Ltd.
|
|
|
|
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
|
|
|
|
*
|
2017-04-14 12:00:05 -04:00
|
|
|
*
|
|
|
|
|
* 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 Preprocessor Macros (aka GCC_PREPROCESSOR_DEFINITIONS) compiler setting.
|
|
|
|
|
*
|
|
|
|
|
* To add a compiler setting, select the project in the Xcode Project Navigator panel,
|
|
|
|
|
* select the Build Settings panel, and add the value to the Preprocessor Macros
|
|
|
|
|
* (aka GCC_PREPROCESSOR_DEFINITIONS) entry.
|
|
|
|
|
*
|
|
|
|
|
* For example, to run the pipelines example, you would add the MVK_pipelines define macro
|
|
|
|
|
* to the Preprocessor Macros (aka GCC_PREPROCESSOR_DEFINITIONS) entry of the Xcode project,
|
2017-06-05 16:26:29 -04:00
|
|
|
* overwriting any otheor value there.
|
2017-04-14 12:00:05 -04:00
|
|
|
*
|
|
|
|
|
* If you choose to add a #define statement to this file, be sure to clear the existing macro
|
|
|
|
|
* from the Preprocessor Macros (aka GCC_PREPROCESSOR_DEFINITIONS) compiler setting in Xcode.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// In the list below, the comments indicate entries that,
|
|
|
|
|
// under certain conditions, that may not run as expected.
|
2017-04-14 12:00:05 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// BASICS
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_pipelines
|
|
|
|
|
# include "../pipelines/pipelines.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_texture
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../texture/texture.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Does not run. Metal does not support passing matrices between shader stages.
|
|
|
|
|
#ifdef MVK_texturecubemap
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../texturecubemap/texturecubemap.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Runs in Release mode. Does not run in Debug mode, as Metal validation will
|
|
|
|
|
// assert that UBO buffer length is too short for UBO size declared in shader.
|
|
|
|
|
#ifdef MVK_texturearray
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../texturearray/texturearray.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_mesh
|
|
|
|
|
# include "../mesh/mesh.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_dynamicuniformbuffer
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../dynamicuniformbuffer/dynamicuniformbuffer.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Does not run. Metal does not support passing arrays between shader stages.
|
|
|
|
|
#ifdef MVK_pushconstants
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../pushconstants/pushconstants.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_specializationconstants
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../specializationconstants/specializationconstants.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_offscreen
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../offscreen/offscreen.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-05 16:26:29 -04:00
|
|
|
#ifdef MVK_radialblur
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../radialblur/radialblur.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-05 16:26:29 -04:00
|
|
|
#ifdef MVK_textoverlay
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../textoverlay/textoverlay.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-05 16:26:29 -04:00
|
|
|
#ifdef MVK_particlefire
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../particlefire/particlefire.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ADVANCED
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_multithreading
|
|
|
|
|
# include "../multithreading/multithreading.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_scenerendering
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../scenerendering/scenerendering.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-05 16:26:29 -04:00
|
|
|
#ifdef MVK_instancing
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../instancing/instancing.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_indirectdraw
|
|
|
|
|
# include "../indirectdraw/indirectdraw.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Does not run. Metal does not support passing matrices between shader stages.
|
|
|
|
|
#ifdef MVK_hdr
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../hdr/hdr.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_occlusionquery
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../occlusionquery/occlusionquery.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Does not run. Sampler arrays require Metal 2.
|
|
|
|
|
#ifdef MVK_texturemipmapgen
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../texturemipmapgen/texturemipmapgen.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_multisampling
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../multisampling/multisampling.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_shadowmapping
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../shadowmapping/shadowmapping.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_shadowmappingomni
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../shadowmappingomni/shadowmappingomni.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_skeletalanimation
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../skeletalanimation/skeletalanimation.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_bloom
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../bloom/bloom.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Runs in Release mode. Debug mode Metal validation will assert
|
|
|
|
|
// UBO buffer length is too short for UBO size declared in shader.
|
|
|
|
|
#ifdef MVK_deferred
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../deferred/deferred.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Does not run. Metal does not support geometry shaders.
|
|
|
|
|
#ifdef MVK_deferredshadows
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../deferredshadows/deferredshadows.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
// Runs in Release mode, but does not display content.
|
|
|
|
|
// Metal does not support the use of specialization constants to set array lengths,
|
|
|
|
|
#ifdef MVK_ssao
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../ssao/ssao.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// COMPUTE - Currently unsupported by MoltenVK
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TESSELLATION - Currently unsupported by MoltenVK
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GEOMETRY SHADER - Unsupported by Metal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EXTENSIONS - Currently unsupported by MoltenVK
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MISC
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_parallaxmapping
|
|
|
|
|
# include "../parallaxmapping/parallaxmapping.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_sphericalenvmapping
|
|
|
|
|
# include "../sphericalenvmapping/sphericalenvmapping.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_gears
|
|
|
|
|
# include "../gears/gears.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-06-22 14:53:49 -04:00
|
|
|
#ifdef MVK_distancefieldfonts
|
2017-04-14 12:00:05 -04:00
|
|
|
# include "../distancefieldfonts/distancefieldfonts.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef MVK_vulkanscene
|
|
|
|
|
# include "../vulkanscene/vulkanscene.cpp"
|
|
|
|
|
#endif
|
|
|
|
|
|