├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── build_linux_vulkan_debug.sh ├── build_linux_vulkan_release.sh ├── cmake └── modules │ ├── FindD3D11.cmake │ └── FindD3D12.cmake ├── include └── Renderer │ ├── GpuProfiler.h │ ├── IRay.h │ ├── IRenderer.h │ ├── IShaderReflection.h │ ├── Image │ ├── Image.h │ └── ImageEnums.h │ ├── Interfaces │ ├── IApp.h │ ├── IFileSystem.h │ ├── ILog.h │ ├── IMemory.h │ ├── IMiddleware.h │ ├── IOperatingSystem.h │ ├── IPlatformEvents.h │ ├── IProfiler.h │ ├── IThread.h │ └── ITime.h │ └── ResourceLoader.h ├── src ├── Examples │ ├── 01_Transformations │ │ ├── 01_Transformations.cpp │ │ ├── GPUCfg │ │ │ └── gpu.cfg │ │ └── Shaders │ │ │ ├── D3D11 │ │ │ ├── basic.frag │ │ │ ├── basic.vert │ │ │ ├── profile.frag │ │ │ ├── profile.vert │ │ │ ├── skybox.frag │ │ │ └── skybox.vert │ │ │ ├── D3D12 │ │ │ ├── basic.frag │ │ │ ├── basic.vert │ │ │ ├── profile.frag │ │ │ ├── profile.vert │ │ │ ├── skybox.frag │ │ │ └── skybox.vert │ │ │ ├── Metal │ │ │ ├── basic.frag.metal │ │ │ ├── basic.vert.metal │ │ │ ├── profile.frag.metal │ │ │ ├── profile.vert.metal │ │ │ ├── skybox.frag.metal │ │ │ └── skybox.vert.metal │ │ │ └── Vulkan │ │ │ ├── Binary │ │ │ ├── basic.frag.bin │ │ │ ├── basic.vert.bin │ │ │ ├── skybox.frag.bin │ │ │ └── skybox.vert.bin │ │ │ ├── basic.frag │ │ │ ├── basic.vert │ │ │ ├── profile.frag │ │ │ ├── profile.vert │ │ │ ├── skybox.frag │ │ │ └── skybox.vert │ ├── Camera │ │ ├── FpsCameraController.cpp │ │ ├── GuiCameraController.cpp │ │ └── Interfaces │ │ │ └── ICameraController.h │ ├── Input │ │ ├── InputMappings.h │ │ ├── InputSystem.cpp │ │ └── InputSystem.h │ └── UnitTestResources │ │ ├── Fonts │ │ └── TitilliumText │ │ │ ├── OFL.txt │ │ │ └── TitilliumText-Bold.otf │ │ └── Textures │ │ ├── Skybox_back6.dds │ │ ├── Skybox_back6.ktx │ │ ├── Skybox_bottom4.dds │ │ ├── Skybox_bottom4.ktx │ │ ├── Skybox_front5.dds │ │ ├── Skybox_front5.ktx │ │ ├── Skybox_left2.dds │ │ ├── Skybox_left2.ktx │ │ ├── Skybox_right1.dds │ │ ├── Skybox_right1.ktx │ │ ├── Skybox_top3.dds │ │ └── Skybox_top3.ktx ├── Middleware │ ├── Text │ │ ├── Fontstash.cpp │ │ ├── Fontstash.h │ │ └── Shaders │ │ │ ├── D3D11 │ │ │ ├── fontstash.frag │ │ │ ├── fontstash2D.vert │ │ │ └── fontstash3D.vert │ │ │ ├── D3D12 │ │ │ ├── fontstash.frag │ │ │ ├── fontstash2D.vert │ │ │ └── fontstash3D.vert │ │ │ ├── Metal │ │ │ ├── fontstash.frag.metal │ │ │ ├── fontstash2D.vert.metal │ │ │ └── fontstash3D.vert.metal │ │ │ └── Vulkan │ │ │ ├── fontstash.frag │ │ │ ├── fontstash2D.vert │ │ │ └── fontstash3D.vert │ └── UI │ │ ├── AppUI.cpp │ │ ├── AppUI.h │ │ ├── ImguiGUIDriver.cpp │ │ ├── Shaders │ │ ├── D3D11 │ │ │ ├── imgui.frag │ │ │ ├── imgui.vert │ │ │ ├── textured_mesh.frag │ │ │ └── textured_mesh.vert │ │ ├── D3D12 │ │ │ ├── imgui.frag │ │ │ ├── imgui.vert │ │ │ ├── textured_mesh.frag │ │ │ └── textured_mesh.vert │ │ ├── Metal │ │ │ ├── imgui.frag.metal │ │ │ ├── imgui.vert.metal │ │ │ ├── textured_mesh.frag.metal │ │ │ └── textured_mesh.vert.metal │ │ └── Vulkan │ │ │ ├── imgui.frag │ │ │ ├── imgui.vert │ │ │ ├── textured_mesh.frag │ │ │ └── textured_mesh.vert │ │ ├── imgui_user.cpp │ │ └── imgui_user.h ├── OS │ ├── Android │ │ ├── AndroidBase.cpp │ │ ├── AndroidFileSystem.cpp │ │ ├── AndroidLog.cpp │ │ ├── AndroidThread.cpp │ │ ├── AndroidTime.cpp │ │ └── Google Android Studio Setup.txt │ ├── Core │ │ ├── Atomics.h │ │ ├── Compiler.h │ │ ├── DLL.h │ │ ├── FileSystem.cpp │ │ ├── GPUConfig.h │ │ ├── PlatformEvents.cpp │ │ ├── RingBuffer.h │ │ ├── ThreadSystem.cpp │ │ ├── ThreadSystem.h │ │ └── Timer.cpp │ ├── Image │ │ └── Image.cpp │ ├── Linux │ │ ├── LinuxBase.cpp │ │ ├── LinuxFileSystem.cpp │ │ ├── LinuxLog.cpp │ │ ├── LinuxThread.cpp │ │ └── LinuxTime.cpp │ ├── Logging │ │ ├── Log.cpp │ │ └── Log.h │ ├── Math │ │ └── MathTypes.h │ ├── MemoryTracking │ │ ├── MemoryTracking.cpp │ │ └── NoMemoryDefines.h │ ├── Windows │ │ ├── WindowsBase.cpp │ │ ├── WindowsFileSystem.cpp │ │ ├── WindowsLog.cpp │ │ ├── WindowsThread.cpp │ │ └── WindowsTime.cpp │ ├── iOS │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── iOSBase.cpp │ │ ├── iOSBase.mm │ │ ├── iOSFileSystem.mm │ │ ├── iOSLog.cpp │ │ └── iOSThread.cpp │ └── macOS │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── macOSBase.mm │ │ ├── macOSFileSystem.mm │ │ ├── macOSLog.cpp │ │ └── macOSThread.cpp ├── Renderer │ ├── CommonShaderReflection.cpp │ ├── Direct3D11 │ │ ├── Direct3D11.cpp │ │ ├── Direct3D11Commands.h │ │ ├── Direct3D11Raytracing.cpp │ │ └── Direct3D11ShaderReflection.cpp │ ├── Direct3D12 │ │ ├── Direct3D12.cpp │ │ ├── Direct3D12Hooks.cpp │ │ ├── Direct3D12Hooks.h │ │ ├── Direct3D12MemoryAllocator.cpp │ │ ├── Direct3D12MemoryAllocator.h │ │ ├── Direct3D12Raytracing.cpp │ │ └── Direct3D12ShaderReflection.cpp │ ├── GpuProfiler.cpp │ ├── Metal │ │ ├── MetalMemoryAllocator.h │ │ ├── MetalRaytracing.mm │ │ ├── MetalRenderer.mm │ │ └── MetalShaderReflection.mm │ ├── ResourceLoader.cpp │ └── Vulkan │ │ ├── Vulkan.cpp │ │ ├── VulkanRaytracing.cpp │ │ └── VulkanShaderReflection.cpp └── Tools │ └── SpirvTools │ ├── SpirvTools.cpp │ ├── SpirvTools.h │ └── dllmain.cpp └── third_party ├── DirectXShaderCompiler ├── dxcapi.h └── dxcapi.use.h ├── EASTL ├── .clang-format ├── 3RDPARTYLICENSES.TXT ├── CONTRIBUTING.md ├── EAAssert │ └── eaassert.h ├── EABase │ ├── .gitignore │ ├── config │ │ ├── eacompiler.h │ │ ├── eacompilertraits.h │ │ └── eaplatform.h │ ├── eabase.h │ ├── eahave.h │ ├── earesult.h │ ├── eastdarg.h │ ├── eaunits.h │ ├── int128.h │ ├── nullptr.h │ └── version.h ├── EASTL.natvis ├── EAStdC │ ├── EAAlignment.h │ ├── EADateTime.h │ ├── EAMemory.cpp │ ├── EAMemory.h │ ├── EAProcess.h │ ├── EASprintf.cpp │ ├── EASprintf.h │ ├── EAStopwatch.h │ ├── EAString.h │ └── EATextUtil.h ├── LICENSE ├── Linux │ └── EASTL.project ├── README.md ├── algorithm.h ├── allocator.h ├── allocator_eastl.cpp ├── allocator_forge.cpp ├── allocator_forge.h ├── allocator_malloc.h ├── any.h ├── array.h ├── assert.cpp ├── bitset.h ├── bitvector.h ├── bonus │ ├── adaptors.h │ ├── call_traits.h │ ├── compressed_pair.h │ ├── fixed_ring_buffer.h │ ├── fixed_tuple_vector.h │ ├── intrusive_sdlist.h │ ├── intrusive_slist.h │ ├── list_map.h │ ├── lru_cache.h │ ├── ring_buffer.h │ ├── sort_extra.h │ ├── sparse_matrix.h │ └── tuple_vector.h ├── chrono.h ├── core_allocator.h ├── core_allocator_adapter.h ├── deque.h ├── fixed_allocator.h ├── fixed_function.h ├── fixed_hash_map.h ├── fixed_hash_set.h ├── fixed_list.h ├── fixed_map.h ├── fixed_pool.cpp ├── fixed_set.h ├── fixed_slist.h ├── fixed_string.h ├── fixed_substring.h ├── fixed_vector.h ├── functional.h ├── hash_map.h ├── hash_set.h ├── hashtable.cpp ├── heap.h ├── initializer_list.h ├── internal │ ├── allocator_traits.h │ ├── allocator_traits_fwd_decls.h │ ├── char_traits.h │ ├── config.h │ ├── copy_help.h │ ├── enable_shared.h │ ├── fill_help.h │ ├── fixed_pool.h │ ├── function.h │ ├── function_detail.h │ ├── function_help.h │ ├── functional_base.h │ ├── generic_iterator.h │ ├── hashtable.h │ ├── in_place_t.h │ ├── integer_sequence.h │ ├── intrusive_hashtable.h │ ├── mem_fn.h │ ├── memory_base.h │ ├── meta.h │ ├── move_help.h │ ├── pair_fwd_decls.h │ ├── piecewise_construct_t.h │ ├── red_black_tree.h │ ├── smart_ptr.h │ ├── thread_support.h │ ├── tuple_fwd_decls.h │ ├── type_compound.h │ ├── type_fundamental.h │ ├── type_pod.h │ ├── type_properties.h │ └── type_transformations.h ├── intrusive_hash_map.h ├── intrusive_hash_set.h ├── intrusive_list.cpp ├── intrusive_list.h ├── intrusive_ptr.h ├── iterator.h ├── linked_array.h ├── linked_ptr.h ├── list.h ├── map.h ├── memory.h ├── meta.h ├── numeric.h ├── numeric_limits.cpp ├── numeric_limits.h ├── optional.h ├── priority_queue.h ├── queue.h ├── random.h ├── ratio.h ├── red_black_tree.cpp ├── safe_ptr.h ├── scoped_array.h ├── scoped_ptr.h ├── segmented_vector.h ├── set.h ├── shared_array.h ├── shared_ptr.h ├── slist.h ├── sort.h ├── span.h ├── stack.h ├── string.cpp ├── string.h ├── string_hash_map.h ├── string_map.h ├── string_view.h ├── thread_support.cpp ├── tuple.h ├── type_traits.h ├── unique_ptr.h ├── unordered_map.h ├── unordered_set.h ├── utility.h ├── variant.h ├── vector.h ├── vector_map.h ├── vector_multimap.h ├── vector_multiset.h ├── vector_set.h ├── version.h └── weak_ptr.h ├── FluidStudios └── MemoryManager │ ├── mmgr.cpp │ ├── mmgr.h │ ├── nommgr.h │ └── readme.txt ├── Fontstash ├── LICENSE.txt ├── README.md ├── example │ ├── error.c │ └── example.c └── src │ ├── fontstash.h │ ├── gl3corefontstash.h │ ├── glfontstash.h │ └── stb_truetype.h ├── MicroProfile ├── Profiler.cpp ├── ProfilerBase.cpp ├── ProfilerBase.h ├── ProfilerDraw.cpp ├── ProfilerHTML.h ├── ProfilerInput.cpp ├── ProfilerUI.cpp ├── ProfilerUI.h └── README.txt ├── ModifiedSonyMath ├── LICENSE.txt ├── README.md ├── common.hpp ├── neon │ ├── boolinvec.hpp │ ├── floatinvec.hpp │ ├── internal.hpp │ ├── matrix.hpp │ ├── quaternion.hpp │ ├── sse2neon.h │ ├── vecidx.hpp │ ├── vector.hpp │ └── vectormath.hpp ├── scalar │ ├── matrix.hpp │ ├── quaternion.hpp │ ├── vector.hpp │ └── vectormath.hpp ├── soa │ ├── float.hpp │ ├── float4x4.hpp │ ├── quaternion.hpp │ ├── soa.hpp │ └── transform.hpp ├── sse │ ├── boolinvec.hpp │ ├── floatinvec.hpp │ ├── internal.hpp │ ├── matrix.hpp │ ├── quaternion.hpp │ ├── vecidx.hpp │ ├── vector.hpp │ └── vectormath.hpp ├── vec2d.hpp └── vectormath.hpp ├── Nothings ├── stb_hash.h ├── stb_image.h ├── stb_image_resize.h ├── stb_image_write.h ├── stb_rect_pack.h ├── stb_textedit.h └── stb_truetype.h ├── SPIRV_Cross ├── GLSL.std.450.h ├── LICENSE ├── README.md ├── spirv.h ├── spirv.hpp ├── spirv_cfg.cpp ├── spirv_cfg.hpp ├── spirv_common.hpp ├── spirv_cpp.cpp ├── spirv_cpp.hpp ├── spirv_cross.cpp ├── spirv_cross.hpp ├── spirv_cross_containers.hpp ├── spirv_cross_error_handling.hpp ├── spirv_cross_parsed_ir.cpp ├── spirv_cross_parsed_ir.hpp ├── spirv_cross_util.cpp ├── spirv_cross_util.hpp ├── spirv_glsl.cpp ├── spirv_glsl.hpp ├── spirv_hlsl.cpp ├── spirv_hlsl.hpp ├── spirv_msl.cpp ├── spirv_msl.hpp ├── spirv_parser.cpp ├── spirv_parser.hpp ├── spirv_reflect.cpp └── spirv_reflect.hpp ├── TinyEXR ├── LICENSE ├── tinyexr.cpp └── tinyexr.h ├── VulkanMemoryAllocator └── VulkanMemoryAllocator.h ├── gainput ├── .appveyor.yml ├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── Doxyfile ├── LICENSE ├── README.md ├── build.gradle ├── extern │ ├── catch │ │ └── catch.hpp │ └── cmake │ │ ├── AndroidNdkModules.cmake │ │ ├── android.toolchain.cmake │ │ └── iOS.cmake └── lib │ ├── CMakeLists.txt │ ├── include │ └── gainput │ │ ├── GainputAllocator.h │ │ ├── GainputContainers.h │ │ ├── GainputDebugRenderer.h │ │ ├── GainputHelpers.h │ │ ├── GainputInputDeltaState.h │ │ ├── GainputInputDevice.h │ │ ├── GainputInputDeviceBuiltIn.h │ │ ├── GainputInputDeviceKeyboard.h │ │ ├── GainputInputDeviceMouse.h │ │ ├── GainputInputDevicePad.h │ │ ├── GainputInputDeviceTouch.h │ │ ├── GainputInputListener.h │ │ ├── GainputInputManager.h │ │ ├── GainputInputMap.h │ │ ├── GainputInputState.h │ │ ├── GainputIos.h │ │ ├── GainputLog.h │ │ ├── GainputMac.h │ │ ├── GainputMapFilters.h │ │ ├── gainput.h │ │ ├── gestures │ │ ├── GainputButtonStickGesture.h │ │ ├── GainputDoubleClickGesture.h │ │ ├── GainputGestures.h │ │ ├── GainputHoldGesture.h │ │ ├── GainputPinchGesture.h │ │ ├── GainputRotateGesture.h │ │ ├── GainputSimultaneouslyDownGesture.h │ │ └── GainputTapGesture.h │ │ └── recorder │ │ ├── GainputInputPlayer.h │ │ ├── GainputInputRecorder.h │ │ └── GainputInputRecording.h │ ├── java │ ├── com │ │ └── example │ │ │ └── gainput │ │ │ └── gainput │ │ │ └── BasicActivity.java │ └── de │ │ └── johanneskuhlmann │ │ └── gainput │ │ └── Gainput.java │ └── source │ └── gainput │ ├── GainputAllocator.cpp │ ├── GainputHelpersEvdev.h │ ├── GainputInputDeltaState.cpp │ ├── GainputInputDevice.cpp │ ├── GainputInputManager.cpp │ ├── GainputInputMap.cpp │ ├── GainputInputState.cpp │ ├── GainputIos.mm │ ├── GainputMac.mm │ ├── GainputMapFilters.cpp │ ├── GainputWindows.h │ ├── builtin │ ├── GainputInputDeviceBuiltIn.cpp │ ├── GainputInputDeviceBuiltInAndroid.h │ ├── GainputInputDeviceBuiltInImpl.h │ ├── GainputInputDeviceBuiltInIos.h │ ├── GainputInputDeviceBuiltInIos.mm │ └── GainputInputDeviceBuiltInNull.h │ ├── dev │ ├── GainputDev.cpp │ ├── GainputDev.h │ ├── GainputDevProtocol.h │ ├── GainputMemoryStream.cpp │ ├── GainputMemoryStream.h │ ├── GainputNetAddress.cpp │ ├── GainputNetAddress.h │ ├── GainputNetConnection.cpp │ ├── GainputNetConnection.h │ ├── GainputNetListener.cpp │ ├── GainputNetListener.h │ └── GainputStream.h │ ├── gainput.cpp │ ├── gestures │ ├── GainputButtonStickGesture.cpp │ ├── GainputDoubleClickGesture.cpp │ ├── GainputHoldGesture.cpp │ ├── GainputPinchGesture.cpp │ ├── GainputRotateGesture.cpp │ ├── GainputSimultaneouslyDownGesture.cpp │ └── GainputTapGesture.cpp │ ├── keyboard │ ├── GainputInputDeviceKeyboard.cpp │ ├── GainputInputDeviceKeyboardAndroid.h │ ├── GainputInputDeviceKeyboardEvdev.h │ ├── GainputInputDeviceKeyboardIOS.h │ ├── GainputInputDeviceKeyboardImpl.h │ ├── GainputInputDeviceKeyboardLinux.h │ ├── GainputInputDeviceKeyboardMac.cpp │ ├── GainputInputDeviceKeyboardMac.h │ ├── GainputInputDeviceKeyboardNull.h │ ├── GainputInputDeviceKeyboardWin.h │ ├── GainputInputDeviceKeyboardWinRaw.h │ └── GainputKeyboardKeyNames.h │ ├── mouse │ ├── GainputInputDeviceMouse.cpp │ ├── GainputInputDeviceMouseEvdev.h │ ├── GainputInputDeviceMouseImpl.h │ ├── GainputInputDeviceMouseLinux.h │ ├── GainputInputDeviceMouseLinuxRaw.h │ ├── GainputInputDeviceMouseMac.h │ ├── GainputInputDeviceMouseMac.mm │ ├── GainputInputDeviceMouseMacRaw.h │ ├── GainputInputDeviceMouseMacRaw.mm │ ├── GainputInputDeviceMouseNull.h │ ├── GainputInputDeviceMouseWin.h │ ├── GainputInputDeviceMouseWinRaw.h │ └── GainputMouseInfo.h │ ├── pad │ ├── GainputInputDevicePad.cpp │ ├── GainputInputDevicePadAndroid.h │ ├── GainputInputDevicePadImpl.h │ ├── GainputInputDevicePadIos.h │ ├── GainputInputDevicePadIos.mm │ ├── GainputInputDevicePadLinux.h │ ├── GainputInputDevicePadMac.cpp │ ├── GainputInputDevicePadMac.h │ ├── GainputInputDevicePadNull.h │ └── GainputInputDevicePadWin.h │ ├── recorder │ ├── GainputInputPlayer.cpp │ ├── GainputInputRecorder.cpp │ └── GainputInputRecording.cpp │ └── touch │ ├── GainputInputDeviceTouch.cpp │ ├── GainputInputDeviceTouchAndroid.h │ ├── GainputInputDeviceTouchImpl.h │ ├── GainputInputDeviceTouchIos.h │ ├── GainputInputDeviceTouchNull.h │ └── GainputTouchInfo.h ├── imgui ├── LICENSE.txt ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_internal.h └── imgui_widgets.cpp ├── renderdoc └── renderdoc_app.h ├── volk ├── README.md ├── generate.py ├── volk.c └── volk.h └── winpixeventruntime ├── Include └── WinPixEventRuntime │ ├── PIXEventsCommon.h │ ├── PIXEventsGenerated.h │ ├── pix3.h │ └── pix3_win.h ├── ThirdPartyNotices.txt ├── WinPixEventRuntime.nuspec ├── [Content_Types].xml ├── _rels └── .rels ├── bin ├── WinPixEventRuntime.dll ├── WinPixEventRuntime.lib ├── WinPixEventRuntime_UAP.dll └── WinPixEventRuntime_UAP.lib └── package └── services └── metadata └── core-properties └── 275b2a06678f4be98fcb5edae6a2f3fb.psmdcp /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | install 3 | .vscode 4 | .directory 5 | *.config 6 | *.creator 7 | *.creator.user 8 | *.files 9 | *.includes -------------------------------------------------------------------------------- /build_linux_vulkan_debug.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set echo off 4 | 5 | cmake -E make_directory build/linux_debug 6 | cd build/linux_debug 7 | cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_VULKAN=1 -DBUILD_LINUX=1 -DBUILD_SPIRV_CROSS=1 -DUSE_MEMORY_TRACKING=0 -DUSE_PROFILER=1 -DBUILD_EXAMPLES=1 -DCMAKE_INSTALL_PREFIX=../../install/linux_debug $@ ../.. 8 | make -j `getconf _NPROCESSORS_ONLN` 9 | make install 10 | 11 | set echo on 12 | -------------------------------------------------------------------------------- /build_linux_vulkan_release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set echo off 4 | 5 | cmake -E make_directory build/linux_release 6 | cd build/linux_release 7 | cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_VULKAN=1 -DBUILD_LINUX=1 -DBUILD_SPIRV_CROSS=1 -DUSE_MEMORY_TRACKING=0 -DBUILD_EXAMPLES=1 -DCMAKE_INSTALL_PREFIX=../../install/linux_release $@ ../.. 8 | make -j `getconf _NPROCESSORS_ONLN` 9 | make install 10 | 11 | set echo on 12 | -------------------------------------------------------------------------------- /include/Renderer/Interfaces/IMiddleware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | struct Renderer; 28 | struct RenderTarget; 29 | struct Cmd; 30 | 31 | class IMiddleware 32 | { 33 | public: 34 | // Our init function should only be called once 35 | // The middleware has to keep these pointers 36 | virtual bool Init(Renderer* renderer) = 0; 37 | virtual void Exit() = 0; 38 | 39 | // When app is loaded, app is provided of the render targets to load 40 | // App is responsible to keep track of these render targets until load is called again 41 | virtual bool Load(RenderTarget** rts) = 0; 42 | virtual void Unload() = 0; 43 | 44 | virtual void Update(float deltaTime) = 0; 45 | virtual void Draw(Cmd* cmd) = 0; 46 | }; -------------------------------------------------------------------------------- /include/Renderer/Interfaces/IPlatformEvents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #pragma once 26 | #include "Interfaces/IOperatingSystem.h" 27 | 28 | #if defined(_APPLE_) 29 | typedef struct tagRECT 30 | { 31 | long left; 32 | long top; 33 | long right; 34 | long bottom; 35 | } RECT, *PRECT; 36 | #endif 37 | 38 | typedef struct WindowResizeEventData 39 | { 40 | RectDesc rect; 41 | struct WindowsDesc* pWindow; 42 | } WindowResizeEventData; 43 | 44 | typedef void (*WindowResizeEventHandler)(const WindowResizeEventData* data); 45 | void registerWindowResizeEvent(WindowResizeEventHandler callback); 46 | void unregisterWindowResizeEvent(WindowResizeEventHandler callback); 47 | 48 | bool requestMouseCapture(bool allowCapture); 49 | -------------------------------------------------------------------------------- /include/Renderer/Interfaces/IProfiler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined(ENABLE_RENDERER_RUNTIME_SWITCH) 4 | #ifndef PROFILE_ENABLED 5 | #define PROFILE_ENABLED 0 6 | #endif 7 | #else 8 | #ifndef PROFILE_ENABLED 9 | #define PROFILE_ENABLED 1 10 | #endif 11 | #endif 12 | 13 | #if (PROFILE_ENABLED) 14 | 15 | #ifndef PROFILE_WEBSERVER 16 | #define PROFILE_WEBSERVER 0 // Enable this if you want to have the profiler through a web browser 17 | #endif 18 | 19 | #endif 20 | 21 | #include 22 | 23 | struct Cmd; 24 | struct GpuProfiler; 25 | struct Renderer; 26 | struct GpuTimer; 27 | struct SwapChain; 28 | 29 | // Call on application initialize to generate the resources needed for UI drawing 30 | // Must be called before adding any GpuProfiler 31 | void initProfiler(Renderer * pRenderer, int image_count); 32 | 33 | // Call on application initialize for Profiler's UI input handling 34 | // To modify inputs go to file /Common_3/ThirdParty/OpenSource/MicroProfile/ProfilerInput.cpp 35 | void profileRegisterInput(); 36 | 37 | // Call on application exit to release resources needed for UI drawing 38 | void exitProfiler(Renderer * pRenderer); 39 | 40 | // Call once per frame to update profiler, ideally after presenting the frame so GPU timestamps are as accurate as possible 41 | void flipProfiler(); 42 | 43 | // Call once per frame to draw UI 44 | void cmdDrawProfiler(Cmd * pCmd, uint32_t Width, uint32_t Height); 45 | 46 | // Check this file for how to CPU profile 47 | #include "MicroProfile/ProfilerBase.h" 48 | 49 | // Check this file for how to GPU profile 50 | #include "Renderer/GpuProfiler.h" 51 | -------------------------------------------------------------------------------- /include/Renderer/Interfaces/ITime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | #include "stdint.h" 28 | 29 | // High res timer functions 30 | int64_t getUSec(); 31 | int64_t getTimerFrequency(); 32 | 33 | // Time related functions 34 | uint32_t getSystemTime(); 35 | uint32_t getTimeSinceStart(); 36 | 37 | /// Low res OS timer 38 | class Timer 39 | { 40 | public: 41 | Timer(); 42 | uint32_t GetMSec(bool reset); 43 | void Reset(); 44 | 45 | private: 46 | uint32_t mStartTime; 47 | }; 48 | 49 | /// High-resolution OS timer 50 | class HiresTimer 51 | { 52 | public: 53 | HiresTimer(); 54 | 55 | int64_t GetUSec(bool reset); 56 | int64_t GetUSecAverage(); 57 | float GetSeconds(bool reset); 58 | float GetSecondsAverage(); 59 | void Reset(); 60 | 61 | private: 62 | int64_t mStartTime; 63 | 64 | static const uint32_t LENGTH_OF_HISTORY = 60; 65 | int64_t mHistory[LENGTH_OF_HISTORY]; 66 | uint32_t mHistoryIndex; 67 | }; 68 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D11/basic.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for simple shading with a point light 26 | // for planets in Unit Test 12 - Transformations 27 | 28 | #define MAX_PLANETS 20 29 | 30 | struct VSOutput { 31 | float4 Position : SV_POSITION; 32 | float4 Color : COLOR; 33 | }; 34 | 35 | float4 main(VSOutput input) : SV_TARGET 36 | { 37 | return input.Color; 38 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D11/profile.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | 26 | struct VSOutput 27 | { 28 | float4 Position : SV_POSITION; 29 | float4 Color : COLOR; 30 | }; 31 | 32 | float4 main(VSOutput In) : SV_Target 33 | { 34 | return In.Color; 35 | } 36 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D11/profile.vert: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | struct VSInput 26 | { 27 | float2 Position : POSITION; 28 | float4 Color : COLOR; 29 | }; 30 | 31 | struct VSOutput { 32 | float4 Position : SV_POSITION; 33 | float4 Color : COLOR; 34 | }; 35 | 36 | VSOutput main(VSInput input) 37 | { 38 | VSOutput result; 39 | result.Position = float4(input.Position.x, input.Position.y, 0.0f, 1.0f); 40 | result.Color = input.Color; 41 | return result; 42 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D11/skybox.vert: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for Skybox in Unit Test 01 - Transformations 26 | 27 | #define MAX_PLANETS 20 28 | 29 | cbuffer uniformBlock : register(b0) 30 | { 31 | float4x4 mvp; 32 | float4x4 toWorld[MAX_PLANETS]; 33 | float4 color[MAX_PLANETS]; 34 | 35 | // Point Light Information 36 | float3 lightPosition; 37 | float3 lightColor; 38 | }; 39 | 40 | struct VSOutput { 41 | float4 Position : SV_POSITION; 42 | float4 TexCoord : TEXCOORD; 43 | }; 44 | 45 | VSOutput main(float4 Position : POSITION) 46 | { 47 | VSOutput result; 48 | 49 | float4 p = float4(Position.x*9, Position.y*9, Position.z*9, 1.0); 50 | float4x4 m = mvp; 51 | p = mul(m,p); 52 | result.Position = p.xyww; 53 | result.TexCoord = float4(Position.x, Position.y, Position.z,Position.w); 54 | return result; 55 | } 56 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D12/basic.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for simple shading with a point light 26 | // for planets in Unit Test 12 - Transformations 27 | 28 | #define MAX_PLANETS 20 29 | 30 | struct VSOutput { 31 | float4 Position : SV_POSITION; 32 | float4 Color : COLOR; 33 | }; 34 | 35 | float4 main(VSOutput input) : SV_TARGET 36 | { 37 | return input.Color; 38 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D12/profile.frag: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | 26 | struct VSOutput 27 | { 28 | float4 Position : SV_POSITION; 29 | float4 Color : COLOR; 30 | }; 31 | 32 | float4 main(VSOutput In) : SV_Target 33 | { 34 | return In.Color; 35 | } 36 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D12/profile.vert: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | struct VSInput 26 | { 27 | float2 Position : POSITION; 28 | float4 Color : COLOR; 29 | }; 30 | 31 | struct VSOutput { 32 | float4 Position : SV_POSITION; 33 | float4 Color : COLOR; 34 | }; 35 | 36 | VSOutput main(VSInput input) 37 | { 38 | VSOutput result; 39 | result.Position = float4(input.Position.x, input.Position.y, 0.0f, 1.0f); 40 | result.Color = input.Color; 41 | return result; 42 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/D3D12/skybox.vert: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for Skybox in Unit Test 01 - Transformations 26 | 27 | #define MAX_PLANETS 20 28 | 29 | cbuffer uniformBlock : register(b0) 30 | { 31 | float4x4 mvp; 32 | float4x4 toWorld[MAX_PLANETS]; 33 | float4 color[MAX_PLANETS]; 34 | 35 | // Point Light Information 36 | float3 lightPosition; 37 | float3 lightColor; 38 | }; 39 | 40 | struct VSOutput { 41 | float4 Position : SV_POSITION; 42 | float4 TexCoord : TEXCOORD; 43 | }; 44 | 45 | VSOutput main(float4 Position : POSITION) 46 | { 47 | VSOutput result; 48 | 49 | float4 p = float4(Position.x*9, Position.y*9, Position.z*9, 1.0); 50 | float4x4 m = mvp; 51 | p = mul(m,p); 52 | result.Position = p.xyww; 53 | result.TexCoord = float4(Position.x, Position.y, Position.z,Position.w); 54 | return result; 55 | } 56 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Metal/basic.frag.metal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for simple shading with a point light 26 | // for planets in Unit Test 01 - Transformations 27 | 28 | #include 29 | using namespace metal; 30 | 31 | struct VSInput 32 | { 33 | float4 Position [[attribute(0)]]; 34 | float4 Normal [[attribute(1)]]; 35 | }; 36 | 37 | struct VSOutput { 38 | float4 Position [[position]]; 39 | float4 Color; 40 | }; 41 | 42 | fragment float4 stageMain(VSOutput input [[stage_in]]) 43 | { 44 | return input.Color; 45 | } 46 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Metal/profile.frag.metal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for simple shading with a point light 26 | // for planets in Unit Test 01 - Transformations 27 | 28 | #include 29 | using namespace metal; 30 | 31 | struct VSOutput { 32 | float4 Position [[position]]; 33 | float4 Color; 34 | }; 35 | 36 | fragment float4 stageMain(VSOutput input [[stage_in]]) 37 | { 38 | return input.Color; 39 | } 40 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Metal/profile.vert.metal: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // Shader for simple shading with a point light 26 | // for planets in Unit Test 01 - Transformations 27 | 28 | #include 29 | using namespace metal; 30 | 31 | struct VSInput 32 | { 33 | float2 Position [[attribute(0)]]; 34 | float4 Color [[attribute(1)]]; 35 | }; 36 | 37 | struct VSOutput { 38 | float4 Position [[position]]; 39 | float4 Color; 40 | }; 41 | 42 | vertex VSOutput stageMain(VSInput input [[stage_in]]) 43 | { 44 | VSOutput result; 45 | result.Position = float4(input.Position.xy, 0.0f, 1.0f); 46 | result.Color = input.Color; 47 | return result; 48 | } 49 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/Binary/basic.frag.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/01_Transformations/Shaders/Vulkan/Binary/basic.frag.bin -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/Binary/basic.vert.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/01_Transformations/Shaders/Vulkan/Binary/basic.vert.bin -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/Binary/skybox.frag.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/01_Transformations/Shaders/Vulkan/Binary/skybox.frag.bin -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/Binary/skybox.vert.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/01_Transformations/Shaders/Vulkan/Binary/skybox.vert.bin -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/basic.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | /* 4 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 5 | * 6 | * This file is part of The-Forge 7 | * (see https://github.com/ConfettiFX/The-Forge). 8 | * 9 | * Licensed to the Apache Software Foundation (ASF) under one 10 | * or more contributor license agreements. See the NOTICE file 11 | * distributed with this work for additional information 12 | * regarding copyright ownership. The ASF licenses this file 13 | * to you under the Apache License, Version 2.0 (the 14 | * "License"); you may not use this file except in compliance 15 | * with the License. You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, 20 | * software distributed under the License is distributed on an 21 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | * KIND, either express or implied. See the License for the 23 | * specific language governing permissions and limitations 24 | * under the License. 25 | */ 26 | 27 | 28 | layout(location = 0) in vec4 Color; 29 | 30 | layout(location = 0) out vec4 outColor; 31 | 32 | void main () 33 | { 34 | outColor = Color; 35 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/profile.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | /* 4 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 5 | * 6 | * This file is part of The-Forge 7 | * (see https://github.com/ConfettiFX/The-Forge). 8 | * 9 | * Licensed to the Apache Software Foundation (ASF) under one 10 | * or more contributor license agreements. See the NOTICE file 11 | * distributed with this work for additional information 12 | * regarding copyright ownership. The ASF licenses this file 13 | * to you under the Apache License, Version 2.0 (the 14 | * "License"); you may not use this file except in compliance 15 | * with the License. You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, 20 | * software distributed under the License is distributed on an 21 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | * KIND, either express or implied. See the License for the 23 | * specific language governing permissions and limitations 24 | * under the License. 25 | */ 26 | 27 | 28 | layout(location = 0) in vec4 fColor; 29 | 30 | layout(location = 0) out vec4 outColor; 31 | 32 | void main () 33 | { 34 | outColor = fColor; 35 | } -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/profile.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | /* 4 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 5 | * 6 | * This file is part of The-Forge 7 | * (see https://github.com/ConfettiFX/The-Forge). 8 | * 9 | * Licensed to the Apache Software Foundation (ASF) under one 10 | * or more contributor license agreements. See the NOTICE file 11 | * distributed with this work for additional information 12 | * regarding copyright ownership. The ASF licenses this file 13 | * to you under the Apache License, Version 2.0 (the 14 | * "License"); you may not use this file except in compliance 15 | * with the License. You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, 20 | * software distributed under the License is distributed on an 21 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | * KIND, either express or implied. See the License for the 23 | * specific language governing permissions and limitations 24 | * under the License. 25 | */ 26 | 27 | layout(location = 0) in vec2 vPosition; 28 | layout(location = 1) in vec4 vColor; 29 | 30 | layout(location = 0) out vec4 fColor; 31 | 32 | void main () 33 | { 34 | gl_Position = vec4(vPosition, 0.0f, 1.0f); 35 | fColor = vColor; 36 | } 37 | -------------------------------------------------------------------------------- /src/Examples/01_Transformations/Shaders/Vulkan/skybox.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | /* 4 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 5 | * 6 | * This file is part of The-Forge 7 | * (see https://github.com/ConfettiFX/The-Forge). 8 | * 9 | * Licensed to the Apache Software Foundation (ASF) under one 10 | * or more contributor license agreements. See the NOTICE file 11 | * distributed with this work for additional information 12 | * regarding copyright ownership. The ASF licenses this file 13 | * to you under the Apache License, Version 2.0 (the 14 | * "License"); you may not use this file except in compliance 15 | * with the License. You may obtain a copy of the License at 16 | * 17 | * http://www.apache.org/licenses/LICENSE-2.0 18 | * 19 | * Unless required by applicable law or agreed to in writing, 20 | * software distributed under the License is distributed on an 21 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 | * KIND, either express or implied. See the License for the 23 | * specific language governing permissions and limitations 24 | * under the License. 25 | */ 26 | 27 | 28 | #define MAX_PLANETS 20 29 | 30 | layout(location = 0) in vec4 vs_in_position; 31 | 32 | layout (std140, set=0, binding=0) uniform uniformBlock{ 33 | uniform mat4 viewProject; 34 | uniform mat4 toWorld[MAX_PLANETS]; 35 | uniform vec4 color[MAX_PLANETS]; 36 | 37 | // Point Light Information 38 | uniform vec3 lightPosition; 39 | uniform vec3 lightColor; 40 | }; 41 | 42 | out gl_PerVertex 43 | { 44 | vec4 gl_Position; 45 | 46 | }; 47 | 48 | layout(location = 0) out INVOCATION 49 | { 50 | vec4 texcoord; 51 | int side; 52 | } vs_out; 53 | 54 | 55 | void main(void) 56 | { 57 | vec4 p = vec4(vs_in_position.xyz,1.0); 58 | mat4 m = viewProject; 59 | m[3] = vec4(0.0, 0.0, 0.0, 1.0); 60 | p = m * p; 61 | gl_Position = vec4(p.x, p.y, p.w, p.w); 62 | vs_out.texcoord = vs_in_position; 63 | vs_out.side = int(vs_in_position.w); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Fonts/TitilliumText/TitilliumText-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Fonts/TitilliumText/TitilliumText-Bold.otf -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_back6.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_back6.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_back6.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_back6.ktx -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_bottom4.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_bottom4.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_bottom4.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_bottom4.ktx -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_front5.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_front5.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_front5.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_front5.ktx -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_left2.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_left2.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_left2.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_left2.ktx -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_right1.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_right1.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_right1.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_right1.ktx -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_top3.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_top3.dds -------------------------------------------------------------------------------- /src/Examples/UnitTestResources/Textures/Skybox_top3.ktx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/src/Examples/UnitTestResources/Textures/Skybox_top3.ktx -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D11/fontstash.frag: -------------------------------------------------------------------------------- 1 | struct PsIn 2 | { 3 | float4 position: SV_Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | cbuffer uRootConstants : register(b0) 8 | { 9 | float4 color; 10 | float2 scaleBias; 11 | }; 12 | 13 | Texture2D uTex0 : register(t1); 14 | SamplerState uSampler0 : register(s2); 15 | 16 | float4 main(PsIn In) : SV_Target 17 | { 18 | return float4(1.0, 1.0, 1.0, uTex0.Sample(uSampler0, In.texCoord).r) * color; 19 | } -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D11/fontstash2D.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position: Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | struct PsIn 8 | { 9 | float4 position: SV_Position; 10 | float2 texCoord: TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | PsIn main(VsIn In) 20 | { 21 | PsIn Out; 22 | Out.position = float4 (In.position, 0.0f, 1.0f); 23 | Out.position.xy = Out.position.xy * scaleBias.xy + float2(-1.0f, 1.0f); 24 | Out.texCoord = In.texCoord; 25 | return Out; 26 | }; -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D11/fontstash3D.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position: Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | struct PsIn 8 | { 9 | float4 position: SV_Position; 10 | float2 texCoord: TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | cbuffer uniformBlock : register(b1) 20 | { 21 | float4x4 mvp; 22 | }; 23 | 24 | PsIn main(VsIn In) 25 | { 26 | PsIn Out; 27 | Out.position = mul(mvp , float4(In.position * scaleBias.xy, 1.0f, 1.0f)); 28 | Out.texCoord = In.texCoord; 29 | return Out; 30 | } -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D12/fontstash.frag: -------------------------------------------------------------------------------- 1 | struct PsIn 2 | { 3 | float4 position: SV_Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | cbuffer uRootConstants : register(b0) 8 | { 9 | float4 color; 10 | float2 scaleBias; 11 | }; 12 | 13 | Texture2D uTex0 : register(t1); 14 | SamplerState uSampler0 : register(s2); 15 | 16 | float4 main(PsIn In) : SV_Target 17 | { 18 | return float4(1.0, 1.0, 1.0, uTex0.Sample(uSampler0, In.texCoord).r) * color; 19 | } -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D12/fontstash2D.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position: Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | struct PsIn 8 | { 9 | float4 position: SV_Position; 10 | float2 texCoord: TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | PsIn main(VsIn In) 20 | { 21 | PsIn Out; 22 | Out.position = float4 (In.position, 0.0f, 1.0f); 23 | Out.position.xy = Out.position.xy * scaleBias.xy + float2(-1.0f, 1.0f); 24 | Out.texCoord = In.texCoord; 25 | return Out; 26 | }; -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/D3D12/fontstash3D.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position: Position; 4 | float2 texCoord: TEXCOORD0; 5 | }; 6 | 7 | struct PsIn 8 | { 9 | float4 position: SV_Position; 10 | float2 texCoord: TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | cbuffer uniformBlock : register(b1) 20 | { 21 | float4x4 mvp; 22 | }; 23 | 24 | PsIn main(VsIn In) 25 | { 26 | PsIn Out; 27 | Out.position = mul(mvp , float4(In.position * scaleBias.xy, 1.0f, 1.0f)); 28 | Out.texCoord = In.texCoord; 29 | return Out; 30 | } -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Metal/fontstash.frag.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Fragment_Shader 5 | { 6 | struct PsIn 7 | { 8 | float4 position [[position]]; 9 | float2 texCoord; 10 | }; 11 | struct Uniforms_uRootConstants 12 | { 13 | packed_float4 color; 14 | packed_float2 scaleBias; 15 | }; 16 | constant Uniforms_uRootConstants & uRootConstants; 17 | texture2d uTex0; 18 | sampler uSampler0; 19 | float4 main(PsIn In) 20 | { 21 | return (float4(1.0, 1.0, 1.0, uTex0.sample(uSampler0, (In).texCoord).r) * uRootConstants.color); 22 | }; 23 | 24 | Fragment_Shader( 25 | constant Uniforms_uRootConstants & uRootConstants,texture2d uTex0,sampler uSampler0) : 26 | uRootConstants(uRootConstants),uTex0(uTex0),uSampler0(uSampler0) {} 27 | }; 28 | 29 | 30 | fragment float4 stageMain( 31 | Fragment_Shader::PsIn In [[stage_in]], 32 | constant Fragment_Shader::Uniforms_uRootConstants & uRootConstants [[buffer(1)]], 33 | texture2d uTex0 [[texture(0)]], 34 | sampler uSampler0 [[sampler(0)]]) 35 | { 36 | Fragment_Shader::PsIn In0; 37 | In0.position = float4(In.position.xyz, 1.0 / In.position.w); 38 | In0.texCoord = In.texCoord; 39 | Fragment_Shader main( 40 | uRootConstants, 41 | uTex0, 42 | uSampler0); 43 | return main.main(In0); 44 | } 45 | -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Metal/fontstash2D.vert.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Vertex_Shader 5 | { 6 | struct VsIn 7 | { 8 | float2 position [[attribute(0)]]; 9 | float2 texCoord [[attribute(1)]]; 10 | }; 11 | struct PsIn 12 | { 13 | float4 position [[position]]; 14 | float2 texCoord; 15 | }; 16 | struct Uniforms_uRootConstants 17 | { 18 | packed_float4 color; 19 | packed_float2 scaleBias; 20 | }; 21 | constant Uniforms_uRootConstants & uRootConstants; 22 | PsIn main(VsIn In) 23 | { 24 | PsIn Out; 25 | ((Out).position = float4((In).position, 0.0, 1.0)); 26 | (((Out).position).xy = ((((Out).position).xy * (uRootConstants.scaleBias).xy) + float2((-1.0), 1.0))); 27 | ((Out).texCoord = (In).texCoord); 28 | return Out; 29 | }; 30 | 31 | Vertex_Shader( 32 | constant Uniforms_uRootConstants & uRootConstants) : 33 | uRootConstants(uRootConstants) {} 34 | }; 35 | 36 | 37 | vertex Vertex_Shader::PsIn stageMain( 38 | Vertex_Shader::VsIn In [[stage_in]], 39 | constant Vertex_Shader::Uniforms_uRootConstants & uRootConstants [[buffer(1)]]) 40 | { 41 | Vertex_Shader::VsIn In0; 42 | In0.position = In.position; 43 | In0.texCoord = In.texCoord; 44 | Vertex_Shader main( 45 | uRootConstants); 46 | return main.main(In0); 47 | } 48 | -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Metal/fontstash3D.vert.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Vertex_Shader 5 | { 6 | struct VsIn 7 | { 8 | float2 position [[attribute(0)]]; 9 | float2 texCoord [[attribute(1)]]; 10 | }; 11 | struct PsIn 12 | { 13 | float4 position [[position]]; 14 | float2 texCoord; 15 | }; 16 | struct Uniforms_uRootConstants 17 | { 18 | packed_float4 color; 19 | packed_float2 scaleBias; 20 | }; 21 | constant Uniforms_uRootConstants & uRootConstants; 22 | struct Uniforms_uniformBlock 23 | { 24 | float4x4 mvp; 25 | }; 26 | constant Uniforms_uniformBlock & uniformBlock; 27 | PsIn main(VsIn In) 28 | { 29 | PsIn Out; 30 | ((Out).position = ((uniformBlock.mvp)*(float4(((In).position * (uRootConstants.scaleBias).xy), 1.0, 1.0)))); 31 | ((Out).texCoord = (In).texCoord); 32 | return Out; 33 | }; 34 | 35 | Vertex_Shader( 36 | constant Uniforms_uRootConstants & uRootConstants,constant Uniforms_uniformBlock & uniformBlock) : 37 | uRootConstants(uRootConstants),uniformBlock(uniformBlock) {} 38 | }; 39 | 40 | 41 | vertex Vertex_Shader::PsIn stageMain( 42 | Vertex_Shader::VsIn In [[stage_in]], 43 | constant Vertex_Shader::Uniforms_uRootConstants & uRootConstants [[buffer(1)]], 44 | constant Vertex_Shader::Uniforms_uniformBlock & uniformBlock [[buffer(2)]]) 45 | { 46 | Vertex_Shader::VsIn In0; 47 | In0.position = In.position; 48 | In0.texCoord = In.texCoord; 49 | Vertex_Shader main( 50 | uRootConstants, 51 | uniformBlock); 52 | return main.main(In0); 53 | } 54 | -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Vulkan/fontstash.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec2 fragInput_TEXCOORD0; 4 | layout(location = 0) out vec4 rast_FragData0; 5 | 6 | struct PsIn 7 | { 8 | vec4 position; 9 | vec2 texCoord; 10 | }; 11 | 12 | layout(push_constant) uniform uRootConstants_Block 13 | { 14 | vec4 color; 15 | vec2 scaleBias; 16 | } uRootConstants; 17 | 18 | layout(set = 0, binding = 2) uniform texture2D uTex0; 19 | layout(set = 0, binding = 3) uniform sampler uSampler0; 20 | 21 | vec4 HLSLmain(PsIn In) 22 | { 23 | return (vec4(1.0, 1.0, 1.0, (texture(sampler2D( uTex0, uSampler0), vec2((In).texCoord))).r) * uRootConstants.color); 24 | } 25 | 26 | void main() 27 | { 28 | PsIn In; 29 | In.position = vec4(gl_FragCoord.xyz, 1.0 / gl_FragCoord.w); 30 | In.texCoord = fragInput_TEXCOORD0; 31 | vec4 result = HLSLmain(In); 32 | rast_FragData0 = result; 33 | } -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Vulkan/fontstash2D.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec2 Position; 4 | layout(location = 1) in vec2 TEXCOORD0; 5 | layout(location = 0) out vec2 vertOutput_TEXCOORD0; 6 | 7 | struct VsIn 8 | { 9 | vec2 position; 10 | vec2 texCoord; 11 | }; 12 | 13 | struct PsIn 14 | { 15 | vec4 position; 16 | vec2 texCoord; 17 | }; 18 | 19 | layout(push_constant) uniform uRootConstants_Block 20 | { 21 | vec4 color; 22 | vec2 scaleBias; 23 | } uRootConstants; 24 | 25 | PsIn HLSLmain(VsIn In) 26 | { 27 | PsIn Out; 28 | ((Out).position = vec4((In).position, 0.0, 1.0)); 29 | (((Out).position).xy = ((((Out).position).xy * (uRootConstants.scaleBias).xy) + vec2((-1.0), 1.0))); 30 | ((Out).texCoord = (In).texCoord); 31 | return Out; 32 | } 33 | 34 | void main() 35 | { 36 | VsIn In; 37 | In.position = Position; 38 | In.texCoord = TEXCOORD0; 39 | PsIn result = HLSLmain(In); 40 | gl_Position = result.position; 41 | vertOutput_TEXCOORD0 = result.texCoord; 42 | } 43 | -------------------------------------------------------------------------------- /src/Middleware/Text/Shaders/Vulkan/fontstash3D.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | 4 | layout(location = 0) in vec2 Position; 5 | layout(location = 1) in vec2 TEXCOORD0; 6 | layout(location = 0) out vec2 vertOutput_TEXCOORD0; 7 | 8 | struct VsIn 9 | { 10 | vec2 position; 11 | vec2 texCoord; 12 | }; 13 | 14 | struct PsIn 15 | { 16 | vec4 position; 17 | vec2 texCoord; 18 | }; 19 | 20 | layout(push_constant) uniform uRootConstants_Block 21 | { 22 | vec4 color; 23 | vec2 scaleBias; 24 | } uRootConstants; 25 | 26 | layout(set = 0, binding = 1) uniform uniformBlock 27 | { 28 | mat4 mvp; 29 | }; 30 | 31 | PsIn HLSLmain(VsIn In) 32 | { 33 | PsIn Out; 34 | ((Out).position = ((mvp)*(vec4(((In).position * (uRootConstants.scaleBias).xy), 1.0, 1.0)))); 35 | ((Out).texCoord = (In).texCoord); 36 | return Out; 37 | } 38 | 39 | void main() 40 | { 41 | VsIn In; 42 | In.position = Position; 43 | In.texCoord = TEXCOORD0; 44 | PsIn result = HLSLmain(In); 45 | gl_Position = result.position; 46 | vertOutput_TEXCOORD0 = result.texCoord; 47 | } 48 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D11/imgui.frag: -------------------------------------------------------------------------------- 1 | struct PS_INPUT 2 | { 3 | float4 pos : SV_POSITION; 4 | float4 col : COLOR0; 5 | float2 uv : TEXCOORD0; 6 | }; 7 | 8 | Texture2D uTex : register(t1); 9 | SamplerState uSampler : register(s2); 10 | 11 | float4 main(PS_INPUT input) : SV_Target 12 | { 13 | return input.col * uTex.Sample(uSampler, input.uv); 14 | } -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D11/imgui.vert: -------------------------------------------------------------------------------- 1 | cbuffer uniformBlockVS : register(b0) 2 | { 3 | float4x4 ProjectionMatrix; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 pos : POSITION; 9 | float2 uv : TEXCOORD0; 10 | float4 col : COLOR0; 11 | }; 12 | 13 | struct PS_INPUT 14 | { 15 | float4 pos : SV_POSITION; 16 | float4 col : COLOR0; 17 | float2 uv : TEXCOORD0; 18 | }; 19 | 20 | PS_INPUT main(VS_INPUT input) 21 | { 22 | PS_INPUT output; 23 | output.pos = mul(ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f)); 24 | output.col = input.col; 25 | output.uv = input.uv; 26 | return output; 27 | } -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D11/textured_mesh.frag: -------------------------------------------------------------------------------- 1 | struct PsIn 2 | { 3 | float4 position : SV_POSITION; 4 | float2 texcoord : TEXCOORD0; 5 | }; 6 | 7 | cbuffer uRootConstants : register(b0) 8 | { 9 | float4 color; 10 | float2 scaleBias; 11 | }; 12 | 13 | Texture2D uTex : register(t1); 14 | SamplerState uSampler : register(s2); 15 | 16 | float4 main(PsIn input) : SV_TARGET0 17 | { 18 | return uTex.Sample(uSampler, input.texcoord) * color; 19 | }; -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D11/textured_mesh.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position : Position; 4 | float2 texcoord : Texcoord; 5 | }; 6 | 7 | struct VsOut 8 | { 9 | float4 position : SV_POSITION; 10 | float2 texcoord : TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | VsOut main(VsIn input) 20 | { 21 | VsOut output = (VsOut)0; 22 | output.position = float4(input.position.xy * scaleBias.xy + float2(-1.0f, 1.0f), 0.0f, 1.0f); 23 | output.texcoord = input.texcoord; 24 | 25 | return output; 26 | }; -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D12/imgui.frag: -------------------------------------------------------------------------------- 1 | struct PS_INPUT 2 | { 3 | float4 pos : SV_POSITION; 4 | float4 col : COLOR0; 5 | float2 uv : TEXCOORD0; 6 | }; 7 | 8 | Texture2D uTex : register(t1, space2); 9 | SamplerState uSampler : register(s2); 10 | 11 | float4 main(PS_INPUT input) : SV_Target 12 | { 13 | return input.col * uTex.Sample(uSampler, input.uv); 14 | } 15 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D12/imgui.vert: -------------------------------------------------------------------------------- 1 | cbuffer uniformBlockVS : register(b0) 2 | { 3 | float4x4 ProjectionMatrix; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 pos : POSITION; 9 | float2 uv : TEXCOORD0; 10 | float4 col : COLOR0; 11 | }; 12 | 13 | struct PS_INPUT 14 | { 15 | float4 pos : SV_POSITION; 16 | float4 col : COLOR0; 17 | float2 uv : TEXCOORD0; 18 | }; 19 | 20 | PS_INPUT main(VS_INPUT input) 21 | { 22 | PS_INPUT output; 23 | output.pos = mul(ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f)); 24 | output.col = input.col; 25 | output.uv = input.uv; 26 | return output; 27 | } -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D12/textured_mesh.frag: -------------------------------------------------------------------------------- 1 | struct PsIn 2 | { 3 | float4 position : SV_POSITION; 4 | float2 texcoord : TEXCOORD0; 5 | }; 6 | 7 | cbuffer uRootConstants : register(b0) 8 | { 9 | float4 color; 10 | float2 scaleBias; 11 | }; 12 | 13 | Texture2D uTex : register(t1); 14 | SamplerState uSampler : register(s2); 15 | 16 | float4 main(PsIn input) : SV_TARGET0 17 | { 18 | return uTex.Sample(uSampler, input.texcoord) * color; 19 | }; -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/D3D12/textured_mesh.vert: -------------------------------------------------------------------------------- 1 | struct VsIn 2 | { 3 | float2 position : Position; 4 | float2 texcoord : Texcoord; 5 | }; 6 | 7 | struct VsOut 8 | { 9 | float4 position : SV_POSITION; 10 | float2 texcoord : TEXCOORD0; 11 | }; 12 | 13 | cbuffer uRootConstants : register(b0) 14 | { 15 | float4 color; 16 | float2 scaleBias; 17 | }; 18 | 19 | VsOut main(VsIn input) 20 | { 21 | VsOut output = (VsOut)0; 22 | output.position = float4(input.position.xy * scaleBias.xy + float2(-1.0f, 1.0f), 0.0f, 1.0f); 23 | output.texcoord = input.texcoord; 24 | 25 | return output; 26 | }; -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Metal/imgui.frag.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Fragment_Shader 5 | { 6 | struct PS_INPUT 7 | { 8 | float4 pos [[position]]; 9 | float4 col; 10 | float2 uv; 11 | }; 12 | texture2d uTex; 13 | sampler uSampler; 14 | float4 main(PS_INPUT input) 15 | { 16 | return (input).col * ((float4)(uTex.sample(uSampler, (input).uv))); 17 | }; 18 | 19 | Fragment_Shader( 20 | texture2d uTex,sampler uSampler) : 21 | uTex(uTex),uSampler(uSampler) {} 22 | }; 23 | 24 | 25 | fragment float4 stageMain( 26 | Fragment_Shader::PS_INPUT input [[stage_in]], 27 | texture2d uTex [[texture(0)]], 28 | sampler uSampler [[sampler(0)]]) 29 | { 30 | Fragment_Shader::PS_INPUT input0; 31 | input0.pos = float4(input.pos.xyz, 1.0 / input.pos.w); 32 | input0.col = input.col; 33 | input0.uv = input.uv; 34 | Fragment_Shader main( 35 | uTex, 36 | uSampler); 37 | return main.main(input0); 38 | } 39 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Metal/imgui.vert.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Vertex_Shader 5 | { 6 | struct Uniforms_uniformBlockVS 7 | { 8 | float4x4 ProjectionMatrix; 9 | }; 10 | constant Uniforms_uniformBlockVS & uniformBlockVS; 11 | struct VS_INPUT 12 | { 13 | float2 pos [[attribute(0)]]; 14 | float2 uv [[attribute(1)]]; 15 | float4 col [[attribute(2)]]; 16 | }; 17 | struct PS_INPUT 18 | { 19 | float4 pos [[position]]; 20 | float4 col; 21 | float2 uv; 22 | }; 23 | PS_INPUT main(VS_INPUT input) 24 | { 25 | PS_INPUT output; 26 | ((output).pos = ((uniformBlockVS.ProjectionMatrix)*(float4(((input).pos).xy, 0.0, 1.0)))); 27 | ((output).col = (input).col); 28 | ((output).uv = (input).uv); 29 | return output; 30 | }; 31 | 32 | Vertex_Shader( 33 | constant Uniforms_uniformBlockVS & uniformBlockVS) : 34 | uniformBlockVS(uniformBlockVS) {} 35 | }; 36 | 37 | 38 | vertex Vertex_Shader::PS_INPUT stageMain( 39 | Vertex_Shader::VS_INPUT input [[stage_in]], 40 | constant Vertex_Shader::Uniforms_uniformBlockVS & uniformBlockVS [[buffer(1)]]) 41 | { 42 | Vertex_Shader::VS_INPUT input0; 43 | input0.pos = input.pos; 44 | input0.uv = input.uv; 45 | input0.col = input.col; 46 | Vertex_Shader main( 47 | uniformBlockVS); 48 | return main.main(input0); 49 | } 50 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Metal/textured_mesh.frag.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Fragment_Shader 5 | { 6 | struct PsIn 7 | { 8 | float4 position [[position]]; 9 | float2 texcoord; 10 | }; 11 | struct Uniforms_uRootConstants 12 | { 13 | packed_float4 color; 14 | packed_float2 scaleBias; 15 | }; 16 | constant Uniforms_uRootConstants & uRootConstants; 17 | texture2d uTex; 18 | sampler uSampler; 19 | float4 main(PsIn input) 20 | { 21 | return uTex.sample(uSampler, (input).texcoord) * uRootConstants.color; 22 | }; 23 | 24 | Fragment_Shader( 25 | constant Uniforms_uRootConstants & uRootConstants,texture2d uTex,sampler uSampler) : 26 | uRootConstants(uRootConstants),uTex(uTex),uSampler(uSampler) {} 27 | }; 28 | 29 | 30 | fragment float4 stageMain( 31 | Fragment_Shader::PsIn input [[stage_in]], 32 | constant Fragment_Shader::Uniforms_uRootConstants & uRootConstants [[buffer(1)]], 33 | texture2d uTex [[texture(0)]], 34 | sampler uSampler [[sampler(0)]]) 35 | { 36 | Fragment_Shader::PsIn input0; 37 | input0.position = float4(input.position.xyz, 1.0 / input.position.w); 38 | input0.texcoord = input.texcoord; 39 | Fragment_Shader main( 40 | uRootConstants, 41 | uTex, 42 | uSampler); 43 | return main.main(input0); 44 | } 45 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Metal/textured_mesh.vert.metal: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace metal; 3 | 4 | struct Vertex_Shader 5 | { 6 | struct VsIn 7 | { 8 | float2 position [[attribute(0)]]; 9 | float2 texcoord [[attribute(1)]]; 10 | }; 11 | struct VsOut 12 | { 13 | float4 position [[position]]; 14 | float2 texcoord; 15 | }; 16 | struct Uniforms_uRootConstants 17 | { 18 | packed_float4 color; 19 | packed_float2 scaleBias; 20 | }; 21 | constant Uniforms_uRootConstants & uRootConstants; 22 | VsOut main(VsIn input) 23 | { 24 | VsOut output; 25 | ((output).position = float4(((((input).position).xy * (uRootConstants.scaleBias).xy) + float2((-1.0), 1.0)), 0.0, 1.0)); 26 | ((output).texcoord = (input).texcoord); 27 | return output; 28 | }; 29 | 30 | Vertex_Shader( 31 | constant Uniforms_uRootConstants & uRootConstants) : 32 | uRootConstants(uRootConstants) {} 33 | }; 34 | 35 | 36 | vertex Vertex_Shader::VsOut stageMain( 37 | Vertex_Shader::VsIn input [[stage_in]], 38 | constant Vertex_Shader::Uniforms_uRootConstants & uRootConstants [[buffer(1)]]) 39 | { 40 | Vertex_Shader::VsIn input0; 41 | input0.position = input.position; 42 | input0.texcoord = input.texcoord; 43 | Vertex_Shader main( 44 | uRootConstants); 45 | return main.main(input0); 46 | } 47 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Vulkan/imgui.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec4 fragInput_COLOR0; 4 | layout(location = 1) in vec2 fragInput_TEXCOORD0; 5 | layout(location = 0) out vec4 rast_FragData0; 6 | 7 | struct PS_INPUT 8 | { 9 | vec4 pos; 10 | vec4 col; 11 | vec2 uv; 12 | }; 13 | 14 | layout(set = 2, binding = 1) uniform texture2D uTex; 15 | layout(set = 0, binding = 2) uniform sampler uSampler; 16 | 17 | vec4 HLSLmain(PS_INPUT input0) 18 | { 19 | return (input0).col * texture(sampler2D( uTex, uSampler), vec2((input0).uv)); 20 | } 21 | 22 | void main() 23 | { 24 | PS_INPUT input0; 25 | input0.pos = vec4(gl_FragCoord.xyz, 1.0 / gl_FragCoord.w); 26 | input0.col = fragInput_COLOR0; 27 | input0.uv = fragInput_TEXCOORD0; 28 | vec4 result = HLSLmain(input0); 29 | rast_FragData0 = result; 30 | } 31 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Vulkan/imgui.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec2 POSITION; 4 | layout(location = 1) in vec2 TEXCOORD0; 5 | layout(location = 2) in vec4 COLOR0; 6 | layout(location = 0) out vec4 vertOutput_COLOR0; 7 | layout(location = 1) out vec2 vertOutput_TEXCOORD0; 8 | 9 | layout(set = 0, binding = 0) uniform uniformBlockVS 10 | { 11 | mat4 ProjectionMatrix; 12 | }; 13 | 14 | struct VS_INPUT 15 | { 16 | vec2 pos; 17 | vec2 uv; 18 | vec4 col; 19 | }; 20 | 21 | struct PS_INPUT 22 | { 23 | vec4 pos; 24 | vec4 col; 25 | vec2 uv; 26 | }; 27 | 28 | PS_INPUT HLSLmain(VS_INPUT input0) 29 | { 30 | PS_INPUT output0; 31 | ((output0).pos = ((ProjectionMatrix)*(vec4(((input0).pos).xy, 0.0, 1.0)))); 32 | ((output0).col = (input0).col); 33 | ((output0).uv = (input0).uv); 34 | return output0; 35 | } 36 | 37 | void main() 38 | { 39 | VS_INPUT input0; 40 | input0.pos = POSITION; 41 | input0.uv = TEXCOORD0; 42 | input0.col = COLOR0; 43 | PS_INPUT result = HLSLmain(input0); 44 | gl_Position = result.pos; 45 | vertOutput_COLOR0 = result.col; 46 | vertOutput_TEXCOORD0 = result.uv; 47 | } 48 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Vulkan/textured_mesh.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec2 fragInput_TEXCOORD0; 4 | layout(location = 0) out vec4 rast_FragData0; 5 | 6 | struct PsIn 7 | { 8 | vec4 position; 9 | vec2 texcoord; 10 | }; 11 | 12 | layout(push_constant) uniform uRootConstants_Block 13 | { 14 | vec4 color; 15 | vec2 scaleBias; 16 | } uRootConstants; 17 | 18 | layout(set = 0, binding = 1) uniform texture2D uTex; 19 | layout(set = 0, binding = 2) uniform sampler uSampler; 20 | 21 | vec4 HLSLmain(PsIn input0) 22 | { 23 | return (texture(sampler2D( uTex, uSampler), vec2((input0).texcoord)) * uRootConstants.color); 24 | } 25 | 26 | void main() 27 | { 28 | PsIn input0; 29 | input0.position = vec4(gl_FragCoord.xyz, 1.0 / gl_FragCoord.w); 30 | input0.texcoord = fragInput_TEXCOORD0; 31 | vec4 result = HLSLmain(input0); 32 | rast_FragData0 = result; 33 | } 34 | -------------------------------------------------------------------------------- /src/Middleware/UI/Shaders/Vulkan/textured_mesh.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | 3 | layout(location = 0) in vec2 Position; 4 | layout(location = 1) in vec2 Texcoord; 5 | layout(location = 0) out vec2 vertOutput_TEXCOORD0; 6 | 7 | struct VsIn 8 | { 9 | vec2 position; 10 | vec2 texcoord; 11 | }; 12 | 13 | struct VsOut 14 | { 15 | vec4 position; 16 | vec2 texcoord; 17 | }; 18 | 19 | layout(push_constant) uniform uRootConstants_Block 20 | { 21 | vec4 color; 22 | vec2 scaleBias; 23 | } uRootConstants; 24 | 25 | VsOut HLSLmain(VsIn input0) 26 | { 27 | VsOut output0; 28 | ((output0).position = vec4(((((input0).position).xy * (uRootConstants.scaleBias).xy) + vec2((-1.0), 1.0)), 0.0, 1.0)); 29 | ((output0).texcoord = (input0).texcoord); 30 | return output0; 31 | } 32 | 33 | void main() 34 | { 35 | VsIn input0; 36 | input0.position = Position; 37 | input0.texcoord = Texcoord; 38 | VsOut result = HLSLmain(input0); 39 | gl_Position = result.position; 40 | vertOutput_TEXCOORD0 = result.texcoord; 41 | } 42 | -------------------------------------------------------------------------------- /src/Middleware/UI/imgui_user.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "imgui/imgui.h" 3 | 4 | namespace ImGui { 5 | // Returns 0 if no change 6 | // Returns 1 if it got changed via the UI or the default textbox 7 | // Returns 2,3,4,5 if a textbox was requested by double clik or crtl+click but wasn't spawned. 8 | // The return value is based on which component asked for a text box since this is a multi-component widget. 9 | /* Paramters: 10 | * label -> Name above widgets 11 | * value_p -> float value(s) to modify 12 | * components -> Number of values in value_p 13 | * minv -> min float value. If minv == maxv then no limits are applied 14 | * max -> max float value. Same as above. 15 | * format -> format to print the float value as. (Mainly used to control number of decimal points) 16 | * minimumHitRadius -> Determines what's the minimum hit radius for the knob to start rotating and change the value. 17 | * windowWidthRatio -> [0,FLT_MAX] value that determines the final size of the all the knobs on the same line with respect to the containing window. 18 | Value of 1.0f with component = 1 --> Size of 1 knob takes full width .. with 2 knobs and value of 1 --> each knob is half width and so on. 19 | * doubleTapForText -> If true then double clicking on knob will open a text box 20 | * spawnText -> 21 | * If true and doubleTapForText is true then the widget spawn a textu box instead of the knob widget. 22 | * If false and doubleTapForText is true, then function will return an int between 2 and 5 to determine which component of the float value needs to be modified BUT the text box won't be spawned. It's up to the client to spawn it. 23 | * framePaddingScale -> Multipler to control extra padding on left side of first knob 24 | **/ 25 | int KnobFloatN( 26 | const char* label, float* value_p, const int& components, const float& step = 1.0f, const float& minv = 0.f, const float& maxv = 0.f, 27 | const char* format = "%.1f", const float& minimumHitRadius = 0.5f, float windowWidthRatio = 1.0f, bool doubleTapForText = true, 28 | bool spawnText = true, float framePaddingScale = 3.0f); 29 | } // namespace ImGui 30 | -------------------------------------------------------------------------------- /src/OS/Android/AndroidTime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /************************************************************************/ 6 | // Time Related Functions 7 | /************************************************************************/ 8 | 9 | uint32_t getSystemTime() 10 | { 11 | long ms; // Milliseconds 12 | time_t s; // Seconds 13 | struct timespec spec; 14 | 15 | clock_gettime(CLOCK_REALTIME, &spec); 16 | 17 | s = spec.tv_sec; 18 | ms = round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds 19 | 20 | ms += s * 1000; 21 | 22 | return (uint32_t)ms; 23 | } 24 | 25 | int64_t getUSec() 26 | { 27 | timespec ts; 28 | clock_gettime(CLOCK_REALTIME, &ts); 29 | long us = (ts.tv_nsec / 1000); 30 | us += ts.tv_sec * 1e6; 31 | return us; 32 | } 33 | 34 | uint32_t getTimeSinceStart() { return (uint32_t)time(NULL); } 35 | 36 | int64_t getTimerFrequency() 37 | { 38 | // This is us to s 39 | return 1000000LL; 40 | } -------------------------------------------------------------------------------- /src/OS/Android/Google Android Studio Setup.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | Google Android Studio Setup 4 | Just download Android Studio first and then use Tools->SDK Manager to download all the other stuff 5 | 6 | https://developer.android.com/studio/ 7 | 8 | Dowload the apropriate platforms in and then download from 9 | - Android Build Tools and lots of other tools 10 | - Google USB driver 11 | - NDK 12 | 13 | - When you have the NDK downloaded, compile shaderc by navigating to /sources/third_party/shaderc/, then running the following command. 14 | ..\..\..\ndk-build.cmd NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL:=gnustl_static APP_ABI=all libshaderc_combined 15 | 16 | - Open a terminal window, and use git to clone the Android Vulkan samples from the repository in which they reside. 17 | $ git clone https://github.com/googlesamples/vulkan-basic-samples.git 18 | 19 | - Navigate to this LunarGSamples/ directory, which is in the local repository that you checked out in the previous step. 20 | Update the gslang source by running the following command. 21 | 22 | On Mac or Linux: 23 | $ ./update_external_sources.sh -s -g 24 | 25 | On Windows: 26 | update_external_sources.bat --sync-glslang --sync-spirv-tools 27 | 28 | - Install the USB driver: 29 | https://developer.android.com/studio/run/oem-usb#InstallingDriver 30 | 31 | - Check if device is connected through USB with the special Device USB driver (for Google phones the Google USB driver) 32 | PS C:\Users\Wolfgang\AppData\Local\Android\Sdk\platform-tools> .\adb.exe devices 33 | List of devices attached 34 | 009298fb8552b853 device 35 | 36 | - Enable USB Debugging on a Nexus 5X: 37 | https://www.technipages.com/nexus-5x-enable-usb-debugging 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/OS/Core/DLL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #ifdef DLL_EXPORT 26 | #define CONFETTI_DLLAPI __declspec(dllexport) 27 | #else 28 | #define CONFETTI_DLLAPI 29 | #endif -------------------------------------------------------------------------------- /src/OS/Core/PlatformEvents.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #include "Interfaces/IOperatingSystem.h" 26 | #include "EASTL/vector.h" 27 | 28 | static eastl::vector gWindowResizeCallbacks; 29 | 30 | void registerWindowResizeEvent(WindowResizeEventHandler callback) { gWindowResizeCallbacks.push_back(callback); } 31 | 32 | void unregisterWindowResizeEvent(WindowResizeEventHandler callback) 33 | { 34 | gWindowResizeCallbacks.erase(eastl::find(gWindowResizeCallbacks.begin(), gWindowResizeCallbacks.end(), callback)); 35 | } 36 | 37 | namespace PlatformEvents { 38 | bool wantsMouseCapture = false; 39 | bool skipMouseCapture = false; 40 | 41 | void onWindowResize(const WindowResizeEventData* data) 42 | { 43 | for (WindowResizeEventHandler& callback : gWindowResizeCallbacks) 44 | callback(data); 45 | } 46 | } // namespace PlatformEvents 47 | 48 | bool requestMouseCapture(bool allowCapture) 49 | { 50 | bool rv = PlatformEvents::wantsMouseCapture; 51 | PlatformEvents::wantsMouseCapture = allowCapture; 52 | return rv; 53 | } 54 | -------------------------------------------------------------------------------- /src/OS/Core/ThreadSystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | typedef void (*TaskFunc)(void* user, uintptr_t arg); 26 | 27 | template 28 | static void memberTaskFunc(void* userData, size_t arg) 29 | { 30 | T* pThis = static_cast(userData); 31 | (pThis->*callback)(arg); 32 | } 33 | 34 | template 35 | static void memberTaskFunc0(void* userData, size_t) 36 | { 37 | T* pThis = static_cast(userData); 38 | (pThis->*callback)(); 39 | } 40 | 41 | struct ThreadSystem; 42 | 43 | void initThreadSystem(ThreadSystem** ppThreadSystem); 44 | 45 | void shutdownThreadSystem(ThreadSystem* pThreadSystem); 46 | 47 | void addThreadSystemRangeTask(ThreadSystem* pThreadSystem, TaskFunc task, void* user, uintptr_t count); 48 | void addThreadSystemRangeTask(ThreadSystem* pThreadSystem, TaskFunc task, void* user, uintptr_t start, uintptr_t end); 49 | void addThreadSystemTask(ThreadSystem* pThreadSystem, TaskFunc task, void* user, uintptr_t index = 0); 50 | 51 | bool assistThreadSystem(ThreadSystem* pThreadSystem); 52 | 53 | bool isThreadSystemIdle(ThreadSystem* pThreadSystem); 54 | void waitThreadSystemIdle(ThreadSystem* pThreadSystem); 55 | -------------------------------------------------------------------------------- /src/OS/Linux/LinuxTime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /************************************************************************/ 6 | // Time Related Functions 7 | /************************************************************************/ 8 | 9 | uint32_t getSystemTime() 10 | { 11 | long ms; // Milliseconds 12 | time_t s; // Seconds 13 | struct timespec spec; 14 | 15 | clock_gettime(CLOCK_REALTIME, &spec); 16 | 17 | s = spec.tv_sec; 18 | ms = round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds 19 | 20 | ms += s * 1000; 21 | 22 | return (uint32_t)ms; 23 | } 24 | 25 | int64_t getUSec() 26 | { 27 | timespec ts; 28 | clock_gettime(CLOCK_REALTIME, &ts); 29 | long us = (ts.tv_nsec / 1000); 30 | us += ts.tv_sec * 1e6; 31 | return us; 32 | } 33 | 34 | uint32_t getTimeSinceStart() { return (uint32_t)time(NULL); } 35 | 36 | int64_t getTimerFrequency() 37 | { 38 | // This is us to s 39 | return 1000000LL; 40 | } 41 | -------------------------------------------------------------------------------- /src/OS/Math/MathTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #pragma once 26 | 27 | #ifndef THEFORGE_INCLUDE_MATHTYPES_H 28 | #define THEFORGE_INCLUDE_MATHTYPES_H 29 | // ModifiedSonyMath ReadMe: 30 | // - All you need to do is include the public header file vectormath.hpp. It will expose the relevant parts of 31 | // the library for you and try to select the SSE implementation if supported. 32 | #include "ModifiedSonyMath/vectormath.hpp" 33 | 34 | typedef Vector2 vec2; 35 | typedef Vector3 vec3; 36 | typedef Vector4 vec4; 37 | 38 | typedef IVector2 ivec2; 39 | typedef IVector3 ivec3; 40 | typedef IVector4 ivec4; 41 | 42 | typedef UVector2 uvec2; 43 | typedef UVector3 uvec3; 44 | typedef UVector4 uvec4; 45 | 46 | typedef Matrix2 mat2; 47 | typedef Matrix3 mat3; 48 | typedef Matrix4 mat4; 49 | #endif // THEFORGE_INCLUDE_MATHTYPES_H 50 | -------------------------------------------------------------------------------- /src/OS/MemoryTracking/NoMemoryDefines.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef THEFORGE_INCLUDE_NOMEMORYDEFINES_H 3 | #define THEFORGE_INCLUDE_NOMEMORYDEFINES_H 4 | 5 | #ifdef malloc 6 | #undef malloc 7 | #endif 8 | 9 | #ifdef calloc 10 | #undef calloc 11 | #endif 12 | 13 | #ifdef realloc 14 | #undef realloc 15 | #endif 16 | 17 | #ifdef free 18 | #undef free 19 | #endif 20 | 21 | #ifdef new 22 | #undef new 23 | #endif 24 | 25 | #ifdef delete 26 | #undef delete 27 | #endif 28 | 29 | #endif -------------------------------------------------------------------------------- /src/OS/Windows/WindowsTime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /************************************************************************/ 6 | // Time Related Functions 7 | /************************************************************************/ 8 | uint32_t getSystemTime() { return (uint32_t)timeGetTime(); } 9 | 10 | uint32_t getTimeSinceStart() { return (uint32_t)time(NULL); } 11 | 12 | static int64_t highResTimerFrequency = 0; 13 | 14 | void initTime() 15 | { 16 | LARGE_INTEGER frequency; 17 | if (QueryPerformanceFrequency(&frequency)) 18 | { 19 | highResTimerFrequency = frequency.QuadPart; 20 | } 21 | else 22 | { 23 | highResTimerFrequency = 1000LL; 24 | } 25 | } 26 | 27 | 28 | int64_t getTimerFrequency() 29 | { 30 | if (highResTimerFrequency == 0) 31 | initTime(); 32 | 33 | return highResTimerFrequency; 34 | } 35 | 36 | // Make sure timer frequency is initialized before anyone tries to use it 37 | struct StaticTime 38 | { 39 | StaticTime() { initTime(); } 40 | } staticTimeInst; 41 | 42 | int64_t getUSec() 43 | { 44 | LARGE_INTEGER counter; 45 | QueryPerformanceCounter(&counter); 46 | return counter.QuadPart * (int64_t)1e6 / getTimerFrequency(); 47 | } 48 | -------------------------------------------------------------------------------- /src/OS/iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #import 26 | 27 | @interface AppDelegate: UIResponder 28 | 29 | @property(strong, nonatomic) UIWindow* window; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/OS/macOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #import 26 | 27 | @interface AppDelegate: NSObject 28 | 29 | @property(assign) IBOutlet NSWindow* window; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/OS/macOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #import "AppDelegate.h" 26 | 27 | @interface AppDelegate () 28 | 29 | @end 30 | 31 | @implementation AppDelegate 32 | 33 | - (void)applicationDidFinishLaunching:(NSNotification*)aNotification 34 | { 35 | // Insert code here to initialize your application 36 | } 37 | 38 | - (void)applicationWillTerminate:(NSNotification*)aNotification 39 | { 40 | // Insert code here to tear down your application 41 | } 42 | 43 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender 44 | { 45 | return YES; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /src/Renderer/Direct3D11/Direct3D11Raytracing.cpp: -------------------------------------------------------------------------------- 1 | // Renderer 2 | #include "IRay.h" 3 | 4 | bool isRaytracingSupported(Renderer* /*pRenderer*/) { 5 | return false; 6 | } 7 | 8 | bool initRaytracing(Renderer* /*pRenderer*/, Raytracing** /*ppRaytracing*/) { 9 | return false; 10 | } 11 | 12 | void removeRaytracing(Renderer* /*pRenderer*/, Raytracing* /*pRaytracing*/) {} 13 | 14 | void addAccelerationStructure(Raytracing* /*pRaytracing*/, const AccelerationStructureDescTop* /*pDesc*/, AccelerationStructure** /*ppAccelerationStructure*/) {} 15 | void removeAccelerationStructure(Raytracing* /*pRaytracing*/, AccelerationStructure* /*pAccelerationStructure*/) {} 16 | 17 | void addRaytracingRootSignature(Raytracing* /*pRaytracing*/, const ShaderResource* /*pResources*/, uint32_t /*resourceCount*/, bool /*local*/, RootSignature** /*ppRootSignature*/, const RootSignatureDesc* /*pRootDesc */) {} 18 | 19 | void addRaytracingShaderTable(Raytracing* /*pRaytracing*/, const RaytracingShaderTableDesc* /*pDesc*/, RaytracingShaderTable** /*ppTable*/) {} 20 | void removeRaytracingShaderTable(Raytracing* /*pRaytracing*/, RaytracingShaderTable* /*pTable*/) {} 21 | 22 | void cmdBuildAccelerationStructure(Cmd* /*pCmd*/, Raytracing* /*pRaytracing*/, RaytracingBuildASDesc* /*pDesc*/) {} 23 | void cmdDispatchRays(Cmd* /*pCmd*/, Raytracing* /*pRaytracing*/, const RaytracingDispatchDesc* /*pDesc*/) {} 24 | 25 | -------------------------------------------------------------------------------- /src/Renderer/Direct3D12/Direct3D12Hooks.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | #if defined(DIRECT3D12) 26 | #include "IRenderer.h" 27 | #include "Direct3D12Hooks.h" 28 | #include "Interfaces/IMemory.h" 29 | 30 | static void enable_debug_layer_hook(Renderer* pRenderer) 31 | { 32 | #if defined(_DEBUG) || defined(PROFILE) 33 | pRenderer->pDXDebug->EnableDebugLayer(); 34 | #endif 35 | } 36 | 37 | static ImageFormat::Enum get_recommended_swapchain_format(bool hintHDR) { return ImageFormat::BGRA8; } 38 | 39 | static uint32_t get_swap_chain_image_index(SwapChain* pSwapChain) { return pSwapChain->pDxSwapChain->GetCurrentBackBufferIndex(); } 40 | 41 | void initHooks() 42 | { 43 | fnHookEnableDebugLayer = enable_debug_layer_hook; 44 | fnHookGetRecommendedSwapChainFormat = get_recommended_swapchain_format; 45 | fnHookGetSwapChainImageIndex = get_swap_chain_image_index; 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /src/Tools/SpirvTools/dllmain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 3 | * 4 | * This file is part of The-Forge 5 | * (see https://github.com/ConfettiFX/The-Forge). 6 | * 7 | * Licensed to the Apache Software Foundation (ASF) under one 8 | * or more contributor license agreements. See the NOTICE file 9 | * distributed with this work for additional information 10 | * regarding copyright ownership. The ASF licenses this file 11 | * to you under the Apache License, Version 2.0 (the 12 | * "License"); you may not use this file except in compliance 13 | * with the License. You may obtain a copy of the License at 14 | * 15 | * http://www.apache.org/licenses/LICENSE-2.0 16 | * 17 | * Unless required by applicable law or agreed to in writing, 18 | * software distributed under the License is distributed on an 19 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 | * KIND, either express or implied. See the License for the 21 | * specific language governing permissions and limitations 22 | * under the License. 23 | */ 24 | 25 | // dllmain.cpp : Defines the entry point for the DLL application. 26 | #if defined(_WIN32) 27 | #include 28 | BOOL APIENTRY DllMain(HMODULE hModule, 29 | DWORD ul_reason_for_call, 30 | LPVOID lpReserved 31 | ) 32 | { 33 | switch(ul_reason_for_call) 34 | { 35 | case DLL_PROCESS_ATTACH: 36 | case DLL_THREAD_ATTACH: 37 | case DLL_THREAD_DETACH: 38 | case DLL_PROCESS_DETACH: 39 | break; 40 | } 41 | return TRUE; 42 | } 43 | #endif -------------------------------------------------------------------------------- /third_party/EASTL/.clang-format: -------------------------------------------------------------------------------- 1 | #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- 2 | Language : Cpp 3 | BasedOnStyle : Google 4 | Standard : Auto 5 | #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- 6 | AccessModifierOffset : -4 7 | AlignTrailingComments : true 8 | AllowAllParametersOfDeclarationOnNextLine : false 9 | AllowShortBlocksOnASingleLine : true 10 | AllowShortFunctionsOnASingleLine : true 11 | AllowShortIfStatementsOnASingleLine : false 12 | AllowShortLoopsOnASingleLine : false 13 | BinPackParameters : false 14 | BreakBeforeBraces : Allman 15 | BreakBeforeTernaryOperators : false 16 | BreakConstructorInitializersBeforeComma : true 17 | ColumnLimit : 120 18 | Cpp11BracedListStyle : true 19 | DerivePointerAlignment : true 20 | DerivePointerBinding : false 21 | IndentWidth : 4 22 | KeepEmptyLinesAtTheStartOfBlocks : true 23 | MaxEmptyLinesToKeep : 2 24 | NamespaceIndentation : All 25 | PointerBindsToType : true 26 | SpacesBeforeTrailingComments : 1 27 | SpacesInAngles : false 28 | SpacesInSquareBrackets : false 29 | TabWidth : 4 30 | UseTab : ForIndentation 31 | #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- 32 | #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#- 33 | -------------------------------------------------------------------------------- /third_party/EASTL/EAAssert/eaassert.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // eaassert.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EAASSERT_EAASSERT_H 8 | #define EAASSERT_EAASSERT_H 9 | 10 | #include 11 | #define EA_ASSERT assert 12 | #define EA_ASSERT_MSG(condition, msg) assert(condition) 13 | 14 | #define EA_FAIL() assert(false) 15 | 16 | 17 | #endif // EAASSERT_EAASSERT_H 18 | -------------------------------------------------------------------------------- /third_party/EASTL/EABase/.gitignore: -------------------------------------------------------------------------------- 1 | tags 2 | 3 | -------------------------------------------------------------------------------- /third_party/EASTL/EABase/earesult.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * earesult.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_earesult_H 9 | #define INCLUDED_earesult_H 10 | 11 | 12 | #include "eabase.h" 13 | 14 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 15 | #pragma once /* Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. */ 16 | #endif 17 | 18 | 19 | 20 | /* This result type is width-compatible with most systems. */ 21 | typedef int32_t ea_result_type; 22 | 23 | 24 | namespace EA 25 | { 26 | typedef int32_t result_type; 27 | 28 | enum 29 | { 30 | #ifndef SUCCESS 31 | // Deprecated 32 | // Note: a public MS header has created a define of this name which causes a build error. Fortunately they 33 | // define it to 0 which is compatible. 34 | // see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h 35 | SUCCESS = 0, 36 | #endif 37 | // Deprecated 38 | FAILURE = -1, 39 | 40 | // These values are now the preferred constants 41 | EA_SUCCESS = 0, 42 | EA_FAILURE = -1, 43 | }; 44 | } 45 | 46 | 47 | /* Macro to simplify testing for success. */ 48 | #ifndef EA_SUCCEEDED 49 | #define EA_SUCCEEDED(result) ((result) >= 0) 50 | #endif 51 | 52 | /* Macro to simplfify testing for general failure. */ 53 | #ifndef EA_FAILED 54 | #define EA_FAILED(result) ((result) < 0) 55 | #endif 56 | 57 | 58 | #endif 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /third_party/EASTL/EABase/eaunits.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * eaunits.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | 8 | #ifndef INCLUDED_eaunits_h 9 | #define INCLUDED_eaunits_h 10 | 11 | #include "eabase.h" 12 | 13 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 14 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 15 | #endif 16 | 17 | // Defining common SI unit macros. 18 | // 19 | // The mebibyte is a multiple of the unit byte for digital information. Technically a 20 | // megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two, 21 | // appropriate for binary machines. Many Linux distributions use the unit, but it is 22 | // not widely acknowledged within the industry or media. 23 | // Reference: https://en.wikipedia.org/wiki/Mebibyte 24 | // 25 | // Examples: 26 | // auto size1 = EA_KILOBYTE(16); 27 | // auto size2 = EA_MEGABYTE(128); 28 | // auto size3 = EA_MEBIBYTE(8); 29 | // auto size4 = EA_GIBIBYTE(8); 30 | 31 | // define byte for completeness 32 | #define EA_BYTE(x) (x) 33 | 34 | // Decimal SI units 35 | #define EA_KILOBYTE(x) (size_t(x) * 1000) 36 | #define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000) 37 | #define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000) 38 | #define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000) 39 | #define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000) 40 | #define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000) 41 | 42 | // Binary SI units 43 | #define EA_KIBIBYTE(x) (size_t(x) * 1024) 44 | #define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024) 45 | #define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024) 46 | #define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024) 47 | #define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024) 48 | #define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024) 49 | 50 | #endif // INCLUDED_earesult_H 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /third_party/EASTL/EABase/version.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------- 2 | * version.h 3 | * 4 | * Copyright (c) Electronic Arts Inc. All rights reserved. 5 | *---------------------------------------------------------------------------*/ 6 | 7 | #ifndef INCLUDED_EABASE_VERSION_H 8 | #define INCLUDED_EABASE_VERSION_H 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | // EABASE_VERSION 12 | // 13 | // We more or less follow the conventional EA packaging approach to versioning 14 | // here. A primary distinction here is that minor versions are defined as two 15 | // digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic 16 | // here is that the value is a counter and not a floating point fraction. 17 | // Note that the major version doesn't have leading zeros. 18 | // 19 | // Example version strings: 20 | // "0.91.00" // Major version 0, minor version 91, patch version 0. 21 | // "1.00.00" // Major version 1, minor and patch version 0. 22 | // "3.10.02" // Major version 3, minor version 10, patch version 02. 23 | // "12.03.01" // Major version 12, minor version 03, patch version 24 | // 25 | // Example usage: 26 | // printf("EABASE version: %s", EABASE_VERSION); 27 | // printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100); 28 | // 29 | /////////////////////////////////////////////////////////////////////////////// 30 | 31 | #ifndef EABASE_VERSION 32 | #define EABASE_VERSION "2.09.03" 33 | #define EABASE_VERSION_N 20903 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EADateTime.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // EADateTime.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EASTDC_EADATETIME_H 8 | #define EASTDC_EADATETIME_H 9 | 10 | #include 11 | 12 | #define EASTDC_API 13 | 14 | namespace EA { 15 | namespace StdC { 16 | 17 | inline EASTDC_API uint64_t GetTime() 18 | { 19 | using namespace std::chrono; 20 | nanoseconds ns = duration_cast(system_clock::now().time_since_epoch()); 21 | return ns.count(); 22 | } 23 | 24 | }} // namespace EA::StdC 25 | 26 | 27 | #endif // EASTDC_EADATETIME_H 28 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EAMemory.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // EAMemory.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EASTDC_EASPRINTF_H 8 | #define EASTDC_EASPRINTF_H 9 | 10 | #include "../EABase/eabase.h" 11 | #include "../EAAssert/eaassert.h" 12 | 13 | #include 14 | 15 | #define EASTDC_API 16 | 17 | namespace EA { 18 | namespace StdC { 19 | 20 | EASTDC_API const void* Memcheck8 (const void* p, uint8_t c, size_t byteCount); 21 | EASTDC_API const void* Memcheck16(const void* p, uint16_t c, size_t byteCount); 22 | EASTDC_API const void* Memcheck32(const void* p, uint32_t c, size_t byteCount); 23 | EASTDC_API const void* Memcheck64(const void* p, uint64_t c, size_t byteCount); 24 | 25 | 26 | EASTDC_API inline uint8_t* Memset8(void* pDest, uint8_t c, size_t uint8Count) 27 | { 28 | return (uint8_t*)memset(pDest, c, uint8Count); 29 | } 30 | 31 | 32 | EASTDC_API inline uint16_t* Memset16(void* pDest, uint16_t c, size_t count) 33 | { 34 | EA_ASSERT(((uintptr_t)pDest & 1) == 0); 35 | 36 | uint16_t* cur = (uint16_t*)pDest; 37 | const uint16_t* const end = (uint16_t*)pDest + count; 38 | while(cur < end) 39 | *cur++ = c; 40 | 41 | return (uint16_t*)pDest; 42 | } 43 | 44 | 45 | EASTDC_API inline uint32_t* Memset32(void* pDest, uint32_t c, size_t count) 46 | { 47 | EA_ASSERT(((uintptr_t)pDest & 3) == 0); 48 | 49 | uint32_t* cur = (uint32_t*)pDest; 50 | const uint32_t* const end = (uint32_t*)pDest + count; 51 | while(cur < end) 52 | *cur++ = c; 53 | 54 | return (uint32_t*)pDest; 55 | } 56 | 57 | 58 | EASTDC_API inline uint64_t* Memset64(void* pDest, uint64_t c, size_t count) 59 | { 60 | EA_ASSERT(((uintptr_t)pDest & 7) == 0); 61 | 62 | uint64_t* cur = (uint64_t*)pDest; 63 | const uint64_t* const end = (uint64_t*)pDest + count; 64 | 65 | while(cur < end) 66 | *cur++ = c; 67 | 68 | return (uint64_t*)pDest; 69 | } 70 | 71 | 72 | EASTDC_API inline int Memcmp(const void* p1, const void* p2, size_t n) 73 | { 74 | return memcmp(p1, p2, n); 75 | } 76 | 77 | 78 | EASTDC_API inline void Memfill8(void* pDestination, uint8_t c, size_t byteCount) 79 | { 80 | Memset8(pDestination, c, byteCount); 81 | } 82 | 83 | 84 | }} // namespace EA::StdC 85 | 86 | #endif // EASTDC_EASPRINTF_H 87 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EAProcess.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // EAProcess.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EASTDC_EAPROCESS_H 8 | #define EASTDC_EAPROCESS_H 9 | 10 | namespace EA { 11 | namespace StdC { 12 | 13 | }} // namespace EA::StdC 14 | 15 | 16 | #endif // EASTDC_EAPROCESS_H 17 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EASprintf.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // EASprintf.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #include "../EABase/eabase.h" 8 | #include "../EAAssert/eaassert.h" 9 | #include "EASprintf.h" 10 | #include 11 | 12 | namespace EA { 13 | namespace StdC { 14 | 15 | EASTDC_API int Vsnprintf(char8_t* EA_RESTRICT pDestination, size_t n, const char8_t* EA_RESTRICT pFormat, va_list arguments) 16 | { return vsnprintf(pDestination, n, pFormat, arguments); } 17 | 18 | EASTDC_API int Vsnprintf(char16_t* EA_RESTRICT pDestination, size_t n, const char16_t* EA_RESTRICT pFormat, va_list arguments) 19 | { return vswprintf((wchar_t*)pDestination, n, (wchar_t*)pFormat, arguments); } 20 | 21 | EASTDC_API int Vsnprintf(char32_t* EA_RESTRICT pDestination, size_t n, const char32_t* EA_RESTRICT pFormat, va_list arguments) 22 | { return vswprintf((wchar_t*)pDestination, n, (wchar_t*)pFormat, arguments); } 23 | 24 | #if defined(EA_WCHAR_UNIQUE) && EA_WCHAR_UNIQUE 25 | EASTDC_API int Vsnprintf(wchar_t* EA_RESTRICT pDestination, size_t n, const wchar_t* EA_RESTRICT pFormat, va_list arguments) 26 | { return vswprintf(pDestination, n, pFormat, arguments); } 27 | #endif 28 | 29 | }} 30 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EASprintf.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // EASprintf.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | /////////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EASTDC_EASPRINTF_H 8 | #define EASTDC_EASPRINTF_H 9 | 10 | #include "../EABase/eabase.h" 11 | #include "../EABase/eastdarg.h" 12 | #include 13 | 14 | #define EASTDC_API 15 | 16 | namespace EA { 17 | namespace StdC { 18 | 19 | EASTDC_API int Vsnprintf(char8_t* EA_RESTRICT pDestination, size_t n, const char8_t* EA_RESTRICT pFormat, va_list arguments); 20 | EASTDC_API int Vsnprintf(char16_t* EA_RESTRICT pDestination, size_t n, const char16_t* EA_RESTRICT pFormat, va_list arguments); 21 | EASTDC_API int Vsnprintf(char32_t* EA_RESTRICT pDestination, size_t n, const char32_t* EA_RESTRICT pFormat, va_list arguments); 22 | 23 | #if defined(EA_WCHAR_UNIQUE) && EA_WCHAR_UNIQUE 24 | EASTDC_API int Vsnprintf(wchar_t* EA_RESTRICT pDestination, size_t n, const wchar_t* EA_RESTRICT pFormat, va_list arguments); 25 | #endif 26 | 27 | template 28 | EASTDC_API int Sprintf(T* EA_RESTRICT pDestination, const T* EA_RESTRICT pFormat, ...) 29 | { 30 | va_list arguments; 31 | va_start(arguments, pFormat); 32 | 33 | auto result = vsprintf(pDestination, pFormat, arguments); 34 | 35 | va_end(arguments); 36 | 37 | return result; 38 | } 39 | 40 | }} // namespace EA::StdC 41 | 42 | #endif // EASTDC_EASPRINTF_H 43 | -------------------------------------------------------------------------------- /third_party/EASTL/EAStdC/EATextUtil.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // EATextUtil.h 3 | // 4 | // Copyright (c) Electronic Arts. All rights reserved. 5 | ///////////////////////////////////////////////////////////////////////////// 6 | 7 | #ifndef EASTDC_EATEXTUTIL_H 8 | #define EASTDC_EATEXTUTIL_H 9 | 10 | #define EASTDC_API 11 | 12 | namespace EA { 13 | namespace StdC { 14 | 15 | // EASTDC_API size_t UTF8CharSize(const char8_t* p); 16 | EASTDC_API size_t UTF8CharSize(char16_t c) 17 | { 18 | if(c < 0x00000080) 19 | return 1; 20 | else if(c < 0x00000800) 21 | return 2; 22 | else // if(c < 0x00010000) 23 | return 3; 24 | 25 | // The following would be used if the input was 32 bit instead of 16 bit. 26 | //else if(c < 0x00010000) 27 | // return 3; 28 | //else if(c < 0x00200000) 29 | // return 4; 30 | //else if(c < 0x04000000) 31 | // return 5; 32 | //else if(c <= 0x7fffffff) 33 | // return 6; 34 | // 35 | //return 1; // Error 36 | } 37 | // EASTDC_API size_t UTF8CharSize(char32_t c); 38 | 39 | EASTDC_API char8_t* UTF8WriteChar(char8_t* p, char16_t c) 40 | { 41 | if(c < 0x80) 42 | { 43 | *p++ = (char8_t)(uint8_t)c; 44 | } 45 | else if(c < 0x0800) 46 | { 47 | *p++ = (char8_t)(uint8_t)((c >> 6) | 0xC0); 48 | *p++ = (char8_t)(uint8_t)((c & 0x3F) | 0x80); 49 | } 50 | else // if(c < 0x00010000) 51 | { 52 | *p++ = (char8_t)(uint8_t)((c >> 12) | 0xE0); 53 | *p++ = (char8_t)(uint8_t)(((c >> 6) & 0x3F) | 0x80); 54 | *p++ = (char8_t)(uint8_t)((c & 0x3F) | 0x80); 55 | } 56 | //else 57 | //{ 58 | // *p++ = (char8_t)(uint8_t)((c >> 18) | 0xF0); 59 | // *p++ = (char8_t)(uint8_t)(((c >> 12) & 0x3F) | 0x80); 60 | // *p++ = (char8_t)(uint8_t)(((c >> 6) & 0x3F) | 0x80); 61 | // *p++ = (char8_t)(uint8_t)((c & 0x3F) | 0x80); 62 | //} 63 | 64 | return p; 65 | } 66 | // EASTDC_API char8_t* UTF8WriteChar(char8_t* p, char32_t c); 67 | 68 | }} // namespace EA::StdC 69 | 70 | #endif // EASTDC_EATEXTUTIL_H 71 | -------------------------------------------------------------------------------- /third_party/EASTL/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2015 Electronic Arts Inc. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. Neither the name of Electronic Arts, Inc. ("EA") nor the names of 14 | its contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | -------------------------------------------------------------------------------- /third_party/EASTL/allocator_eastl.cpp: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include "internal/config.h" 7 | #include "allocator.h" 8 | 9 | 10 | /////////////////////////////////////////////////////////////////////////////// 11 | // ReadMe 12 | // 13 | // This file implements the default application allocator. 14 | // You can replace this allocator.cpp file with a different one, 15 | // you can define EASTL_USER_DEFINED_ALLOCATOR below to ignore this file, 16 | // or you can modify the EASTL config.h file to redefine how allocators work. 17 | /////////////////////////////////////////////////////////////////////////////// 18 | 19 | 20 | #ifndef EASTL_USER_DEFINED_ALLOCATOR // If the user hasn't declared that he has defined an allocator implementation elsewhere... 21 | 22 | namespace eastl 23 | { 24 | 25 | /// gDefaultAllocator 26 | /// Default global allocator instance. 27 | EASTL_API allocator gDefaultAllocator; 28 | EASTL_API allocator* gpDefaultAllocator = &gDefaultAllocator; 29 | 30 | EASTL_API allocator* GetDefaultAllocator() 31 | { 32 | return gpDefaultAllocator; 33 | } 34 | 35 | EASTL_API allocator* SetDefaultAllocator(allocator* pAllocator) 36 | { 37 | allocator* const pPrevAllocator = gpDefaultAllocator; 38 | gpDefaultAllocator = pAllocator; 39 | return pPrevAllocator; 40 | } 41 | 42 | } // namespace eastl 43 | 44 | 45 | #endif // EASTL_USER_DEFINED_ALLOCATOR 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /third_party/EASTL/allocator_forge.cpp: -------------------------------------------------------------------------------- 1 | #include "internal/config.h" 2 | #include "allocator_forge.h" 3 | 4 | #if EASTL_ALLOCATOR_FORGE 5 | #include "Interfaces/IMemory.h" 6 | 7 | namespace eastl 8 | { 9 | 10 | void* allocator_forge::allocate(size_t n, int /*flags*/) 11 | { 12 | return conf_malloc(n); 13 | } 14 | 15 | void* allocator_forge::allocate(size_t n, size_t alignment, size_t alignmentOffset, int /*flags*/) 16 | { 17 | if ((alignmentOffset % alignment) == 0) // We check for (offset % alignmnent == 0) instead of (offset == 0) because any block which is 18 | // aligned on e.g. 64 also is aligned at an offset of 64 by definition. 19 | return conf_memalign(alignment, n); 20 | 21 | return NULL; 22 | } 23 | 24 | void allocator_forge::deallocate(void* p, size_t /*n*/) 25 | { 26 | conf_free(p); 27 | } 28 | 29 | /// gDefaultAllocator 30 | /// Default global allocator_forge instance. 31 | EASTL_API allocator_forge gDefaultAllocatorForge; 32 | EASTL_API allocator_forge* gpDefaultAllocatorForge = &gDefaultAllocatorForge; 33 | 34 | EASTL_API allocator_forge* GetDefaultAllocatorForge() 35 | { 36 | return gpDefaultAllocatorForge; 37 | } 38 | 39 | EASTL_API allocator_forge* SetDefaultAllocatorForge(allocator_forge* pAllocator) 40 | { 41 | allocator_forge* const pPrevAllocator = gpDefaultAllocatorForge; 42 | gpDefaultAllocatorForge = pAllocator; 43 | return pPrevAllocator; 44 | } 45 | 46 | } // namespace eastl 47 | 48 | 49 | #endif // EASTL_USER_DEFINED_ALLOCATOR 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /third_party/EASTL/allocator_forge.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_ALLOCATOR_FORGE_H 7 | #define EASTL_ALLOCATOR_FORGE_H 8 | 9 | #include "internal/config.h" 10 | 11 | #if EASTL_ALLOCATOR_FORGE 12 | 13 | namespace eastl 14 | { 15 | /////////////////////////////////////////////////////////////////////////////// 16 | // allocator_forge 17 | // 18 | // Implements an EASTL allocator that uses malloc/free as opposed to 19 | // new/delete or PPMalloc Malloc/Free. 20 | // 21 | // Example usage: 22 | // vector intVector; 23 | // 24 | class allocator_forge 25 | { 26 | public: 27 | allocator_forge(const char* = NULL) {} 28 | 29 | allocator_forge(const allocator_forge&) {} 30 | 31 | allocator_forge(const allocator_forge&, const char*) {} 32 | 33 | allocator_forge& operator=(const allocator_forge&) { return *this; } 34 | 35 | bool operator==(const allocator_forge&) { return true; } 36 | 37 | bool operator!=(const allocator_forge&) { return false; } 38 | 39 | void* allocate(size_t n, int /*flags*/ = 0); 40 | 41 | void* allocate(size_t n, size_t alignment, size_t alignmentOffset, int /*flags*/ = 0); 42 | 43 | void deallocate(void* p, size_t /*n*/); 44 | 45 | const char* get_name() const { return "allocator_forge"; } 46 | 47 | void set_name(const char*) {} 48 | }; 49 | inline bool operator==(const allocator_forge&, const allocator_forge&) { return true; } 50 | inline bool operator!=(const allocator_forge&, const allocator_forge&) { return false; } 51 | 52 | EASTL_API allocator_forge* GetDefaultAllocatorForge(); 53 | EASTL_API allocator_forge* SetDefaultAllocatorForge(allocator_forge* pAllocator); 54 | 55 | } // namespace eastl 56 | 57 | #endif 58 | 59 | #endif // Header include guard 60 | -------------------------------------------------------------------------------- /third_party/EASTL/bonus/adaptors.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | /////////////////////////////////////////////////////////////////////////////// 6 | /////////////////////////////////////////////////////////////////////////////// 7 | 8 | 9 | #ifndef EASTL_ADAPTORS_H 10 | #define EASTL_ADAPTORS_H 11 | 12 | 13 | #include "../internal/config.h" 14 | #include "../internal/move_help.h" 15 | 16 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 17 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 18 | #endif 19 | 20 | EA_DISABLE_VC_WARNING(4512 4626) 21 | #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+ 22 | EA_DISABLE_VC_WARNING(5027) // move assignment operator was implicitly defined as deleted 23 | #endif 24 | 25 | 26 | namespace eastl 27 | { 28 | /// reverse 29 | /// 30 | /// This adaptor allows reverse iteration of a container in ranged base for-loops. 31 | /// 32 | /// for (auto& i : reverse(c)) { ... } 33 | /// 34 | template 35 | struct reverse_wrapper 36 | { 37 | reverse_wrapper(Container& c) : mContainer(c) {} 38 | Container& mContainer; 39 | }; 40 | 41 | template 42 | auto begin(const reverse_wrapper& w) -> decltype(rbegin(w.mContainer)) 43 | { return rbegin(w.mContainer); } 44 | 45 | template 46 | auto end(const reverse_wrapper& w) -> decltype(rend(w.mContainer)) 47 | { return rend(w.mContainer); } 48 | 49 | template 50 | reverse_wrapper reverse(Container&& c) 51 | { return reverse_wrapper(eastl::forward(c)); } 52 | 53 | } // namespace eastl 54 | 55 | #if defined(_MSC_VER) && (_MSC_VER >= 1900) // VS2015+ 56 | EA_RESTORE_VC_WARNING() 57 | #endif 58 | EA_RESTORE_VC_WARNING() 59 | 60 | #endif // Header include guard 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /third_party/EASTL/bonus/fixed_ring_buffer.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_FIXED_RING_BUFFER_H 6 | #define EASTL_FIXED_RING_BUFFER_H 7 | 8 | #include "../internal/config.h" 9 | #include "../fixed_vector.h" 10 | #include "../bonus/ring_buffer.h" 11 | 12 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 13 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 14 | #endif 15 | 16 | namespace eastl 17 | { 18 | 19 | /// fixed_ring_buffer 20 | /// 21 | /// This is a convenience template alias for creating a fixed-sized 22 | /// ring_buffer using eastl::fixed_vector as its storage container. This has 23 | /// been tricky for users to get correct due to the constructor requirements 24 | /// of eastl::ring_buffer leaking the implementation detail of the sentinel 25 | /// value being used internally. In addition, it was not obvious what the 26 | /// correct allocator_type template parameter should be used for containers 27 | /// providing both a default allocator type and an overflow allocator type. 28 | /// 29 | /// We are over-allocating the fixed_vector container to accommodate the 30 | /// ring_buffer sentinel to prevent that implementation detail leaking into 31 | /// user code. 32 | /// 33 | /// Example usage: 34 | /// 35 | /// fixed_ring_buffer rb = {0, 1, 2, 3, 4, 5, 6, 7}; 36 | /// or 37 | /// fixed_ring_buffer rb(8); // capacity doesn't need to respect sentinel 38 | /// rb.push_back(0); 39 | /// 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template 43 | using fixed_ring_buffer = 44 | ring_buffer, typename fixed_vector::overflow_allocator_type>; 45 | #endif 46 | 47 | } // namespace eastl 48 | 49 | #endif // Header include guard 50 | 51 | -------------------------------------------------------------------------------- /third_party/EASTL/fixed_pool.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #include "internal/fixed_pool.h" 7 | #include "fixed_allocator.h" 8 | 9 | 10 | 11 | namespace eastl 12 | { 13 | 14 | 15 | EASTL_API void fixed_pool_base::init(void* pMemory, size_t memorySize, size_t nodeSize, 16 | size_t alignment, size_t /*alignmentOffset*/) 17 | { 18 | // To do: Support alignmentOffset. 19 | 20 | #if EASTL_FIXED_SIZE_TRACKING_ENABLED 21 | mnCurrentSize = 0; 22 | mnPeakSize = 0; 23 | #endif 24 | 25 | if(pMemory) 26 | { 27 | // Assert that alignment is a power of 2 value (e.g. 1, 2, 4, 8, 16, etc.) 28 | EASTL_ASSERT((alignment & (alignment - 1)) == 0); 29 | 30 | // Make sure alignment is a valid value. 31 | if(alignment < 1) 32 | alignment = 1; 33 | 34 | mpNext = (Link*)(((uintptr_t)pMemory + (alignment - 1)) & ~(alignment - 1)); 35 | memorySize -= (uintptr_t)mpNext - (uintptr_t)pMemory; 36 | pMemory = mpNext; 37 | 38 | // The node size must be at least as big as a Link, which itself is sizeof(void*). 39 | if(nodeSize < sizeof(Link)) 40 | nodeSize = ((sizeof(Link) + (alignment - 1))) & ~(alignment - 1); 41 | 42 | // If the user passed in a memory size that wasn't a multiple of the node size, 43 | // we need to chop down the memory size so that the last node is not a whole node. 44 | memorySize = (memorySize / nodeSize) * nodeSize; 45 | 46 | mpCapacity = (Link*)((uintptr_t)pMemory + memorySize); 47 | mpHead = NULL; 48 | mnNodeSize = nodeSize; 49 | } 50 | } 51 | 52 | 53 | } // namespace eastl 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/allocator_traits_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_ALLOCATOR_TRAITS_H 7 | #define EASTL_INTERNAL_ALLOCATOR_TRAITS_H 8 | 9 | 10 | #include "../EABase/eabase.h" 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | #include "config.h" 16 | #include "../numeric_limits.h" 17 | 18 | namespace eastl 19 | { 20 | template 21 | struct allocator_traits; 22 | 23 | } // namespace eastl 24 | 25 | #endif // Header include guard 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/function_help.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_FUNCTION_HELP_H 6 | #define EASTL_INTERNAL_FUNCTION_HELP_H 7 | 8 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 9 | #pragma once 10 | #endif 11 | 12 | #include "config.h" 13 | #include "../type_traits.h" 14 | 15 | namespace eastl 16 | { 17 | namespace internal 18 | { 19 | 20 | ////////////////////////////////////////////////////////////////////// 21 | // is_null 22 | // 23 | template 24 | bool is_null(const T&) 25 | { 26 | return false; 27 | } 28 | 29 | template 30 | bool is_null(Result (*const& function_pointer)(Arguments...)) 31 | { 32 | return function_pointer == nullptr; 33 | } 34 | 35 | template 36 | bool is_null(Result (Class::*const& function_pointer)(Arguments...)) 37 | { 38 | return function_pointer == nullptr; 39 | } 40 | 41 | template 42 | bool is_null(Result (Class::*const& function_pointer)(Arguments...) const) 43 | { 44 | return function_pointer == nullptr; 45 | } 46 | 47 | } // namespace internal 48 | } // namespace eastl 49 | 50 | #endif // Header include guard 51 | 52 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/memory_base.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_INTERNAL_MEMORY_BASE_H 6 | #define EASTL_INTERNAL_MEMORY_BASE_H 7 | 8 | #include "config.h" 9 | 10 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 11 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 12 | #endif 13 | 14 | 15 | //////////////////////////////////////////////////////////////////////////////////////////// 16 | // This file contains basic functionality found in the standard library 'memory' header that 17 | // have limited or no dependencies. This allows us to utilize these utilize these functions 18 | // in other EASTL code while avoid circular dependencies. 19 | //////////////////////////////////////////////////////////////////////////////////////////// 20 | 21 | namespace eastl 22 | { 23 | /// addressof 24 | /// 25 | /// From the C++11 Standard, section 20.6.12.1 26 | /// Returns the actual address of the object or function referenced by r, even in the presence of an overloaded operator&. 27 | /// 28 | template 29 | T* addressof(T& value) EA_NOEXCEPT 30 | { 31 | return reinterpret_cast(&const_cast(reinterpret_cast(value))); 32 | } 33 | 34 | } // namespace eastl 35 | 36 | #endif // EASTL_INTERNAL_MEMORY_BASE_H 37 | 38 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/pair_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_PAIR_FWD_DECLS_H 6 | #define EASTL_PAIR_FWD_DECLS_H 7 | 8 | #include "config.h" 9 | 10 | namespace eastl 11 | { 12 | template 13 | struct pair; 14 | } 15 | 16 | #endif // EASTL_PAIR_FWD_DECLS_H 17 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/piecewise_construct_t.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 7 | #define EASTL_INTERNAL_PIECEWISE_CONSTRUCT_T_H 8 | 9 | 10 | #include "../EABase/eabase.h" 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | /////////////////////////////////////////////////////////////////////////////// 18 | /// piecewise_construct_t 19 | /// 20 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct_t 21 | /// 22 | struct piecewise_construct_t 23 | { 24 | explicit piecewise_construct_t() = default; 25 | }; 26 | 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | /// piecewise_construct 30 | /// 31 | /// A tag type used to disambiguate between function overloads that take two tuple arguments. 32 | /// 33 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct 34 | /// 35 | EA_CONSTEXPR piecewise_construct_t piecewise_construct = eastl::piecewise_construct_t(); 36 | 37 | } // namespace eastl 38 | 39 | 40 | #endif // Header include guard 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /third_party/EASTL/internal/tuple_fwd_decls.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_TUPLE_FWD_DECLS_H 6 | #define EASTL_TUPLE_FWD_DECLS_H 7 | 8 | #include "config.h" 9 | 10 | #if EASTL_TUPLE_ENABLED 11 | 12 | namespace eastl 13 | { 14 | template 15 | class tuple; 16 | 17 | template 18 | class tuple_size; 19 | 20 | template 21 | class tuple_element; 22 | 23 | template 24 | using tuple_element_t = typename tuple_element::type; 25 | 26 | // const typename for tuple_element_t, for when tuple or TupleImpl cannot itself be const 27 | template 28 | using const_tuple_element_t = typename conditional< 29 | is_lvalue_reference>::value, 30 | add_lvalue_reference_t>>, 31 | const tuple_element_t 32 | >::type; 33 | 34 | // get 35 | template 36 | tuple_element_t>& get(tuple& t); 37 | 38 | template 39 | const_tuple_element_t>& get(const tuple& t); 40 | 41 | template 42 | tuple_element_t>&& get(tuple&& t); 43 | 44 | template 45 | T& get(tuple& t); 46 | 47 | template 48 | const T& get(const tuple& t); 49 | 50 | template 51 | T&& get(tuple&& t); 52 | } 53 | 54 | #endif // EASTL_VARIADIC_TEMPLATES_ENABLED 55 | 56 | #endif // EASTL_TUPLE_FWD_DECLS_H 57 | -------------------------------------------------------------------------------- /third_party/EASTL/intrusive_list.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #include "intrusive_list.h" 6 | 7 | 8 | namespace eastl 9 | { 10 | 11 | 12 | EASTL_API void intrusive_list_base::reverse() EA_NOEXCEPT 13 | { 14 | intrusive_list_node* pNode = &mAnchor; 15 | do { 16 | intrusive_list_node* const pTemp = pNode->mpNext; 17 | pNode->mpNext = pNode->mpPrev; 18 | pNode->mpPrev = pTemp; 19 | pNode = pNode->mpPrev; 20 | } 21 | while(pNode != &mAnchor); 22 | } 23 | 24 | 25 | 26 | EASTL_API bool intrusive_list_base::validate() const 27 | { 28 | const intrusive_list_node *p = &mAnchor; 29 | const intrusive_list_node *q = p; 30 | 31 | // We do two tests below: 32 | // 33 | // 1) Prev and next pointers are symmetric. We check (p->next->prev == p) 34 | // for each node, which is enough to verify all links. 35 | // 36 | // 2) Loop check. We bump the q pointer at one-half rate compared to the 37 | // p pointer; (p == q) if and only if we are at the start (which we 38 | // don't check) or if there is a loop somewhere in the list. 39 | 40 | do { 41 | // validate node (even phase) 42 | if (p->mpNext->mpPrev != p) 43 | return false; // broken linkage detected 44 | 45 | // bump only fast pointer 46 | p = p->mpNext; 47 | if (p == &mAnchor) 48 | break; 49 | 50 | if (p == q) 51 | return false; // loop detected 52 | 53 | // validate node (odd phase) 54 | if (p->mpNext->mpPrev != p) 55 | return false; // broken linkage detected 56 | 57 | // bump both pointers 58 | p = p->mpNext; 59 | q = q->mpNext; 60 | 61 | if (p == q) 62 | return false; // loop detected 63 | 64 | } while(p != &mAnchor); 65 | 66 | return true; 67 | } 68 | 69 | 70 | } // namespace eastl 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /third_party/EASTL/unordered_map.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_UNORDERED_MAP_H 6 | #define EASTL_UNORDERED_MAP_H 7 | 8 | #include "internal/config.h" 9 | #include "hash_map.h" 10 | 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | /// unordered_map 18 | /// 19 | /// The original TR1 (technical report 1) used "hash_map" to name a hash 20 | /// table backed associative container of unique key-value pairs. When the 21 | /// container was added to the C++11 standard the committee chose the name 22 | /// "unordered_map" to clarify that internally the elements are NOT sorted in 23 | /// any particular order. We provide a template alias here to ensure feature 24 | /// parity with the original eastl::hash_map. 25 | /// 26 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 27 | template , 30 | typename Predicate = eastl::equal_to, 31 | typename Allocator = EASTLAllocatorType, 32 | bool bCacheHashCode = false> 33 | using unordered_map = hash_map; 34 | #endif 35 | 36 | /// unordered_multimap 37 | /// 38 | /// Similar template alias as "unordered_map" except the contained elements 39 | /// need not be unique. See "hash_multimap" for more details. 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template , 45 | typename Predicate = eastl::equal_to, 46 | typename Allocator = EASTLAllocatorType, 47 | bool bCacheHashCode = false> 48 | using unordered_multimap = hash_multimap; 49 | #endif 50 | 51 | } // namespace eastl 52 | 53 | #endif // Header include guard 54 | 55 | -------------------------------------------------------------------------------- /third_party/EASTL/unordered_set.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_UNORDERED_SET_H 6 | #define EASTL_UNORDERED_SET_H 7 | 8 | #include "internal/config.h" 9 | #include "hash_set.h" 10 | 11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 12 | #pragma once // Some compilers (e.g. VC++) benefit significantly from using this. We've measured 3-4% build speed improvements in apps as a result. 13 | #endif 14 | 15 | namespace eastl 16 | { 17 | 18 | /// unordered_set 19 | /// 20 | /// The original TR1 (technical report 1) used "hash_set" to name a hash 21 | /// table backed associative container of unique "Key" type objects. When 22 | /// the container was added to the C++11 standard the committee chose the 23 | /// name "unordered_set" to clarify that internally the elements are NOT 24 | /// sorted in any particular order. We provide a template alias here to 25 | /// ensure feature parity with the original eastl::hash_set. 26 | /// 27 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 28 | template , 30 | typename Predicate = eastl::equal_to, 31 | typename Allocator = EASTLAllocatorType, 32 | bool bCacheHashCode = false> 33 | using unordered_set = hash_set; 34 | #endif 35 | 36 | /// unordered_multiset 37 | /// 38 | /// Similar template alias as "unordered_set" except the contained elements 39 | /// need not be unique. See "hash_multiset" for more details. 40 | /// 41 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES) 42 | template , 44 | typename Predicate = eastl::equal_to, 45 | typename Allocator = EASTLAllocatorType, 46 | bool bCacheHashCode = false> 47 | using unordered_multiset = hash_multiset; 48 | #endif 49 | 50 | } // namespace eastl 51 | 52 | #endif // Header include guard 53 | 54 | -------------------------------------------------------------------------------- /third_party/EASTL/version.h: -------------------------------------------------------------------------------- 1 | ///////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | ///////////////////////////////////////////////////////////////////////////// 4 | 5 | #ifndef EASTL_VERSION_H 6 | #define EASTL_VERSION_H 7 | 8 | #include "EABase/eabase.h" 9 | #if defined(EA_PRAGMA_ONCE_SUPPORTED) 10 | #pragma once 11 | #endif 12 | 13 | #include "internal/config.h" 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /third_party/EASTL/weak_ptr.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // Copyright (c) Electronic Arts Inc. All rights reserved. 3 | /////////////////////////////////////////////////////////////////////////////// 4 | 5 | 6 | #ifndef EASTL_WEAK_PTR_H 7 | #define EASTL_WEAK_PTR_H 8 | 9 | 10 | // This header file is deprecated. The implementation has moved: 11 | #include "shared_ptr.h" 12 | 13 | 14 | #endif 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /third_party/FluidStudios/MemoryManager/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/FluidStudios/MemoryManager/readme.txt -------------------------------------------------------------------------------- /third_party/Fontstash/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Mikko Mononen memon@inside.org 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | 19 | -------------------------------------------------------------------------------- /third_party/MicroProfile/Profiler.cpp: -------------------------------------------------------------------------------- 1 | #include "Renderer/Interfaces/IProfiler.h" 2 | 3 | #include "ProfilerBase.h" 4 | #include "ProfilerUI.h" 5 | 6 | void flipProfiler() 7 | { 8 | ProfileFlip(); 9 | } 10 | 11 | void cmdDrawProfiler(Cmd * pCmd, uint32_t Width, uint32_t Height) 12 | { 13 | ProfileDraw(pCmd, Width, Height); 14 | } 15 | -------------------------------------------------------------------------------- /third_party/MicroProfile/README.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/MicroProfile/README.txt -------------------------------------------------------------------------------- /third_party/ModifiedSonyMath/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Vector Math library for 3-D linear algebra (vector, matrix, quaternion) 2 | SIMD support for SSE. Also includes generic multi-platform scalar version. 3 | 4 | Copyright (C) 2006, 2007 Sony Computer Entertainment Inc. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, 8 | with or without modification, are permitted provided that the 9 | following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the Sony Computer Entertainment Inc nor the names 16 | of its contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | -------------------------------------------------------------------------------- /third_party/ModifiedSonyMath/soa/transform.hpp: -------------------------------------------------------------------------------- 1 | //========================================= #ConfettiMathExtensionsBegin ================================================ 2 | //========================================= #ConfettiAnimationMathExtensionsBegin ======================================= 3 | 4 | /* 5 | * Copyright (c) 2018-2019 Confetti Interactive Inc. 6 | * 7 | * This file is part of The-Forge 8 | * (see https://github.com/ConfettiFX/The-Forge). 9 | * 10 | * Licensed to the Apache Software Foundation (ASF) under one 11 | * or more contributor license agreements. See the NOTICE file 12 | * distributed with this work for additional information 13 | * regarding copyright ownership. The ASF licenses this file 14 | * to you under the Apache License, Version 2.0 (the 15 | * "License"); you may not use this file except in compliance 16 | * with the License. You may obtain a copy of the License at 17 | * 18 | * http://www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, 21 | * software distributed under the License is distributed on an 22 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 23 | * KIND, either express or implied. See the License for the 24 | * specific language governing permissions and limitations 25 | * under the License. 26 | */ 27 | 28 | #ifndef VECTORMATH_SOA_TRANSFORM_HPP 29 | #define VECTORMATH_SOA_TRANSFORM_HPP 30 | 31 | namespace Vectormath 32 | { 33 | namespace Soa 34 | { 35 | 36 | //---------------------------------------------------------------------------- 37 | // SOA Transform 38 | //---------------------------------------------------------------------------- 39 | 40 | inline SoaTransform SoaTransform::identity() { 41 | const SoaTransform ret = {SoaFloat3::zero(), SoaQuaternion::identity(), 42 | SoaFloat3::one()}; 43 | return ret; 44 | } 45 | 46 | } // namespace Soa 47 | } // namespace Vectormath 48 | 49 | #endif // VECTORMATH_SOA_TRANSFORM_HPP 50 | 51 | //========================================= #ConfettiAnimationMathExtensionsEnd ======================================= 52 | //========================================= #ConfettiMathExtensionsEnd ================================================ -------------------------------------------------------------------------------- /third_party/SPIRV_Cross/spirv_cross_util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2019 Arm Limited 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 SPIRV_CROSS_UTIL_HPP 18 | #define SPIRV_CROSS_UTIL_HPP 19 | 20 | #include "spirv_cross.hpp" 21 | 22 | namespace spirv_cross_util 23 | { 24 | void rename_interface_variable(SPIRV_CROSS_NAMESPACE::Compiler &compiler, 25 | const SPIRV_CROSS_NAMESPACE::SmallVector &resources, 26 | uint32_t location, const std::string &name); 27 | void inherit_combined_sampler_bindings(SPIRV_CROSS_NAMESPACE::Compiler &compiler); 28 | } // namespace spirv_cross_util 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /third_party/TinyEXR/LICENSE: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 - 2015, Syoyo Fujita 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | License 29 | 30 | 3-clause BSD 31 | tinyexr uses miniz, which is developed by Rich Geldreich richgel99@gmail.com, and licensed under public domain. 32 | tinyexr tools uses stb, which is licensed under public domain: https://github.com/nothings/stb 33 | tinyexr uses some code from OpenEXR, which is licensed under 3-clause BSDF license. -------------------------------------------------------------------------------- /third_party/gainput/.appveyor.yml: -------------------------------------------------------------------------------- 1 | 2 | platform: 3 | - x64 4 | 5 | configuration: 6 | - Debug 7 | - Release 8 | 9 | before_build: 10 | - md build 11 | - cd build 12 | - cmake -G "Visual Studio 14 2015 Win64" .. 13 | 14 | build: 15 | project: build\Project.sln 16 | -------------------------------------------------------------------------------- /third_party/gainput/.gitignore: -------------------------------------------------------------------------------- 1 | *.[doa] 2 | *.swp 3 | *.mk 4 | *.pyc 5 | .lock-* 6 | .cproject 7 | .project 8 | build/ 9 | __pycache__/ 10 | .depproj/ 11 | gainput_2008.* 12 | docs/ 13 | gainput.sdf 14 | gainput.sln 15 | gainput.unsuccessfulbuild 16 | *.opensdf 17 | cmakebuild*/ 18 | 19 | .idea 20 | .gradle 21 | .externalNativeBuild 22 | gradle 23 | -------------------------------------------------------------------------------- /third_party/gainput/.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | - osx 4 | language: cpp 5 | compiler: 6 | - gcc 7 | - clang 8 | sudo: false 9 | script: mkdir build_debug && cd build_debug/ && cmake -DCMAKE_BUILD_TYPE=Debug .. && make && test/gainputtest && cd .. && mkdir build_release && cd build_release/ && cmake -DCMAKE_BUILD_TYPE=Release .. && make && test/gainputtest 10 | 11 | -------------------------------------------------------------------------------- /third_party/gainput/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | set(GAINPUT_MAJOR_VERSION 1) 3 | set(GAINPUT_MINOR_VERSION 0) 4 | set(GAINPUT_PATCH_VERSION 0) 5 | set(GAINPUT_VERSION ${GAINPUT_MAJOR_VERSION}.${GAINPUT_MINOR_VERSION}.${GAINPUT_PATCH_VERSION}) 6 | 7 | option(GAINPUT_SAMPLES "Build Samples for Gainput" OFF) 8 | option(GAINPUT_TESTS "Build Tests for Gainput" OFF) 9 | option(GAINPUT_BUILD_SHARED "BUILD_SHARED" ON) 10 | option(GAINPUT_BUILD_STATIC "BUILD_STATIC" ON) 11 | 12 | if(!WIN32) 13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") 14 | else() 15 | set(XINPUT "Xinput9_1_0") 16 | if ( ${CMAKE_SYSTEM_VERSION} LESS 6.1 ) 17 | set(XINPUT, "xinput") 18 | endif() 19 | endif() 20 | 21 | if(ANDROID) 22 | include(extern/cmake/AndroidNdkModules.cmake) 23 | android_ndk_import_module_native_app_glue() 24 | endif() 25 | 26 | add_subdirectory(lib) 27 | 28 | if(GAINPUT_SAMPLES) 29 | add_subdirectory(samples) 30 | endif() 31 | 32 | if(GAINPUT_TESTS) 33 | add_subdirectory(test) 34 | endif() 35 | 36 | -------------------------------------------------------------------------------- /third_party/gainput/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2017 Johannes Kuhlmann 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /third_party/gainput/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | dependencies { 6 | classpath 'com.android.tools.build:gradle:2.3.2' 7 | 8 | // NOTE: Do not place your application dependencies here; they belong 9 | // in the individual module build.gradle files 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | jcenter() 16 | } 17 | } 18 | 19 | apply plugin: 'com.android.application' 20 | 21 | android { 22 | compileSdkVersion 25 23 | buildToolsVersion "25.0.2" 24 | defaultConfig { 25 | applicationId "com.example.gainput.gainput" 26 | minSdkVersion 21 27 | targetSdkVersion 25 28 | versionCode 1 29 | versionName "1.0" 30 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 31 | externalNativeBuild { 32 | cmake { 33 | cppFlags "" 34 | } 35 | } 36 | } 37 | buildTypes { 38 | release { 39 | minifyEnabled false 40 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 41 | } 42 | } 43 | externalNativeBuild { 44 | cmake { 45 | path "CMakeLists.txt" 46 | } 47 | } 48 | sourceSets { 49 | main { 50 | manifest.srcFile 'extern/android/AndroidManifest.xml' 51 | res.srcDirs = ['extern/android/res/'] 52 | java.srcDirs = ['lib/java/'] 53 | } 54 | } 55 | } 56 | 57 | dependencies { 58 | compile fileTree(dir: 'libs', include: ['*.jar']) 59 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 60 | exclude group: 'com.android.support', module: 'support-annotations' 61 | }) 62 | compile 'com.android.support:appcompat-v7:25.3.1' 63 | testCompile 'junit:junit:4.12' 64 | } 65 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputDebugRenderer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTDEBUGRENDERER_H_ 3 | #define GAINPUTDEBUGRENDERER_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | /// Interface for debug rendering of input device states. 9 | /** 10 | * Coordinates and other measures passed to the interface's functions are in the 11 | * range of 0.0f to 1.0f. 12 | * 13 | * The functions are called as part InputManager::Update(). 14 | */ 15 | class GAINPUT_LIBEXPORT DebugRenderer 16 | { 17 | public: 18 | /// Empty virtual destructor. 19 | virtual ~DebugRenderer() { } 20 | 21 | /// Called to draw a circle with the given radius. 22 | virtual void DrawCircle(float x, float y, float radius) = 0; 23 | 24 | /// Called to draw a line between the two given points. 25 | virtual void DrawLine(float x1, float y1, float x2, float y2) = 0; 26 | 27 | /// Called to draw some text at the given position. 28 | virtual void DrawText(float x, float y, const char* const text) = 0; 29 | }; 30 | 31 | } 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputHelpers.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTHELPERS_H_ 3 | #define GAINPUTHELPERS_H_ 4 | 5 | #include "GainputLog.h" 6 | 7 | namespace gainput 8 | { 9 | 10 | inline void HandleButton(InputDevice& device, InputState& state, InputDeltaState* delta, DeviceButtonId buttonId, bool value) 11 | { 12 | #ifdef GAINPUT_DEBUG 13 | if (value != state.GetBool(buttonId)) 14 | { 15 | GAINPUT_LOG("Button changed: %d, %i\n", buttonId, value); 16 | } 17 | #endif 18 | 19 | if (delta) 20 | { 21 | const bool oldValue = state.GetBool(buttonId); 22 | delta->AddChange(device.GetDeviceId(), buttonId, oldValue, value); 23 | } 24 | state.Set(buttonId, value); 25 | } 26 | 27 | inline void HandleAxis(InputDevice& device, InputState& state, InputDeltaState* delta, DeviceButtonId buttonId, float value) 28 | { 29 | const float deadZone = device.GetDeadZone(buttonId); 30 | if (deadZone > 0.0f) 31 | { 32 | const float absValue = Abs(value); 33 | const float sign = value < 0.0f ? -1.0f : 1.0f; 34 | if (absValue < deadZone) 35 | { 36 | value = 0.0f; 37 | } 38 | else 39 | { 40 | value -= sign*deadZone; 41 | value *= 1.0f / (1.0f - deadZone); 42 | } 43 | } 44 | #ifdef GAINPUT_DEBUG 45 | if (value != state.GetFloat(buttonId)) 46 | { 47 | GAINPUT_LOG("Axis changed: %d, %f\n", buttonId, value); 48 | } 49 | #endif 50 | 51 | if (delta) 52 | { 53 | const float oldValue = state.GetFloat(buttonId); 54 | delta->AddChange(device.GetDeviceId(), buttonId, oldValue, value); 55 | } 56 | state.Set(buttonId, value); 57 | 58 | } 59 | 60 | } 61 | 62 | #endif 63 | 64 | 65 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputInputDeviceBuiltIn.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEBUILTIN_H_ 3 | #define GAINPUTINPUTDEVICEBUILTIN_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | /// All valid device buttons for InputDeviceBuiltIn. 9 | enum BuiltInButton 10 | { 11 | BuiltInButtonAccelerationX, 12 | BuiltInButtonAccelerationY, 13 | BuiltInButtonAccelerationZ, 14 | BuiltInButtonGravityX, 15 | BuiltInButtonGravityY, 16 | BuiltInButtonGravityZ, 17 | BuiltInButtonGyroscopeX, 18 | BuiltInButtonGyroscopeY, 19 | BuiltInButtonGyroscopeZ, 20 | BuiltInButtonMagneticFieldX, 21 | BuiltInButtonMagneticFieldY, 22 | BuiltInButtonMagneticFieldZ, 23 | BuiltInButtonCount_ 24 | }; 25 | 26 | class InputDeviceBuiltInImpl; 27 | 28 | /// An input device for inputs that are directly built into the executing device (for example, sensors in a phone). 29 | class GAINPUT_LIBEXPORT InputDeviceBuiltIn : public InputDevice 30 | { 31 | public: 32 | /// Initializes the device. 33 | /** 34 | * Instantiate the device using InputManager::CreateDevice(). 35 | * 36 | * \param manager The input manager this device is managed by. 37 | * \param device The ID of this device. 38 | */ 39 | InputDeviceBuiltIn(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant); 40 | /// Shuts down the device. 41 | ~InputDeviceBuiltIn(); 42 | 43 | /// Returns DT_BUILTIN. 44 | DeviceType GetType() const { return DT_BUILTIN; } 45 | DeviceVariant GetVariant() const; 46 | const char* GetTypeName() const { return "builtin"; } 47 | bool IsValidButtonId(DeviceButtonId deviceButton) const; 48 | 49 | size_t GetAnyButtonDown(DeviceButtonSpec* outButtons, size_t maxButtonCount) const; 50 | 51 | size_t GetButtonName(DeviceButtonId deviceButton, char* buffer, size_t bufferLength) const; 52 | ButtonType GetButtonType(DeviceButtonId deviceButton) const; 53 | DeviceButtonId GetButtonByName(const char* name) const; 54 | 55 | protected: 56 | void InternalUpdate(InputDeltaState* delta); 57 | 58 | DeviceState InternalGetState() const; 59 | 60 | private: 61 | InputDeviceBuiltInImpl* impl_; 62 | 63 | }; 64 | 65 | } 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputInputState.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTSTATE_H_ 3 | #define GAINPUTINPUTSTATE_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | /// State of an input device. 9 | class GAINPUT_LIBEXPORT InputState 10 | { 11 | public: 12 | /// Initializes the state. 13 | /** 14 | * \param allocator The allocator to be used for all memory allocations. 15 | * \param buttonCount The maximum number of device buttons. 16 | */ 17 | InputState(Allocator& allocator, unsigned int buttonCount); 18 | /// Unitializes the state. 19 | ~InputState(); 20 | 21 | /// Returns the number of buttons in this state. 22 | /** 23 | * Note that not all buttons may be valid. 24 | * 25 | * \sa InputDevice::IsValidButtonId() 26 | */ 27 | unsigned GetButtonCount() const { return buttonCount_; } 28 | 29 | /// Returns the bool state of the given device button. 30 | bool GetBool(DeviceButtonId buttonId) const { return buttons_[buttonId].b; } 31 | /// Sets the bool state of the given device button. 32 | void Set(DeviceButtonId buttonId, bool value) { buttons_[buttonId].b = value; } 33 | /// Returns the float state of the given device button. 34 | float GetFloat(DeviceButtonId buttonId) const { return buttons_[buttonId].f; } 35 | /// Sets the float state of the given device button. 36 | void Set(DeviceButtonId buttonId, float value) { buttons_[buttonId].f = value; } 37 | 38 | /// Sets the states of all buttons in this input state to the states of all buttons in the given input state. 39 | InputState& operator=(const InputState& other); 40 | 41 | private: 42 | Allocator& allocator_; 43 | unsigned int buttonCount_; 44 | 45 | struct Button 46 | { 47 | union 48 | { 49 | bool b; 50 | float f; 51 | }; 52 | }; 53 | 54 | Button* buttons_; 55 | }; 56 | 57 | } 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputIos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTIOS_H_ 3 | #define GAINPUTIOS_H_ 4 | 5 | #import 6 | 7 | namespace gainput 8 | { 9 | class InputManager; 10 | struct GestureConfig; 11 | } 12 | 13 | 14 | /// [IOS ONLY] UIKit view that captures keyboard inputs. 15 | /** 16 | * In order to enable keyboard input on iOS devices (i.e. make the InputDeviceTouch work), 17 | * an instance of this view has to be attached as a subview to GainputView below. 18 | * TODO: CUstomization, Modifier keys 19 | * TODO: Behave as regular keyboard with full events 20 | */ 21 | @interface KeyboardView : UITextView 22 | - (id _Nonnull) initWithFrame:(CGRect)frame inputManager:(gainput::InputManager&)inputManager; 23 | @property(nonatomic, readonly) BOOL hasText; 24 | @end 25 | 26 | 27 | /// [IOS ONLY] UIKit view that captures touch inputs. 28 | /** 29 | * In order to enable touch input on iOS devices (i.e. make the InputDeviceTouch work), 30 | * an instance of this view has to be attached as a subview to the view of your application. 31 | * Note that, for touches to work in portrait and landscape mode, the subview has to be 32 | * rotated correctly with its parent. 33 | */ 34 | @interface GainputView : UIView 35 | @property (nullable, nonatomic, strong) KeyboardView * pKeyboardView; 36 | - (id _Nonnull)initWithFrame:(CGRect)frame inputManager:(gainput::InputManager&)inputManager; 37 | - (BOOL)setVirtualKeyboard:(int)inputType; 38 | -(void) addGestureMapping: 39 | (unsigned)gestureType 40 | forId:(unsigned)gestureId 41 | withConfig:(gainput::GestureConfig&)gestureConfig; 42 | @end 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputLog.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUT_LOG_H_ 3 | #define GAINPUT_LOG_H_ 4 | 5 | #include "../../include/gainput/gainput.h" 6 | 7 | #if defined(GAINPUT_PLATFORM_LINUX) 8 | 9 | #if defined(GAINPUT_DEBUG) || defined(GAINPUT_DEV) 10 | #include 11 | #define GAINPUT_LOG(...) printf(__VA_ARGS__); 12 | #endif 13 | 14 | #elif defined(GAINPUT_PLATFORM_WIN) || defined(GAINPUT_PLATFORM_XBOX_ONE) 15 | 16 | #if defined(GAINPUT_DEBUG) || defined(GAINPUT_DEV) 17 | #include 18 | #include 19 | #define GAINPUT_LOG(...) { char buf[1024]; sprintf(buf, __VA_ARGS__); OutputDebugStringA(buf); } 20 | #endif 21 | 22 | #elif defined(GAINPUT_PLATFORM_ANDROID) 23 | 24 | #if defined(GAINPUT_DEBUG) || defined(GAINPUT_DEV) 25 | #include 26 | #define GAINPUT_LOG(...) ((void)__android_log_print(ANDROID_LOG_INFO, "gainput", __VA_ARGS__)) 27 | #endif 28 | 29 | #elif defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 30 | #include 31 | #define GAINPUT_LOG(...) printf(__VA_ARGS__); 32 | #endif 33 | 34 | #ifndef GAINPUT_LOG 35 | #define GAINPUT_LOG(...) 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputMac.h: -------------------------------------------------------------------------------- 1 | // 2 | // GainputMac.h 3 | // gainputstatic 4 | // 5 | // Created by Toto on 9/7/18. 6 | // 7 | 8 | #ifndef GainputMac_h 9 | #define GainputMac_h 10 | 11 | #import 12 | 13 | /// [MACOS ONLY] NSView that captures mouse/keyboard inputs. 14 | @interface GainputMacInputView : NSView 15 | 16 | - (id)initWithFrame:(NSRect)frame window:(NSWindow *)window retinaScale:(float)retinaScale inputManager:(gainput::InputManager&)inputManager; 17 | 18 | -(void)SetMouseCapture:(BOOL)captured; 19 | 20 | @end 21 | 22 | 23 | namespace gainput 24 | { 25 | class InputManager; 26 | } 27 | 28 | 29 | 30 | #endif /* GainputMac_h */ 31 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/GainputMapFilters.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTMAPFILTERS_H_ 3 | #define GAINPUTMAPFILTERS_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | /// Inverts the given input value in the range [-1.0f, 1.0f]. 9 | GAINPUT_LIBEXPORT float InvertSymmetricInput(float const value, void*); 10 | 11 | /// Inverts the given input value in the range [0.0f, 1.0f]. 12 | GAINPUT_LIBEXPORT float InvertInput(float const value, void*); 13 | 14 | } 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/gestures/GainputButtonStickGesture.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTBUTTONSTICKGESTURE_H_ 3 | #define GAINPUTBUTTONSTICKGESTURE_H_ 4 | 5 | #ifdef GAINPUT_ENABLE_BUTTON_STICK_GESTURE 6 | 7 | namespace gainput 8 | { 9 | 10 | /// Buttons provided by the ButtonStickGesture. 11 | enum ButtonStickAction 12 | { 13 | ButtonStickAxis 14 | }; 15 | 16 | 17 | class GAINPUT_LIBEXPORT ButtonStickGesture : public InputGesture 18 | { 19 | public: 20 | /// Initializes the gesture. 21 | ButtonStickGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant); 22 | /// Uninitializes the gesture. 23 | ~ButtonStickGesture(); 24 | 25 | /// Sets up the gesture for operation with the given axes and buttons. 26 | void Initialize(DeviceId negativeAxisDevice, DeviceButtonId negativeAxis, 27 | DeviceId positiveAxisDevice, DeviceButtonId positiveAxis); 28 | 29 | bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton == ButtonStickAxis; } 30 | 31 | ButtonType GetButtonType(DeviceButtonId deviceButton) const { GAINPUT_UNUSED(deviceButton); GAINPUT_ASSERT(IsValidButtonId(deviceButton)); return BT_FLOAT; } 32 | 33 | protected: 34 | void InternalUpdate(InputDeltaState* delta); 35 | 36 | private: 37 | DeviceButtonSpec negativeAxis_; 38 | DeviceButtonSpec positiveAxis_; 39 | 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/gestures/GainputSimultaneouslyDownGesture.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTSIMULTANEOUSLYDOWNGESTURE_H_ 3 | #define GAINPUTSIMULTANEOUSLYDOWNGESTURE_H_ 4 | 5 | #ifdef GAINPUT_ENABLE_SIMULTANEOUSLY_DOWN_GESTURE 6 | 7 | namespace gainput 8 | { 9 | 10 | /// Buttons provided by the SimultaneouslyDownGesture. 11 | enum SimultaneouslyDownAction 12 | { 13 | SimultaneouslyDownTriggered ///< The button triggered by double-clicking. 14 | }; 15 | 16 | /// A gesture that tracks if a number of buttons is down simultaneously. 17 | /** 18 | * This gesture can be used to detect if multiple buttons are down at the same time. Its only 19 | * device button ::SimultaneouslyDownTriggered is true while all buttons provided through AddButton() 20 | * are down. 21 | * 22 | * After instantiating the gesture like any other input device, call AddButton() as often as necessary 23 | * to properly set it up. 24 | * 25 | * In order for this gesture to be available, Gainput must be built with \c GAINPUT_ENABLE_ALL_GESTURES or 26 | * \c GAINPUT_ENABLE_SIMULTANEOUSLY_DOWN_GESTURE defined. 27 | * 28 | * \sa AddButton 29 | * \sa InputManager::CreateDevice 30 | */ 31 | class GAINPUT_LIBEXPORT SimultaneouslyDownGesture : public InputGesture 32 | { 33 | public: 34 | /// Initializes the gesture. 35 | SimultaneouslyDownGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant); 36 | /// Uninitializes the gesture. 37 | ~SimultaneouslyDownGesture(); 38 | 39 | /// Adds the given button as a button to check. 40 | /** 41 | * \param device ID of the input device containing the button to be checked. 42 | * \param button ID of the device button to be checked. 43 | */ 44 | void AddButton(DeviceId device, DeviceButtonId button); 45 | 46 | /// Removes all buttons previously registered through AddButton(). 47 | void ClearButtons(); 48 | 49 | bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton == SimultaneouslyDownTriggered; } 50 | 51 | ButtonType GetButtonType(DeviceButtonId deviceButton) const { GAINPUT_UNUSED(deviceButton); GAINPUT_ASSERT(IsValidButtonId(deviceButton)); return BT_BOOL; } 52 | 53 | protected: 54 | void InternalUpdate(InputDeltaState* delta); 55 | 56 | private: 57 | Array buttons_; 58 | 59 | }; 60 | 61 | } 62 | 63 | #endif 64 | 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/gestures/GainputTapGesture.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTTAPGESTURE_H_ 3 | #define GAINPUTTAPGESTURE_H_ 4 | 5 | #ifdef GAINPUT_ENABLE_TAP_GESTURE 6 | 7 | namespace gainput 8 | { 9 | 10 | /// Buttons provided by the TapGesture. 11 | enum TapAction 12 | { 13 | TapTriggered ///< The button that is triggered by tapping. 14 | }; 15 | 16 | /// A tap-to-trigger gesture. 17 | /** 18 | * This gesture, mainly meant for touch devices, triggers after the specified button has been down and released 19 | * during the specified time frame. If the button is down for a longer time, no action is triggered. 20 | * 21 | * After instantiating the gesture like any other input device, call Initialize() to properly 22 | * set it up. 23 | * 24 | * In order for this gesture to be available, Gainput must be built with \c GAINPUT_ENABLE_ALL_GESTURES or 25 | * \c GAINPUT_ENABLE_TAP_GESTURE defined. 26 | * 27 | * \sa Initialize 28 | * \sa InputManager::CreateDevice 29 | */ 30 | class GAINPUT_LIBEXPORT TapGesture : public InputGesture 31 | { 32 | public: 33 | /// Initializes the gesture. 34 | TapGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant variant); 35 | /// Uninitializes the gesture. 36 | ~TapGesture(); 37 | 38 | /// Sets up the gesture. 39 | /** 40 | * \param actionButtonDevice ID of the input device containing the action button. 41 | * \param actionButton ID of the device button to be used as the action button. 42 | * \param timeSpan Time in milliseconds the user may hold at most. 43 | */ 44 | void Initialize(DeviceId actionButtonDevice, DeviceButtonId actionButton, uint64_t timeSpan = 500); 45 | 46 | bool IsValidButtonId(DeviceButtonId deviceButton) const { return deviceButton == TapTriggered; } 47 | 48 | ButtonType GetButtonType(DeviceButtonId deviceButton) const { GAINPUT_UNUSED(deviceButton); GAINPUT_ASSERT(IsValidButtonId(deviceButton)); return BT_BOOL; } 49 | 50 | protected: 51 | void InternalUpdate(InputDeltaState* delta); 52 | 53 | private: 54 | DeviceButtonSpec actionButton_; 55 | 56 | uint64_t timeSpan_; 57 | uint64_t firstDownTime_; 58 | 59 | }; 60 | 61 | } 62 | 63 | #endif 64 | 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/recorder/GainputInputPlayer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTPLAYER_H_ 3 | #define GAINPUTINPUTPLAYER_H_ 4 | 5 | #ifdef GAINPUT_ENABLE_RECORDER 6 | 7 | namespace gainput 8 | { 9 | 10 | /// Plays back a previously recorded sequence of device state changes. 11 | /** 12 | * In order for input recording to be available, Gainput must have been built with 13 | * \c GAINPUT_ENABLE_RECORDER defined. 14 | */ 15 | class GAINPUT_LIBEXPORT InputPlayer : public DeviceStateModifier 16 | { 17 | public: 18 | /// Initializes the player. 19 | /** 20 | * \param manager The manager to receive the device state changes. 21 | * \param recording The recording to play, may be 0. 22 | */ 23 | InputPlayer(InputManager& manager, InputRecording* recording = 0); 24 | /// Destructs the player. 25 | ~InputPlayer(); 26 | 27 | /// Updates the player, called internally from InputManager::Update(). 28 | void Update(InputDeltaState* delta); 29 | 30 | /// Starts the playback. 31 | /** 32 | * A recording must have been provided before doing this, either through the 33 | * constructor or SetRecording(). 34 | */ 35 | void Start(); 36 | /// Stops the Playback. 37 | void Stop(); 38 | /// Returns if the player is currently playing. 39 | bool IsPlaying() const { return isPlaying_; } 40 | 41 | /// Sets the recording to play. 42 | void SetRecording(InputRecording* recording); 43 | /// Returns the currently set recording. 44 | InputRecording* GetRecording() { return recording_; } 45 | /// Returns the currently set recording. 46 | const InputRecording* GetRecording() const { return recording_; } 47 | 48 | private: 49 | InputManager& manager_; 50 | 51 | bool isPlaying_; 52 | InputRecording* recording_; 53 | uint64_t startTime_; 54 | 55 | Array devicesToReset_; 56 | 57 | ModifierId playingModifierId_; 58 | }; 59 | 60 | } 61 | 62 | #endif 63 | 64 | #endif 65 | 66 | -------------------------------------------------------------------------------- /third_party/gainput/lib/include/gainput/recorder/GainputInputRecorder.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTRECORDER_H_ 3 | #define GAINPUTINPUTRECORDER_H_ 4 | 5 | #ifdef GAINPUT_ENABLE_RECORDER 6 | 7 | namespace gainput 8 | { 9 | 10 | /// Records a sequence of button state changes. 11 | /** 12 | * In order for input recording to be available, Gainput must have been built with 13 | * \c GAINPUT_ENABLE_RECORDER defined. 14 | */ 15 | class GAINPUT_LIBEXPORT InputRecorder 16 | { 17 | public: 18 | /// Initializes the recorder. 19 | /** 20 | * \param manager The InputManager to receive button state changes from. 21 | */ 22 | InputRecorder(InputManager& manager); 23 | /// Destructs the recorder. 24 | ~InputRecorder(); 25 | 26 | /// Starts recording. 27 | /** 28 | * Also clears the InputRecording that is being recorded to so that it's not possible 29 | * to resume recording after stopping to record. 30 | */ 31 | void Start(); 32 | /// Stops recording. 33 | void Stop(); 34 | /// Returns if the recorder is currently recording. 35 | bool IsRecording() const { return isRecording_; } 36 | 37 | /// Adds a device to record the button state changes of. 38 | /** 39 | * If no device is set, all devices are recorded. 40 | * \param device The ID of the device to record. 41 | */ 42 | void AddDeviceToRecord(DeviceId device) { recordedDevices_[device] = true; } 43 | /// Returns if the given device should be recorded. 44 | /** 45 | * \param device The ID of the device to check. 46 | */ 47 | bool IsDeviceToRecord(DeviceId device) { return recordedDevices_.empty() || recordedDevices_.count(device) > 0; } 48 | 49 | /// Returns the recording that is being recorded to, may be 0. 50 | InputRecording* GetRecording() { return recording_; } 51 | /// Returns the recording that is being recorded to, may be 0. 52 | const InputRecording* GetRecording() const { return recording_; } 53 | /// Returns the time the recording was started. 54 | uint64_t GetStartTime() const { return startTime_; } 55 | 56 | private: 57 | InputManager& manager_; 58 | 59 | bool isRecording_; 60 | InputListener* recordingListener_; 61 | ListenerId recordingListenerId_; 62 | InputRecording* recording_; 63 | uint64_t startTime_; 64 | HashMap recordedDevices_; 65 | 66 | }; 67 | 68 | } 69 | 70 | #endif 71 | 72 | #endif 73 | 74 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/GainputAllocator.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../include/gainput/gainput.h" 3 | 4 | #include "../../include/gainput/GainputLog.h" 5 | 6 | namespace gainput 7 | { 8 | 9 | DefaultAllocator& 10 | GetDefaultAllocator() 11 | { 12 | static DefaultAllocator da; 13 | return da; 14 | } 15 | 16 | 17 | TrackingAllocator::TrackingAllocator(Allocator& backingAllocator, Allocator& internalAllocator) 18 | : backingAllocator_(backingAllocator), 19 | internalAllocator_(internalAllocator), 20 | allocations_(internalAllocator.New >(internalAllocator)), 21 | allocateCount_(0), 22 | deallocateCount_(0), 23 | allocatedMemory_(0) 24 | { 25 | } 26 | 27 | TrackingAllocator::~TrackingAllocator() 28 | { 29 | internalAllocator_.Delete(allocations_); 30 | } 31 | 32 | void* TrackingAllocator::Allocate(size_t size, size_t align) 33 | { 34 | void* ptr = backingAllocator_.Allocate(size, align); 35 | (*allocations_)[ptr] = size; 36 | ++allocateCount_; 37 | allocatedMemory_ += size; 38 | return ptr; 39 | } 40 | 41 | void TrackingAllocator::Deallocate(void* ptr) 42 | { 43 | HashMap::iterator it = allocations_->find(ptr); 44 | if (it == allocations_->end()) 45 | { 46 | GAINPUT_LOG("Warning: Trying to deallocate unknown memory block: %p\n", ptr); 47 | } 48 | else 49 | { 50 | allocatedMemory_ -= it->second; 51 | allocations_->erase(it); 52 | } 53 | ++deallocateCount_; 54 | backingAllocator_.Deallocate(ptr); 55 | } 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/GainputInputState.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../include/gainput/gainput.h" 3 | 4 | 5 | namespace gainput 6 | { 7 | 8 | InputState::InputState(Allocator& allocator, unsigned int buttonCount) : 9 | allocator_(allocator), 10 | buttonCount_(buttonCount) 11 | { 12 | const size_t size = sizeof(Button) * buttonCount_; 13 | buttons_ = static_cast(allocator_.Allocate(size)); 14 | GAINPUT_ASSERT(buttons_); 15 | memset(buttons_, 0, size); 16 | } 17 | 18 | InputState::~InputState() 19 | { 20 | allocator_.Deallocate(buttons_); 21 | } 22 | 23 | InputState& 24 | InputState::operator=(const InputState& other) 25 | { 26 | const size_t size = sizeof(Button) * buttonCount_; 27 | memcpy(buttons_, other.buttons_, size); 28 | return *this; 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/GainputMapFilters.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../include/gainput/gainput.h" 3 | #include "../../include/gainput/GainputMapFilters.h" 4 | 5 | 6 | namespace gainput 7 | { 8 | 9 | float InvertSymmetricInput(float const value, void*) 10 | { 11 | return -value; 12 | } 13 | 14 | float InvertInput(float const value, void*) 15 | { 16 | return 1.0f - value; 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/GainputWindows.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTWINDOWS_H_ 3 | #define GAINPUTWINDOWS_H_ 4 | 5 | #ifndef WIN32_LEAN_AND_MEAN 6 | #define WIN32_LEAN_AND_MEAN 7 | #endif 8 | 9 | #ifndef NOMINMAX 10 | #define NOMINMAX 11 | #endif 12 | 13 | #include 14 | #include 15 | #ifdef DrawText 16 | #undef DrawText 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/builtin/GainputInputDeviceBuiltInImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEBUILTINIMPL_H_ 3 | #define GAINPUTINPUTDEVICEBUILTINIMPL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceBuiltInImpl 9 | { 10 | public: 11 | virtual ~InputDeviceBuiltInImpl() { } 12 | virtual InputDevice::DeviceVariant GetVariant() const = 0; 13 | virtual InputDevice::DeviceState GetState() const { return InputDevice::DS_OK; } 14 | virtual void Update(InputDeltaState* delta) = 0; 15 | virtual bool IsValidButton(DeviceButtonId deviceButton) const = 0; 16 | }; 17 | 18 | } 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/builtin/GainputInputDeviceBuiltInIos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEBUILTINIOS_H_ 3 | #define GAINPUTINPUTDEVICEBUILTINIOS_H_ 4 | 5 | 6 | namespace gainput 7 | { 8 | 9 | class InputDeviceBuiltInImplIos : public InputDeviceBuiltInImpl 10 | { 11 | public: 12 | InputDeviceBuiltInImplIos(InputManager& manager, InputDevice& device, unsigned index, InputState& state, InputState& previousState); 13 | ~InputDeviceBuiltInImplIos(); 14 | 15 | InputDevice::DeviceVariant GetVariant() const 16 | { 17 | return InputDevice::DV_STANDARD; 18 | } 19 | 20 | void Update(InputDeltaState* delta); 21 | 22 | InputDevice::DeviceState GetState() const 23 | { 24 | return deviceState_; 25 | } 26 | 27 | bool IsValidButton(DeviceButtonId deviceButton) const; 28 | 29 | bool Vibrate(float leftMotor, float rightMotor) 30 | { 31 | return false; 32 | } 33 | 34 | bool pausePressed_; 35 | 36 | private: 37 | InputManager& manager_ __unused; 38 | InputDevice& device_; 39 | unsigned index_ __unused; 40 | bool padFound_ __unused; 41 | InputState& state_; 42 | InputState& previousState_ __unused; 43 | InputDevice::DeviceState deviceState_; 44 | 45 | void* motionManager_; 46 | 47 | }; 48 | 49 | } 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/builtin/GainputInputDeviceBuiltInNull.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEBUILTINNULL_H_ 3 | #define GAINPUTINPUTDEVICEBUILTINNULL_H_ 4 | 5 | 6 | namespace gainput 7 | { 8 | 9 | class InputDeviceBuiltInImplNull : public InputDeviceBuiltInImpl 10 | { 11 | public: 12 | InputDeviceBuiltInImplNull(InputManager& /*manager*/, InputDevice& /*device*/, unsigned /*index*/, InputState& /*state*/, InputState& /*previousState*/) 13 | { 14 | } 15 | 16 | InputDevice::DeviceVariant GetVariant() const 17 | { 18 | return InputDevice::DV_NULL; 19 | } 20 | 21 | void Update(InputDeltaState* /*delta*/) 22 | { 23 | } 24 | 25 | InputDevice::DeviceState GetState() const 26 | { 27 | return InputDevice::DS_OK; 28 | } 29 | 30 | bool IsValidButton(DeviceButtonId /*deviceButton*/) const 31 | { 32 | return false; 33 | } 34 | }; 35 | 36 | } 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputDev.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTDEV_H_ 3 | #define GAINPUTDEV_H_ 4 | 5 | #ifdef GAINPUT_DEV 6 | 7 | #include "GainputDevProtocol.h" 8 | 9 | namespace gainput 10 | { 11 | 12 | void DevInit(InputManager* inputManager); 13 | void DevShutdown(const InputManager* inputManager); 14 | void DevUpdate(InputDeltaState* delta); 15 | void DevNewMap(InputMap* inputMap); 16 | void DevNewUserButton(InputMap* inputMap, UserButtonId userButton, DeviceId device, DeviceButtonId deviceButton); 17 | void DevRemoveUserButton(InputMap* inputMap, UserButtonId userButton); 18 | void DevRemoveMap(InputMap* inputMap); 19 | void DevNewDevice(InputDevice* device); 20 | void DevConnect(InputManager* inputManager, const char* ip, unsigned port); 21 | void DevStartDeviceSync(DeviceId deviceId); 22 | 23 | } 24 | 25 | #define GAINPUT_DEV_INIT(inputManager) DevInit(inputManager) 26 | #define GAINPUT_DEV_SHUTDOWN(inputManager) DevShutdown(inputManager) 27 | #define GAINPUT_DEV_UPDATE(delta) DevUpdate(delta) 28 | #define GAINPUT_DEV_NEW_MAP(inputMap) DevNewMap(inputMap) 29 | #define GAINPUT_DEV_NEW_USER_BUTTON(inputMap, userButton, device, deviceButton) DevNewUserButton(inputMap, userButton, device, deviceButton) 30 | #define GAINPUT_DEV_REMOVE_USER_BUTTON(inputMap, userButton) DevRemoveUserButton(inputMap, userButton) 31 | #define GAINPUT_DEV_REMOVE_MAP(inputMap) DevRemoveMap(inputMap) 32 | #define GAINPUT_DEV_NEW_DEVICE(device) DevNewDevice(device) 33 | #define GAINPUT_DEV_CONNECT(inputManager, ip, port) DevConnect(inputManager, ip, port) 34 | #define GAINPUT_DEV_START_SYNC(deviceId) DevStartDeviceSync(deviceId) 35 | 36 | #else 37 | 38 | #define GAINPUT_DEV_INIT(inputManager) 39 | #define GAINPUT_DEV_SHUTDOWN(inputManager) 40 | #define GAINPUT_DEV_UPDATE(delta) 41 | #define GAINPUT_DEV_NEW_MAP(inputMap) 42 | #define GAINPUT_DEV_NEW_USER_BUTTON(inputMap, userButton, device, deviceButton) 43 | #define GAINPUT_DEV_REMOVE_USER_BUTTON(inputMap, userButton) 44 | #define GAINPUT_DEV_REMOVE_MAP(inputMap) 45 | #define GAINPUT_DEV_NEW_DEVICE(device) 46 | #define GAINPUT_DEV_CONNECT(inputManager, ip, port) 47 | #define GAINPUT_DEV_START_SYNC(device) 48 | 49 | #endif 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputDevProtocol.h: -------------------------------------------------------------------------------- 1 | #ifndef GAINPUTDEVPROTOCOL_H_ 2 | #define GAINPUTDEVPROTOCOL_H_ 3 | 4 | namespace gainput 5 | { 6 | 7 | enum DevCmd 8 | { 9 | DevCmdHello, 10 | DevCmdDevice, 11 | DevCmdDeviceButton, 12 | DevCmdMap, 13 | DevCmdRemoveMap, 14 | DevCmdUserButton, 15 | DevCmdRemoveUserButton, 16 | DevCmdPing, 17 | DevCmdUserButtonChanged, 18 | DevCmdGetAllInfos, 19 | DevCmdStartDeviceSync, 20 | DevCmdSetDeviceButton, 21 | }; 22 | 23 | const static unsigned DevProtocolVersion = 0x3; 24 | 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputMemoryStream.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/gainput/gainput.h" 2 | 3 | #if defined(GAINPUT_DEV) || defined(GAINPUT_ENABLE_RECORDER) 4 | #include "GainputMemoryStream.h" 5 | 6 | namespace gainput { 7 | 8 | MemoryStream::MemoryStream(void* data, size_t length, size_t capacity, bool ownership) : 9 | data_(data), 10 | length_(length), 11 | capacity_(capacity), 12 | ownership_(ownership), 13 | position_(0) 14 | { 15 | // empty 16 | } 17 | 18 | MemoryStream::MemoryStream(size_t capacity, Allocator& allocator) : 19 | allocator_(&allocator), 20 | length_(0), 21 | capacity_(capacity), 22 | ownership_(true), 23 | position_(0) 24 | { 25 | data_ = this->allocator_->Allocate(capacity_); 26 | } 27 | 28 | MemoryStream::~MemoryStream() 29 | { 30 | if (ownership_) 31 | { 32 | assert(allocator_); 33 | allocator_->Deallocate(data_); 34 | } 35 | } 36 | 37 | size_t 38 | MemoryStream::Read(void* dest, size_t readLength) 39 | { 40 | assert(position_ + readLength <= length_); 41 | memcpy(dest, (void*)( (uint8_t*)data_ + position_), readLength); 42 | position_ += readLength; 43 | return readLength; 44 | } 45 | 46 | size_t 47 | MemoryStream::Write(const void* src, size_t writeLength) 48 | { 49 | assert(position_ + writeLength <= capacity_); 50 | memcpy((void*)( (uint8_t*)data_ + position_), src, writeLength); 51 | position_ += writeLength; 52 | length_ += writeLength; 53 | return writeLength; 54 | } 55 | 56 | bool 57 | MemoryStream::SeekBegin(int offset) 58 | { 59 | if (offset < 0) 60 | { 61 | return false; 62 | } 63 | position_ = offset; 64 | return true; 65 | } 66 | 67 | bool 68 | MemoryStream::SeekCurrent(int offset) 69 | { 70 | if (offset + position_ > length_) 71 | { 72 | return false; 73 | } 74 | position_ += offset; 75 | return true; 76 | } 77 | 78 | bool 79 | MemoryStream::SeekEnd(int offset) 80 | { 81 | if (offset > 0) 82 | { 83 | return false; 84 | } 85 | position_ = length_ + offset; 86 | return true; 87 | } 88 | 89 | } 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputMemoryStream.h: -------------------------------------------------------------------------------- 1 | #ifndef GAINPUTMEMORYSTREAM_H_ 2 | #define GAINPUTMEMORYSTREAM_H_ 3 | 4 | #include "GainputStream.h" 5 | 6 | namespace gainput { 7 | 8 | class MemoryStream : public Stream 9 | { 10 | public: 11 | MemoryStream(void* data, size_t length, size_t capacity, bool ownership = false); 12 | MemoryStream(size_t capacity, Allocator& allocator = GetDefaultAllocator()); 13 | ~MemoryStream(); 14 | 15 | size_t Read(void* dest, size_t readLength); 16 | size_t Write(const void* src, size_t writeLength); 17 | 18 | size_t GetSize() const { return length_; } 19 | size_t GetLeft() const { return length_ - position_; } 20 | 21 | bool SeekBegin(int offset); 22 | bool SeekCurrent(int offset); 23 | bool SeekEnd(int offset); 24 | 25 | virtual void Reset() { length_ = 0; position_ = 0; } 26 | 27 | bool IsEof() const 28 | { 29 | return position_ >= length_; 30 | } 31 | 32 | void* GetData() { return data_; } 33 | size_t GetPosition() const { return position_; } 34 | 35 | private: 36 | Allocator* allocator_; 37 | void* data_; 38 | size_t length_; 39 | size_t capacity_; 40 | bool ownership_; 41 | 42 | size_t position_; 43 | 44 | }; 45 | 46 | } 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputNetAddress.cpp: -------------------------------------------------------------------------------- 1 | #include "../../../include/gainput/gainput.h" 2 | 3 | #ifdef GAINPUT_DEV 4 | #include "GainputNetAddress.h" 5 | 6 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_WIN) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 7 | 8 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 9 | #include 10 | #include 11 | #include 12 | #endif 13 | 14 | namespace gainput { 15 | 16 | NetAddress::NetAddress(const char* ip, unsigned port) 17 | { 18 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 19 | struct in_addr inp; 20 | if (!inet_aton(ip, &inp)) 21 | { 22 | assert(false); 23 | return; 24 | } 25 | addr.sin_addr.s_addr = inp.s_addr; 26 | #elif defined(GAINPUT_PLATFORM_WIN) 27 | addr.sin_addr.s_addr = inet_addr(ip); 28 | #endif 29 | 30 | addr.sin_family = AF_INET; 31 | addr.sin_port = htons(port); 32 | } 33 | 34 | NetAddress::NetAddress(const struct sockaddr_in& rhs) 35 | { 36 | addr.sin_family = rhs.sin_family; 37 | addr.sin_addr.s_addr = rhs.sin_addr.s_addr; 38 | addr.sin_port = rhs.sin_port; 39 | } 40 | 41 | } 42 | #endif 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputNetAddress.h: -------------------------------------------------------------------------------- 1 | #ifndef GAINPUTADDRESS_H_ 2 | #define GAINPUTADDRESS_H_ 3 | 4 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 5 | #include 6 | #include 7 | #include 8 | #elif defined(GAINPUT_PLATFORM_WIN) 9 | #define _WINSOCK_DEPRECATED_NO_WARNINGS 10 | #include 11 | #include 12 | #endif 13 | 14 | namespace gainput { 15 | 16 | class NetAddress 17 | { 18 | public: 19 | NetAddress(const char* ip, unsigned port); 20 | 21 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_WIN) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 22 | NetAddress(const struct sockaddr_in& rhs); 23 | 24 | const struct sockaddr_in& GetAddr() const { return addr; } 25 | struct sockaddr_in& GetAddr() { return addr; } 26 | #endif 27 | 28 | NetAddress& operator = (const NetAddress& rhs); 29 | 30 | private: 31 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_WIN) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 32 | struct sockaddr_in addr; 33 | #endif 34 | 35 | }; 36 | 37 | 38 | inline 39 | NetAddress& 40 | NetAddress::operator = (const NetAddress& rhs) 41 | { 42 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_WIN) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 43 | addr.sin_family = rhs.addr.sin_family; 44 | addr.sin_addr.s_addr = rhs.addr.sin_addr.s_addr; 45 | addr.sin_port = rhs.addr.sin_port; 46 | #endif 47 | return *this; 48 | } 49 | 50 | } 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputNetConnection.h: -------------------------------------------------------------------------------- 1 | #ifndef GAINPUTCONNECTION_H_ 2 | #define GAINPUTCONNECTION_H_ 3 | 4 | #include "GainputNetAddress.h" 5 | 6 | namespace gainput { 7 | 8 | class Stream; 9 | 10 | class NetConnection 11 | { 12 | public: 13 | NetConnection(const NetAddress& address, Allocator& allocator = GetDefaultAllocator()); 14 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 15 | NetConnection(const NetAddress& remoteAddress, int fd, Allocator& allocator = GetDefaultAllocator()); 16 | #elif defined(GAINPUT_PLATFORM_WIN) 17 | NetConnection(const NetAddress& remoteAddress, SOCKET fd, Allocator& allocator = GetDefaultAllocator()); 18 | #endif 19 | ~NetConnection(); 20 | 21 | bool Connect(bool shouldBlock); 22 | void Close(); 23 | bool IsConnected() const; 24 | bool IsReady(bool read, bool write); 25 | 26 | size_t Send(const void* buffer, size_t length); 27 | size_t Send(Stream& stream); 28 | 29 | size_t Receive(void* buffer, size_t length); 30 | size_t Receive(Stream& stream, size_t maxLength); 31 | 32 | private: 33 | Allocator& allocator; 34 | NetAddress address; 35 | 36 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 37 | int fd; 38 | #elif defined(GAINPUT_PLATFORM_WIN) 39 | SOCKET fd; 40 | #endif 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/dev/GainputNetListener.h: -------------------------------------------------------------------------------- 1 | #ifndef GAINPUTLISTENER_H_ 2 | #define GAINPUTLISTENER_H_ 3 | 4 | #include "gainput/GainputAllocator.h" 5 | #include "GainputNetAddress.h" 6 | 7 | namespace gainput { 8 | 9 | class NetConnection; 10 | 11 | class NetListener 12 | { 13 | public: 14 | NetListener(const NetAddress& address, Allocator& allocator = GetDefaultAllocator()); 15 | ~NetListener(); 16 | 17 | bool Start(bool shouldBlock); 18 | void Stop(); 19 | 20 | NetConnection* Accept(); 21 | 22 | private: 23 | NetAddress address; 24 | Allocator& allocator; 25 | bool blocking; 26 | 27 | #if defined(GAINPUT_PLATFORM_LINUX) || defined(GAINPUT_PLATFORM_ANDROID) || defined(GAINPUT_PLATFORM_IOS) || defined(GAINPUT_PLATFORM_MAC) || defined(GAINPUT_PLATFORM_TVOS) 28 | int fd; 29 | #elif defined(GAINPUT_PLATFORM_WIN) 30 | SOCKET listenSocket; 31 | #endif 32 | 33 | }; 34 | 35 | } 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/gestures/GainputSimultaneouslyDownGesture.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../../include/gainput/gainput.h" 3 | #include "../../../include/gainput/gestures/GainputSimultaneouslyDownGesture.h" 4 | 5 | #ifdef GAINPUT_ENABLE_SIMULTANEOUSLY_DOWN_GESTURE 6 | #include "../../../include/gainput/GainputInputDeltaState.h" 7 | #include "../../../include/gainput/GainputHelpers.h" 8 | 9 | namespace gainput 10 | { 11 | 12 | SimultaneouslyDownGesture::SimultaneouslyDownGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant /*variant*/) : 13 | InputGesture(manager, device, index), 14 | buttons_(manager.GetAllocator()) 15 | { 16 | state_ = manager_.GetAllocator().New(manager.GetAllocator(), 1); 17 | GAINPUT_ASSERT(state_); 18 | previousState_ = manager_.GetAllocator().New(manager.GetAllocator(), 1); 19 | GAINPUT_ASSERT(previousState_); 20 | } 21 | 22 | SimultaneouslyDownGesture::~SimultaneouslyDownGesture() 23 | { 24 | manager_.GetAllocator().Delete(state_); 25 | manager_.GetAllocator().Delete(previousState_); 26 | } 27 | 28 | void 29 | SimultaneouslyDownGesture::AddButton(DeviceId device, DeviceButtonId button) 30 | { 31 | DeviceButtonSpec spec; 32 | spec.deviceId = device; 33 | spec.buttonId = button; 34 | buttons_.push_back(spec); 35 | } 36 | 37 | void 38 | SimultaneouslyDownGesture::ClearButtons() 39 | { 40 | buttons_.clear(); 41 | } 42 | 43 | void 44 | SimultaneouslyDownGesture::InternalUpdate(InputDeltaState* delta) 45 | { 46 | bool allDown = !buttons_.empty(); 47 | 48 | for (Array::const_iterator it = buttons_.begin(); 49 | it != buttons_.end() && allDown; 50 | ++it) 51 | { 52 | const InputDevice* device = manager_.GetDevice(it->deviceId); 53 | GAINPUT_ASSERT(device); 54 | allDown = allDown && device->GetBool(it->buttonId); 55 | } 56 | 57 | HandleButton(*this, *state_, delta, SimultaneouslyDownTriggered, allDown); 58 | } 59 | 60 | } 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/gestures/GainputTapGesture.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "../../../include/gainput/gainput.h" 3 | #include "../../../include/gainput/gestures/GainputTapGesture.h" 4 | 5 | #ifdef GAINPUT_ENABLE_TAP_GESTURE 6 | #include "../../../include/gainput/GainputInputDeltaState.h" 7 | #include "../../../include/gainput/GainputHelpers.h" 8 | 9 | namespace gainput 10 | { 11 | 12 | TapGesture::TapGesture(InputManager& manager, DeviceId device, unsigned index, DeviceVariant /*variant*/) : 13 | InputGesture(manager, device, index), 14 | firstDownTime_(0) 15 | { 16 | actionButton_.buttonId = InvalidDeviceButtonId; 17 | 18 | state_ = manager_.GetAllocator().New(manager.GetAllocator(), 1); 19 | GAINPUT_ASSERT(state_); 20 | previousState_ = manager_.GetAllocator().New(manager.GetAllocator(), 1); 21 | GAINPUT_ASSERT(previousState_); 22 | } 23 | 24 | TapGesture::~TapGesture() 25 | { 26 | manager_.GetAllocator().Delete(state_); 27 | manager_.GetAllocator().Delete(previousState_); 28 | } 29 | 30 | void 31 | TapGesture::Initialize(DeviceId actionButtonDevice, DeviceButtonId actionButton, uint64_t timeSpan) 32 | { 33 | actionButton_.deviceId = actionButtonDevice; 34 | actionButton_.buttonId = actionButton; 35 | timeSpan_ = timeSpan; 36 | } 37 | 38 | void 39 | TapGesture::InternalUpdate(InputDeltaState* delta) 40 | { 41 | if (actionButton_.buttonId == InvalidDeviceButtonId) 42 | { 43 | return; 44 | } 45 | 46 | const InputDevice* actionDevice = manager_.GetDevice(actionButton_.deviceId); 47 | GAINPUT_ASSERT(actionDevice); 48 | 49 | HandleButton(*this, *state_, delta, TapTriggered, false); 50 | 51 | if (actionDevice->GetBool(actionButton_.buttonId)) 52 | { 53 | if (firstDownTime_ == 0) 54 | { 55 | firstDownTime_ = manager_.GetTime(); 56 | } 57 | } 58 | else 59 | { 60 | if (firstDownTime_ > 0 && firstDownTime_ + timeSpan_ >= manager_.GetTime()) 61 | { 62 | HandleButton(*this, *state_, delta, TapTriggered, true); 63 | } 64 | firstDownTime_ = 0; 65 | } 66 | } 67 | 68 | } 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/keyboard/GainputInputDeviceKeyboardImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEKEYBOARDIMPL_H_ 3 | #define GAINPUTINPUTDEVICEKEYBOARDIMPL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceKeyboardImpl 9 | { 10 | public: 11 | virtual ~InputDeviceKeyboardImpl() { } 12 | virtual InputDevice::DeviceVariant GetVariant() const = 0; 13 | virtual InputDevice::DeviceState GetState() const { return InputDevice::DS_OK; } 14 | virtual void Update(InputDeltaState* delta) = 0; 15 | virtual InputState* GetNextInputState() { return 0; } 16 | 17 | virtual bool IsTextInputEnabled() const = 0; 18 | virtual void SetTextInputEnabled(bool enabled) = 0; 19 | virtual char GetNextCharacter(gainput::DeviceButtonId buttonId = gainput::InvalidDeviceId) = 0; 20 | virtual void ClearButtons() { return; } 21 | }; 22 | 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/keyboard/GainputInputDeviceKeyboardNull.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEKEYBOARDNULL_H_ 3 | #define GAINPUTINPUTDEVICEKEYBOARDNULL_H_ 4 | 5 | #include "GainputInputDeviceKeyboardImpl.h" 6 | 7 | namespace gainput 8 | { 9 | 10 | class InputDeviceKeyboardImplNull : public InputDeviceKeyboardImpl 11 | { 12 | public: 13 | InputDeviceKeyboardImplNull(InputManager& /*manager*/, DeviceId /*device*/) 14 | { 15 | } 16 | 17 | InputDevice::DeviceVariant GetVariant() const 18 | { 19 | return InputDevice::DV_NULL; 20 | } 21 | 22 | void Update(InputDeltaState* /*delta*/) 23 | { 24 | } 25 | 26 | bool IsTextInputEnabled() const { return false; } 27 | void SetTextInputEnabled(bool /*enabled*/) { } 28 | char GetNextCharacter(gainput::DeviceButtonId buttonId) { return 0; } 29 | }; 30 | 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEMOUSEIMPL_H_ 3 | #define GAINPUTINPUTDEVICEMOUSEIMPL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceMouseImpl 9 | { 10 | public: 11 | virtual ~InputDeviceMouseImpl() { } 12 | virtual InputDevice::DeviceVariant GetVariant() const = 0; 13 | virtual InputDevice::DeviceState GetState() const { return InputDevice::DS_OK; } 14 | virtual void Update(InputDeltaState* delta) = 0; 15 | virtual void WarpMouse(const float&x, const float& y) {} 16 | virtual InputState * GetNextInputState() { return NULL; } 17 | }; 18 | 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseMac.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEMOUSEMAC_H_ 3 | #define GAINPUTINPUTDEVICEMOUSEMAC_H_ 4 | 5 | #include "GainputInputDeviceMouseImpl.h" 6 | #import 7 | 8 | @class GainputMacInputView; 9 | 10 | namespace gainput 11 | { 12 | 13 | class InputDeviceMouseImplMac : public InputDeviceMouseImpl 14 | { 15 | public: 16 | InputDeviceMouseImplMac(InputManager& manager, InputDevice& device, InputState& state, InputState& previousState); 17 | ~InputDeviceMouseImplMac(); 18 | 19 | InputDevice::DeviceVariant GetVariant() const override 20 | { 21 | return InputDevice::DV_STANDARD; 22 | } 23 | 24 | virtual InputState * GetNextInputState() override { 25 | return &nextState_; 26 | } 27 | 28 | InputDevice::DeviceState GetState() const override { return deviceState_; } 29 | 30 | void Update(InputDeltaState* delta) override; 31 | 32 | void HandleMouseMove(float x, float y); 33 | void HandleMouseWheel(int deltaY); 34 | void HandleMouseButton(bool isPressed, gainput::DeviceButtonId mouseButtonId ); 35 | 36 | InputManager& manager_; 37 | InputDevice::DeviceState deviceState_; 38 | InputDevice& device_; 39 | InputState* state_; 40 | InputState* previousState_; 41 | InputState nextState_; 42 | InputDeltaState* delta_; 43 | }; 44 | 45 | } 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseMac.mm: -------------------------------------------------------------------------------- 1 | 2 | #include "../../../include/gainput/gainput.h" 3 | 4 | #ifdef GAINPUT_PLATFORM_MAC 5 | #include "../../../include/gainput/GainputMac.h" 6 | #include "GainputInputDeviceMouseMac.h" 7 | 8 | #include "../../../include/gainput/GainputInputDeltaState.h" 9 | #include "../../../include/gainput/GainputHelpers.h" 10 | #include "../../../include/gainput/GainputLog.h" 11 | 12 | #import 13 | 14 | namespace gainput 15 | { 16 | 17 | InputDeviceMouseImplMac::InputDeviceMouseImplMac(InputManager& manager, InputDevice& device, InputState& state, InputState& previousState ) : 18 | manager_(manager), 19 | device_(device), 20 | state_(&state), 21 | previousState_(&previousState), 22 | nextState_(manager.GetAllocator(), MouseButtonCount + MouseAxisCount), 23 | delta_(0) 24 | { 25 | 26 | deviceState_ = InputDevice::DeviceState::DS_OK; 27 | 28 | } 29 | 30 | InputDeviceMouseImplMac::~InputDeviceMouseImplMac() 31 | { 32 | } 33 | 34 | void InputDeviceMouseImplMac::HandleMouseMove(float x, float y) 35 | { 36 | HandleAxis(device_, nextState_, delta_, gainput::MouseAxisX, x); 37 | HandleAxis(device_, nextState_, delta_, gainput::MouseAxisY, y); 38 | } 39 | 40 | void InputDeviceMouseImplMac::HandleMouseWheel(int deltaY) 41 | { 42 | if(deltaY < 0) 43 | { 44 | HandleButton(device_, nextState_, delta_, gainput::MouseButtonWheelDown, true); 45 | 46 | } 47 | else 48 | { 49 | HandleButton(device_, nextState_, delta_, gainput::MouseButtonWheelUp, true); 50 | } 51 | } 52 | 53 | 54 | void InputDeviceMouseImplMac::HandleMouseButton(bool isPressed, gainput::DeviceButtonId mouseButtonId ) 55 | { 56 | if(mouseButtonId < gainput::MouseButton0 || mouseButtonId >= gainput::MouseButtonMax) 57 | return; 58 | HandleButton(device_, nextState_, delta_, mouseButtonId, isPressed); 59 | 60 | } 61 | 62 | void InputDeviceMouseImplMac::Update(InputDeltaState* delta) 63 | { 64 | delta_ = delta; 65 | 66 | // Reset mouse wheel buttons 67 | HandleButton(device_, nextState_, delta_, MouseButtonWheelUp, false); 68 | HandleButton(device_, nextState_, delta_, MouseButtonWheelDown, false); 69 | 70 | *state_ = nextState_; 71 | } 72 | 73 | } 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseMacRaw.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEMOUSEMACRAW_H_ 3 | #define GAINPUTINPUTDEVICEMOUSEMACRAW_H_ 4 | 5 | #include "GainputInputDeviceMouseImpl.h" 6 | 7 | namespace gainput 8 | { 9 | 10 | class InputDeviceMouseImplMacRaw : public InputDeviceMouseImpl 11 | { 12 | public: 13 | InputDeviceMouseImplMacRaw(InputManager& manager, InputDevice& device, InputState& state, InputState& previousState); 14 | ~InputDeviceMouseImplMacRaw(); 15 | 16 | InputDevice::DeviceVariant GetVariant() const override 17 | { 18 | return InputDevice::DV_RAW; 19 | } 20 | 21 | virtual InputState * GetNextInputState() override { 22 | return &nextState_; 23 | } 24 | 25 | InputDevice::DeviceState GetState() const override { return deviceState_; } 26 | 27 | void Update(InputDeltaState* delta) override; 28 | void HandleMouseMove(float x, float y); 29 | 30 | InputManager& manager_; 31 | InputDevice::DeviceState deviceState_; 32 | InputDevice& device_; 33 | InputState* state_; 34 | InputState* previousState_; 35 | InputState nextState_; 36 | InputDeltaState* delta_; 37 | 38 | float mousePosAccumulationX_; 39 | float mousePosAccumulationY_; 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseMacRaw.mm: -------------------------------------------------------------------------------- 1 | #include "../../../include/gainput/gainput.h" 2 | 3 | 4 | #ifdef GAINPUT_PLATFORM_MAC 5 | 6 | #include "GainputInputDeviceMouseMacRaw.h" 7 | 8 | #include "../../../include/gainput/GainputInputDeltaState.h" 9 | #include "../../../include/gainput/GainputHelpers.h" 10 | #include "../../../include/gainput/GainputLog.h" 11 | 12 | #import 13 | //#import 14 | 15 | #import 16 | #import 17 | #import 18 | 19 | 20 | namespace gainput 21 | { 22 | 23 | InputDeviceMouseImplMacRaw::InputDeviceMouseImplMacRaw(InputManager& manager, InputDevice& device, InputState& state, InputState& previousState) : 24 | manager_(manager), 25 | device_(device), 26 | state_(&state), 27 | previousState_(&previousState), 28 | nextState_(manager.GetAllocator(), MouseButtonCount + MouseAxisCount), 29 | delta_(0) 30 | { 31 | mousePosAccumulationX_ = 0; 32 | mousePosAccumulationY_ = 0; 33 | deviceState_ = InputDevice::DeviceState::DS_OK; 34 | } 35 | 36 | InputDeviceMouseImplMacRaw::~InputDeviceMouseImplMacRaw() 37 | { 38 | } 39 | 40 | void InputDeviceMouseImplMacRaw::HandleMouseMove(float x, float y) 41 | { 42 | mousePosAccumulationX_ += x; 43 | mousePosAccumulationY_ += y; 44 | HandleAxis(device_, nextState_, delta_, gainput::MouseAxisX, mousePosAccumulationX_); 45 | HandleAxis(device_, nextState_, delta_, gainput::MouseAxisY, mousePosAccumulationY_); 46 | } 47 | 48 | void InputDeviceMouseImplMacRaw::Update(InputDeltaState* delta) 49 | { 50 | delta_ = delta; 51 | 52 | // Reset mouse wheel buttons 53 | HandleButton(device_, nextState_, delta_, MouseButtonWheelDown, false); 54 | HandleButton(device_, nextState_, delta_, MouseButtonWheelUp, false); 55 | HandleButton(device_, nextState_, delta_, MouseButtonWheelDown, false); 56 | 57 | *state_ = nextState_; 58 | } 59 | 60 | } 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseNull.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEMOUSENULL_H_ 3 | #define GAINPUTINPUTDEVICEMOUSENULL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceMouseImplNull : public InputDeviceMouseImpl 9 | { 10 | public: 11 | InputDeviceMouseImplNull(InputManager& /*manager*/, DeviceId /*device*/) 12 | { 13 | } 14 | 15 | InputDevice::DeviceVariant GetVariant() const 16 | { 17 | return InputDevice::DV_NULL; 18 | } 19 | 20 | void Update(InputDeltaState* /*delta*/) 21 | { 22 | } 23 | }; 24 | 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/mouse/GainputMouseInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTMOUSEINFO_H_ 3 | #define GAINPUTMOUSEINFO_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | namespace 9 | { 10 | struct DeviceButtonInfo 11 | { 12 | ButtonType type; 13 | const char* name; 14 | }; 15 | 16 | DeviceButtonInfo deviceButtonInfos[] = 17 | { 18 | { BT_BOOL, "mouse_left" }, 19 | { BT_BOOL, "mouse_middle" }, 20 | { BT_BOOL, "mouse_right" }, 21 | { BT_BOOL, "mouse_3" }, 22 | { BT_BOOL, "mouse_4" }, 23 | { BT_BOOL, "mouse_5" }, 24 | { BT_BOOL, "mouse_6" }, 25 | { BT_BOOL, "mouse_7" }, 26 | { BT_BOOL, "mouse_8" }, 27 | { BT_BOOL, "mouse_9" }, 28 | { BT_BOOL, "mouse_10" }, 29 | { BT_BOOL, "mouse_11" }, 30 | { BT_BOOL, "mouse_12" }, 31 | { BT_BOOL, "mouse_13" }, 32 | { BT_BOOL, "mouse_14" }, 33 | { BT_BOOL, "mouse_15" }, 34 | { BT_BOOL, "mouse_16" }, 35 | { BT_BOOL, "mouse_17" }, 36 | { BT_BOOL, "mouse_18" }, 37 | { BT_BOOL, "mouse_19" }, 38 | { BT_BOOL, "mouse_20" }, 39 | { BT_FLOAT, "mouse_x" }, 40 | { BT_FLOAT, "mouse_y" } 41 | }; 42 | } 43 | 44 | 45 | } 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/pad/GainputInputDevicePadAndroid.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEPADANDROID_H_ 3 | #define GAINPUTINPUTDEVICEPADANDROID_H_ 4 | 5 | #include "GainputInputDevicePadImpl.h" 6 | #include 7 | 8 | namespace gainput 9 | { 10 | 11 | class InputDevicePadImplAndroid : public InputDevicePadImpl 12 | { 13 | public: 14 | InputDevicePadImplAndroid(InputManager& manager, InputDevice& device, unsigned index, InputState& state, InputState& previousState) : 15 | manager_(manager), 16 | device_(device), 17 | state_(&state), 18 | previousState_(&previousState), 19 | nextState_(manager.GetAllocator(), PadButtonMax_), 20 | delta_(0), 21 | index_(index), 22 | deviceState_(InputDevice::DS_UNAVAILABLE) 23 | { 24 | (void)previousState; 25 | GAINPUT_ASSERT(index_ < MaxPadCount); 26 | } 27 | 28 | ~InputDevicePadImplAndroid() 29 | { 30 | } 31 | 32 | InputDevice::DeviceVariant GetVariant() const 33 | { 34 | return InputDevice::DV_STANDARD; 35 | } 36 | 37 | void Update(InputDeltaState* delta) 38 | { 39 | delta_ = delta; 40 | *state_ = nextState_; 41 | } 42 | 43 | InputDevice::DeviceState GetState() const 44 | { 45 | return deviceState_; 46 | } 47 | 48 | void SetState(InputDevice::DeviceState state) 49 | { 50 | deviceState_ = state; 51 | } 52 | 53 | bool IsValidButton(DeviceButtonId deviceButton) const 54 | { 55 | return deviceButton < PadButtonMax_; 56 | } 57 | 58 | bool Vibrate(float /*leftMotor*/, float /*rightMotor*/) 59 | { 60 | return false; // TODO 61 | } 62 | 63 | InputState* GetNextInputState() { return &nextState_; } 64 | 65 | private: 66 | InputManager& manager_; 67 | InputDevice& device_; 68 | InputState* state_; 69 | InputState* previousState_; 70 | InputState nextState_; 71 | InputDeltaState* delta_; 72 | unsigned index_; 73 | InputDevice::DeviceState deviceState_; 74 | 75 | }; 76 | 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/pad/GainputInputDevicePadImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEPADIMPL_H_ 3 | #define GAINPUTINPUTDEVICEPADIMPL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDevicePadImpl 9 | { 10 | public: 11 | virtual ~InputDevicePadImpl() { } 12 | virtual InputDevice::DeviceVariant GetVariant() const = 0; 13 | virtual InputDevice::DeviceState GetState() const { return InputDevice::DS_OK; } 14 | virtual void Update(InputDeltaState* delta) = 0; 15 | virtual bool IsValidButton(DeviceButtonId deviceButton) const = 0; 16 | virtual bool Vibrate(float leftMotor, float rightMotor) = 0; 17 | virtual InputState* GetNextInputState() { return 0; } 18 | }; 19 | 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/pad/GainputInputDevicePadIos.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEPADIOS_H_ 3 | #define GAINPUTINPUTDEVICEPADIOS_H_ 4 | 5 | #include "../../../include/gainput/GainputContainers.h" 6 | 7 | namespace gainput 8 | { 9 | 10 | class InputDevicePadImplIos : public InputDevicePadImpl 11 | { 12 | public: 13 | InputDevicePadImplIos(InputManager& manager, InputDevice& device, unsigned index, InputState& state, InputState& previousState); 14 | ~InputDevicePadImplIos(); 15 | 16 | InputDevice::DeviceVariant GetVariant() const 17 | { 18 | return InputDevice::DV_STANDARD; 19 | } 20 | 21 | void Update(InputDeltaState* delta); 22 | 23 | InputDevice::DeviceState GetState() const 24 | { 25 | return deviceState_; 26 | } 27 | 28 | bool IsValidButton(DeviceButtonId deviceButton) const; 29 | 30 | typedef gainput::Array GlobalControllerList; 31 | static GlobalControllerList* mappedControllers_; 32 | 33 | bool Vibrate(float leftMotor, float rightMotor) 34 | { 35 | return false; 36 | } 37 | 38 | private: 39 | InputManager& manager_; 40 | InputDevice& device_; 41 | unsigned index_; 42 | InputState& state_; 43 | InputState& previousState_; 44 | InputDevice::DeviceState deviceState_; 45 | 46 | bool pausePressed_; 47 | bool isMicro_; 48 | bool isNormal_; 49 | bool isExtended_; 50 | bool supportsMotion_; 51 | bool isRemote_; 52 | void* gcController_; 53 | 54 | void UpdateRemote_(InputDeltaState* delta); 55 | void UpdateGamepad_(InputDeltaState* delta); 56 | }; 57 | 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/pad/GainputInputDevicePadMac.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEPADMAC_H_ 3 | #define GAINPUTINPUTDEVICEPADMAC_H_ 4 | 5 | 6 | namespace gainput 7 | { 8 | 9 | class InputDevicePadImplMac : public InputDevicePadImpl 10 | { 11 | public: 12 | InputDevicePadImplMac(InputManager& manager, InputDevice& device, unsigned index, InputState& state, InputState& previousState); 13 | ~InputDevicePadImplMac(); 14 | 15 | InputDevice::DeviceVariant GetVariant() const 16 | { 17 | return InputDevice::DV_STANDARD; 18 | } 19 | 20 | void Update(InputDeltaState* delta); 21 | 22 | InputDevice::DeviceState GetState() const 23 | { 24 | return deviceState_; 25 | } 26 | 27 | bool IsValidButton(DeviceButtonId deviceButton) const; 28 | 29 | bool Vibrate(float leftMotor, float rightMotor) 30 | { 31 | return false; 32 | } 33 | 34 | HashMap buttonDialect_; 35 | HashMap axisDialect_; 36 | float minAxis_; 37 | float maxAxis_; 38 | float minTriggerAxis_; 39 | float maxTriggerAxis_; 40 | InputManager& manager_; 41 | InputDevice& device_; 42 | unsigned index_; 43 | InputState& state_; 44 | InputState& previousState_; 45 | InputState nextState_; 46 | InputDeltaState* delta_; 47 | InputDevice::DeviceState deviceState_; 48 | 49 | void* ioManager_; 50 | 51 | private: 52 | }; 53 | 54 | } 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/pad/GainputInputDevicePadNull.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICEPADNULL_H_ 3 | #define GAINPUTINPUTDEVICEPADNULL_H_ 4 | 5 | 6 | namespace gainput 7 | { 8 | 9 | class InputDevicePadImplNull : public InputDevicePadImpl 10 | { 11 | public: 12 | InputDevicePadImplNull(InputManager& manager, InputDevice& device, unsigned index, InputState& state, InputState& previousState) 13 | { 14 | } 15 | 16 | InputDevice::DeviceVariant GetVariant() const 17 | { 18 | return InputDevice::DV_NULL; 19 | } 20 | 21 | void Update(InputDeltaState* /*delta*/) 22 | { 23 | } 24 | 25 | InputDevice::DeviceState GetState() const 26 | { 27 | return InputDevice::DS_OK; 28 | } 29 | 30 | bool IsValidButton(DeviceButtonId /*deviceButton*/) const 31 | { 32 | return false; 33 | } 34 | 35 | bool Vibrate(float /*leftMotor*/, float /*rightMotor*/) 36 | { 37 | return false; 38 | } 39 | }; 40 | 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/touch/GainputInputDeviceTouchImpl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICETOUCHIMPL_H_ 3 | #define GAINPUTINPUTDEVICETOUCHIMPL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceTouchImpl 9 | { 10 | public: 11 | virtual ~InputDeviceTouchImpl() { } 12 | virtual InputDevice::DeviceVariant GetVariant() const = 0; 13 | virtual InputDevice::DeviceState GetState() const = 0; 14 | virtual void Update(InputDeltaState* delta) = 0; 15 | virtual bool SupportsPressure() const { return false; } 16 | virtual InputState* GetNextInputState() { return 0; } 17 | 18 | virtual void GetVirtualKeyboardInput(char* buffer, uint32_t inbufferLength) const { 19 | inbufferLength = 0; 20 | if(buffer) *buffer='\0'; 21 | } 22 | 23 | }; 24 | 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/touch/GainputInputDeviceTouchNull.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTINPUTDEVICETOUCHNULL_H_ 3 | #define GAINPUTINPUTDEVICETOUCHNULL_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | class InputDeviceTouchImplNull : public InputDeviceTouchImpl 9 | { 10 | public: 11 | InputDeviceTouchImplNull(InputManager& manager, InputDevice& device) 12 | { 13 | } 14 | 15 | InputDevice::DeviceVariant GetVariant() const 16 | { 17 | return InputDevice::DV_NULL; 18 | } 19 | 20 | void Update(InputDeltaState* /*delta*/) 21 | { 22 | } 23 | 24 | InputDevice::DeviceState GetState() const { return InputDevice::DS_OK; } 25 | }; 26 | 27 | } 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /third_party/gainput/lib/source/gainput/touch/GainputTouchInfo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef GAINPUTTOUCHINFO_H_ 3 | #define GAINPUTTOUCHINFO_H_ 4 | 5 | namespace gainput 6 | { 7 | 8 | namespace 9 | { 10 | struct DeviceButtonInfo 11 | { 12 | ButtonType type; 13 | const char* name; 14 | }; 15 | 16 | DeviceButtonInfo const deviceButtonInfos[] = 17 | { 18 | { BT_BOOL, "touch_0_down" }, 19 | { BT_FLOAT, "touch_0_x" }, 20 | { BT_FLOAT, "touch_0_y" }, 21 | { BT_FLOAT, "touch_0_pressure" }, 22 | { BT_BOOL, "touch_1_down" }, 23 | { BT_FLOAT, "touch_1_x" }, 24 | { BT_FLOAT, "touch_1_y" }, 25 | { BT_FLOAT, "touch_1_pressure" }, 26 | { BT_BOOL, "touch_2_down" }, 27 | { BT_FLOAT, "touch_2_x" }, 28 | { BT_FLOAT, "touch_2_y" }, 29 | { BT_FLOAT, "touch_2_pressure" }, 30 | { BT_BOOL, "touch_3_down" }, 31 | { BT_FLOAT, "touch_3_x" }, 32 | { BT_FLOAT, "touch_3_y" }, 33 | { BT_FLOAT, "touch_3_pressure" }, 34 | { BT_BOOL, "touch_4_down" }, 35 | { BT_FLOAT, "touch_4_x" }, 36 | { BT_FLOAT, "touch_4_y" }, 37 | { BT_FLOAT, "touch_4_pressure" }, 38 | { BT_BOOL, "touch_5_down" }, 39 | { BT_FLOAT, "touch_5_x" }, 40 | { BT_FLOAT, "touch_5_y" }, 41 | { BT_FLOAT, "touch_5_pressure" }, 42 | { BT_BOOL, "touch_6_down" }, 43 | { BT_FLOAT, "touch_6_x" }, 44 | { BT_FLOAT, "touch_6_y" }, 45 | { BT_FLOAT, "touch_6_pressure" }, 46 | { BT_BOOL, "touch_7_down" }, 47 | { BT_FLOAT, "touch_7_x" }, 48 | { BT_FLOAT, "touch_7_y" }, 49 | { BT_FLOAT, "touch_7_pressure" } 50 | }; 51 | } 52 | 53 | const unsigned TouchPointCount = 8; 54 | const unsigned TouchDataElems = 4; 55 | 56 | } 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /third_party/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2018 Omar Cornut 4 | 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /third_party/winpixeventruntime/Include/WinPixEventRuntime/pix3_win.h: -------------------------------------------------------------------------------- 1 | /*==========================================================================; 2 | * 3 | * Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | * 5 | * File: PIX3_win.h 6 | * Content: PIX include file 7 | * Don't include this file directly - use pix3.h 8 | * 9 | ****************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef _PIX3_H_ 14 | #error Don't include this file directly - use pix3.h 15 | #endif 16 | 17 | #ifndef _PIX3_WIN_H_ 18 | #define _PIX3_WIN_H_ 19 | 20 | struct PIXEventsBlockInfo 21 | { 22 | }; 23 | 24 | struct PIXEventsThreadInfo 25 | { 26 | PIXEventsBlockInfo* block; 27 | UINT64* biasedLimit; 28 | UINT64* destination; 29 | UINT64* limit; 30 | UINT64 id; 31 | }; 32 | 33 | extern "C" PIXEventsThreadInfo* PIXGetThreadInfo(); 34 | 35 | // The following defines denote the different metadata values that have been used 36 | // by tools to denote how to parse pix marker event data. The first two values 37 | // are legacy values. 38 | #define WINPIX_EVENT_UNICODE_VERSION 0 39 | #define WINPIX_EVENT_ANSI_VERSION 1 40 | #define WINPIX_EVENT_PIX3BLOB_VERSION 2 41 | 42 | #define D3D12_EVENT_METADATA WINPIX_EVENT_PIX3BLOB_VERSION 43 | 44 | __forceinline UINT64 PIXGetTimestampCounter() 45 | { 46 | LARGE_INTEGER time = {}; 47 | QueryPerformanceCounter(&time); 48 | return time.QuadPart; 49 | } 50 | 51 | #define PIXSetCPUMarkerOnContext(context, metadata, ...) MakeCPUSetMarkerForContext(metadata, context, __VA_ARGS__) 52 | #define PIXBeginCPUEventOnContext(context, metadata, ...) MakeCPUBeginEventForContext(metadata, context, __VA_ARGS__) 53 | #define PIXEndCPUEventOnContext(context) MakeCPUEndEventForContext(context) 54 | 55 | #endif //_PIX3_WIN_H_ 56 | -------------------------------------------------------------------------------- /third_party/winpixeventruntime/WinPixEventRuntime.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinPixEventRuntime 5 | 1.0.170918004 6 | WinPixEventRuntime 7 | Microsoft 8 | pix,microsoft 9 | https://www.microsoft.com/web/webpi/eula/eula_pix_event_runtime.htm 10 | https://blogs.msdn.microsoft.com/pix/winpixeventruntime/ 11 | http://www.gravatar.com/avatar/df362936893270e6a1b53807fa90e8fa 12 | false 13 | Allows applications to be instrumented with marker events, for use with Microsoft PIX. 14 | PIX Direct3D graphics 3D 15 | 16 | -------------------------------------------------------------------------------- /third_party/winpixeventruntime/[Content_Types].xml: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /third_party/winpixeventruntime/_rels/.rels: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /third_party/winpixeventruntime/bin/WinPixEventRuntime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/winpixeventruntime/bin/WinPixEventRuntime.dll -------------------------------------------------------------------------------- /third_party/winpixeventruntime/bin/WinPixEventRuntime.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/winpixeventruntime/bin/WinPixEventRuntime.lib -------------------------------------------------------------------------------- /third_party/winpixeventruntime/bin/WinPixEventRuntime_UAP.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/winpixeventruntime/bin/WinPixEventRuntime_UAP.dll -------------------------------------------------------------------------------- /third_party/winpixeventruntime/bin/WinPixEventRuntime_UAP.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boberfly/The-Forge-Lite/2c1558f07f9991f4b14b6bcce43d641268168274/third_party/winpixeventruntime/bin/WinPixEventRuntime_UAP.lib -------------------------------------------------------------------------------- /third_party/winpixeventruntime/package/services/metadata/core-properties/275b2a06678f4be98fcb5edae6a2f3fb.psmdcp: -------------------------------------------------------------------------------- 1 | MicrosoftAllows applications to be instrumented with marker events, for use with Microsoft PIX.WinPixEventRuntime1.0.170918004PIX Direct3D graphics 3DWinPixEventRuntimeNuGet, Version=3.3.0.212, Culture=neutral, PublicKeyToken=31bf3856ad364e35;Microsoft Windows NT 6.2.9200.0;.NET Framework 4.5 --------------------------------------------------------------------------------