├── .appveyor.yml ├── .clang-format ├── .gitattributes ├── .gitignore ├── .gitmodules ├── .travis.yml ├── API-Samples ├── 01-init_instance │ └── 01-init_instance.cpp ├── 02-enumerate_devices │ └── 02-enumerate_devices.cpp ├── 03-init_device │ └── 03-init_device.cpp ├── 04-init_command_buffer │ └── 04-init_command_buffer.cpp ├── 05-init_swapchain │ └── 05-init_swapchain.cpp ├── 06-init_depth_buffer │ └── 06-init_depth_buffer.cpp ├── 07-init_uniform_buffer │ └── 07-init_uniform_buffer.cpp ├── 08-init_pipeline_layout │ └── 08-init_pipeline_layout.cpp ├── 09-init_descriptor_set │ └── 09-init_descriptor_set.cpp ├── 10-init_render_pass │ └── 10-init_render_pass.cpp ├── 11-init_shaders │ ├── 11-init_shaders.cpp │ ├── 11-init_shaders.frag │ └── 11-init_shaders.vert ├── 12-init_frame_buffers │ └── 12-init_frame_buffers.cpp ├── 13-init_vertex_buffer │ └── 13-init_vertex_buffer.cpp ├── 14-init_pipeline │ ├── 14-init_pipeline.cpp │ ├── 14-init_pipeline.frag │ └── 14-init_pipeline.vert ├── 15-draw_cube │ ├── 15-draw_cube.cpp │ ├── 15-draw_cube.frag │ └── 15-draw_cube.vert ├── 16-vulkan_1_1 │ └── 16-vulkan_1_1.cpp ├── CMakeLists.txt ├── README-cmake.md ├── README-codegen.md ├── README.md ├── Tutorial │ ├── .gitignore │ ├── .markdownlint.json │ ├── .vscode │ │ ├── settings.json │ │ └── spell.json │ ├── README.md │ ├── build.bat │ ├── build.sh │ ├── css │ │ └── lg_stylesheet.css │ ├── images │ │ ├── BasicAppLoader.png │ │ ├── BasicAppLoader.xml │ │ ├── CommandBufferInsert.png │ │ ├── CommandBufferInsert.xml │ │ ├── DepthBufferBindView.png │ │ ├── DepthBufferBindView.xml │ │ ├── Device1QueueFamilies.png │ │ ├── Device1QueueFamilies.xml │ │ ├── Device2QueueFamilies.png │ │ ├── Device2QueueFamilies.xml │ │ ├── FrameBuffers.png │ │ ├── FrameBuffers.xml │ │ ├── GraphicsPipeline.png │ │ ├── GraphicsPipeline.xml │ │ ├── ImageMemoryLayout.png │ │ ├── ImageMemoryLayout.xml │ │ ├── PhysicalDeviceQueueFamilyProperties.png │ │ ├── PhysicalDeviceQueueFamilyProperties.xml │ │ ├── PhysicalDevices.png │ │ ├── PhysicalDevices.xml │ │ ├── RenderPassLayouts.png │ │ ├── RenderPassLayouts.xml │ │ ├── Swapchain.png │ │ ├── Swapchain.xml │ │ ├── bg-starfield.jpg │ │ ├── drawcube.png │ │ └── vulkanlogo.png │ ├── markdown │ │ ├── 00-intro.md │ │ ├── 01-init_instance.md │ │ ├── 02-enumerate_devices.md │ │ ├── 03-init_device.md │ │ ├── 04-init_command_buffer.md │ │ ├── 05-init_swapchain.md │ │ ├── 06-init_depth_buffer.md │ │ ├── 07-init_uniform_buffer.md │ │ ├── 08-init_pipeline_layout.md │ │ ├── 09-init_descriptor_set.md │ │ ├── 10-init_render_pass.md │ │ ├── 11-init_shaders.md │ │ ├── 12-init_frame_buffers.md │ │ ├── 13-init_vertex_buffer.md │ │ ├── 14-init_pipeline.md │ │ ├── 15-draw_cube.md │ │ ├── 16-vulkan_1_1_changes.md │ │ └── index.md │ └── tools │ │ └── Markdown.pl ├── android │ ├── CMakeLists.txt │ ├── build.gradle │ ├── compile_shaders.py │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── project_template │ │ ├── README.md │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ └── res │ │ │ └── values │ │ │ └── strings.xml │ ├── settings.gradle.in │ └── vulkan_wrapper │ │ ├── vulkan_wrapper.cpp │ │ └── vulkan_wrapper.h ├── copy_blit_image │ └── copy_blit_image.cpp ├── create_debug_report_callback │ └── create_debug_report_callback.cpp ├── data │ ├── blue.ppm │ ├── cube_data.h │ ├── green.ppm │ ├── logo-256x256-solid.png │ ├── logo-256x256.png │ ├── lunarg.ppm │ ├── red.ppm │ ├── spotlight.ppm │ └── yellow.ppm ├── draw_subpasses │ ├── draw_subpasses.cpp │ ├── draw_subpasses.frag │ ├── draw_subpasses.full.vert │ └── draw_subpasses.vert ├── draw_textured_cube │ ├── draw_textured_cube.cpp │ ├── draw_textured_cube.frag │ └── draw_textured_cube.vert ├── dynamic_uniform │ ├── dynamic_uniform.cpp │ ├── dynamic_uniform.frag │ └── dynamic_uniform.vert ├── enable_validation_with_callback │ └── enable_validation_with_callback.cpp ├── enumerate_devices_adv │ └── enumerate_devices_adv.cpp ├── events │ └── events.cpp ├── get-descripts.sh ├── get-short-descripts.sh ├── immutable_sampler │ ├── immutable_sampler.cpp │ ├── immutable_sampler.frag │ └── immutable_sampler.vert ├── init_texture │ └── init_texture.cpp ├── input_attachment │ ├── input_attachment.cpp │ ├── input_attachment.frag │ └── input_attachment.vert ├── instance_extension_properties │ └── instance_extension_properties.cpp ├── instance_layer_extension_properties │ └── instance_layer_extension_properties.cpp ├── instance_layer_properties │ └── instance_layer_properties.cpp ├── memory_barriers │ ├── memory_barriers.cpp │ ├── memory_barriers.frag │ └── memory_barriers.vert ├── multiple_sets │ ├── multiple_sets.cpp │ ├── multiple_sets.frag │ └── multiple_sets.vert ├── multithreaded_command_buffers │ ├── multithreaded_command_buffers.cpp │ ├── multithreaded_command_buffers.frag │ └── multithreaded_command_buffers.vert ├── occlusion_query │ ├── occlusion_query.cpp │ ├── occlusion_query.frag │ └── occlusion_query.vert ├── pipeline_cache │ ├── pipeline_cache.cpp │ ├── pipeline_cache.frag │ └── pipeline_cache.vert ├── pipeline_derivative │ ├── pipeline_derivative.cpp │ ├── pipeline_derivative.frag │ ├── pipeline_derivative.vert │ └── pipeline_derivative2.frag ├── push_constants │ ├── push_constants.cpp │ ├── push_constants.frag │ └── push_constants.vert ├── push_descriptors │ ├── push_descriptors.cpp │ ├── push_descriptors.frag │ └── push_descriptors.vert ├── run_all_samples.py ├── run_all_samples.sh ├── secondary_command_buffer │ ├── secondary_command_buffer.cpp │ ├── secondary_command_buffer.frag │ └── secondary_command_buffer.vert ├── separate_image_sampler │ ├── separate_image_sampler.cpp │ ├── separate_image_sampler.frag │ └── separate_image_sampler.vert ├── spirv_assembly │ ├── spirv_assembly.cpp │ ├── spirv_assembly.frag │ └── spirv_assembly.vert ├── spirv_specialization │ ├── specialized.frag │ ├── spirv_specialization.cpp │ ├── spirv_specialization.frag │ └── spirv_specialization.vert ├── template │ ├── template.cpp │ ├── template.frag │ └── template.vert ├── texel_buffer │ ├── texel_buffer.cpp │ ├── texel_buffer.frag │ └── texel_buffer.vert ├── utils │ ├── CMakeLists.txt │ ├── README.md │ ├── glm │ │ ├── common.hpp │ │ ├── detail │ │ │ ├── _features.hpp │ │ │ ├── _fixes.hpp │ │ │ ├── _literals.hpp │ │ │ ├── _noise.hpp │ │ │ ├── _swizzle.hpp │ │ │ ├── _swizzle_func.hpp │ │ │ ├── _vectorize.hpp │ │ │ ├── dummy.cpp │ │ │ ├── func_common.hpp │ │ │ ├── func_common.inl │ │ │ ├── func_exponential.hpp │ │ │ ├── func_exponential.inl │ │ │ ├── func_geometric.hpp │ │ │ ├── func_geometric.inl │ │ │ ├── func_integer.hpp │ │ │ ├── func_integer.inl │ │ │ ├── func_matrix.hpp │ │ │ ├── func_matrix.inl │ │ │ ├── func_noise.hpp │ │ │ ├── func_noise.inl │ │ │ ├── func_packing.hpp │ │ │ ├── func_packing.inl │ │ │ ├── func_trigonometric.hpp │ │ │ ├── func_trigonometric.inl │ │ │ ├── func_vector_relational.hpp │ │ │ ├── func_vector_relational.inl │ │ │ ├── glm.cpp │ │ │ ├── hint.hpp │ │ │ ├── intrinsic_common.hpp │ │ │ ├── intrinsic_common.inl │ │ │ ├── intrinsic_exponential.hpp │ │ │ ├── intrinsic_exponential.inl │ │ │ ├── intrinsic_geometric.hpp │ │ │ ├── intrinsic_geometric.inl │ │ │ ├── intrinsic_integer.hpp │ │ │ ├── intrinsic_integer.inl │ │ │ ├── intrinsic_matrix.hpp │ │ │ ├── intrinsic_matrix.inl │ │ │ ├── intrinsic_trigonometric.hpp │ │ │ ├── intrinsic_trigonometric.inl │ │ │ ├── intrinsic_vector_relational.hpp │ │ │ ├── intrinsic_vector_relational.inl │ │ │ ├── precision.hpp │ │ │ ├── precision.inl │ │ │ ├── setup.hpp │ │ │ ├── type_float.hpp │ │ │ ├── type_gentype.hpp │ │ │ ├── type_gentype.inl │ │ │ ├── type_half.hpp │ │ │ ├── type_half.inl │ │ │ ├── type_int.hpp │ │ │ ├── type_mat.hpp │ │ │ ├── type_mat.inl │ │ │ ├── type_mat2x2.hpp │ │ │ ├── type_mat2x2.inl │ │ │ ├── type_mat2x3.hpp │ │ │ ├── type_mat2x3.inl │ │ │ ├── type_mat2x4.hpp │ │ │ ├── type_mat2x4.inl │ │ │ ├── type_mat3x2.hpp │ │ │ ├── type_mat3x2.inl │ │ │ ├── type_mat3x3.hpp │ │ │ ├── type_mat3x3.inl │ │ │ ├── type_mat3x4.hpp │ │ │ ├── type_mat3x4.inl │ │ │ ├── type_mat4x2.hpp │ │ │ ├── type_mat4x2.inl │ │ │ ├── type_mat4x3.hpp │ │ │ ├── type_mat4x3.inl │ │ │ ├── type_mat4x4.hpp │ │ │ ├── type_mat4x4.inl │ │ │ ├── type_vec.hpp │ │ │ ├── type_vec.inl │ │ │ ├── type_vec1.hpp │ │ │ ├── type_vec1.inl │ │ │ ├── type_vec2.hpp │ │ │ ├── type_vec2.inl │ │ │ ├── type_vec3.hpp │ │ │ ├── type_vec3.inl │ │ │ ├── type_vec4.hpp │ │ │ └── type_vec4.inl │ │ ├── exponential.hpp │ │ ├── ext.hpp │ │ ├── fwd.hpp │ │ ├── geometric.hpp │ │ ├── glm.hpp │ │ ├── gtc │ │ │ ├── constants.hpp │ │ │ ├── constants.inl │ │ │ ├── epsilon.hpp │ │ │ ├── epsilon.inl │ │ │ ├── matrix_access.hpp │ │ │ ├── matrix_access.inl │ │ │ ├── matrix_integer.hpp │ │ │ ├── matrix_inverse.hpp │ │ │ ├── matrix_inverse.inl │ │ │ ├── matrix_transform.hpp │ │ │ ├── matrix_transform.inl │ │ │ ├── noise.hpp │ │ │ ├── noise.inl │ │ │ ├── packing.hpp │ │ │ ├── packing.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── random.hpp │ │ │ ├── random.inl │ │ │ ├── reciprocal.hpp │ │ │ ├── reciprocal.inl │ │ │ ├── type_precision.hpp │ │ │ ├── type_precision.inl │ │ │ ├── type_ptr.hpp │ │ │ ├── type_ptr.inl │ │ │ ├── ulp.hpp │ │ │ └── ulp.inl │ │ ├── gtx │ │ │ ├── associated_min_max.hpp │ │ │ ├── associated_min_max.inl │ │ │ ├── bit.hpp │ │ │ ├── bit.inl │ │ │ ├── closest_point.hpp │ │ │ ├── closest_point.inl │ │ │ ├── color_space.hpp │ │ │ ├── color_space.inl │ │ │ ├── color_space_YCoCg.hpp │ │ │ ├── color_space_YCoCg.inl │ │ │ ├── compatibility.hpp │ │ │ ├── compatibility.inl │ │ │ ├── component_wise.hpp │ │ │ ├── component_wise.inl │ │ │ ├── constants.hpp │ │ │ ├── dual_quaternion.hpp │ │ │ ├── dual_quaternion.inl │ │ │ ├── epsilon.hpp │ │ │ ├── euler_angles.hpp │ │ │ ├── euler_angles.inl │ │ │ ├── extend.hpp │ │ │ ├── extend.inl │ │ │ ├── extented_min_max.hpp │ │ │ ├── extented_min_max.inl │ │ │ ├── fast_exponential.hpp │ │ │ ├── fast_exponential.inl │ │ │ ├── fast_square_root.hpp │ │ │ ├── fast_square_root.inl │ │ │ ├── fast_trigonometry.hpp │ │ │ ├── fast_trigonometry.inl │ │ │ ├── gradient_paint.hpp │ │ │ ├── gradient_paint.inl │ │ │ ├── handed_coordinate_space.hpp │ │ │ ├── handed_coordinate_space.inl │ │ │ ├── inertia.hpp │ │ │ ├── inertia.inl │ │ │ ├── int_10_10_10_2.hpp │ │ │ ├── int_10_10_10_2.inl │ │ │ ├── integer.hpp │ │ │ ├── integer.inl │ │ │ ├── intersect.hpp │ │ │ ├── intersect.inl │ │ │ ├── io.hpp │ │ │ ├── io.inl │ │ │ ├── log_base.hpp │ │ │ ├── log_base.inl │ │ │ ├── matrix_cross_product.hpp │ │ │ ├── matrix_cross_product.inl │ │ │ ├── matrix_interpolation.hpp │ │ │ ├── matrix_interpolation.inl │ │ │ ├── matrix_major_storage.hpp │ │ │ ├── matrix_major_storage.inl │ │ │ ├── matrix_operation.hpp │ │ │ ├── matrix_operation.inl │ │ │ ├── matrix_query.hpp │ │ │ ├── matrix_query.inl │ │ │ ├── matrix_transform_2d.hpp │ │ │ ├── matrix_transform_2d.inl │ │ │ ├── mixed_product.hpp │ │ │ ├── mixed_product.inl │ │ │ ├── multiple.hpp │ │ │ ├── multiple.inl │ │ │ ├── noise.hpp │ │ │ ├── norm.hpp │ │ │ ├── norm.inl │ │ │ ├── normal.hpp │ │ │ ├── normal.inl │ │ │ ├── normalize_dot.hpp │ │ │ ├── normalize_dot.inl │ │ │ ├── number_precision.hpp │ │ │ ├── number_precision.inl │ │ │ ├── optimum_pow.hpp │ │ │ ├── optimum_pow.inl │ │ │ ├── orthonormalize.hpp │ │ │ ├── orthonormalize.inl │ │ │ ├── perpendicular.hpp │ │ │ ├── perpendicular.inl │ │ │ ├── polar_coordinates.hpp │ │ │ ├── polar_coordinates.inl │ │ │ ├── projection.hpp │ │ │ ├── projection.inl │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl │ │ │ ├── random.hpp │ │ │ ├── raw_data.hpp │ │ │ ├── raw_data.inl │ │ │ ├── reciprocal.hpp │ │ │ ├── rotate_normalized_axis.hpp │ │ │ ├── rotate_normalized_axis.inl │ │ │ ├── rotate_vector.hpp │ │ │ ├── rotate_vector.inl │ │ │ ├── scalar_relational.hpp │ │ │ ├── scalar_relational.inl │ │ │ ├── simd_mat4.hpp │ │ │ ├── simd_mat4.inl │ │ │ ├── simd_quat.hpp │ │ │ ├── simd_quat.inl │ │ │ ├── simd_vec4.hpp │ │ │ ├── simd_vec4.inl │ │ │ ├── spline.hpp │ │ │ ├── spline.inl │ │ │ ├── std_based_type.hpp │ │ │ ├── std_based_type.inl │ │ │ ├── string_cast.hpp │ │ │ ├── string_cast.inl │ │ │ ├── transform.hpp │ │ │ ├── transform.inl │ │ │ ├── transform2.hpp │ │ │ ├── transform2.inl │ │ │ ├── ulp.hpp │ │ │ ├── unsigned_int.hpp │ │ │ ├── unsigned_int.inl │ │ │ ├── vec1.hpp │ │ │ ├── vec1.inl │ │ │ ├── vector_angle.hpp │ │ │ ├── vector_angle.inl │ │ │ ├── vector_query.hpp │ │ │ ├── vector_query.inl │ │ │ ├── wrap.hpp │ │ │ └── wrap.inl │ │ ├── integer.hpp │ │ ├── mat2x2.hpp │ │ ├── mat2x3.hpp │ │ ├── mat2x4.hpp │ │ ├── mat3x2.hpp │ │ ├── mat3x3.hpp │ │ ├── mat3x4.hpp │ │ ├── mat4x2.hpp │ │ ├── mat4x3.hpp │ │ ├── mat4x4.hpp │ │ ├── matrix.hpp │ │ ├── packing.hpp │ │ ├── trigonometric.hpp │ │ ├── vec2.hpp │ │ ├── vec3.hpp │ │ ├── vec4.hpp │ │ ├── vector_relational.hpp │ │ └── virtrev │ │ │ └── xstream.hpp │ ├── samples_platform.h │ ├── util.cpp │ ├── util.hpp │ ├── util_init.cpp │ └── util_init.hpp ├── validation_cache │ ├── validation_cache.cpp │ ├── validation_cache.frag │ └── validation_cache.vert └── vulkan_1_1_flexible │ └── vulkan_1_1_flexible.cpp ├── BUILD.md ├── CMakeLists-SDK.txt ├── CMakeLists.txt ├── LICENSE.txt ├── README-contrib.md ├── README.md ├── Sample-Programs └── Hologram │ ├── CMakeLists.txt │ ├── Game.h │ ├── Helpers.h │ ├── Hologram.cpp │ ├── Hologram.frag │ ├── Hologram.h │ ├── Hologram.push_constant.vert │ ├── Hologram.vert │ ├── Main.cpp │ ├── Meshes.cpp │ ├── Meshes.h │ ├── Meshes.teapot.h │ ├── README.md │ ├── Shell.cpp │ ├── Shell.h │ ├── ShellAndroid.cpp │ ├── ShellAndroid.h │ ├── ShellWayland.cpp │ ├── ShellWayland.h │ ├── ShellWin32.cpp │ ├── ShellWin32.h │ ├── ShellXcb.cpp │ ├── ShellXcb.h │ ├── Simulation.cpp │ ├── Simulation.h │ ├── android │ ├── CMakeLists.txt │ ├── build-and-install │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── jni │ │ ├── HelpersDispatchTable.cpp │ │ ├── HelpersDispatchTable.h │ │ ├── Hologram.frag.h │ │ ├── Hologram.push_constant.vert.h │ │ └── Hologram.vert.h │ │ └── res │ │ └── values │ │ └── strings.xml │ └── generate-dispatch-table ├── Vulkan_LogoBug_48px_Nov17.png ├── build_windows_samples_sdk.bat ├── cmake ├── Copyright_cmake.txt ├── FindImageMagick.cmake ├── FindPCIAccess.cmake ├── FindPthreadStubs.cmake ├── FindUDev.cmake ├── FindValgrind.cmake ├── FindVulkan.cmake ├── FindWayland.cmake ├── FindX11_XCB.cmake ├── FindXCB.cmake ├── README.txt └── cmake_uninstall.cmake.in ├── external ├── x64 │ └── lib │ │ └── vulkan-1.lib └── x86 │ └── lib │ └── vulkan-1.lib ├── external_revisions ├── glslang_giturl └── glslang_revision ├── samples_images ├── CopyBlitImage.png ├── Hologram.png ├── Overlay.png ├── cube.png ├── drawcube.png ├── drawsubpasses.png ├── drawtexturedcube.png ├── dynamicuniform.png ├── immutable_sampler.png ├── inputattachment.png ├── memory_barriers.png ├── multiplesets.png ├── multithreadedcmdbuf.png ├── occlusionquery.png ├── pipeline_cache.png ├── push_constants.png ├── secondarycmd.png ├── separate_image_sampler.png ├── sorttable.js ├── spirv_assembly.png ├── spirv_specialization.png ├── template.png └── texelbuffer.png ├── samples_index.html ├── scripts ├── check_code_format.sh ├── determine_vs_version.py ├── fetch_glslangvalidator.py ├── fetch_spirv_tools.py ├── generate_spirv.py ├── known_good.json └── update_deps.py ├── update_external_sources.bat └── update_external_sources.sh /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # Windows Build Configuration for AppVeyor 2 | # http://www.appveyor.com/docs/appveyor-yml 3 | # 4 | 5 | # This version starts a separte job for each platform config 6 | # in order to get around the AppVeyor limit of 60 mins per job. 7 | 8 | # build version format 9 | version: "{build}" 10 | 11 | # Free accounts have a max of 1, but ask anyway. 12 | max_jobs: 4 13 | 14 | os: 15 | - Visual Studio 2015 16 | 17 | environment: 18 | PYTHON_PATH: "C:/Python35" 19 | PYTHON_PACKAGE_PATH: "C:/Python35/Scripts" 20 | CMAKE_URL: "http://cmake.org/files/v3.10/cmake-3.10.2-win64-x64.zip" 21 | 22 | branches: 23 | only: 24 | - master 25 | 26 | install: 27 | - appveyor DownloadFile %CMAKE_URL% -FileName cmake.zip 28 | - 7z x cmake.zip -oC:\cmake > nul 29 | - set path=C:\cmake\bin;%path% 30 | - cmake --version 31 | 32 | before_build: 33 | - "SET PATH=C:\\Python35;C:\\Python35\\Scripts;%PATH%" 34 | - echo Starting build for %APPVEYOR_REPO_NAME% 35 | # Install dependencies 36 | - python scripts/update_deps.py --dir=external --arch=%PLATFORM% --config=%CONFIGURATION% 37 | - echo Generating CMake files for %PLATFORM% 38 | - mkdir build 39 | - cd build 40 | - cmake -A %PLATFORM% -C../external/helper.cmake --config %CONFIGURATION% .. 41 | - echo Building platform=%PLATFORM% configuration=%CONFIGURATION% 42 | 43 | platform: 44 | - Win32 45 | - x64 46 | 47 | configuration: 48 | - Release 49 | - Debug 50 | 51 | # Build only x64 Release and Win32(x86) Debug to reduce build time. 52 | # This should still provide adequate 32-bit vs 64-bit and 53 | # Release vs Debug coverage. 54 | matrix: 55 | exclude: 56 | - configuration: Release 57 | platform: Win32 58 | - configuration: Debug 59 | platform: x64 60 | 61 | build: 62 | parallel: true # enable MSBuild parallel builds 63 | project: build/VULKAN_SAMPLES.sln # path to Visual Studio solution or project 64 | verbosity: quiet # quiet|minimal|normal|detailed 65 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | # Use defaults from the Google style with the following exceptions: 3 | BasedOnStyle: Google 4 | IndentWidth: 4 5 | ColumnLimit: 132 6 | SortIncludes: false 7 | ... 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes 2 | # See https://help.github.com/articles/dealing-with-line-endings/ 3 | 4 | # default behavior, if core.autocrlf is unset. 5 | * text=auto 6 | 7 | # files to be converted to native line endings on checkout. 8 | *.cpp text 9 | *.h text 10 | 11 | # files to always have CRLF line endings on checkout. 12 | *.bat text eol=crlf 13 | 14 | # files to always have CR line endings on checkout. 15 | *.sh text eol=cr 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeCache.txt 2 | CMakeLists.txt.user 3 | CMakeFiles/ 4 | cmake_install.cmake 5 | Makefile 6 | scripts/__pycache__ 7 | VKConfig.h 8 | *.so 9 | *.so.* 10 | _out64 11 | out32/* 12 | out64/* 13 | demos/Debug/* 14 | demos/Win32/Debug/* 15 | demos/xcb_nvidia.dir/* 16 | demos/smoke/HelpersDispatchTable.cpp 17 | demos/smoke/HelpersDispatchTable.h 18 | libs/Win32/Debug/* 19 | *.pyc 20 | *.vcproj 21 | *.sln 22 | *.suo 23 | *.vcxproj 24 | *.sdf 25 | *.filters 26 | build 27 | build32 28 | dbuild 29 | external 30 | build-android/external 31 | *.config 32 | *.creator 33 | *.creator.user 34 | *.files 35 | *.includes 36 | *.autosave 37 | .DS_Store 38 | .idea 39 | .gradle 40 | .externalNativeBuild 41 | *.iml 42 | .vscode/ 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/.gitmodules -------------------------------------------------------------------------------- /API-Samples/02-enumerate_devices/02-enumerate_devices.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Vulkan Samples 3 | * 4 | * Copyright (C) 2015-2016 Valve Corporation 5 | * Copyright (C) 2015-2016 LunarG, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | /* 21 | VULKAN_SAMPLE_SHORT_DESCRIPTION 22 | enumerate physical devices 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | int sample_main(int argc, char *argv[]) { 30 | struct sample_info info = {}; 31 | init_global_layer_properties(info); 32 | init_instance(info, "vulkansamples_enumerate"); 33 | 34 | /* VULKAN_KEY_START */ 35 | 36 | uint32_t gpu_count = 1; 37 | VkResult U_ASSERT_ONLY res = vkEnumeratePhysicalDevices(info.inst, &gpu_count, NULL); 38 | assert(gpu_count); 39 | info.gpus.resize(gpu_count); 40 | res = vkEnumeratePhysicalDevices(info.inst, &gpu_count, info.gpus.data()); 41 | assert(!res && gpu_count >= 1); 42 | 43 | /* VULKAN_KEY_END */ 44 | 45 | vkDestroyInstance(info.inst, NULL); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /API-Samples/11-init_shaders/11-init_shaders.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/11-init_shaders/11-init_shaders.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } -------------------------------------------------------------------------------- /API-Samples/14-init_pipeline/14-init_pipeline.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/14-init_pipeline/14-init_pipeline.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform bufferVals { 5 | mat4 mvp; 6 | } myBufferVals; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec4 inColor; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | outColor = inColor; 12 | gl_Position = myBufferVals.mvp * pos; 13 | } -------------------------------------------------------------------------------- /API-Samples/15-draw_cube/15-draw_cube.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/15-draw_cube/15-draw_cube.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform bufferVals { 5 | mat4 mvp; 6 | } myBufferVals; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec4 inColor; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | outColor = inColor; 12 | gl_Position = myBufferVals.mvp * pos; 13 | } -------------------------------------------------------------------------------- /API-Samples/README-codegen.md: -------------------------------------------------------------------------------- 1 | # Codegen 2 | Certain utility and set up code will be reused in multiple samples. Rather 3 | than duplicate this code in each sample, *future* plans include developing 4 | a codegen capability that will substitute this utility code into sample(s) 5 | at build time. More details will be provided as this develops. 6 | 7 | -------------------------------------------------------------------------------- /API-Samples/README.md: -------------------------------------------------------------------------------- 1 | # Code and Other Conventions for Vulkan Samples 2 | 3 | - The Vulkan version to which the sample is being written must be the prefix 4 | in the sample code file name. For example, vk0.10-SAMPLE.cpp. 5 | 6 | - A sample should highlight a specific Vulkan entry point or capability 7 | which must be identified in the name of the sample source file. For 8 | example, vk0.10-device-info.cpp. 9 | 10 | - Use the data/ (Vulkan-release-independent) and data/VERSION/ 11 | (Vulkan-release-dependent) directories for uniquely-named data, shaders, 12 | images, etc. used by your sample. VERSION must match the version prefix 13 | used in the sample file name. For example, a shader file for 14 | $VULKAN_SAMPLES/src/vk0.10-imageformat.cpp could be 15 | $VULKAN_SAMPLES/data/vk0.10/imgf-texture-2d.spv. 16 | 17 | - Each sample should include a comment of the following form used for auto- 18 | extraction of a short one-line description of the sample: 19 | 20 | ``` 21 | /* 22 | VULKAN_SAMPLE_SHORT_DESCRIPTION 23 | short description of sample 24 | */ 25 | ``` 26 | - Each sample may include a comment of the following form used for auto- 27 | extraction of a more detailed, multi-line description of the sample: 28 | 29 | ``` 30 | /* 31 | VULKAN_SAMPLE_DESCRIPTION_START 32 | short description of sample 33 | continued here 34 | and here 35 | VULKAN_SAMPLE_DESCRIPTION_END 36 | */ 37 | ``` 38 | 39 | - For easier navigation to the relevant section(s) of code in the source 40 | file, where applicable, the sections should be identified by the following 41 | comment header/footer: 42 | 43 | ``` 44 | /* VULKAN_KEY_START */ 45 | /* VULKAN_KEY_END */ 46 | ``` 47 | 48 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment13": "Line length", 3 | "MD013": false, 4 | "_comment32": "Lists should be surrounded by blank lines", 5 | "MD032": false, 6 | "_comment33": "Inline HTML", 7 | "MD033": false 8 | } -------------------------------------------------------------------------------- /API-Samples/Tutorial/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "markdown.styles": [ 4 | "css/lg_stylesheet.css" 5 | ] 6 | } -------------------------------------------------------------------------------- /API-Samples/Tutorial/.vscode/spell.json: -------------------------------------------------------------------------------- 1 | { 2 | "language": "en", 3 | "ignoreWordsList": [ 4 | "Vulkan", 5 | "css", 6 | "stylesheet", 7 | "LunarG", 8 | "cpp", 9 | "lg", 10 | "Swapchain", 11 | "commandbuffer", 12 | "swapchain", 13 | "depthbuffer", 14 | "uniformbuffer", 15 | "pipelinelayouts", 16 | "descriptorset", 17 | "renderpass", 18 | "Shaders", 19 | "shaders", 20 | "framebuffer", 21 | "vertexbuffer", 22 | "drawcube", 23 | "Khronos", 24 | "Direct3D", 25 | "initializes", 26 | "LunarXchange", 27 | "GitHub", 28 | "vulkan", 29 | "vkCreateInstance", 30 | "VulkanSamples", 31 | "VkInstanceCreateInfo", 32 | "gpus", 33 | "vkEnumeratePhysicalDevices", 34 | "QueueFamilyProperties", 35 | "blits", 36 | "VK", 37 | "allocators", 38 | "granularities", 39 | "vkBeginCommandBuffer", 40 | "vkCmd", 41 | "vkEndCommandBuffer", 42 | "KHR", 43 | "WAYLAND", 44 | "WIN32", 45 | "XCB", 46 | "XLIB", 47 | "Xlib", 48 | "SWAPCHAIN", 49 | "vkQueuePresentKHR", 50 | "vkGetPhysicalDeviceSurfaceSupportKHR", 51 | "B8G8R8A8", 52 | "UNORM", 53 | "VkSurfaceFormatKHR", 54 | "R8G8B8A8", 55 | "1D", 56 | "vkCreateWin32SurfaceKHR", 57 | "VkFormat", 58 | "allocationSize", 59 | "sizeof", 60 | "texel", 61 | "GLES", 62 | "unmap", 63 | "descriptorType", 64 | "N'th", 65 | "VkDescriptorBufferInfo", 66 | "perl", 67 | "markdown", 68 | "Markdown", 69 | "json", 70 | "subpasses", 71 | "subpass", 72 | "texels", 73 | "framebuffers", 74 | "vkCmdBeginRenderPass", 75 | "GLSL", 76 | "SPIR-V", 77 | "spv", 78 | "shaderStages", 79 | "Framebuffers", 80 | "attribs", 81 | "viewport", 82 | "multisampling", 83 | "viewports" 84 | ], 85 | "mistakeTypeToStatus": { 86 | "Spelling": "Error", 87 | "Passive Voice": "Information", 88 | "Complex Expression": "Disable", 89 | "Hyphen Required": "Warning" 90 | }, 91 | "languageIDs": [ 92 | "markdown", 93 | "text" 94 | ], 95 | "ignoreRegExp": [ 96 | "/\\\\(.*\\\\.(jpg|jpeg|png|md|gif|JPG|JPEG|PNG|MD|GIF)\\\\)/g", 97 | "/((http|https|ftp|git)\\\\S*)/g", 98 | "/^(\\\\s+[\\\\w\\\\W]+?\\\\n*)(\\\\s*)\\\\n*$/gm" 99 | ] 100 | } -------------------------------------------------------------------------------- /API-Samples/Tutorial/build.bat: -------------------------------------------------------------------------------- 1 | rmdir /Q /S out 2 | mkdir out 3 | mkdir out\html 4 | mkdir out\css 5 | mkdir out\images 6 | 7 | pushd markdown 8 | for /R "." %%f in (*.md) do ( 9 | perl ..\tools\Markdown.pl --html4tags %%~nf.md > ..\out\html\%%~nf.html 10 | ) 11 | popd 12 | copy /y css\lg_stylesheet.css out\css\lg_stylesheet.css 13 | copy /y images\*.png out\images 14 | copy /y images\bg-starfield.jpg out\images\bg-starfield.jpg 15 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | OUTDIR="${OUTDIR:-out}" 3 | mkdir -p "${OUTDIR}/html" 4 | mkdir -p "${OUTDIR}/css" 5 | mkdir -p "${OUTDIR}/images" 6 | 7 | for i in markdown/*.md; do 8 | file=${i##*/} 9 | base=${file%.*} 10 | perl tools/Markdown.pl --html4tags $i > "${OUTDIR}/html/${base}.html" 11 | done 12 | cp css/lg_stylesheet.css "${OUTDIR}/css" 13 | cp images/*.png "${OUTDIR}/images" 14 | cp images/bg-starfield.jpg "${OUTDIR}/images" 15 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/css/lg_stylesheet.css: -------------------------------------------------------------------------------- 1 | html { 2 | background: url('../images/bg-starfield.jpg'); 3 | background-attachment: fixed; 4 | background-size: cover; 5 | } 6 | 7 | body { 8 | font-family: Helvetica, Arial, sans-serif; 9 | font-size: 14px; 10 | line-height: 1.42857143; 11 | color: #e8e8e8; 12 | width: 700px; 13 | margin: auto; 14 | background-color: 3F3F3F; 15 | position: relative; 16 | padding: 0 30px; 17 | } 18 | 19 | pre { 20 | background-color: rgba(0,0,0,.5); 21 | font-size: 1em; 22 | display: block; 23 | padding: 9.5px; 24 | margin: 0 0 10px; 25 | font-size: 13px; 26 | line-height: 1.42857143; 27 | word-break: break-all; 28 | word-wrap: break-word; 29 | color: #2F2F2F; 30 | border: 1px solid #ccc; 31 | border-radius: 3px; 32 | font-family: Menlo,Monaco,Consolas,"Courier New",monospace; 33 | overflow: auto; 34 | } 35 | 36 | code { 37 | color: #D1D1D1; 38 | } 39 | 40 | a { 41 | color: #3bdae6; 42 | background-color:transparent; 43 | text-decoration: none; 44 | cursor: pointer; 45 | } 46 | 47 | .nav-bar { 48 | margin: none; 49 | padding: none; 50 | position: static; 51 | } 52 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/BasicAppLoader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/BasicAppLoader.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/CommandBufferInsert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/CommandBufferInsert.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/DepthBufferBindView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/DepthBufferBindView.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/DepthBufferBindView.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/Device1QueueFamilies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/Device1QueueFamilies.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/Device2QueueFamilies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/Device2QueueFamilies.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/FrameBuffers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/FrameBuffers.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/GraphicsPipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/GraphicsPipeline.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/ImageMemoryLayout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/ImageMemoryLayout.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/PhysicalDeviceQueueFamilyProperties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/PhysicalDeviceQueueFamilyProperties.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/PhysicalDeviceQueueFamilyProperties.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/PhysicalDevices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/PhysicalDevices.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/RenderPassLayouts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/RenderPassLayouts.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/RenderPassLayouts.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/Swapchain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/Swapchain.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/bg-starfield.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/bg-starfield.jpg -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/drawcube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/drawcube.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/images/vulkanlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/Tutorial/images/vulkanlogo.png -------------------------------------------------------------------------------- /API-Samples/Tutorial/markdown/index.md: -------------------------------------------------------------------------------- 1 | # Welcome to the Vulkan Samples Tutorial 2 | 3 | 4 | 5 | This tutorial is organized into sections that walk you 6 | through the steps to create a simple Vulkan program. 7 | Each tutorial section corresponds directly to a sample program 8 | in the LunarG samples progression 9 | and is designed to be read as you look at and experiment with real 10 | code from the progression. 11 | 12 | ## Tutorial Index 13 | 14 | * [Introduction](00-intro.html) 15 | * [Instance](01-init_instance.html) 16 | * [Enumerate Devices](02-enumerate_devices.html) 17 | * [Device](03-init_device.html) 18 | * [Command Buffer](04-init_command_buffer.html) 19 | * [Swapchain](05-init_swapchain.html) 20 | * [Depth Buffer](06-init_depth_buffer.html) 21 | * [Uniform Buffer](07-init_uniform_buffer.html) 22 | * [Pipeline Layout](08-init_pipeline_layout.html) 23 | * [Descriptor Set](09-init_descriptor_set.html) 24 | * [Render Pass](10-init_render_pass.html) 25 | * [Shaders](11-init_shaders.html) 26 | * [Framebuffers](12-init_frame_buffers.html) 27 | * [Vertex Buffer](13-init_vertex_buffer.html) 28 | * [Pipeline](14-init_pipeline.html) 29 | * [Draw Cube](15-draw_cube.html) 30 | * [Vulkan 1.1 Changes](16-vulkan_1_1_changes.html) 31 | 32 | ## The Goal 33 | 34 | The final section in the tutorial produces a program that displays this: 35 | 36 | ![Draw Cube](../images/drawcube.png) 37 | 38 | ## Change Log 39 | 40 | * 26 Aug 2016 - Initial Revision 41 | * 26 Oct 2016 - Image layout transitions are now specified 42 | in render pass and subpass definitions, instead of using memory barriers 43 | * 26 Oct 2017 - Added new page on Vulkan 1.1 44 | * 01 Aug 2018 - Added "Next" link to Intro page from Index 45 | 46 | 47 | 48 | 49 | 50 |
Next: Introduction
51 |
© Copyright 2016-2018 LunarG, Inc
52 | -------------------------------------------------------------------------------- /API-Samples/android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | cmake_minimum_required(VERSION 3.4.1) 18 | # Build Util Lib 19 | set(UTILS_NAME vsamputils) 20 | get_filename_component(PROJECT_SOURCE_DIR 21 | "${CMAKE_SOURCE_DIR}/../../.." 22 | ABSOLUTE) 23 | get_filename_component(GLMINC_PREFIX 24 | "${CMAKE_SOURCE_DIR}/../utils" 25 | ABSOLUTE) 26 | add_subdirectory(${CMAKE_SOURCE_DIR}/../utils ${CMAKE_BINARY_DIR}/utils) 27 | 28 | # Build application's shared lib 29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -D VK_USE_PLATFORM_ANDROID_KHR") 30 | 31 | # Force export ANativeActivity_onCreate(), 32 | # Refer to: https://github.com/android-ndk/ndk/issues/381. 33 | set(CMAKE_SHARED_LINKER_FLAGS 34 | "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") 35 | 36 | add_library(vulkan_sample SHARED 37 | ${CMAKE_SOURCE_DIR}/../${SAMPLE_NAME}/${SAMPLE_NAME}.cpp 38 | ${CMAKE_SOURCE_DIR}/vulkan_wrapper/vulkan_wrapper.cpp) 39 | 40 | target_include_directories(vulkan_sample PRIVATE 41 | ${CMAKE_SOURCE_DIR}/../data 42 | ${GLMINC_PREFIX} 43 | ${CMAKE_SOURCE_DIR}/ShaderHeaders 44 | ${CMAKE_SOURCE_DIR}/../android/vulkan_wrapper) 45 | 46 | target_link_libraries(vulkan_sample 47 | log 48 | ${UTILS_NAME}) 49 | -------------------------------------------------------------------------------- /API-Samples/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Copyright 2016, 2018 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 16 | 17 | buildscript { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | dependencies { 23 | classpath 'com.android.tools.build:gradle:4.0.0' 24 | // NOTE: Do not place your application dependencies here; they belong 25 | // in the individual module build.gradle files 26 | } 27 | } 28 | 29 | allprojects { 30 | repositories { 31 | google() 32 | jcenter() 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /API-Samples/android/compile_shaders.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 LunarG, Inc. 2 | # To be run from build/API-Samples 3 | 4 | import os, subprocess, platform, sys 5 | script = os.path.join("..", "..", "scripts", "generate_spirv.py") 6 | validator = os.path.join("..", "..", "glslang", "bin", "glslangValidator") 7 | assembler = os.path.join("..", "..", "spirv-tools", "bin", "spirv-as") 8 | 9 | zip_name = {"Linux": "glslang-master-linux-Release.zip", 10 | "Darwin": "glslang-master-osx-Release.zip", 11 | "Windows": "glslang-master-windows-x64-Release.zip"}[platform.system()] 12 | if not os.path.exists(validator): 13 | args = [ sys.executable, os.path.join("..", "..", "scripts", "fetch_glslangvalidator.py"), zip_name] 14 | subprocess.check_call(args) 15 | 16 | zip_name = {"Linux" : "SPIRV-Tools-master-linux-RelWithDebInfo.zip", 17 | "Darwin": "SPIRV-Tools-master-osx-RelWithDebInfo.zip", 18 | "Windows":"SPIRV-Tools-master-windows-x64-Release.zip"}[platform.system()] 19 | if not os.path.exists(assembler): 20 | args = [ sys.executable, os.path.join("..", "..", "scripts", "fetch_spirv_tools.py"), zip_name] 21 | subprocess.check_call(args) 22 | 23 | samplesdir = os.path.join(os.getcwd(), "..") 24 | headersdir = os.path.join(os.getcwd(), "ShaderHeaders") 25 | if not os.path.exists(headersdir): 26 | os.mkdir(headersdir) 27 | assembly_files = ["spirv_assembly.vert", "spirv_assembly.frag", "specialized.frag"] 28 | for root, dir, files in os.walk(samplesdir): 29 | for file in files: 30 | if file.endswith(".vert") or file.endswith(".frag"): 31 | samplepath = os.path.join(root, file) 32 | if file in assembly_files: 33 | args = [ sys.executable, script, samplepath, os.path.join(headersdir, file + ".h"), assembler, "true"] 34 | else: 35 | args = [ sys.executable, script, samplepath, os.path.join(headersdir, file + ".h"), validator, "false"] 36 | subprocess.check_call(args) 37 | #print(args) 38 | 39 | 40 | -------------------------------------------------------------------------------- /API-Samples/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /API-Samples/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /API-Samples/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 03 18:51:35 PDT 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /API-Samples/android/project_template/README.md: -------------------------------------------------------------------------------- 1 | Copyright 2016 Google Inc. All rights reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | @SAMPLE_DESCRIPTION@ -------------------------------------------------------------------------------- /API-Samples/android/project_template/build.gradle: -------------------------------------------------------------------------------- 1 | // Copyright 2016, 2018 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | apply plugin: 'com.android.application' 16 | 17 | def stlType = 'c++_static' 18 | 19 | android { 20 | compileSdkVersion 30 21 | buildToolsVersion '30.0.0' 22 | ndkVersion '21.3.6528147' 23 | 24 | defaultConfig { 25 | applicationId '@PACKAGE_NAME@' 26 | minSdkVersion 24 // Official vulkan support starts from API level 24 27 | targetSdkVersion 26 28 | versionCode 1 29 | versionName '0.0.1' 30 | ndk { 31 | abiFilters '@ABI_NAME@' 32 | } 33 | externalNativeBuild { 34 | cmake { 35 | arguments '-DANDROID_PLATFORM=android-24', '-DANDROID_TOOLCHAIN=clang', 36 | "-DANDROID_STL=${stlType}", '-DSAMPLE_NAME=' + project.getName() 37 | } 38 | } 39 | } 40 | externalNativeBuild { 41 | cmake { 42 | path '../CMakeLists.txt' 43 | } 44 | } 45 | @OTHER_FLAGS@ 46 | buildTypes { 47 | release { 48 | minifyEnabled false 49 | } 50 | } 51 | @ASSET_DIR@ 52 | @VALIDATIONLAYER_PACKING@ 53 | } 54 | 55 | dependencies { 56 | implementation fileTree(dir: 'libs', include: ['*.jar']) 57 | } 58 | -------------------------------------------------------------------------------- /API-Samples/android/project_template/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | @EXTRA_PERMISSIONS@ 22 | 23 | 25 | 26 | 28 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /API-Samples/android/project_template/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | @SAMPLE_NAME@ 20 | 21 | -------------------------------------------------------------------------------- /API-Samples/android/settings.gradle.in: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // configure path to the source code generated on your machine 16 | @SETTINGS_GRADLE@ 17 | -------------------------------------------------------------------------------- /API-Samples/data/blue.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/blue.ppm -------------------------------------------------------------------------------- /API-Samples/data/green.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/green.ppm -------------------------------------------------------------------------------- /API-Samples/data/logo-256x256-solid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/logo-256x256-solid.png -------------------------------------------------------------------------------- /API-Samples/data/logo-256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/logo-256x256.png -------------------------------------------------------------------------------- /API-Samples/data/lunarg.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/lunarg.ppm -------------------------------------------------------------------------------- /API-Samples/data/red.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/red.ppm -------------------------------------------------------------------------------- /API-Samples/data/spotlight.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/spotlight.ppm -------------------------------------------------------------------------------- /API-Samples/data/yellow.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/data/yellow.ppm -------------------------------------------------------------------------------- /API-Samples/draw_subpasses/draw_subpasses.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/draw_subpasses/draw_subpasses.full.vert: -------------------------------------------------------------------------------- 1 | // This shader renders a simple fullscreen quad using the VS alone 2 | #version 400 3 | #extension GL_ARB_separate_shader_objects : enable 4 | #extension GL_ARB_shading_language_420pack : enable 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = vec4(1.0f, 0.1f, 0.1f, 0.5f); 8 | const vec4 verts[4] = vec4[4](vec4(-1.0, -1.0, 0.5, 1.0), 9 | vec4( 1.0, -1.0, 0.5, 1.0), 10 | vec4(-1.0, 1.0, 0.5, 1.0), 11 | vec4( 1.0, 1.0, 0.5, 1.0)); 12 | 13 | gl_Position = verts[gl_VertexIndex]; 14 | } -------------------------------------------------------------------------------- /API-Samples/draw_subpasses/draw_subpasses.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform bufferVals { 5 | mat4 mvp; 6 | } myBufferVals; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec4 inColor; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | outColor = inColor; 12 | gl_Position = myBufferVals.mvp * pos; 13 | } -------------------------------------------------------------------------------- /API-Samples/draw_textured_cube/draw_textured_cube.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/draw_textured_cube/draw_textured_cube.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/dynamic_uniform/dynamic_uniform.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/dynamic_uniform/dynamic_uniform.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform bufferVals { 5 | mat4 mvp; 6 | } myBufferVals; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec4 inColor; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | outColor = inColor; 12 | gl_Position = myBufferVals.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/get-descripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # get long description of vulkan sample applications 4 | # - currently displays descriptions for all samples that have set 5 | # a long description via the VULKAN_SAMPLE_DESCRIPTION_START and 6 | # VULKAN_SAMPLE_DESCRIPTION_END keywords 7 | # 8 | # usage: get-descripts.sh 9 | # 10 | # TODO - support filename(s) options - display descripts for only those samples 11 | 12 | # save command directory 13 | CMDDIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" 14 | 15 | SAMPS=`find "$CMDDIR" -name *.cpp -not -path "*util*"` 16 | 17 | # read all source .cpp files and display the long description 18 | IFS=$(echo -en "\n\b") 19 | for f in $SAMPS 20 | do 21 | DESCRIPT=`sed -n '/^VULKAN_SAMPLE_DESCRIPTION_START$/,/^VULKAN_SAMPLE_DESCRIPTION_END$/{ /^VULKAN_SAMPLE_DESCRIPTION_START/d; /^VULKAN_SAMPLE_DESCRIPTION_END/d; p; }' "$f"` 22 | BNAME=`basename $f` 23 | if [ ! -z "$DESCRIPT" ]; then 24 | echo "$BNAME:" 25 | echo "$DESCRIPT" 26 | echo "" 27 | else 28 | echo "$BNAME:" 29 | echo No Description 30 | echo "" 31 | fi 32 | done 33 | 34 | -------------------------------------------------------------------------------- /API-Samples/get-short-descripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # return short description of identified or all samples 4 | # get-short-descript.sh [--nofname] [--sampfname sample_source_file_name] 5 | # 6 | # - uses VULKAN_SAMPLE_SHORT_DESCRIPTION keyword from source file 7 | # - default (no options) will display short descriptions for all samples 8 | # - default display format: displays sample file names and short descriptions 9 | # filename.cpp: short descript 10 | # - specify --nofname to suppress display of the filename 11 | 12 | NOFNAME="" 13 | 14 | # save command directory 15 | CMDDIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" 16 | 17 | # default to displaying short descriptions of all samples 18 | SAMP2DISP=`find "$CMDDIR" -name *.cpp -not -path "*util*"` 19 | 20 | 21 | # parse the arguments 22 | while test $# -gt 0; do 23 | case "$1" in 24 | --nofname) 25 | NOFNAME=true 26 | ;; 27 | --sampfname) 28 | shift 29 | SAMP2DISP=$1 30 | ;; 31 | esac 32 | 33 | shift 34 | done 35 | 36 | # read all identified .cpp file(s) and display the short description 37 | IFS=$(echo -en "\n\b") 38 | for f in $SAMP2DISP 39 | do 40 | SHORT_DESCRIPT=`sed -n '/VULKAN_SAMPLE_SHORT_DESCRIPTION/{n;p}' $f` 41 | BNAME=`basename $f` 42 | if test -z $NOFNAME; then 43 | echo "$BNAME: $SHORT_DESCRIPT" 44 | else 45 | echo "$SHORT_DESCRIPT" 46 | fi 47 | done 48 | 49 | -------------------------------------------------------------------------------- /API-Samples/immutable_sampler/immutable_sampler.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (set = 0, binding = 1) uniform sampler2D surface; 5 | layout (location = 0) in vec2 inTexCoords; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | 9 | // Sample from the texture, using an immutable sampler 10 | outColor = texture(surface, inTexCoords); 11 | 12 | } -------------------------------------------------------------------------------- /API-Samples/immutable_sampler/immutable_sampler.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 outTexCoords; 10 | void main() { 11 | outTexCoords = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/input_attachment/input_attachment.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput 3 | myInputAttachment; 4 | layout (location = 0) out vec4 outColor; 5 | void main() { 6 | outColor = subpassLoad(myInputAttachment); 7 | } -------------------------------------------------------------------------------- /API-Samples/input_attachment/input_attachment.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | vec2 vertices[3]; 3 | void main() { 4 | vertices[0] = vec2(-1.0, -1.0); 5 | vertices[1] = vec2( 1.0, -1.0); 6 | vertices[2] = vec2( 0.0, 1.0); 7 | gl_Position = vec4(vertices[gl_VertexIndex % 3], 0.0, 1.0); 8 | } -------------------------------------------------------------------------------- /API-Samples/memory_barriers/memory_barriers.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/memory_barriers/memory_barriers.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/multiple_sets/multiple_sets.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 inColor; 5 | layout (location = 1) in vec2 inTexCoords; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | vec4 resColor = inColor; 9 | // Create a border to see the cube more easily 10 | if (inTexCoords.x < 0.01 || inTexCoords.x > 0.99) 11 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 12 | if (inTexCoords.y < 0.01 || inTexCoords.y > 0.99) 13 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 14 | outColor = resColor; 15 | } -------------------------------------------------------------------------------- /API-Samples/multiple_sets/multiple_sets.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | // Note, set = 0 here 5 | layout (std140, set = 0, binding = 0) uniform bufferVals { 6 | mat4 mvp; 7 | } myBufferVals; 8 | // And set = 1 here 9 | layout (set = 1, binding = 0) uniform sampler2D surface; 10 | layout (location = 0) in vec4 pos; 11 | layout (location = 1) in vec2 inTexCoords; 12 | layout (location = 0) out vec4 outColor; 13 | layout (location = 1) out vec2 outTexCoords; 14 | void main() { 15 | outColor = texture(surface, vec2(0.0)); 16 | outTexCoords = inTexCoords; 17 | gl_Position = myBufferVals.mvp * pos; 18 | } -------------------------------------------------------------------------------- /API-Samples/multithreaded_command_buffers/multithreaded_command_buffers.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } -------------------------------------------------------------------------------- /API-Samples/multithreaded_command_buffers/multithreaded_command_buffers.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 pos; 5 | layout (location = 1) in vec4 inColor; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = inColor; 9 | gl_Position = pos; 10 | } -------------------------------------------------------------------------------- /API-Samples/occlusion_query/occlusion_query.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/occlusion_query/occlusion_query.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform bufferVals { 5 | mat4 mvp; 6 | } myBufferVals; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec4 inColor; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | outColor = inColor; 12 | gl_Position = myBufferVals.mvp * pos; 13 | } -------------------------------------------------------------------------------- /API-Samples/pipeline_cache/pipeline_cache.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/pipeline_cache/pipeline_cache.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/pipeline_derivative/pipeline_derivative.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/pipeline_derivative/pipeline_derivative.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/pipeline_derivative/pipeline_derivative2.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | layout (location = 0) in vec2 texcoord; 3 | layout (location = 0) out vec4 outColor; 4 | void main() { 5 | outColor = vec4(texcoord.x, texcoord.y, 6 | 1.0 - texcoord.x - texcoord.y, 1.0f); 7 | } -------------------------------------------------------------------------------- /API-Samples/push_constants/push_constants.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout(push_constant) uniform pushBlock { 5 | int iFoo; 6 | float fBar; 7 | } pushConstantsBlock; 8 | layout (location = 0) in vec2 inTexCoords; 9 | layout (location = 0) out vec4 outColor; 10 | void main() { 11 | 12 | vec4 green = vec4(0.0, 1.0, 0.0, 1.0); 13 | vec4 red = vec4(1.0, 0.0, 0.0, 1.0); 14 | 15 | // Start with passing color 16 | vec4 resColor = green; 17 | 18 | // See if we've read in the correct push constants 19 | if (pushConstantsBlock.iFoo != 2) 20 | resColor = red; 21 | if (pushConstantsBlock.fBar != 1.0f) 22 | resColor = red; 23 | 24 | // Create a border to see the cube more easily 25 | if (inTexCoords.x < 0.01 || inTexCoords.x > 0.99) 26 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 27 | if (inTexCoords.y < 0.01 || inTexCoords.y > 0.99) 28 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 29 | outColor = resColor; 30 | } -------------------------------------------------------------------------------- /API-Samples/push_constants/push_constants.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 outTexCoords; 10 | void main() { 11 | outTexCoords = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/push_descriptors/push_descriptors.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/push_descriptors/push_descriptors.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/run_all_samples.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2020 LunarG, Inc. 2 | # To be run from build/API-Samples 3 | 4 | import os, subprocess, platform 5 | 6 | if platform.system() == 'Windows': 7 | for subdir in ["Debug", "Release"]: 8 | if os.path.isdir(subdir): 9 | directory = os.path.realpath(subdir) 10 | break 11 | else: 12 | sys.exit("Cannot find samples in Debug or Release, have they been built?") 13 | suffix = ".exe" 14 | else: 15 | directory = os.getcwd() 16 | suffix = "" 17 | 18 | samples = [] 19 | samplesdir = os.path.join("..", "..", "API-Samples") 20 | for root, dir, files in os.walk(samplesdir): 21 | for file in files: 22 | if file.endswith(".cpp") and "utils" not in root and "android" not in root: 23 | samples.append(os.path.splitext(file)[0]) 24 | 25 | samples.sort() 26 | samples_requiring_validation_layer = ["enable_validation_with_callback", "validation_cache"] 27 | for sample in samples: 28 | executable = os.path.join(directory, sample) 29 | print('exe = ' + executable) 30 | if "VK_LAYER_PATH" not in os.environ and sample in samples_requiring_validation_layer: 31 | print('Skipping {} because it requires validation layers'.format(sample)) 32 | continue 33 | if os.path.isfile(executable + suffix): 34 | print('Running: ' + sample) 35 | subprocess.check_call(executable) 36 | else: 37 | print("Skipping {} because the sample doesn't seem to be built".format(sample)) 38 | -------------------------------------------------------------------------------- /API-Samples/secondary_command_buffer/secondary_command_buffer.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/secondary_command_buffer/secondary_command_buffer.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/separate_image_sampler/separate_image_sampler.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (set = 0, binding = 1) uniform texture2D tex; 5 | layout (set = 0, binding = 2) uniform sampler samp; 6 | layout (location = 0) in vec2 inTexCoords; 7 | layout (location = 0) out vec4 outColor; 8 | void main() { 9 | 10 | // Combine the selected texture with sampler as a parameter 11 | vec4 resColor = texture(sampler2D(tex, samp), inTexCoords); 12 | 13 | // Create a border to see the cube more easily 14 | if (inTexCoords.x < 0.01 || inTexCoords.x > 0.99) 15 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 16 | if (inTexCoords.y < 0.01 || inTexCoords.y > 0.99) 17 | resColor *= vec4(0.1, 0.1, 0.1, 1.0); 18 | outColor = resColor; 19 | } -------------------------------------------------------------------------------- /API-Samples/separate_image_sampler/separate_image_sampler.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/spirv_assembly/spirv_assembly.frag: -------------------------------------------------------------------------------- 1 | ; SPIR-V 2 | ; Version: 1.0 3 | ; Generator: Khronos Glslang Reference Front End; 1 4 | ; Bound: 21\n" 5 | ; Schema: 0\n" 6 | OpCapability Shader 7 | %1 = OpExtInstImport "GLSL.std.450" 8 | OpMemoryModel Logical GLSL450 9 | OpEntryPoint Fragment %4 "main" %9 %17 10 | OpExecutionMode %4 OriginUpperLeft 11 | OpSource GLSL 400 12 | OpSourceExtension "GL_ARB_separate_shader_objects" 13 | OpSourceExtension "GL_ARB_shading_language_420pack" 14 | OpName %4 "main" 15 | OpName %9 "outColor" 16 | OpName %13 "tex" 17 | OpName %17 "texcoord" 18 | OpDecorate %9 Location 0 19 | OpDecorate %13 DescriptorSet 0 20 | OpDecorate %13 Binding 1 21 | OpDecorate %17 Location 0 22 | %2 = OpTypeVoid 23 | %3 = OpTypeFunction %2 24 | %6 = OpTypeFloat 32 25 | %7 = OpTypeVector %6 4 26 | %8 = OpTypePointer Output %7 27 | %9 = OpVariable %8 Output 28 | %10 = OpTypeImage %6 2D 0 0 0 1 Unknown 29 | %11 = OpTypeSampledImage %10 30 | %12 = OpTypePointer UniformConstant %11 31 | %13 = OpVariable %12 UniformConstant 32 | %15 = OpTypeVector %6 2 33 | %16 = OpTypePointer Input %15 34 | %17 = OpVariable %16 Input 35 | %19 = OpConstant %6 0 36 | %4 = OpFunction %2 None %3 37 | %5 = OpLabel 38 | %14 = OpLoad %11 %13 39 | %18 = OpLoad %15 %17 40 | %20 = OpImageSampleExplicitLod %7 %14 %18 Lod %19 41 | OpStore %9 %20 42 | OpReturn 43 | OpFunctionEnd 44 | -------------------------------------------------------------------------------- /API-Samples/spirv_specialization/spirv_specialization.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | layout (constant_id = 5) const bool drawUserColor = false; 8 | layout (constant_id = 7) const float r = 0.0f; 9 | layout (constant_id = 8) const float g = 0.0f; 10 | layout (constant_id = 9) const float b = 0.0f; 11 | void main() { 12 | if (drawUserColor) 13 | outColor = vec4(r, g, b, 1.0); 14 | else 15 | outColor = textureLod(tex, texcoord, 0.0); 16 | } -------------------------------------------------------------------------------- /API-Samples/spirv_specialization/spirv_specialization.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/template/template.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 1) uniform sampler2D tex; 5 | layout (location = 0) in vec2 texcoord; 6 | layout (location = 0) out vec4 outColor; 7 | void main() { 8 | outColor = textureLod(tex, texcoord, 0.0); 9 | } -------------------------------------------------------------------------------- /API-Samples/template/template.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/texel_buffer/texel_buffer.frag: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (location = 0) in vec4 color; 5 | layout (location = 0) out vec4 outColor; 6 | void main() { 7 | outColor = color; 8 | } 9 | -------------------------------------------------------------------------------- /API-Samples/texel_buffer/texel_buffer.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (binding = 0) uniform samplerBuffer texels; 5 | layout (location = 0) out vec4 outColor; 6 | vec2 vertices[3]; 7 | float r; 8 | float g; 9 | float b; 10 | void main() { 11 | r = texelFetch(texels, 0).r; 12 | g = texelFetch(texels, 1).r; 13 | b = texelFetch(texels, 2).r; 14 | outColor = vec4(r, g, b, 1.0); 15 | vertices[0] = vec2(-1.0, -1.0); 16 | vertices[1] = vec2( 1.0, -1.0); 17 | vertices[2] = vec2( 0.0, 1.0); 18 | gl_Position = vec4(vertices[gl_VertexIndex % 3], 0.0, 1.0); 19 | } -------------------------------------------------------------------------------- /API-Samples/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB UTILS_SOURCE *.cpp) 2 | 3 | set(SAMPLES_DATA_DIR ${SAMPLES_DATA_DIR} "${PROJECT_SOURCE_DIR}/API-Samples/data") 4 | if(SDK_INCLUDE_PATH) 5 | include_directories( ${SAMPLES_DATA_DIR} ${GLSLANG_SPIRV_INCLUDE_DIR} ${GLMINC_PREFIX} ${SDK_INCLUDE_PATH} ) 6 | else() 7 | include_directories( ${SAMPLES_DATA_DIR} ${GLSLANG_SPIRV_INCLUDE_DIR} ${GLMINC_PREFIX} ) 8 | endif() 9 | 10 | if(ANDROID) 11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -DVK_USE_PLATFORM_ANDROID_KHR") 12 | elseif(WIN32) 13 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") 14 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES") 15 | 16 | # If MSVC, disable some signed/unsigned mismatch warnings. 17 | if (MSVC) 18 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267") 19 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") 20 | endif() 21 | else() 22 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") 23 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare") 24 | endif() 25 | 26 | add_library(${UTILS_NAME} STATIC ${UTILS_SOURCE}) 27 | 28 | if(ANDROID) 29 | add_library(native_app_glue STATIC 30 | ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) 31 | target_include_directories(${UTILS_NAME} PRIVATE 32 | ${ANDROID_NDK}/sources/android/native_app_glue 33 | ${CMAKE_CURRENT_SOURCE_DIR}/../android/vulkan_wrapper 34 | ${CMAKE_CURRENT_SOURCE_DIR}/../data) 35 | target_link_libraries(${UTILS_NAME} 36 | android 37 | log 38 | native_app_glue) 39 | endif() 40 | 41 | -------------------------------------------------------------------------------- /API-Samples/utils/README.md: -------------------------------------------------------------------------------- 1 | # Utility Functions for the Vulkan Samples Kit 2 | 3 | ## utils.hpp/utils.cpp 4 | 5 | - get_base_data_dir() - return full path to the base data directory; uses 6 | CMAKE definition VULKAN_SAMPLES_BASE_DIR to get the samples base directory 7 | and appends “/data/” 8 | - get_data_dir(__FILE__) - return the full path to the release-specific data 9 | directory 10 | - the version prefix is extracted from __FILE__ to determine the release 11 | specific data directory component 12 | - implies that function must be called from the main sample source file, 13 | not another utility 14 | 15 | Other utility functions may be added to utils.cpp, or new source files created. 16 | 17 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/common.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/common.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_COMMON_INCLUDED 30 | #define GLM_COMMON_INCLUDED 31 | 32 | #include "detail/func_common.hpp" 33 | 34 | #endif//GLM_COMMON_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/_fixes.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_fixes.hpp 25 | /// @date 2011-02-21 / 2011-11-22 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #include 30 | 31 | //! Workaround for compatibility with other libraries 32 | #ifdef max 33 | #undef max 34 | #endif 35 | 36 | //! Workaround for compatibility with other libraries 37 | #ifdef min 38 | #undef min 39 | #endif 40 | 41 | //! Workaround for Android 42 | #ifdef isnan 43 | #undef isnan 44 | #endif 45 | 46 | //! Workaround for Android 47 | #ifdef isinf 48 | #undef isinf 49 | #endif 50 | 51 | //! Workaround for Chrone Native Client 52 | #ifdef log2 53 | #undef log2 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/_literals.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/_literals.hpp 25 | /// @date 2013-05-06 / 2013-05-06 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_literals 30 | #define glm_core_literals 31 | 32 | namespace glm 33 | { 34 | #define GLM_CXX11_USER_LITERALS 35 | #ifdef GLM_CXX11_USER_LITERALS 36 | /* 37 | GLM_FUNC_QUALIFIER detail::half operator "" _h(long double const s) 38 | { 39 | return detail::half(s); 40 | } 41 | 42 | GLM_FUNC_QUALIFIER float operator "" _f(long double const s) 43 | { 44 | return static_cast(s); 45 | } 46 | */ 47 | #endif//GLM_CXX11_USER_LITERALS 48 | 49 | }//namespace glm 50 | 51 | #endif//glm_core_literals 52 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/hint.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/hint.hpp 25 | /// @date 2008-08-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type 30 | #define glm_core_type 31 | 32 | namespace glm 33 | { 34 | // Use dont_care, nicest and fastest to optimize implementations. 35 | class dont_care {}; 36 | class nicest {}; 37 | class fastest {}; 38 | }//namespace glm 39 | 40 | #endif//glm_core_type 41 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/intrinsic_exponential.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_exponential.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/intrinsic_integer.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_integer.hpp 25 | /// @date 2009-05-11 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_integer 30 | #define glm_detail_intrinsic_integer 31 | 32 | #include "glm/glm.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | __m128i _mm_bit_interleave_si128(__m128i x); 42 | __m128i _mm_bit_interleave_si128(__m128i x, __m128i y); 43 | 44 | }//namespace detail 45 | }//namespace glm 46 | 47 | #include "intrinsic_integer.inl" 48 | 49 | #endif//GLM_ARCH 50 | #endif//glm_detail_intrinsic_integer 51 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/intrinsic_trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_trigonometric 30 | #define glm_detail_intrinsic_trigonometric 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_trigonometric.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_trigonometric 49 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/intrinsic_trigonometric.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_trigonometric.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/intrinsic_vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/intrinsic_vector_relational.hpp 25 | /// @date 2009-06-09 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_detail_intrinsic_vector_relational 30 | #define glm_detail_intrinsic_vector_relational 31 | 32 | #include "setup.hpp" 33 | 34 | #if(!(GLM_ARCH & GLM_ARCH_SSE2)) 35 | # error "SSE2 instructions not supported or enabled" 36 | #else 37 | 38 | namespace glm{ 39 | namespace detail 40 | { 41 | 42 | }//namespace detail 43 | }//namespace glm 44 | 45 | #include "intrinsic_vector_relational.inl" 46 | 47 | #endif//GLM_ARCH 48 | #endif//glm_detail_intrinsic_vector_relational 49 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/precision.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/precision.hpp 25 | /// @date 2013-04-01 / 2013-04-01 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_CORE_PRECISION_INCLUDED 30 | #define GLM_CORE_PRECISION_INCLUDED 31 | 32 | namespace glm 33 | { 34 | enum precision 35 | { 36 | highp, 37 | mediump, 38 | lowp, 39 | defaultp = highp 40 | }; 41 | }//namespace glm 42 | 43 | #endif//GLM_CORE_PRECISION_INCLUDED 44 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/precision.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/utils/glm/detail/precision.inl -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/type_half.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_half.hpp 25 | /// @date 2008-08-17 / 2011-09-20 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef glm_core_type_half 30 | #define glm_core_type_half 31 | 32 | #include "setup.hpp" 33 | 34 | namespace glm{ 35 | namespace detail 36 | { 37 | typedef short hdata; 38 | 39 | GLM_FUNC_DECL float toFloat32(hdata value); 40 | GLM_FUNC_DECL hdata toFloat16(float const & value); 41 | 42 | }//namespace detail 43 | 44 | /// half-precision floating-point numbers. 45 | //typedef detail::hdata half; 46 | 47 | }//namespace glm 48 | 49 | #include "type_half.inl" 50 | 51 | #endif//glm_core_type_half 52 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/type_half.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/API-Samples/utils/glm/detail/type_half.inl -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/type_mat.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_mat.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/detail/type_vec.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/core/type_vec.inl 25 | /// @date 2011-06-15 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/exponential.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/exponential.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_EXPONENTIAL_INCLUDED 30 | #define GLM_EXPONENTIAL_INCLUDED 31 | 32 | #include "detail/func_exponential.hpp" 33 | 34 | #endif//GLM_EXPONENTIAL_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/geometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/geometric.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_GEOMETRIC_INCLUDED 30 | #define GLM_GEOMETRIC_INCLUDED 31 | 32 | #include "detail/func_geometric.hpp" 33 | 34 | #endif//GLM_GEOMETRIC_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtc/type_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtc_swizzle 24 | /// @file glm/gtc/swizzle.inl 25 | /// @date 2009-06-14 / 2011-06-15 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | namespace glm 30 | { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/closest_point.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-30 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/closest_point.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | #ifndef glm_gtx_closest_point 11 | #define glm_gtx_closest_point 12 | 13 | namespace glm 14 | { 15 | template 16 | GLM_FUNC_QUALIFIER detail::tvec3 closestPointOnLine 17 | ( 18 | detail::tvec3 const & point, 19 | detail::tvec3 const & a, 20 | detail::tvec3 const & b 21 | ) 22 | { 23 | T LineLength = distance(a, b); 24 | detail::tvec3 Vector = point - a; 25 | detail::tvec3 LineDirection = (b - a) / LineLength; 26 | 27 | // Project Vector to LineDirection to get the distance of point from a 28 | T Distance = dot(Vector, LineDirection); 29 | 30 | if(Distance <= T(0)) return a; 31 | if(Distance >= LineLength) return b; 32 | return a + LineDirection * Distance; 33 | } 34 | }//namespace glm 35 | 36 | #endif//glm_gtx_closest_point 37 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/color_space_YCoCg.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-28 5 | // Updated : 2008-10-28 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/color_space_YCoCg.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCg 14 | ( 15 | detail::tvec3 const & rgbColor 16 | ) 17 | { 18 | detail::tvec3 result; 19 | result.x/*Y */ = rgbColor.r / T(4) + rgbColor.g / T(2) + rgbColor.b / T(4); 20 | result.y/*Co*/ = rgbColor.r / T(2) + rgbColor.g * T(0) - rgbColor.b / T(2); 21 | result.z/*Cg*/ = - rgbColor.r / T(4) + rgbColor.g / T(2) - rgbColor.b / T(4); 22 | return result; 23 | } 24 | 25 | template 26 | GLM_FUNC_QUALIFIER detail::tvec3 rgb2YCoCgR 27 | ( 28 | detail::tvec3 const & rgbColor 29 | ) 30 | { 31 | detail::tvec3 result; 32 | result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4); 33 | result.y/*Co*/ = rgbColor.r - rgbColor.b; 34 | result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2); 35 | return result; 36 | } 37 | 38 | template 39 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCg2rgb 40 | ( 41 | detail::tvec3 const & YCoCgColor 42 | ) 43 | { 44 | detail::tvec3 result; 45 | result.r = YCoCgColor.x + YCoCgColor.y - YCoCgColor.z; 46 | result.g = YCoCgColor.x + YCoCgColor.z; 47 | result.b = YCoCgColor.x - YCoCgColor.y - YCoCgColor.z; 48 | return result; 49 | } 50 | 51 | template 52 | GLM_FUNC_QUALIFIER detail::tvec3 YCoCgR2rgb 53 | ( 54 | detail::tvec3 const & YCoCgRColor 55 | ) 56 | { 57 | detail::tvec3 result; 58 | T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2)); 59 | result.g = YCoCgRColor.z + tmp; 60 | result.b = tmp - (YCoCgRColor.y / T(2)); 61 | result.r = result.b + YCoCgRColor.y; 62 | return result; 63 | } 64 | }//namespace glm 65 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/compatibility.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-16 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/compatibility.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | // isfinite 13 | template 14 | GLM_FUNC_QUALIFIER bool isfinite( 15 | genType const & x) 16 | { 17 | # if(GLM_LANG & GLM_LANG_CXX11_FLAG) 18 | return std::isfinite(x) != 0; 19 | # elif(GLM_COMPILER & GLM_COMPILER_VC) 20 | return _finite(x); 21 | # elif(GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID) 22 | return _isfinite(x) != 0; 23 | # else 24 | return isfinite(x) != 0; 25 | # endif 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tvec2 isfinite( 30 | detail::tvec2 const & x) 31 | { 32 | return detail::tvec2( 33 | isfinite(x.x), 34 | isfinite(x.y)); 35 | } 36 | 37 | template 38 | GLM_FUNC_QUALIFIER detail::tvec3 isfinite( 39 | detail::tvec3 const & x) 40 | { 41 | return detail::tvec3( 42 | isfinite(x.x), 43 | isfinite(x.y), 44 | isfinite(x.z)); 45 | } 46 | 47 | template 48 | GLM_FUNC_QUALIFIER detail::tvec4 isfinite( 49 | detail::tvec4 const & x) 50 | { 51 | return detail::tvec4( 52 | isfinite(x.x), 53 | isfinite(x.y), 54 | isfinite(x.z), 55 | isfinite(x.w)); 56 | } 57 | 58 | }//namespace glm 59 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/component_wise.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-21 5 | // Updated : 2010-02-12 6 | // Licence : This source is under MIT License 7 | // File : gtx_component_wise.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template class vecType> 13 | GLM_FUNC_QUALIFIER T compAdd(vecType const & v) 14 | { 15 | T result(0); 16 | for(length_t i = 0; i < v.length(); ++i) 17 | result += v[i]; 18 | return result; 19 | } 20 | 21 | template class vecType> 22 | GLM_FUNC_QUALIFIER T compMul(vecType const & v) 23 | { 24 | T result(1); 25 | for(length_t i = 0; i < v.length(); ++i) 26 | result *= v[i]; 27 | return result; 28 | } 29 | 30 | template class vecType> 31 | GLM_FUNC_QUALIFIER T compMin(vecType const & v) 32 | { 33 | T result(v[0]); 34 | for(length_t i = 1; i < v.length(); ++i) 35 | result = min(result, v[i]); 36 | return result; 37 | } 38 | 39 | template class vecType> 40 | GLM_FUNC_QUALIFIER T compMax(vecType const & v) 41 | { 42 | T result(v[0]); 43 | for(length_t i = 1; i < v.length(); ++i) 44 | result = max(result, v[i]); 45 | return result; 46 | } 47 | }//namespace glm 48 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/constants.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_constants 25 | #define GLM_GTX_constants 26 | 27 | #include "../gtc/constants.hpp" 28 | 29 | #if(defined(GLM_MESSAGES)) 30 | # pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTC_constants (glm/gtc/constants.hpp) instead") 31 | #endif 32 | 33 | #endif//GLM_GTX_constants 34 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/epsilon.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_epsilon extension is deprecated, include GLM_GTC_epsilon (glm/gtc/epsilon) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/epsilon.hpp" 30 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/extend.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2006-01-07 5 | // Updated : 2008-10-05 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/extend.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType extend 14 | ( 15 | genType const & Origin, 16 | genType const & Source, 17 | genType const & Distance 18 | ) 19 | { 20 | return Origin + (Source - Origin) * Distance; 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER detail::tvec2 extend 25 | ( 26 | detail::tvec2 const & Origin, 27 | detail::tvec2 const & Source, 28 | T const & Distance 29 | ) 30 | { 31 | return Origin + (Source - Origin) * Distance; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 extend 36 | ( 37 | detail::tvec3 const & Origin, 38 | detail::tvec3 const & Source, 39 | T const & Distance 40 | ) 41 | { 42 | return Origin + (Source - Origin) * Distance; 43 | } 44 | 45 | template 46 | GLM_FUNC_QUALIFIER detail::tvec4 extend 47 | ( 48 | detail::tvec4 const & Origin, 49 | detail::tvec4 const & Source, 50 | T const & Distance 51 | ) 52 | { 53 | return Origin + (Source - Origin) * Distance; 54 | } 55 | }//namespace glm 56 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/gradient_paint.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2009-03-06 5 | // Updated : 2013-04-09 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/gradient_paint.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER T radialGradient 14 | ( 15 | detail::tvec2 const & Center, 16 | T const & Radius, 17 | detail::tvec2 const & Focal, 18 | detail::tvec2 const & Position 19 | ) 20 | { 21 | detail::tvec2 F = Focal - Center; 22 | detail::tvec2 D = Position - Focal; 23 | T Radius2 = pow2(Radius); 24 | T Fx2 = pow2(F.x); 25 | T Fy2 = pow2(F.y); 26 | 27 | T Numerator = (D.x * F.x + D.y * F.y) + sqrt(Radius2 * (pow2(D.x) + pow2(D.y)) - pow2(D.x * F.y - D.y * F.x)); 28 | T Denominator = Radius2 - (Fx2 + Fy2); 29 | return Numerator / Denominator; 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER T linearGradient 34 | ( 35 | detail::tvec2 const & Point0, 36 | detail::tvec2 const & Point1, 37 | detail::tvec2 const & Position 38 | ) 39 | { 40 | detail::tvec2 Dist = Point1 - Point0; 41 | return (Dist.x * (Position.x - Point0.x) + Dist.y * (Position.y - Point0.y)) / glm::dot(Dist, Dist); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/handed_coordinate_space.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-02-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/handed_coordinate_space.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool rightHanded 14 | ( 15 | detail::tvec3 const & tangent, 16 | detail::tvec3 const & binormal, 17 | detail::tvec3 const & normal 18 | ) 19 | { 20 | return dot(cross(normal, tangent), binormal) > T(0); 21 | } 22 | 23 | template 24 | GLM_FUNC_QUALIFIER bool leftHanded 25 | ( 26 | detail::tvec3 const & tangent, 27 | detail::tvec3 const & binormal, 28 | detail::tvec3 const & normal 29 | ) 30 | { 31 | return dot(cross(normal, tangent), binormal) < T(0); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/int_10_10_10_2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #ifndef GLM_GTX_int_10_10_10_2 25 | #define GLM_GTX_int_10_10_10_2 26 | 27 | // Dependency: 28 | #include "../glm.hpp" 29 | #include "../gtx/raw_data.hpp" 30 | 31 | #if(defined(GLM_MESSAGES)) 32 | # pragma message("GLM: GLM_GTX_int_10_10_10_2 extension is deprecated, include GLM_GTC_packing (glm/gtc/packing.hpp) instead") 33 | #endif 34 | 35 | namespace glm 36 | { 37 | //! Deprecated, use packUnorm3x10_1x2 instead. 38 | GLM_DEPRECATED GLM_FUNC_DECL dword uint10_10_10_2_cast(glm::vec4 const & v); 39 | 40 | }//namespace glm 41 | 42 | #include "int_10_10_10_2.inl" 43 | 44 | #endif//GLM_GTX_int_10_10_10_2 45 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/int_10_10_10_2.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | namespace glm 25 | { 26 | GLM_FUNC_QUALIFIER dword uint10_10_10_2_cast 27 | ( 28 | glm::vec4 const & v 29 | ) 30 | { 31 | return dword(uint(v.x * 2047.f) << 0 | uint(v.y * 2047.f) << 10 | uint(v.z * 2047.f) << 20 | uint(v.w * 3.f) << 30); 32 | } 33 | }//namespace glm 34 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/log_base.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_log_base 24 | /// @file glm/gtx/log_base.hpp 25 | /// @date 2008-10-24 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_log_base GLM_GTX_log_base 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Logarithm for any base. base can be a vector or a scalar. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_log_base 39 | #define GLM_GTX_log_base 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 45 | # pragma message("GLM: GLM_GTX_log_base extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_log_base 51 | /// @{ 52 | 53 | //! Logarithm for any base. 54 | //! From GLM_GTX_log_base. 55 | template 56 | GLM_FUNC_DECL genType log( 57 | genType const & x, 58 | genType const & base); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "log_base.inl" 64 | 65 | #endif//GLM_GTX_log_base 66 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/log_base.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-10-24 5 | // Updated : 2008-10-24 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/log_base.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType log( 14 | genType const & x, 15 | genType const & base) 16 | { 17 | assert(x != genType(0)); 18 | 19 | return glm::log(x) / glm::log(base); 20 | } 21 | 22 | VECTORIZE_VEC_SCA(log) 23 | VECTORIZE_VEC_VEC(log) 24 | }//namespace glm 25 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/matrix_cross_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/matrix_cross_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 matrixCross3 14 | ( 15 | detail::tvec3 const & x 16 | ) 17 | { 18 | detail::tmat3x3 Result(T(0)); 19 | Result[0][1] = x.z; 20 | Result[1][0] = -x.z; 21 | Result[0][2] = -x.y; 22 | Result[2][0] = x.y; 23 | Result[1][2] = x.x; 24 | Result[2][1] = -x.x; 25 | return Result; 26 | } 27 | 28 | template 29 | GLM_FUNC_QUALIFIER detail::tmat4x4 matrixCross4 30 | ( 31 | detail::tvec3 const & x 32 | ) 33 | { 34 | detail::tmat4x4 Result(T(0)); 35 | Result[0][1] = x.z; 36 | Result[1][0] = -x.z; 37 | Result[0][2] = -x.y; 38 | Result[2][0] = x.y; 39 | Result[1][2] = x.x; 40 | Result[2][1] = -x.x; 41 | return Result; 42 | } 43 | 44 | }//namespace glm 45 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/mixed_product.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-04-03 5 | // Updated : 2008-09-17 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/mixed_product.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER T mixedProduct 14 | ( 15 | detail::tvec3 const & v1, 16 | detail::tvec3 const & v2, 17 | detail::tvec3 const & v3 18 | ) 19 | { 20 | return dot(cross(v1, v2), v3); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/noise.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random (glm/gtc/noise.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/noise.hpp" 30 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/normal.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2011-06-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/normal.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 triangleNormal 14 | ( 15 | detail::tvec3 const & p1, 16 | detail::tvec3 const & p2, 17 | detail::tvec3 const & p3 18 | ) 19 | { 20 | return normalize(cross(p1 - p2, p1 - p3)); 21 | } 22 | }//namespace glm 23 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/number_precision.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-05-10 5 | // Updated : 2007-05-10 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/number_precision.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/optimum_pow.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-27 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/optimum_pow.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER genType pow2(genType const & x) 14 | { 15 | return x * x; 16 | } 17 | 18 | template 19 | GLM_FUNC_QUALIFIER genType pow3(genType const & x) 20 | { 21 | return x * x * x; 22 | } 23 | 24 | template 25 | GLM_FUNC_QUALIFIER genType pow4(genType const & x) 26 | { 27 | return (x * x) * (x * x); 28 | } 29 | 30 | GLM_FUNC_QUALIFIER bool powOfTwo(int x) 31 | { 32 | return !(x & (x - 1)); 33 | } 34 | 35 | template 36 | GLM_FUNC_QUALIFIER detail::tvec2 powOfTwo(detail::tvec2 const & x) 37 | { 38 | return detail::tvec2( 39 | powOfTwo(x.x), 40 | powOfTwo(x.y)); 41 | } 42 | 43 | template 44 | GLM_FUNC_QUALIFIER detail::tvec3 powOfTwo(detail::tvec3 const & x) 45 | { 46 | return detail::tvec3( 47 | powOfTwo(x.x), 48 | powOfTwo(x.y), 49 | powOfTwo(x.z)); 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER detail::tvec4 powOfTwo(detail::tvec4 const & x) 54 | { 55 | return detail::tvec4( 56 | powOfTwo(x.x), 57 | powOfTwo(x.y), 58 | powOfTwo(x.z), 59 | powOfTwo(x.w)); 60 | } 61 | }//namespace glm 62 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/orthonormalize.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2005-12-21 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/orthonormalize.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat3x3 orthonormalize 14 | ( 15 | const detail::tmat3x3& m 16 | ) 17 | { 18 | detail::tmat3x3 r = m; 19 | 20 | r[0] = normalize(r[0]); 21 | 22 | float d0 = dot(r[0], r[1]); 23 | r[1] -= r[0] * d0; 24 | r[1] = normalize(r[1]); 25 | 26 | float d1 = dot(r[1], r[2]); 27 | d0 = dot(r[0], r[2]); 28 | r[2] -= r[0] * d0 + r[1] * d1; 29 | r[2] = normalize(r[2]); 30 | 31 | return r; 32 | } 33 | 34 | template 35 | GLM_FUNC_QUALIFIER detail::tvec3 orthonormalize 36 | ( 37 | const detail::tvec3& x, 38 | const detail::tvec3& y 39 | ) 40 | { 41 | return normalize(x - y * dot(y, x)); 42 | } 43 | }//namespace glm 44 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/perpendicular.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/perpendicular.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType perp 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return x - proj(x, Normal); 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/polar_coordinates.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2007-03-06 5 | // Updated : 2009-05-01 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/polar_coordinates.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tvec3 polar 14 | ( 15 | detail::tvec3 const & euclidean 16 | ) 17 | { 18 | T const Length(length(euclidean)); 19 | detail::tvec3 const tmp(euclidean / Length); 20 | T const xz_dist(sqrt(tmp.x * tmp.x + tmp.z * tmp.z)); 21 | 22 | #ifdef GLM_FORCE_RADIANS 23 | return detail::tvec3( 24 | atan(xz_dist, tmp.y), // latitude 25 | atan(tmp.x, tmp.z), // longitude 26 | xz_dist); // xz distance 27 | #else 28 | # pragma message("GLM: polar function returning degrees is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") 29 | return detail::tvec3( 30 | degrees(atan(xz_dist, tmp.y)), // latitude 31 | degrees(atan(tmp.x, tmp.z)), // longitude 32 | xz_dist); // xz distance 33 | #endif 34 | } 35 | 36 | template 37 | GLM_FUNC_QUALIFIER detail::tvec3 euclidean 38 | ( 39 | detail::tvec2 const & polar 40 | ) 41 | { 42 | #ifdef GLM_FORCE_RADIANS 43 | T const latitude(polar.x); 44 | T const longitude(polar.y); 45 | #else 46 | # pragma message("GLM: euclidean function taking degrees as parameters is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.") 47 | T const latitude(radians(polar.x)); 48 | T const longitude(radians(polar.y)); 49 | #endif 50 | 51 | return detail::tvec3( 52 | cos(latitude) * sin(longitude), 53 | sin(latitude), 54 | cos(latitude) * cos(longitude)); 55 | } 56 | 57 | }//namespace glm 58 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/projection.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_projection 24 | /// @file glm/gtx/projection.hpp 25 | /// @date 2005-12-21 / 2011-06-07 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_projection GLM_GTX_projection 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Projection of a vector to other one 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_projection 39 | #define GLM_GTX_projection 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 45 | # pragma message("GLM: GLM_GTX_projection extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_projection 51 | /// @{ 52 | 53 | //! Projects x on Normal. 54 | //! From GLM_GTX_projection extension. 55 | template 56 | GLM_FUNC_DECL vecType proj( 57 | vecType const & x, 58 | vecType const & Normal); 59 | 60 | /// @} 61 | }//namespace glm 62 | 63 | #include "projection.inl" 64 | 65 | #endif//GLM_GTX_projection 66 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/projection.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-03-06 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/projection.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER vecType proj 14 | ( 15 | vecType const & x, 16 | vecType const & Normal 17 | ) 18 | { 19 | return glm::dot(x, Normal) / glm::dot(Normal, Normal) * Normal; 20 | } 21 | }//namespace glm 22 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/random.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_random extension is deprecated, include GLM_GTC_random instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/random.hpp" 30 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/raw_data.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-11-19 5 | // Updated : 2008-11-19 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/raw_data.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | // Dependency: 10 | // - GLM core 11 | /////////////////////////////////////////////////////////////////////////////////////////////////// 12 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/reciprocal.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_reciprocal extension is deprecated, include GLM_GTC_reciprocal instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/scalar_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_scalar_relational 24 | /// @file glm/gtx/scalar_relational.hpp 25 | /// @date 2013-02-04 / 2013-02-04 26 | /// @author Christophe Riccio 27 | /// 28 | /// @see core (dependence) 29 | /// 30 | /// @defgroup gtx_extend GLM_GTX_scalar_relational 31 | /// @ingroup gtx 32 | /// 33 | /// @brief Extend a position from a source to a position at a defined length. 34 | /// 35 | /// need to be included to use these functionalities. 36 | /////////////////////////////////////////////////////////////////////////////////// 37 | 38 | #ifndef GLM_GTX_scalar_relational 39 | #define GLM_GTX_scalar_relational 40 | 41 | // Dependency: 42 | #include "../glm.hpp" 43 | 44 | #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED)) 45 | # pragma message("GLM: GLM_GTX_extend extension included") 46 | #endif 47 | 48 | namespace glm 49 | { 50 | /// @addtogroup gtx_scalar_relational 51 | /// @{ 52 | 53 | 54 | 55 | /// @} 56 | }//namespace glm 57 | 58 | #include "scalar_relational.inl" 59 | 60 | #endif//GLM_GTX_scalar_relational 61 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/scalar_relational.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2013-02-04 5 | // Updated : 2013-02-04 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/scalar_relational.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER bool lessThan 14 | ( 15 | T const & x, 16 | T const & y 17 | ) 18 | { 19 | return x < y; 20 | } 21 | 22 | template 23 | GLM_FUNC_QUALIFIER bool lessThanEqual 24 | ( 25 | T const & x, 26 | T const & y 27 | ) 28 | { 29 | return x <= y; 30 | } 31 | 32 | template 33 | GLM_FUNC_QUALIFIER bool greaterThan 34 | ( 35 | T const & x, 36 | T const & y 37 | ) 38 | { 39 | return x > y; 40 | } 41 | 42 | template 43 | GLM_FUNC_QUALIFIER bool greaterThanEqual 44 | ( 45 | T const & x, 46 | T const & y 47 | ) 48 | { 49 | return x >= y; 50 | } 51 | 52 | template 53 | GLM_FUNC_QUALIFIER bool equal 54 | ( 55 | T const & x, 56 | T const & y 57 | ) 58 | { 59 | return x == y; 60 | } 61 | 62 | template 63 | GLM_FUNC_QUALIFIER bool notEqual 64 | ( 65 | T const & x, 66 | T const & y 67 | ) 68 | { 69 | return x != y; 70 | } 71 | 72 | GLM_FUNC_QUALIFIER bool any 73 | ( 74 | bool const & x 75 | ) 76 | { 77 | return x; 78 | } 79 | 80 | GLM_FUNC_QUALIFIER bool all 81 | ( 82 | bool const & x 83 | ) 84 | { 85 | return x; 86 | } 87 | 88 | GLM_FUNC_QUALIFIER bool not_ 89 | ( 90 | bool const & x 91 | ) 92 | { 93 | return !x; 94 | } 95 | }//namespace glm 96 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/std_based_type.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2008-06-08 5 | // Updated : 2008-06-08 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/std_based_type.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/transform.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-21 5 | // Updated : 2009-04-29 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/transform.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | template 13 | GLM_FUNC_QUALIFIER detail::tmat4x4 translate( 14 | detail::tvec3 const & v) 15 | { 16 | return translate( 17 | detail::tmat4x4(1.0f), v); 18 | } 19 | 20 | template 21 | GLM_FUNC_QUALIFIER detail::tmat4x4 rotate( 22 | T angle, 23 | detail::tvec3 const & v) 24 | { 25 | return rotate( 26 | detail::tmat4x4(1), angle, v); 27 | } 28 | 29 | template 30 | GLM_FUNC_QUALIFIER detail::tmat4x4 scale( 31 | detail::tvec3 const & v) 32 | { 33 | return scale( 34 | detail::tmat4x4(1.0f), v); 35 | } 36 | 37 | }//namespace glm 38 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/ulp.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_ulp extension is deprecated, include GLM_GTC_ulp (glm/gtc/ulp.hpp) instead") 26 | #endif 27 | 28 | // Promoted: 29 | #include "../gtc/ulp.hpp" 30 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/unsigned_int.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /////////////////////////////////////////////////////////////////////////////////// 23 | 24 | #if(defined(GLM_MESSAGES)) 25 | # pragma message("GLM: GLM_GTX_unsigned_int extension is deprecated, include GLM_GTX_integer instead") 26 | #endif 27 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/unsigned_int.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 3 | /////////////////////////////////////////////////////////////////////////////////////////////////// 4 | // Created : 2005-12-24 5 | // Updated : 2008-10-07 6 | // Licence : This source is under MIT License 7 | // File : glm/gtx/unsigned_int.inl 8 | /////////////////////////////////////////////////////////////////////////////////////////////////// 9 | 10 | namespace glm 11 | { 12 | 13 | }//namespace glm 14 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/gtx/vec1.inl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref gtx_vec1 24 | /// @file glm/gtx/vec1.inl 25 | /// @date 2013-03-16 / 2013-03-16 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/integer.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/integer.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_INTEGER_INCLUDED 30 | #define GLM_INTEGER_INCLUDED 31 | 32 | #include "detail/func_integer.hpp" 33 | 34 | #endif//GLM_INTEGER_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/matrix.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/matrix.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_MATRIX_INCLUDED 30 | #define GLM_MATRIX_INCLUDED 31 | 32 | #include "detail/func_matrix.hpp" 33 | 34 | #endif//GLM_MATRIX_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/packing.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/packing.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_PACKING_INCLUDED 30 | #define GLM_PACKING_INCLUDED 31 | 32 | #include "detail/func_packing.hpp" 33 | 34 | #endif//GLM_PACKING_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/trigonometric.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/trigonometric.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_TRIGONOMETRIC_INCLUDED 30 | #define GLM_TRIGONOMETRIC_INCLUDED 31 | 32 | #include "detail/func_trigonometric.hpp" 33 | 34 | #endif//GLM_TRIGONOMETRIC_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/vec2.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec2.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC2_INCLUDED 30 | #define GLM_VEC2_INCLUDED 31 | 32 | #include "detail/type_vec2.hpp" 33 | 34 | #endif//GLM_VEC2_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/vec3.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec3.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC3_INCLUDED 30 | #define GLM_VEC3_INCLUDED 31 | 32 | #include "detail/type_vec3.hpp" 33 | 34 | #endif//GLM_VEC3_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/vec4.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vec4.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VEC4_INCLUDED 30 | #define GLM_VEC4_INCLUDED 31 | 32 | #include "detail/type_vec4.hpp" 33 | 34 | #endif//GLM_VEC4_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/utils/glm/vector_relational.hpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////// 2 | /// OpenGL Mathematics (glm.g-truc.net) 3 | /// 4 | /// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) 5 | /// Permission is hereby granted, free of charge, to any person obtaining a copy 6 | /// of this software and associated documentation files (the "Software"), to deal 7 | /// in the Software without restriction, including without limitation the rights 8 | /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | /// copies of the Software, and to permit persons to whom the Software is 10 | /// furnished to do so, subject to the following conditions: 11 | /// 12 | /// The above copyright notice and this permission notice shall be included in 13 | /// all copies or substantial portions of the Software. 14 | /// 15 | /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | /// THE SOFTWARE. 22 | /// 23 | /// @ref core 24 | /// @file glm/vector_relational.hpp 25 | /// @date 2013-12-24 / 2013-12-24 26 | /// @author Christophe Riccio 27 | /////////////////////////////////////////////////////////////////////////////////// 28 | 29 | #ifndef GLM_VECTOR_RELATIONAL_INCLUDED 30 | #define GLM_VECTOR_RELATIONAL_INCLUDED 31 | 32 | #include "detail/func_vector_relational.hpp" 33 | 34 | #endif//GLM_VECTOR_RELATIONAL_INCLUDED 35 | -------------------------------------------------------------------------------- /API-Samples/validation_cache/validation_cache.frag: -------------------------------------------------------------------------------- 1 | // The fragment shader contains a 32-bit integer constant (tweak_value) 2 | // which we can search for in the compiled SPIRV and replace with new 3 | // values to generate "different" shaders. 4 | #version 400 5 | #extension GL_ARB_separate_shader_objects : enable 6 | #extension GL_ARB_shading_language_420pack : enable 7 | const uint tweak_value = 0xdeadbeef; 8 | layout (binding = 1) uniform sampler2D tex; 9 | layout (location = 0) in vec2 texcoord; 10 | layout (location = 0) out vec4 outColor; 11 | void main() { 12 | outColor = textureLod(tex, texcoord, 0.0); 13 | outColor.a = float(tweak_value); 14 | } -------------------------------------------------------------------------------- /API-Samples/validation_cache/validation_cache.vert: -------------------------------------------------------------------------------- 1 | #version 400 2 | #extension GL_ARB_separate_shader_objects : enable 3 | #extension GL_ARB_shading_language_420pack : enable 4 | layout (std140, binding = 0) uniform buf { 5 | mat4 mvp; 6 | } ubuf; 7 | layout (location = 0) in vec4 pos; 8 | layout (location = 1) in vec2 inTexCoords; 9 | layout (location = 0) out vec2 texcoord; 10 | void main() { 11 | texcoord = inTexCoords; 12 | gl_Position = ubuf.mvp * pos; 13 | } 14 | -------------------------------------------------------------------------------- /README-contrib.md: -------------------------------------------------------------------------------- 1 | # Contributing Vulkan Samples 2 | Contributions to the Vulkan Samples Kit effort are encouraged! 3 | 4 | ## General Requirements 5 | - All contributions MUST have an Apache-style license. 6 | 7 | ## Procedure for Contributing 8 | 0. contact LunarG for access to the VulkanSamplesKit repository 9 | 1. clone the VulkanSamplesKit repository 10 | 2. create a new branch for your work 11 | 3. add contributions to your new branch 12 | 4. ensure the requirements in src/README.md are met and the branch builds 13 | 5. submit a pull/merge request for your branch 14 | 15 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/Hologram.frag: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | precision highp float; 4 | 5 | layout(location = 0) in vec3 color; 6 | layout(location = 1) in float alpha; 7 | 8 | layout(location = 0) out vec4 fragcolor; 9 | 10 | void main() 11 | { 12 | fragcolor = vec4(color, alpha); 13 | } 14 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/Hologram.push_constant.vert: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout(location = 0) in vec3 in_pos; 4 | layout(location = 1) in vec3 in_normal; 5 | 6 | layout(std140, push_constant) uniform param_block { 7 | vec3 light_pos; 8 | vec3 light_color; 9 | mat4 model; 10 | mat4 view_projection; 11 | float alpha; 12 | } params; 13 | 14 | layout(location = 0) out vec3 color; 15 | layout(location = 1) out float alpha; 16 | 17 | void main() 18 | { 19 | vec3 world_light = vec3(params.model * vec4(params.light_pos, 1.0)); 20 | vec3 world_pos = vec3(params.model * vec4(in_pos, 1.0)); 21 | vec3 world_normal = mat3(params.model) * in_normal; 22 | 23 | vec3 light_dir = world_light - world_pos; 24 | float brightness = dot(light_dir, world_normal) / length(light_dir) / length(world_normal); 25 | brightness = abs(brightness); 26 | 27 | gl_Position = params.view_projection * vec4(world_pos, 1.0); 28 | color = params.light_color * brightness; 29 | alpha = params.alpha; 30 | } 31 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/Hologram.vert: -------------------------------------------------------------------------------- 1 | #version 310 es 2 | 3 | layout(location = 0) in vec3 in_pos; 4 | layout(location = 1) in vec3 in_normal; 5 | 6 | layout(std140, set = 0, binding = 0) uniform param_block { 7 | vec3 light_pos; 8 | vec3 light_color; 9 | mat4 model; 10 | mat4 view_projection; 11 | float alpha; 12 | } params; 13 | 14 | layout(location = 0) out vec3 color; 15 | layout(location = 1) out float alpha; 16 | 17 | void main() 18 | { 19 | vec3 world_light = vec3(params.model * vec4(params.light_pos, 1.0)); 20 | vec3 world_pos = vec3(params.model * vec4(in_pos, 1.0)); 21 | vec3 world_normal = mat3(params.model) * in_normal; 22 | 23 | vec3 light_dir = world_light - world_pos; 24 | float brightness = dot(light_dir, world_normal) / length(light_dir) / length(world_normal); 25 | brightness = abs(brightness); 26 | 27 | gl_Position = params.view_projection * vec4(world_pos, 1.0); 28 | color = params.light_color * brightness; 29 | alpha = params.alpha; 30 | } 31 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/Main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Google, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include "Hologram.h" 21 | 22 | namespace { 23 | 24 | Game *create_game(const std::vector &args) { return new Hologram(args); } 25 | 26 | Game *create_game(int argc, char **argv) { 27 | std::vector args(argv, argv + argc); 28 | return create_game(args); 29 | } 30 | 31 | } // namespace 32 | 33 | #if defined(VK_USE_PLATFORM_XCB_KHR) 34 | 35 | #include "ShellXcb.h" 36 | 37 | int main(int argc, char **argv) { 38 | Game *game = create_game(argc, argv); 39 | { 40 | ShellXcb shell(*game); 41 | shell.run(); 42 | } 43 | delete game; 44 | 45 | return 0; 46 | } 47 | 48 | #elif defined(VK_USE_PLATFORM_WAYLAND_KHR) 49 | 50 | #include "ShellWayland.h" 51 | 52 | int main(int argc, char **argv) { 53 | Game *game = create_game(argc, argv); 54 | { 55 | ShellWayland shell(*game); 56 | shell.run(); 57 | } 58 | delete game; 59 | 60 | return 0; 61 | } 62 | 63 | #elif defined(VK_USE_PLATFORM_ANDROID_KHR) 64 | 65 | #include 66 | #include "ShellAndroid.h" 67 | 68 | void android_main(android_app *app) { 69 | Game *game = create_game(ShellAndroid::get_args(*app)); 70 | try { 71 | ShellAndroid shell(*app, *game); 72 | shell.run(); 73 | } catch (const std::runtime_error &e) { 74 | __android_log_print(ANDROID_LOG_ERROR, game->settings().name.c_str(), "%s", e.what()); 75 | } 76 | 77 | delete game; 78 | } 79 | 80 | #elif defined(VK_USE_PLATFORM_WIN32_KHR) 81 | 82 | #include "ShellWin32.h" 83 | 84 | int main(int argc, char **argv) { 85 | Game *game = create_game(argc, argv); 86 | { 87 | ShellWin32 shell(*game); 88 | shell.run(); 89 | } 90 | delete game; 91 | 92 | return 0; 93 | } 94 | 95 | #endif // VK_USE_PLATFORM_XCB_KHR 96 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/Meshes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Google, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef MESHES_H 18 | #define MESHES_H 19 | 20 | #include 21 | #include 22 | 23 | class Meshes { 24 | public: 25 | Meshes(VkDevice dev, const std::vector &mem_flags); 26 | ~Meshes(); 27 | 28 | const VkPipelineVertexInputStateCreateInfo &vertex_input_state() const { return vertex_input_state_; } 29 | const VkPipelineInputAssemblyStateCreateInfo &input_assembly_state() const { return input_assembly_state_; } 30 | 31 | enum Type { 32 | MESH_PYRAMID, 33 | MESH_ICOSPHERE, 34 | MESH_TEAPOT, 35 | 36 | MESH_COUNT, 37 | }; 38 | 39 | void cmd_bind_buffers(VkCommandBuffer cmd) const; 40 | void cmd_draw(VkCommandBuffer cmd, Type type) const; 41 | 42 | private: 43 | void allocate_resources(VkDeviceSize vb_size, VkDeviceSize ib_size, const std::vector &mem_flags); 44 | 45 | VkDevice dev_; 46 | 47 | VkVertexInputBindingDescription vertex_input_binding_; 48 | std::vector vertex_input_attrs_; 49 | VkPipelineVertexInputStateCreateInfo vertex_input_state_; 50 | VkPipelineInputAssemblyStateCreateInfo input_assembly_state_; 51 | VkIndexType index_type_; 52 | 53 | std::vector draw_commands_; 54 | 55 | VkBuffer vb_; 56 | VkBuffer ib_; 57 | VkDeviceMemory mem_; 58 | VkDeviceSize ib_mem_offset_; 59 | }; 60 | 61 | #endif // MESHES_H 62 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/README.md: -------------------------------------------------------------------------------- 1 | This demo demonstrates multi-thread command buffer recording. 2 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/ShellAndroid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Google, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SHELL_ANDROID_H 18 | #define SHELL_ANDROID_H 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | #include "Shell.h" 25 | 26 | class ShellAndroid : public Shell { 27 | public: 28 | static std::vector get_args(android_app &app); 29 | 30 | ShellAndroid(android_app &app, Game &game); 31 | ~ShellAndroid(); 32 | 33 | void log(LogPriority priority, const char *msg) const; 34 | 35 | void run(); 36 | void quit(); 37 | 38 | private: 39 | PFN_vkGetInstanceProcAddr load_vk(); 40 | bool can_present(VkPhysicalDevice phy, uint32_t queue_family) { return true; } 41 | 42 | VkSurfaceKHR create_surface(VkInstance instance); 43 | 44 | void on_app_cmd(int32_t cmd); 45 | int32_t on_input_event(const AInputEvent *event); 46 | 47 | static inline void on_app_cmd(android_app *app, int32_t cmd); 48 | static inline int32_t on_input_event(android_app *app, AInputEvent *event); 49 | 50 | android_app &app_; 51 | 52 | void *lib_handle_; 53 | }; 54 | 55 | void ShellAndroid::on_app_cmd(android_app *app, int32_t cmd) { 56 | auto android = reinterpret_cast(app->userData); 57 | android->on_app_cmd(cmd); 58 | } 59 | 60 | int32_t ShellAndroid::on_input_event(android_app *app, AInputEvent *event) { 61 | auto android = reinterpret_cast(app->userData); 62 | return android->on_input_event(event); 63 | } 64 | 65 | #endif // SHELL_ANDROID_H 66 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/ShellWin32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Google, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SHELL_WIN32_H 18 | #define SHELL_WIN32_H 19 | 20 | #include 21 | #include "Shell.h" 22 | 23 | class ShellWin32 : public Shell { 24 | public: 25 | ShellWin32(Game &game); 26 | ~ShellWin32(); 27 | 28 | void run(); 29 | void quit(); 30 | 31 | private: 32 | PFN_vkGetInstanceProcAddr load_vk(); 33 | bool can_present(VkPhysicalDevice phy, uint32_t queue_family); 34 | 35 | void create_window(); 36 | VkSurfaceKHR create_surface(VkInstance instance); 37 | 38 | static LRESULT CALLBACK window_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 39 | ShellWin32 *shell = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); 40 | 41 | // called from constructor, CreateWindowEx specifically. But why? 42 | if (!shell) return DefWindowProc(hwnd, uMsg, wParam, lParam); 43 | 44 | return shell->handle_message(uMsg, wParam, lParam); 45 | } 46 | LRESULT handle_message(UINT msg, WPARAM wparam, LPARAM lparam); 47 | 48 | HINSTANCE hinstance_; 49 | HWND hwnd_; 50 | 51 | HMODULE hmodule_; 52 | }; 53 | 54 | #endif // SHELL_WIN32_H 55 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/ShellXcb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Google, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SHELL_XCB_H 18 | #define SHELL_XCB_H 19 | 20 | #include 21 | #include "Shell.h" 22 | 23 | class ShellXcb : public Shell { 24 | public: 25 | ShellXcb(Game &game); 26 | ~ShellXcb(); 27 | 28 | void run(); 29 | void quit() { quit_ = true; } 30 | 31 | private: 32 | void init_connection(); 33 | 34 | PFN_vkGetInstanceProcAddr load_vk(); 35 | bool can_present(VkPhysicalDevice phy, uint32_t queue_family); 36 | 37 | void create_window(); 38 | VkSurfaceKHR create_surface(VkInstance instance); 39 | 40 | void handle_event(const xcb_generic_event_t *ev); 41 | void loop_wait(); 42 | void loop_poll(); 43 | 44 | xcb_connection_t *c_; 45 | xcb_screen_t *scr_; 46 | xcb_window_t win_; 47 | 48 | xcb_atom_t wm_protocols_; 49 | xcb_atom_t wm_delete_window_; 50 | 51 | void *lib_handle_; 52 | 53 | bool quit_; 54 | }; 55 | 56 | #endif // SHELL_XCB_H 57 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2017 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | cmake_minimum_required(VERSION 3.10.2) 18 | project(Hologram) 19 | 20 | get_filename_component(samplesDir "${CMAKE_SOURCE_DIR}/../../.." ABSOLUTE) 21 | set(hologramDir "${samplesDir}/Sample-Programs/Hologram") 22 | get_filename_component(glmDir "${samplesDir}/API-Samples/utils" ABSOLUTE) 23 | get_filename_component(vulkanDir "${samplesDir}/include" ABSOLUTE) 24 | 25 | # build native_app_glue as a static lib 26 | add_library(native_activity_glue STATIC 27 | ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) 28 | 29 | # Build application's shared lib 30 | set(CMAKE_CXX_FLAGS 31 | "${CMAKE_CXX_FLAGS} -std=c++11 -fexceptions -Wall \ 32 | -Wextra -Wno-unused-parameter \ 33 | -DVK_NO_PROTOTYPES -DVK_USE_PLATFORM_ANDROID_KHR \ 34 | -DGLM_FORCE_RADIANS") 35 | add_library(Hologram SHARED 36 | ${hologramDir}/Shell.cpp 37 | ${hologramDir}/ShellAndroid.cpp 38 | ${hologramDir}/Simulation.cpp 39 | ${hologramDir}/Meshes.cpp 40 | ${hologramDir}/Hologram.cpp 41 | ${hologramDir}/Main.cpp 42 | ${CMAKE_SOURCE_DIR}/src/main/jni/HelpersDispatchTable.cpp) 43 | 44 | target_include_directories(Hologram PRIVATE 45 | ${ANDROID_NDK}/sources/android/native_app_glue 46 | ${vulkanDir} 47 | ${glmDir} 48 | ${CMAKE_SOURCE_DIR}/src/main/jni) 49 | 50 | target_link_libraries(Hologram 51 | android 52 | log 53 | native_activity_glue) 54 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/build-and-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ -z "${ANDROID_SDK_HOME}" ]; 6 | then echo "Please set ANDROID_SDK_HOME, exiting"; exit; 7 | else echo "ANDROID_SDK_HOME is ${ANDROID_SDK_HOME}"; 8 | fi 9 | 10 | if [ -z "${ANDROID_NDK_HOME}" ]; 11 | then echo "Please set ANDROID_NDK_HOME, exiting"; exit; 12 | else echo "ANDROID_NDK_HOME is ${ANDROID_NDK_HOME}"; 13 | fi 14 | 15 | 16 | generate_local_properties() { 17 | : > local.properties 18 | echo "sdk.dir=${ANDROID_SDK_HOME}" >> local.properties 19 | echo "ndk.dir=${ANDROID_NDK_HOME}" >> local.properties 20 | } 21 | 22 | build() { 23 | ./gradlew build 24 | } 25 | 26 | install() { 27 | adb uninstall com.example.Hologram 28 | adb install build/outputs/apk/android-debug.apk 29 | } 30 | 31 | run() { 32 | adb shell am start com.example.Hologram/android.app.NativeActivity 33 | } 34 | 35 | generate_local_properties 36 | build 37 | install 38 | #run 39 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:2.3.0' 8 | } 9 | } 10 | 11 | apply plugin: 'com.android.application' 12 | 13 | android { 14 | compileSdkVersion 25 15 | buildToolsVersion "25.0.2" 16 | 17 | defaultConfig { 18 | applicationId "com.example.Hologram" 19 | minSdkVersion 23 20 | targetSdkVersion 23 21 | versionCode 1 22 | versionName "0.1" 23 | ndk { 24 | abiFilters 'armeabi-v7a', 'x86' 25 | } 26 | externalNativeBuild { 27 | cmake { 28 | arguments '-DANDROID_PLATFORM=android-23', 29 | '-DANDROID_STL=c++_static', 30 | '-DANDROID_TOOLCHAIN=clang' 31 | } 32 | } 33 | } 34 | externalNativeBuild { 35 | cmake { 36 | path 'CMakeLists.txt' 37 | } 38 | } 39 | buildTypes { 40 | release { 41 | ndk { 42 | debuggable true 43 | } 44 | minifyEnabled = false 45 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 46 | 'proguard-rules.pro' 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/Sample-Programs/Hologram/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 24 18:58:48 PDT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Sample-Programs/Hologram/android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hologram 4 | 5 | -------------------------------------------------------------------------------- /Vulkan_LogoBug_48px_Nov17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/Vulkan_LogoBug_48px_Nov17.png -------------------------------------------------------------------------------- /build_windows_samples_sdk.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | 3 | :: Specify UTF-8 for character encoding 4 | chcp 65001 5 | 6 | :: Check that cmake is configured 7 | where cmake.exe > nul 2>&1 8 | if not %errorlevel% equ 0 ( 9 | echo ERROR: CMake was not found. Please install CMake or put cmake.exe in your PATH. 10 | exit /b 1 11 | ) 12 | 13 | where msbuild.exe > nul 2>&1 14 | if not %errorlevel% equ 0 ( 15 | echo ERROR: MSBuild was not found. Please use a visual studio developer console, or put MSBuild.exe in your PATH. 16 | exit /b 1 17 | ) 18 | 19 | :: Get the version of msbuild 20 | set cmd="msbuild /version | findstr /rxc:"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"" 21 | for /f "tokens=1* delims=." %%i in ('%cmd%') do set msbuild_version=%%i 22 | if %msbuild_version% lss 14 ( 23 | echo ERROR: MSBuild must be at least version 14 ^(Visual Studio 2015^). Found version %msbuild_version%. 24 | exit /b 1 25 | ) 26 | set version_string=Visual Studio %msbuild_version% 27 | 28 | set START_DIR=%CD% 29 | cd %VULKAN_SDK% 30 | 31 | :: Build samples 32 | cd samples 33 | md build 34 | cd build 35 | cmake -G "%version_string%" -A x64 -DGLSLANG_INSTALL_DIR=%VULKAN_SDK% .. 36 | call msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Debug /verbosity:quiet 37 | call msbuild ALL_BUILD.vcxproj /p:Platform=x64 /p:Configuration=Release /verbosity:quiet 38 | 39 | cd %START_DIR% 40 | -------------------------------------------------------------------------------- /cmake/FindPCIAccess.cmake: -------------------------------------------------------------------------------- 1 | # - FindPCIAccess 2 | # 3 | # Copyright 2015 Valve Corporation 4 | 5 | find_package(PkgConfig) 6 | 7 | pkg_check_modules(PC_PCIACCESS QUIET pciaccess) 8 | 9 | find_path(PCIACCESS_INCLUDE_DIR NAMES pciaccess.h 10 | HINTS 11 | ${PC_PCIACCESS_INCLUDEDIR} 12 | ${PC_PCIACCESS_INCLUDE_DIRS} 13 | ) 14 | 15 | find_library(PCIACCESS_LIBRARY NAMES pciaccess 16 | HINTS 17 | ${PC_PCIACCESS_LIBDIR} 18 | ${PC_PCIACCESS_LIBRARY_DIRS} 19 | ) 20 | 21 | include(FindPackageHandleStandardArgs) 22 | find_package_handle_standard_args(PCIAccess DEFAULT_MSG 23 | PCIACCESS_INCLUDE_DIR PCIACCESS_LIBRARY) 24 | 25 | mark_as_advanced(PCIACCESS_INCLUDE_DIR PCIACCESS_LIBRARY) 26 | 27 | set(PCIACCESS_INCLUDE_DIRS ${PCIACCESS_INCLUDE_DIR}) 28 | set(PCIACCESS_LIBRARIES ${PCIACCESS_LIBRARY}) 29 | -------------------------------------------------------------------------------- /cmake/FindPthreadStubs.cmake: -------------------------------------------------------------------------------- 1 | # - FindPthreadStubs 2 | # 3 | # Copyright (C) 2015 Valve Corporation 4 | 5 | find_package(PkgConfig) 6 | 7 | pkg_check_modules(PC_PTHREADSTUBS QUIET pthread-stubs) 8 | 9 | include(FindPackageHandleStandardArgs) 10 | find_package_handle_standard_args(PthreadStubs DEFAULT_MSG 11 | PC_PTHREADSTUBS_FOUND) 12 | 13 | set(PTHREADSTUBS_INCLUDE_DIRS "") 14 | set(PTHREADSTUBS_LIBRARIES "") 15 | -------------------------------------------------------------------------------- /cmake/FindUDev.cmake: -------------------------------------------------------------------------------- 1 | # - FindUDev 2 | # 3 | # Copyright (C) 2015 Valve Corporation 4 | 5 | find_package(PkgConfig) 6 | 7 | pkg_check_modules(PC_LIBUDEV QUIET libudev) 8 | 9 | find_path(UDEV_INCLUDE_DIR NAMES libudev.h 10 | HINTS 11 | ${PC_LIBUDEV_INCLUDEDIR} 12 | ${PC_LIBUDEV_INCLUDE_DIRS} 13 | ) 14 | 15 | find_library(UDEV_LIBRARY NAMES udev 16 | HINTS 17 | ${PC_LIBUDEV_LIBDIR} 18 | ${PC_LIBUDEV_LIBRARY_DIRS} 19 | ) 20 | 21 | include(FindPackageHandleStandardArgs) 22 | find_package_handle_standard_args(UDev DEFAULT_MSG 23 | UDEV_INCLUDE_DIR UDEV_LIBRARY) 24 | 25 | mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIBRARY) 26 | 27 | set(UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR}) 28 | set(UDEV_LIBRARIES ${UDEV_LIBRARY}) 29 | -------------------------------------------------------------------------------- /cmake/FindValgrind.cmake: -------------------------------------------------------------------------------- 1 | # - FindValgrind 2 | # 3 | # Copyright (C) 2015 Valve Corporation 4 | 5 | find_package(PkgConfig) 6 | 7 | pkg_check_modules(PC_VALGRIND QUIET valgrind) 8 | 9 | find_path(VALGRIND_INCLUDE_DIR NAMES valgrind.h memcheck.h 10 | HINTS 11 | ${PC_VALGRIND_INCLUDEDIR} 12 | ${PC_VALGRIND_INCLUDE_DIRS} 13 | ) 14 | 15 | include(FindPackageHandleStandardArgs) 16 | find_package_handle_standard_args(Valgrind DEFAULT_MSG 17 | VALGRIND_INCLUDE_DIR) 18 | 19 | mark_as_advanced(VALGRIND_INCLUDE_DIR) 20 | 21 | set(VALGRIND_INCLUDE_DIRS ${VALGRIND_INCLUDE_DIR}) 22 | set(VALGRIND_LIBRARIES "") 23 | -------------------------------------------------------------------------------- /cmake/FindVulkan.cmake: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 | # file Copyright.txt or https://cmake.org/licensing for details. 3 | 4 | #.rst: 5 | # FindVulkan 6 | # ---------- 7 | # 8 | # Try to find Vulkan 9 | # 10 | # IMPORTED Targets 11 | # ^^^^^^^^^^^^^^^^ 12 | # 13 | # This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if 14 | # Vulkan has been found. 15 | # 16 | # Result Variables 17 | # ^^^^^^^^^^^^^^^^ 18 | # 19 | # This module defines the following variables:: 20 | # 21 | # Vulkan_FOUND - True if Vulkan was found 22 | # Vulkan_INCLUDE_DIRS - include directories for Vulkan 23 | # Vulkan_LIBRARIES - link against this library to use Vulkan 24 | # 25 | # The module will also define two cache variables:: 26 | # 27 | # Vulkan_INCLUDE_DIR - the Vulkan include directory 28 | # Vulkan_LIBRARY - the path to the Vulkan library 29 | # 30 | 31 | if(WIN32) 32 | find_path(Vulkan_INCLUDE_DIR 33 | NAMES vulkan/vulkan.h 34 | PATHS 35 | "$ENV{VULKAN_SDK}/Include" 36 | ) 37 | 38 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 39 | find_library(Vulkan_LIBRARY 40 | NAMES vulkan-1 41 | PATHS 42 | "$ENV{VULKAN_SDK}/Lib" 43 | "$ENV{VULKAN_SDK}/Bin" 44 | ) 45 | elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) 46 | find_library(Vulkan_LIBRARY 47 | NAMES vulkan-1 48 | PATHS 49 | "$ENV{VULKAN_SDK}/Lib32" 50 | "$ENV{VULKAN_SDK}/Bin32" 51 | NO_SYSTEM_ENVIRONMENT_PATH 52 | ) 53 | endif() 54 | else() 55 | find_path(Vulkan_INCLUDE_DIR 56 | NAMES vulkan/vulkan.h 57 | PATHS 58 | "$ENV{VULKAN_SDK}/include") 59 | find_library(Vulkan_LIBRARY 60 | NAMES vulkan 61 | PATHS 62 | "$ENV{VULKAN_SDK}/lib") 63 | endif() 64 | 65 | set(Vulkan_LIBRARIES ${Vulkan_LIBRARY}) 66 | set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR}) 67 | 68 | #include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) 69 | include(FindPackageHandleStandardArgs) 70 | find_package_handle_standard_args(Vulkan 71 | DEFAULT_MSG 72 | Vulkan_LIBRARY Vulkan_INCLUDE_DIR) 73 | 74 | mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY) 75 | 76 | if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan) 77 | add_library(Vulkan::Vulkan UNKNOWN IMPORTED) 78 | set_target_properties(Vulkan::Vulkan PROPERTIES 79 | IMPORTED_LOCATION "${Vulkan_LIBRARIES}" 80 | INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}") 81 | endif() 82 | -------------------------------------------------------------------------------- /cmake/FindX11_XCB.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libX11-xcb 2 | # Once done this will define 3 | # 4 | # X11_XCB_FOUND - system has libX11-xcb 5 | # X11_XCB_LIBRARIES - Link these to use libX11-xcb 6 | # X11_XCB_INCLUDE_DIR - the libX11-xcb include dir 7 | # X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb 8 | 9 | # Copyright (c) 2011 Fredrik Höglund 10 | # Copyright (c) 2008 Helio Chissini de Castro, 11 | # Copyright (c) 2007 Matthias Kretz, 12 | # 13 | # Redistribution and use is allowed according to the terms of the BSD license. 14 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 15 | 16 | IF (NOT WIN32) 17 | # use pkg-config to get the directories and then use these values 18 | # in the FIND_PATH() and FIND_LIBRARY() calls 19 | FIND_PACKAGE(PkgConfig) 20 | PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb) 21 | 22 | SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS}) 23 | 24 | FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS}) 25 | FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS}) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR) 29 | 30 | MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES) 31 | ENDIF (NOT WIN32) 32 | 33 | -------------------------------------------------------------------------------- /cmake/FindXCB.cmake: -------------------------------------------------------------------------------- 1 | # - FindXCB 2 | # 3 | # Copyright (C) 2015 Valve Corporation 4 | 5 | find_package(PkgConfig) 6 | 7 | if(NOT XCB_FIND_COMPONENTS) 8 | set(XCB_FIND_COMPONENTS xcb) 9 | endif() 10 | 11 | include(FindPackageHandleStandardArgs) 12 | set(XCB_FOUND true) 13 | set(XCB_INCLUDE_DIRS "") 14 | set(XCB_LIBRARIES "") 15 | foreach(comp ${XCB_FIND_COMPONENTS}) 16 | # component name 17 | string(TOUPPER ${comp} compname) 18 | string(REPLACE "-" "_" compname ${compname}) 19 | # header name 20 | string(REPLACE "xcb-" "" headername xcb/${comp}.h) 21 | # library name 22 | set(libname ${comp}) 23 | 24 | pkg_check_modules(PC_${comp} QUIET ${comp}) 25 | 26 | find_path(${compname}_INCLUDE_DIR NAMES ${headername} 27 | HINTS 28 | ${PC_${comp}_INCLUDEDIR} 29 | ${PC_${comp}_INCLUDE_DIRS} 30 | ) 31 | 32 | find_library(${compname}_LIBRARY NAMES ${libname} 33 | HINTS 34 | ${PC_${comp}_LIBDIR} 35 | ${PC_${comp}_LIBRARY_DIRS} 36 | ) 37 | 38 | find_package_handle_standard_args(${comp} 39 | FOUND_VAR ${comp}_FOUND 40 | REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY) 41 | mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY) 42 | 43 | list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR}) 44 | list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY}) 45 | 46 | if(NOT ${comp}_FOUND) 47 | set(XCB_FOUND false) 48 | endif() 49 | endforeach() 50 | 51 | list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) 52 | -------------------------------------------------------------------------------- /cmake/README.txt: -------------------------------------------------------------------------------- 1 | The following files are copied out of CMake 2.8. 2 | - FindImageMagick.cmake 3 | 4 | I have also copied the Copyright.txt file out of cmake and renamed it: 5 | - Copyright_cmake.txt 6 | 7 | All other files are created and/or maintained by either LunarG Inc or Valve Corporation. -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /external/x64/lib/vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/external/x64/lib/vulkan-1.lib -------------------------------------------------------------------------------- /external/x86/lib/vulkan-1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/external/x86/lib/vulkan-1.lib -------------------------------------------------------------------------------- /external_revisions/glslang_giturl: -------------------------------------------------------------------------------- 1 | https://github.com/KhronosGroup/glslang.git 2 | -------------------------------------------------------------------------------- /external_revisions/glslang_revision: -------------------------------------------------------------------------------- 1 | 2651ccaec8 2 | -------------------------------------------------------------------------------- /samples_images/CopyBlitImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/CopyBlitImage.png -------------------------------------------------------------------------------- /samples_images/Hologram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/Hologram.png -------------------------------------------------------------------------------- /samples_images/Overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/Overlay.png -------------------------------------------------------------------------------- /samples_images/cube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/cube.png -------------------------------------------------------------------------------- /samples_images/drawcube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/drawcube.png -------------------------------------------------------------------------------- /samples_images/drawsubpasses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/drawsubpasses.png -------------------------------------------------------------------------------- /samples_images/drawtexturedcube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/drawtexturedcube.png -------------------------------------------------------------------------------- /samples_images/dynamicuniform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/dynamicuniform.png -------------------------------------------------------------------------------- /samples_images/immutable_sampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/immutable_sampler.png -------------------------------------------------------------------------------- /samples_images/inputattachment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/inputattachment.png -------------------------------------------------------------------------------- /samples_images/memory_barriers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/memory_barriers.png -------------------------------------------------------------------------------- /samples_images/multiplesets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/multiplesets.png -------------------------------------------------------------------------------- /samples_images/multithreadedcmdbuf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/multithreadedcmdbuf.png -------------------------------------------------------------------------------- /samples_images/occlusionquery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/occlusionquery.png -------------------------------------------------------------------------------- /samples_images/pipeline_cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/pipeline_cache.png -------------------------------------------------------------------------------- /samples_images/push_constants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/push_constants.png -------------------------------------------------------------------------------- /samples_images/secondarycmd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/secondarycmd.png -------------------------------------------------------------------------------- /samples_images/separate_image_sampler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/separate_image_sampler.png -------------------------------------------------------------------------------- /samples_images/spirv_assembly.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/spirv_assembly.png -------------------------------------------------------------------------------- /samples_images/spirv_specialization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/spirv_specialization.png -------------------------------------------------------------------------------- /samples_images/template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/template.png -------------------------------------------------------------------------------- /samples_images/texelbuffer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunarG/VulkanSamples/08e87dc3194cfc15e49125f71592d8acff070ce4/samples_images/texelbuffer.png -------------------------------------------------------------------------------- /scripts/check_code_format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2017 Google Inc. 3 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Script to determine if source code in Pull Request is properly formatted. 17 | # Exits with non 0 exit code if formatting is needed. 18 | # 19 | # This script assumes to be invoked at the project root directory. 20 | 21 | RED='\033[0;31m' 22 | GREEN='\033[0;32m' 23 | NC='\033[0m' # No Color 24 | 25 | FILES_TO_CHECK=$(git diff --name-only master | grep -E ".*\.(cpp|cc|c\+\+|cxx|c|h|hpp)$") 26 | 27 | if [ -z "${FILES_TO_CHECK}" ]; then 28 | echo -e "${GREEN}No source code to check for formatting.${NC}" 29 | exit 0 30 | fi 31 | 32 | FORMAT_DIFF=$(git diff -U0 master -- ${FILES_TO_CHECK} | python ./scripts/clang-format-diff.py -p1 -style=file) 33 | 34 | if [ -z "${FORMAT_DIFF}" ]; then 35 | echo -e "${GREEN}All source code in PR properly formatted.${NC}" 36 | exit 0 37 | else 38 | echo -e "${RED}Found formatting errors!${NC}" 39 | echo "${FORMAT_DIFF}" 40 | exit 1 41 | fi 42 | -------------------------------------------------------------------------------- /scripts/known_good.json: -------------------------------------------------------------------------------- 1 | { 2 | "repos" : [ 3 | { 4 | "name" : "Vulkan-Headers", 5 | "url" : "https://github.com/KhronosGroup/Vulkan-Headers.git", 6 | "sub_dir" : "Vulkan-Headers", 7 | "build_dir" : "Vulkan-Headers/build", 8 | "install_dir" : "Vulkan-Headers/build/install", 9 | "commit" : "v1.2.170" 10 | }, 11 | { 12 | "name" : "Vulkan-Loader", 13 | "url" : "https://github.com/KhronosGroup/Vulkan-Loader.git", 14 | "sub_dir" : "Vulkan-Loader", 15 | "build_dir" : "Vulkan-Loader/build", 16 | "install_dir" : "Vulkan-Loader/build/install", 17 | "commit" : "v1.2.170", 18 | "deps" : [ 19 | { 20 | "var_name" : "VULKAN_HEADERS_INSTALL_DIR", 21 | "repo_name" : "Vulkan-Headers" 22 | } 23 | ], 24 | "cmake_options" : [ 25 | "-DBUILD_TESTS=NO" 26 | ], 27 | "build_platforms" : [ 28 | "linux", 29 | "darwin" 30 | ] 31 | } 32 | ], 33 | "install_names" : { 34 | "Vulkan-Headers" : "VULKAN_HEADERS_INSTALL_DIR", 35 | "Vulkan-Loader" : "VULKAN_LOADER_INSTALL_DIR" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /update_external_sources.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set errorCode=0 4 | set BUILD_DIR=%~dp0 5 | 6 | set BASE_DIR="%BUILD_DIR%submodules" 7 | set V_LVL_DIR=%BASE_DIR%\Vulkan-LoaderAndValidationLayers 8 | 9 | git submodule update --init --recursive 10 | 11 | :build_lvl 12 | echo. 13 | echo Setting Up %V_LVL_DIR% 14 | cd "%V_LVL_DIR%" 15 | call .\update_external_sources.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 -------------------------------------------------------------------------------- /update_external_sources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Update source for glslang 3 | 4 | set -e 5 | 6 | if [[ $(uname) == "Linux" || $(uname) =~ "CYGWIN" ]]; then 7 | CURRENT_DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")" 8 | CORE_COUNT=$(nproc || echo 4) 9 | elif [[ $(uname) == "Darwin" ]]; then 10 | CURRENT_DIR="$(dirname "$(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' ${BASH_SOURCE[0]})")" 11 | CORE_COUNT=$(sysctl -n hw.ncpu || echo 4) 12 | fi 13 | echo CURRENT_DIR=$CURRENT_DIR 14 | echo CORE_COUNT=$CORE_COUNT 15 | 16 | BUILDDIR=${CURRENT_DIR} 17 | BASEDIR="$BUILDDIR/submodules" 18 | 19 | git submodule update --init --recursive 20 | 21 | echo "Running LVL update external sources" 22 | cd ${BASEDIR}/Vulkan-LoaderAndValidationLayers 23 | ./update_external_sources.sh "$@" --------------------------------------------------------------------------------