├── .editorconfig
├── .gitignore
├── Build
├── ImageBasedPBR.sln
├── ImageBasedPBR.vcxproj
├── ImageBasedPBR.vcxproj.filters
├── PixelShaders.vcxproj
└── VertexShaders.vcxproj
├── Data
├── Meshes
│ ├── Cube.gltf
│ ├── Cube_data.bin
│ ├── Sphere.gltf
│ └── Sphere_data.bin
├── Roboto-Medium.ttf
├── Shaders
│ └── .gitkeep
└── Textures
│ └── Newport_Loft.hdr
├── ImageBasedPBR.png
├── LICENSE
├── README.md
└── Source
├── CPUAndGPUCommon.h
├── External
├── DirectXMath
│ ├── DirectXCollision.h
│ ├── DirectXCollision.inl
│ ├── DirectXColors.h
│ ├── DirectXMath.h
│ ├── DirectXMathConvert.inl
│ ├── DirectXMathMatrix.inl
│ ├── DirectXMathMisc.inl
│ ├── DirectXMathVector.inl
│ ├── DirectXPackedVector.h
│ └── DirectXPackedVector.inl
├── EAAssert
│ ├── eaassert.h
│ ├── source
│ │ └── eaassert.cpp
│ └── version.h
├── EABase
│ ├── config
│ │ ├── eacompiler.h
│ │ ├── eacompilertraits.h
│ │ └── eaplatform.h
│ ├── eabase.h
│ ├── eahave.h
│ ├── earesult.h
│ ├── eastdarg.h
│ ├── eaunits.h
│ ├── int128.h
│ ├── nullptr.h
│ └── version.h
├── EASTL
│ ├── algorithm.h
│ ├── allocator.h
│ ├── allocator_malloc.h
│ ├── any.h
│ ├── array.h
│ ├── 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_set.h
│ ├── fixed_slist.h
│ ├── fixed_string.h
│ ├── fixed_substring.h
│ ├── fixed_vector.h
│ ├── functional.h
│ ├── hash_map.h
│ ├── hash_set.h
│ ├── 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.h
│ ├── intrusive_ptr.h
│ ├── iterator.h
│ ├── linked_array.h
│ ├── linked_ptr.h
│ ├── list.h
│ ├── map.h
│ ├── memory.h
│ ├── meta.h
│ ├── numeric.h
│ ├── numeric_limits.h
│ ├── optional.h
│ ├── priority_queue.h
│ ├── queue.h
│ ├── random.h
│ ├── ratio.h
│ ├── safe_ptr.h
│ ├── scoped_array.h
│ ├── scoped_ptr.h
│ ├── segmented_vector.h
│ ├── set.h
│ ├── shared_array.h
│ ├── shared_ptr.h
│ ├── slist.h
│ ├── sort.h
│ ├── source
│ │ ├── allocator_eastl.cpp
│ │ ├── assert.cpp
│ │ ├── fixed_pool.cpp
│ │ ├── hashtable.cpp
│ │ ├── intrusive_list.cpp
│ │ ├── numeric_limits.cpp
│ │ ├── red_black_tree.cpp
│ │ ├── string.cpp
│ │ └── thread_support.cpp
│ ├── span.h
│ ├── stack.h
│ ├── string.h
│ ├── string_hash_map.h
│ ├── string_map.h
│ ├── string_view.h
│ ├── 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
├── EAStdC
│ ├── EAAlignment.h
│ ├── EABitTricks.h
│ ├── EAByteCrackers.h
│ ├── EACType.h
│ ├── EACallback.h
│ ├── EADateTime.h
│ ├── EAEndian.h
│ ├── EAFixedPoint.h
│ ├── EAGlobal.h
│ ├── EAHashCRC.h
│ ├── EAHashString.h
│ ├── EAMathHelp.h
│ ├── EAMemory.h
│ ├── EAProcess.h
│ ├── EARandom.h
│ ├── EARandomDistribution.h
│ ├── EAScanf.h
│ ├── EASingleton.h
│ ├── EASprintf.h
│ ├── EASprintfOrdered.h
│ ├── EAStdC.h
│ ├── EAStopwatch.h
│ ├── EAString.h
│ ├── EATextUtil.h
│ ├── Int128_t.h
│ ├── Win32
│ │ └── EAMathHelpWin32.inl
│ ├── internal
│ │ ├── Config.h
│ │ ├── EAMemory.inl
│ │ ├── IntrusiveList.h
│ │ ├── ScanfCore.h
│ │ ├── SprintfCore.h
│ │ ├── Thread.h
│ │ └── stdioEA.h
│ ├── source
│ │ ├── EACType.cpp
│ │ ├── EACallback.cpp
│ │ ├── EADateTime.cpp
│ │ ├── EAFixedPoint.cpp
│ │ ├── EAGlobal.cpp
│ │ ├── EAHashCRC.cpp
│ │ ├── EAHashString.cpp
│ │ ├── EAMemory.cpp
│ │ ├── EAProcess.cpp
│ │ ├── EARandom.cpp
│ │ ├── EAScanf.cpp
│ │ ├── EAScanfCore.cpp
│ │ ├── EASprintf.cpp
│ │ ├── EASprintfCore.cpp
│ │ ├── EASprintfOrdered.cpp
│ │ ├── EAStdC.cpp
│ │ ├── EAStopwatch.cpp
│ │ ├── EAString.cpp
│ │ ├── EATextUtil.cpp
│ │ └── Int128_t.cpp
│ └── version.h
├── EAThread
│ ├── android
│ │ ├── eathread_atomic_android.h
│ │ └── eathread_atomic_android_c11.h
│ ├── apple
│ │ ├── eathread_atomic_apple.h
│ │ ├── eathread_callstack_apple.h
│ │ └── eathread_sync_apple.h
│ ├── arm
│ │ └── eathread_sync_arm.h
│ ├── armgcc
│ │ └── eathread_sync_armgcc.h
│ ├── cpp11
│ │ └── eathread_atomic_cpp11.h
│ ├── eathread.h
│ ├── eathread_atomic.h
│ ├── eathread_barrier.h
│ ├── eathread_callstack.h
│ ├── eathread_callstack_context.h
│ ├── eathread_condition.h
│ ├── eathread_futex.h
│ ├── eathread_list.h
│ ├── eathread_mutex.h
│ ├── eathread_pool.h
│ ├── eathread_rwmutex.h
│ ├── eathread_rwmutex_ip.h
│ ├── eathread_rwsemalock.h
│ ├── eathread_rwspinlock.h
│ ├── eathread_rwspinlockw.h
│ ├── eathread_semaphore.h
│ ├── eathread_spinlock.h
│ ├── eathread_storage.h
│ ├── eathread_sync.h
│ ├── eathread_thread.h
│ ├── gcc
│ │ ├── eathread_atomic_gcc.h
│ │ └── eathread_sync_gcc.h
│ ├── internal
│ │ ├── atomic.h
│ │ ├── config.h
│ │ ├── dllinfo.h
│ │ ├── eathread_atomic.h
│ │ ├── eathread_atomic_standalone.h
│ │ ├── eathread_atomic_standalone_gcc.h
│ │ ├── eathread_atomic_standalone_msvc.h
│ │ ├── eathread_global.h
│ │ └── timings.h
│ ├── shared_array_mt.h
│ ├── shared_ptr_mt.h
│ ├── source
│ │ ├── android
│ │ │ ├── com_ea_EAThread_EAThread.h
│ │ │ ├── eathread_android.cpp
│ │ │ ├── eathread_fake_atomic_64.cpp
│ │ │ └── eathread_semaphore_android.cpp
│ │ ├── apple
│ │ │ ├── eathread_callstack_apple.cpp
│ │ │ └── eathread_semaphore_apple.cpp
│ │ ├── arm
│ │ │ └── eathread_callstack_arm.cpp
│ │ ├── cpp11
│ │ │ ├── eathread_cpp11.cpp
│ │ │ ├── eathread_mutex_cpp11.cpp
│ │ │ ├── eathread_semaphore_cpp11.cpp
│ │ │ └── eathread_thread_cpp11.cpp
│ │ ├── eathread.cpp
│ │ ├── eathread_barrier.cpp
│ │ ├── eathread_callstack.cpp
│ │ ├── eathread_condition.cpp
│ │ ├── eathread_futex.cpp
│ │ ├── eathread_mutex.cpp
│ │ ├── eathread_pool.cpp
│ │ ├── eathread_rwmutex.cpp
│ │ ├── eathread_rwmutex_ip.cpp
│ │ ├── eathread_semaphore.cpp
│ │ ├── eathread_storage.cpp
│ │ ├── eathread_thread.cpp
│ │ ├── kettle
│ │ │ ├── eathread_barrier_kettle.cpp
│ │ │ ├── eathread_callstack_kettle.cpp
│ │ │ ├── eathread_condition_kettle.cpp
│ │ │ ├── eathread_kettle.cpp
│ │ │ ├── eathread_mutex_kettle.cpp
│ │ │ ├── eathread_pthread_stack_info.cpp
│ │ │ ├── eathread_semaphore_kettle.cpp
│ │ │ └── eathread_thread_kettle.cpp
│ │ ├── libunwind
│ │ │ └── eathread_callstack_libunwind.cpp
│ │ ├── null
│ │ │ └── eathread_callstack_null.cpp
│ │ ├── pc
│ │ │ ├── eathread_callstack_win32.cpp
│ │ │ ├── eathread_callstack_win64.cpp
│ │ │ ├── eathread_mutex_pc.cpp
│ │ │ ├── eathread_pc.cpp
│ │ │ ├── eathread_semaphore_pc.cpp
│ │ │ └── eathread_thread_pc.cpp
│ │ ├── unix
│ │ │ ├── eathread_barrier_unix.cpp
│ │ │ ├── eathread_callstack_glibc.cpp
│ │ │ ├── eathread_condition_unix.cpp
│ │ │ ├── eathread_mutex_unix.cpp
│ │ │ ├── eathread_pthread_stack_info.cpp
│ │ │ ├── eathread_semaphore_unix.cpp
│ │ │ ├── eathread_thread_unix.cpp
│ │ │ └── eathread_unix.cpp
│ │ ├── version.cpp
│ │ └── x86
│ │ │ └── eathread_callstack_x86.cpp
│ ├── version.h
│ ├── x86-64
│ │ ├── eathread_atomic_x86-64.h
│ │ └── eathread_sync_x86-64.h
│ └── x86
│ │ ├── eathread_atomic_x86.h
│ │ └── eathread_sync_x86.h
├── cgltf.cpp
├── cgltf.h
├── d3dx12.h
├── imgui
│ ├── imconfig.h
│ ├── imgui.cpp
│ ├── imgui.h
│ ├── imgui_demo.cpp
│ ├── imgui_draw.cpp
│ ├── imgui_internal.h
│ ├── imgui_widgets.cpp
│ ├── imstb_rectpack.h
│ ├── imstb_textedit.h
│ └── imstb_truetype.h
├── stb_image.cpp
└── stb_image.h
├── ImageBasedPBR.cpp
├── Library.cpp
├── Library.h
└── Shaders
├── Common.hlsli
├── EquirectangularToCube.hlsl
├── GenerateBRDFIntegrationMap.hlsl
├── GenerateIrradianceMap.hlsl
├── GenerateMipmaps.hlsl
├── PrefilterEnvMap.hlsl
├── SampleEnvMap.hlsl
├── SimpleForward.hlsl
├── Test.hlsl
└── UserInterface.hlsl
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | # Baseline
7 | [*]
8 | charset = utf-8
9 | indent_style = tab
10 | indent_size = 4
11 | tab_width = 4
12 | trim_trailing_whitespace = false
13 | max_line_length = 120
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pdb
2 | *.ilk
3 | *.exe
4 | *.cso
5 | *.ipdb
6 | *.iobj
7 | *.user
8 | /Build/.vs
9 | /Build/x64
10 | imgui.ini
--------------------------------------------------------------------------------
/Build/ImageBasedPBR.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29009.5
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageBasedPBR", "ImageBasedPBR.vcxproj", "{89B82422-AD60-4402-A07C-68CA8C26D63A}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {04D14098-B9A3-4DF8-8356-76EBEB036B00} = {04D14098-B9A3-4DF8-8356-76EBEB036B00}
9 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22} = {54D728F2-8AAD-41C1-B4D5-42C831AACC22}
10 | EndProjectSection
11 | EndProject
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VertexShaders", "VertexShaders.vcxproj", "{54D728F2-8AAD-41C1-B4D5-42C831AACC22}"
13 | EndProject
14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PixelShaders", "PixelShaders.vcxproj", "{04D14098-B9A3-4DF8-8356-76EBEB036B00}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|x64 = Debug|x64
19 | Release|x64 = Release|x64
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {89B82422-AD60-4402-A07C-68CA8C26D63A}.Debug|x64.ActiveCfg = Debug|x64
23 | {89B82422-AD60-4402-A07C-68CA8C26D63A}.Debug|x64.Build.0 = Debug|x64
24 | {89B82422-AD60-4402-A07C-68CA8C26D63A}.Release|x64.ActiveCfg = Release|x64
25 | {89B82422-AD60-4402-A07C-68CA8C26D63A}.Release|x64.Build.0 = Release|x64
26 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22}.Debug|x64.ActiveCfg = Debug|x64
27 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22}.Debug|x64.Build.0 = Debug|x64
28 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22}.Release|x64.ActiveCfg = Release|x64
29 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22}.Release|x64.Build.0 = Release|x64
30 | {04D14098-B9A3-4DF8-8356-76EBEB036B00}.Debug|x64.ActiveCfg = Debug|x64
31 | {04D14098-B9A3-4DF8-8356-76EBEB036B00}.Debug|x64.Build.0 = Debug|x64
32 | {04D14098-B9A3-4DF8-8356-76EBEB036B00}.Release|x64.ActiveCfg = Release|x64
33 | {04D14098-B9A3-4DF8-8356-76EBEB036B00}.Release|x64.Build.0 = Release|x64
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | GlobalSection(ExtensibilityGlobals) = postSolution
39 | SolutionGuid = {3FEDA15D-D8B8-475C-9C9B-E1784C81E0E4}
40 | EndGlobalSection
41 | EndGlobal
42 |
--------------------------------------------------------------------------------
/Build/PixelShaders.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | 16.0
15 | {04D14098-B9A3-4DF8-8356-76EBEB036B00}
16 | PS
17 | 10.0
18 | PixelShaders
19 |
20 |
21 |
22 | Application
23 | true
24 | v142
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v142
31 | true
32 | MultiByte
33 |
34 |
35 |
36 | $(Platform)\$(Configuration)\PS\
37 | $(SolutionDir)..\
38 |
39 |
40 | $(Platform)\$(Configuration)\PS\
41 | $(SolutionDir)..\
42 |
43 |
44 |
45 | MainPS
46 | 6.0
47 | $(OutDir)Data\Shaders\%(Filename).ps.cso
48 | Pixel
49 |
50 |
51 |
52 |
53 | MainPS
54 | 6.0
55 | $(OutDir)Data\Shaders\%(Filename).ps.cso
56 | Pixel
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | Pixel
66 | Pixel
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/Build/VertexShaders.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | 16.0
15 | {54D728F2-8AAD-41C1-B4D5-42C831AACC22}
16 | VS
17 | 10.0
18 | VertexShaders
19 |
20 |
21 |
22 | Application
23 | true
24 | v142
25 | MultiByte
26 |
27 |
28 | Application
29 | false
30 | v142
31 | true
32 | MultiByte
33 |
34 |
35 |
36 | $(Platform)\$(Configuration)\VS\
37 | $(SolutionDir)..\
38 |
39 |
40 | $(Platform)\$(Configuration)\VS\
41 | $(SolutionDir)..\
42 |
43 |
44 |
45 | MainVS
46 | 6.0
47 | $(OutDir)Data\Shaders\%(Filename).vs.cso
48 | Vertex
49 | /Ges %(AdditionalOptions)
50 |
51 |
52 |
53 |
54 | MainVS
55 | 6.0
56 | $(OutDir)Data\Shaders\%(Filename).vs.cso
57 | Vertex
58 | /Ges %(AdditionalOptions)
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/Data/Meshes/Cube.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset":{
3 | "version":"2.0",
4 | "generator":"Houdini GLTF 2.0 Exporter"
5 | },
6 | "accessors":[
7 | {
8 | "bufferView":0,
9 | "componentType":5121,
10 | "count":36,
11 | "type":"SCALAR",
12 | "min":[0
13 | ],
14 | "max":[35
15 | ]
16 | },
17 | {
18 | "bufferView":1,
19 | "componentType":5126,
20 | "count":36,
21 | "type":"VEC3",
22 | "min":[-0.5,-0.5,-0.5
23 | ],
24 | "max":[0.5,0.5,0.5
25 | ]
26 | },
27 | {
28 | "bufferView":2,
29 | "componentType":5126,
30 | "count":36,
31 | "type":"VEC3",
32 | "min":[-1,-1,-1
33 | ],
34 | "max":[1,1,1
35 | ]
36 | }
37 | ],
38 | "buffers":[
39 | {
40 | "uri":"Cube_data.bin",
41 | "byteLength":900,
42 | "name":"main_buffer"
43 | }
44 | ],
45 | "bufferViews":[
46 | {
47 | "buffer":0,
48 | "byteLength":36,
49 | "target":34963
50 | },
51 | {
52 | "buffer":0,
53 | "byteOffset":36,
54 | "byteLength":432,
55 | "target":34962
56 | },
57 | {
58 | "buffer":0,
59 | "byteOffset":468,
60 | "byteLength":432,
61 | "target":34962
62 | }
63 | ],
64 | "nodes":[
65 | {
66 | "name":"box1",
67 | "mesh":0
68 | }
69 | ],
70 | "meshes":[
71 | {
72 | "primitives":[
73 | {
74 | "attributes":{
75 | "NORMAL":2,
76 | "POSITION":1
77 | },
78 | "indices":0
79 | }
80 | ]
81 | }
82 | ],
83 | "scenes":[
84 | {
85 | "nodes":[0
86 | ]
87 | }
88 | ],
89 | "scene":0
90 | }
91 |
--------------------------------------------------------------------------------
/Data/Meshes/Cube_data.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/Data/Meshes/Cube_data.bin
--------------------------------------------------------------------------------
/Data/Meshes/Sphere.gltf:
--------------------------------------------------------------------------------
1 | {
2 | "asset":{
3 | "version":"2.0",
4 | "generator":"Houdini GLTF 2.0 Exporter"
5 | },
6 | "accessors":[
7 | {
8 | "bufferView":0,
9 | "componentType":5123,
10 | "count":6912,
11 | "type":"SCALAR",
12 | "min":[0
13 | ],
14 | "max":[1153
15 | ]
16 | },
17 | {
18 | "bufferView":1,
19 | "componentType":5126,
20 | "count":1154,
21 | "type":"VEC3",
22 | "min":[-0.998026729,-1,-0.998026729
23 | ],
24 | "max":[0.998026729,1,0.998026729
25 | ]
26 | },
27 | {
28 | "bufferView":2,
29 | "componentType":5126,
30 | "count":1154,
31 | "type":"VEC3",
32 | "min":[-0.99803704,-1,-0.99803704
33 | ],
34 | "max":[0.99803704,1,0.99803704
35 | ]
36 | }
37 | ],
38 | "buffers":[
39 | {
40 | "uri":"Sphere_data.bin",
41 | "byteLength":41520,
42 | "name":"main_buffer"
43 | }
44 | ],
45 | "bufferViews":[
46 | {
47 | "buffer":0,
48 | "byteLength":13824,
49 | "target":34963
50 | },
51 | {
52 | "buffer":0,
53 | "byteOffset":13824,
54 | "byteLength":13848,
55 | "target":34962
56 | },
57 | {
58 | "buffer":0,
59 | "byteOffset":27672,
60 | "byteLength":13848,
61 | "target":34962
62 | }
63 | ],
64 | "nodes":[
65 | {
66 | "name":"geo1",
67 | "mesh":0
68 | }
69 | ],
70 | "meshes":[
71 | {
72 | "primitives":[
73 | {
74 | "attributes":{
75 | "NORMAL":2,
76 | "POSITION":1
77 | },
78 | "indices":0
79 | }
80 | ]
81 | }
82 | ],
83 | "scenes":[
84 | {
85 | "nodes":[0
86 | ]
87 | }
88 | ],
89 | "scene":0
90 | }
91 |
--------------------------------------------------------------------------------
/Data/Meshes/Sphere_data.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/Data/Meshes/Sphere_data.bin
--------------------------------------------------------------------------------
/Data/Roboto-Medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/Data/Roboto-Medium.ttf
--------------------------------------------------------------------------------
/Data/Shaders/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/Data/Shaders/.gitkeep
--------------------------------------------------------------------------------
/Data/Textures/Newport_Loft.hdr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/Data/Textures/Newport_Loft.hdr
--------------------------------------------------------------------------------
/ImageBasedPBR.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michal-z/ImageBasedPBR/ae3a9110a508bcc48ca786f22c12c3d5db6ddd61/ImageBasedPBR.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Michal Ziulek
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ImageBasedPBR
2 | Image Based Lighting using DirectX 12.
3 |
4 | 
5 |
--------------------------------------------------------------------------------
/Source/CPUAndGPUCommon.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | #include "DirectXMath/DirectXMath.h"
5 | typedef XMFLOAT4X4 float4x4;
6 | typedef XMFLOAT4X3 float4x3;
7 | typedef XMFLOAT2 float2;
8 | typedef XMFLOAT3 float3;
9 | typedef XMFLOAT4 float4;
10 | #endif
11 |
12 | #ifdef __cplusplus
13 | #define SALIGN alignas(256)
14 | #else
15 | #define SALIGN
16 | #endif
17 |
18 | struct SALIGN FPerDrawConstantData
19 | {
20 | float4x4 ObjectToClip;
21 | float4x3 ObjectToWorld;
22 | float3 Albedo;
23 | float Metallic;
24 | float Roughness;
25 | float AO;
26 | };
27 |
28 | struct SALIGN FPerFrameConstantData
29 | {
30 | float4 LightPositions[4];
31 | float4 LightColors[4];
32 | float4 ViewerPosition;
33 | };
34 |
35 | #ifdef __cplusplus
36 | #undef SALIGN
37 | #endif
38 |
--------------------------------------------------------------------------------
/Source/External/EAAssert/source/eaassert.cpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #include "EAAssert/eaassert.h"
6 |
7 | #ifndef EA_ASSERT_HAVE_OWN_HEADER
8 |
9 | #include
10 |
11 | #if defined(EA_PLATFORM_MICROSOFT)
12 | #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0400)
13 | #undef _WIN32_WINNT
14 | #define _WIN32_WINNT 0x0400
15 | #endif
16 | #ifndef WIN32_LEAN_AND_MEAN
17 | #define WIN32_LEAN_AND_MEAN
18 | #endif
19 | #pragma warning(push,0)
20 | #include // ::IsDebuggerPresent
21 | #pragma warning(pop)
22 | #endif
23 |
24 |
25 |
26 |
27 | #if !defined(EA_ASSERT_VSNPRINTF)
28 | #if defined(EA_PLATFORM_MICROSOFT)
29 | #define EA_ASSERT_VSNPRINTF _vsnprintf
30 | #define EA_ASSERT_SNPRINTF _snprintf
31 | #else
32 | #define EA_ASSERT_VSNPRINTF vsnprintf
33 | #define EA_ASSERT_SNPRINTF snprintf
34 | #endif
35 | #endif
36 |
37 |
38 | namespace EA {
39 | namespace Assert {
40 | namespace Detail {
41 | namespace {
42 |
43 | #if defined(EA_ASSERT_ENABLED)
44 | static void PlatformPrint(const char *str)
45 | {
46 | #if defined(EA_PLATFORM_MICROSOFT)
47 | if (IsDebuggerPresent())
48 | {
49 | ::OutputDebugStringA(str);
50 | }
51 | #endif
52 |
53 | puts(str);
54 |
55 | #if defined(EA_PLATFORM_MOBILE)
56 | fflush(stdout); // Mobile platforms need this because otherwise you can easily lose output if the device crashes.
57 | #endif
58 | }
59 | #endif
60 |
61 | bool DefaultFailureCallback(const char* expr, const char* filename, int line, const char* function, const char* msg, va_list args)
62 | {
63 | #if defined(EA_ASSERT_ENABLED)
64 | const int largeEnough = 2048;
65 | char output[largeEnough + 1] = {};
66 | char fmtMsg[largeEnough + 1] = {};
67 |
68 | int len = EA_ASSERT_VSNPRINTF(fmtMsg, largeEnough, msg, args);
69 |
70 | if(len==0)
71 | {
72 | len = EA_ASSERT_SNPRINTF(fmtMsg, largeEnough, "none");
73 | }
74 |
75 | // different platforms return different values for the error, but in both
76 | // cases it'll be out of bounds, so clamp the return value to largeEnough.
77 | if (len < 0 || len > largeEnough)
78 | len = largeEnough;
79 |
80 | fmtMsg[len] = '\0';
81 |
82 | len = EA_ASSERT_SNPRINTF(output, largeEnough,
83 | "%s(%d) : EA_ASSERT failed: '%s' in function: %s\n, message: %s",
84 | filename, line, expr, function, fmtMsg);
85 | if (len < 0 || len > largeEnough)
86 | len = largeEnough;
87 |
88 | output[len] = '\0';
89 |
90 | PlatformPrint(output);
91 | #else
92 | EA_UNUSED(expr);
93 | EA_UNUSED(filename);
94 | EA_UNUSED(line);
95 | EA_UNUSED(function);
96 | EA_UNUSED(msg);
97 | EA_UNUSED(args);
98 | #endif
99 |
100 | return true;
101 | }
102 |
103 | FailureCallback gFailureCallback = &DefaultFailureCallback;
104 | }}
105 |
106 | void SetFailureCallback(FailureCallback failureCallback)
107 | {
108 | Detail::gFailureCallback = failureCallback;
109 | }
110 |
111 | FailureCallback GetFailureCallback()
112 | {
113 | return Detail::gFailureCallback;
114 | }
115 |
116 | bool Detail::VCall(const char *expr, const char *filename, int line, const char *function, const char *msg, ...)
117 | {
118 | va_list args;
119 | va_start(args, msg);
120 | bool ret = (*GetFailureCallback())(expr, filename, line, function, msg, args);
121 | va_end(args);
122 | return ret;
123 | }
124 |
125 | bool Detail::Call(const char *expr, const char *filename, int line, const char *function)
126 | {
127 | // Pass an empty string as msg parameter. Some FailureCallback implementation (Frostbite)
128 | // will display only msg and discard the rest of the data when msg is non empty.
129 | return VCall(expr, filename, line, function, "");
130 | }
131 |
132 | bool Detail::Call(const char *expr, const char *filename, int line, const char *function, const char* msg)
133 | {
134 | return VCall(expr, filename, line, function, "%s", msg);
135 |
136 | }
137 |
138 | }}
139 |
140 | #endif
141 |
--------------------------------------------------------------------------------
/Source/External/EAAssert/version.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | /**
6 | \file
7 | Define the major, minor and patch versions.
8 | */
9 |
10 | #ifndef EAASSERT_VERSION_H
11 | #define EAASSERT_VERSION_H
12 |
13 | // Define the major, minor and patch versions.
14 | // This information is updated with each release.
15 |
16 | //! This define indicates the major version number for the filesys package.
17 | //! \sa EAASSERT_VERSION_MAJOR
18 | #define EAASSERT_VERSION_MAJOR 1
19 | //! This define indicates the minor version number for the filesys package.
20 | //! \sa EAASSERT_VERSION_MINOR
21 | #define EAASSERT_VERSION_MINOR 5
22 | //! This define indicates the patch version number for the filesys package.
23 | //! \sa EAASSERT_VERSION_PATCH
24 | #define EAASSERT_VERSION_PATCH 8
25 |
26 | /*!
27 | * This is a utility macro that users may use to create a single version number
28 | * that can be compared against EAASSERT_VERSION.
29 | *
30 | * For example:
31 | *
32 | * \code
33 | *
34 | * #if EAASSERT_VERSION > EAASSERT_CREATE_VERSION_NUMBER( 1, 1, 0 )
35 | * printf("Filesys version is greater than 1.1.0.\n");
36 | * #endif
37 | *
38 | * \endcode
39 | */
40 | #define EAASSERT_CREATE_VERSION_NUMBER( major_ver, minor_ver, patch_ver ) \
41 | ((major_ver) * 1000000 + (minor_ver) * 1000 + (patch_ver))
42 |
43 | /*!
44 | * This macro is an aggregate of the major, minor and patch version numbers.
45 | * \sa EAASSERT_CREATE_VERSION_NUMBER
46 | */
47 | #define EAASSERT_VERSION \
48 | EAASSERT_CREATE_VERSION_NUMBER( EAASSERT_VERSION_MAJOR, EAASSERT_VERSION_MINOR, EAASSERT_VERSION_PATCH )
49 |
50 | #define EAASSERT_VERSION_MAJOR_STR EAASSERT_VERSION_STRINGIFY(EAASSERT_VERSION_MAJOR)
51 | #if EAASSERT_VERSION_MINOR >= 10
52 | #define EAASSERT_VERSION_MINOR_STR EAASSERT_VERSION_STRINGIFY(EAASSERT_VERSION_MINOR)
53 | #else
54 | #define EAASSERT_VERSION_MINOR_STR "0" EAASSERT_VERSION_STRINGIFY(EAASSERT_VERSION_MINOR)
55 | #endif
56 |
57 | #if EAASSERT_VERSION_PATCH >= 10
58 | #define EAASSERT_VERSION_PATCH_STR EAASSERT_VERSION_STRINGIFY(EAASSERT_VERSION_PATCH)
59 | #else
60 | #define EAASSERT_VERSION_PATCH_STR "0" EAASSERT_VERSION_STRINGIFY(EAASSERT_VERSION_PATCH)
61 | #endif
62 |
63 | /*!
64 | * This macro returns a string version of the macro
65 | * \sa EAASSERT_VERSION_STRING
66 | */
67 | #define EAASSERT_VERSION_STRING EAASSERT_VERSION_MAJOR_STR "." EAASSERT_VERSION_MINOR_STR "." EAASSERT_VERSION_PATCH_STR
68 |
69 | #endif // EAASSERT_VERSION_H
70 |
--------------------------------------------------------------------------------
/Source/External/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
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 |
--------------------------------------------------------------------------------
/Source/External/EABase/eastdarg.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------------
2 | * eastdarg.h
3 | *
4 | * Copyright (c) Electronic Arts Inc. All rights reserved.
5 | *---------------------------------------------------------------------------*/
6 |
7 |
8 | #ifndef INCLUDED_eastdarg_H
9 | #define INCLUDED_eastdarg_H
10 |
11 |
12 | #include
13 | #include
14 |
15 |
16 | // VA_ARG_COUNT
17 | //
18 | // Returns the number of arguments passed to a macro's ... argument.
19 | // This applies to macros only and not functions.
20 | //
21 | // Example usage:
22 | // assert(VA_ARG_COUNT() == 0);
23 | // assert(VA_ARG_COUNT(a) == 1);
24 | // assert(VA_ARG_COUNT(a, b) == 2);
25 | // assert(VA_ARG_COUNT(a, b, c) == 3);
26 | //
27 | #if !defined(VA_ARG_COUNT)
28 | #define VA_ARG_COUNT(...) VA_ARG_COUNT_II((VA_ARG_COUNT_PREFIX_ ## __VA_ARGS__ ## _VA_ARG_COUNT_POSTFIX,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0))
29 | #define VA_ARG_COUNT_II(__args) VA_ARG_COUNT_I __args
30 | #define VA_ARG_COUNT_PREFIX__VA_ARG_COUNT_POSTFIX ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0
31 | #define VA_ARG_COUNT_I(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,_21,_22,_23,_24,_25,_26,_27,_28,_29,_30,_31,N,...) N
32 | #endif
33 |
34 |
35 | // va_copy
36 | //
37 | // va_copy is required by C++11
38 | // C++11 and C99 require va_copy to be #defined and implemented.
39 | // http://en.cppreference.com/w/cpp/utility/variadic/va_copy
40 | //
41 | // Example usage:
42 | // void Func(char* p, ...){
43 | // va_list args, argsCopy;
44 | // va_start(args, p);
45 | // va_copy(argsCopy, args);
46 | // (use args)
47 | // (use argsCopy, which acts the same as args)
48 | // va_end(args);
49 | // va_end(argsCopy);
50 | // }
51 | //
52 | #ifndef va_copy
53 | #if defined(__va_copy) // GCC and others define this for non-C99 compatibility.
54 | #define va_copy(dest, src) __va_copy((dest), (src))
55 | #else
56 | // This may not work for some platforms, depending on their ABI.
57 | // It works for Microsoft x86,x64, and PowerPC-based platforms.
58 | #define va_copy(dest, src) memcpy(&(dest), &(src), sizeof(va_list))
59 | #endif
60 | #endif
61 |
62 |
63 |
64 | // va_list_reference
65 | //
66 | // va_list_reference is not part of the C or C++ standards.
67 | // It allows you to pass a va_list by reference to another
68 | // function instead of by value. You cannot simply use va_list&
69 | // as that won't work with many va_list implementations because
70 | // they are implemented as arrays (which can't be passed by
71 | // reference to a function without decaying to a pointer).
72 | //
73 | // Example usage:
74 | // void Test(va_list_reference args){
75 | // printf("%d", va_arg(args, int));
76 | // }
77 | // void Func(char* p, ...){
78 | // va_list args;
79 | // va_start(args, p);
80 | // Test(args); // Upon return args will be modified.
81 | // va_end(args);
82 | // }
83 | #ifndef va_list_reference
84 | #if defined(EA_PLATFORM_MICROSOFT) || (EA_PLATFORM_PTR_SIZE == 4) || (defined(EA_PLATFORM_APPLE) && defined(EA_PROCESSOR_ARM64)) || defined(CS_UNDEFINED_STRING) || (defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM64))
85 | // This is required for platform ABIs in which va_list is a struct or pointer.
86 | #define va_list_reference va_list&
87 | #else
88 | // This is required for platform ABIs in which va_list is defined to be an array.
89 | #define va_list_reference va_list
90 | #endif
91 | #endif
92 |
93 |
94 |
95 |
96 | #endif /* Header include guard */
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/Source/External/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
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 |
--------------------------------------------------------------------------------
/Source/External/EABase/nullptr.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------------
2 | * nullptr.h
3 | *
4 | * Copyright (c) Electronic Arts Inc. All rights reserved.
5 | *---------------------------------------------------------------------------*/
6 |
7 |
8 | #include
9 | #include
10 |
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 |
17 | #if defined(EA_COMPILER_CPP11_ENABLED) && !defined(EA_COMPILER_NO_NULLPTR) && !defined(EA_HAVE_nullptr_t_IMPL)
18 | // The compiler supports nullptr, but the standard library doesn't implement a declaration for std::nullptr_t. So we provide one.
19 | namespace std { typedef decltype(nullptr) nullptr_t; }
20 | #endif
21 |
22 |
23 |
24 | #if defined(EA_COMPILER_NO_NULLPTR) // If the compiler lacks a native version...
25 |
26 | namespace std
27 | {
28 | class nullptr_t
29 | {
30 | public:
31 | template // When tested a pointer, acts as 0.
32 | operator T*() const
33 | { return 0; }
34 |
35 | template // When tested as a member pointer, acts as 0.
36 | operator T C::*() const
37 | { return 0; }
38 |
39 | typedef void* (nullptr_t::*bool_)() const;
40 | operator bool_() const // An rvalue of type std::nullptr_t can be converted to an rvalue of type bool; the resulting value is false.
41 | { return false; } // We can't use operator bool(){ return false; } because bool is convertable to int which breaks other required functionality.
42 |
43 | // We can't enable this without generating warnings about nullptr being uninitialized after being used when created without "= {}".
44 | //void* mSizeofVoidPtr; // sizeof(nullptr_t) == sizeof(void*). Needs to be public if nullptr_t is to be a POD.
45 |
46 | private:
47 | void operator&() const; // Address cannot be taken.
48 | };
49 |
50 | inline nullptr_t nullptr_get()
51 | {
52 | nullptr_t n = { }; // std::nullptr exists.
53 | return n;
54 | }
55 |
56 | #if !defined(nullptr) // If somebody hasn't already defined nullptr in a custom way...
57 | #define nullptr nullptr_get()
58 | #endif
59 |
60 | } // namespace std
61 |
62 |
63 | template
64 | inline bool operator==(T* p, const std::nullptr_t)
65 | { return p == 0; }
66 |
67 | template
68 | inline bool operator==(const std::nullptr_t, T* p)
69 | { return p == 0; }
70 |
71 | template
72 | inline bool operator==(T U::* p, const std::nullptr_t)
73 | { return p == 0; }
74 |
75 | template
76 | inline bool operator==(const std::nullptr_t, T U::* p)
77 | { return p == 0; }
78 |
79 | inline bool operator==(const std::nullptr_t, const std::nullptr_t)
80 | { return true; }
81 |
82 | inline bool operator!=(const std::nullptr_t, const std::nullptr_t)
83 | { return false; }
84 |
85 | inline bool operator<(const std::nullptr_t, const std::nullptr_t)
86 | { return false; }
87 |
88 | inline bool operator>(const std::nullptr_t, const std::nullptr_t)
89 | { return false; }
90 |
91 | inline bool operator<=(const std::nullptr_t, const std::nullptr_t)
92 | { return true; }
93 |
94 | inline bool operator>=(const std::nullptr_t, const std::nullptr_t)
95 | { return true; }
96 |
97 |
98 | using std::nullptr_t; // exported to global namespace.
99 | using std::nullptr_get; // exported to global namespace.
100 |
101 | #endif // EA_COMPILER_NO_NULLPTR
102 |
103 |
--------------------------------------------------------------------------------
/Source/External/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.05"
33 | #define EABASE_VERSION_N 20905
34 | #endif
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/Source/External/EASTL/allocator_malloc.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #ifndef EASTL_ALLOCATOR_MALLOC_H
7 | #define EASTL_ALLOCATOR_MALLOC_H
8 |
9 |
10 | #include
11 | #include
12 | #include
13 |
14 |
15 | // EASTL_ALIGNED_MALLOC_AVAILABLE
16 | //
17 | // Identifies if the standard library provides a built-in aligned version of malloc.
18 | // Defined as 0 or 1, depending on the standard library or platform availability.
19 | // None of the viable C functions provides for an aligned malloc with offset, so we
20 | // don't consider that supported in any case.
21 | //
22 | // Options for aligned allocations:
23 | // C11 aligned_alloc http://linux.die.net/man/3/aligned_alloc
24 | // glibc memalign http://linux.die.net/man/3/posix_memalign
25 | // Posix posix_memalign http://pubs.opengroup.org/onlinepubs/000095399/functions/posix_memalign.html
26 | // VC++ _aligned_malloc http://msdn.microsoft.com/en-us/library/8z34s9c6%28VS.80%29.aspx This is not suitable, since it has a limitation that you need to free via _aligned_free.
27 | //
28 | #if !defined EASTL_ALIGNED_MALLOC_AVAILABLE
29 | #if defined(EA_PLATFORM_POSIX) && !defined(EA_PLATFORM_APPLE)
30 | // memalign is more consistently available than posix_memalign, though its location isn't consistent across
31 | // platforms and compiler libraries. Typically it's declared in one of three headers: stdlib.h, malloc.h, or malloc/malloc.h
32 | #include // memalign, posix_memalign.
33 | #define EASTL_ALIGNED_MALLOC_AVAILABLE 1
34 |
35 | #if defined(__clang__)
36 | #if __has_include()
37 | #include
38 | #elif __has_include()
39 | #include
40 | #endif
41 | #elif defined(EA_PLATFORM_BSD)
42 | #include
43 | #else
44 | #include
45 | #endif
46 | #else
47 | #define EASTL_ALIGNED_MALLOC_AVAILABLE 0
48 | #endif
49 | #endif
50 |
51 |
52 | namespace eastl
53 | {
54 |
55 | ///////////////////////////////////////////////////////////////////////////////
56 | // allocator_malloc
57 | //
58 | // Implements an EASTL allocator that uses malloc/free as opposed to
59 | // new/delete or PPMalloc Malloc/Free.
60 | //
61 | // Example usage:
62 | // vector intVector;
63 | //
64 | class allocator_malloc
65 | {
66 | public:
67 | allocator_malloc(const char* = NULL)
68 | { }
69 |
70 | allocator_malloc(const allocator_malloc&)
71 | { }
72 |
73 | allocator_malloc(const allocator_malloc&, const char*)
74 | { }
75 |
76 | allocator_malloc& operator=(const allocator_malloc&)
77 | { return *this; }
78 |
79 | bool operator==(const allocator_malloc&)
80 | { return true; }
81 |
82 | bool operator!=(const allocator_malloc&)
83 | { return false; }
84 |
85 | void* allocate(size_t n, int /*flags*/ = 0)
86 | { return malloc(n); }
87 |
88 | void* allocate(size_t n, size_t alignment, size_t alignmentOffset, int /*flags*/ = 0)
89 | {
90 | #if EASTL_ALIGNED_MALLOC_AVAILABLE
91 | if((alignmentOffset % alignment) == 0) // We check for (offset % alignmnent == 0) instead of (offset == 0) because any block which is aligned on e.g. 64 also is aligned at an offset of 64 by definition.
92 | return memalign(alignment, n); // memalign is more consistently available than posix_memalign.
93 | #else
94 | if((alignment <= EASTL_SYSTEM_ALLOCATOR_MIN_ALIGNMENT) && ((alignmentOffset % alignment) == 0))
95 | return malloc(n);
96 | #endif
97 | return NULL;
98 | }
99 |
100 | void deallocate(void* p, size_t /*n*/)
101 | { free(p); }
102 |
103 | const char* get_name() const
104 | { return "allocator_malloc"; }
105 |
106 | void set_name(const char*)
107 | { }
108 | };
109 |
110 |
111 | } // namespace eastl
112 |
113 |
114 |
115 | #endif // Header include guard
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/Source/External/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
14 | #include
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 |
--------------------------------------------------------------------------------
/Source/External/EASTL/bonus/call_traits.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | ///////////////////////////////////////////////////////////////////////////////
6 | // The design for call_traits here is very similar to that found in template
7 | // metaprogramming libraries such as Boost, GCC, and Metrowerks, given that
8 | // these libraries have established this interface as a defacto standard for
9 | // solving this problem. Also, these are described in various books on the
10 | // topic of template metaprogramming, such as "Modern C++ Design".
11 | //
12 | // See http://www.boost.org/libs/utility/call_traits.htm or search for
13 | // call_traits in Google for a description of call_traits.
14 | ///////////////////////////////////////////////////////////////////////////////
15 |
16 |
17 | #ifndef EASTL_CALL_TRAITS_H
18 | #define EASTL_CALL_TRAITS_H
19 |
20 |
21 | #include
22 | #include
23 |
24 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
25 | #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.
26 | #endif
27 |
28 |
29 |
30 | namespace eastl
31 | {
32 |
33 |
34 | template
35 | struct ct_imp2 { typedef const T& param_type; };
36 |
37 | template
38 | struct ct_imp2 { typedef const T param_type; };
39 |
40 | template
41 | struct ct_imp { typedef const T& param_type; };
42 |
43 | template
44 | struct ct_imp { typedef typename ct_imp2::param_type param_type; };
45 |
46 | template
47 | struct ct_imp { typedef T const param_type; };
48 |
49 |
50 |
51 | template
52 | struct call_traits
53 | {
54 | public:
55 | typedef T value_type;
56 | typedef T& reference;
57 | typedef const T& const_reference;
58 | typedef typename ct_imp::value, is_arithmetic::value>::param_type param_type;
59 | };
60 |
61 |
62 | template
63 | struct call_traits
64 | {
65 | typedef T& value_type;
66 | typedef T& reference;
67 | typedef const T& const_reference;
68 | typedef T& param_type;
69 | };
70 |
71 |
72 | template
73 | struct call_traits
74 | {
75 | private:
76 | typedef T array_type[N];
77 |
78 | public:
79 | typedef const T* value_type;
80 | typedef array_type& reference;
81 | typedef const array_type& const_reference;
82 | typedef const T* const param_type;
83 | };
84 |
85 |
86 | template
87 | struct call_traits
88 | {
89 | private:
90 | typedef const T array_type[N];
91 |
92 | public:
93 | typedef const T* value_type;
94 | typedef array_type& reference;
95 | typedef const array_type& const_reference;
96 | typedef const T* const param_type;
97 | };
98 |
99 |
100 | } // namespace eastl
101 |
102 |
103 | #endif // Header include guard
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/Source/External/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
9 | #include
10 | #include
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 |
--------------------------------------------------------------------------------
/Source/External/EASTL/core_allocator.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_CORE_ALLOCATOR_H
6 | #define EASTL_CORE_ALLOCATOR_H
7 |
8 | #if EASTL_CORE_ALLOCATOR_ENABLED
9 |
10 | #include
11 |
12 | namespace EA
13 | {
14 | namespace Allocator
15 | {
16 | /// EASTLCoreAllocatorImpl
17 | ///
18 | /// EASTL provides an out of the box implementation of the
19 | /// ICoreAllocator interface. This is provided as a convenience for
20 | /// users who wish to provide ICoreAllocator implementations for EASTL to use.
21 | ///
22 | /// EASTL has a dependency on coreallocator so to provide an out of
23 | /// the box implementation for EASTLCoreAlloctor and EASTLCoreDeleter
24 | /// that can be used and tested. Historically we could not test
25 | /// ICoreAllocator interface because we relied on the code being linked
26 | /// in user code.
27 | ///
28 |
29 | class EASTLCoreAllocatorImpl : public ICoreAllocator
30 | {
31 | public:
32 | virtual void* Alloc(size_t size, const char* name, unsigned int flags)
33 | {
34 | return ::operator new[](size, name, flags, 0, __FILE__, __LINE__);
35 | }
36 |
37 | virtual void* Alloc(size_t size, const char* name, unsigned int flags, unsigned int alignment, unsigned int alignOffset = 0)
38 | {
39 | return ::operator new[](size, alignment, alignOffset, name, flags, 0, __FILE__, __LINE__);
40 | }
41 |
42 | virtual void Free(void* ptr, size_t size = 0)
43 | {
44 | ::operator delete(static_cast(ptr));
45 | }
46 |
47 | virtual void* AllocDebug(size_t size, const DebugParams debugParams, unsigned int flags)
48 | {
49 | return Alloc(size, debugParams.mName, flags);
50 | }
51 |
52 | virtual void* AllocDebug(size_t size, const DebugParams debugParams, unsigned int flags, unsigned int align, unsigned int alignOffset = 0)
53 | {
54 | return Alloc(size, debugParams.mName, flags, align, alignOffset);
55 | }
56 |
57 | static EASTLCoreAllocatorImpl* GetDefaultAllocator();
58 | };
59 |
60 | inline EASTLCoreAllocatorImpl* EASTLCoreAllocatorImpl::GetDefaultAllocator()
61 | {
62 | static EASTLCoreAllocatorImpl allocator;
63 | return &allocator;
64 | }
65 | }
66 | }
67 |
68 | #endif // EASTL_CORE_ALLOCATOR_ENABLED
69 | #endif // EASTL_CORE_ALLOCATOR_H
70 |
71 |
--------------------------------------------------------------------------------
/Source/External/EASTL/fixed_function.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_FIXED_FUNCTION_H
6 | #define EASTL_FIXED_FUNCTION_H
7 |
8 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
9 | #pragma once
10 | #endif
11 |
12 | #include
13 |
14 | namespace eastl
15 | {
16 | #define EASTL_INTERNAL_FIXED_FUNCTION_STATIC_ASSERT(TYPE) \
17 | static_assert(sizeof(TYPE) <= sizeof(typename Base::FunctorStorageType), \
18 | "fixed_function local buffer is not large enough to hold the callable object.")
19 |
20 | #define EASTL_INTERNAL_FIXED_FUNCTION_NEW_SIZE_STATIC_ASSERT(NEW_SIZE_IN_BYTES) \
21 | static_assert(SIZE_IN_BYTES >= NEW_SIZE_IN_BYTES, \
22 | "fixed_function local buffer is not large enough to hold the new fixed_function type.")
23 |
24 | template
25 | class fixed_function;
26 |
27 | template
28 | class fixed_function : public internal::function_detail
29 | {
30 | using Base = internal::function_detail;
31 |
32 | public:
33 | using typename Base::result_type;
34 |
35 | fixed_function() EA_NOEXCEPT = default;
36 | fixed_function(std::nullptr_t p) EA_NOEXCEPT
37 | : Base(p)
38 | {
39 | }
40 |
41 | fixed_function(const fixed_function& other)
42 | : Base(other)
43 | {
44 | }
45 |
46 | fixed_function(fixed_function&& other)
47 | : Base(eastl::move(other))
48 | {
49 | }
50 |
51 | template
52 | fixed_function(Functor functor)
53 | : Base(eastl::move(functor))
54 | {
55 | EASTL_INTERNAL_FIXED_FUNCTION_STATIC_ASSERT(Functor);
56 | }
57 |
58 | template
59 | fixed_function(const fixed_function& other)
60 | : Base(other)
61 | {
62 | EASTL_INTERNAL_FIXED_FUNCTION_NEW_SIZE_STATIC_ASSERT(NEW_SIZE_IN_BYTES);
63 | }
64 |
65 | template
66 | fixed_function(fixed_function&& other)
67 | : Base(eastl::move(other))
68 | {
69 | EASTL_INTERNAL_FIXED_FUNCTION_NEW_SIZE_STATIC_ASSERT(NEW_SIZE_IN_BYTES);
70 | }
71 |
72 | ~fixed_function() EA_NOEXCEPT = default;
73 |
74 | fixed_function& operator=(const fixed_function& other)
75 | {
76 | Base::operator=(other);
77 | return *this;
78 | }
79 |
80 | fixed_function& operator=(fixed_function&& other)
81 | {
82 | Base::operator=(eastl::move(other));
83 | return *this;
84 | }
85 |
86 | fixed_function& operator=(std::nullptr_t p) EA_NOEXCEPT
87 | {
88 | Base::operator=(p);
89 | return *this;
90 | }
91 |
92 | template
93 | fixed_function& operator=(const fixed_function& other)
94 | {
95 | EASTL_INTERNAL_FIXED_FUNCTION_NEW_SIZE_STATIC_ASSERT(NEW_SIZE_IN_BYTES);
96 |
97 | Base::operator=(other);
98 | return *this;
99 | }
100 |
101 | template
102 | fixed_function& operator=(fixed_function&& other)
103 | {
104 | EASTL_INTERNAL_FIXED_FUNCTION_NEW_SIZE_STATIC_ASSERT(NEW_SIZE_IN_BYTES);
105 |
106 | Base::operator=(eastl::move(other));
107 | return *this;
108 | }
109 |
110 | template
111 | fixed_function& operator=(Functor&& functor)
112 | {
113 | EASTL_INTERNAL_FIXED_FUNCTION_STATIC_ASSERT(eastl::decay_t);
114 | Base::operator=(eastl::forward(functor));
115 | return *this;
116 | }
117 |
118 | template
119 | fixed_function& operator=(eastl::reference_wrapper f) EA_NOEXCEPT
120 | {
121 | EASTL_INTERNAL_FIXED_FUNCTION_STATIC_ASSERT(eastl::reference_wrapper);
122 | Base::operator=(f);
123 | return *this;
124 | }
125 |
126 | void swap(fixed_function& other) EA_NOEXCEPT
127 | {
128 | Base::swap(other);
129 | }
130 |
131 | explicit operator bool() const EA_NOEXCEPT
132 | {
133 | return Base::operator bool();
134 | }
135 |
136 | R operator ()(Args... args) const
137 | {
138 | return Base::operator ()(eastl::forward(args)...);
139 | }
140 |
141 | #if EASTL_RTTI_ENABLED
142 | const std::type_info& target_type() const EA_NOEXCEPT
143 | {
144 | return Base::target_type();
145 | }
146 |
147 | template
148 | Functor* target() EA_NOEXCEPT
149 | {
150 | return Base::target();
151 | }
152 |
153 | template
154 | const Functor* target() const EA_NOEXCEPT
155 | {
156 | return Base::target();
157 | }
158 | #endif
159 | };
160 |
161 | template
162 | bool operator==(const fixed_function& f, std::nullptr_t) EA_NOEXCEPT
163 | {
164 | return !f;
165 | }
166 |
167 | template
168 | bool operator==(std::nullptr_t, const fixed_function& f) EA_NOEXCEPT
169 | {
170 | return !f;
171 | }
172 |
173 | template
174 | bool operator!=(const fixed_function& f, std::nullptr_t) EA_NOEXCEPT
175 | {
176 | return !!f;
177 | }
178 |
179 | template
180 | bool operator!=(std::nullptr_t, const fixed_function& f) EA_NOEXCEPT
181 | {
182 | return !!f;
183 | }
184 |
185 | template
186 | void swap(fixed_function& lhs, fixed_function& rhs)
187 | {
188 | lhs.swap(rhs);
189 | }
190 |
191 | } // namespace eastl
192 |
193 | #endif // EASTL_FIXED_FUNCTION_H
194 |
--------------------------------------------------------------------------------
/Source/External/EASTL/initializer_list.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | //
4 | // This file #includes if it's available, else it defines
5 | // its own version of std::initializer_list. It does not define eastl::initializer_list
6 | // because that would not provide any use, due to how the C++11 Standard works.
7 | ///////////////////////////////////////////////////////////////////////////////
8 |
9 |
10 | #ifndef EASTL_INITIALIZER_LIST_H
11 | #define EASTL_INITIALIZER_LIST_H
12 |
13 |
14 | #include
15 | #include
16 |
17 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
18 | #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.
19 | #endif
20 |
21 |
22 | #if defined(EA_HAVE_CPP11_INITIALIZER_LIST) // If the compiler can generate calls to std::initializer_list...
23 |
24 | // The initializer_list type must be declared in the std namespace, as that's the
25 | // namespace the compiler uses when generating code to use it.
26 | EA_DISABLE_ALL_VC_WARNINGS()
27 | #include
28 | EA_RESTORE_ALL_VC_WARNINGS()
29 |
30 | #else
31 |
32 | // If you get an error here about initializer_list being already defined, then the EA_HAVE_CPP11_INITIALIZER_LIST define from needs to be updated.
33 | namespace std
34 | {
35 | // See the C++11 Standard, section 18.9.
36 | template
37 | class initializer_list
38 | {
39 | public:
40 | typedef E value_type;
41 | typedef const E& reference;
42 | typedef const E& const_reference;
43 | typedef size_t size_type;
44 | typedef const E* iterator; // Must be const, as initializer_list (and its mpArray) is an immutable temp object.
45 | typedef const E* const_iterator;
46 |
47 | private:
48 | iterator mpArray;
49 | size_type mArraySize;
50 |
51 | // This constructor is private, but the C++ compiler has the ability to call it, as per the C++11 Standard.
52 | initializer_list(const_iterator pArray, size_type arraySize)
53 | : mpArray(pArray), mArraySize(arraySize) { }
54 |
55 | public:
56 | initializer_list() EA_NOEXCEPT // EA_NOEXCEPT requires a recent version of EABase.
57 | : mpArray(NULL), mArraySize(0) { }
58 |
59 | size_type size() const EA_NOEXCEPT { return mArraySize; }
60 | const_iterator begin() const EA_NOEXCEPT { return mpArray; } // Must be const_iterator, as initializer_list (and its mpArray) is an immutable temp object.
61 | const_iterator end() const EA_NOEXCEPT { return mpArray + mArraySize; }
62 | };
63 |
64 |
65 | template
66 | const T* begin(std::initializer_list ilist) EA_NOEXCEPT
67 | {
68 | return ilist.begin();
69 | }
70 |
71 | template
72 | const T* end(std::initializer_list ilist) EA_NOEXCEPT
73 | {
74 | return ilist.end();
75 | }
76 | }
77 |
78 | #endif
79 |
80 |
81 | #endif // Header include guard
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Source/External/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
11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
12 | #pragma once
13 | #endif
14 |
15 | #include
16 | #include
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 |
--------------------------------------------------------------------------------
/Source/External/EASTL/internal/enable_shared.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #ifndef EASTL_INTERNAL_ENABLE_SHARED_H
7 | #define EASTL_INTERNAL_ENABLE_SHARED_H
8 |
9 |
10 | #include
11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
12 | #pragma once
13 | #endif
14 |
15 | namespace eastl
16 | {
17 |
18 | /// enable_shared_from_this
19 | ///
20 | /// This is a helper mixin class that allows you to make any class
21 | /// export a shared_ptr instance that is associated with the class
22 | /// instance. Any class that inherits from this class gets two functions:
23 | /// shared_ptr shared_from_this();
24 | /// shared_ptr shared_from_this() const;
25 | /// If you call shared_from_this, you get back a shared_ptr that
26 | /// refers to the class. A second call to shared_from_this returns
27 | /// another shared_ptr that is shared with the first one.
28 | ///
29 | /// The trick that happens which is not so obvious here (and which is
30 | /// not mentioned at all in the Boost documentation of their version
31 | /// of this) is that the shared_ptr constructor detects that the
32 | /// class has an enable_shared_from_this mixin and sets up this system
33 | /// automatically for the user. This is done with template tricks.
34 | ///
35 | /// For some additional explanation, see the Boost documentation for
36 | /// their description of their version of enable_shared_from_this.
37 | ///
38 | template
39 | class enable_shared_from_this
40 | {
41 | public:
42 | shared_ptr shared_from_this()
43 | { return shared_ptr(mWeakPtr); }
44 |
45 | shared_ptr shared_from_this() const
46 | { return shared_ptr(mWeakPtr); }
47 |
48 | public: // This is public because the alternative fails on some compilers that we need to support.
49 | mutable weak_ptr mWeakPtr;
50 |
51 | protected:
52 | template friend class shared_ptr;
53 |
54 | EA_CONSTEXPR enable_shared_from_this() EA_NOEXCEPT
55 | { }
56 |
57 | enable_shared_from_this(const enable_shared_from_this&) EA_NOEXCEPT
58 | { }
59 |
60 | enable_shared_from_this& operator=(const enable_shared_from_this&) EA_NOEXCEPT
61 | { return *this; }
62 |
63 | ~enable_shared_from_this()
64 | { }
65 |
66 | }; // enable_shared_from_this
67 |
68 | } // namespace eastl
69 |
70 |
71 | #endif // Header include guard
72 |
73 |
74 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/Source/External/EASTL/internal/function.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_FUNCTION_H
6 | #define EASTL_FUNCTION_H
7 |
8 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
9 | #pragma once
10 | #endif
11 |
12 | #include
13 |
14 | namespace eastl
15 | {
16 |
17 | /// EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE
18 | ///
19 | /// Defines the size of the SSO buffer which is used to hold the specified capture state of the callable.
20 | ///
21 | #ifndef EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE
22 | #define EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE (2 * sizeof(void*))
23 | #endif
24 |
25 | static_assert(EASTL_FUNCTION_DEFAULT_CAPTURE_SSO_SIZE >= sizeof(void*), "functor storage must be able to hold at least a pointer!");
26 |
27 | template
28 | class function;
29 |
30 | template
31 | class function : public internal::function_detail
32 | {
33 | private:
34 | using Base = internal::function_detail;
35 | public:
36 | using typename Base::result_type;
37 |
38 | function() EA_NOEXCEPT = default;
39 | function(std::nullptr_t p) EA_NOEXCEPT
40 | : Base(p)
41 | {
42 | }
43 |
44 | function(const function& other)
45 | : Base(other)
46 | {
47 | }
48 |
49 | function(function&& other)
50 | : Base(eastl::move(other))
51 | {
52 | }
53 |
54 | template
55 | function(Functor functor)
56 | : Base(eastl::move(functor))
57 | {
58 | }
59 |
60 | ~function() EA_NOEXCEPT = default;
61 |
62 | function& operator=(const function& other)
63 | {
64 | Base::operator=(other);
65 | return *this;
66 | }
67 |
68 | function& operator=(function&& other)
69 | {
70 | Base::operator=(eastl::move(other));
71 | return *this;
72 | }
73 |
74 | function& operator=(std::nullptr_t p) EA_NOEXCEPT
75 | {
76 | Base::operator=(p);
77 | return *this;
78 | }
79 |
80 | template
81 | function& operator=(Functor&& functor)
82 | {
83 | Base::operator=(eastl::forward(functor));
84 | return *this;
85 | }
86 |
87 | template
88 | function& operator=(eastl::reference_wrapper f) EA_NOEXCEPT
89 | {
90 | Base::operator=(f);
91 | return *this;
92 | }
93 |
94 | void swap(function& other) EA_NOEXCEPT
95 | {
96 | Base::swap(other);
97 | }
98 |
99 | explicit operator bool() const EA_NOEXCEPT
100 | {
101 | return Base::operator bool();
102 | }
103 |
104 | R operator ()(Args... args) const
105 | {
106 | return Base::operator ()(eastl::forward(args)...);
107 | }
108 |
109 | #if EASTL_RTTI_ENABLED
110 | const std::type_info& target_type() const EA_NOEXCEPT
111 | {
112 | return Base::target_type();
113 | }
114 |
115 | template
116 | Functor* target() EA_NOEXCEPT
117 | {
118 | return Base::target();
119 | }
120 |
121 | template
122 | const Functor* target() const EA_NOEXCEPT
123 | {
124 | return Base::target();
125 | }
126 | #endif // EASTL_RTTI_ENABLED
127 | };
128 |
129 | template
130 | bool operator==(const function& f, std::nullptr_t) EA_NOEXCEPT
131 | {
132 | return !f;
133 | }
134 |
135 | template
136 | bool operator==(std::nullptr_t, const function& f) EA_NOEXCEPT
137 | {
138 | return !f;
139 | }
140 |
141 | template
142 | bool operator!=(const function& f, std::nullptr_t) EA_NOEXCEPT
143 | {
144 | return !!f;
145 | }
146 |
147 | template
148 | bool operator!=(std::nullptr_t, const function& f) EA_NOEXCEPT
149 | {
150 | return !!f;
151 | }
152 |
153 | template
154 | void swap(function& lhs, function& rhs)
155 | {
156 | lhs.swap(rhs);
157 | }
158 |
159 | } // namespace eastl
160 |
161 | #endif // EASTL_FUNCTION_H
162 |
--------------------------------------------------------------------------------
/Source/External/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
13 | #include
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 |
--------------------------------------------------------------------------------
/Source/External/EASTL/internal/in_place_t.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #ifndef EASTL_INTERNAL_IN_PLACE_T_H
7 | #define EASTL_INTERNAL_IN_PLACE_T_H
8 |
9 |
10 | #include
11 | #if defined(EA_PRAGMA_ONCE_SUPPORTED)
12 | #pragma once
13 | #endif
14 |
15 | namespace eastl
16 | {
17 | namespace Internal
18 | {
19 | struct in_place_tag {};
20 | template struct in_place_type_tag {};
21 | template struct in_place_index_tag {};
22 | }
23 |
24 | ///////////////////////////////////////////////////////////////////////////////
25 | /// in_place_tag
26 | ///
27 | /// http://en.cppreference.com/w/cpp/utility/in_place_tag
28 | ///
29 | struct in_place_tag
30 | {
31 | in_place_tag() = delete;
32 |
33 | private:
34 | explicit in_place_tag(Internal::in_place_tag) {}
35 | friend inline in_place_tag Internal_ConstructInPlaceTag();
36 | };
37 |
38 | // internal factory function for in_place_tag
39 | inline in_place_tag Internal_ConstructInPlaceTag() { return in_place_tag(Internal::in_place_tag{}); }
40 |
41 |
42 | ///////////////////////////////////////////////////////////////////////////////
43 | /// in_place_t / in_place_type_t / in_place_index_t
44 | ///
45 | /// used to disambiguate overloads that take arguments (possibly a parameter
46 | /// pack) for in-place construction of some value.
47 | ///
48 | /// http://en.cppreference.com/w/cpp/utility/optional/in_place_t
49 | ///
50 | using in_place_t = in_place_tag(&)(Internal::in_place_tag);
51 |
52 | template
53 | using in_place_type_t = in_place_tag(&)(Internal::in_place_type_tag);
54 |
55 | template
56 | using in_place_index_t = in_place_tag(&)(Internal::in_place_index_tag);
57 |
58 |
59 | ///////////////////////////////////////////////////////////////////////////////
60 | /// in_place / in_place / in_place
61 | ///
62 | /// http://en.cppreference.com/w/cpp/utility/in_place
63 | ///
64 | inline in_place_tag in_place(Internal::in_place_tag) { return Internal_ConstructInPlaceTag(); }
65 |
66 | template
67 | inline in_place_tag in_place(Internal::in_place_type_tag) { return Internal_ConstructInPlaceTag(); }
68 |
69 | template
70 | inline in_place_tag in_place(Internal::in_place_index_tag) { return Internal_ConstructInPlaceTag(); }
71 |
72 |
73 | } // namespace eastl
74 |
75 |
76 | #endif // Header include guard
77 |
78 |
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/Source/External/EASTL/internal/integer_sequence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_INTEGER_SEQUENCE_H
6 | #define EASTL_INTEGER_SEQUENCE_H
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | namespace eastl
13 | {
14 |
15 | #if EASTL_VARIADIC_TEMPLATES_ENABLED && !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
16 |
17 | // integer_sequence
18 | template
19 | class integer_sequence
20 | {
21 | public:
22 | typedef T value_type;
23 | static_assert(is_integral::value, "eastl::integer_sequence can only be instantiated with an integral type");
24 | static EA_CONSTEXPR size_t size() EA_NOEXCEPT { return sizeof...(Ints); }
25 | };
26 |
27 | template
28 | struct make_index_sequence_impl;
29 |
30 | template
31 | struct make_index_sequence_impl>
32 | {
33 | typedef typename make_index_sequence_impl>::type type;
34 | };
35 |
36 | template
37 | struct make_index_sequence_impl<0, integer_sequence>
38 | {
39 | typedef integer_sequence type;
40 | };
41 |
42 | template
43 | using index_sequence = integer_sequence;
44 |
45 | template
46 | using make_index_sequence = typename make_index_sequence_impl>::type;
47 |
48 | template
49 | struct integer_sequence_convert_impl;
50 |
51 | template
52 | struct integer_sequence_convert_impl>
53 | {
54 | typedef integer_sequence type;
55 | };
56 |
57 | template
58 | struct make_integer_sequence_impl
59 | {
60 | typedef typename integer_sequence_convert_impl>::type type;
61 | };
62 |
63 | template
64 | using make_integer_sequence = typename make_integer_sequence_impl::type;
65 |
66 | // Helper alias template that converts any type parameter pack into an index sequence of the same length
67 | template
68 | using index_sequence_for = make_index_sequence;
69 |
70 | #endif // EASTL_VARIADIC_TEMPLATES_ENABLED
71 |
72 | } // namespace eastl
73 |
74 | #endif // EASTL_INTEGER_SEQUENCE_H
75 |
--------------------------------------------------------------------------------
/Source/External/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
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 |
--------------------------------------------------------------------------------
/Source/External/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
9 |
10 | namespace eastl
11 | {
12 | template
13 | struct pair;
14 | }
15 |
16 | #endif // EASTL_PAIR_FWD_DECLS_H
17 |
--------------------------------------------------------------------------------
/Source/External/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
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 |
--------------------------------------------------------------------------------
/Source/External/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
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 |
--------------------------------------------------------------------------------
/Source/External/EASTL/intrusive_hash_map.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_INTRUSIVE_HASH_MAP_H
6 | #define EASTL_INTRUSIVE_HASH_MAP_H
7 |
8 |
9 | #include
10 | #include
11 | #include
12 | #include
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 | namespace eastl
21 | {
22 |
23 | /// intrusive_hash_map
24 | ///
25 | /// Template parameters:
26 | /// Key The key object (key in the key/value pair). T must contain a member of type Key named mKey.
27 | /// T The type of object the map holds (a.k.a. value).
28 | /// bucketCount The number of buckets to use. Best if it's a prime number.
29 | /// Hash Hash function. See functional.h for examples of hash functions.
30 | /// Equal Equality testing predicate; tells if two elements are equal.
31 | ///
32 | template , typename Equal = eastl::equal_to >
33 | class intrusive_hash_map : public intrusive_hashtable
34 | {
35 | public:
36 | typedef intrusive_hashtable base_type;
37 | typedef intrusive_hash_map this_type;
38 |
39 | public:
40 | explicit intrusive_hash_map(const Hash& h = Hash(), const Equal& eq = Equal())
41 | : base_type(h, eq)
42 | {
43 | // Empty
44 | }
45 |
46 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea?
47 | //intrusive_hash_map(std::initializer_list ilist);
48 |
49 | }; // intrusive_hash_map
50 |
51 |
52 |
53 |
54 | /// intrusive_hash_multimap
55 | ///
56 | /// Implements a intrusive_hash_multimap, which is the same thing as a intrusive_hash_map
57 | /// except that contained elements need not be unique. See the documentation
58 | /// for intrusive_hash_map for details.
59 | ///
60 | /// Template parameters:
61 | /// Key The key object (key in the key/value pair). T must contain a member of type Key named mKey.
62 | /// T The type of object the map holds (a.k.a. value).
63 | /// bucketCount The number of buckets to use. Best if it's a prime number.
64 | /// Hash Hash function. See functional.h for examples of hash functions.
65 | /// Equal Equality testing predicate; tells if two elements are equal.
66 | ///
67 | template , typename Equal = eastl::equal_to >
68 | class intrusive_hash_multimap : public intrusive_hashtable
69 | {
70 | public:
71 | typedef intrusive_hashtable base_type;
72 | typedef intrusive_hash_multimap this_type;
73 |
74 | public:
75 | explicit intrusive_hash_multimap(const Hash& h = Hash(), const Equal& eq = Equal())
76 | : base_type(h, eq)
77 | {
78 | // Empty
79 | }
80 |
81 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea?
82 | //intrusive_hash_multimap(std::initializer_list ilist);
83 |
84 | }; // intrusive_hash_multimap
85 |
86 |
87 |
88 |
89 | } // namespace eastl
90 |
91 |
92 | #endif // Header include guard
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/Source/External/EASTL/intrusive_hash_set.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #ifndef EASTL_INTRUSIVE_HASH_SET_H
6 | #define EASTL_INTRUSIVE_HASH_SET_H
7 |
8 |
9 | #include
10 | #include
11 | #include
12 | #include
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 | namespace eastl
21 | {
22 |
23 | /// intrusive_hash_set
24 | ///
25 | /// Template parameters:
26 | /// T The type of object the set holds (a.k.a. value).
27 | /// bucketCount The number of buckets to use. Best if it's a prime number.
28 | /// Hash Hash function. See functional.h for examples of hash functions.
29 | /// Equal Equality testing predicate; tells if two elements are equal.
30 | ///
31 | template , typename Equal = eastl::equal_to >
32 | class intrusive_hash_set : public intrusive_hashtable
33 | {
34 | public:
35 | typedef intrusive_hashtable base_type;
36 | typedef intrusive_hash_set this_type;
37 |
38 | public:
39 | explicit intrusive_hash_set(const Hash& h = Hash(), const Equal& eq = Equal())
40 | : base_type(h, eq)
41 | {
42 | // Empty
43 | }
44 |
45 | // To consider: Is this feasible, given how initializer_list works by creating a temporary array? Even if it is feasible, is it a good idea?
46 | //intrusive_hash_set(std::initializer_list ilist);
47 |
48 | }; // intrusive_hash_set
49 |
50 |
51 |
52 |
53 | /// intrusive_hash_multiset
54 | ///
55 | /// Implements a intrusive_hash_multiset, which is the same thing as a intrusive_hash_set
56 | /// except that contained elements need not be unique. See the documentation
57 | /// for intrusive_hash_set for details.
58 | ///
59 | /// Template parameters:
60 | /// T The type of object the set holds (a.k.a. value).
61 | /// bucketCount The number of buckets to use. Best if it's a prime number.
62 | /// Hash Hash function. See functional.h for examples of hash functions.
63 | /// Equal Equality testing predicate; tells if two elements are equal.
64 | ///
65 | template