├── .clang-format
├── .clang-format-ignore
├── .gitattributes
├── .github
└── workflows
│ ├── pre-release.yml
│ └── tagged-release.yml
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build2
├── kram.xcconfig
├── kram.xcodeproj
│ └── project.pbxproj
├── kram.xcworkspace
│ └── contents.xcworkspacedata
├── kramc.xcodeproj
│ └── project.pbxproj
├── kramv.xcodeproj
│ └── project.pbxproj
└── vectormath.xcodeproj
│ └── project.pbxproj
├── gtlf
├── GLTF
│ ├── GLTF.h
│ ├── GLTF.xcodeproj
│ │ └── project.pbxproj
│ ├── Headers
│ │ ├── Extensions
│ │ │ ├── GLTFExtensionNames.h
│ │ │ └── GLTFKHRLight.h
│ │ ├── GLTFAccessor.h
│ │ ├── GLTFAnimation.h
│ │ ├── GLTFAsset.h
│ │ ├── GLTFBinaryChunk.h
│ │ ├── GLTFBuffer.h
│ │ ├── GLTFBufferAllocator.h
│ │ ├── GLTFBufferView.h
│ │ ├── GLTFCamera.h
│ │ ├── GLTFDefaultBufferAllocator.h
│ │ ├── GLTFEnums.h
│ │ ├── GLTFImage.h
│ │ ├── GLTFMaterial.h
│ │ ├── GLTFMesh.h
│ │ ├── GLTFNode.h
│ │ ├── GLTFNodeVisitor.h
│ │ ├── GLTFObject.h
│ │ ├── GLTFScene.h
│ │ ├── GLTFSkin.h
│ │ ├── GLTFTexture.h
│ │ ├── GLTFTextureSampler.h
│ │ ├── GLTFUtilities.h
│ │ └── GLTFVertexDescriptor.h
│ ├── Info.plist
│ ├── Source
│ │ ├── Extensions
│ │ │ ├── GLTFExtensionNames.m
│ │ │ └── GLTFKHRLight.m
│ │ ├── GLTFAccessor.m
│ │ ├── GLTFAnimation.m
│ │ ├── GLTFAsset.m
│ │ ├── GLTFBinaryChunk.m
│ │ ├── GLTFBufferView.m
│ │ ├── GLTFCamera.m
│ │ ├── GLTFDefaultBufferAllocator.m
│ │ ├── GLTFImage.m
│ │ ├── GLTFMaterial.m
│ │ ├── GLTFMesh.m
│ │ ├── GLTFNode.m
│ │ ├── GLTFObject.m
│ │ ├── GLTFScene.m
│ │ ├── GLTFSkin.m
│ │ ├── GLTFTexture.m
│ │ ├── GLTFTextureSampler.m
│ │ ├── GLTFUtilities.m
│ │ └── GLTFVertexDescriptor.m
│ └── kram.xcconfig
└── GLTFMTL
│ ├── GLTFMTL.h
│ ├── GLTFMTL.xcodeproj
│ └── project.pbxproj
│ ├── Headers
│ ├── GLTFMTLBufferAllocator.h
│ ├── GLTFMTLLightingEnvironment.h
│ ├── GLTFMTLRenderer.h
│ ├── GLTFMTLShaderBuilder.h
│ ├── GLTFMTLTextureLoader.h
│ └── GLTFMTLUtilities.h
│ ├── Info.plist
│ ├── Source
│ ├── GLTFMTLBufferAllocator.m
│ ├── GLTFMTLLightingEnvironment.m
│ ├── GLTFMTLRenderer.m
│ ├── GLTFMTLShaderBuilder.m
│ ├── GLTFMTLTextureLoader.m
│ └── GLTFMTLUtilities.m
│ └── kram.xcconfig
├── hlslparser
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build.ninja
├── buildShaders.sh
├── hlslparser.sln
├── hlslparser.vcxproj
├── hlslparser.vcxproj.filters
├── hlslparser.xcodeproj
│ └── project.pbxproj
├── hlslparser.xcworkspace
│ └── contents.xcworkspacedata
├── premake4.lua
├── shaders
│ ├── Compute.hlsl
│ ├── Sample.hlsl
│ ├── ShaderHLSL.h
│ ├── ShaderMSL.h
│ └── Skinning.hlsl
├── src
│ ├── CodeWriter.cpp
│ ├── CodeWriter.h
│ ├── Engine.cpp
│ ├── Engine.h
│ ├── HLSLGenerator.cpp
│ ├── HLSLGenerator.h
│ ├── HLSLParser.cpp
│ ├── HLSLParser.h
│ ├── HLSLTokenizer.cpp
│ ├── HLSLTokenizer.h
│ ├── HLSLTree.cpp
│ ├── HLSLTree.h
│ ├── MSLGenerator.cpp
│ ├── MSLGenerator.h
│ └── Main.cpp
└── testshaders.xcodeproj
│ └── project.pbxproj
├── kram-preview
├── Base.lproj
│ └── KramPreviewViewController.xib
├── Info.plist
├── KramPreviewViewController.h
├── KramPreviewViewController.mm
└── kram_preview.entitlements
├── kram-profile
├── CBA
│ ├── Analysis.cpp
│ ├── Analysis.h
│ ├── Arena.cpp
│ ├── Arena.h
│ ├── BuildEvents.cpp
│ ├── BuildEvents.h
│ ├── CBA.h
│ ├── CBA.mm
│ ├── Utils.cpp
│ ├── Utils.h
│ ├── simdjson.cpp
│ └── simdjson.h
├── README.md
├── Source
│ ├── KramZipHelper.cpp
│ ├── KramZipHelper.h
│ ├── KramZipHelperW.h
│ ├── KramZipHelperW.mm
│ ├── kram-profile-Bridging-Header.h
│ ├── miniz.cpp
│ ├── miniz.h
│ └── track_event_parser.cpp
├── kram-profile.xcodeproj
│ └── project.pbxproj
└── kram-profile
│ ├── AnyCodable.swift
│ ├── AnyDecodable.swift
│ ├── AnyEncodable.swift
│ ├── Assets.xcassets
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-1024.png
│ │ ├── Icon-128.png
│ │ ├── Icon-256 1.png
│ │ ├── Icon-256.png
│ │ ├── Icon-32 1.png
│ │ ├── Icon-32.png
│ │ ├── Icon-512 1.png
│ │ ├── Icon-512.png
│ │ └── Icon-64.png
│ └── Contents.json
│ ├── DataCompression.swift
│ ├── File.swift
│ ├── FileList.swift
│ ├── Info.plist
│ ├── Keycode.swift
│ ├── Log.swift
│ ├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
│ ├── kram_profile.entitlements
│ └── kram_profileApp.swift
├── kram-thumb-win
├── CMakeLists.txt
├── Dll.cpp
├── Dll.rc
├── KramThumbProvider.cpp
├── KramThumbProvider.def
├── LICENSE
├── README.md
└── resource.h
├── kram-thumb
├── Info.plist
├── KramThumbnailProvider.h
├── KramThumbnailProvider.mm
└── kram_thumb.entitlements
├── kramc
├── CMakeLists.txt
└── KramMain.cpp
├── kramv
├── Assets.xcassets
│ ├── AccentColor.colorset
│ │ └── Contents.json
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-1024.png
│ │ ├── Icon-128.png
│ │ ├── Icon-256 1.png
│ │ ├── Icon-256.png
│ │ ├── Icon-32 1.png
│ │ ├── Icon-32.png
│ │ ├── Icon-512 1.png
│ │ ├── Icon-512.png
│ │ └── Icon-64.png
│ └── Contents.json
├── Base.lproj
│ └── Main.storyboard
├── CMakeLists.txt
├── Info.plist
├── KramLoader.h
├── KramLoader.mm
├── KramRenderer.h
├── KramRenderer.mm
├── KramViewerBase.cpp
├── KramViewerBase.h
├── KramViewerMain.mm
├── Shaders
│ ├── KramShaders.h
│ ├── KramShaders.metal
│ ├── brdf.metal
│ ├── hdr.metal
│ ├── pbr.metal
│ ├── pbr.txt
│ └── skybox.metal
├── Textures
│ ├── piazza_san_marco.ktx
│ └── tropical_beach.ktx
└── kramv.entitlements
├── libkram
├── CMakeLists.txt
├── allocate
│ ├── dlmalloc.cpp
│ └── dlmalloc.h
├── astc-encoder
│ ├── astcenc.h
│ ├── astcenc_averages_and_directions.cpp
│ ├── astcenc_block_sizes.cpp
│ ├── astcenc_color_quantize.cpp
│ ├── astcenc_color_unquantize.cpp
│ ├── astcenc_compress_symbolic.cpp
│ ├── astcenc_compute_variance.cpp
│ ├── astcenc_decompress_symbolic.cpp
│ ├── astcenc_diagnostic_trace.cpp
│ ├── astcenc_diagnostic_trace.h
│ ├── astcenc_entry.cpp
│ ├── astcenc_find_best_partitioning.cpp
│ ├── astcenc_ideal_endpoints_and_weights.cpp
│ ├── astcenc_image.cpp
│ ├── astcenc_integer_sequence.cpp
│ ├── astcenc_internal.h
│ ├── astcenc_mathlib.cpp
│ ├── astcenc_mathlib.h
│ ├── astcenc_mathlib_softfloat.cpp
│ ├── astcenc_partition_tables.cpp
│ ├── astcenc_percentile_tables.cpp
│ ├── astcenc_pick_best_endpoint_format.cpp
│ ├── astcenc_platform_isa_detection.cpp
│ ├── astcenc_quantization.cpp
│ ├── astcenc_symbolic_physical.cpp
│ ├── astcenc_vecmathlib.h
│ ├── astcenc_vecmathlib_avx2_8.h
│ ├── astcenc_vecmathlib_common_4.h
│ ├── astcenc_vecmathlib_neon_4.h
│ ├── astcenc_vecmathlib_none_4.h
│ ├── astcenc_vecmathlib_sse_4.h
│ ├── astcenc_weight_align.cpp
│ └── astcenc_weight_quant_xfer_tables.cpp
├── ate
│ ├── ateencoder.h
│ └── ateencoder.mm
├── bc7enc
│ ├── LICENSE
│ ├── README.md
│ ├── bc7decomp.cpp
│ ├── bc7decomp.h
│ ├── bc7decomp_ref.cpp
│ ├── bc7enc.cpp
│ ├── bc7enc.h
│ ├── ert.cpp
│ ├── ert.h
│ ├── rdo_bc_encoder.cpp
│ ├── rdo_bc_encoder.h
│ ├── rgbcx.cpp
│ ├── rgbcx.h
│ ├── rgbcx_table4.h
│ ├── rgbcx_table4_small.h
│ ├── utils.cpp
│ └── utils.h
├── cgltf
│ ├── LICENSE
│ ├── README.md
│ ├── cgltf.h
│ └── cgltf_write.h
├── compressonator
│ └── bc6h
│ │ ├── bc6h_decode.cpp
│ │ ├── bc6h_decode.h
│ │ ├── bc6h_definitions.h
│ │ ├── bc6h_encode.cpp
│ │ ├── bc6h_encode.h
│ │ ├── bc6h_utils.h
│ │ ├── hdr_encode.cpp
│ │ └── hdr_encode.h
├── eastl
│ ├── include
│ │ ├── 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
│ │ │ ├── atomic.h
│ │ │ ├── basic_string.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
│ │ │ └── tuple_vector.h
│ │ │ ├── chrono.h
│ │ │ ├── core_allocator.h
│ │ │ ├── core_allocator_adapter.h
│ │ │ ├── deque.h
│ │ │ ├── finally.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
│ │ │ ├── atomic
│ │ │ │ ├── arch
│ │ │ │ │ ├── arch.h
│ │ │ │ │ ├── arch_add_fetch.h
│ │ │ │ │ ├── arch_and_fetch.h
│ │ │ │ │ ├── arch_cmpxchg_strong.h
│ │ │ │ │ ├── arch_cmpxchg_weak.h
│ │ │ │ │ ├── arch_compiler_barrier.h
│ │ │ │ │ ├── arch_cpu_pause.h
│ │ │ │ │ ├── arch_exchange.h
│ │ │ │ │ ├── arch_fetch_add.h
│ │ │ │ │ ├── arch_fetch_and.h
│ │ │ │ │ ├── arch_fetch_or.h
│ │ │ │ │ ├── arch_fetch_sub.h
│ │ │ │ │ ├── arch_fetch_xor.h
│ │ │ │ │ ├── arch_load.h
│ │ │ │ │ ├── arch_memory_barrier.h
│ │ │ │ │ ├── arch_or_fetch.h
│ │ │ │ │ ├── arch_signal_fence.h
│ │ │ │ │ ├── arch_store.h
│ │ │ │ │ ├── arch_sub_fetch.h
│ │ │ │ │ ├── arch_thread_fence.h
│ │ │ │ │ └── arch_xor_fetch.h
│ │ │ │ ├── atomic.h
│ │ │ │ ├── atomic_asserts.h
│ │ │ │ ├── atomic_base_width.h
│ │ │ │ ├── atomic_casts.h
│ │ │ │ ├── atomic_flag.h
│ │ │ │ ├── atomic_flag_standalone.h
│ │ │ │ ├── atomic_integral.h
│ │ │ │ ├── atomic_macros.h
│ │ │ │ ├── atomic_macros
│ │ │ │ │ ├── atomic_macros_add_fetch.h
│ │ │ │ │ ├── atomic_macros_all.h
│ │ │ │ │ ├── atomic_macros_and_fetch.h
│ │ │ │ │ ├── atomic_macros_base.h
│ │ │ │ │ ├── atomic_macros_cmpxchg_strong.h
│ │ │ │ │ ├── atomic_macros_cmpxchg_weak.h
│ │ │ │ │ ├── atomic_macros_compiler_barrier.h
│ │ │ │ │ ├── atomic_macros_cpu_pause.h
│ │ │ │ │ ├── atomic_macros_exchange.h
│ │ │ │ │ ├── atomic_macros_fetch_add.h
│ │ │ │ │ ├── atomic_macros_fetch_and.h
│ │ │ │ │ ├── atomic_macros_fetch_or.h
│ │ │ │ │ ├── atomic_macros_fetch_sub.h
│ │ │ │ │ ├── atomic_macros_fetch_xor.h
│ │ │ │ │ ├── atomic_macros_load.h
│ │ │ │ │ ├── atomic_macros_memory_barrier.h
│ │ │ │ │ ├── atomic_macros_or_fetch.h
│ │ │ │ │ ├── atomic_macros_signal_fence.h
│ │ │ │ │ ├── atomic_macros_store.h
│ │ │ │ │ ├── atomic_macros_sub_fetch.h
│ │ │ │ │ ├── atomic_macros_thread_fence.h
│ │ │ │ │ └── atomic_macros_xor_fetch.h
│ │ │ │ ├── atomic_memory_order.h
│ │ │ │ ├── atomic_pointer.h
│ │ │ │ ├── atomic_pop_compiler_options.h
│ │ │ │ ├── atomic_push_compiler_options.h
│ │ │ │ ├── atomic_size_aligned.h
│ │ │ │ ├── atomic_standalone.h
│ │ │ │ └── compiler
│ │ │ │ │ ├── compiler.h
│ │ │ │ │ ├── compiler_add_fetch.h
│ │ │ │ │ ├── compiler_and_fetch.h
│ │ │ │ │ ├── compiler_barrier.h
│ │ │ │ │ ├── compiler_cmpxchg_strong.h
│ │ │ │ │ ├── compiler_cmpxchg_weak.h
│ │ │ │ │ ├── compiler_cpu_pause.h
│ │ │ │ │ ├── compiler_exchange.h
│ │ │ │ │ ├── compiler_fetch_add.h
│ │ │ │ │ ├── compiler_fetch_and.h
│ │ │ │ │ ├── compiler_fetch_or.h
│ │ │ │ │ ├── compiler_fetch_sub.h
│ │ │ │ │ ├── compiler_fetch_xor.h
│ │ │ │ │ ├── compiler_load.h
│ │ │ │ │ ├── compiler_memory_barrier.h
│ │ │ │ │ ├── compiler_or_fetch.h
│ │ │ │ │ ├── compiler_signal_fence.h
│ │ │ │ │ ├── compiler_store.h
│ │ │ │ │ ├── compiler_sub_fetch.h
│ │ │ │ │ ├── compiler_thread_fence.h
│ │ │ │ │ ├── compiler_xor_fetch.h
│ │ │ │ │ ├── gcc
│ │ │ │ │ ├── compiler_gcc.h
│ │ │ │ │ ├── compiler_gcc_add_fetch.h
│ │ │ │ │ ├── compiler_gcc_and_fetch.h
│ │ │ │ │ ├── compiler_gcc_barrier.h
│ │ │ │ │ ├── compiler_gcc_cmpxchg_strong.h
│ │ │ │ │ ├── compiler_gcc_cmpxchg_weak.h
│ │ │ │ │ ├── compiler_gcc_cpu_pause.h
│ │ │ │ │ ├── compiler_gcc_exchange.h
│ │ │ │ │ ├── compiler_gcc_fetch_add.h
│ │ │ │ │ ├── compiler_gcc_fetch_and.h
│ │ │ │ │ ├── compiler_gcc_fetch_or.h
│ │ │ │ │ ├── compiler_gcc_fetch_sub.h
│ │ │ │ │ ├── compiler_gcc_fetch_xor.h
│ │ │ │ │ ├── compiler_gcc_load.h
│ │ │ │ │ ├── compiler_gcc_or_fetch.h
│ │ │ │ │ ├── compiler_gcc_signal_fence.h
│ │ │ │ │ ├── compiler_gcc_store.h
│ │ │ │ │ ├── compiler_gcc_sub_fetch.h
│ │ │ │ │ ├── compiler_gcc_thread_fence.h
│ │ │ │ │ └── compiler_gcc_xor_fetch.h
│ │ │ │ │ └── msvc
│ │ │ │ │ ├── compiler_msvc.h
│ │ │ │ │ ├── compiler_msvc_add_fetch.h
│ │ │ │ │ ├── compiler_msvc_and_fetch.h
│ │ │ │ │ ├── compiler_msvc_barrier.h
│ │ │ │ │ ├── compiler_msvc_cmpxchg_strong.h
│ │ │ │ │ ├── compiler_msvc_cmpxchg_weak.h
│ │ │ │ │ ├── compiler_msvc_cpu_pause.h
│ │ │ │ │ ├── compiler_msvc_exchange.h
│ │ │ │ │ ├── compiler_msvc_fetch_add.h
│ │ │ │ │ ├── compiler_msvc_fetch_and.h
│ │ │ │ │ ├── compiler_msvc_fetch_or.h
│ │ │ │ │ ├── compiler_msvc_fetch_sub.h
│ │ │ │ │ ├── compiler_msvc_fetch_xor.h
│ │ │ │ │ ├── compiler_msvc_or_fetch.h
│ │ │ │ │ ├── compiler_msvc_signal_fence.h
│ │ │ │ │ ├── compiler_msvc_sub_fetch.h
│ │ │ │ │ └── compiler_msvc_xor_fetch.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
│ │ │ ├── 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
│ │ │ ├── span.h
│ │ │ ├── stack.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
│ │ │ └── weak_ptr.h
│ └── source
│ │ ├── allocator_eastl.cpp
│ │ ├── assert.cpp
│ │ ├── atomic.cpp
│ │ ├── fixed_pool.cpp
│ │ ├── hashtable.cpp
│ │ ├── intrusive_list.cpp
│ │ ├── numeric_limits.cpp
│ │ ├── red_black_tree.cpp
│ │ ├── string.cpp
│ │ └── thread_support.cpp
├── etc2comp
│ ├── Etc.cpp
│ ├── Etc.h
│ ├── EtcBlock4x4.cpp
│ ├── EtcBlock4x4.h
│ ├── EtcBlock4x4Encoding.cpp
│ ├── EtcBlock4x4Encoding.h
│ ├── EtcBlock4x4EncodingBits.h
│ ├── EtcBlock4x4Encoding_ETC1.cpp
│ ├── EtcBlock4x4Encoding_ETC1.h
│ ├── EtcBlock4x4Encoding_R11.cpp
│ ├── EtcBlock4x4Encoding_R11.h
│ ├── EtcBlock4x4Encoding_RG11.cpp
│ ├── EtcBlock4x4Encoding_RG11.h
│ ├── EtcBlock4x4Encoding_RGB8.cpp
│ ├── EtcBlock4x4Encoding_RGB8.h
│ ├── EtcBlock4x4Encoding_RGB8A1.cpp
│ ├── EtcBlock4x4Encoding_RGB8A1.h
│ ├── EtcBlock4x4Encoding_RGBA8.cpp
│ ├── EtcBlock4x4Encoding_RGBA8.h
│ ├── EtcColor.h
│ ├── EtcColorFloatRGBA.h
│ ├── EtcConfig.h
│ ├── EtcDifferentialTrys.cpp
│ ├── EtcDifferentialTrys.h
│ ├── EtcErrorMetric.h
│ ├── EtcImage.cpp
│ ├── EtcImage.h
│ ├── EtcIndividualTrys.cpp
│ ├── EtcIndividualTrys.h
│ ├── EtcMath.cpp
│ └── EtcMath.h
├── fastl
│ ├── LICENSE
│ ├── falgorithm.h
│ ├── fstring.h
│ ├── map.h
│ ├── pair.h
│ ├── set.h
│ ├── unordered_map.h
│ ├── unordered_set.h
│ └── vector.h
├── fmt
│ ├── LICENSE.rst
│ ├── args.h
│ ├── chrono.h
│ ├── color.h
│ ├── compile.h
│ ├── core.h
│ ├── fmt.cpp
│ ├── format-inl.h
│ ├── format.cpp
│ ├── format.h
│ ├── os.cpp
│ ├── os.h
│ ├── ostream.h
│ ├── printf.h
│ ├── ranges.h
│ ├── std.h
│ └── xchar.h
├── heman
│ ├── hedistance.cpp
│ └── hedistance.h
├── json11
│ ├── json11.cpp
│ └── json11.h
├── kram
│ ├── BlockedLinearAllocator.cpp
│ ├── BlockedLinearAllocator.h
│ ├── ImmutableString.cpp
│ ├── ImmutableString.h
│ ├── KTXImage.cpp
│ ├── KTXImage.h
│ ├── Kram.cpp
│ ├── Kram.h
│ ├── KramConfig.h
│ ├── KramDDSHelper.cpp
│ ├── KramDDSHelper.h
│ ├── KramFileHelper.cpp
│ ├── KramFileHelper.h
│ ├── KramFileIO.cpp
│ ├── KramFileIO.h
│ ├── KramFmt.h
│ ├── KramImage.cpp
│ ├── KramImage.h
│ ├── KramImageInfo.cpp
│ ├── KramImageInfo.h
│ ├── KramLib.h
│ ├── KramLog.cpp
│ ├── KramLog.h
│ ├── KramMipper.cpp
│ ├── KramMipper.h
│ ├── KramMmapHelper.cpp
│ ├── KramMmapHelper.h
│ ├── KramPrefix.h
│ ├── KramSDFMipper.cpp
│ ├── KramSDFMipper.h
│ ├── KramThreadPool.cpp
│ ├── KramThreadPool.h
│ ├── KramTimer.cpp
│ ├── KramTimer.h
│ ├── KramZipHelper.cpp
│ ├── KramZipHelper.h
│ ├── KramZipStream.cpp
│ ├── KramZipStream.h
│ ├── TaskSystem.cpp
│ ├── TaskSystem.h
│ └── win_mmap.h
├── lodepng
│ ├── LICENSE
│ ├── lodepng.cpp
│ └── lodepng.h
├── miniz
│ ├── miniz.cpp
│ └── miniz.h
├── simdjson
│ ├── simdjson.cpp
│ └── simdjson.h
├── squish
│ ├── alpha.cpp
│ ├── alpha.h
│ ├── clusterfit.cpp
│ ├── clusterfit.h
│ ├── colourblock.cpp
│ ├── colourblock.h
│ ├── colourfit.cpp
│ ├── colourfit.h
│ ├── colourset.cpp
│ ├── colourset.h
│ ├── maths.cpp
│ ├── maths.h
│ ├── rangefit.cpp
│ ├── rangefit.h
│ ├── singlecolourfit.cpp
│ ├── singlecolourfit.h
│ ├── singlecolourlookup.inl
│ ├── squish.cpp
│ ├── squish.h
│ ├── squishgen.cpp
│ └── squishtest.cpp
├── tmpfileplus
│ ├── tmpfileplus.cpp
│ └── tmpfileplus.h
├── transcoder
│ ├── basisu.h
│ ├── basisu_containers.h
│ ├── basisu_containers_impl.h
│ ├── basisu_file_headers.h
│ ├── basisu_global_selector_cb.h
│ ├── basisu_global_selector_palette.h
│ ├── basisu_transcoder.cpp
│ ├── basisu_transcoder.h
│ ├── basisu_transcoder_internal.h
│ ├── basisu_transcoder_tables_astc.inc
│ ├── basisu_transcoder_tables_astc_0_255.inc
│ ├── basisu_transcoder_tables_atc_55.inc
│ ├── basisu_transcoder_tables_atc_56.inc
│ ├── basisu_transcoder_tables_bc7_m5_alpha.inc
│ ├── basisu_transcoder_tables_bc7_m5_color.inc
│ ├── basisu_transcoder_tables_dxt1_5.inc
│ ├── basisu_transcoder_tables_dxt1_6.inc
│ ├── basisu_transcoder_tables_pvrtc2_45.inc
│ ├── basisu_transcoder_tables_pvrtc2_alpha_33.inc
│ └── basisu_transcoder_uastc.h
├── vectormath
│ ├── README.md
│ ├── bounds234.cpp
│ ├── bounds234.h
│ ├── double234.cpp
│ ├── double234.h
│ ├── float234.cpp
│ ├── float234.h
│ ├── float4a.cpp
│ ├── float4a.h
│ ├── half234.h
│ ├── int234.h
│ ├── long234.h
│ ├── module.modulemap
│ ├── sse2neon-arm64.h
│ ├── sse2neon.h
│ ├── sse_mathfun.h
│ ├── vectormath234.cpp
│ └── vectormath234.h
└── zstd
│ ├── zstd.cpp
│ ├── zstd.h
│ └── zstddeclib.cpp
├── plugin
├── CMakeLists.txt
└── kps
│ ├── KPS.cpp
│ ├── KPS.h
│ ├── KPS.r
│ ├── KPSScripting.cpp
│ ├── KPSTerminology.h
│ ├── KPSUI.h
│ ├── KPSVersion.h
│ ├── kram-ps.rsrc
│ ├── mac
│ ├── Info.plist
│ ├── KPSAbout.xib
│ ├── KPSAboutController.h
│ ├── KPSAboutController.mm
│ ├── KPSInput.xib
│ ├── KPSInputController.h
│ ├── KPSInputController.mm
│ ├── KPSOutput.xib
│ ├── KPSOutputController.h
│ ├── KPSOutputController.mm
│ └── KPSUICocoa.mm
│ └── win
│ ├── KPSDialogs.rc
│ ├── KPSInputDialog.cpp
│ ├── KPSOutputDialog.cpp
│ └── resource.h
├── scripts
├── EASTL.natvis
├── EASTL.py
├── GpuMemDump.schema.json
├── GpuMemDumpPerfetto.py
├── GpuMemDumpSample.json
├── GpuMemDumpVis.py
├── buildShaders.sh
├── cba.sh
├── cibuild.sh
├── fixfinder.sh
├── fixupSources.sh
├── formatSources.sh
├── kramTests.sh
├── kramTextures.py
├── open_trace_in_ui.py
├── pre-commit
├── requirements.txt
└── simdk.py
└── tests
├── src
├── AtlasTest-a.png
├── AtlasTest-atlas.json
├── Black4x4-a.png
├── Checkerboard-1darray-a.png
├── Checkerboard-2darray-a.png
├── Checkerboard-3d-a.png
├── Checkerboard-cube-a.png
├── Checkerboard-cubearray-a.png
├── Checkerboard4x4-a.png
├── CircleGlow-d.png
├── ColorMap-a.png
├── GradientGray4x4-a.png
├── TestAlphaGradient.png
├── TestColorGradient.png
├── TestDirections-cube-a.png
├── TestNumbers-atlas4x4-2darray-a.png
├── Toof-a.png
├── White4x4-a.png
├── brick01-d.png
├── brick01-h.png
├── collectorbarrel-a.png
├── collectorbarrel-h.png
├── color_grid-a.png
├── flipper-sdf.png
├── laying_rock7-d.png
├── laying_rock7-h.png
├── rockwall-d.png
├── rockwall-h.png
├── roots-d.png
└── roots-h.png
└── traces
├── KramImage.json
└── KramImage.json.gz
/.clang-format-ignore:
--------------------------------------------------------------------------------
1 | #comments look like this, so these dirs are processed
2 |
3 | gltf/*
4 |
5 | #hlslparser/*
6 |
7 | #kram-preview/*
8 | #kram-profile/*
9 | #kram-profile/CBA/*
10 | #kram-shader/*
11 | #kram-thumb/*
12 | #kram-thumb-win/*
13 | #kramc
14 | #kramv
15 |
16 | libkram/allocate/*
17 | libkram/astc-encoder/*
18 | libkram/bc7enc/*
19 | libkram/cgltf/*
20 | libkram/compressonator/*
21 | libkram/eastl/*
22 | #libkram/etc2comp/*
23 | libkram/fastl/*
24 | libkram/fmt/*
25 | libkram/heman/*
26 | libkram/json11/*
27 | #libkram/kram/*
28 | libkram/lodepng/*
29 | libkram/miniz/*
30 | libkram/simdjson/*
31 | libkram/squish/*
32 | libkram/tmpfileplus/*
33 | libkram/transcoder/*
34 | #libkram/vectormath/*
35 | libkram/zstd/*
36 |
37 | plugin/*
38 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # This controls the line-endings on various file types.
2 | # Most win editors can cope with lf ending files,
3 | # and use binary load to avoid cstdlib replacement.
4 |
5 | # txt/sh/py scripts need to be lf to run across wsl/macOS
6 | *.sh text eol=lf
7 | *.py text eol=lf
8 | *.txt text eol=lf
9 |
10 | *.json text eol=lf
11 | *.plist text eol=lf
12 | *.xconfig text eol=lf
13 |
14 | *.md text eol=lf
15 | LICENSE text eol=lf
16 | meson.build text eol=lf
17 | *.vcproj text eol=crlf
18 |
19 | # what about .cpp/.h files?
20 |
21 | #-------------
22 | # commit various binary file types to git-lfs
23 | # see here https://rehansaeed.com/gitattributes-best-practices/
24 | # -text means it's not a text file and is binary
25 |
26 | # Archives
27 | *.7z filter=lfs diff=lfs merge=lfs -text
28 | *.gz filter=lfs diff=lfs merge=lfs -text
29 | *.tar filter=lfs diff=lfs merge=lfs -text
30 | *.zip filter=lfs diff=lfs merge=lfs -text
31 |
32 | *.ico filter=lfs diff=lfs merge=lfs -text
33 | *.jpg filter=lfs diff=lfs merge=lfs -text
34 | *.png filter=lfs diff=lfs merge=lfs -text
35 | *.ktx filter=lfs diff=lfs merge=lfs -text
36 | *.ktx2 filter=lfs diff=lfs merge=lfs -text
37 | *.dds filter=lfs diff=lfs merge=lfs -text
38 | *.psd filter=lfs diff=lfs merge=lfs -text
39 |
40 | # Documents
41 | *.pdf filter=lfs diff=lfs merge=lfs -text
42 |
43 | # Models
44 | *.obj filter=lfs diff=lfs merge=lfs
45 | *.gltf filter=lfs diff=lfs merge=lfs
46 | *.glb filter=lfs diff=lfs merge=lfs -text
47 | *.fbx filter=lfs diff=lfs merge=lfs -text
48 | *.usda filter=lfs diff=lfs merge=lfs -text
49 | *.usdc filter=lfs diff=lfs merge=lfs -text
50 | *.usdz filter=lfs diff=lfs merge=lfs -text
51 | *.rkassets filter=lfs diff=lfs merge=lfs -text
52 |
53 | # Other
54 | *.exe filter=lfs diff=lfs merge=lfs -text
55 |
--------------------------------------------------------------------------------
/.github/workflows/pre-release.yml:
--------------------------------------------------------------------------------
1 | name: "pre-release"
2 |
3 | # run on any changes, will copy data to pre-releases
4 | on:
5 | push:
6 | branches: [ '*' ]
7 | pull_request:
8 | branches: [ '*' ]
9 |
10 | jobs:
11 | pre-release:
12 | runs-on: ${{ matrix.os }}
13 | strategy:
14 | matrix:
15 | #os: [ubuntu-latest, macos-latest, windows-latest]
16 | #os: [macos-latest, windows-latest]
17 | #os: [macos-15, windows-latest]
18 | os: [ubuntu-latest, macos-15, windows-latest]
19 |
20 | steps:
21 | - name: Update CMake
22 | uses: lukka/get-cmake@latest
23 |
24 | - name: Check out code
25 | uses: actions/checkout@v4
26 |
27 | - name: Build and install to bin/
28 | run: ./scripts/cibuild.sh ${{ matrix.os }}
29 | shell: bash
30 |
31 | # this doesn't work with a matrix, only macos is uploaded, no way to specify same tag
32 | # - name: Upload build to releases
33 | # uses: "marvinpinto/action-automatic-releases@latest"
34 | # with:
35 | # repo_token: "${{ secrets.GITHUB_TOKEN }}"
36 | # automatic_release_tag: "latest"
37 | # prerelease: true
38 | # draft: false
39 | # title: "prerelease"
40 | # files: bin/*.zip
41 |
42 | # so do another upload to get both
43 | - name: Upload all builds to releases
44 | uses: svenstaro/upload-release-action@v2
45 | with:
46 | prerelease: true
47 | repo_token: ${{ secrets.GITHUB_TOKEN }}
48 | file: bin/*.zip
49 | file_glob: true
50 | tag: ${{ github.ref }}
51 | overwrite: true
52 |
--------------------------------------------------------------------------------
/.github/workflows/tagged-release.yml:
--------------------------------------------------------------------------------
1 | name: "tagged-release"
2 |
3 | # run on any changes tagged with v*, will copy data to releases
4 | on:
5 | push:
6 | tags:
7 | - 'v*'
8 |
9 | jobs:
10 | tagged-release:
11 | runs-on: ${{ matrix.os }}
12 | strategy:
13 | matrix:
14 | #os: [ubuntu-latest, macos-latest, windows-latest]
15 | #os: [macos-latest, windows-latest]
16 | #os: [macos-15, windows-latest]
17 | os: [ubuntu-latest, macos-15, windows-latest]
18 |
19 | steps:
20 | - name: Update CMake
21 | uses: lukka/get-cmake@latest
22 |
23 | - name: Check out code
24 | uses: actions/checkout@v4
25 |
26 | - name: Build and install to bin/
27 | run: ./scripts/cibuild.sh ${{ matrix.os }}
28 | shell: bash
29 |
30 | # this doesn't work with a matrix, only macos is uploaded, no way to specify same tag
31 | # - name: Upload build to releases
32 | # uses: "marvinpinto/action-automatic-releases@latest"
33 | # with:
34 | # repo_token: "${{ secrets.GITHUB_TOKEN }}"
35 | # prerelease: false
36 | # files: bin/*.zip
37 |
38 | # so do another upload to get both
39 | - name: Upload all builds to releases
40 | uses: svenstaro/upload-release-action@v2
41 | with:
42 | repo_token: ${{ secrets.GITHUB_TOKEN }}
43 | file: bin/*.zip
44 | file_glob: true
45 | tag: ${{ github.ref }}
46 | overwrite: true
47 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore cmake build data
2 | build/
3 |
4 | # ignore bin folder where install products go
5 | bin/
6 |
7 | # ignore out folder, test results go here
8 | out/
9 |
10 | # this file is generated from cibuild.sh, and is based on current tag
11 | libkram/kram/KramVersion.h
12 |
13 | # ignore zip files
14 | *.zip
15 |
16 | # Prerequisites
17 | *.d
18 |
19 | # Compiled Object files
20 | *.slo
21 | *.lo
22 | *.o
23 | *.obj
24 |
25 | # Precompiled Headers
26 | # *.gch
27 | # *.pch
28 |
29 | # Compiled Dynamic libraries
30 | *.so
31 | *.dylib
32 | *.dll
33 |
34 | # Fortran module files
35 | *.mod
36 | *.smod
37 |
38 | # Compiled Static libraries
39 | *.lai
40 | *.la
41 | *.a
42 | *.lib
43 |
44 | # Executables
45 | *.exe
46 | *.out
47 |
48 | plugin/ext/
49 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020-2021 Alec Miller
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 |
--------------------------------------------------------------------------------
/build2/kram.xcconfig:
--------------------------------------------------------------------------------
1 | // kram - Copyright 2020-2025 by Alec Miller. - MIT License
2 | // The license and copyright notice shall be included
3 | // in all copies or substantial portions of the Software.
4 |
5 | // Xcode's AVX2 simd setting doesn't set -mfma or -m16c. So
6 | // then universal builds throw hundreds of warnings. Ugh.
7 | // Xcode doesn't set NDEBUG=1 in Release builds. Ugh.
8 | // Also turn on -ftime-trace to review build times in kram-profile.
9 |
10 | // This setting only applies to x64, but many macs only have AVX (2019 MBP).
11 | // Note that f16c is supported on AVX, but fma requires AVX2.
12 | // If setting this to AVX, then set GLTF/GLTFMTL too since those don't use config.
13 | // There isn't currently a vectormath fallback to avx (see SIMD_AVX2).
14 | CLANG_X86_VECTOR_INSTRUCTIONS = avx2
15 |
16 | KRAM_FLAGS_X64 =
17 | KRAM_FLAGS_X64[sdk=*][arch=x86_64] = -mf16c -mfma
18 |
19 | KRAM_FLAGS_RELEASE =
20 | KRAM_FLAGS_RELEASE[sdk=*][config=Release] = -DNDEBUG=1
21 |
22 | KRAM_FLAGS = -ftime-trace
23 | KRAM_FLAGS = $(KRAM_FLAGS) -DUSE_SIMDLIB=1 -DUSE_SIMDLIBMODULE=1
24 | KRAM_FLAGS = $(KRAM_FLAGS) -fmodules -fcxx-modules
25 |
26 | // KRAM_FLAGS += -DCOMPILE_EASTL=1
27 | // TODO: also set include path for eastl
28 |
29 | // configuring all the encoders in kram
30 | // KRAM_FLAGS += -DCOMPILE_ASTCENC=1 -DCOMPILE_ATE=1 -DCOMPILE_ETCENC=1 -DCOMPILE_SQUISH=1 -DCOMPILE_BCENC=1 -DCOMPILE_COMP=1 -DCOMPILE_BASIS=0 -DCOMPILE_EASTL=0
31 |
32 | // This is killing build times in Xcode16
33 | ENABLE_MODULE_VERIFIER = NO
34 |
35 | OTHER_CFLAGS = $(inherited) $(KRAM_FLAGS) $(KRAM_FLAGS_RELEASE) $(KRAM_FLAGS_X64)
36 |
--------------------------------------------------------------------------------
/build2/kram.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
12 |
13 |
15 |
16 |
18 |
19 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/gtlf/GLTF/GLTF.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #include
18 |
19 | #if TARGET_OS_OSX
20 | // eliminate Cocoa, can't this use AppKit?
21 | #include
22 | #elif TARGET_OS_IOS
23 | #include
24 | #endif
25 |
26 | //! Project version number for GLTF.
27 | FOUNDATION_EXPORT double GLTFVersionNumber;
28 |
29 | //! Project version string for GLTF.
30 | FOUNDATION_EXPORT const unsigned char GLTFVersionString[];
31 |
32 | #import
33 | #import
34 | #import
35 | #import
36 | #import
37 | #import
38 | #import
39 | #import
40 | #import
41 | #import
42 | #import
43 | #import
44 | #import
45 | #import
46 | #import
47 | #import
48 | #import
49 | #import
50 | #import
51 | #import
52 | #import
53 | #import
54 | #import
55 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/Extensions/GLTFExtensionNames.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | //@import Foundation;
18 | #import
19 |
20 | extern NSString *const GLTFExtensionKHRMaterialsPBRSpecularGlossiness;
21 | extern NSString *const GLTFExtensionKHRLights;
22 | extern NSString *const GLTFExtensionKHRMaterialsUnlit;
23 | extern NSString *const GLTFExtensionKHRTextureTransform;
24 | extern NSString *const GLTFExtensionEXTPBRAttributes;
25 | extern NSString *const GLTFExtensionKHRDracoMeshCompression;
26 | extern NSString *const GLTFExtensionKHRMeshQuantization;
27 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFAccessor.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | //@import simd;
21 |
22 | NS_ASSUME_NONNULL_BEGIN
23 |
24 | @class GLTFBufferView;
25 |
26 | typedef struct {
27 | float minValue[16];
28 | float maxValue[16];
29 | } GLTFValueRange;
30 |
31 | @interface GLTFAccessor : GLTFObject
32 | @property (nonatomic, weak) GLTFBufferView *bufferView;
33 | @property (nonatomic, assign) GLTFDataType componentType;
34 | @property (nonatomic, assign) GLTFDataDimension dimension;
35 | @property (nonatomic, assign) NSInteger offset;
36 | @property (nonatomic, assign) NSInteger count;
37 | @property (nonatomic, assign) GLTFValueRange valueRange;
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFAnimation.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @class GLTFNode, GLTFAccessor;
23 |
24 | @interface GLTFAnimation : GLTFObject
25 | @property (nonatomic, copy) NSArray *channels;
26 | @property (nonatomic, copy) NSDictionary *samplers;
27 |
28 | - (void)runAtTime:(NSTimeInterval)time;
29 | @end
30 |
31 | @interface GLTFAnimationSampler : GLTFObject
32 | @property (nonatomic, weak) GLTFAccessor *inputAccessor;
33 | @property (nonatomic, weak) GLTFAccessor *outputAccessor;
34 | @property (nonatomic, assign) GLTFInterpolationMode interpolationMode;
35 | @end
36 |
37 | @interface GLTFAnimationChannel : NSObject
38 | @property (nonatomic, weak) GLTFNode *targetNode;
39 | @property (nonatomic, weak) NSString *targetPath;
40 | @property (nonatomic, weak) GLTFAnimationSampler *sampler;
41 | @property (nonatomic, readonly, assign) NSTimeInterval duration;
42 | @property (nonatomic, readonly, assign) NSTimeInterval startTime;
43 | @property (nonatomic, readonly, assign) NSTimeInterval endTime;
44 | @end
45 |
46 | NS_ASSUME_NONNULL_END
47 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFBinaryChunk.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | //@import Foundation;
18 | #import
19 |
20 | extern const UInt32 GLTFBinaryMagic;
21 |
22 | typedef NS_ENUM(NSInteger, GLTFChunkType) {
23 | GLTFChunkTypeJSON = 0x4E4F534A,
24 | GLTFChunkTypeBinary = 0x004E4942
25 | };
26 |
27 | typedef struct {
28 | UInt32 magic;
29 | UInt32 version;
30 | UInt32 length;
31 | } GLTFBinaryHeader;
32 |
33 | @interface GLTFBinaryChunk : NSObject
34 | @property (nonatomic, assign) GLTFChunkType chunkType;
35 | @property (nonatomic, strong) NSData *data;
36 | @end
37 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFBuffer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @protocol GLTFBuffer
22 |
23 | @property (nonatomic, readonly) NSInteger length;
24 |
25 | /// The actual data associated with this buffer. If uri is a data URI, this is populated when loading; else it is nil
26 | @property (nonatomic, readonly) void *contents;
27 |
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFBufferAllocator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | //@import Foundation;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @protocol GLTFBufferAllocator
24 | + (uint64_t)liveAllocationSize;
25 | - (id)newBufferWithLength:(NSInteger)length;
26 | - (id)newBufferWithData:(NSData *)data;
27 | @end
28 |
29 | NS_ASSUME_NONNULL_END
30 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFBufferView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @protocol GLTFBuffer;
23 |
24 | @interface GLTFBufferView : GLTFObject
25 | @property (nonatomic, weak) id buffer;
26 | @property (nonatomic, assign) GLTFTarget target;
27 | @property (nonatomic, assign) NSInteger length;
28 | @property (nonatomic, assign) NSInteger offset;
29 | @property (nonatomic, assign) NSInteger stride;
30 | @end
31 |
32 | NS_ASSUME_NONNULL_END
33 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFCamera.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | //@import simd;
21 |
22 | #import
23 |
24 | NS_ASSUME_NONNULL_BEGIN
25 |
26 | @class GLTFNode;
27 |
28 | @interface GLTFCamera : GLTFObject
29 | @property (nonatomic, assign) GLTFCameraType cameraType;
30 |
31 | @property (nonatomic, assign) float aspectRatio; // Only applicable when type is perspective
32 | @property (nonatomic, assign) float yfov; // Only applicable when type is perspective
33 | @property (nonatomic, assign) float xmag; // Only applicable when type is orthographic
34 | @property (nonatomic, assign) float ymag; // Only applicable when type is orthographic
35 | @property (nonatomic, assign) float znear;
36 | @property (nonatomic, assign) float zfar;
37 |
38 | @property (nonatomic, assign) simd_float4x4 projectionMatrix;
39 |
40 | @property (nonatomic, copy) NSArray *referencingNodes;
41 |
42 | @end
43 |
44 | NS_ASSUME_NONNULL_END
45 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFDefaultBufferAllocator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | //@import Foundation;
18 |
19 | #import
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @interface GLTFDefaultBufferAllocator : NSObject
24 |
25 | @end
26 |
27 | NS_ASSUME_NONNULL_END
28 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFImage.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | //@import Foundation;
21 |
22 | NS_ASSUME_NONNULL_BEGIN
23 |
24 | @interface GLTFImage : GLTFObject
25 |
26 | /// A reference to a buffer view containing image data, if url is nil
27 | @property (nonatomic, strong) GLTFBufferView * _Nullable bufferView;
28 |
29 | /// The MIME type of the data contained in this image's buffer view
30 | @property (nonatomic, copy) NSString * _Nullable mimeType;
31 |
32 | /// A file URL, if the URI was not a decodable data-uri; otherwise nil
33 | @property (nonatomic, copy) NSURL * _Nullable url;
34 |
35 | /// A data object containing the data encoded in the image's data-uri, if present; otherwise nil
36 | @property (nonatomic, strong) NSData *imageData;
37 |
38 | @end
39 |
40 | NS_ASSUME_NONNULL_END
41 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFMesh.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @class GLTFAccessor, GLTFVertexDescriptor, GLTFSubmesh, GLTFMaterial;
23 |
24 | @interface GLTFMesh : GLTFObject
25 | @property (nonatomic, copy) NSArray *submeshes;
26 | @property (nonatomic, copy) NSArray *defaultMorphTargetWeights;
27 | @end
28 |
29 | @interface GLTFMorphTarget : GLTFObject
30 | @property (nonatomic, copy) NSDictionary *accessorsForAttributes;
31 | @end
32 |
33 | @interface GLTFSubmesh : GLTFObject
34 | @property (nonatomic, copy) NSDictionary *accessorsForAttributes;
35 | @property (nonatomic, weak) GLTFAccessor *indexAccessor;
36 | @property (nonatomic, weak) GLTFMaterial *material;
37 | @property (nonatomic, assign) GLTFPrimitiveType primitiveType;
38 | @property (nonatomic, copy) NSArray *morphTargets;
39 |
40 | @property (nonatomic, readonly) GLTFVertexDescriptor *vertexDescriptor;
41 | @end
42 |
43 | NS_ASSUME_NONNULL_END
44 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFNodeVisitor.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | //@import Foundation;
18 |
19 | NS_ASSUME_NONNULL_BEGIN
20 |
21 | @class GLTFNode;
22 |
23 | typedef NS_ENUM(NSInteger, GLTFVisitationStrategy) {
24 | GLTFVisitationStrategyDepthFirst
25 | };
26 |
27 | typedef void (^GLTFNodeVisitor)(GLTFNode *node, int depth, BOOL *stop);
28 |
29 | @protocol GLTFNodeVisitable
30 | - (void)acceptVisitor:(GLTFNodeVisitor)visitor strategy:(GLTFVisitationStrategy)strategy;
31 | @end
32 |
33 | NS_ASSUME_NONNULL_END
34 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | //#import
19 | //@import Foundation;
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @protocol GLTFObject
24 |
25 | /// The user-defined name of this object. Need not be unique.
26 | @property (nonatomic, copy) NSString * _Nullable name;
27 | /// Data specific to any extensions used in this document
28 | @property (nonatomic, copy) NSDictionary *extensions;
29 | /// Contains application-specific information that is passed through but not parsed
30 | @property (nonatomic, copy) NSDictionary *extras;
31 |
32 | @end
33 |
34 | @interface GLTFObject : NSObject
35 |
36 | /// A unique identifier for this object
37 | @property (nonatomic, readonly) NSUUID *identifier;
38 | /// The user-defined name of this object. Need not be unique.
39 | @property (nonatomic, copy) NSString * _Nullable name;
40 | /// Data specific to any extensions used in this document
41 | @property (nonatomic, copy) NSDictionary *extensions;
42 | /// Contains application-specific information that is passed through but not parsed
43 | @property (nonatomic, copy) NSDictionary *extras;
44 |
45 | @end
46 |
47 | NS_ASSUME_NONNULL_END
48 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFScene.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 | #import
20 |
21 | NS_ASSUME_NONNULL_BEGIN
22 |
23 | @class GLTFNode;
24 | @class GLTFKHRLight;
25 |
26 | @interface GLTFScene : GLTFObject
27 | @property (nonatomic, copy) NSArray *nodes;
28 | @property (nonatomic, weak) GLTFKHRLight * _Nullable ambientLight;
29 | @property (nonatomic, readonly, assign) GLTFBoundingBox approximateBounds;
30 |
31 | - (void)addNode:(GLTFNode *)node;
32 |
33 | @end
34 |
35 | NS_ASSUME_NONNULL_END
36 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFSkin.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | //@import Foundation;
18 | #import
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @class GLTFAccessor, GLTFNode;
23 |
24 | @interface GLTFSkin : GLTFObject
25 | @property (nonatomic, strong) GLTFAccessor *inverseBindMatricesAccessor;
26 | @property (nonatomic, copy) NSArray *jointNodes;
27 | @property (nonatomic, assign) GLTFNode *skeletonRootNode;
28 | @end
29 |
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Headers/GLTFTextureSampler.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | NS_ASSUME_NONNULL_BEGIN
21 |
22 | @interface GLTFTextureSampler : GLTFObject
23 |
24 | // GLTFSamplingFilterLinear
25 | @property (nonatomic, assign) GLTFSamplingFilter magFilter;
26 | // GLTFSamplingFilterNearestMipLinear
27 | @property (nonatomic, assign) GLTFSamplingFilter minFilter;
28 | // GLTFAddressModeRepeat
29 | @property (nonatomic, assign) GLTFAddressMode sAddressMode;
30 | // GLTFAddressModeRepeat
31 | @property (nonatomic, assign) GLTFAddressMode tAddressMode;
32 | @end
33 |
34 | NS_ASSUME_NONNULL_END
35 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSHumanReadableCopyright
22 | Copyright © 2018 Warren Moore. All rights reserved.
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/Extensions/GLTFExtensionNames.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFExtensionNames.h"
18 |
19 | NSString *const GLTFExtensionKHRMaterialsPBRSpecularGlossiness = @"KHR_materials_pbrSpecularGlossiness";
20 | NSString *const GLTFExtensionKHRLights = @"KHR_lights";
21 | NSString *const GLTFExtensionKHRMaterialsUnlit = @"KHR_materials_unlit";
22 | NSString *const GLTFExtensionKHRTextureTransform = @"KHR_texture_transform";
23 | NSString *const GLTFExtensionEXTPBRAttributes = @"EXT_pbr_attributes";
24 | NSString *const GLTFExtensionKHRDracoMeshCompression = @"KHR_draco_mesh_compression";
25 | NSString *const GLTFExtensionKHRMeshQuantization = @"KHR_mesh_quantization";
26 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/Extensions/GLTFKHRLight.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFKHRLight.h"
18 |
19 | @implementation GLTFKHRLight
20 |
21 | - (instancetype)init {
22 | if ((self = [super init])) {
23 | _type = GLTFKHRLightTypeDirectional;
24 | _color = (simd_float4){ 1, 1, 1, 1 };
25 | _intensity = 1;
26 | _range = 0;
27 | _innerConeAngle = 0;
28 | _outerConeAngle = M_PI_4;
29 | }
30 | return self;
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFAccessor.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFAccessor.h"
18 |
19 | @implementation GLTFAccessor
20 |
21 | - (NSString *)description {
22 | return [NSString stringWithFormat:@"GLTFAccessor: count: %d, component type: %d, dimension: %d, offset: %d, view: %@",
23 | (int)self.count, (int)self.componentType, (int)self.dimension, (int)self.offset, self.bufferView];
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFBinaryChunk.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFBinaryChunk.h"
18 |
19 | const UInt32 GLTFBinaryMagic = 0x46546C67;
20 |
21 | @implementation GLTFBinaryChunk
22 | @end
23 |
24 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFBufferView.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFBufferView.h"
18 |
19 | @implementation GLTFBufferView
20 |
21 | - (NSString *)description {
22 | return [NSString stringWithFormat:@"GLTFBufferView: length: %d, offset: %d, stride: %d, target: %d, buffer: %@",
23 | (int)self.length, (int)self.offset, (int)self.stride, (int)self.target, self.buffer];
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFMaterial.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFMaterial.h"
18 |
19 | @implementation GLTFMaterial
20 |
21 | - (instancetype)init {
22 | if ((self = [super init])) {
23 | _baseColorFactor = (simd_float4){ 1, 1, 1, 1 };
24 | _metalnessFactor = 1.0;
25 | _roughnessFactor = 1.0;
26 | _occlusionStrength = 1.0;
27 | _emissiveFactor = (simd_float3) { 0.0, 0.0, 0.0 };
28 | _normalTextureScale = 1.0;
29 | _alphaMode = GLTFAlphaModeOpaque;
30 | _alphaCutoff = 0.5;
31 | }
32 | return self;
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFObject.h"
18 |
19 | @implementation GLTFObject
20 |
21 | - (instancetype)init {
22 | if ((self = [super init])) {
23 | _identifier = [NSUUID new];
24 | }
25 | return self;
26 | }
27 |
28 | - (NSString *)description {
29 | return [NSString stringWithFormat:@"%@; name = %@", super.description, self.name];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFScene.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFScene.h"
18 | #import "GLTFNode.h"
19 |
20 | @interface GLTFScene ()
21 | @property (nonatomic, strong) NSMutableArray *mutableNodes;
22 | @end
23 |
24 | @implementation GLTFScene
25 |
26 | - (void)setNodes:(NSArray *)nodes {
27 | _mutableNodes = [nodes mutableCopy];
28 | }
29 |
30 | - (NSArray *)nodes {
31 | return [_mutableNodes copy];
32 | }
33 |
34 | - (void)addNode:(GLTFNode *)node {
35 | if (node.parent) {
36 | [node removeFromParent];
37 | }
38 |
39 | [_mutableNodes addObject:node];
40 | }
41 |
42 | - (GLTFBoundingBox)approximateBounds {
43 | GLTFBoundingBox sceneBounds = { 0 };
44 | for (GLTFNode *node in self.nodes) {
45 | GLTFBoundingBox nodeBounds = node.approximateBounds;
46 | GLTFBoundingBoxUnion(&sceneBounds, nodeBounds);
47 | }
48 | return sceneBounds;
49 | }
50 |
51 | - (void)acceptVisitor:(GLTFNodeVisitor)visitor strategy:(GLTFVisitationStrategy)strategy {
52 | for (GLTFNode *node in self.nodes) {
53 | [node acceptVisitor:visitor strategy:strategy];
54 | }
55 | }
56 |
57 | @end
58 |
--------------------------------------------------------------------------------
/gtlf/GLTF/Source/GLTFSkin.m:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import "GLTFSkin.h"
18 |
19 | @implementation GLTFSkin
20 | @end
21 |
--------------------------------------------------------------------------------
/gtlf/GLTF/kram.xcconfig:
--------------------------------------------------------------------------------
1 | ../../build2/kram.xcconfig
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/GLTFMTL.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 |
19 | #if TARGET_OS_OSX
20 | #import
21 | #elif TARGET_OS_IOS
22 | #import
23 | #endif
24 |
25 | //! Project version number for GLTFMTL.
26 | FOUNDATION_EXPORT double GLTFMTLVersionNumber;
27 |
28 | //! Project version string for GLTFMTL.
29 | FOUNDATION_EXPORT const unsigned char GLTFMTLVersionString[];
30 |
31 | #import
32 | #import
33 | #import
34 | #import
35 | #import
36 | #import
37 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Headers/GLTFMTLBufferAllocator.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 | //#import
20 | #import
21 |
22 | //@import Foundation;
23 | //@import Metal;
24 |
25 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | @interface GLTFMTLBuffer : NSObject
28 |
29 | @property (nonatomic, readonly) id buffer;
30 |
31 | @end
32 |
33 | @interface GLTFMTLBufferAllocator : NSObject
34 |
35 | - (instancetype)initWithDevice:(id)device;
36 |
37 | @end
38 |
39 | NS_ASSUME_NONNULL_END
40 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Headers/GLTFMTLLightingEnvironment.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 | //#import
20 | #import
21 |
22 | //@import Foundation;
23 | //@import Metal;
24 |
25 | NS_ASSUME_NONNULL_BEGIN
26 |
27 | @interface GLTFMTLLightingEnvironment : NSObject
28 |
29 | @property (nonatomic, retain) id environmentCube;
30 | @property (nonatomic, retain) id diffuseCube;
31 | @property (nonatomic, retain) id specularCube;
32 | @property (nonatomic, retain) id brdfLUT;
33 |
34 | @property (nonatomic, assign) float intensity;
35 | @property (nonatomic, readonly, assign) int specularMipLevelCount;
36 |
37 | - (instancetype)initWithLibrary:(id)library;
38 |
39 | - (void)generateFromCubeTexture:(id)environmentCubeSource commandBuffer:(id)commandBuffer;
40 |
41 | - (void)generateFromEquirectTexture:(id)environmentEquirectSource commandBuffer:(id)commandBuffer;
42 |
43 | @end
44 |
45 | NS_ASSUME_NONNULL_END
46 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Headers/GLTFMTLRenderer.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | //@import Foundation;
21 | //@import Metal;
22 |
23 | NS_ASSUME_NONNULL_BEGIN
24 |
25 | #define GLTFMTLRendererMaxInflightFrames 3
26 |
27 | @class GLTFMTLLightingEnvironment;
28 |
29 | @interface GLTFMTLRenderer : NSObject
30 |
31 | @property (nonatomic, assign) CGSize drawableSize;
32 |
33 | @property (nonatomic, assign) simd_float4x4 viewMatrix;
34 | @property (nonatomic, assign) simd_float4x4 projectionMatrix;
35 |
36 | @property (nonatomic, assign) int sampleCount;
37 | @property (nonatomic, assign) MTLPixelFormat colorPixelFormat;
38 | @property (nonatomic, assign) MTLPixelFormat depthStencilPixelFormat;
39 |
40 | @property (nonatomic, strong) GLTFMTLLightingEnvironment * _Nullable lightingEnvironment;
41 | @property (nonatomic, strong) id _Nullable textureLoader;
42 |
43 | - (instancetype)initWithDevice:(id)device;
44 |
45 | - (void)renderScene:(GLTFScene *)scene
46 | commandBuffer:(id)commandBuffer
47 | commandEncoder:(id)renderEncoder;
48 |
49 | - (void)signalFrameCompletion;
50 |
51 | /// call this before loading a new asset
52 | - (void)releaseAllResources;
53 |
54 | @end
55 |
56 | NS_ASSUME_NONNULL_END
57 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Headers/GLTFMTLShaderBuilder.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 |
20 | //@import Metal;
21 |
22 | #define GLTFMTLMaximumLightCount 3
23 |
24 | // Maximum number of textures supplied by a material; excludes IBL textures, etc.
25 | #define GLTFMTLMaximumTextureCount (GLTFTextureBindIndexEmissive + 1)
26 |
27 | NS_ASSUME_NONNULL_BEGIN
28 |
29 | @class GLTFMTLLightingEnvironment;
30 |
31 | @interface GLTFMTLShaderBuilder : NSObject
32 |
33 | - (id)renderPipelineStateForSubmesh:(GLTFSubmesh *)submesh
34 | lightingEnvironment:(GLTFMTLLightingEnvironment * _Nullable)lightingEnvironment
35 | colorPixelFormat:(MTLPixelFormat)colorPixelFormat
36 | depthStencilPixelFormat:(MTLPixelFormat)depthStencilPixelFormat
37 | sampleCount:(int)sampleCount
38 | device:(id)device;
39 |
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Headers/GLTFMTLTextureLoader.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) 2018 Warren Moore. All rights reserved.
3 | //
4 | // Permission to use, copy, modify, and distribute this software for any
5 | // purpose with or without fee is hereby granted, provided that the above
6 | // copyright notice and this permission notice appear in all copies.
7 | //
8 | // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | //
16 |
17 | #import
18 | #import
19 | //#import
20 | #import
21 |
22 | //@import Metal;
23 |
24 | NS_ASSUME_NONNULL_BEGIN
25 |
26 | extern NSString *const GLTFMTLTextureLoaderOptionGenerateMipmaps;
27 | extern NSString *const GLTFMTLTextureLoaderOptionUsageFlags;
28 | extern NSString *const GLTFMTLTextureLoaderOptionSRGB;
29 |
30 | @protocol IGLTFMTLTextureLoader
31 | //- (instancetype)initWithDevice:(id)device;
32 | - (id _Nullable)newTextureWithContentsOfURL:(NSURL *)url options:(NSDictionary * _Nullable)options error:(NSError * __autoreleasing *)error;
33 | - (id _Nullable)newTextureWithData:(NSData *)data options:(NSDictionary * _Nullable)options error:(NSError * __autoreleasing *)error;
34 | @end
35 |
36 | @interface GLTFMTLTextureLoader : NSObject
37 | - (instancetype)initWithDevice:(id)device;
38 | - (id _Nullable)newTextureWithContentsOfURL:(NSURL *)url options:(NSDictionary * _Nullable)options error:(NSError **)error;
39 | - (id _Nullable)newTextureWithData:(NSData *)data options:(NSDictionary * _Nullable)options error:(NSError **)error;
40 | @end
41 |
42 | NS_ASSUME_NONNULL_END
43 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSHumanReadableCopyright
22 | Copyright © 2018 Warren Moore. All rights reserved.
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/gtlf/GLTFMTL/kram.xcconfig:
--------------------------------------------------------------------------------
1 | ../../build2/kram.xcconfig
--------------------------------------------------------------------------------
/hlslparser/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013-2014 Unknown Worlds Entertainment, Inc.
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.
--------------------------------------------------------------------------------
/hlslparser/hlslparser.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.40629.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hlslparser", "hlslparser.vcxproj", "{FAA5AD82-3351-479F-A315-F287EBD0A816}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {FAA5AD82-3351-479F-A315-F287EBD0A816}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {FAA5AD82-3351-479F-A315-F287EBD0A816}.Debug|Win32.Build.0 = Debug|Win32
16 | {FAA5AD82-3351-479F-A315-F287EBD0A816}.Release|Win32.ActiveCfg = Release|Win32
17 | {FAA5AD82-3351-479F-A315-F287EBD0A816}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/hlslparser/hlslparser.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/hlslparser/premake4.lua:
--------------------------------------------------------------------------------
1 | solution "HLSLParser"
2 | location "build"
3 | configurations { "Debug", "Release" }
4 |
5 | project "HLSLParser"
6 | kind "ConsoleApp"
7 | language "C++"
8 | files { "src/**.h", "src/**.cpp" }
9 |
10 | configuration "Debug"
11 | targetdir "bin/debug"
12 | defines { "DEBUG" }
13 | flags { "Symbols" }
14 |
15 | configuration "Release"
16 | targetdir "bin/release"
17 | defines { "NDEBUG" }
18 | flags { "Optimize" }
--------------------------------------------------------------------------------
/hlslparser/shaders/Compute.hlsl:
--------------------------------------------------------------------------------
1 | //--------------------------------------------------------------------------------------
2 | // File: Compute.hlsl
3 | //
4 | // This file contains the Compute Shader to perform array A + array B
5 | //
6 | // Copyright (c) Microsoft Corporation. All rights reserved.
7 | //--------------------------------------------------------------------------------------
8 |
9 | #include "ShaderHLSL.h"
10 |
11 | // adapted from https://learn.microsoft.com/en-us/windows/win32/direct3d11/direct3d-11-advanced-stages-compute-create
12 |
13 | struct BufType
14 | {
15 | int i;
16 | float f;
17 | };
18 |
19 | StructuredBuffer Buffer0 : register(t0);
20 | StructuredBuffer Buffer1 : register(t1);
21 |
22 | RWStructuredBuffer BufferOut : register(u2);
23 |
24 | // TODO: support numthreads designator
25 | // [numthreads(1, 1, 1)]
26 | void ComputeCS( uint3 tid : SV_DispatchThreadID )
27 | {
28 | BufferOut[tid.x].i = Buffer0[tid.x].i + Buffer1[tid.x].i;
29 | BufferOut[tid.x].f = Buffer0[tid.x].f + Buffer1[tid.x].f;
30 | }
31 |
32 | //-------------------
33 |
34 | // Need better way to search entry points, don't use filename
35 | // Just search functions ending in VS/PS/CS
36 | // [numthreads(1, 1, 1)]
37 | // void ComputeCS( uint3 DTid : SV_DispatchThreadID )
38 | // {
39 | // int i0 = asint( Buffer0.Load( DTid.x*8 ) );
40 | // float f0 = asfloat( Buffer0.Load( DTid.x*8+4 ) );
41 | // int i1 = asint( Buffer1.Load( DTid.x*8 ) );
42 | // float f1 = asfloat( Buffer1.Load( DTid.x*8+4 ) );
43 | //
44 | // BufferOut.Store( DTid.x*8, asuint(i0 + i1) );
45 | // BufferOut.Store( DTid.x*8+4, asuint(f0 + f1) );
46 | //
47 | // There is this new templated Load call.
48 | // This greatly simplifies using BAB.
49 | // float3 pos = Buffer0.Load(idx);
50 | // Bufferout.Store(idx);
51 | // }
52 |
53 |
--------------------------------------------------------------------------------
/hlslparser/src/CodeWriter.h:
--------------------------------------------------------------------------------
1 | //=============================================================================
2 | //
3 | // Render/CodeWriter.h
4 | //
5 | // Created by Max McGuire (max@unknownworlds.com)
6 | // Copyright (c) 2013, Unknown Worlds Entertainment, Inc.
7 | //
8 | //=============================================================================
9 |
10 | #pragma once
11 |
12 | #include "Engine.h"
13 |
14 | // stl
15 | #include
16 |
17 | namespace M4 {
18 |
19 | class Allocator;
20 |
21 | /**
22 | * This class is used for outputting code. It handles indentation and inserting #line markers
23 | * to match the desired output line numbers.
24 | */
25 | class CodeWriter {
26 | public:
27 | CodeWriter();
28 |
29 | void SetWriteFileLine(bool enable) { m_writeFileLine = enable; }
30 |
31 | void BeginLine(int indent, const char* fileName = NULL, int lineNumber = -1);
32 | void Write(const char* format, ...) M4_PRINTF_ATTR(2, 3);
33 | int EndLine(const char* text = NULL);
34 |
35 | void WriteLine(int indent, const char* format, ...) M4_PRINTF_ATTR(3, 4);
36 | void WriteLineTagged(int indent, const char* fileName, int lineNumber, const char* format, ...) M4_PRINTF_ATTR(5, 6);
37 |
38 | const char* GetResult() const;
39 | void Reset();
40 |
41 | private:
42 | std::string m_buffer;
43 | int m_currentLine;
44 | const char* m_currentFileName;
45 | int m_spacesPerIndent;
46 | int m_currentIndent;
47 | bool m_writeFileLine;
48 | };
49 |
50 | } //namespace M4
51 |
--------------------------------------------------------------------------------
/kram-preview/Base.lproj/KramPreviewViewController.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/kram-preview/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | kram-preview
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | QLSupportedContentTypes
30 |
31 | org.khronos.ktx
32 | public.ktx2
33 | image/dds
34 | public.png
35 |
36 | QLSupportsSearchableItems
37 |
38 |
39 | NSExtensionPointIdentifier
40 | com.apple.quicklook.preview
41 | NSExtensionPrincipalClass
42 | KramPreviewViewController
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/kram-preview/KramPreviewViewController.h:
--------------------------------------------------------------------------------
1 | // kram - Copyright 2020-2025 by Alec Miller. - MIT License
2 | // The license and copyright notice shall be included
3 | // in all copies or substantial portions of the Software.
4 |
5 | #import
6 |
7 | @interface KramPreviewViewController : NSViewController
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/kram-preview/kram_preview.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/kram-profile/CBA/Analysis.h:
--------------------------------------------------------------------------------
1 | // Clang Build Analyzer https://github.com/aras-p/ClangBuildAnalyzer
2 | // SPDX-License-Identifier: Unlicense
3 | #pragma once
4 |
5 | #include
6 |
7 | #include "BuildEvents.h"
8 |
9 | void DoAnalysis(const BuildEvents& events, BuildNames& names, std::string& out);
10 |
--------------------------------------------------------------------------------
/kram-profile/CBA/Arena.cpp:
--------------------------------------------------------------------------------
1 | // Clang Build Analyzer https://github.com/aras-p/ClangBuildAnalyzer
2 | // SPDX-License-Identifier: Unlicense
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | struct ArenaBlock
9 | {
10 | uint8_t* buffer;
11 | size_t bufferSize;
12 | size_t used;
13 | };
14 |
15 | static std::vector s_Blocks;
16 |
17 | const size_t kDefaultBlockSize = 65536;
18 |
19 |
20 | void ArenaInitialize()
21 | {
22 | }
23 |
24 | void ArenaDelete()
25 | {
26 | for (auto& b : s_Blocks)
27 | delete[] b.buffer;
28 | s_Blocks.clear();
29 | }
30 |
31 | void* ArenaAllocate(size_t size)
32 | {
33 | // do we need a new block?
34 | if (s_Blocks.empty() || s_Blocks.back().used + size > s_Blocks.back().bufferSize)
35 | {
36 | ArenaBlock block;
37 | block.bufferSize = std::max(size, kDefaultBlockSize);
38 | block.buffer = new uint8_t[block.bufferSize];
39 | block.used = 0;
40 | s_Blocks.emplace_back(block);
41 | }
42 |
43 | // allocate from the last block
44 | ArenaBlock& b = s_Blocks.back();
45 | void* ptr = b.buffer + b.used;
46 | b.used += size;
47 | return ptr;
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/kram-profile/CBA/Arena.h:
--------------------------------------------------------------------------------
1 | // Clang Build Analyzer https://github.com/aras-p/ClangBuildAnalyzer
2 | // SPDX-License-Identifier: Unlicense
3 | #pragma once
4 |
5 | void ArenaInitialize();
6 | void ArenaDelete();
7 | void* ArenaAllocate(size_t size);
8 |
--------------------------------------------------------------------------------
/kram-profile/CBA/CBA.h:
--------------------------------------------------------------------------------
1 | #import "Foundation/Foundation.h"
2 |
3 | @interface CBA : NSObject
4 |
5 | - (_Nonnull instancetype)init;
6 | - (void)deinit;
7 |
8 | // Can parseAll or one file at time
9 | - (void)parse:(NSData* _Nonnull)file filename:(NSString* _Nonnull)filename;
10 | - (void)parseAll:(NSArray * _Nonnull)files filenames:(NSArray * _Nonnull)filenames;
11 |
12 | // This isn't so useful, since need specific files to parse
13 | - (NSString* _Nonnull)analyzeAll;
14 | - (NSString* _Nonnull)analyze:(NSArray * _Nonnull)filenames;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/kram-profile/CBA/Utils.h:
--------------------------------------------------------------------------------
1 | // Clang Build Analyzer https://github.com/aras-p/ClangBuildAnalyzer
2 | // SPDX-License-Identifier: Unlicense
3 | #pragma once
4 | #include
5 | #include
6 |
7 | namespace utils
8 | {
9 | [[nodiscard]] std::string GetNicePath(const std::string_view& path);
10 | [[nodiscard]] std::string_view GetFilename(const std::string_view& path);
11 |
12 | [[nodiscard]] bool IsHeader(std::string_view path);
13 |
14 | /*
15 | void Lowercase(std::string& path);
16 |
17 | [[nodiscard]] bool BeginsWith(const std::string& str, const std::string& prefix);
18 | */
19 | [[nodiscard]] bool EndsWith(const std::string_view& str, const std::string& suffix);
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/kram-profile/Source/KramZipHelperW.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #import
4 |
5 | typedef struct ZipEntryW {
6 | const char* _Nonnull filename; // max 512, aliased
7 | int32_t fileIndex;
8 |
9 | // attributes
10 | uint64_t uncompressedSize;
11 | uint64_t compressedSize;
12 | int32_t modificationDate;
13 | uint32_t crc32;
14 | } ZipEntryW;
15 |
16 | // Use this to bridge the C++ over to Swift for now
17 | // TODO: form a clang module and reference C++ directly
18 | @interface ZipHelperW : NSObject
19 | - (nonnull instancetype)initWithData:(nonnull NSData*)data;
20 |
21 | // extract the data. Can alias into the file.
22 | - (nullable NSData*)extract:(nonnull const char*)filename;
23 |
24 | // pass back vector this way for now, should be property
25 | - (nonnull const ZipEntryW*)zipEntrys;
26 |
27 | - (NSInteger)zipEntrysCount;
28 |
29 | // This isn't the fileIndex, but uses count above to avoid needing to do unsafe
30 | - (ZipEntryW)zipEntry:(NSInteger)index;
31 |
32 | // retrieve an entry by filename
33 | - (ZipEntryW)zipEntryByName:(nonnull const char*)name;
34 |
35 | @end
36 |
37 | // This is only needed for OptFunction and backend names
38 | const char* _Nullable demangleSymbolName(const char* _Nonnull symbolName_);
39 |
40 | // This is really the only call needed out of CBA
41 | // Convert templated code to collapsed name so get more correspondence in map.
42 | const char* _Nullable collapseFunctionName(const char* _Nonnull name_);
43 |
--------------------------------------------------------------------------------
/kram-profile/Source/KramZipHelperW.mm:
--------------------------------------------------------------------------------
1 | #include "KramZipHelperW.h"
2 |
3 | #include "KramZipHelper.h"
4 |
5 | using namespace kram;
6 |
7 | @implementation ZipHelperW {
8 | ZipHelper _helper;
9 | }
10 |
11 | - (nonnull instancetype)initWithData:(nonnull NSData*)data
12 | {
13 | _helper.openForRead((const uint8_t*)data.bytes, data.length);
14 | return self;
15 | }
16 |
17 | - (nullable NSData*)extract:(nonnull const char*)filename
18 | {
19 | NSData* data = nil;
20 |
21 | auto entry = _helper.zipEntry(filename);
22 | if (!entry) {
23 | return nil;
24 | }
25 |
26 | bool isCompressed = entry->uncompressedSize != entry->compressedSize;
27 | if (isCompressed) {
28 | // this allocates memory
29 | data = [NSMutableData dataWithLength:entry->uncompressedSize];
30 | _helper.extract(filename, (uint8_t*)data.bytes, data.length);
31 | }
32 | else {
33 | const uint8_t* bytes = nullptr;
34 | uint64_t bytesLength = 0;
35 |
36 | // this aliases the archive
37 | _helper.extractRaw(filename, &bytes, bytesLength);
38 | data = [NSData dataWithBytesNoCopy:(void*)bytes length:bytesLength freeWhenDone:NO];
39 | }
40 |
41 | return data;
42 | }
43 |
44 | // Need this for the list data
45 | - (nonnull const ZipEntryW*)zipEntrys
46 | {
47 | return (const ZipEntryW*)_helper.zipEntrys().data();
48 | }
49 | - (NSInteger)zipEntrysCount
50 | {
51 | return _helper.zipEntrys().size();
52 | }
53 |
54 | - (ZipEntryW)zipEntry:(NSInteger)index
55 | {
56 | return *(const ZipEntryW*)&_helper.zipEntrys()[index];
57 | }
58 |
59 | - (ZipEntryW)zipEntryByName:(nonnull const char*)name
60 | {
61 | // DONE: fix to return a dummy type, since zips can be missing files
62 | // from one iteration to the next.
63 | static ZipEntryW nilEntry = {""};
64 | const ZipEntry* entry = _helper.zipEntry(name);
65 | if (entry) {
66 | return *(const ZipEntryW*)entry;
67 | }
68 | else {
69 | return nilEntry;
70 | }
71 | }
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/kram-profile/Source/kram-profile-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #include "CBA.h"
6 | #include "KramZipHelperW.h"
7 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "scale" : "1x",
6 | "size" : "16x16"
7 | },
8 | {
9 | "filename" : "Icon-32 1.png",
10 | "idiom" : "mac",
11 | "scale" : "2x",
12 | "size" : "16x16"
13 | },
14 | {
15 | "filename" : "Icon-32.png",
16 | "idiom" : "mac",
17 | "scale" : "1x",
18 | "size" : "32x32"
19 | },
20 | {
21 | "filename" : "Icon-64.png",
22 | "idiom" : "mac",
23 | "scale" : "2x",
24 | "size" : "32x32"
25 | },
26 | {
27 | "filename" : "Icon-128.png",
28 | "idiom" : "mac",
29 | "scale" : "1x",
30 | "size" : "128x128"
31 | },
32 | {
33 | "filename" : "Icon-256 1.png",
34 | "idiom" : "mac",
35 | "scale" : "2x",
36 | "size" : "128x128"
37 | },
38 | {
39 | "filename" : "Icon-256.png",
40 | "idiom" : "mac",
41 | "scale" : "1x",
42 | "size" : "256x256"
43 | },
44 | {
45 | "filename" : "Icon-512 1.png",
46 | "idiom" : "mac",
47 | "scale" : "2x",
48 | "size" : "256x256"
49 | },
50 | {
51 | "filename" : "Icon-512.png",
52 | "idiom" : "mac",
53 | "scale" : "1x",
54 | "size" : "512x512"
55 | },
56 | {
57 | "filename" : "Icon-1024.png",
58 | "idiom" : "mac",
59 | "scale" : "2x",
60 | "size" : "512x512"
61 | }
62 | ],
63 | "info" : {
64 | "author" : "xcode",
65 | "version" : 1
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-1024.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-128.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-256 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-256 1.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-256.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-32 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-32 1.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-32.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-512 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-512 1.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-512.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kram-profile/kram-profile/Assets.xcassets/AppIcon.appiconset/Icon-64.png
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/FileList.swift:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/kram-profile/kram-profile/kram_profile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 | com.apple.security.network.client
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/kram-thumb-win/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | # dll output can be renamed for debug vs. release, but is hard to debug
3 | set(myTargetLib kram-thumb-win)
4 |
5 | # caller already set all this
6 | # project(${myTargetLib} LANGUAGES CXX)
7 |
8 | set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /NODEFAULTLIB:LIBCMT")
9 | set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/KramThumbProvider.def /NODEFAULTLIB:LIBCMT")
10 |
11 | set(SOURCE_FILES
12 | Dll.cpp
13 | Dll.rc
14 | KramThumbProvider.cpp
15 | )
16 |
17 | # Module is a DLL library
18 | add_library(${myTargetLib} MODULE ${SOURCE_FILES})
19 |
20 | # This doesn't work for dll based viewer
21 | # Use the static linked libs, or the exe needs the VCRuntimeDLL installed
22 | # This has to occur after library defined above.
23 | # set_property(TARGET ${myTargetLib} PROPERTY
24 | # MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")
25 |
26 | # to turn off exceptions/rtti use /GR and /EHsc replacement
27 | string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
28 | string(REGEX REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
29 |
30 | # all warnings, AVX2, and multiprocess compiles
31 | target_compile_options(${myTargetLib} PRIVATE /W3 -march=haswell -mf16c -mfma /MP /GF /FC)
32 |
33 | target_compile_definitions(${myTargetLib} PRIVATE -D_ITERATOR_DEBUG_LEVEL=0 -D_HAS_EXCEPTIONS=0 -DUNICODE -D_UNICODE)
34 |
35 | if (CMAKE_BUILD_TYPE EQUAL "Debug")
36 | target_compile_definitions(${myTargetLib} PRIVATE "/INCREMENTAL")
37 |
38 | elseif (CMAKE_BUILD_TYPE EQUAL "Release")
39 | # only dead strip on Release builds since this disables Incremental linking, may want Profile build that doesn't use this
40 | target_compile_definitions(${myTargetLib} PRIVATE "/OPT:REF")
41 | endif()
42 |
43 | target_link_libraries(${myTargetLib} PRIVATE shlwapi.lib libkram)
44 |
--------------------------------------------------------------------------------
/kram-thumb-win/Dll.rc:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #ifndef DEBUG
4 | #define VER_DEBUG 0
5 | #else
6 | #define VER_DEBUG VS_FF_DEBUG
7 | #endif
8 |
9 | VS_VERSION_INFO VERSIONINFO
10 | FILEVERSION 0,0,2,0
11 | PRODUCTVERSION 0,0,2,0
12 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
13 | FILEFLAGS VER_DEBUG
14 | FILEOS VOS__WINDOWS32
15 | FILETYPE VFT_DLL
16 | FILESUBTYPE VFT2_UNKNOWN
17 | BEGIN
18 | BLOCK "StringFileInfo"
19 | BEGIN
20 | BLOCK "040904E4"
21 | BEGIN
22 | VALUE "CompanyName", "ba"
23 | VALUE "FileDescription", "Kram Thumbnail Provider"
24 | VALUE "FileVersion", "0.0.2.0"
25 | VALUE "InternalName", "KramThumbProvider.dll"
26 | VALUE "LegalCopyright", "2023, Alec Miller"
27 | VALUE "LegalTrademarks1", ""
28 | VALUE "LegalTrademarks2", ""
29 | VALUE "OriginalFilename", "KramThumbProvider.dll"
30 | VALUE "ProductName", "KramThumbProvider"
31 | VALUE "ProductVersion", "0, 0, 2, 0"
32 | END
33 | END
34 | BLOCK "VarFileInfo"
35 | BEGIN
36 | VALUE "Translation", 0x409, 1200
37 | END
38 | END
--------------------------------------------------------------------------------
/kram-thumb-win/KramThumbProvider.def:
--------------------------------------------------------------------------------
1 | EXPORTS
2 | DllGetClassObject PRIVATE
3 | DllCanUnloadNow PRIVATE
4 | DllRegisterServer PRIVATE
5 | DllUnregisterServer PRIVATE
6 | DllMain PRIVATE
7 |
--------------------------------------------------------------------------------
/kram-thumb-win/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 iOrange
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 |
--------------------------------------------------------------------------------
/kram-thumb-win/README.md:
--------------------------------------------------------------------------------
1 | # kram-thumb-win.dll
2 |
3 | Windows thumbnailer for DDS/KTX/KTX2 containers in C++. To use the thumbnailer:
4 |
5 | * Go to build or bin folder.
6 | * Install "regsvr32.exe kram-thumb-win.dll".
7 | * Uninstall "regsvr32.exe /u kram-thumb-win.dll"
8 |
9 | # About kram thumbnailer
10 |
11 | The thumbnailer dll runs the same libkram decoders that kramv thumbnailer uses for macOS. An ancient Win7 thumbnil service calls over to the dll. The Microsoft service harkens back to Win7, was last updated in vista, and their sample didn't work off github. So thankfully a dev on github can cleaned all this up.
12 |
13 | A sanitized stream of bytes is supplied by the Explorer thumbnail service to the dll, the dll uses libkram to decode the image container to a single image, and returns the closest mip as a bitmap to the service. The bitmap is assumed to be sRGB, but there are few details or settings. Explorer caches the thumbnails. Windows also seems to generate thumbnails when apps are tied to specific extensions.
14 |
15 | For some reason, Microsoft doesn't upscale small 2x2 thumbnails. These show up as barely visible dots despite a request for a 32x32 pixel. macOS does upscale these so they are viewable.
16 |
17 | These are the default thumbnail sizes that are subject to change. Note that Microsoft bases dpi off multiples of 96, where macOS uses 72.
18 |
19 | * 32x32
20 | * 96x96
21 | * 256x256
22 | * 1024x1024
23 |
24 | Adapted from Microsoft sample code that iOrange cleaned to generate thumbnails for QOI images.
25 |
26 | https://github.com/iOrange/QOIThumbnailProvider
27 |
28 | This code doesn't work and the ability to run this as an exe don't seem to be present.
29 |
30 | https://learn.microsoft.com/en-us/samples/microsoft/windows-classic-samples/recipethumbnailprovider/
31 |
32 |
--------------------------------------------------------------------------------
/kram-thumb-win/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Dll.rc
4 | //
5 | #define VER_DEBUG 0
6 | #define VS_VERSION_INFO 1
7 | #define IDC_STATIC -1
8 |
9 | // Next default values for new objects
10 | //
11 | #ifdef APSTUDIO_INVOKED
12 | #ifndef APSTUDIO_READONLY_SYMBOLS
13 | #define _APS_NEXT_RESOURCE_VALUE 101
14 | #define _APS_NEXT_COMMAND_VALUE 40001
15 | #define _APS_NEXT_CONTROL_VALUE 1000
16 | #define _APS_NEXT_SYMED_VALUE 101
17 | #endif
18 | #endif
19 |
--------------------------------------------------------------------------------
/kram-thumb/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | kram-thumb
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | QLSupportedContentTypes
30 |
31 | org.khronos.ktx
32 | public.ktx2
33 | image/dds
34 | public.png
35 |
36 | QLThumbnailMinimumDimension
37 | 0
38 |
39 | NSExtensionPointIdentifier
40 | com.apple.quicklook.thumbnail
41 | NSExtensionPrincipalClass
42 | KramThumbnailProvider
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/kram-thumb/KramThumbnailProvider.h:
--------------------------------------------------------------------------------
1 | // kram - Copyright 2020-2025 by Alec Miller. - MIT License
2 | // The license and copyright notice shall be included
3 | // in all copies or substantial portions of the Software.
4 |
5 | #import
6 |
7 | NS_ASSUME_NONNULL_BEGIN
8 |
9 | @interface KramThumbnailProvider : QLThumbnailProvider
10 |
11 | @end
12 |
13 | NS_ASSUME_NONNULL_END
14 |
--------------------------------------------------------------------------------
/kram-thumb/kram_thumb.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "scale" : "1x",
6 | "size" : "16x16"
7 | },
8 | {
9 | "filename" : "Icon-32 1.png",
10 | "idiom" : "mac",
11 | "scale" : "2x",
12 | "size" : "16x16"
13 | },
14 | {
15 | "filename" : "Icon-32.png",
16 | "idiom" : "mac",
17 | "scale" : "1x",
18 | "size" : "32x32"
19 | },
20 | {
21 | "filename" : "Icon-64.png",
22 | "idiom" : "mac",
23 | "scale" : "2x",
24 | "size" : "32x32"
25 | },
26 | {
27 | "filename" : "Icon-128.png",
28 | "idiom" : "mac",
29 | "scale" : "1x",
30 | "size" : "128x128"
31 | },
32 | {
33 | "filename" : "Icon-256 1.png",
34 | "idiom" : "mac",
35 | "scale" : "2x",
36 | "size" : "128x128"
37 | },
38 | {
39 | "filename" : "Icon-256.png",
40 | "idiom" : "mac",
41 | "scale" : "1x",
42 | "size" : "256x256"
43 | },
44 | {
45 | "filename" : "Icon-512 1.png",
46 | "idiom" : "mac",
47 | "scale" : "2x",
48 | "size" : "256x256"
49 | },
50 | {
51 | "filename" : "Icon-512.png",
52 | "idiom" : "mac",
53 | "scale" : "1x",
54 | "size" : "512x512"
55 | },
56 | {
57 | "filename" : "Icon-1024.png",
58 | "idiom" : "mac",
59 | "scale" : "2x",
60 | "size" : "512x512"
61 | }
62 | ],
63 | "info" : {
64 | "author" : "xcode",
65 | "version" : 1
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-1024.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-128.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-256 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-256 1.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-256.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-32 1.png:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:5f22c4dc90c013e14aedb31e25c5480dcfd5a49b7d7a2607fdadb3bdcf0bf602
3 | size 1498
4 |
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-32.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-512 1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-512 1.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-512.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/AppIcon.appiconset/Icon-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alecazam/kram/065e2f804d455b8e71b1c4895de06fabe79f2095/kramv/Assets.xcassets/AppIcon.appiconset/Icon-64.png
--------------------------------------------------------------------------------
/kramv/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/kramv/Textures/piazza_san_marco.ktx:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:f82bd492c978b4f3635c1ce8af0c543dc4ae118568f82209fde13472b908a82e
3 | size 16777284
4 |
--------------------------------------------------------------------------------
/kramv/Textures/tropical_beach.ktx:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:ec461d7a52169a108f677fb2646180479e9a97a0ce80242df14ca9fadb0ebd54
3 | size 16777284
4 |
--------------------------------------------------------------------------------
/kramv/kramv.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/libkram/ate/ateencoder.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if COMPILE_ATE
4 |
5 | #include
6 |
7 | namespace kram {
8 |
9 | class KTXHeader;
10 |
11 | // ATE = AppleTextureEncoder.
12 | // This was limited to ASTC 4x4 and 8x8 encoding, but has expanded to include BC1/4/5/7 encoders.
13 | // Available on macOS and iOS, but newer OS is needed for newer encoders.
14 | class ATEEncoder {
15 | public:
16 | ATEEncoder();
17 |
18 | bool isBCSupported() const { return _isBCSupported; }
19 | bool isHDRDecodeSupported() const { return _isHDRDecodeSupported; }
20 |
21 | bool Encode(uint32_t metalPixelFormat, size_t dstDataSize, int32_t blockDimsY,
22 | bool hasAlpha, bool weightChannels,
23 | bool isVerbose, int32_t quality,
24 | int32_t width, int32_t height, const uint8_t* srcData, uint8_t* dstData);
25 |
26 | bool Decode(uint32_t metalPixelFormat, size_t dstDataSize, int32_t blockDimsY,
27 | bool isVerbose,
28 | int32_t width, int32_t height, const uint8_t* srcData, uint8_t* dstData);
29 |
30 | private:
31 | // encode and decode
32 | bool _isBCSupported = false;
33 |
34 | // astc hdr is only decode currently, also bc hdr formats didn't decode
35 | bool _isHDRDecodeSupported = false;
36 | };
37 |
38 |
39 | } // namespace
40 |
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/libkram/cgltf/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018-2021 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 |
--------------------------------------------------------------------------------
/libkram/compressonator/bc6h/bc6h_decode.h:
--------------------------------------------------------------------------------
1 | //===============================================================================
2 | // Copyright (c) 2014-2016 Advanced Micro Devices, Inc. All rights reserved.
3 | //===============================================================================
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
13 | // all copies or substantial portions of the Software.
14 | //
15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | // THE SOFTWARE.
22 | //
23 | //////////////////////////////////////////////////////////////////////////////////
24 |
25 | #pragma once
26 | //#ifndef _BC6H_DECODE_H_
27 | //#define _BC6H_DECODE_H_
28 |
29 | #include
30 | //#include "bc6h_library.h"
31 | #include "bc6h_definitions.h"
32 |
33 | class BC6HBlockDecoder {
34 | public:
35 | BC6HBlockDecoder() {};
36 | ~BC6HBlockDecoder() {};
37 | void DecompressBlock(float out[MAX_SUBSET_SIZE][MAX_DIMENSION_BIG], BYTE in[BC6H_COMPRESSED_BLOCK_SIZE]);
38 |
39 | bool bc6signed = false; // this is suppiled by user for compression for SIGNED_F16 or UNSIGNED_F16 or obtained during decompression
40 |
41 | };
42 |
43 |
44 | //#endif
45 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EABase/earesult.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------------
2 | * earesult.h
3 | *
4 | * Copyright (c) Electronic Arts Inc. All rights reserved.
5 | *---------------------------------------------------------------------------*/
6 |
7 |
8 | #pragma once
9 |
10 | #include
11 |
12 |
13 | /* This result type is width-compatible with most systems. */
14 | typedef int32_t ea_result_type;
15 |
16 |
17 | namespace EA
18 | {
19 | typedef int32_t result_type;
20 |
21 | enum
22 | {
23 | #ifndef SUCCESS
24 | // Deprecated
25 | // Note: a public MS header has created a define of this name which causes a build error. Fortunately they
26 | // define it to 0 which is compatible.
27 | // see: WindowsSDK\8.1.51641-fb\installed\Include\um\RasError.h
28 | SUCCESS = 0,
29 | #endif
30 | // Deprecated
31 | FAILURE = -1,
32 |
33 | // These values are now the preferred constants
34 | EA_SUCCESS = 0,
35 | EA_FAILURE = -1,
36 | };
37 | }
38 |
39 |
40 | /* Macro to simplify testing for success. */
41 | #ifndef EA_SUCCEEDED
42 | #define EA_SUCCEEDED(result) ((result) >= 0)
43 | #endif
44 |
45 | /* Macro to simplfify testing for general failure. */
46 | #ifndef EA_FAILED
47 | #define EA_FAILED(result) ((result) < 0)
48 | #endif
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EABase/eaunits.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------------
2 | * eaunits.h
3 | *
4 | * Copyright (c) Electronic Arts Inc. All rights reserved.
5 | *---------------------------------------------------------------------------*/
6 |
7 |
8 | #pragma once
9 |
10 | #include
11 |
12 | // Defining common SI unit macros.
13 | //
14 | // The mebibyte is a multiple of the unit byte for digital information. Technically a
15 | // megabyte (MB) is a power of ten, while a mebibyte (MiB) is a power of two,
16 | // appropriate for binary machines. Many Linux distributions use the unit, but it is
17 | // not widely acknowledged within the industry or media.
18 | // Reference: https://en.wikipedia.org/wiki/Mebibyte
19 | //
20 | // Examples:
21 | // auto size1 = EA_KILOBYTE(16);
22 | // auto size2 = EA_MEGABYTE(128);
23 | // auto size3 = EA_MEBIBYTE(8);
24 | // auto size4 = EA_GIBIBYTE(8);
25 |
26 | // define byte for completeness
27 | #define EA_BYTE(x) (x)
28 |
29 | // Decimal SI units
30 | #define EA_KILOBYTE(x) (size_t(x) * 1000)
31 | #define EA_MEGABYTE(x) (size_t(x) * 1000 * 1000)
32 | #define EA_GIGABYTE(x) (size_t(x) * 1000 * 1000 * 1000)
33 | #define EA_TERABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000)
34 | #define EA_PETABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000)
35 | #define EA_EXABYTE(x) (size_t(x) * 1000 * 1000 * 1000 * 1000 * 1000 * 1000)
36 |
37 | // Binary SI units
38 | #define EA_KIBIBYTE(x) (size_t(x) * 1024)
39 | #define EA_MEBIBYTE(x) (size_t(x) * 1024 * 1024)
40 | #define EA_GIBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024)
41 | #define EA_TEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024)
42 | #define EA_PEBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024)
43 | #define EA_EXBIBYTE(x) (size_t(x) * 1024 * 1024 * 1024 * 1024 * 1024 * 1024)
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EABase/version.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------------
2 | * version.h
3 | *
4 | * Copyright (c) Electronic Arts Inc. All rights reserved.
5 | *---------------------------------------------------------------------------*/
6 |
7 | #pragma once
8 |
9 | ///////////////////////////////////////////////////////////////////////////////
10 | // EABASE_VERSION
11 | //
12 | // We more or less follow the conventional EA packaging approach to versioning
13 | // here. A primary distinction here is that minor versions are defined as two
14 | // digit entities (e.g. .03") instead of minimal digit entities ".3"). The logic
15 | // here is that the value is a counter and not a floating point fraction.
16 | // Note that the major version doesn't have leading zeros.
17 | //
18 | // Example version strings:
19 | // "0.91.00" // Major version 0, minor version 91, patch version 0.
20 | // "1.00.00" // Major version 1, minor and patch version 0.
21 | // "3.10.02" // Major version 3, minor version 10, patch version 02.
22 | // "12.03.01" // Major version 12, minor version 03, patch version
23 | //
24 | // Example usage:
25 | // printf("EABASE version: %s", EABASE_VERSION);
26 | // printf("EABASE version: %d.%d.%d", EABASE_VERSION_N / 10000 % 100, EABASE_VERSION_N / 100 % 100, EABASE_VERSION_N % 100);
27 | //
28 | ///////////////////////////////////////////////////////////////////////////////
29 |
30 | #ifndef EABASE_VERSION
31 | #define EABASE_VERSION "2.09.12"
32 | #define EABASE_VERSION_N 20912
33 | #endif
34 |
35 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/bonus/fixed_ring_buffer.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | namespace eastl
12 | {
13 |
14 | /// fixed_ring_buffer
15 | ///
16 | /// This is a convenience template alias for creating a fixed-sized
17 | /// ring_buffer using eastl::fixed_vector as its storage container. This has
18 | /// been tricky for users to get correct due to the constructor requirements
19 | /// of eastl::ring_buffer leaking the implementation detail of the sentinel
20 | /// value being used internally. In addition, it was not obvious what the
21 | /// correct allocator_type template parameter should be used for containers
22 | /// providing both a default allocator type and an overflow allocator type.
23 | ///
24 | /// We are over-allocating the fixed_vector container to accommodate the
25 | /// ring_buffer sentinel to prevent that implementation detail leaking into
26 | /// user code.
27 | ///
28 | /// Example usage:
29 | ///
30 | /// fixed_ring_buffer rb = {0, 1, 2, 3, 4, 5, 6, 7};
31 | /// or
32 | /// fixed_ring_buffer rb(8); // capacity doesn't need to respect sentinel
33 | /// rb.push_back(0);
34 | ///
35 | ///
36 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
37 | template
38 | using fixed_ring_buffer =
39 | ring_buffer, typename fixed_vector::overflow_allocator_type>;
40 | #endif
41 |
42 | } // namespace eastl
43 |
44 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // Include the architecture specific implementations
11 | //
12 | #if defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)
13 |
14 | #include "x86/arch_x86.h"
15 |
16 | #elif defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64)
17 |
18 | #include "arm/arch_arm.h"
19 |
20 | #endif
21 |
22 |
23 | /////////////////////////////////////////////////////////////////////////////////
24 |
25 |
26 | #include "arch_fetch_add.h"
27 | #include "arch_fetch_sub.h"
28 |
29 | #include "arch_fetch_and.h"
30 | #include "arch_fetch_xor.h"
31 | #include "arch_fetch_or.h"
32 |
33 | #include "arch_add_fetch.h"
34 | #include "arch_sub_fetch.h"
35 |
36 | #include "arch_and_fetch.h"
37 | #include "arch_xor_fetch.h"
38 | #include "arch_or_fetch.h"
39 |
40 | #include "arch_exchange.h"
41 |
42 | #include "arch_cmpxchg_weak.h"
43 | #include "arch_cmpxchg_strong.h"
44 |
45 | #include "arch_load.h"
46 | #include "arch_store.h"
47 |
48 | #include "arch_compiler_barrier.h"
49 |
50 | #include "arch_cpu_pause.h"
51 |
52 | #include "arch_memory_barrier.h"
53 |
54 | #include "arch_signal_fence.h"
55 |
56 | #include "arch_thread_fence.h"
57 |
58 |
59 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch_compiler_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | #define EASTL_ARCH_ATOMIC_COMPILER_BARRIER_AVAILABLE 0
9 |
10 | #define EASTL_ARCH_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 0
11 |
12 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch_cpu_pause.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // copyright (c) electronic arts inc. all rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_ARCH_ATOMIC_CPU_PAUSE()
11 | //
12 | #if defined(EASTL_ARCH_ATOMIC_CPU_PAUSE)
13 | #define EASTL_ARCH_ATOMIC_CPU_PAUSE_AVAILABLE 1
14 | #else
15 | #define EASTL_ARCH_ATOMIC_CPU_PAUSE_AVAILABLE 0
16 | #endif
17 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch_memory_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_ARCH_ATOMIC_CPU_MB()
12 | //
13 | #if defined(EASTL_ARCH_ATOMIC_CPU_MB)
14 | #define EASTL_ARCH_ATOMIC_CPU_MB_AVAILABLE 1
15 | #else
16 | #define EASTL_ARCH_ATOMIC_CPU_MB_AVAILABLE 0
17 | #endif
18 |
19 |
20 | /////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // void EASTL_ARCH_ATOMIC_CPU_WMB()
23 | //
24 | #if defined(EASTL_ARCH_ATOMIC_CPU_WMB)
25 | #define EASTL_ARCH_ATOMIC_CPU_WMB_AVAILABLE 1
26 | #else
27 | #define EASTL_ARCH_ATOMIC_CPU_WMB_AVAILABLE 0
28 | #endif
29 |
30 |
31 | /////////////////////////////////////////////////////////////////////////////////
32 | //
33 | // void EASTL_ARCH_ATOMIC_CPU_RMB()
34 | //
35 | #if defined(EASTL_ARCH_ATOMIC_CPU_RMB)
36 | #define EASTL_ARCH_ATOMIC_CPU_RMB_AVAILABLE 1
37 | #else
38 | #define EASTL_ARCH_ATOMIC_CPU_RMB_AVAILABLE 0
39 | #endif
40 |
41 |
42 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch_signal_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_RELAXED_AVAILABLE 0
9 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_ACQUIRE_AVAILABLE 0
10 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_RELEASE_AVAILABLE 0
11 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_ACQ_REL_AVAILABLE 0
12 | #define EASTL_ARCH_ATOMIC_SIGNAL_FENCE_SEQ_CST_AVAILABLE 0
13 |
14 |
15 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/arch/arch_thread_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | /////////////////////////////////////////////////////////////////////////////////
8 | //
9 | // void EASTL_ARCH_ATOMIC_THREAD_FENCE_*()
10 | //
11 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED)
12 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 1
13 | #else
14 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 0
15 | #endif
16 |
17 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE)
18 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 1
19 | #else
20 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 0
21 | #endif
22 |
23 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE)
24 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 1
25 | #else
26 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 0
27 | #endif
28 |
29 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL)
30 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 1
31 | #else
32 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 0
33 | #endif
34 |
35 | #if defined(EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST)
36 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 1
37 | #else
38 | #define EASTL_ARCH_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 0
39 | #endif
40 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_flag_standalone.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | namespace eastl
10 | {
11 |
12 |
13 | ////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // bool atomic_flag_test_and_set(eastl::atomic*)
16 | //
17 | EASTL_FORCE_INLINE bool atomic_flag_test_and_set(eastl::atomic_flag* atomicObj) EA_NOEXCEPT
18 | {
19 | return atomicObj->test_and_set();
20 | }
21 |
22 | template
23 | EASTL_FORCE_INLINE bool atomic_flag_test_and_set_explicit(eastl::atomic_flag* atomicObj, Order order)
24 | {
25 | return atomicObj->test_and_set(order);
26 | }
27 |
28 |
29 | ////////////////////////////////////////////////////////////////////////////////
30 | //
31 | // bool atomic_flag_clear(eastl::atomic*)
32 | //
33 | EASTL_FORCE_INLINE void atomic_flag_clear(eastl::atomic_flag* atomicObj)
34 | {
35 | atomicObj->clear();
36 | }
37 |
38 | template
39 | EASTL_FORCE_INLINE void atomic_flag_clear_explicit(eastl::atomic_flag* atomicObj, Order order)
40 | {
41 | atomicObj->clear(order);
42 | }
43 |
44 |
45 | ////////////////////////////////////////////////////////////////////////////////
46 | //
47 | // bool atomic_flag_test(eastl::atomic*)
48 | //
49 | EASTL_FORCE_INLINE bool atomic_flag_test(eastl::atomic_flag* atomicObj)
50 | {
51 | return atomicObj->test();
52 | }
53 |
54 | template
55 | EASTL_FORCE_INLINE bool atomic_flag_test_explicit(eastl::atomic_flag* atomicObj, Order order)
56 | {
57 | return atomicObj->test(order);
58 | }
59 |
60 |
61 | } // namespace eastl
62 |
63 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_macros/atomic_macros_compiler_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_ATOMIC_COMPILER_BARRIER()
12 | //
13 | #define EASTL_ATOMIC_COMPILER_BARRIER() \
14 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_COMPILER_BARRIER)()
15 |
16 |
17 | /////////////////////////////////////////////////////////////////////////////////
18 | //
19 | // void EASTL_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type)
20 | //
21 | #define EASTL_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \
22 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY)(val, type)
23 |
24 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_macros/atomic_macros_cpu_pause.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_ATOMIC_CPU_PAUSE()
12 | //
13 | #define EASTL_ATOMIC_CPU_PAUSE() \
14 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_PAUSE)()
15 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_macros/atomic_macros_memory_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_ATOMIC_CPU_MB()
11 | //
12 | #define EASTL_ATOMIC_CPU_MB() \
13 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_MB)()
14 |
15 |
16 | /////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // void EASTL_ATOMIC_CPU_WMB()
19 | //
20 | #define EASTL_ATOMIC_CPU_WMB() \
21 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_WMB)()
22 |
23 |
24 | /////////////////////////////////////////////////////////////////////////////////
25 | //
26 | // void EASTL_ATOMIC_CPU_RMB()
27 | //
28 | #define EASTL_ATOMIC_CPU_RMB() \
29 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_CPU_RMB)()
30 |
31 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_macros/atomic_macros_signal_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_ATOMIC_SIGNAL_FENCE_*()
11 | //
12 | #define EASTL_ATOMIC_SIGNAL_FENCE_RELAXED() \
13 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_RELAXED)()
14 |
15 | #define EASTL_ATOMIC_SIGNAL_FENCE_ACQUIRE() \
16 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_ACQUIRE)()
17 |
18 | #define EASTL_ATOMIC_SIGNAL_FENCE_RELEASE() \
19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_RELEASE)()
20 |
21 | #define EASTL_ATOMIC_SIGNAL_FENCE_ACQ_REL() \
22 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_ACQ_REL)()
23 |
24 | #define EASTL_ATOMIC_SIGNAL_FENCE_SEQ_CST() \
25 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_SIGNAL_FENCE_SEQ_CST)()
26 |
27 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_macros/atomic_macros_thread_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_ATOMIC_THREAD_FENCE_*()
11 | //
12 | #define EASTL_ATOMIC_THREAD_FENCE_RELAXED() \
13 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_RELAXED)()
14 |
15 | #define EASTL_ATOMIC_THREAD_FENCE_ACQUIRE() \
16 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_ACQUIRE)()
17 |
18 | #define EASTL_ATOMIC_THREAD_FENCE_RELEASE() \
19 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_RELEASE)()
20 |
21 | #define EASTL_ATOMIC_THREAD_FENCE_ACQ_REL() \
22 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_ACQ_REL)()
23 |
24 | #define EASTL_ATOMIC_THREAD_FENCE_SEQ_CST() \
25 | EASTL_ATOMIC_CHOOSE_OP_IMPL(ATOMIC_THREAD_FENCE_SEQ_CST)()
26 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_memory_order.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | namespace eastl
9 | {
10 |
11 |
12 | namespace internal
13 | {
14 |
15 |
16 | struct memory_order_relaxed_s {};
17 | struct memory_order_read_depends_s {};
18 | struct memory_order_acquire_s {};
19 | struct memory_order_release_s {};
20 | struct memory_order_acq_rel_s {};
21 | struct memory_order_seq_cst_s {};
22 |
23 |
24 | } // namespace internal
25 |
26 |
27 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_relaxed = internal::memory_order_relaxed_s{};
28 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_read_depends = internal::memory_order_read_depends_s{};
29 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_acquire = internal::memory_order_acquire_s{};
30 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_release = internal::memory_order_release_s{};
31 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_acq_rel = internal::memory_order_acq_rel_s{};
32 | EASTL_CPP17_INLINE_VARIABLE constexpr auto memory_order_seq_cst = internal::memory_order_seq_cst_s{};
33 |
34 |
35 | } // namespace eastl
36 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_pop_compiler_options.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | /* NOTE: No Header Guard */
7 |
8 |
9 | EA_RESTORE_VC_WARNING();
10 |
11 | EA_RESTORE_CLANG_WARNING();
12 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/atomic_push_compiler_options.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | /* NOTE: No Header Guard */
7 |
8 |
9 | // 'class' : multiple assignment operators specified
10 | EA_DISABLE_VC_WARNING(4522);
11 |
12 | // misaligned atomic operation may incur significant performance penalty
13 | // The above warning is emitted in earlier versions of clang incorrectly.
14 | // All eastl::atomic objects are size aligned.
15 | // This is static and runtime asserted.
16 | // Thus we disable this warning.
17 | EA_DISABLE_CLANG_WARNING(-Watomic-alignment);
18 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/compiler_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER()
12 | //
13 | #if defined(EASTL_COMPILER_ATOMIC_COMPILER_BARRIER)
14 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_AVAILABLE 1
15 | #else
16 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_AVAILABLE 0
17 | #endif
18 |
19 |
20 | /////////////////////////////////////////////////////////////////////////////////
21 | //
22 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type)
23 | //
24 | #if defined(EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY)
25 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 1
26 | #else
27 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_AVAILABLE 0
28 | #endif
29 |
30 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/compiler_cpu_pause.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE()
12 | //
13 | #if defined(EASTL_COMPILER_ATOMIC_CPU_PAUSE)
14 |
15 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE_AVAILABLE 1
16 |
17 | #else
18 |
19 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \
20 | ((void)0)
21 |
22 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE_AVAILABLE 1
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/compiler_memory_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_COMPILER_ATOMIC_CPU_MB()
11 | //
12 | #if defined(EASTL_COMPILER_ATOMIC_CPU_MB)
13 | #define EASTL_COMPILER_ATOMIC_CPU_MB_AVAILABLE 1
14 | #else
15 | #define EASTL_COMPILER_ATOMIC_CPU_MB_AVAILABLE 0
16 | #endif
17 |
18 |
19 | /////////////////////////////////////////////////////////////////////////////////
20 | //
21 | // void EASTL_COMPILER_ATOMIC_CPU_WMB()
22 | //
23 | #if defined(EASTL_COMPILER_ATOMIC_CPU_WMB)
24 | #define EASTL_COMPILER_ATOMIC_CPU_WMB_AVAILABLE 1
25 | #else
26 | #define EASTL_COMPILER_ATOMIC_CPU_WMB_AVAILABLE 0
27 | #endif
28 |
29 |
30 | /////////////////////////////////////////////////////////////////////////////////
31 | //
32 | // void EASTL_COMPILER_ATOMIC_CPU_RMB()
33 | //
34 | #if defined(EASTL_COMPILER_ATOMIC_CPU_RMB)
35 | #define EASTL_COMPILER_ATOMIC_CPU_RMB_AVAILABLE 1
36 | #else
37 | #define EASTL_COMPILER_ATOMIC_CPU_RMB_AVAILABLE 0
38 | #endif
39 |
40 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/compiler_signal_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_*()
12 | //
13 | #if defined(EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED)
14 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED_AVAILABLE 1
15 | #else
16 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED_AVAILABLE 0
17 | #endif
18 |
19 | #if defined(EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE)
20 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE_AVAILABLE 1
21 | #else
22 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE_AVAILABLE 0
23 | #endif
24 |
25 | #if defined(EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE)
26 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE_AVAILABLE 1
27 | #else
28 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE_AVAILABLE 0
29 | #endif
30 |
31 | #if defined(EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL)
32 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL_AVAILABLE 1
33 | #else
34 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL_AVAILABLE 0
35 | #endif
36 |
37 | #if defined(EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST)
38 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST_AVAILABLE 1
39 | #else
40 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST_AVAILABLE 0
41 | #endif
42 |
43 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/compiler_thread_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_COMPILER_ATOMIC_THREAD_FENCE_*()
11 | //
12 | #if defined(EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELAXED)
13 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 1
14 | #else
15 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELAXED_AVAILABLE 0
16 | #endif
17 |
18 | #if defined(EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQUIRE)
19 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 1
20 | #else
21 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQUIRE_AVAILABLE 0
22 | #endif
23 |
24 | #if defined(EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELEASE)
25 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 1
26 | #else
27 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELEASE_AVAILABLE 0
28 | #endif
29 |
30 | #if defined(EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQ_REL)
31 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 1
32 | #else
33 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQ_REL_AVAILABLE 0
34 | #endif
35 |
36 | #if defined(EASTL_COMPILER_ATOMIC_THREAD_FENCE_SEQ_CST)
37 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 1
38 | #else
39 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_SEQ_CST_AVAILABLE 0
40 | #endif
41 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER()
11 | //
12 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() \
13 | __asm__ __volatile__ ("" ::: "memory")
14 |
15 |
16 | /////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type)
19 | //
20 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \
21 | __asm__ __volatile__ ("" : /* Output Operands */ : "r"(&(val)) : "memory")
22 |
23 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_cpu_pause.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE()
12 | //
13 | #if defined(EA_PROCESSOR_X86) || defined(EA_PROCESSOR_X86_64)
14 |
15 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \
16 | __asm__ __volatile__ ("pause")
17 |
18 | #elif defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64)
19 |
20 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \
21 | __asm__ __volatile__ ("yield")
22 |
23 | #endif
24 |
25 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_signal_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | #define EASTL_GCC_ATOMIC_SIGNAL_FENCE(gccMemoryOrder) \
10 | __atomic_signal_fence(gccMemoryOrder)
11 |
12 |
13 | /////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // void EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_*()
16 | //
17 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED() \
18 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_RELAXED)
19 |
20 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE() \
21 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_ACQUIRE)
22 |
23 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE() \
24 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_RELEASE)
25 |
26 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL() \
27 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_ACQ_REL)
28 |
29 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST() \
30 | EASTL_GCC_ATOMIC_SIGNAL_FENCE(__ATOMIC_SEQ_CST)
31 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/gcc/compiler_gcc_thread_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | #define EASTL_GCC_ATOMIC_THREAD_FENCE(gccMemoryOrder) \
10 | __atomic_thread_fence(gccMemoryOrder)
11 |
12 |
13 | /////////////////////////////////////////////////////////////////////////////////
14 | //
15 | // void EASTL_COMPILER_ATOMIC_THREAD_FENCE_*()
16 | //
17 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELAXED() \
18 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_RELAXED)
19 |
20 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQUIRE() \
21 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_ACQUIRE)
22 |
23 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_RELEASE() \
24 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_RELEASE)
25 |
26 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_ACQ_REL() \
27 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_ACQ_REL)
28 |
29 | #define EASTL_COMPILER_ATOMIC_THREAD_FENCE_SEQ_CST() \
30 | EASTL_GCC_ATOMIC_THREAD_FENCE(__ATOMIC_SEQ_CST)
31 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_barrier.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER()
11 | //
12 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER() \
13 | _ReadWriteBarrier()
14 |
15 |
16 | /////////////////////////////////////////////////////////////////////////////////
17 | //
18 | // void EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(const T&, type)
19 | //
20 | #define EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY(val, type) \
21 | EASTL_COMPILER_ATOMIC_COMPILER_BARRIER_DATA_DEPENDENCY_FUNC(const_cast(eastl::addressof((val)))); \
22 | EASTL_ATOMIC_COMPILER_BARRIER()
23 |
24 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_cpu_pause.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // copyright (c) electronic arts inc. all rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 |
9 | /////////////////////////////////////////////////////////////////////////////////
10 | //
11 | // void EASTL_COMPILER_ATOMIC_CPU_PAUSE()
12 | //
13 | // NOTE:
14 | // Rather obscure macro in Windows.h that expands to pause or rep; nop on
15 | // compatible x86 cpus or the arm yield on compatible arm processors.
16 | // This is nicer than switching on platform specific intrinsics.
17 | //
18 | #define EASTL_COMPILER_ATOMIC_CPU_PAUSE() \
19 | YieldProcessor()
20 |
21 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/atomic/compiler/msvc/compiler_msvc_signal_fence.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 |
8 | /////////////////////////////////////////////////////////////////////////////////
9 | //
10 | // void EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_*()
11 | //
12 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELAXED() \
13 | EASTL_ATOMIC_COMPILER_BARRIER()
14 |
15 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQUIRE() \
16 | EASTL_ATOMIC_COMPILER_BARRIER()
17 |
18 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_RELEASE() \
19 | EASTL_ATOMIC_COMPILER_BARRIER()
20 |
21 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_ACQ_REL() \
22 | EASTL_ATOMIC_COMPILER_BARRIER()
23 |
24 | #define EASTL_COMPILER_ATOMIC_SIGNAL_FENCE_SEQ_CST() \
25 | EASTL_ATOMIC_COMPILER_BARRIER()
26 |
27 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/function_help.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | namespace eastl
11 | {
12 | namespace internal
13 | {
14 |
15 | //////////////////////////////////////////////////////////////////////
16 | // is_null
17 | //
18 | template
19 | bool is_null(const T&)
20 | {
21 | return false;
22 | }
23 |
24 | template
25 | bool is_null(Result (*const& function_pointer)(Arguments...))
26 | {
27 | return function_pointer == nullptr;
28 | }
29 |
30 | template
31 | bool is_null(Result (Class::*const& function_pointer)(Arguments...))
32 | {
33 | return function_pointer == nullptr;
34 | }
35 |
36 | template
37 | bool is_null(Result (Class::*const& function_pointer)(Arguments...) const)
38 | {
39 | return function_pointer == nullptr;
40 | }
41 |
42 | } // namespace internal
43 | } // namespace eastl
44 |
45 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/memory_base.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | ////////////////////////////////////////////////////////////////////////////////////////////
10 | // This file contains basic functionality found in the standard library 'memory' header that
11 | // have limited or no dependencies. This allows us to utilize these utilize these functions
12 | // in other EASTL code while avoid circular dependencies.
13 | ////////////////////////////////////////////////////////////////////////////////////////////
14 |
15 | namespace eastl
16 | {
17 | /// addressof
18 | ///
19 | /// From the C++11 Standard, section 20.6.12.1
20 | /// Returns the actual address of the object or function referenced by r, even in the presence of an overloaded operator&.
21 | ///
22 | template
23 | T* addressof(T& value) EA_NOEXCEPT
24 | {
25 | return reinterpret_cast(&const_cast(reinterpret_cast(value)));
26 | }
27 |
28 | } // namespace eastl
29 |
30 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/pair_fwd_decls.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | namespace eastl
10 | {
11 | template
12 | struct pair;
13 | }
14 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/piecewise_construct_t.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | #include
9 |
10 | namespace eastl
11 | {
12 | ///////////////////////////////////////////////////////////////////////////////
13 | /// piecewise_construct_t
14 | ///
15 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct_t
16 | ///
17 | struct piecewise_construct_t
18 | {
19 | explicit piecewise_construct_t() = default;
20 | };
21 |
22 |
23 | ///////////////////////////////////////////////////////////////////////////////
24 | /// piecewise_construct
25 | ///
26 | /// A tag type used to disambiguate between function overloads that take two tuple arguments.
27 | ///
28 | /// http://en.cppreference.com/w/cpp/utility/piecewise_construct
29 | ///
30 | EA_CONSTEXPR piecewise_construct_t piecewise_construct = eastl::piecewise_construct_t();
31 |
32 | } // namespace eastl
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/internal/tuple_fwd_decls.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | #if EASTL_TUPLE_ENABLED
10 |
11 | namespace eastl
12 | {
13 | template
14 | class tuple;
15 |
16 | template
17 | class tuple_size;
18 |
19 | template
20 | class tuple_element;
21 |
22 | template
23 | using tuple_element_t = typename tuple_element::type;
24 |
25 | // const typename for tuple_element_t, for when tuple or TupleImpl cannot itself be const
26 | template
27 | using const_tuple_element_t = typename conditional<
28 | is_lvalue_reference>::value,
29 | add_lvalue_reference_t>>,
30 | const tuple_element_t
31 | >::type;
32 |
33 | // get
34 | template
35 | tuple_element_t>& get(tuple& t);
36 |
37 | template
38 | const_tuple_element_t>& get(const tuple& t);
39 |
40 | template
41 | tuple_element_t>&& get(tuple&& t);
42 |
43 | template
44 | T& get(tuple& t);
45 |
46 | template
47 | const T& get(const tuple& t);
48 |
49 | template
50 | T&& get(tuple&& t);
51 | }
52 |
53 | #endif // EASTL_VARIADIC_TEMPLATES_ENABLED
54 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/unordered_map.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | namespace eastl
11 | {
12 | /// unordered_map
13 | ///
14 | /// The original TR1 (technical report 1) used "hash_map" to name a hash
15 | /// table backed associative container of unique key-value pairs. When the
16 | /// container was added to the C++11 standard the committee chose the name
17 | /// "unordered_map" to clarify that internally the elements are NOT sorted in
18 | /// any particular order. We provide a template alias here to ensure feature
19 | /// parity with the original eastl::hash_map.
20 | ///
21 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
22 | template ,
25 | typename Predicate = eastl::equal_to,
26 | typename Allocator = EASTLAllocatorType,
27 | bool bCacheHashCode = false>
28 | using unordered_map = hash_map;
29 | #endif
30 |
31 |
32 | /// unordered_multimap
33 | ///
34 | /// Similar template alias as "unordered_map" except the contained elements
35 | /// need not be unique. See "hash_multimap" for more details.
36 | ///
37 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
38 | template ,
41 | typename Predicate = eastl::equal_to,
42 | typename Allocator = EASTLAllocatorType,
43 | bool bCacheHashCode = false>
44 | using unordered_multimap = hash_multimap;
45 | #endif
46 |
47 | } // namespace eastl
48 |
49 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/unordered_set.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | namespace eastl
11 | {
12 |
13 | /// unordered_set
14 | ///
15 | /// The original TR1 (technical report 1) used "hash_set" to name a hash
16 | /// table backed associative container of unique "Key" type objects. When
17 | /// the container was added to the C++11 standard the committee chose the
18 | /// name "unordered_set" to clarify that internally the elements are NOT
19 | /// sorted in any particular order. We provide a template alias here to
20 | /// ensure feature parity with the original eastl::hash_set.
21 | ///
22 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
23 | template ,
25 | typename Predicate = eastl::equal_to,
26 | typename Allocator = EASTLAllocatorType,
27 | bool bCacheHashCode = false>
28 | using unordered_set = hash_set;
29 | #endif
30 |
31 | /// unordered_multiset
32 | ///
33 | /// Similar template alias as "unordered_set" except the contained elements
34 | /// need not be unique. See "hash_multiset" for more details.
35 | ///
36 | #if !defined(EA_COMPILER_NO_TEMPLATE_ALIASES)
37 | template ,
39 | typename Predicate = eastl::equal_to,
40 | typename Allocator = EASTLAllocatorType,
41 | bool bCacheHashCode = false>
42 | using unordered_multiset = hash_multiset;
43 | #endif
44 |
45 | } // namespace eastl
46 |
47 |
--------------------------------------------------------------------------------
/libkram/eastl/include/EASTL/weak_ptr.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 |
5 |
6 | #pragma once
7 |
8 | // This header file is deprecated. The implementation has moved:
9 | #include
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/libkram/eastl/source/allocator_eastl.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////
4 | #if USE_EASTL
5 |
6 | #include
7 | #include
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 | #endif
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/libkram/eastl/source/atomic.cpp:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | /////////////////////////////////////////////////////////////////////////////////
4 | #if USE_EASTL
5 |
6 | #include
7 |
8 |
9 | namespace eastl
10 | {
11 |
12 | namespace internal
13 | {
14 |
15 |
16 | static void EastlCompilerBarrierDataDependencyFunc(void*)
17 | {
18 | }
19 |
20 | volatile CompilerBarrierDataDependencyFuncPtr gCompilerBarrierDataDependencyFunc = &EastlCompilerBarrierDataDependencyFunc;
21 |
22 |
23 | } // namespace internal
24 |
25 | } // namespace eastl
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/libkram/eastl/source/fixed_pool.cpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 | #if USE_EASTL
5 |
6 | #include
7 | #include
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 | #endif
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/libkram/eastl/source/intrusive_list.cpp:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | // Copyright (c) Electronic Arts Inc. All rights reserved.
3 | ///////////////////////////////////////////////////////////////////////////////
4 | #if USE_EASTL
5 |
6 | #include
7 |
8 |
9 | namespace eastl
10 | {
11 |
12 |
13 | EASTL_API void intrusive_list_base::reverse() EA_NOEXCEPT
14 | {
15 | intrusive_list_node* pNode = &mAnchor;
16 | do {
17 | intrusive_list_node* const pTemp = pNode->mpNext;
18 | pNode->mpNext = pNode->mpPrev;
19 | pNode->mpPrev = pTemp;
20 | pNode = pNode->mpPrev;
21 | }
22 | while(pNode != &mAnchor);
23 | }
24 |
25 |
26 |
27 | EASTL_API bool intrusive_list_base::validate() const
28 | {
29 | const intrusive_list_node *p = &mAnchor;
30 | const intrusive_list_node *q = p;
31 |
32 | // We do two tests below:
33 | //
34 | // 1) Prev and next pointers are symmetric. We check (p->next->prev == p)
35 | // for each node, which is enough to verify all links.
36 | //
37 | // 2) Loop check. We bump the q pointer at one-half rate compared to the
38 | // p pointer; (p == q) if and only if we are at the start (which we
39 | // don't check) or if there is a loop somewhere in the list.
40 |
41 | do {
42 | // validate node (even phase)
43 | if (p->mpNext->mpPrev != p)
44 | return false; // broken linkage detected
45 |
46 | // bump only fast pointer
47 | p = p->mpNext;
48 | if (p == &mAnchor)
49 | break;
50 |
51 | if (p == q)
52 | return false; // loop detected
53 |
54 | // validate node (odd phase)
55 | if (p->mpNext->mpPrev != p)
56 | return false; // broken linkage detected
57 |
58 | // bump both pointers
59 | p = p->mpNext;
60 | q = q->mpNext;
61 |
62 | if (p == q)
63 | return false; // loop detected
64 |
65 | } while(p != &mAnchor);
66 |
67 | return true;
68 | }
69 |
70 |
71 | } // namespace eastl
72 |
73 |
74 | #endif
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/libkram/etc2comp/EtcColor.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The Etc2Comp Authors.
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 | /*
18 | #pragma once
19 |
20 | #include
21 |
22 | namespace Etc
23 | {
24 |
25 | inline float LogToLinear(float a_fLog)
26 | {
27 | static const float ALPHA = 0.055f;
28 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA;
29 |
30 | if (a_fLog <= 0.04045f)
31 | {
32 | return a_fLog / 12.92f;
33 | }
34 | else
35 | {
36 | return powf((a_fLog + ALPHA) / ONE_PLUS_ALPHA, 2.4f);
37 | }
38 | }
39 |
40 | inline float LinearToLog(float a_fLinear)
41 | {
42 | static const float ALPHA = 0.055f;
43 | static const float ONE_PLUS_ALPHA = 1.0f + ALPHA;
44 |
45 | if (a_fLinear <= 0.0031308f)
46 | {
47 | return 12.92f * a_fLinear;
48 | }
49 | else
50 | {
51 | return ONE_PLUS_ALPHA * powf(a_fLinear, (1.0f/2.4f)) - ALPHA;
52 | }
53 | }
54 |
55 | class ColorR8G8B8A8
56 | {
57 | public:
58 |
59 | unsigned char ucR;
60 | unsigned char ucG;
61 | unsigned char ucB;
62 | unsigned char ucA;
63 |
64 | };
65 | }
66 | */
67 |
--------------------------------------------------------------------------------
/libkram/etc2comp/EtcConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The Etc2Comp Authors.
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 | #pragma once
18 |
19 | #include
20 |
--------------------------------------------------------------------------------
/libkram/etc2comp/EtcErrorMetric.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The Etc2Comp Authors.
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 | #pragma once
18 |
19 | namespace Etc
20 | {
21 |
22 | enum ErrorMetric
23 | {
24 | //RGBA, // Premul weighted RGB
25 | //RGBX,
26 |
27 | GRAY,
28 | REC709, // Luma weighted(RGB) + A*A
29 |
30 | NUMERIC, // X*X + Y*Y + Z*Z + W*W
31 | // NUMERICX, // X*X
32 | // NUMERICXY, // X*X + Y*Y
33 | //
34 | // NORMALXYZ,
35 | //
36 | //ERROR_METRICS,
37 | //
38 | //BT709 = REC709
39 | };
40 |
41 | inline const char *ErrorMetricToString(ErrorMetric errorMetric)
42 | {
43 | switch (errorMetric)
44 | {
45 | // case RGBA:
46 | // return "RGBA";
47 | // case RGBX:
48 | // return "RGBX";
49 | case GRAY:
50 | return "GRAY";
51 | case REC709:
52 | return "REC709";
53 | case NUMERIC:
54 | return "NUMERIC";
55 | // case NUMERICX:
56 | // return "NUMERICX";
57 | // case NUMERICXY:
58 | // return "NUMERICXY";
59 | // case NORMALXYZ:
60 | // return "NORMALXYZ";
61 | //case ERROR_METRICS:
62 | default:
63 | return "UNKNOWN";
64 | }
65 | }
66 | } // namespace Etc
67 |
--------------------------------------------------------------------------------
/libkram/etc2comp/EtcMath.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The Etc2Comp Authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include "EtcConfig.h"
18 | #include "EtcMath.h"
19 |
20 | namespace Etc
21 | {
22 |
23 | // ----------------------------------------------------------------------------------------------------
24 | // calculate the line that best fits the set of XY points contained in a_afX[] and a_afY[]
25 | // use a_fSlope and a_fOffset to define that line
26 | //
27 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points,
28 | float *a_fSlope, float *a_fOffset)
29 | {
30 | float fPoints = (float)a_Points;
31 |
32 | float fSumX = 0.0f;
33 | float fSumY = 0.0f;
34 | float fSumXY = 0.0f;
35 | float fSumX2 = 0.0f;
36 |
37 | for (unsigned int uiPoint = 0; uiPoint < a_Points; uiPoint++)
38 | {
39 | fSumX += a_afX[uiPoint];
40 | fSumY += a_afY[uiPoint];
41 | fSumXY += a_afX[uiPoint] * a_afY[uiPoint];
42 | fSumX2 += a_afX[uiPoint] * a_afX[uiPoint];
43 | }
44 |
45 | float fDivisor = fPoints*fSumX2 - fSumX*fSumX;
46 |
47 | // if vertical line
48 | if (fDivisor == 0.0f)
49 | {
50 | *a_fSlope = 0.0f;
51 | *a_fOffset = 0.0f;
52 | return true;
53 | }
54 |
55 | *a_fSlope = (fPoints*fSumXY - fSumX*fSumY) / fDivisor;
56 | *a_fOffset = (fSumY - (*a_fSlope)*fSumX) / fPoints;
57 |
58 | return false;
59 | }
60 |
61 | // ----------------------------------------------------------------------------------------------------
62 | //
63 |
64 | } // namespace Etc
65 |
--------------------------------------------------------------------------------
/libkram/etc2comp/EtcMath.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 The Etc2Comp Authors.
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 | #pragma once
18 |
19 | #include
20 |
21 | namespace Etc
22 | {
23 |
24 | // ----------------------------------------------------------------------------------------------------
25 | // return true if vertical line
26 | bool Regression(float a_afX[], float a_afY[], unsigned int a_Points,
27 | float *a_fSlope, float *a_fOffset);
28 |
29 | inline float ConvertMSEToPSNR(float a_fMSE)
30 | {
31 | if (a_fMSE == 0.0f)
32 | {
33 | return INFINITY;
34 | }
35 |
36 | return 10.0f * log10f(1.0f / a_fMSE);
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/libkram/fastl/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Ramon Viladomat
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.
--------------------------------------------------------------------------------
/libkram/fastl/pair.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef USE_FASTL
4 |
5 | namespace fastl
6 | {
7 | template
8 | struct pair
9 | {
10 | typedef T1 first_type;
11 | typedef T2 second_type;
12 |
13 | pair()
14 | :first(),second(){}
15 | pair(const T1& _first, const T2& _second)
16 | :first(_first),second(_second) {}
17 |
18 | // added these
19 | pair(const pair& rhs)
20 | :first(rhs.first),second(rhs.second) {}
21 | pair(pair&& rhs)
22 | :first(std::move(rhs.first)),second(std::move(rhs.second)) {}
23 |
24 | pair& operator=(const pair& rhs)
25 | {
26 | first = rhs.first;
27 | second = rhs.second;
28 | return *this;
29 | }
30 | pair& operator=(pair&& rhs)
31 | {
32 | first = std::move(rhs.first);
33 | second = std::move(rhs.second);
34 | return *this;
35 | }
36 |
37 | T1 first;
38 | T2 second;
39 | };
40 |
41 | template
42 | pair make_pair(const T1& k, const T2& v) { return pair(k,v); }
43 | }
44 |
45 | #else
46 |
47 | //#include
48 | //
49 | //namespace fastl
50 | //{
51 | // template using pair = std::pair;
52 | //}
53 |
54 | #endif //USE_FASTL
55 |
56 | #ifdef FASTL_EXPOSE_PLAIN_ALIAS
57 |
58 | template using pair = fastl::pair;
59 |
60 | #endif //FASTL_EXPOSE_PLAIN_ALIAS
61 |
--------------------------------------------------------------------------------
/libkram/fastl/unordered_map.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef USE_FASTL
4 |
5 | #include "../fastl/map.h"
6 |
7 | namespace fastl
8 | {
9 | // Build unordered_map as a map
10 | template using unordered_map = fastl::map;
11 | }
12 |
13 | #else
14 |
15 | //#include
16 | //
17 | //namespace fastl
18 | //{
19 | // template using unordered_map = std::unordered_map;
20 | //}
21 |
22 | #endif //USE_FASTL
23 |
24 | #ifdef FASTL_EXPOSE_PLAIN_ALIAS
25 |
26 | template using unordered_map = fastl::unordered_map;
27 |
28 | #endif //FASTL_EXPOSE_PLAIN_ALIAS
29 |
--------------------------------------------------------------------------------
/libkram/fastl/unordered_set.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef USE_FASTL
4 |
5 | #include "../fastl/set.h"
6 |
7 | namespace fastl
8 | {
9 | // Build unordered_map as a map
10 | template using unordered_set = fastl::set;
11 | }
12 |
13 | #else
14 |
15 | //#include
16 | //
17 | //namespace fastl
18 | //{
19 | // template using unordered_set = std::unordered_set