├── .clang-format ├── .editorconfig ├── .gitignore ├── CHANGELOG.md ├── CMakeLists.txt ├── CMakePresets.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── app.cpp ├── cmdline.cpp ├── cmdline.h ├── ext ├── CMakeLists.txt ├── glad │ ├── CMakeLists.txt │ ├── License.md │ ├── include │ │ ├── KHR │ │ │ └── khrplatform.h │ │ └── glad │ │ │ └── glad.h │ └── src │ │ └── glad.c ├── libvkr │ ├── .gitignore │ ├── CMakeLists.txt │ ├── CMakePresets.json │ ├── README.md │ ├── ext │ │ ├── CMakeLists.txt │ │ ├── ext.cmake │ │ ├── extract_msi.ps1 │ │ ├── meshopt_triangle_remap.patch │ │ ├── meshoptimizer-0.18 │ │ │ ├── .clang-format │ │ │ ├── .editorconfig │ │ │ ├── .github │ │ │ │ ├── ISSUE_TEMPLATE │ │ │ │ │ ├── bug_report.md │ │ │ │ │ ├── config.yml │ │ │ │ │ └── feature_request.md │ │ │ │ └── workflows │ │ │ │ │ ├── build.yml │ │ │ │ │ └── release.yml │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── CONTRIBUTING.md │ │ │ ├── LICENSE.md │ │ │ ├── Makefile │ │ │ ├── README.md │ │ │ ├── codecov.yml │ │ │ ├── config.cmake.in │ │ │ ├── demo │ │ │ │ ├── ansi.c │ │ │ │ ├── demo.html │ │ │ │ ├── index.html │ │ │ │ ├── main.cpp │ │ │ │ ├── pirate.glb │ │ │ │ ├── pirate.obj │ │ │ │ ├── simplify.html │ │ │ │ └── tests.cpp │ │ │ ├── extern │ │ │ │ ├── cgltf.h │ │ │ │ ├── fast_obj.h │ │ │ │ └── sdefl.h │ │ │ ├── gltf │ │ │ │ ├── README.md │ │ │ │ ├── animation.cpp │ │ │ │ ├── basisenc.cpp │ │ │ │ ├── basislib.cpp │ │ │ │ ├── cli.js │ │ │ │ ├── fileio.cpp │ │ │ │ ├── gltfpack.cpp │ │ │ │ ├── gltfpack.h │ │ │ │ ├── image.cpp │ │ │ │ ├── json.cpp │ │ │ │ ├── library.js │ │ │ │ ├── material.cpp │ │ │ │ ├── mesh.cpp │ │ │ │ ├── node.cpp │ │ │ │ ├── package.json │ │ │ │ ├── parsegltf.cpp │ │ │ │ ├── parseobj.cpp │ │ │ │ ├── stream.cpp │ │ │ │ ├── wasistubs.cpp │ │ │ │ ├── wasistubs.txt │ │ │ │ └── write.cpp │ │ │ ├── js │ │ │ │ ├── README.md │ │ │ │ ├── benchmark.js │ │ │ │ ├── index.js │ │ │ │ ├── index.module.d.ts │ │ │ │ ├── index.module.js │ │ │ │ ├── meshopt_decoder.js │ │ │ │ ├── meshopt_decoder.module.d.ts │ │ │ │ ├── meshopt_decoder.module.js │ │ │ │ ├── meshopt_decoder.test.js │ │ │ │ ├── meshopt_decoder_reference.js │ │ │ │ ├── meshopt_encoder.js │ │ │ │ ├── meshopt_encoder.module.d.ts │ │ │ │ ├── meshopt_encoder.module.js │ │ │ │ ├── meshopt_encoder.test.js │ │ │ │ ├── meshopt_simplifier.js │ │ │ │ ├── meshopt_simplifier.module.d.ts │ │ │ │ ├── meshopt_simplifier.module.js │ │ │ │ ├── meshopt_simplifier.test.js │ │ │ │ └── package.json │ │ │ ├── src │ │ │ │ ├── allocator.cpp │ │ │ │ ├── clusterizer.cpp │ │ │ │ ├── indexcodec.cpp │ │ │ │ ├── indexgenerator.cpp │ │ │ │ ├── meshoptimizer.h │ │ │ │ ├── overdrawanalyzer.cpp │ │ │ │ ├── overdrawoptimizer.cpp │ │ │ │ ├── simplifier.cpp │ │ │ │ ├── spatialorder.cpp │ │ │ │ ├── stripifier.cpp │ │ │ │ ├── vcacheanalyzer.cpp │ │ │ │ ├── vcacheoptimizer.cpp │ │ │ │ ├── vertexcodec.cpp │ │ │ │ ├── vertexfilter.cpp │ │ │ │ ├── vfetchanalyzer.cpp │ │ │ │ └── vfetchoptimizer.cpp │ │ │ └── tools │ │ │ │ ├── codecbench.cpp │ │ │ │ ├── codecfuzz.cpp │ │ │ │ ├── meshloader.cpp │ │ │ │ ├── vcachetester.cpp │ │ │ │ ├── vcachetuner.cpp │ │ │ │ ├── wasmpack.py │ │ │ │ └── wasmstubs.cpp │ │ ├── numpy-1.21.0 │ │ │ ├── LICENSE.txt │ │ │ └── include │ │ │ │ └── numpy │ │ │ │ ├── .doxyfile │ │ │ │ ├── __multiarray_api.h │ │ │ │ ├── __ufunc_api.h │ │ │ │ ├── _neighborhood_iterator_imp.h │ │ │ │ ├── _numpyconfig.h │ │ │ │ ├── arrayobject.h │ │ │ │ ├── arrayscalars.h │ │ │ │ ├── experimental_dtype_api.h │ │ │ │ ├── halffloat.h │ │ │ │ ├── libdivide │ │ │ │ ├── LICENSE.txt │ │ │ │ └── libdivide.h │ │ │ │ ├── multiarray_api.txt │ │ │ │ ├── ndarrayobject.h │ │ │ │ ├── ndarraytypes.h │ │ │ │ ├── noprefix.h │ │ │ │ ├── npy_1_7_deprecated_api.h │ │ │ │ ├── npy_3kcompat.h │ │ │ │ ├── npy_common.h │ │ │ │ ├── npy_cpu.h │ │ │ │ ├── npy_endian.h │ │ │ │ ├── npy_interrupt.h │ │ │ │ ├── npy_math.h │ │ │ │ ├── npy_no_deprecated_api.h │ │ │ │ ├── npy_os.h │ │ │ │ ├── numpyconfig.h │ │ │ │ ├── old_defines.h │ │ │ │ ├── oldnumeric.h │ │ │ │ ├── random │ │ │ │ ├── bitgen.h │ │ │ │ └── distributions.h │ │ │ │ ├── ufunc_api.txt │ │ │ │ ├── ufuncobject.h │ │ │ │ └── utils.h │ │ └── python-3.10.6 │ │ │ └── linux │ │ │ ├── LICENSE.txt │ │ │ └── include │ │ │ ├── ImDib.h │ │ │ ├── ImPlatform.h │ │ │ ├── Imaging.h │ │ │ ├── ImagingUtils.h │ │ │ ├── Python.h │ │ │ ├── abstract.h │ │ │ ├── bltinmodule.h │ │ │ ├── boolobject.h │ │ │ ├── bytearrayobject.h │ │ │ ├── bytesobject.h │ │ │ ├── cellobject.h │ │ │ ├── ceval.h │ │ │ ├── classobject.h │ │ │ ├── code.h │ │ │ ├── codecs.h │ │ │ ├── compile.h │ │ │ ├── complexobject.h │ │ │ ├── context.h │ │ │ ├── cpython │ │ │ ├── abstract.h │ │ │ ├── bytearrayobject.h │ │ │ ├── bytesobject.h │ │ │ ├── ceval.h │ │ │ ├── code.h │ │ │ ├── compile.h │ │ │ ├── dictobject.h │ │ │ ├── fileobject.h │ │ │ ├── fileutils.h │ │ │ ├── frameobject.h │ │ │ ├── import.h │ │ │ ├── initconfig.h │ │ │ ├── interpreteridobject.h │ │ │ ├── listobject.h │ │ │ ├── methodobject.h │ │ │ ├── object.h │ │ │ ├── objimpl.h │ │ │ ├── odictobject.h │ │ │ ├── picklebufobject.h │ │ │ ├── pyctype.h │ │ │ ├── pydebug.h │ │ │ ├── pyerrors.h │ │ │ ├── pyfpe.h │ │ │ ├── pylifecycle.h │ │ │ ├── pymem.h │ │ │ ├── pystate.h │ │ │ ├── pythonrun.h │ │ │ ├── pytime.h │ │ │ ├── sysmodule.h │ │ │ ├── traceback.h │ │ │ ├── tupleobject.h │ │ │ └── unicodeobject.h │ │ │ ├── datetime.h │ │ │ ├── descrobject.h │ │ │ ├── dictobject.h │ │ │ ├── dynamic_annotations.h │ │ │ ├── enumobject.h │ │ │ ├── errcode.h │ │ │ ├── eval.h │ │ │ ├── exports.h │ │ │ ├── fileobject.h │ │ │ ├── fileutils.h │ │ │ ├── floatobject.h │ │ │ ├── frameobject.h │ │ │ ├── funcobject.h │ │ │ ├── genericaliasobject.h │ │ │ ├── genobject.h │ │ │ ├── graminit.h │ │ │ ├── import.h │ │ │ ├── internal │ │ │ ├── pycore_abstract.h │ │ │ ├── pycore_accu.h │ │ │ ├── pycore_asdl.h │ │ │ ├── pycore_ast.h │ │ │ ├── pycore_ast_state.h │ │ │ ├── pycore_atomic.h │ │ │ ├── pycore_atomic_funcs.h │ │ │ ├── pycore_bitutils.h │ │ │ ├── pycore_blocks_output_buffer.h │ │ │ ├── pycore_bytes_methods.h │ │ │ ├── pycore_call.h │ │ │ ├── pycore_ceval.h │ │ │ ├── pycore_code.h │ │ │ ├── pycore_compile.h │ │ │ ├── pycore_condvar.h │ │ │ ├── pycore_context.h │ │ │ ├── pycore_dtoa.h │ │ │ ├── pycore_fileutils.h │ │ │ ├── pycore_format.h │ │ │ ├── pycore_gc.h │ │ │ ├── pycore_getopt.h │ │ │ ├── pycore_gil.h │ │ │ ├── pycore_hamt.h │ │ │ ├── pycore_hashtable.h │ │ │ ├── pycore_import.h │ │ │ ├── pycore_initconfig.h │ │ │ ├── pycore_interp.h │ │ │ ├── pycore_list.h │ │ │ ├── pycore_long.h │ │ │ ├── pycore_moduleobject.h │ │ │ ├── pycore_object.h │ │ │ ├── pycore_parser.h │ │ │ ├── pycore_pathconfig.h │ │ │ ├── pycore_pyarena.h │ │ │ ├── pycore_pyerrors.h │ │ │ ├── pycore_pyhash.h │ │ │ ├── pycore_pylifecycle.h │ │ │ ├── pycore_pymem.h │ │ │ ├── pycore_pystate.h │ │ │ ├── pycore_runtime.h │ │ │ ├── pycore_structseq.h │ │ │ ├── pycore_symtable.h │ │ │ ├── pycore_sysmodule.h │ │ │ ├── pycore_traceback.h │ │ │ ├── pycore_tuple.h │ │ │ ├── pycore_ucnhash.h │ │ │ ├── pycore_unionobject.h │ │ │ └── pycore_warnings.h │ │ │ ├── interpreteridobject.h │ │ │ ├── intrcheck.h │ │ │ ├── iterobject.h │ │ │ ├── listobject.h │ │ │ ├── longintrepr.h │ │ │ ├── longobject.h │ │ │ ├── marshal.h │ │ │ ├── memoryobject.h │ │ │ ├── methodobject.h │ │ │ ├── modsupport.h │ │ │ ├── moduleobject.h │ │ │ ├── namespaceobject.h │ │ │ ├── object.h │ │ │ ├── objimpl.h │ │ │ ├── opcode.h │ │ │ ├── osdefs.h │ │ │ ├── osmodule.h │ │ │ ├── patchlevel.h │ │ │ ├── py_curses.h │ │ │ ├── pycapsule.h │ │ │ ├── pyconfig.h │ │ │ ├── pydtrace.h │ │ │ ├── pyerrors.h │ │ │ ├── pyexpat.h │ │ │ ├── pyframe.h │ │ │ ├── pyhash.h │ │ │ ├── pylifecycle.h │ │ │ ├── pymacconfig.h │ │ │ ├── pymacro.h │ │ │ ├── pymath.h │ │ │ ├── pymem.h │ │ │ ├── pyport.h │ │ │ ├── pystate.h │ │ │ ├── pystrcmp.h │ │ │ ├── pystrhex.h │ │ │ ├── pystrtod.h │ │ │ ├── pythonrun.h │ │ │ ├── pythread.h │ │ │ ├── rangeobject.h │ │ │ ├── setobject.h │ │ │ ├── sliceobject.h │ │ │ ├── structmember.h │ │ │ ├── structseq.h │ │ │ ├── sysmodule.h │ │ │ ├── token.h │ │ │ ├── traceback.h │ │ │ ├── tracemalloc.h │ │ │ ├── tupleobject.h │ │ │ ├── typeslots.h │ │ │ ├── unicodeobject.h │ │ │ ├── warnings.h │ │ │ ├── weakrefobject.h │ │ │ └── x86_64-linux-gnu │ │ │ └── python3.10 │ │ │ └── pyconfig.h │ ├── scripts │ │ ├── README.md │ │ ├── blender_vkr │ │ │ ├── CMakeLists.txt │ │ │ ├── __init__.py │ │ │ ├── operator_file_export_camera_path.py │ │ │ ├── operator_file_export_pbr_textures.py │ │ │ └── operator_file_export_vkrs.py │ │ ├── install_blender_addon.bpy │ │ ├── install_blender_addon.sh │ │ ├── vkr2obj.py │ │ ├── vkrinfo.py │ │ ├── vktconvert.py │ │ └── vktinfo.py │ └── src │ │ ├── vkr.c │ │ ├── vkr.h │ │ ├── vkrmodule.c │ │ ├── vkrtest.c │ │ └── vktconvert.c └── stb │ └── stb.cpp ├── imstate.cpp ├── imstate.h ├── libapp ├── CMakeLists.txt ├── app_state.cpp ├── app_state.h ├── benchmark_info.cpp ├── benchmark_info.h ├── camera_state.h ├── data_capture_state.h ├── imutils.cpp ├── imutils.h ├── scene_state.cpp ├── scene_state.h ├── shell.cpp └── shell.h ├── librender ├── CMakeLists.txt ├── bounds.cpp ├── bounds.h ├── camera.h ├── dequantize.glsl ├── gpu_programs.cpp ├── gpu_programs.h ├── halton.h ├── lights.cpp ├── lights.h ├── material.cpp ├── material.h ├── mesh.cpp ├── mesh.h ├── mesh_decode.h ├── quantization.cpp ├── quantization.h ├── quantize.h ├── raytrace_backend.h ├── render_backend.cpp ├── render_backend.h ├── render_data.h ├── render_params.glsl.h ├── scene.cpp └── scene.h ├── main.cpp ├── pch.hpp ├── rendering ├── CMakeLists.txt ├── bsdfs │ ├── base_material.h.glsl │ ├── gltf_bsdf.glsl │ ├── hit_point.glsl │ ├── simple_bsdf.glsl │ └── texture_channel_mask.h ├── color │ ├── color_matching.glsl │ └── color_matching.h ├── defaults.glsl ├── gpu_programs.cmake ├── gpu_programs.h ├── language.glsl ├── language.hpp ├── lights │ ├── light.h.glsl │ ├── point.h.glsl │ ├── quad.glsl │ ├── quad.h.glsl │ ├── sky_model_arhosek │ │ ├── sky_model.cpp │ │ ├── sky_model.glsl │ │ ├── sky_model.h │ │ ├── sky_model.h.glsl │ │ ├── sky_model_data_ciexyz.h │ │ ├── sky_model_data_rgb.h │ │ └── sky_model_data_spectral.h │ ├── sun.glsl │ ├── tri.glsl │ └── tri.h.glsl ├── mc │ ├── light_sampling.h │ ├── lights_linear.glsl │ ├── lights_point.glsl │ ├── lights_sun.glsl │ ├── nee.glsl │ ├── nee_interface.glsl │ ├── shade_base_material.glsl │ ├── shade_megakernel.glsl │ └── shading_interface.glsl ├── pathspace.h ├── pointsets │ ├── bn_data.h │ ├── bn_rng.glsl │ ├── bn_tables.h │ ├── hashing.glsl │ ├── lcg_rng.glsl │ ├── sample_order.glsl │ ├── selected_rng.glsl │ ├── sobol.glsl │ ├── sobol_data.h │ └── sobol_tables.h ├── postprocess │ ├── color_grading_utils.glsl │ ├── reprojection.glsl │ ├── reprojection.h │ ├── tonemapping.h │ └── tonemapping_utils.glsl ├── rt │ ├── footprint.glsl │ ├── geometry.h.glsl │ ├── hit.glsl │ ├── material_textures.glsl │ └── materials.glsl ├── tests │ ├── compile.cpp │ └── gltf_bsdf.cpp ├── tools │ ├── prepare_sobol.cpp │ └── sobol_tables_src.h └── util.glsl ├── scripts └── ide_project_tools.cmake ├── security.md ├── third-party-components.md ├── util ├── CMakeLists.txt ├── compare_exr.cpp ├── compute_util.h ├── device_backend.cpp ├── device_backend.h ├── display │ ├── CMakeLists.txt │ ├── display.h │ ├── gldisplay.cpp │ ├── gldisplay.h │ ├── imgui_backend.cpp │ ├── imgui_backend.h │ ├── render_graphic.h │ ├── shader.cpp │ └── shader.h ├── error_io.cpp ├── error_io.h ├── file_mapping.cpp ├── file_mapping.h ├── image.cpp ├── image.h ├── interactive_camera.cpp ├── interactive_camera.h ├── lod.cpp ├── lod.h ├── online_stats.h ├── profiling.cpp ├── profiling.h ├── ref_counted.h ├── sha1_bytes.cpp ├── sha1_bytes.h ├── types.h ├── unordered_vector.hpp ├── util.cpp ├── util.h ├── write_image.cpp └── write_image.h └── vulkan ├── CMakeLists.txt ├── accumulate.glsl ├── cmake └── glslcli.cmake ├── command_buffer_utils.cpp ├── command_buffer_utils.h ├── compute_vulkan.cpp ├── compute_vulkan.h ├── geometry.glsl ├── gpu_params.glsl ├── hit.rchit ├── light_sampling ├── render_binned_lights.cpp └── render_binned_lights.h ├── miss.rmiss ├── pipeline_pt ├── accumulate.glsl ├── any_hit.glsl ├── any_hit.rahit ├── hit.rchit ├── miss.rmiss ├── occlusion_miss.rmiss ├── perspective.rgen └── setup_recursive_pt.glsl ├── pipeline_raster ├── basic.frag ├── basic.vert ├── raster_scene_vulkan.cpp └── raster_scene_vulkan.h ├── pointsets ├── render_bn.cpp ├── render_bn.h ├── render_sobol.cpp └── render_sobol.h ├── process_samples.comp ├── processing ├── example.comp ├── process_example.cpp ├── process_example.h ├── process_profiling_tools.cpp ├── process_profiling_tools.h ├── process_taa.comp ├── process_taa.cpp └── process_taa.h ├── profiling ├── profiling_scopes.cpp └── profiling_scopes.h ├── pt_megakernel.comp ├── pt_megakernel.glsl ├── pt_megakernel.rgen ├── raygen.rgen ├── render_pipeline_vulkan.cpp ├── render_pipeline_vulkan.h ├── render_sky.cpp ├── render_vulkan.cpp ├── render_vulkan.h ├── render_vulkan_extensions.cpp ├── render_vulkan_spirv.h.in ├── resource_utils.cpp ├── resource_utils.h ├── rt_debug.comp ├── rt_intersect.comp ├── setup_iterative_pt.glsl ├── setup_pixel_assignment.glsl ├── vkdisplay.cpp ├── vkdisplay.h ├── vulkan_utils.cpp ├── vulkan_utils.h ├── vulkanrt_utils.cpp └── vulkanrt_utils.h /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | # Unix newlines. 5 | end_of_line = lf 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 4 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.raw 3 | build/ 4 | repro/ 5 | *build/ 6 | cmake-build 7 | cmake-ninja 8 | .DS_Store 9 | compile_commands.json 10 | .cache/ 11 | imgui.ini 12 | chameleonrt.png 13 | vulkan_cache 14 | .tmp.* 15 | .vs/ 16 | *.csv 17 | *.pfm 18 | .vscode 19 | ext/download/ 20 | 21 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v1.0.0 2 | 3 | Note: This is a public pre-release limited to the core components 4 | required for reproducing some of our research papers. 5 | 6 | - Path tracer variants for multiple styles of Vulkan RT usage, 7 | stack-/tail-recursive, iterative, megakernel(s) inline and asyc 8 | - GLTF BSDF with normal maps, PBR specular and transmission layers 9 | - basic indirect ray differentials and mipmapping 10 | - multiple RNG variants 11 | - basic temporal accumulation & TAA resolve 12 | - basic support for triangle emitters 13 | - composable renderer architecture for testing many feature 14 | combinations across many implementation variants 15 | - auto-serialized ImGui and application state, persistent state on 16 | application restarts, extensive pre-configuration+automation options 17 | - arena-based, block-fused GPU memory allocations 18 | -------------------------------------------------------------------------------- /CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "cmakeMinimumRequired": { 4 | "major": 3, 5 | "minor": 21 6 | }, 7 | "configurePresets": [ 8 | { 9 | "name": "vulkan", 10 | "description": "Build framework for vulkan.", 11 | "binaryDir": "${sourceDir}/build/${presetName}", 12 | "cacheVariables": { 13 | "ENABLE_VULKAN": "ON", 14 | "CMAKE_BUILD_TYPE": "Release" 15 | } 16 | }, 17 | { 18 | "name": "vulkan_debug", 19 | "description": "Build framework for vulkan in debug mode.", 20 | "inherits": "vulkan", 21 | "cacheVariables": { 22 | "CMAKE_BUILD_TYPE": "Debug" 23 | } 24 | } 25 | ], 26 | "buildPresets": [ 27 | { 28 | "name": "vulkan", 29 | "configurePreset": "vulkan", 30 | "configuration": "Release" 31 | }, 32 | { 33 | "name": "vulkan_debug", 34 | "configurePreset": "vulkan_debug", 35 | "configuration": "Debug" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Intel Corporation 4 | 5 | Based on ChameleonRT, Copyright (c) 2019 Will Usher 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /cmdline.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace command_line { 11 | 12 | struct Keyframe { 13 | double hold = 1.0; 14 | std::string configuration_ini; 15 | }; 16 | 17 | struct ProgramArgs { 18 | std::string display_frontend; 19 | std::vector configuration_inis; 20 | std::vector added_frames; 21 | bool have_upscale_factor { false }; 22 | bool have_window_size { false }; 23 | int render_upscale_factor { 1 }; 24 | int window_width { 1920 }; 25 | int window_height { 1080 }; 26 | std::string device_override; 27 | }; 28 | 29 | ProgramArgs parse(Shell::DefaultArgs* shell_args, const std::vector &vargs); 30 | 31 | } // namespace command_line 32 | -------------------------------------------------------------------------------- /ext/glad/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | add_library(glad src/glad.c) 5 | 6 | target_include_directories(glad PUBLIC 7 | $ 8 | $) 9 | 10 | target_link_libraries(glad PUBLIC ${OPENGL_LIBRARIES}) 11 | 12 | if (UNIX AND NOT APPLE) 13 | target_link_libraries(glad PUBLIC dl) 14 | endif() 15 | 16 | -------------------------------------------------------------------------------- /ext/glad/License.md: -------------------------------------------------------------------------------- 1 | This code was generated using [glad](https://github.com/Dav1dde/glad). 2 | As the [glad documentation](https://github.com/Dav1dde/glad#license) states, it is licensed as follows: 3 | 4 | > The generated code from glad is any of Public Domain, WTFPL or CC0. Now 5 | > Khronos has some of their specifications under Apache Version 2.0 license 6 | > which may have an impact on the generated code, see [this clarifying 7 | > comment](https://github.com/KhronosGroup/OpenGL-Registry/issues/376#issuecomment-596187053) 8 | > on the Khronos / OpenGL-Specification issue tracker. 9 | -------------------------------------------------------------------------------- /ext/libvkr/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | ext/download/ 3 | -------------------------------------------------------------------------------- /ext/libvkr/CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "cmakeMinimumRequired": { 4 | "major": 3, 5 | "minor": 21, 6 | "patch": 6 7 | }, 8 | "configurePresets": [ 9 | { 10 | "name": "release", 11 | "displayName": "Release", 12 | "description": "Build libvkr in release mode, and the python wrapper if python is available.", 13 | "binaryDir": "${sourceDir}/build/release", 14 | "cacheVariables": { 15 | "CMAKE_BUILD_TYPE": "Release" 16 | } 17 | }, 18 | { 19 | "name": "debug", 20 | "displayName": "Debug", 21 | "description": "Build libvkr in debug mode, and the python wrapper if python is available.", 22 | "binaryDir": "${sourceDir}/build/debug", 23 | "cacheVariables": { 24 | "CMAKE_BUILD_TYPE": "Debug" 25 | } 26 | } 27 | ], 28 | "buildPresets": [ 29 | { 30 | "name": "release", 31 | "configurePreset": "release", 32 | "configuration": "Release" 33 | }, 34 | { 35 | "name": "debug", 36 | "configurePreset": "debug", 37 | "configuration": "Debug" 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /ext/libvkr/README.md: -------------------------------------------------------------------------------- 1 | # libvkr 2 | 3 | This project includes a library and tools designed to deal with the 4 | .vks/.vkt scene format. It is used in the Real-time Path Tracing Research Framework. 5 | 6 | You can build standalone by simply calling 7 | 8 | ```shell 9 | cmake --preset release 10 | cmake --build --preset release 11 | ``` 12 | 13 | Note that there is also a debug preset. 14 | 15 | Alternatively, you can use this library directly with `add_subdirectory`, which 16 | will give access to the library target `vkr`. 17 | 18 | This library also contains a Python wrapper, pyvkr. 19 | 20 | # Scripts 21 | 22 | The scripts folder contains utilities that use the pyvkr module. 23 | See [scripts/README.md](scripts/README.md) for more detail. 24 | 25 | 26 | -------------------------------------------------------------------------------- /ext/libvkr/ext/extract_msi.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | # We have to replace forward slashes because msiexec only understands backslashes. 5 | $archive=$args[0] -replace '[/]','\' 6 | $target=$args[1] -replace '[/]','\' 7 | echo "Extracting $archive to $target ..." 8 | msiexec.exe /a "$archive" /qn TARGETDIR="$target" 9 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.clang-format: -------------------------------------------------------------------------------- 1 | Standard: Cpp03 2 | UseTab: ForIndentation 3 | TabWidth: 4 4 | IndentWidth: 4 5 | AccessModifierOffset: -4 6 | BreakBeforeBraces: Allman 7 | IndentCaseLabels: false 8 | ColumnLimit: 0 9 | PointerAlignment: Left 10 | BreakConstructorInitializersBeforeComma: true 11 | NamespaceIndentation: None 12 | AlignEscapedNewlines: DontAlign 13 | AlignAfterOpenBracket: DontAlign 14 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.editorconfig: -------------------------------------------------------------------------------- 1 | # See https://editorconfig.org/ for more info 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = tab 6 | indent_size = 4 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report if you believe you've found a bug in this project; please use GitHub Discussions instead if you think the bug may be in your code. 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Help and support 4 | url: https://github.com/zeux/meshoptimizer/discussions 5 | about: Please use GitHub Discussions if you have questions or need help. 6 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/.gitignore: -------------------------------------------------------------------------------- 1 | /build/ 2 | /data/ 3 | /gltf/library.wasm 4 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016-2022 Arseny Kapoulkine 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 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: off 6 | patch: off 7 | 8 | ignore: 9 | - demo 10 | - extern 11 | - tools 12 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | include("${CMAKE_CURRENT_LIST_DIR}/meshoptimizerTargets.cmake") 4 | check_required_components(meshoptimizer) 5 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/demo/ansi.c: -------------------------------------------------------------------------------- 1 | /* This file makes sure the library can be used by C89 code */ 2 | #include "../src/meshoptimizer.h" 3 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/demo/pirate.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/RealTimePathTracingResearchFramework/5641742c9785a1474ca0f93a4e8e09eced2fe246/ext/libvkr/ext/meshoptimizer-0.18/demo/pirate.glb -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/gltf/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // This file is part of gltfpack and is distributed under the terms of MIT License. 3 | var gltfpack = require('./library.js'); 4 | 5 | var fs = require('fs'); 6 | 7 | var args = process.argv.slice(2); 8 | 9 | var interface = { 10 | read: function (path) { 11 | return fs.readFileSync(path); 12 | }, 13 | write: function (path, data) { 14 | fs.writeFileSync(path, data); 15 | }, 16 | }; 17 | 18 | gltfpack.pack(args, interface) 19 | .then(function (log) { 20 | process.stdout.write(log); 21 | process.exit(0); 22 | }) 23 | .catch(function (err) { 24 | process.stderr.write(err.message); 25 | process.exit(1); 26 | }); 27 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/gltf/json.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of gltfpack; see gltfpack.h for version/license details 2 | #include "gltfpack.h" 3 | 4 | #include 5 | 6 | void comma(std::string& s) 7 | { 8 | char ch = s.empty() ? 0 : s[s.size() - 1]; 9 | 10 | if (ch != 0 && ch != '[' && ch != '{') 11 | s += ","; 12 | } 13 | 14 | void append(std::string& s, size_t v) 15 | { 16 | char buf[32]; 17 | snprintf(buf, sizeof(buf), "%zu", v); 18 | s += buf; 19 | } 20 | 21 | void append(std::string& s, float v) 22 | { 23 | char buf[64]; 24 | snprintf(buf, sizeof(buf), "%.9g", v); 25 | s += buf; 26 | } 27 | 28 | void append(std::string& s, const char* v) 29 | { 30 | s += v; 31 | } 32 | 33 | void append(std::string& s, const std::string& v) 34 | { 35 | s += v; 36 | } 37 | 38 | void appendJson(std::string& s, const char* begin, const char* end) 39 | { 40 | enum State 41 | { 42 | None, 43 | Escape, 44 | Quoted 45 | } state = None; 46 | 47 | for (const char* it = begin; it != end; ++it) 48 | { 49 | char ch = *it; 50 | 51 | // whitespace outside of quoted strings can be ignored 52 | if (state != None || !isspace(ch)) 53 | s += ch; 54 | 55 | // the finite automata tracks whether we're inside a quoted string 56 | switch (state) 57 | { 58 | case None: 59 | state = (ch == '"') ? Quoted : None; 60 | break; 61 | 62 | case Quoted: 63 | state = (ch == '"') ? None : (ch == '\\') ? Escape : Quoted; 64 | break; 65 | 66 | case Escape: 67 | state = Quoted; 68 | break; 69 | 70 | default: 71 | assert(!"Unexpected parsing state"); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/gltf/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gltfpack", 3 | "version": "0.18.0", 4 | "description": "A command-line tool that can optimize glTF files for size and speed", 5 | "author": "Arseny Kapoulkine", 6 | "license": "MIT", 7 | "bugs": "https://github.com/zeux/meshoptimizer/issues", 8 | "homepage": "https://github.com/zeux/meshoptimizer", 9 | "keywords": [ 10 | "gltf" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/zeux/meshoptimizer" 15 | }, 16 | "bin": "./cli.js", 17 | "main": "./library.js", 18 | "files": [ 19 | "*.js", "*.wasm" 20 | ], 21 | "scripts": { 22 | "prepublishOnly": "node cli.js -v" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/gltf/wasistubs.cpp: -------------------------------------------------------------------------------- 1 | #ifdef __wasi__ 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | extern "C" void __cxa_throw(void* ptr, void* type, void* destructor) 8 | { 9 | abort(); 10 | } 11 | 12 | extern "C" void* __cxa_allocate_exception(size_t thrown_size) 13 | { 14 | abort(); 15 | } 16 | 17 | extern "C" int32_t __wasi_path_open32(int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3, int32_t arg4, int32_t arg5, int32_t arg6, int32_t arg7, int32_t arg8) 18 | __attribute__(( 19 | __import_module__("wasi_snapshot_preview1"), 20 | __import_name__("path_open32"), 21 | __warn_unused_result__)); 22 | 23 | extern "C" int32_t __imported_wasi_snapshot_preview1_path_open(int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3, int32_t arg4, int64_t arg5, int64_t arg6, int32_t arg7, int32_t arg8) 24 | { 25 | return __wasi_path_open32(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); 26 | } 27 | 28 | extern "C" int32_t __wasi_fd_seek32(int32_t arg0, int32_t arg1, int32_t arg2, int32_t arg3) 29 | __attribute__(( 30 | __import_module__("wasi_snapshot_preview1"), 31 | __import_name__("fd_seek32"), 32 | __warn_unused_result__)); 33 | 34 | extern "C" int32_t __imported_wasi_snapshot_preview1_fd_seek(int32_t arg0, int64_t arg1, int32_t arg2, int32_t arg3) 35 | { 36 | *(uint64_t*)arg3 = 0; 37 | return __wasi_fd_seek32(arg0, arg1, arg2, arg3); 38 | } 39 | 40 | extern "C" int32_t __imported_wasi_snapshot_preview1_clock_time_get(int32_t arg0, int64_t arg1, int32_t arg2) 41 | { 42 | return __WASI_ERRNO_NOSYS; 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/gltf/wasistubs.txt: -------------------------------------------------------------------------------- 1 | __wasi_path_open32 2 | __wasi_fd_seek32 3 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/index.js: -------------------------------------------------------------------------------- 1 | const MeshoptEncoder = require('./meshopt_encoder.js'); 2 | const MeshoptDecoder = require('./meshopt_decoder.js'); 3 | 4 | module.exports = {MeshoptEncoder, MeshoptDecoder}; 5 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/index.module.d.ts: -------------------------------------------------------------------------------- 1 | export * from './meshopt_encoder.module'; 2 | export * from './meshopt_decoder.module'; 3 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/index.module.js: -------------------------------------------------------------------------------- 1 | export * from './meshopt_encoder.module.js'; 2 | export * from './meshopt_decoder.module.js'; 3 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/meshopt_decoder.module.d.ts: -------------------------------------------------------------------------------- 1 | // This file is part of meshoptimizer library and is distributed under the terms of MIT License. 2 | // Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 3 | export const MeshoptDecoder: { 4 | supported: boolean; 5 | ready: Promise; 6 | 7 | decodeVertexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, filter?: string) => void; 8 | decodeIndexBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void; 9 | decodeIndexSequence: (target: Uint8Array, count: number, size: number, source: Uint8Array) => void; 10 | 11 | decodeGltfBuffer: (target: Uint8Array, count: number, size: number, source: Uint8Array, mode: string, filter?: string) => void; 12 | }; 13 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/meshopt_encoder.module.d.ts: -------------------------------------------------------------------------------- 1 | // This file is part of meshoptimizer library and is distributed under the terms of MIT License. 2 | // Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 3 | export const MeshoptEncoder: { 4 | supported: boolean; 5 | ready: Promise; 6 | 7 | reorderMesh: (indices: Uint32Array, triangles: boolean, optsize: boolean) => [Uint32Array, number]; 8 | 9 | encodeVertexBuffer: (source: Uint8Array, count: number, size: number) => Uint8Array; 10 | encodeIndexBuffer: (source: Uint8Array, count: number, size: number) => Uint8Array; 11 | encodeIndexSequence: (source: Uint8Array, count: number, size: number) => Uint8Array; 12 | 13 | encodeGltfBuffer: (source: Uint8Array, count: number, size: number, mode: string) => Uint8Array; 14 | 15 | encodeFilterOct: (source: Float32Array, count: number, stride: number, bits: number) => Uint8Array; 16 | encodeFilterQuat: (source: Float32Array, count: number, stride: number, bits: number) => Uint8Array; 17 | encodeFilterExp: (source: Float32Array, count: number, stride: number, bits: number) => Uint8Array; 18 | }; 19 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/meshopt_simplifier.module.d.ts: -------------------------------------------------------------------------------- 1 | // This file is part of meshoptimizer library and is distributed under the terms of MIT License. 2 | // Copyright (C) 2016-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) 3 | export type Flags = "LockBorder"; 4 | 5 | export const MeshoptSimplifier: { 6 | supported: boolean; 7 | ready: Promise; 8 | 9 | compactMesh: (indices: Uint32Array) => [Uint32Array, number]; 10 | 11 | simplify(indices: Uint32Array, vertex_positions: Float32Array, vertex_positions_stride: number, target_index_count: number, target_error: number, flags?: [Flags]) => [Uint32Array, number]; 12 | 13 | getScale: (vertex_positions: Float32Array, vertex_positions_stride: number) => number; 14 | }; 15 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "meshoptimizer", 3 | "version": "0.18.0", 4 | "description": "Mesh optimizaiton library that makes meshes smaller and faster to render", 5 | "author": "Arseny Kapoulkine", 6 | "license": "MIT", 7 | "bugs": "https://github.com/zeux/meshoptimizer/issues", 8 | "homepage": "https://github.com/zeux/meshoptimizer", 9 | "keywords": [ 10 | "compression", 11 | "mesh" 12 | ], 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/zeux/meshoptimizer" 16 | }, 17 | "files": [ 18 | "*.js", "*.ts" 19 | ], 20 | "main": "index.js", 21 | "module": "index.module.js", 22 | "types": "index.module.d.ts", 23 | "scripts": { 24 | "test": "node meshopt_encoder.test.js && node meshopt_decoder.test.js && node meshopt_simplifier.test.js", 25 | "prepublishOnly": "npm test" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/src/allocator.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of meshoptimizer library; see meshoptimizer.h for version/license details 2 | #include "meshoptimizer.h" 3 | 4 | void meshopt_setAllocator(void* (MESHOPTIMIZER_ALLOC_CALLCONV *allocate)(size_t), void (MESHOPTIMIZER_ALLOC_CALLCONV *deallocate)(void*)) 5 | { 6 | meshopt_Allocator::Storage::allocate = allocate; 7 | meshopt_Allocator::Storage::deallocate = deallocate; 8 | } 9 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/src/vfetchanalyzer.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of meshoptimizer library; see meshoptimizer.h for version/license details 2 | #include "meshoptimizer.h" 3 | 4 | #include 5 | #include 6 | 7 | meshopt_VertexFetchStatistics meshopt_analyzeVertexFetch(const unsigned int* indices, size_t index_count, size_t vertex_count, size_t vertex_size) 8 | { 9 | assert(index_count % 3 == 0); 10 | assert(vertex_size > 0 && vertex_size <= 256); 11 | 12 | meshopt_Allocator allocator; 13 | 14 | meshopt_VertexFetchStatistics result = {}; 15 | 16 | unsigned char* vertex_visited = allocator.allocate(vertex_count); 17 | memset(vertex_visited, 0, vertex_count); 18 | 19 | const size_t kCacheLine = 64; 20 | const size_t kCacheSize = 128 * 1024; 21 | 22 | // simple direct mapped cache; on typical mesh data this is close to 4-way cache, and this model is a gross approximation anyway 23 | size_t cache[kCacheSize / kCacheLine] = {}; 24 | 25 | for (size_t i = 0; i < index_count; ++i) 26 | { 27 | unsigned int index = indices[i]; 28 | assert(index < vertex_count); 29 | 30 | vertex_visited[index] = 1; 31 | 32 | size_t start_address = index * vertex_size; 33 | size_t end_address = start_address + vertex_size; 34 | 35 | size_t start_tag = start_address / kCacheLine; 36 | size_t end_tag = (end_address + kCacheLine - 1) / kCacheLine; 37 | 38 | assert(start_tag < end_tag); 39 | 40 | for (size_t tag = start_tag; tag < end_tag; ++tag) 41 | { 42 | size_t line = tag % (sizeof(cache) / sizeof(cache[0])); 43 | 44 | // we store +1 since cache is filled with 0 by default 45 | result.bytes_fetched += (cache[line] != tag + 1) * kCacheLine; 46 | cache[line] = tag + 1; 47 | } 48 | } 49 | 50 | size_t unique_vertex_count = 0; 51 | 52 | for (size_t i = 0; i < vertex_count; ++i) 53 | unique_vertex_count += vertex_visited[i]; 54 | 55 | result.overfetch = unique_vertex_count == 0 ? 0 : float(result.bytes_fetched) / float(unique_vertex_count * vertex_size); 56 | 57 | return result; 58 | } 59 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/tools/codecfuzz.cpp: -------------------------------------------------------------------------------- 1 | #include "../src/meshoptimizer.h" 2 | 3 | #include 4 | #include 5 | 6 | void fuzzDecoder(const uint8_t* data, size_t size, size_t stride, int (*decode)(void*, size_t, size_t, const unsigned char*, size_t)) 7 | { 8 | size_t count = 66; // must be divisible by 3 for decodeIndexBuffer; should be >=64 to cover large vertex blocks 9 | 10 | void* destination = malloc(count * stride); 11 | assert(destination); 12 | 13 | int rc = decode(destination, count, stride, reinterpret_cast(data), size); 14 | (void)rc; 15 | 16 | free(destination); 17 | } 18 | 19 | namespace meshopt 20 | { 21 | extern unsigned int cpuid; 22 | } 23 | 24 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) 25 | { 26 | // decodeIndexBuffer supports 2 and 4-byte indices 27 | fuzzDecoder(data, size, 2, meshopt_decodeIndexBuffer); 28 | fuzzDecoder(data, size, 4, meshopt_decodeIndexBuffer); 29 | 30 | // decodeIndexSequence supports 2 and 4-byte indices 31 | fuzzDecoder(data, size, 2, meshopt_decodeIndexSequence); 32 | fuzzDecoder(data, size, 4, meshopt_decodeIndexSequence); 33 | 34 | // decodeVertexBuffer supports any strides divisible by 4 in 4-256 interval 35 | // It's a waste of time to check all of them, so we'll just check a few with different alignment mod 16 36 | fuzzDecoder(data, size, 4, meshopt_decodeVertexBuffer); 37 | fuzzDecoder(data, size, 16, meshopt_decodeVertexBuffer); 38 | fuzzDecoder(data, size, 24, meshopt_decodeVertexBuffer); 39 | fuzzDecoder(data, size, 32, meshopt_decodeVertexBuffer); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/tools/meshloader.cpp: -------------------------------------------------------------------------------- 1 | #ifndef _CRT_SECURE_NO_WARNINGS 2 | #define _CRT_SECURE_NO_WARNINGS 3 | #endif 4 | 5 | #define CGLTF_IMPLEMENTATION 6 | #include "../extern/cgltf.h" 7 | 8 | #define FAST_OBJ_IMPLEMENTATION 9 | #include "../extern/fast_obj.h" 10 | -------------------------------------------------------------------------------- /ext/libvkr/ext/meshoptimizer-0.18/tools/wasmpack.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import sys 4 | 5 | # regenerate with wasmpack.py generate 6 | table = [32, 0, 65, 2, 1, 106, 34, 33, 3, 128, 11, 4, 13, 64, 6, 253, 10, 7, 15, 116, 127, 5, 8, 12, 40, 16, 19, 54, 20, 9, 27, 255, 113, 17, 42, 67, 24, 23, 146, 148, 18, 14, 22, 45, 70, 69, 56, 114, 101, 21, 25, 63, 75, 136, 108, 28, 118, 29, 73, 115] 7 | 8 | base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 9 | 10 | def encode(buffer): 11 | result = '' 12 | 13 | for ch in buffer.read(): 14 | if ch in table: 15 | index = table.index(ch) 16 | result += base64[index] 17 | else: 18 | result += base64[60 + ch // 64] 19 | result += base64[ch % 64] 20 | 21 | return result 22 | 23 | def stats(buffer): 24 | hist = [0] * 256 25 | for ch in buffer.read(): 26 | hist[ch] += 1 27 | 28 | result = [i for i in range(256)] 29 | result.sort(key=lambda i: hist[i], reverse=True) 30 | 31 | return result 32 | 33 | if sys.argv[-1] == 'generate': 34 | print(stats(sys.stdin.buffer)[:60]) 35 | else: 36 | print(encode(sys.stdin.buffer)) 37 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/.doxyfile: -------------------------------------------------------------------------------- 1 | INCLUDE_PATH += @CUR_DIR 2 | PREDEFINED += NPY_INTERNAL_BUILD 3 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/_numpyconfig.h: -------------------------------------------------------------------------------- 1 | #define NPY_SIZEOF_SHORT SIZEOF_SHORT 2 | #define NPY_SIZEOF_INT SIZEOF_INT 3 | #define NPY_SIZEOF_LONG SIZEOF_LONG 4 | #define NPY_SIZEOF_FLOAT 4 5 | #define NPY_SIZEOF_COMPLEX_FLOAT 8 6 | #define NPY_SIZEOF_DOUBLE 8 7 | #define NPY_SIZEOF_COMPLEX_DOUBLE 16 8 | #define NPY_SIZEOF_LONGDOUBLE 8 9 | #define NPY_SIZEOF_COMPLEX_LONGDOUBLE 16 10 | #define NPY_SIZEOF_PY_INTPTR_T 8 11 | #define NPY_SIZEOF_OFF_T 4 12 | #define NPY_SIZEOF_PY_LONG_LONG 8 13 | #define NPY_SIZEOF_LONGLONG 8 14 | #define NPY_NO_SIGNAL 1 15 | #define NPY_NO_SMP 0 16 | #define NPY_HAVE_DECL_ISNAN 17 | #define NPY_HAVE_DECL_ISINF 18 | #define NPY_HAVE_DECL_SIGNBIT 19 | #define NPY_HAVE_DECL_ISFINITE 20 | #define NPY_USE_C99_COMPLEX 1 21 | #define NPY_RELAXED_STRIDES_CHECKING 1 22 | #define NPY_USE_C99_FORMATS 1 23 | #define NPY_VISIBILITY_HIDDEN 24 | #define NPY_ABI_VERSION 0x01000009 25 | #define NPY_API_VERSION 0x0000000F 26 | 27 | #ifndef __STDC_FORMAT_MACROS 28 | #define __STDC_FORMAT_MACROS 1 29 | #endif 30 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/arrayobject.h: -------------------------------------------------------------------------------- 1 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_ARRAYOBJECT_H_ 2 | #define NUMPY_CORE_INCLUDE_NUMPY_ARRAYOBJECT_H_ 3 | #define Py_ARRAYOBJECT_H 4 | 5 | #include "ndarrayobject.h" 6 | #include "npy_interrupt.h" 7 | 8 | #ifdef NPY_NO_PREFIX 9 | #include "noprefix.h" 10 | #endif 11 | 12 | #endif /* NUMPY_CORE_INCLUDE_NUMPY_ARRAYOBJECT_H_ */ 13 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/libdivide/LICENSE.txt: -------------------------------------------------------------------------------- 1 | zlib License 2 | ------------ 3 | 4 | Copyright (C) 2010 - 2019 ridiculous_fish, 5 | Copyright (C) 2016 - 2019 Kim Walisch, 6 | 7 | This software is provided 'as-is', without any express or implied 8 | warranty. In no event will the authors be held liable for any damages 9 | arising from the use of this software. 10 | 11 | Permission is granted to anyone to use this software for any purpose, 12 | including commercial applications, and to alter it and redistribute it 13 | freely, subject to the following restrictions: 14 | 15 | 1. The origin of this software must not be misrepresented; you must not 16 | claim that you wrote the original software. If you use this software 17 | in a product, an acknowledgment in the product documentation would be 18 | appreciated but is not required. 19 | 2. Altered source versions must be plainly marked as such, and must not be 20 | misrepresented as being the original software. 21 | 3. This notice may not be removed or altered from any source distribution. 22 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/npy_no_deprecated_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This include file is provided for inclusion in Cython *.pyd files where 3 | * one would like to define the NPY_NO_DEPRECATED_API macro. It can be 4 | * included by 5 | * 6 | * cdef extern from "npy_no_deprecated_api.h": pass 7 | * 8 | */ 9 | #ifndef NPY_NO_DEPRECATED_API 10 | 11 | /* put this check here since there may be multiple includes in C extensions. */ 12 | #if defined(NUMPY_CORE_INCLUDE_NUMPY_NDARRAYTYPES_H_) || \ 13 | defined(NUMPY_CORE_INCLUDE_NUMPY_NPY_DEPRECATED_API_H) || \ 14 | defined(NUMPY_CORE_INCLUDE_NUMPY_OLD_DEFINES_H_) 15 | #error "npy_no_deprecated_api.h" must be first among numpy includes. 16 | #else 17 | #define NPY_NO_DEPRECATED_API NPY_API_VERSION 18 | #endif 19 | 20 | #endif /* NPY_NO_DEPRECATED_API */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/npy_os.h: -------------------------------------------------------------------------------- 1 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_OS_H_ 2 | #define NUMPY_CORE_INCLUDE_NUMPY_NPY_OS_H_ 3 | 4 | #if defined(linux) || defined(__linux) || defined(__linux__) 5 | #define NPY_OS_LINUX 6 | #elif defined(__FreeBSD__) || defined(__NetBSD__) || \ 7 | defined(__OpenBSD__) || defined(__DragonFly__) 8 | #define NPY_OS_BSD 9 | #ifdef __FreeBSD__ 10 | #define NPY_OS_FREEBSD 11 | #elif defined(__NetBSD__) 12 | #define NPY_OS_NETBSD 13 | #elif defined(__OpenBSD__) 14 | #define NPY_OS_OPENBSD 15 | #elif defined(__DragonFly__) 16 | #define NPY_OS_DRAGONFLY 17 | #endif 18 | #elif defined(sun) || defined(__sun) 19 | #define NPY_OS_SOLARIS 20 | #elif defined(__CYGWIN__) 21 | #define NPY_OS_CYGWIN 22 | #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 23 | #define NPY_OS_WIN32 24 | #elif defined(__APPLE__) 25 | #define NPY_OS_DARWIN 26 | #else 27 | #define NPY_OS_UNKNOWN 28 | #endif 29 | 30 | #endif /* NUMPY_CORE_INCLUDE_NUMPY_NPY_OS_H_ */ 31 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/oldnumeric.h: -------------------------------------------------------------------------------- 1 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_OLDNUMERIC_H_ 2 | #define NUMPY_CORE_INCLUDE_NUMPY_OLDNUMERIC_H_ 3 | 4 | /* FIXME -- this file can be deleted? */ 5 | 6 | #include "arrayobject.h" 7 | 8 | #ifndef PYPY_VERSION 9 | #ifndef REFCOUNT 10 | # define REFCOUNT NPY_REFCOUNT 11 | # define MAX_ELSIZE 16 12 | #endif 13 | #endif 14 | 15 | #define PyArray_UNSIGNED_TYPES 16 | #define PyArray_SBYTE NPY_BYTE 17 | #define PyArray_CopyArray PyArray_CopyInto 18 | #define _PyArray_multiply_list PyArray_MultiplyIntList 19 | #define PyArray_ISSPACESAVER(m) NPY_FALSE 20 | #define PyScalarArray_Check PyArray_CheckScalar 21 | 22 | #define CONTIGUOUS NPY_CONTIGUOUS 23 | #define OWN_DIMENSIONS 0 24 | #define OWN_STRIDES 0 25 | #define OWN_DATA NPY_OWNDATA 26 | #define SAVESPACE 0 27 | #define SAVESPACEBIT 0 28 | 29 | #undef import_array 30 | #define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } } 31 | 32 | #endif /* NUMPY_CORE_INCLUDE_NUMPY_OLDNUMERIC_H_ */ 33 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/random/bitgen.h: -------------------------------------------------------------------------------- 1 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_RANDOM_BITGEN_H_ 2 | #define NUMPY_CORE_INCLUDE_NUMPY_RANDOM_BITGEN_H_ 3 | 4 | #pragma once 5 | #include 6 | #include 7 | #include 8 | 9 | /* Must match the declaration in numpy/random/.pxd */ 10 | 11 | typedef struct bitgen { 12 | void *state; 13 | uint64_t (*next_uint64)(void *st); 14 | uint32_t (*next_uint32)(void *st); 15 | double (*next_double)(void *st); 16 | uint64_t (*next_raw)(void *st); 17 | } bitgen_t; 18 | 19 | 20 | #endif /* NUMPY_CORE_INCLUDE_NUMPY_RANDOM_BITGEN_H_ */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/numpy-1.21.0/include/numpy/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef NUMPY_CORE_INCLUDE_NUMPY_UTILS_H_ 2 | #define NUMPY_CORE_INCLUDE_NUMPY_UTILS_H_ 3 | 4 | #ifndef __COMP_NPY_UNUSED 5 | #if defined(__GNUC__) 6 | #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) 7 | #elif defined(__ICC) 8 | #define __COMP_NPY_UNUSED __attribute__ ((__unused__)) 9 | #elif defined(__clang__) 10 | #define __COMP_NPY_UNUSED __attribute__ ((unused)) 11 | #else 12 | #define __COMP_NPY_UNUSED 13 | #endif 14 | #endif 15 | 16 | #if defined(__GNUC__) || defined(__ICC) || defined(__clang__) 17 | #define NPY_DECL_ALIGNED(x) __attribute__ ((aligned (x))) 18 | #elif defined(_MSC_VER) 19 | #define NPY_DECL_ALIGNED(x) __declspec(align(x)) 20 | #else 21 | #define NPY_DECL_ALIGNED(x) 22 | #endif 23 | 24 | /* Use this to tag a variable as not used. It will remove unused variable 25 | * warning on support platforms (see __COM_NPY_UNUSED) and mangle the variable 26 | * to avoid accidental use */ 27 | #define NPY_UNUSED(x) (__NPY_UNUSED_TAGGED ## x) __COMP_NPY_UNUSED 28 | #define NPY_EXPAND(x) x 29 | 30 | #define NPY_STRINGIFY(x) #x 31 | #define NPY_TOSTRING(x) NPY_STRINGIFY(x) 32 | 33 | #define NPY_CAT__(a, b) a ## b 34 | #define NPY_CAT_(a, b) NPY_CAT__(a, b) 35 | #define NPY_CAT(a, b) NPY_CAT_(a, b) 36 | 37 | #endif /* NUMPY_CORE_INCLUDE_NUMPY_UTILS_H_ */ 38 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/ImDib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Python Imaging Library 3 | * $Id$ 4 | * 5 | * Windows DIB specifics 6 | * 7 | * Copyright (c) Secret Labs AB 1997-98. 8 | * Copyright (c) Fredrik Lundh 1996. 9 | * 10 | * See the README file for information on usage and redistribution. 11 | */ 12 | 13 | #ifdef _WIN32 14 | 15 | #include "ImPlatform.h" 16 | 17 | #if defined(__cplusplus) 18 | extern "C" { 19 | #endif 20 | 21 | struct ImagingDIBInstance { 22 | /* Windows interface */ 23 | HDC dc; 24 | HBITMAP bitmap; 25 | HGDIOBJ old_bitmap; 26 | BITMAPINFO *info; 27 | UINT8 *bits; 28 | HPALETTE palette; 29 | /* Used by cut and paste */ 30 | char mode[4]; 31 | int xsize, ysize; 32 | int pixelsize; 33 | int linesize; 34 | ImagingShuffler pack; 35 | ImagingShuffler unpack; 36 | }; 37 | 38 | typedef struct ImagingDIBInstance *ImagingDIB; 39 | 40 | extern char * 41 | ImagingGetModeDIB(int size_out[2]); 42 | 43 | extern ImagingDIB 44 | ImagingNewDIB(const char *mode, int xsize, int ysize); 45 | 46 | extern void 47 | ImagingDeleteDIB(ImagingDIB im); 48 | 49 | extern void 50 | ImagingDrawDIB(ImagingDIB dib, void *dc, int dst[4], int src[4]); 51 | extern void 52 | ImagingExposeDIB(ImagingDIB dib, void *dc); 53 | 54 | extern int 55 | ImagingQueryPaletteDIB(ImagingDIB dib, void *dc); 56 | 57 | extern void 58 | ImagingPasteDIB(ImagingDIB dib, Imaging im, int xy[4]); 59 | 60 | #if defined(__cplusplus) 61 | } 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/ImPlatform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Python Imaging Library 3 | * $Id$ 4 | * 5 | * platform declarations for the imaging core library 6 | * 7 | * Copyright (c) Fredrik Lundh 1995-2003. 8 | */ 9 | 10 | #include "Python.h" 11 | 12 | /* Check that we have an ANSI compliant compiler */ 13 | #ifndef HAVE_PROTOTYPES 14 | #error Sorry, this library requires support for ANSI prototypes. 15 | #endif 16 | #ifndef STDC_HEADERS 17 | #error Sorry, this library requires ANSI header files. 18 | #endif 19 | 20 | #if defined(PIL_NO_INLINE) 21 | #define inline 22 | #else 23 | #if defined(_MSC_VER) && !defined(__GNUC__) 24 | #define inline __inline 25 | #endif 26 | #endif 27 | 28 | #if defined(_WIN32) || defined(__CYGWIN__) 29 | 30 | #define WIN32_LEAN_AND_MEAN 31 | #include 32 | 33 | #ifdef __CYGWIN__ 34 | #undef _WIN64 35 | #undef _WIN32 36 | #undef __WIN32__ 37 | #undef WIN32 38 | #endif 39 | 40 | #else 41 | /* For System that are not Windows, we'll need to define these. */ 42 | 43 | #if SIZEOF_SHORT == 2 44 | #define INT16 short 45 | #elif SIZEOF_INT == 2 46 | #define INT16 int 47 | #else 48 | #define INT16 short /* most things works just fine anyway... */ 49 | #endif 50 | 51 | #if SIZEOF_SHORT == 4 52 | #define INT32 short 53 | #elif SIZEOF_INT == 4 54 | #define INT32 int 55 | #elif SIZEOF_LONG == 4 56 | #define INT32 long 57 | #else 58 | #error Cannot find required 32-bit integer type 59 | #endif 60 | 61 | #if SIZEOF_LONG == 8 62 | #define INT64 long 63 | #elif SIZEOF_LONG_LONG == 8 64 | #define INT64 long 65 | #endif 66 | 67 | #define INT8 signed char 68 | #define UINT8 unsigned char 69 | 70 | #define UINT16 unsigned INT16 71 | #define UINT32 unsigned INT32 72 | 73 | #endif 74 | 75 | /* assume IEEE; tweak if necessary (patches are welcome) */ 76 | #define FLOAT16 UINT16 77 | #define FLOAT32 float 78 | #define FLOAT64 double 79 | 80 | #ifdef _MSC_VER 81 | typedef signed __int64 int64_t; 82 | #endif 83 | 84 | #ifdef __GNUC__ 85 | #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 86 | #endif 87 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/ImagingUtils.h: -------------------------------------------------------------------------------- 1 | #ifdef WORDS_BIGENDIAN 2 | #define MAKE_UINT32(u0, u1, u2, u3) \ 3 | ((UINT32)(u3) | ((UINT32)(u2) << 8) | ((UINT32)(u1) << 16) | ((UINT32)(u0) << 24)) 4 | #define MASK_UINT32_CHANNEL_0 0xff000000 5 | #define MASK_UINT32_CHANNEL_1 0x00ff0000 6 | #define MASK_UINT32_CHANNEL_2 0x0000ff00 7 | #define MASK_UINT32_CHANNEL_3 0x000000ff 8 | #else 9 | #define MAKE_UINT32(u0, u1, u2, u3) \ 10 | ((UINT32)(u0) | ((UINT32)(u1) << 8) | ((UINT32)(u2) << 16) | ((UINT32)(u3) << 24)) 11 | #define MASK_UINT32_CHANNEL_0 0x000000ff 12 | #define MASK_UINT32_CHANNEL_1 0x0000ff00 13 | #define MASK_UINT32_CHANNEL_2 0x00ff0000 14 | #define MASK_UINT32_CHANNEL_3 0xff000000 15 | #endif 16 | 17 | #define SHIFTFORDIV255(a) ((((a) >> 8) + a) >> 8) 18 | 19 | /* like (a * b + 127) / 255), but much faster on most platforms */ 20 | #define MULDIV255(a, b, tmp) (tmp = (a) * (b) + 128, SHIFTFORDIV255(tmp)) 21 | 22 | #define DIV255(a, tmp) (tmp = (a) + 128, SHIFTFORDIV255(tmp)) 23 | 24 | #define BLEND(mask, in1, in2, tmp1) DIV255(in1 *(255 - mask) + in2 * mask, tmp1) 25 | 26 | #define PREBLEND(mask, in1, in2, tmp1) (MULDIV255(in1, (255 - mask), tmp1) + in2) 27 | 28 | #define CLIP8(v) ((v) <= 0 ? 0 : (v) < 256 ? (v) : 255) 29 | 30 | /* This is to work around a bug in GCC prior 4.9 in 64 bit mode. 31 | GCC generates code with partial dependency which is 3 times slower. 32 | See: https://stackoverflow.com/a/26588074/253146 */ 33 | #if defined(__x86_64__) && defined(__SSE__) && !defined(__NO_INLINE__) && \ 34 | !defined(__clang__) && defined(GCC_VERSION) && (GCC_VERSION < 40900) 35 | static float __attribute__((always_inline)) inline _i2f(int v) { 36 | float x; 37 | __asm__("xorps %0, %0; cvtsi2ss %1, %0" : "=x"(x) : "r"(v)); 38 | return x; 39 | } 40 | #else 41 | static float inline _i2f(int v) { return (float)v; } 42 | #endif 43 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/bltinmodule.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_BLTINMODULE_H 2 | #define Py_BLTINMODULE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_DATA(PyTypeObject) PyFilter_Type; 8 | PyAPI_DATA(PyTypeObject) PyMap_Type; 9 | PyAPI_DATA(PyTypeObject) PyZip_Type; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif /* !Py_BLTINMODULE_H */ 15 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/boolobject.h: -------------------------------------------------------------------------------- 1 | /* Boolean object interface */ 2 | 3 | #ifndef Py_BOOLOBJECT_H 4 | #define Py_BOOLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | PyAPI_DATA(PyTypeObject) PyBool_Type; 11 | 12 | #define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type) 13 | 14 | /* Py_False and Py_True are the only two bools in existence. 15 | Don't forget to apply Py_INCREF() when returning either!!! */ 16 | 17 | /* Don't use these directly */ 18 | PyAPI_DATA(struct _longobject) _Py_FalseStruct; 19 | PyAPI_DATA(struct _longobject) _Py_TrueStruct; 20 | 21 | /* Use these macros */ 22 | #define Py_False ((PyObject *) &_Py_FalseStruct) 23 | #define Py_True ((PyObject *) &_Py_TrueStruct) 24 | 25 | // Test if an object is the True singleton, the same as "x is True" in Python. 26 | PyAPI_FUNC(int) Py_IsTrue(PyObject *x); 27 | #define Py_IsTrue(x) Py_Is((x), Py_True) 28 | 29 | // Test if an object is the False singleton, the same as "x is False" in Python. 30 | PyAPI_FUNC(int) Py_IsFalse(PyObject *x); 31 | #define Py_IsFalse(x) Py_Is((x), Py_False) 32 | 33 | /* Macros for returning Py_True or Py_False, respectively */ 34 | #define Py_RETURN_TRUE return Py_NewRef(Py_True) 35 | #define Py_RETURN_FALSE return Py_NewRef(Py_False) 36 | 37 | /* Function to return a bool from a C long */ 38 | PyAPI_FUNC(PyObject *) PyBool_FromLong(long); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | #endif /* !Py_BOOLOBJECT_H */ 44 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/bytearrayobject.h: -------------------------------------------------------------------------------- 1 | /* ByteArray object interface */ 2 | 3 | #ifndef Py_BYTEARRAYOBJECT_H 4 | #define Py_BYTEARRAYOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include 10 | 11 | /* Type PyByteArrayObject represents a mutable array of bytes. 12 | * The Python API is that of a sequence; 13 | * the bytes are mapped to ints in [0, 256). 14 | * Bytes are not characters; they may be used to encode characters. 15 | * The only way to go between bytes and str/unicode is via encoding 16 | * and decoding. 17 | * For the convenience of C programmers, the bytes type is considered 18 | * to contain a char pointer, not an unsigned char pointer. 19 | */ 20 | 21 | /* Type object */ 22 | PyAPI_DATA(PyTypeObject) PyByteArray_Type; 23 | PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; 24 | 25 | /* Type check macros */ 26 | #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) 27 | #define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type) 28 | 29 | /* Direct API functions */ 30 | PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); 31 | PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); 32 | PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); 33 | PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); 34 | PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); 35 | PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); 36 | 37 | #ifndef Py_LIMITED_API 38 | # define Py_CPYTHON_BYTEARRAYOBJECT_H 39 | # include "cpython/bytearrayobject.h" 40 | # undef Py_CPYTHON_BYTEARRAYOBJECT_H 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* !Py_BYTEARRAYOBJECT_H */ 47 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cellobject.h: -------------------------------------------------------------------------------- 1 | /* Cell object interface */ 2 | #ifndef Py_LIMITED_API 3 | #ifndef Py_CELLOBJECT_H 4 | #define Py_CELLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct { 10 | PyObject_HEAD 11 | PyObject *ob_ref; /* Content of the cell or NULL when empty */ 12 | } PyCellObject; 13 | 14 | PyAPI_DATA(PyTypeObject) PyCell_Type; 15 | 16 | #define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type) 17 | 18 | PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); 19 | PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); 20 | PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); 21 | 22 | #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) 23 | #define PyCell_SET(op, v) ((void)(((PyCellObject *)(op))->ob_ref = v)) 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_TUPLEOBJECT_H */ 29 | #endif /* Py_LIMITED_API */ 30 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/classobject.h: -------------------------------------------------------------------------------- 1 | /* Former class object interface -- now only bound methods are here */ 2 | 3 | /* Revealing some structures (not for general use) */ 4 | 5 | #ifndef Py_LIMITED_API 6 | #ifndef Py_CLASSOBJECT_H 7 | #define Py_CLASSOBJECT_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | PyObject_HEAD 14 | PyObject *im_func; /* The callable object implementing the method */ 15 | PyObject *im_self; /* The instance it is bound to */ 16 | PyObject *im_weakreflist; /* List of weak references */ 17 | vectorcallfunc vectorcall; 18 | } PyMethodObject; 19 | 20 | PyAPI_DATA(PyTypeObject) PyMethod_Type; 21 | 22 | #define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type) 23 | 24 | PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *); 25 | 26 | PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); 27 | PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); 28 | 29 | /* Macros for direct access to these values. Type checks are *not* 30 | done, so use with care. */ 31 | #define PyMethod_GET_FUNCTION(meth) \ 32 | (((PyMethodObject *)meth) -> im_func) 33 | #define PyMethod_GET_SELF(meth) \ 34 | (((PyMethodObject *)meth) -> im_self) 35 | 36 | typedef struct { 37 | PyObject_HEAD 38 | PyObject *func; 39 | } PyInstanceMethodObject; 40 | 41 | PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type; 42 | 43 | #define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type) 44 | 45 | PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *); 46 | PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *); 47 | 48 | /* Macros for direct access to these values. Type checks are *not* 49 | done, so use with care. */ 50 | #define PyInstanceMethod_GET_FUNCTION(meth) \ 51 | (((PyInstanceMethodObject *)meth) -> func) 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif /* !Py_CLASSOBJECT_H */ 57 | #endif /* Py_LIMITED_API */ 58 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/code.h: -------------------------------------------------------------------------------- 1 | /* Definitions for bytecode */ 2 | 3 | #ifndef Py_CODE_H 4 | #define Py_CODE_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct PyCodeObject PyCodeObject; 10 | 11 | #ifndef Py_LIMITED_API 12 | # define Py_CPYTHON_CODE_H 13 | # include "cpython/code.h" 14 | # undef Py_CPYTHON_CODE_H 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | #endif /* !Py_CODE_H */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/compile.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_COMPILE_H 2 | #define Py_COMPILE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* These definitions must match corresponding definitions in graminit.h. */ 8 | #define Py_single_input 256 9 | #define Py_file_input 257 10 | #define Py_eval_input 258 11 | #define Py_func_type_input 345 12 | 13 | /* This doesn't need to match anything */ 14 | #define Py_fstring_input 800 15 | 16 | #ifndef Py_LIMITED_API 17 | # define Py_CPYTHON_COMPILE_H 18 | # include "cpython/compile.h" 19 | # undef Py_CPYTHON_COMPILE_H 20 | #endif 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif /* !Py_COMPILE_H */ 26 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/bytearrayobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_BYTEARRAYOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | /* Object layout */ 6 | typedef struct { 7 | PyObject_VAR_HEAD 8 | Py_ssize_t ob_alloc; /* How many bytes allocated in ob_bytes */ 9 | char *ob_bytes; /* Physical backing buffer */ 10 | char *ob_start; /* Logical start inside ob_bytes */ 11 | Py_ssize_t ob_exports; /* How many buffer exports */ 12 | } PyByteArrayObject; 13 | 14 | /* Macros, trading safety for speed */ 15 | #define PyByteArray_AS_STRING(self) \ 16 | (assert(PyByteArray_Check(self)), \ 17 | Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_start : _PyByteArray_empty_string) 18 | #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)), Py_SIZE(self)) 19 | 20 | PyAPI_DATA(char) _PyByteArray_empty_string[]; 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/ceval.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_CEVAL_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); 6 | PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); 7 | PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); 8 | PyAPI_FUNC(int) _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg); 9 | PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void); 10 | PyAPI_FUNC(int) _PyEval_SetAsyncGenFirstiter(PyObject *); 11 | PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void); 12 | PyAPI_FUNC(int) _PyEval_SetAsyncGenFinalizer(PyObject *); 13 | PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFinalizer(void); 14 | 15 | /* Helper to look up a builtin object */ 16 | PyAPI_FUNC(PyObject *) _PyEval_GetBuiltinId(_Py_Identifier *); 17 | /* Look at the current frame's (if any) code's co_flags, and turn on 18 | the corresponding compiler flags in cf->cf_flags. Return 1 if any 19 | flag was set, else return 0. */ 20 | PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); 21 | 22 | PyAPI_FUNC(PyObject *) _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int exc); 23 | 24 | PyAPI_FUNC(void) _PyEval_SetSwitchInterval(unsigned long microseconds); 25 | PyAPI_FUNC(unsigned long) _PyEval_GetSwitchInterval(void); 26 | 27 | PyAPI_FUNC(Py_ssize_t) _PyEval_RequestCodeExtraIndex(freefunc); 28 | 29 | PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); 30 | PyAPI_FUNC(int) _PyEval_SliceIndexNotNone(PyObject *, Py_ssize_t *); 31 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/fileobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_FILEOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | PyAPI_FUNC(char *) Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); 6 | 7 | /* The std printer acts as a preliminary sys.stderr until the new io 8 | infrastructure is in place. */ 9 | PyAPI_FUNC(PyObject *) PyFile_NewStdPrinter(int); 10 | PyAPI_DATA(PyTypeObject) PyStdPrinter_Type; 11 | 12 | typedef PyObject * (*Py_OpenCodeHookFunction)(PyObject *, void *); 13 | 14 | PyAPI_FUNC(PyObject *) PyFile_OpenCode(const char *utf8path); 15 | PyAPI_FUNC(PyObject *) PyFile_OpenCodeObject(PyObject *path); 16 | PyAPI_FUNC(int) PyFile_SetOpenCodeHook(Py_OpenCodeHookFunction hook, void *userData); 17 | 18 | PyAPI_FUNC(int) _PyLong_FileDescriptor_Converter(PyObject *, void *); 19 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/import.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_IMPORT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | PyMODINIT_FUNC PyInit__imp(void); 6 | 7 | PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *); 8 | 9 | PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(struct _Py_Identifier *name); 10 | PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module); 11 | PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module); 12 | 13 | PyAPI_FUNC(void) _PyImport_AcquireLock(void); 14 | PyAPI_FUNC(int) _PyImport_ReleaseLock(void); 15 | 16 | /* Obsolete since 3.5, will be removed in 3.11. */ 17 | Py_DEPRECATED(3.10) PyAPI_FUNC(PyObject *) _PyImport_FindExtensionObject(PyObject *, PyObject *); 18 | 19 | PyAPI_FUNC(int) _PyImport_FixupBuiltin( 20 | PyObject *mod, 21 | const char *name, /* UTF-8 encoded string */ 22 | PyObject *modules 23 | ); 24 | PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *, 25 | PyObject *, PyObject *); 26 | 27 | struct _inittab { 28 | const char *name; /* ASCII encoded string */ 29 | PyObject* (*initfunc)(void); 30 | }; 31 | PyAPI_DATA(struct _inittab *) PyImport_Inittab; 32 | PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); 33 | 34 | struct _frozen { 35 | const char *name; /* ASCII encoded string */ 36 | const unsigned char *code; 37 | int size; 38 | }; 39 | 40 | /* Embedding apps may change this pointer to point to their favorite 41 | collection of frozen modules: */ 42 | 43 | PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules; 44 | 45 | PyAPI_DATA(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *); 46 | PyAPI_DATA(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *); 47 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/interpreteridobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_INTERPRETERIDOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | /* Interpreter ID Object */ 6 | 7 | PyAPI_DATA(PyTypeObject) _PyInterpreterID_Type; 8 | 9 | PyAPI_FUNC(PyObject *) _PyInterpreterID_New(int64_t); 10 | PyAPI_FUNC(PyObject *) _PyInterpreterState_GetIDObject(PyInterpreterState *); 11 | PyAPI_FUNC(PyInterpreterState *) _PyInterpreterID_LookUp(PyObject *); 12 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/listobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_LISTOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | typedef struct { 6 | PyObject_VAR_HEAD 7 | /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ 8 | PyObject **ob_item; 9 | 10 | /* ob_item contains space for 'allocated' elements. The number 11 | * currently in use is ob_size. 12 | * Invariants: 13 | * 0 <= ob_size <= allocated 14 | * len(list) == ob_size 15 | * ob_item == NULL implies ob_size == allocated == 0 16 | * list.sort() temporarily sets allocated to -1 to detect mutations. 17 | * 18 | * Items must normally not be NULL, except during construction when 19 | * the list is not yet visible outside the function that builds it. 20 | */ 21 | Py_ssize_t allocated; 22 | } PyListObject; 23 | 24 | PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); 25 | PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out); 26 | 27 | /* Macro, trading safety for speed */ 28 | 29 | /* Cast argument to PyListObject* type. */ 30 | #define _PyList_CAST(op) (assert(PyList_Check(op)), (PyListObject *)(op)) 31 | 32 | #define PyList_GET_ITEM(op, i) (_PyList_CAST(op)->ob_item[i]) 33 | #define PyList_SET_ITEM(op, i, v) ((void)(_PyList_CAST(op)->ob_item[i] = (v))) 34 | #define PyList_GET_SIZE(op) Py_SIZE(_PyList_CAST(op)) 35 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/methodobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_METHODOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | PyAPI_DATA(PyTypeObject) PyCMethod_Type; 6 | 7 | #define PyCMethod_CheckExact(op) Py_IS_TYPE(op, &PyCMethod_Type) 8 | #define PyCMethod_Check(op) PyObject_TypeCheck(op, &PyCMethod_Type) 9 | 10 | /* Macros for direct access to these values. Type checks are *not* 11 | done, so use with care. */ 12 | #define PyCFunction_GET_FUNCTION(func) \ 13 | (((PyCFunctionObject *)func) -> m_ml -> ml_meth) 14 | #define PyCFunction_GET_SELF(func) \ 15 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_STATIC ? \ 16 | NULL : ((PyCFunctionObject *)func) -> m_self) 17 | #define PyCFunction_GET_FLAGS(func) \ 18 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags) 19 | #define PyCFunction_GET_CLASS(func) \ 20 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags & METH_METHOD ? \ 21 | ((PyCMethodObject *)func) -> mm_class : NULL) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | PyMethodDef *m_ml; /* Description of the C function to call */ 26 | PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ 27 | PyObject *m_module; /* The __module__ attribute, can be anything */ 28 | PyObject *m_weakreflist; /* List of weak references */ 29 | vectorcallfunc vectorcall; 30 | } PyCFunctionObject; 31 | 32 | typedef struct { 33 | PyCFunctionObject func; 34 | PyTypeObject *mm_class; /* Class that defines this method */ 35 | } PyCMethodObject; 36 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/odictobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ODICTOBJECT_H 2 | #define Py_ODICTOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* OrderedDict */ 9 | /* This API is optional and mostly redundant. */ 10 | 11 | #ifndef Py_LIMITED_API 12 | 13 | typedef struct _odictobject PyODictObject; 14 | 15 | PyAPI_DATA(PyTypeObject) PyODict_Type; 16 | PyAPI_DATA(PyTypeObject) PyODictIter_Type; 17 | PyAPI_DATA(PyTypeObject) PyODictKeys_Type; 18 | PyAPI_DATA(PyTypeObject) PyODictItems_Type; 19 | PyAPI_DATA(PyTypeObject) PyODictValues_Type; 20 | 21 | #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) 22 | #define PyODict_CheckExact(op) Py_IS_TYPE(op, &PyODict_Type) 23 | #define PyODict_SIZE(op) PyDict_GET_SIZE((op)) 24 | 25 | PyAPI_FUNC(PyObject *) PyODict_New(void); 26 | PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); 27 | PyAPI_FUNC(int) PyODict_DelItem(PyObject *od, PyObject *key); 28 | 29 | /* wrappers around PyDict* functions */ 30 | #define PyODict_GetItem(od, key) PyDict_GetItem(_PyObject_CAST(od), key) 31 | #define PyODict_GetItemWithError(od, key) \ 32 | PyDict_GetItemWithError(_PyObject_CAST(od), key) 33 | #define PyODict_Contains(od, key) PyDict_Contains(_PyObject_CAST(od), key) 34 | #define PyODict_Size(od) PyDict_Size(_PyObject_CAST(od)) 35 | #define PyODict_GetItemString(od, key) \ 36 | PyDict_GetItemString(_PyObject_CAST(od), key) 37 | 38 | #endif 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | #endif /* !Py_ODICTOBJECT_H */ 44 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/picklebufobject.h: -------------------------------------------------------------------------------- 1 | /* PickleBuffer object. This is built-in for ease of use from third-party 2 | * C extensions. 3 | */ 4 | 5 | #ifndef Py_PICKLEBUFOBJECT_H 6 | #define Py_PICKLEBUFOBJECT_H 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #ifndef Py_LIMITED_API 12 | 13 | PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type; 14 | 15 | #define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type) 16 | 17 | /* Create a PickleBuffer redirecting to the given buffer-enabled object */ 18 | PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *); 19 | /* Get the PickleBuffer's underlying view to the original object 20 | * (NULL if released) 21 | */ 22 | PyAPI_FUNC(const Py_buffer *) PyPickleBuffer_GetBuffer(PyObject *); 23 | /* Release the PickleBuffer. Returns 0 on success, -1 on error. */ 24 | PyAPI_FUNC(int) PyPickleBuffer_Release(PyObject *); 25 | 26 | #endif /* !Py_LIMITED_API */ 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* !Py_PICKLEBUFOBJECT_H */ 32 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/pyctype.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef PYCTYPE_H 3 | #define PYCTYPE_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #define PY_CTF_LOWER 0x01 9 | #define PY_CTF_UPPER 0x02 10 | #define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) 11 | #define PY_CTF_DIGIT 0x04 12 | #define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) 13 | #define PY_CTF_SPACE 0x08 14 | #define PY_CTF_XDIGIT 0x10 15 | 16 | PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; 17 | 18 | /* Unlike their C counterparts, the following macros are not meant to 19 | * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument 20 | * must be a signed/unsigned char. */ 21 | #define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) 22 | #define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) 23 | #define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) 24 | #define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) 25 | #define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) 26 | #define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) 27 | #define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) 28 | 29 | PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; 30 | PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; 31 | 32 | #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) 33 | #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | #endif /* !PYCTYPE_H */ 39 | #endif /* !Py_LIMITED_API */ 40 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/pydebug.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_PYDEBUG_H 3 | #define Py_PYDEBUG_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(int) Py_DebugFlag; 9 | PyAPI_DATA(int) Py_VerboseFlag; 10 | PyAPI_DATA(int) Py_QuietFlag; 11 | PyAPI_DATA(int) Py_InteractiveFlag; 12 | PyAPI_DATA(int) Py_InspectFlag; 13 | PyAPI_DATA(int) Py_OptimizeFlag; 14 | PyAPI_DATA(int) Py_NoSiteFlag; 15 | PyAPI_DATA(int) Py_BytesWarningFlag; 16 | PyAPI_DATA(int) Py_FrozenFlag; 17 | PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; 18 | PyAPI_DATA(int) Py_DontWriteBytecodeFlag; 19 | PyAPI_DATA(int) Py_NoUserSiteDirectory; 20 | PyAPI_DATA(int) Py_UnbufferedStdioFlag; 21 | PyAPI_DATA(int) Py_HashRandomizationFlag; 22 | PyAPI_DATA(int) Py_IsolatedFlag; 23 | 24 | #ifdef MS_WINDOWS 25 | PyAPI_DATA(int) Py_LegacyWindowsFSEncodingFlag; 26 | PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; 27 | #endif 28 | 29 | /* this is a wrapper around getenv() that pays attention to 30 | Py_IgnoreEnvironmentFlag. It should be used for getting variables like 31 | PYTHONPATH and PYTHONHOME from the environment */ 32 | #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif /* !Py_PYDEBUG_H */ 38 | #endif /* Py_LIMITED_API */ 39 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/pyfpe.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PYFPE_H 2 | #define Py_PYFPE_H 3 | /* Header excluded from the stable API */ 4 | #ifndef Py_LIMITED_API 5 | 6 | /* These macros used to do something when Python was built with --with-fpectl, 7 | * but support for that was dropped in 3.7. We continue to define them though, 8 | * to avoid breaking API users. 9 | */ 10 | 11 | #define PyFPE_START_PROTECT(err_string, leave_stmt) 12 | #define PyFPE_END_PROTECT(v) 13 | 14 | #endif /* !defined(Py_LIMITED_API) */ 15 | #endif /* !Py_PYFPE_H */ 16 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/sysmodule.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_SYSMODULE_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | PyAPI_FUNC(PyObject *) _PySys_GetObjectId(_Py_Identifier *key); 6 | PyAPI_FUNC(int) _PySys_SetObjectId(_Py_Identifier *key, PyObject *); 7 | 8 | PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); 9 | 10 | typedef int(*Py_AuditHookFunction)(const char *, PyObject *, void *); 11 | 12 | PyAPI_FUNC(int) PySys_Audit( 13 | const char *event, 14 | const char *argFormat, 15 | ...); 16 | PyAPI_FUNC(int) PySys_AddAuditHook(Py_AuditHookFunction, void*); 17 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/traceback.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_TRACEBACK_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | typedef struct _traceback { 6 | PyObject_HEAD 7 | struct _traceback *tb_next; 8 | PyFrameObject *tb_frame; 9 | int tb_lasti; 10 | int tb_lineno; 11 | } PyTracebackObject; 12 | 13 | PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, PyObject *, int, int); 14 | PyAPI_FUNC(void) _PyTraceback_Add(const char *, const char *, int); 15 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/cpython/tupleobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CPYTHON_TUPLEOBJECT_H 2 | # error "this header file must not be included directly" 3 | #endif 4 | 5 | typedef struct { 6 | PyObject_VAR_HEAD 7 | /* ob_item contains space for 'ob_size' elements. 8 | Items must normally not be NULL, except during construction when 9 | the tuple is not yet visible outside the function that builds it. */ 10 | PyObject *ob_item[1]; 11 | } PyTupleObject; 12 | 13 | PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); 14 | PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); 15 | 16 | /* Macros trading safety for speed */ 17 | 18 | /* Cast argument to PyTupleObject* type. */ 19 | #define _PyTuple_CAST(op) (assert(PyTuple_Check(op)), (PyTupleObject *)(op)) 20 | 21 | #define PyTuple_GET_SIZE(op) Py_SIZE(_PyTuple_CAST(op)) 22 | 23 | #define PyTuple_GET_ITEM(op, i) (_PyTuple_CAST(op)->ob_item[i]) 24 | 25 | /* Macro, *only* to be used to fill in brand new tuples */ 26 | #define PyTuple_SET_ITEM(op, i, v) ((void)(_PyTuple_CAST(op)->ob_item[i] = v)) 27 | 28 | PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out); 29 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/enumobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ENUMOBJECT_H 2 | #define Py_ENUMOBJECT_H 3 | 4 | /* Enumerate Object */ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) PyEnum_Type; 11 | PyAPI_DATA(PyTypeObject) PyReversed_Type; 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* !Py_ENUMOBJECT_H */ 18 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/errcode.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ERRCODE_H 2 | #define Py_ERRCODE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Error codes passed around between file input, tokenizer, parser and 9 | interpreter. This is necessary so we can turn them into Python 10 | exceptions at a higher level. Note that some errors have a 11 | slightly different meaning when passed from the tokenizer to the 12 | parser than when passed from the parser to the interpreter; e.g. 13 | the parser only returns E_EOF when it hits EOF immediately, and it 14 | never returns E_OK. */ 15 | 16 | #define E_OK 10 /* No error */ 17 | #define E_EOF 11 /* End Of File */ 18 | #define E_INTR 12 /* Interrupted */ 19 | #define E_TOKEN 13 /* Bad token */ 20 | #define E_SYNTAX 14 /* Syntax error */ 21 | #define E_NOMEM 15 /* Ran out of memory */ 22 | #define E_DONE 16 /* Parsing complete */ 23 | #define E_ERROR 17 /* Execution error */ 24 | #define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ 25 | #define E_OVERFLOW 19 /* Node had too many children */ 26 | #define E_TOODEEP 20 /* Too many indentation levels */ 27 | #define E_DEDENT 21 /* No matching outer block for dedent */ 28 | #define E_DECODE 22 /* Error in decoding into Unicode */ 29 | #define E_EOFS 23 /* EOF in triple-quoted string */ 30 | #define E_EOLS 24 /* EOL in single-quoted string */ 31 | #define E_LINECONT 25 /* Unexpected characters after a line continuation */ 32 | #define E_BADSINGLE 27 /* Ill-formed single statement input */ 33 | #define E_INTERACT_STOP 28 /* Interactive mode stopped tokenization */ 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | #endif /* !Py_ERRCODE_H */ 39 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/eval.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface to execute compiled code */ 3 | 4 | #ifndef Py_EVAL_H 5 | #define Py_EVAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); 11 | 12 | PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, 13 | PyObject *globals, 14 | PyObject *locals, 15 | PyObject *const *args, int argc, 16 | PyObject *const *kwds, int kwdc, 17 | PyObject *const *defs, int defc, 18 | PyObject *kwdefs, PyObject *closure); 19 | 20 | #ifndef Py_LIMITED_API 21 | PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); 22 | #endif 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !Py_EVAL_H */ 28 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/exports.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_EXPORTS_H 2 | #define Py_EXPORTS_H 3 | 4 | #if defined(_WIN32) || defined(__CYGWIN__) 5 | #define Py_IMPORTED_SYMBOL __declspec(dllimport) 6 | #define Py_EXPORTED_SYMBOL __declspec(dllexport) 7 | #define Py_LOCAL_SYMBOL 8 | #else 9 | /* 10 | * If we only ever used gcc >= 5, we could use __has_attribute(visibility) 11 | * as a cross-platform way to determine if visibility is supported. However, 12 | * we may still need to support gcc >= 4, as some Ubuntu LTS and Centos versions 13 | * have 4 < gcc < 5. 14 | */ 15 | #ifndef __has_attribute 16 | #define __has_attribute(x) 0 // Compatibility with non-clang compilers. 17 | #endif 18 | #if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\ 19 | (defined(__clang__) && __has_attribute(visibility)) 20 | #define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default"))) 21 | #define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default"))) 22 | #define Py_LOCAL_SYMBOL __attribute__ ((visibility ("hidden"))) 23 | #else 24 | #define Py_IMPORTED_SYMBOL 25 | #define Py_EXPORTED_SYMBOL 26 | #define Py_LOCAL_SYMBOL 27 | #endif 28 | #endif 29 | 30 | #endif /* Py_EXPORTS_H */ 31 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/fileobject.h: -------------------------------------------------------------------------------- 1 | /* File object interface (what's left of it -- see io.py) */ 2 | 3 | #ifndef Py_FILEOBJECT_H 4 | #define Py_FILEOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #define PY_STDIOTEXTMODE "b" 10 | 11 | PyAPI_FUNC(PyObject *) PyFile_FromFd(int, const char *, const char *, int, 12 | const char *, const char *, 13 | const char *, int); 14 | PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); 15 | PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); 16 | PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); 17 | PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); 18 | 19 | /* The default encoding used by the platform file system APIs 20 | If non-NULL, this is different than the default encoding for strings 21 | */ 22 | PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; 23 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 24 | PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; 25 | #endif 26 | PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; 27 | 28 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 29 | PyAPI_DATA(int) Py_UTF8Mode; 30 | #endif 31 | 32 | /* A routine to check if a file descriptor can be select()-ed. */ 33 | #ifdef _MSC_VER 34 | /* On Windows, any socket fd can be select()-ed, no matter how high */ 35 | #define _PyIsSelectable_fd(FD) (1) 36 | #else 37 | #define _PyIsSelectable_fd(FD) ((unsigned int)(FD) < (unsigned int)FD_SETSIZE) 38 | #endif 39 | 40 | #ifndef Py_LIMITED_API 41 | # define Py_CPYTHON_FILEOBJECT_H 42 | # include "cpython/fileobject.h" 43 | # undef Py_CPYTHON_FILEOBJECT_H 44 | #endif 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif /* !Py_FILEOBJECT_H */ 50 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/fileutils.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_FILEUTILS_H 2 | #define Py_FILEUTILS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 8 | PyAPI_FUNC(wchar_t *) Py_DecodeLocale( 9 | const char *arg, 10 | size_t *size); 11 | 12 | PyAPI_FUNC(char*) Py_EncodeLocale( 13 | const wchar_t *text, 14 | size_t *error_pos); 15 | #endif 16 | 17 | #ifndef Py_LIMITED_API 18 | # define Py_CPYTHON_FILEUTILS_H 19 | # include "cpython/fileutils.h" 20 | # undef Py_CPYTHON_FILEUTILS_H 21 | #endif 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif /* !Py_FILEUTILS_H */ 27 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/frameobject.h: -------------------------------------------------------------------------------- 1 | /* Frame object interface */ 2 | 3 | #ifndef Py_FRAMEOBJECT_H 4 | #define Py_FRAMEOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "pyframe.h" 10 | 11 | #ifndef Py_LIMITED_API 12 | # define Py_CPYTHON_FRAMEOBJECT_H 13 | # include "cpython/frameobject.h" 14 | # undef Py_CPYTHON_FRAMEOBJECT_H 15 | #endif 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | #endif /* !Py_FRAMEOBJECT_H */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/genericaliasobject.h: -------------------------------------------------------------------------------- 1 | // Implementation of PEP 585: support list[int] etc. 2 | #ifndef Py_GENERICALIASOBJECT_H 3 | #define Py_GENERICALIASOBJECT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(PyObject *) Py_GenericAlias(PyObject *, PyObject *); 9 | PyAPI_DATA(PyTypeObject) Py_GenericAliasType; 10 | 11 | #ifdef __cplusplus 12 | } 13 | #endif 14 | #endif /* !Py_GENERICALIASOBJECT_H */ 15 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/graminit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/RealTimePathTracingResearchFramework/5641742c9785a1474ca0f93a4e8e09eced2fe246/ext/libvkr/ext/python-3.10.6/linux/include/graminit.h -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_abstract.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_ABSTRACT_H 2 | #define Py_INTERNAL_ABSTRACT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | // Fast inlined version of PyIndex_Check() 12 | static inline int 13 | _PyIndex_Check(PyObject *obj) 14 | { 15 | PyNumberMethods *tp_as_number = Py_TYPE(obj)->tp_as_number; 16 | return (tp_as_number != NULL && tp_as_number->nb_index != NULL); 17 | } 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_INTERNAL_ABSTRACT_H */ 23 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_accu.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_INTERNAL_ACCU_H 3 | #define Py_INTERNAL_ACCU_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /*** This is a private API for use by the interpreter and the stdlib. 9 | *** Its definition may be changed or removed at any moment. 10 | ***/ 11 | 12 | #ifndef Py_BUILD_CORE 13 | # error "this header requires Py_BUILD_CORE define" 14 | #endif 15 | 16 | /* 17 | * A two-level accumulator of unicode objects that avoids both the overhead 18 | * of keeping a huge number of small separate objects, and the quadratic 19 | * behaviour of using a naive repeated concatenation scheme. 20 | */ 21 | 22 | #undef small /* defined by some Windows headers */ 23 | 24 | typedef struct { 25 | PyObject *large; /* A list of previously accumulated large strings */ 26 | PyObject *small; /* Pending small strings */ 27 | } _PyAccu; 28 | 29 | PyAPI_FUNC(int) _PyAccu_Init(_PyAccu *acc); 30 | PyAPI_FUNC(int) _PyAccu_Accumulate(_PyAccu *acc, PyObject *unicode); 31 | PyAPI_FUNC(PyObject *) _PyAccu_FinishAsList(_PyAccu *acc); 32 | PyAPI_FUNC(PyObject *) _PyAccu_Finish(_PyAccu *acc); 33 | PyAPI_FUNC(void) _PyAccu_Destroy(_PyAccu *acc); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | #endif /* !Py_INTERNAL_ACCU_H */ 39 | #endif /* !Py_LIMITED_API */ 40 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_call.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_CALL_H 2 | #define Py_INTERNAL_CALL_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( 12 | PyThreadState *tstate, 13 | PyObject *callable, 14 | PyObject *obj, 15 | PyObject *args, 16 | PyObject *kwargs); 17 | 18 | PyAPI_FUNC(PyObject *) _PyObject_FastCallDictTstate( 19 | PyThreadState *tstate, 20 | PyObject *callable, 21 | PyObject *const *args, 22 | size_t nargsf, 23 | PyObject *kwargs); 24 | 25 | PyAPI_FUNC(PyObject *) _PyObject_Call( 26 | PyThreadState *tstate, 27 | PyObject *callable, 28 | PyObject *args, 29 | PyObject *kwargs); 30 | 31 | static inline PyObject * 32 | _PyObject_CallNoArgTstate(PyThreadState *tstate, PyObject *func) { 33 | return _PyObject_VectorcallTstate(tstate, func, NULL, 0, NULL); 34 | } 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif /* !Py_INTERNAL_CALL_H */ 40 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_code.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_CODE_H 2 | #define Py_INTERNAL_CODE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | typedef struct { 8 | PyObject *ptr; /* Cached pointer (borrowed reference) */ 9 | uint64_t globals_ver; /* ma_version of global dict */ 10 | uint64_t builtins_ver; /* ma_version of builtin dict */ 11 | } _PyOpcache_LoadGlobal; 12 | 13 | typedef struct { 14 | PyTypeObject *type; 15 | Py_ssize_t hint; 16 | unsigned int tp_version_tag; 17 | } _PyOpCodeOpt_LoadAttr; 18 | 19 | struct _PyOpcache { 20 | union { 21 | _PyOpcache_LoadGlobal lg; 22 | _PyOpCodeOpt_LoadAttr la; 23 | } u; 24 | char optimized; 25 | }; 26 | 27 | /* Private API */ 28 | int _PyCode_InitOpcache(PyCodeObject *co); 29 | 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif /* !Py_INTERNAL_CODE_H */ 35 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_compile.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_COMPILE_H 2 | #define Py_INTERNAL_COMPILE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | struct _arena; // Type defined in pycore_pyarena.h 12 | struct _mod; // Type defined in pycore_ast.h 13 | 14 | // Export the symbol for test_peg_generator (built as a library) 15 | PyAPI_FUNC(PyCodeObject*) _PyAST_Compile( 16 | struct _mod *mod, 17 | PyObject *filename, 18 | PyCompilerFlags *flags, 19 | int optimize, 20 | struct _arena *arena); 21 | extern PyFutureFeatures* _PyFuture_FromAST( 22 | struct _mod * mod, 23 | PyObject *filename 24 | ); 25 | 26 | extern PyObject* _Py_Mangle(PyObject *p, PyObject *name); 27 | 28 | typedef struct { 29 | int optimize; 30 | int ff_features; 31 | 32 | int recursion_depth; /* current recursion depth */ 33 | int recursion_limit; /* recursion limit */ 34 | } _PyASTOptimizeState; 35 | 36 | extern int _PyAST_Optimize( 37 | struct _mod *, 38 | struct _arena *arena, 39 | _PyASTOptimizeState *state); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif /* !Py_INTERNAL_COMPILE_H */ 45 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_context.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_CONTEXT_H 2 | #define Py_INTERNAL_CONTEXT_H 3 | 4 | #ifndef Py_BUILD_CORE 5 | # error "this header requires Py_BUILD_CORE define" 6 | #endif 7 | 8 | #include "pycore_hamt.h" /* PyHamtObject */ 9 | 10 | struct _pycontextobject { 11 | PyObject_HEAD 12 | PyContext *ctx_prev; 13 | PyHamtObject *ctx_vars; 14 | PyObject *ctx_weakreflist; 15 | int ctx_entered; 16 | }; 17 | 18 | 19 | struct _pycontextvarobject { 20 | PyObject_HEAD 21 | PyObject *var_name; 22 | PyObject *var_default; 23 | PyObject *var_cached; 24 | uint64_t var_cached_tsid; 25 | uint64_t var_cached_tsver; 26 | Py_hash_t var_hash; 27 | }; 28 | 29 | 30 | struct _pycontexttokenobject { 31 | PyObject_HEAD 32 | PyContext *tok_ctx; 33 | PyContextVar *tok_var; 34 | PyObject *tok_oldval; 35 | int tok_used; 36 | }; 37 | 38 | 39 | int _PyContext_Init(void); 40 | void _PyContext_Fini(PyInterpreterState *interp); 41 | 42 | #endif /* !Py_INTERNAL_CONTEXT_H */ 43 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_dtoa.h: -------------------------------------------------------------------------------- 1 | #ifndef PY_NO_SHORT_FLOAT_REPR 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | 6 | #ifndef Py_BUILD_CORE 7 | # error "this header requires Py_BUILD_CORE define" 8 | #endif 9 | 10 | /* These functions are used by modules compiled as C extension like math: 11 | they must be exported. */ 12 | 13 | PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); 14 | PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, 15 | int *decpt, int *sign, char **rve); 16 | PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); 17 | PyAPI_FUNC(double) _Py_dg_stdnan(int sign); 18 | PyAPI_FUNC(double) _Py_dg_infinity(int sign); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* !PY_NO_SHORT_FLOAT_REPR */ 24 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_fileutils.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_FILEUTILS_H 2 | #define Py_INTERNAL_FILEUTILS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "Py_BUILD_CORE must be defined to include this header" 9 | #endif 10 | 11 | #include /* struct lconv */ 12 | 13 | PyAPI_DATA(int) _Py_HasFileSystemDefaultEncodeErrors; 14 | 15 | PyAPI_FUNC(int) _Py_DecodeUTF8Ex( 16 | const char *arg, 17 | Py_ssize_t arglen, 18 | wchar_t **wstr, 19 | size_t *wlen, 20 | const char **reason, 21 | _Py_error_handler errors); 22 | 23 | PyAPI_FUNC(int) _Py_EncodeUTF8Ex( 24 | const wchar_t *text, 25 | char **str, 26 | size_t *error_pos, 27 | const char **reason, 28 | int raw_malloc, 29 | _Py_error_handler errors); 30 | 31 | PyAPI_FUNC(wchar_t*) _Py_DecodeUTF8_surrogateescape( 32 | const char *arg, 33 | Py_ssize_t arglen, 34 | size_t *wlen); 35 | 36 | PyAPI_FUNC(int) _Py_GetForceASCII(void); 37 | 38 | /* Reset "force ASCII" mode (if it was initialized). 39 | 40 | This function should be called when Python changes the LC_CTYPE locale, 41 | so the "force ASCII" mode can be detected again on the new locale 42 | encoding. */ 43 | PyAPI_FUNC(void) _Py_ResetForceASCII(void); 44 | 45 | 46 | PyAPI_FUNC(int) _Py_GetLocaleconvNumeric( 47 | struct lconv *lc, 48 | PyObject **decimal_point, 49 | PyObject **thousands_sep); 50 | 51 | PyAPI_FUNC(void) _Py_closerange(int first, int last); 52 | 53 | PyAPI_FUNC(wchar_t*) _Py_GetLocaleEncoding(void); 54 | PyAPI_FUNC(PyObject*) _Py_GetLocaleEncodingObject(void); 55 | 56 | #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION 57 | extern int _Py_LocaleUsesNonUnicodeWchar(void); 58 | 59 | extern wchar_t* _Py_DecodeNonUnicodeWchar( 60 | const wchar_t* native, 61 | Py_ssize_t size); 62 | 63 | extern int _Py_EncodeNonUnicodeWchar_InPlace( 64 | wchar_t* unicode, 65 | Py_ssize_t size); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #endif /* !Py_INTERNAL_FILEUTILS_H */ 72 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_format.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_FORMAT_H 2 | #define Py_INTERNAL_FORMAT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | /* Format codes 12 | * F_LJUST '-' 13 | * F_SIGN '+' 14 | * F_BLANK ' ' 15 | * F_ALT '#' 16 | * F_ZERO '0' 17 | */ 18 | #define F_LJUST (1<<0) 19 | #define F_SIGN (1<<1) 20 | #define F_BLANK (1<<2) 21 | #define F_ALT (1<<3) 22 | #define F_ZERO (1<<4) 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !Py_INTERNAL_FORMAT_H */ 28 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_PYGETOPT_H 2 | #define Py_INTERNAL_PYGETOPT_H 3 | 4 | #ifndef Py_BUILD_CORE 5 | # error "this header requires Py_BUILD_CORE define" 6 | #endif 7 | 8 | extern int _PyOS_opterr; 9 | extern Py_ssize_t _PyOS_optind; 10 | extern const wchar_t *_PyOS_optarg; 11 | 12 | extern void _PyOS_ResetGetOpt(void); 13 | 14 | typedef struct { 15 | const wchar_t *name; 16 | int has_arg; 17 | int val; 18 | } _PyOS_LongOption; 19 | 20 | extern int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex); 21 | 22 | #endif /* !Py_INTERNAL_PYGETOPT_H */ 23 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_gil.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_GIL_H 2 | #define Py_INTERNAL_GIL_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | #include "pycore_atomic.h" /* _Py_atomic_address */ 12 | #include "pycore_condvar.h" /* PyCOND_T */ 13 | 14 | #ifndef Py_HAVE_CONDVAR 15 | # error You need either a POSIX-compatible or a Windows system! 16 | #endif 17 | 18 | /* Enable if you want to force the switching of threads at least 19 | every `interval`. */ 20 | #undef FORCE_SWITCHING 21 | #define FORCE_SWITCHING 22 | 23 | struct _gil_runtime_state { 24 | /* microseconds (the Python API uses seconds, though) */ 25 | unsigned long interval; 26 | /* Last PyThreadState holding / having held the GIL. This helps us 27 | know whether anyone else was scheduled after we dropped the GIL. */ 28 | _Py_atomic_address last_holder; 29 | /* Whether the GIL is already taken (-1 if uninitialized). This is 30 | atomic because it can be read without any lock taken in ceval.c. */ 31 | _Py_atomic_int locked; 32 | /* Number of GIL switches since the beginning. */ 33 | unsigned long switch_number; 34 | /* This condition variable allows one or several threads to wait 35 | until the GIL is released. In addition, the mutex also protects 36 | the above variables. */ 37 | PyCOND_T cond; 38 | PyMUTEX_T mutex; 39 | #ifdef FORCE_SWITCHING 40 | /* This condition variable helps the GIL-releasing thread wait for 41 | a GIL-awaiting thread to be scheduled and take the GIL. */ 42 | PyCOND_T switch_cond; 43 | PyMUTEX_T switch_mutex; 44 | #endif 45 | }; 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | #endif /* !Py_INTERNAL_GIL_H */ 51 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_import.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_LIMITED_API 2 | #ifndef Py_INTERNAL_IMPORT_H 3 | #define Py_INTERNAL_IMPORT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifdef HAVE_FORK 9 | extern PyStatus _PyImport_ReInitLock(void); 10 | #endif 11 | extern PyObject* _PyImport_BootstrapImp(PyThreadState *tstate); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | #endif /* !Py_INTERNAL_IMPORT_H */ 17 | #endif /* !Py_LIMITED_API */ 18 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_list.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_LIST_H 2 | #define Py_INTERNAL_LIST_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | #include "listobject.h" // _PyList_CAST() 12 | 13 | 14 | #define _PyList_ITEMS(op) (_PyList_CAST(op)->ob_item) 15 | 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | #endif /* !Py_INTERNAL_LIST_H */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_long.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_LONG_H 2 | #define Py_INTERNAL_LONG_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | #include "pycore_interp.h" // PyInterpreterState.small_ints 12 | #include "pycore_pystate.h" // _PyThreadState_GET() 13 | 14 | // Don't call this function but _PyLong_GetZero() and _PyLong_GetOne() 15 | static inline PyObject* __PyLong_GetSmallInt_internal(int value) 16 | { 17 | PyInterpreterState *interp = _PyInterpreterState_GET(); 18 | assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS); 19 | size_t index = _PY_NSMALLNEGINTS + value; 20 | PyObject *obj = (PyObject*)interp->small_ints[index]; 21 | // _PyLong_GetZero(), _PyLong_GetOne() and get_small_int() must not be 22 | // called before _PyLong_Init() nor after _PyLong_Fini(). 23 | assert(obj != NULL); 24 | return obj; 25 | } 26 | 27 | // Return a borrowed reference to the zero singleton. 28 | // The function cannot return NULL. 29 | static inline PyObject* _PyLong_GetZero(void) 30 | { return __PyLong_GetSmallInt_internal(0); } 31 | 32 | // Return a borrowed reference to the one singleton. 33 | // The function cannot return NULL. 34 | static inline PyObject* _PyLong_GetOne(void) 35 | { return __PyLong_GetSmallInt_internal(1); } 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* !Py_INTERNAL_LONG_H */ 41 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_moduleobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_MODULEOBJECT_H 2 | #define Py_INTERNAL_MODULEOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | typedef struct { 12 | PyObject_HEAD 13 | PyObject *md_dict; 14 | struct PyModuleDef *md_def; 15 | void *md_state; 16 | PyObject *md_weaklist; 17 | // for logging purposes after md_dict is cleared 18 | PyObject *md_name; 19 | } PyModuleObject; 20 | 21 | static inline PyModuleDef* _PyModule_GetDef(PyObject *mod) { 22 | assert(PyModule_Check(mod)); 23 | return ((PyModuleObject *)mod)->md_def; 24 | } 25 | 26 | static inline void* _PyModule_GetState(PyObject* mod) { 27 | assert(PyModule_Check(mod)); 28 | return ((PyModuleObject *)mod)->md_state; 29 | } 30 | 31 | static inline PyObject* _PyModule_GetDict(PyObject *mod) { 32 | assert(PyModule_Check(mod)); 33 | PyObject *dict = ((PyModuleObject *)mod) -> md_dict; 34 | // _PyModule_GetDict(mod) must not be used after calling module_clear(mod) 35 | assert(dict != NULL); 36 | return dict; 37 | } 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | #endif /* !Py_INTERNAL_MODULEOBJECT_H */ 43 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_parser.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_PARSER_H 2 | #define Py_INTERNAL_PARSER_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | extern struct _mod* _PyParser_ASTFromString( 12 | const char *str, 13 | PyObject* filename, 14 | int mode, 15 | PyCompilerFlags *flags, 16 | PyArena *arena); 17 | extern struct _mod* _PyParser_ASTFromFile( 18 | FILE *fp, 19 | PyObject *filename_ob, 20 | const char *enc, 21 | int mode, 22 | const char *ps1, 23 | const char *ps2, 24 | PyCompilerFlags *flags, 25 | int *errcode, 26 | PyArena *arena); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* !Py_INTERNAL_PARSER_H */ 32 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_pyhash.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_HASH_H 2 | #define Py_INTERNAL_HASH_H 3 | 4 | #ifndef Py_BUILD_CORE 5 | # error "this header requires Py_BUILD_CORE define" 6 | #endif 7 | 8 | uint64_t _Py_KeyedHash(uint64_t, const char *, Py_ssize_t); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_structseq.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_STRUCTSEQ_H 2 | #define Py_INTERNAL_STRUCTSEQ_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | 12 | PyAPI_FUNC(int) _PyStructSequence_InitType( 13 | PyTypeObject *type, 14 | PyStructSequence_Desc *desc, 15 | unsigned long tp_flags); 16 | 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif /* !Py_INTERNAL_STRUCTSEQ_H */ 22 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_sysmodule.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_SYSMODULE_H 2 | #define Py_INTERNAL_SYSMODULE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | PyAPI_FUNC(int) _PySys_Audit( 12 | PyThreadState *tstate, 13 | const char *event, 14 | const char *argFormat, 15 | ...); 16 | 17 | /* We want minimal exposure of this function, so use extern rather than 18 | PyAPI_FUNC() to not export the symbol. */ 19 | extern void _PySys_ClearAuditHooks(PyThreadState *tstate); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif /* !Py_INTERNAL_SYSMODULE_H */ 25 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_tuple.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_TUPLE_H 2 | #define Py_INTERNAL_TUPLE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | #include "tupleobject.h" /* _PyTuple_CAST() */ 12 | 13 | #define _PyTuple_ITEMS(op) (_PyTuple_CAST(op)->ob_item) 14 | 15 | PyAPI_FUNC(PyObject *) _PyTuple_FromArray(PyObject *const *, Py_ssize_t); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | #endif /* !Py_INTERNAL_TUPLE_H */ 21 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_ucnhash.h: -------------------------------------------------------------------------------- 1 | /* Unicode name database interface */ 2 | #ifndef Py_INTERNAL_UCNHASH_H 3 | #define Py_INTERNAL_UCNHASH_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifndef Py_BUILD_CORE 9 | # error "this header requires Py_BUILD_CORE define" 10 | #endif 11 | 12 | /* revised ucnhash CAPI interface (exported through a "wrapper") */ 13 | 14 | #define PyUnicodeData_CAPSULE_NAME "unicodedata._ucnhash_CAPI" 15 | 16 | typedef struct { 17 | 18 | /* Get name for a given character code. 19 | Returns non-zero if success, zero if not. 20 | Does not set Python exceptions. */ 21 | int (*getname)(Py_UCS4 code, char* buffer, int buflen, 22 | int with_alias_and_seq); 23 | 24 | /* Get character code for a given name. 25 | Same error handling as for getname(). */ 26 | int (*getcode)(const char* name, int namelen, Py_UCS4* code, 27 | int with_named_seq); 28 | 29 | } _PyUnicode_Name_CAPI; 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif /* !Py_INTERNAL_UCNHASH_H */ 35 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_unionobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_UNIONOBJECT_H 2 | #define Py_INTERNAL_UNIONOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | extern PyTypeObject _PyUnion_Type; 12 | #define _PyUnion_Check(op) Py_IS_TYPE(op, &_PyUnion_Type) 13 | extern PyObject *_Py_union_type_or(PyObject *, PyObject *); 14 | 15 | #define _PyGenericAlias_Check(op) PyObject_TypeCheck(op, &Py_GenericAliasType) 16 | extern PyObject *_Py_subs_parameters(PyObject *, PyObject *, PyObject *, PyObject *); 17 | extern PyObject *_Py_make_parameters(PyObject *); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_INTERNAL_UNIONOBJECT_H */ 23 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/internal/pycore_warnings.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERNAL_WARNINGS_H 2 | #define Py_INTERNAL_WARNINGS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifndef Py_BUILD_CORE 8 | # error "this header requires Py_BUILD_CORE define" 9 | #endif 10 | 11 | struct _warnings_runtime_state { 12 | /* Both 'filters' and 'onceregistry' can be set in warnings.py; 13 | get_warnings_attr() will reset these variables accordingly. */ 14 | PyObject *filters; /* List */ 15 | PyObject *once_registry; /* Dict */ 16 | PyObject *default_action; /* String */ 17 | long filters_version; 18 | }; 19 | 20 | extern int _PyWarnings_InitState(PyInterpreterState *interp); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif /* !Py_INTERNAL_WARNINGS_H */ 26 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/interpreteridobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTERPRETERIDOBJECT_H 2 | #define Py_INTERPRETERIDOBJECT_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifndef Py_LIMITED_API 9 | # define Py_CPYTHON_INTERPRETERIDOBJECT_H 10 | # include "cpython/interpreteridobject.h" 11 | # undef Py_CPYTHON_INTERPRETERIDOBJECT_H 12 | #endif 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif /* !Py_INTERPRETERIDOBJECT_H */ 18 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/intrcheck.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_INTRCHECK_H 2 | #define Py_INTRCHECK_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_FUNC(int) PyOS_InterruptOccurred(void); 8 | #ifdef HAVE_FORK 9 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03070000 10 | PyAPI_FUNC(void) PyOS_BeforeFork(void); 11 | PyAPI_FUNC(void) PyOS_AfterFork_Parent(void); 12 | PyAPI_FUNC(void) PyOS_AfterFork_Child(void); 13 | #endif 14 | #endif 15 | /* Deprecated, please use PyOS_AfterFork_Child() instead */ 16 | Py_DEPRECATED(3.7) PyAPI_FUNC(void) PyOS_AfterFork(void); 17 | 18 | #ifndef Py_LIMITED_API 19 | PyAPI_FUNC(int) _PyOS_IsMainThread(void); 20 | 21 | #ifdef MS_WINDOWS 22 | /* windows.h is not included by Python.h so use void* instead of HANDLE */ 23 | PyAPI_FUNC(void*) _PyOS_SigintEvent(void); 24 | #endif 25 | #endif /* !Py_LIMITED_API */ 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif /* !Py_INTRCHECK_H */ 31 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/iterobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ITEROBJECT_H 2 | #define Py_ITEROBJECT_H 3 | /* Iterators (the basic kind, over a sequence) */ 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(PyTypeObject) PySeqIter_Type; 9 | PyAPI_DATA(PyTypeObject) PyCallIter_Type; 10 | #ifdef Py_BUILD_CORE 11 | extern PyTypeObject _PyAnextAwaitable_Type; 12 | #endif 13 | 14 | #define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type) 15 | 16 | PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); 17 | 18 | 19 | #define PyCallIter_Check(op) Py_IS_TYPE(op, &PyCallIter_Type) 20 | 21 | PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif /* !Py_ITEROBJECT_H */ 27 | 28 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/listobject.h: -------------------------------------------------------------------------------- 1 | /* List object interface 2 | 3 | Another generally useful object type is a list of object pointers. 4 | This is a mutable type: the list items can be changed, and items can be 5 | added or removed. Out-of-range indices or non-list objects are ignored. 6 | 7 | WARNING: PyList_SetItem does not increment the new item's reference count, 8 | but does decrement the reference count of the item it replaces, if not nil. 9 | It does *decrement* the reference count if it is *not* inserted in the list. 10 | Similarly, PyList_GetItem does not increment the returned item's reference 11 | count. 12 | */ 13 | 14 | #ifndef Py_LISTOBJECT_H 15 | #define Py_LISTOBJECT_H 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | PyAPI_DATA(PyTypeObject) PyList_Type; 21 | PyAPI_DATA(PyTypeObject) PyListIter_Type; 22 | PyAPI_DATA(PyTypeObject) PyListRevIter_Type; 23 | 24 | #define PyList_Check(op) \ 25 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) 26 | #define PyList_CheckExact(op) Py_IS_TYPE(op, &PyList_Type) 27 | 28 | PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); 29 | PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); 30 | 31 | PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); 32 | PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); 33 | PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); 34 | PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); 35 | 36 | PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 37 | PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); 38 | 39 | PyAPI_FUNC(int) PyList_Sort(PyObject *); 40 | PyAPI_FUNC(int) PyList_Reverse(PyObject *); 41 | PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); 42 | 43 | #ifndef Py_LIMITED_API 44 | # define Py_CPYTHON_LISTOBJECT_H 45 | # include "cpython/listobject.h" 46 | # undef Py_CPYTHON_LISTOBJECT_H 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | #endif /* !Py_LISTOBJECT_H */ 53 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/marshal.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface for marshal.c */ 3 | 4 | #ifndef Py_MARSHAL_H 5 | #define Py_MARSHAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define Py_MARSHAL_VERSION 4 11 | 12 | PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); 13 | PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); 14 | PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); 15 | 16 | #ifndef Py_LIMITED_API 17 | PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); 18 | PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); 19 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); 20 | PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); 21 | #endif 22 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(const char *, 23 | Py_ssize_t); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_MARSHAL_H */ 29 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/namespaceobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* simple namespace object interface */ 3 | 4 | #ifndef NAMESPACEOBJECT_H 5 | #define NAMESPACEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #ifndef Py_LIMITED_API 11 | PyAPI_DATA(PyTypeObject) _PyNamespace_Type; 12 | 13 | PyAPI_FUNC(PyObject *) _PyNamespace_New(PyObject *kwds); 14 | #endif /* !Py_LIMITED_API */ 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | #endif /* !NAMESPACEOBJECT_H */ 20 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/osdefs.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_OSDEFS_H 2 | #define Py_OSDEFS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Operating system dependencies */ 9 | 10 | #ifdef MS_WINDOWS 11 | #define SEP L'\\' 12 | #define ALTSEP L'/' 13 | #define MAXPATHLEN 256 14 | #define DELIM L';' 15 | #endif 16 | 17 | #ifdef __VXWORKS__ 18 | #define DELIM L';' 19 | #endif 20 | 21 | /* Filename separator */ 22 | #ifndef SEP 23 | #define SEP L'/' 24 | #endif 25 | 26 | /* Max pathname length */ 27 | #ifdef __hpux 28 | #include 29 | #include 30 | #ifndef PATH_MAX 31 | #define PATH_MAX MAXPATHLEN 32 | #endif 33 | #endif 34 | 35 | #ifndef MAXPATHLEN 36 | #if defined(PATH_MAX) && PATH_MAX > 1024 37 | #define MAXPATHLEN PATH_MAX 38 | #else 39 | #define MAXPATHLEN 1024 40 | #endif 41 | #endif 42 | 43 | /* Search path entry delimiter */ 44 | #ifndef DELIM 45 | #define DELIM L':' 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | #endif /* !Py_OSDEFS_H */ 52 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/osmodule.h: -------------------------------------------------------------------------------- 1 | 2 | /* os module interface */ 3 | 4 | #ifndef Py_OSMODULE_H 5 | #define Py_OSMODULE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 11 | PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); 12 | #endif 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif /* !Py_OSMODULE_H */ 18 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/patchlevel.h: -------------------------------------------------------------------------------- 1 | 2 | /* Python version identification scheme. 3 | 4 | When the major or minor version changes, the VERSION variable in 5 | configure.ac must also be changed. 6 | 7 | There is also (independent) API version information in modsupport.h. 8 | */ 9 | 10 | /* Values for PY_RELEASE_LEVEL */ 11 | #define PY_RELEASE_LEVEL_ALPHA 0xA 12 | #define PY_RELEASE_LEVEL_BETA 0xB 13 | #define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ 14 | #define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ 15 | /* Higher for patch releases */ 16 | 17 | /* Version parsed out into numeric values */ 18 | /*--start constants--*/ 19 | #define PY_MAJOR_VERSION 3 20 | #define PY_MINOR_VERSION 10 21 | #define PY_MICRO_VERSION 6 22 | #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL 23 | #define PY_RELEASE_SERIAL 0 24 | 25 | /* Version as a string */ 26 | #define PY_VERSION "3.10.6" 27 | /*--end constants--*/ 28 | 29 | /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. 30 | Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ 31 | #define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ 32 | (PY_MINOR_VERSION << 16) | \ 33 | (PY_MICRO_VERSION << 8) | \ 34 | (PY_RELEASE_LEVEL << 4) | \ 35 | (PY_RELEASE_SERIAL << 0)) 36 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pycapsule.h: -------------------------------------------------------------------------------- 1 | 2 | /* Capsule objects let you wrap a C "void *" pointer in a Python 3 | object. They're a way of passing data through the Python interpreter 4 | without creating your own custom type. 5 | 6 | Capsules are used for communication between extension modules. 7 | They provide a way for an extension module to export a C interface 8 | to other extension modules, so that extension modules can use the 9 | Python import mechanism to link to one another. 10 | 11 | For more information, please see "c-api/capsule.html" in the 12 | documentation. 13 | */ 14 | 15 | #ifndef Py_CAPSULE_H 16 | #define Py_CAPSULE_H 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PyAPI_DATA(PyTypeObject) PyCapsule_Type; 22 | 23 | typedef void (*PyCapsule_Destructor)(PyObject *); 24 | 25 | #define PyCapsule_CheckExact(op) Py_IS_TYPE(op, &PyCapsule_Type) 26 | 27 | 28 | PyAPI_FUNC(PyObject *) PyCapsule_New( 29 | void *pointer, 30 | const char *name, 31 | PyCapsule_Destructor destructor); 32 | 33 | PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); 34 | 35 | PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); 36 | 37 | PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); 38 | 39 | PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); 40 | 41 | PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); 42 | 43 | PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); 44 | 45 | PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); 46 | 47 | PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); 48 | 49 | PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); 50 | 51 | PyAPI_FUNC(void *) PyCapsule_Import( 52 | const char *name, /* UTF-8 encoded string */ 53 | int no_block); 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | #endif /* !Py_CAPSULE_H */ 60 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pyframe.h: -------------------------------------------------------------------------------- 1 | /* Limited C API of PyFrame API 2 | * 3 | * Include "frameobject.h" to get the PyFrameObject structure. 4 | */ 5 | 6 | #ifndef Py_PYFRAME_H 7 | #define Py_PYFRAME_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct _frame PyFrameObject; 13 | 14 | /* Return the line of code the frame is currently executing. */ 15 | PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); 16 | 17 | PyAPI_FUNC(PyCodeObject *) PyFrame_GetCode(PyFrameObject *frame); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_PYFRAME_H */ 23 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pystrcmp.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRCMP_H 2 | #define Py_STRCMP_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); 9 | PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); 10 | 11 | #ifdef MS_WINDOWS 12 | #define PyOS_strnicmp strnicmp 13 | #define PyOS_stricmp stricmp 14 | #else 15 | #define PyOS_strnicmp PyOS_mystrnicmp 16 | #define PyOS_stricmp PyOS_mystricmp 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* !Py_STRCMP_H */ 24 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pystrhex.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRHEX_H 2 | #define Py_STRHEX_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifndef Py_LIMITED_API 9 | /* Returns a str() containing the hex representation of argbuf. */ 10 | PyAPI_FUNC(PyObject*) _Py_strhex(const char* argbuf, const Py_ssize_t arglen); 11 | /* Returns a bytes() containing the ASCII hex representation of argbuf. */ 12 | PyAPI_FUNC(PyObject*) _Py_strhex_bytes(const char* argbuf, const Py_ssize_t arglen); 13 | /* These variants include support for a separator between every N bytes: */ 14 | PyAPI_FUNC(PyObject*) _Py_strhex_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); 15 | PyAPI_FUNC(PyObject*) _Py_strhex_bytes_with_sep(const char* argbuf, const Py_ssize_t arglen, const PyObject* sep, const int bytes_per_group); 16 | #endif /* !Py_LIMITED_API */ 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* !Py_STRHEX_H */ 23 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pystrtod.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRTOD_H 2 | #define Py_STRTOD_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | PyAPI_FUNC(double) PyOS_string_to_double(const char *str, 10 | char **endptr, 11 | PyObject *overflow_exception); 12 | 13 | /* The caller is responsible for calling PyMem_Free to free the buffer 14 | that's is returned. */ 15 | PyAPI_FUNC(char *) PyOS_double_to_string(double val, 16 | char format_code, 17 | int precision, 18 | int flags, 19 | int *type); 20 | 21 | #ifndef Py_LIMITED_API 22 | PyAPI_FUNC(PyObject *) _Py_string_to_number_with_underscores( 23 | const char *str, Py_ssize_t len, const char *what, PyObject *obj, void *arg, 24 | PyObject *(*innerfunc)(const char *, Py_ssize_t, void *)); 25 | 26 | PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); 27 | #endif 28 | 29 | 30 | /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ 31 | #define Py_DTSF_SIGN 0x01 /* always add the sign */ 32 | #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ 33 | #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code 34 | specific */ 35 | 36 | /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ 37 | #define Py_DTST_FINITE 0 38 | #define Py_DTST_INFINITE 1 39 | #define Py_DTST_NAN 2 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* !Py_STRTOD_H */ 46 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/pythonrun.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interfaces to parse and execute pieces of python code */ 3 | 4 | #ifndef Py_PYTHONRUN_H 5 | #define Py_PYTHONRUN_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) Py_CompileString(const char *, const char *, int); 11 | 12 | PyAPI_FUNC(void) PyErr_Print(void); 13 | PyAPI_FUNC(void) PyErr_PrintEx(int); 14 | PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); 15 | 16 | 17 | /* Stuff with no proper home (yet) */ 18 | PyAPI_DATA(int) (*PyOS_InputHook)(void); 19 | 20 | /* Stack size, in "pointers" (so we get extra safety margins 21 | on 64-bit platforms). On a 32-bit platform, this translates 22 | to an 8k margin. */ 23 | #define PYOS_STACK_MARGIN 2048 24 | 25 | #if defined(WIN32) && !defined(MS_WIN64) && !defined(_M_ARM) && defined(_MSC_VER) && _MSC_VER >= 1300 26 | /* Enable stack checking under Microsoft C */ 27 | #define USE_STACKCHECK 28 | #endif 29 | 30 | #ifdef USE_STACKCHECK 31 | /* Check that we aren't overflowing our stack */ 32 | PyAPI_FUNC(int) PyOS_CheckStack(void); 33 | #endif 34 | 35 | #ifndef Py_LIMITED_API 36 | # define Py_CPYTHON_PYTHONRUN_H 37 | # include "cpython/pythonrun.h" 38 | # undef Py_CPYTHON_PYTHONRUN_H 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif /* !Py_PYTHONRUN_H */ 45 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/rangeobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Range object interface */ 3 | 4 | #ifndef Py_RANGEOBJECT_H 5 | #define Py_RANGEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* 11 | A range object represents an integer range. This is an immutable object; 12 | a range cannot change its value after creation. 13 | 14 | Range objects behave like the corresponding tuple objects except that 15 | they are represented by a start, stop, and step datamembers. 16 | */ 17 | 18 | PyAPI_DATA(PyTypeObject) PyRange_Type; 19 | PyAPI_DATA(PyTypeObject) PyRangeIter_Type; 20 | PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; 21 | 22 | #define PyRange_Check(op) Py_IS_TYPE(op, &PyRange_Type) 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif /* !Py_RANGEOBJECT_H */ 28 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/structseq.h: -------------------------------------------------------------------------------- 1 | 2 | /* Named tuple object interface */ 3 | 4 | #ifndef Py_STRUCTSEQ_H 5 | #define Py_STRUCTSEQ_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct PyStructSequence_Field { 11 | const char *name; 12 | const char *doc; 13 | } PyStructSequence_Field; 14 | 15 | typedef struct PyStructSequence_Desc { 16 | const char *name; 17 | const char *doc; 18 | struct PyStructSequence_Field *fields; 19 | int n_in_sequence; 20 | } PyStructSequence_Desc; 21 | 22 | extern const char * const PyStructSequence_UnnamedField; 23 | 24 | #ifndef Py_LIMITED_API 25 | PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, 26 | PyStructSequence_Desc *desc); 27 | PyAPI_FUNC(int) PyStructSequence_InitType2(PyTypeObject *type, 28 | PyStructSequence_Desc *desc); 29 | #endif 30 | PyAPI_FUNC(PyTypeObject*) PyStructSequence_NewType(PyStructSequence_Desc *desc); 31 | 32 | PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); 33 | 34 | #ifndef Py_LIMITED_API 35 | typedef PyTupleObject PyStructSequence; 36 | 37 | /* Macro, *only* to be used to fill in brand new objects */ 38 | #define PyStructSequence_SET_ITEM(op, i, v) PyTuple_SET_ITEM(op, i, v) 39 | 40 | #define PyStructSequence_GET_ITEM(op, i) PyTuple_GET_ITEM(op, i) 41 | #endif 42 | 43 | PyAPI_FUNC(void) PyStructSequence_SetItem(PyObject*, Py_ssize_t, PyObject*); 44 | PyAPI_FUNC(PyObject*) PyStructSequence_GetItem(PyObject*, Py_ssize_t); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | #endif /* !Py_STRUCTSEQ_H */ 50 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/sysmodule.h: -------------------------------------------------------------------------------- 1 | 2 | /* System module interface */ 3 | 4 | #ifndef Py_SYSMODULE_H 5 | #define Py_SYSMODULE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PySys_GetObject(const char *); 11 | PyAPI_FUNC(int) PySys_SetObject(const char *, PyObject *); 12 | 13 | PyAPI_FUNC(void) PySys_SetArgv(int, wchar_t **); 14 | PyAPI_FUNC(void) PySys_SetArgvEx(int, wchar_t **, int); 15 | PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); 16 | 17 | PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) 18 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 19 | PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 20 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 21 | PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); 22 | PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); 23 | 24 | PyAPI_FUNC(void) PySys_ResetWarnOptions(void); 25 | PyAPI_FUNC(void) PySys_AddWarnOption(const wchar_t *); 26 | PyAPI_FUNC(void) PySys_AddWarnOptionUnicode(PyObject *); 27 | PyAPI_FUNC(int) PySys_HasWarnOptions(void); 28 | 29 | PyAPI_FUNC(void) PySys_AddXOption(const wchar_t *); 30 | PyAPI_FUNC(PyObject *) PySys_GetXOptions(void); 31 | 32 | #ifndef Py_LIMITED_API 33 | # define Py_CPYTHON_SYSMODULE_H 34 | # include "cpython/sysmodule.h" 35 | # undef Py_CPYTHON_SYSMODULE_H 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* !Py_SYSMODULE_H */ 42 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/traceback.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_TRACEBACK_H 2 | #define Py_TRACEBACK_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* Traceback interface */ 8 | 9 | PyAPI_FUNC(int) PyTraceBack_Here(PyFrameObject *); 10 | PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); 11 | 12 | /* Reveal traceback type so we can typecheck traceback objects */ 13 | PyAPI_DATA(PyTypeObject) PyTraceBack_Type; 14 | #define PyTraceBack_Check(v) Py_IS_TYPE(v, &PyTraceBack_Type) 15 | 16 | 17 | #ifndef Py_LIMITED_API 18 | # define Py_CPYTHON_TRACEBACK_H 19 | # include "cpython/traceback.h" 20 | # undef Py_CPYTHON_TRACEBACK_H 21 | #endif 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif /* !Py_TRACEBACK_H */ 27 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/tracemalloc.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_TRACEMALLOC_H 2 | #define Py_TRACEMALLOC_H 3 | 4 | #ifndef Py_LIMITED_API 5 | /* Track an allocated memory block in the tracemalloc module. 6 | Return 0 on success, return -1 on error (failed to allocate memory to store 7 | the trace). 8 | 9 | Return -2 if tracemalloc is disabled. 10 | 11 | If memory block is already tracked, update the existing trace. */ 12 | PyAPI_FUNC(int) PyTraceMalloc_Track( 13 | unsigned int domain, 14 | uintptr_t ptr, 15 | size_t size); 16 | 17 | /* Untrack an allocated memory block in the tracemalloc module. 18 | Do nothing if the block was not tracked. 19 | 20 | Return -2 if tracemalloc is disabled, otherwise return 0. */ 21 | PyAPI_FUNC(int) PyTraceMalloc_Untrack( 22 | unsigned int domain, 23 | uintptr_t ptr); 24 | 25 | /* Get the traceback where a memory block was allocated. 26 | 27 | Return a tuple of (filename: str, lineno: int) tuples. 28 | 29 | Return None if the tracemalloc module is disabled or if the memory block 30 | is not tracked by tracemalloc. 31 | 32 | Raise an exception and return NULL on error. */ 33 | PyAPI_FUNC(PyObject*) _PyTraceMalloc_GetTraceback( 34 | unsigned int domain, 35 | uintptr_t ptr); 36 | #endif 37 | 38 | #endif /* !Py_TRACEMALLOC_H */ 39 | -------------------------------------------------------------------------------- /ext/libvkr/ext/python-3.10.6/linux/include/tupleobject.h: -------------------------------------------------------------------------------- 1 | /* Tuple object interface */ 2 | 3 | #ifndef Py_TUPLEOBJECT_H 4 | #define Py_TUPLEOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | /* 10 | Another generally useful object type is a tuple of object pointers. 11 | For Python, this is an immutable type. C code can change the tuple items 12 | (but not their number), and even use tuples as general-purpose arrays of 13 | object references, but in general only brand new tuples should be mutated, 14 | not ones that might already have been exposed to Python code. 15 | 16 | *** WARNING *** PyTuple_SetItem does not increment the new item's reference 17 | count, but does decrement the reference count of the item it replaces, 18 | if not nil. It does *decrement* the reference count if it is *not* 19 | inserted in the tuple. Similarly, PyTuple_GetItem does not increment the 20 | returned item's reference count. 21 | */ 22 | 23 | PyAPI_DATA(PyTypeObject) PyTuple_Type; 24 | PyAPI_DATA(PyTypeObject) PyTupleIter_Type; 25 | 26 | #define PyTuple_Check(op) \ 27 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) 28 | #define PyTuple_CheckExact(op) Py_IS_TYPE(op, &PyTuple_Type) 29 | 30 | PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); 31 | PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); 32 | PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); 33 | PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); 34 | PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 35 | PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); 36 | 37 | #ifndef Py_LIMITED_API 38 | # define Py_CPYTHON_TUPLEOBJECT_H 39 | # include "cpython/tupleobject.h" 40 | # undef Py_CPYTHON_TUPLEOBJECT_H 41 | #endif 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | #endif /* !Py_TUPLEOBJECT_H */ 47 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/README.md: -------------------------------------------------------------------------------- 1 | # libvkr scripts 2 | 3 | ## Preparation 4 | 5 | To run the python scripts, you need to set `PYTHONPATH` to point to 6 | the built pyvkr module. If you use the release preset to build, this can be 7 | done using 8 | 9 | ```shell 10 | export PYTHONPATH=$(pwd)/build/release:${PYTHONPATH} 11 | ``` 12 | 13 | The module will only build if cmake can find Python! 14 | 15 | ## vkrinfo.py 16 | 17 | Print metadata loaded from a .vks file. 18 | 19 | ## vkr2obj.py 20 | 21 | Convert .vks to .obj. 22 | 23 | ## vktconvert.py 24 | 25 | Convert textures to .vkt. 26 | 27 | ## vktinfo.py 28 | 29 | Print metadata loaded from a .vkt file. 30 | 31 | ## Blender addon 32 | 33 | If Python, NumPy and Blender can be found, then cmake will also install the 34 | `blender_vkr` addon. This addon facilitates exporting to the .vks scene format. 35 | 36 | Note that you need to build with NumPy that is old enough 37 | for your Blender version. You can check the NumPy version used in Blender with 38 | 39 | ```sh 40 | $ blender --background --python-expr "import numpy; print(numpy.__version__)" 41 | ``` 42 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/install_blender_addon.bpy: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | # run with: blender --background -P "install_blender_addon.bpy" 5 | 6 | import bpy 7 | import os 8 | import sys 9 | 10 | module_name = "blender_vkr" 11 | module_archive = module_name + ".zip" 12 | module_file = os.path.join(os.getcwd(), module_archive) 13 | 14 | if not os.path.isfile(module_file): 15 | print(f"Cannot find module archive {module_file}") 16 | module_file = os.path.join(os.path.dirname(__file__), module_archive) 17 | 18 | if not os.path.isfile(module_file): 19 | print(f"Cannot find module archive {module_file}") 20 | sys.exit(1) 21 | print(f"Installing from {module_file}") 22 | 23 | if os.name == 'nt': 24 | support_module_loaded = sys.modules.get(module_name) 25 | if support_module_loaded is not None: 26 | print(f"Need to disable module first and restart, please re-run script") 27 | bpy.ops.preferences.addon_disable(module=module_name) 28 | bpy.ops.wm.save_userpref() 29 | sys.exit(2) 30 | 31 | bpy.ops.preferences.addon_install(overwrite=True, filepath=module_file) 32 | bpy.ops.preferences.addon_enable(module=module_name) 33 | # Required so that blender does not forget we enabled. 34 | bpy.ops.wm.save_userpref() 35 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/install_blender_addon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2023 Intel Corporation. 3 | # SPDX-License-Identifier: MIT 4 | 5 | 6 | SCRIPT_FILE=$(readlink -f ${0}) 7 | SCRIPT_DIR=$(dirname ${SCRIPT_FILE}) 8 | 9 | if ! ( command -v blender &> /dev/null ) 10 | then 11 | echo "Cannot find blender" 12 | exit 1 13 | fi 14 | 15 | # Optional argument: module source dir. 16 | if [ $# -gt 0 ] 17 | then 18 | SCRIPT_DIR="$1" 19 | fi 20 | 21 | MODULE_ARCHIVE="${SCRIPT_DIR}/blender_vkr.zip" 22 | 23 | if [ ! -f "${MODULE_ARCHIVE}" ] 24 | then 25 | echo "Cannot find module archive ${MODULE_ARCHIVE}" 26 | exit 2 27 | fi 28 | 29 | INSTALL_SCRIPT=' 30 | import bpy 31 | import os 32 | import sys 33 | 34 | module_name = "blender_vkr" 35 | cwd = os.getcwd() 36 | module_file = os.path.join(cwd, module_name + ".zip") 37 | 38 | if not os.path.isfile(module_file): 39 | print(f"Cannot find module archive {module_file}") 40 | sys.exit(1) 41 | 42 | bpy.ops.preferences.addon_install(overwrite=True, filepath=module_file) 43 | bpy.ops.preferences.addon_enable(module=module_name) 44 | # Required so that blender does not forget we enabled. 45 | bpy.ops.wm.save_userpref() 46 | ' 47 | 48 | cd "${SCRIPT_DIR}" 49 | blender --background --python-expr "${INSTALL_SCRIPT}" 50 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/vkrinfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright 2023 Intel Corporation. 3 | # SPDX-License-Identifier: MIT 4 | 5 | 6 | import pyvkr 7 | import sys 8 | import pprint 9 | 10 | if len(sys.argv) < 2: 11 | print(f'usage: {sys.argv[0]} FILE') 12 | sys.exit(0) 13 | 14 | scene = pyvkr.open_scene(sys.argv[1]) 15 | pprint.pprint(scene) 16 | 17 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/vktconvert.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright 2023 Intel Corporation. 3 | # SPDX-License-Identifier: MIT 4 | 5 | 6 | import pyvkr 7 | import sys 8 | 9 | if len(sys.argv) < 4: 10 | print(f'usage: {sys.argv[0]} INPUT OUTPUT FORMAT') 11 | sys.exit(0) 12 | 13 | inputFile = sys.argv[1] 14 | outputFile = sys.argv[2] 15 | outputFormat = int(sys.argv[3]) 16 | 17 | print(f"Converting {inputFile} to {outputFile} ...") 18 | pyvkr.convert_texture(inputFile, outputFile, outputFormat) 19 | 20 | -------------------------------------------------------------------------------- /ext/libvkr/scripts/vktinfo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright 2023 Intel Corporation. 3 | # SPDX-License-Identifier: MIT 4 | 5 | 6 | import pyvkr 7 | import sys 8 | import pprint 9 | 10 | if len(sys.argv) < 2: 11 | print(f'usage: {sys.argv[0]} FILE') 12 | sys.exit(0) 13 | 14 | tex = pyvkr.open_texture(sys.argv[1]) 15 | pprint.pprint(tex) 16 | 17 | 18 | -------------------------------------------------------------------------------- /ext/libvkr/src/vkrtest.c: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | /* 5 | * This is a simple test program that does nothing but open a .vks file. 6 | * Uses include crash tests and debugging. 7 | */ 8 | 9 | #include "vkr.h" 10 | #include 11 | 12 | void eh(VkrResult result, const char *msg) 13 | { 14 | printf("error: %s\n", msg); 15 | } 16 | 17 | int main(int argc, char **argv) 18 | { 19 | if (argc <= 1) { 20 | return -1; 21 | } 22 | 23 | VkrScene vks = {0}; 24 | return !(vkr_open_scene(argv[1], &vks, eh) == VKR_SUCCESS); 25 | } 26 | -------------------------------------------------------------------------------- /ext/libvkr/src/vktconvert.c: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "vkr.h" 5 | #include 6 | #include 7 | 8 | void errorHandler(VkrResult result, const char *msg) 9 | { 10 | printf("error: %s\n", msg); 11 | } 12 | 13 | int main(int argc, char **argv) 14 | { 15 | if (argc < 4) { 16 | printf("usage: %s INPUT OUTPUT FORMAT [OPAQUE FORMAT]\n", argv[0]); 17 | return -1; 18 | } 19 | printf("converting %s to %s ...\n", argv[1], argv[2]); 20 | int format = atoi(argv[3]); 21 | int opaqueFormat = argc > 4 ? atoi(argv[4]) : format; 22 | vkr_convert_texture(argv[1], argv[2], format, opaqueFormat, 23 | errorHandler); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /ext/stb/stb.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #define STB_IMAGE_IMPLEMENTATION 5 | #include "stb_image.h" 6 | 7 | #define STB_IMAGE_WRITE_IMPLEMENTATION 8 | #include "stb_image_write.h" 9 | 10 | -------------------------------------------------------------------------------- /libapp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | add_library(libapp 5 | benchmark_info.cpp 6 | shell.cpp 7 | scene_state.cpp 8 | app_state.cpp 9 | imutils.cpp 10 | ) 11 | add_project_files(libapp ${CMAKE_CURRENT_SOURCE_DIR} *.h) 12 | target_precompile_headers(libapp REUSE_FROM util) 13 | 14 | target_include_directories(libapp PUBLIC 15 | $) 16 | target_link_libraries(libapp PUBLIC 17 | librender 18 | util 19 | display) 20 | -------------------------------------------------------------------------------- /libapp/imutils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #include "imgui.h" 6 | 7 | inline int valid_combo_index(int ia, char const* const* strings, size_t size = ~0) { 8 | int index = 0; 9 | for (int i = 0; i <= ia && (size_t) i < size && strings[i]; ++i) 10 | index = i; 11 | return index; 12 | } 13 | 14 | bool ui_list_node_ex(char const* label, ImGuiTreeNodeFlags flags, bool *p_open, bool* p_up, bool* p_down); 15 | 16 | inline bool ui_begin_list_frame(char const* name, bool *p_add) { 17 | ImGui::AlignTextToFramePadding(); 18 | ImGui::Text("%s: ", name); 19 | if (p_add) { 20 | ImGui::SameLine(); 21 | *p_add = ImGui::Button("+"); 22 | } 23 | return ImGui::BeginChildFrame( ImGui::GetID(name), ImVec2(0, 0) ); 24 | } 25 | 26 | inline void ui_end_list_frame() { 27 | ImGui::EndChildFrame(); 28 | } 29 | -------------------------------------------------------------------------------- /librender/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | add_library(librender 5 | material.cpp 6 | bounds.cpp 7 | mesh.cpp 8 | scene.cpp 9 | lights.cpp 10 | quantization.cpp 11 | ../rendering/lights/sky_model_arhosek/sky_model.cpp 12 | render_backend.cpp 13 | gpu_programs.cpp 14 | ) 15 | add_project_files(librender ${CMAKE_CURRENT_SOURCE_DIR} *.h *.glsl) 16 | target_precompile_headers(librender PRIVATE ../pch.hpp) 17 | 18 | target_include_directories(util PUBLIC 19 | $) 20 | 21 | target_link_libraries(librender PUBLIC util) 22 | target_link_libraries(librender PRIVATE vkr) 23 | -------------------------------------------------------------------------------- /librender/bounds.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | struct Sphere { 10 | glm::vec3 origin; 11 | float radius; 12 | 13 | Sphere() = default; 14 | Sphere(const glm::vec3 &_origin, float _radius); 15 | 16 | const Sphere &operator+=(const Sphere &other); 17 | Sphere operator+(const Sphere &other)const; 18 | 19 | // Computes a bounding sphere for a set of points 20 | static Sphere boundPoints(const glm::vec3 *positions, int num_positions); 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /librender/camera.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | struct CameraDesc { 9 | glm::vec3 position, center, up; 10 | float fov_y; 11 | }; 12 | -------------------------------------------------------------------------------- /librender/dequantize.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | 5 | #ifndef DEQUANTIZE_H_GLSL 6 | #define DEQUANTIZE_H_GLSL 7 | 8 | #define DEQUANTIZE_POSITION_XYZ(wx, wy, wz, scaling, offset) \ 9 | (vec3( uint(wx) & 0x1FFFFF, \ 10 | uint(wy) & 0x1FFFFF, \ 11 | uint(wz) & 0x1FFFFF) \ 12 | * scaling \ 13 | + offset \ 14 | ) 15 | #ifdef GLSL_SPLIT_INT64 16 | #define DEQUANTIZE_POSITION(dword, scaling, offset) \ 17 | DEQUANTIZE_POSITION_XYZ(dword.x, (dword.x >> uint(21)) | (dword.y << uint(11)), dword.y >> uint(10), scaling, offset) 18 | #else 19 | #define DEQUANTIZE_POSITION(dword, scaling, offset) \ 20 | DEQUANTIZE_POSITION_XYZ(dword, dword >> uint(21), dword >> uint(42), scaling, offset) 21 | #endif 22 | 23 | inline vec3 dequantize_normal(uint32_t word) { 24 | vec2 n = vec2( 25 | ivec2(word & 0xFFFF, word >> 16) 26 | - ivec2(0x8000) 27 | ) / float(uint(0x7FFF)); 28 | float nl1 = abs(n.x) + abs(n.y); 29 | if (nl1 >= 1.0f) { 30 | n = (vec2(1.0f) - abs(vec2(n.y, n.x))) 31 | * vec2( 32 | n.x >= 0.0f ? 1.0f : -1.0f, 33 | n.y >= 0.0f ? 1.0f : -1.0f 34 | ); 35 | } 36 | return normalize(vec3( 37 | n.x, 38 | n.y, 39 | 1.0f - nl1 40 | )); 41 | } 42 | 43 | inline vec2 dequantize_uv(uint32_t word) { 44 | return vec2(0.0f, 1.0f) 45 | + vec2( 46 | ivec2(word & 0xFFFF, -int(word >> 16)) 47 | ) * (8.0f / float(uint(0xFFFF))); 48 | } 49 | 50 | inline vec3 dequantize_hdr(uint32_t word) { 51 | vec3 color = vec3(uvec3(word >> 18, word >> 9, word) & uvec3(0xff)) / 511.0f; 52 | return ldexp(color, ivec3(word >> 27)); 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /librender/lights.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #ifndef GLM 10 | #define GLM(type) glm::type 11 | #endif 12 | #include "render_params.glsl.h" 13 | #include "../rendering/lights/tri.h.glsl" 14 | #include "../rendering/lights/quad.h.glsl" 15 | #include "../rendering/lights/point.h.glsl" 16 | #include "../rendering/lights/light.h.glsl" 17 | 18 | struct Scene; 19 | struct ParameterizedMesh; 20 | struct Mesh; 21 | struct BaseMaterial; 22 | 23 | std::vector collect_emitters(Scene const& scene); 24 | std::vector collect_emitters(glm::mat4 const& transform, ParameterizedMesh const& pm, Mesh const& mesh, std::vector const& materials); 25 | 26 | // importance sampling tools 27 | struct BinnedLightSampling { 28 | std::vector emitters; 29 | std::vector radiances; 30 | LightSamplingConfig params; 31 | BinnedLightSampling() { 32 | params.bin_size = 0; // mark uninitialized 33 | } 34 | int bin_count() const; 35 | }; 36 | void update_light_sampling(BinnedLightSampling& binned, std::vector const& emitters, LightSamplingConfig params); 37 | 38 | struct LightSamplingSetup { 39 | std::vector emitters; 40 | BinnedLightSampling binned; 41 | }; 42 | 43 | // compute representative radiance value based on closest shading points to light source where variance is still visibly perceived (depends on viewer scale) 44 | std::vector estimate_normalized_radiance(Scene const* scene, std::vector const& emitters, float min_perceived_receiver_dist); 45 | // remove short-range emitters that contribute no noticeable light outside their local environment (depends on camera exposure) 46 | void trim_dim_emitters(std::vector& emitters, std::vector &radiances, float min_radiance); 47 | // partition emitters into approx. equal-weight bins for importance sampling 48 | void equalize_emitter_bins(std::vector& emitters, std::vector &radiances, int bin_size); 49 | -------------------------------------------------------------------------------- /librender/material.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "material.h" 5 | 6 | -------------------------------------------------------------------------------- /librender/material.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "file_mapping.h" 11 | 12 | #ifndef GLM 13 | #define GLM(type) glm::type 14 | #endif 15 | #ifndef GLCPP_DEFAULT 16 | #define GLCPP_DEFAULT(...) __VA_ARGS__ 17 | #endif 18 | 19 | #include "../rendering/bsdfs/texture_channel_mask.h" 20 | #include "../rendering/bsdfs/base_material.h.glsl" 21 | 22 | -------------------------------------------------------------------------------- /librender/quantization.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #include 6 | #include 7 | 8 | void dequantize_vertices(void* target, size_t stride, size_t vertexCount 9 | , void const* source, uint32_t format_flags 10 | , glm::vec3 quantized_scaling, glm::vec3 quantized_offset); 11 | void dequantize_normals(glm::vec3* target, size_t vertexCount 12 | , void const* source, uint32_t format_flags); 13 | void dequantize_uvs(glm::vec2* target, size_t vertexCount 14 | , void const* source, uint32_t format_flags); 15 | 16 | template 17 | inline void dequantize_material_ids(T* target, size_t vertexCount 18 | , void const* source, uint32_t material_id_bitcount) { 19 | if (8 * sizeof(T) == material_id_bitcount) { 20 | memcpy(target, source, sizeof(T) * vertexCount); 21 | return; 22 | } 23 | switch (material_id_bitcount) { 24 | case 8: 25 | for (size_t i = 0; i < vertexCount; ++i) 26 | target[i] = ((uint8_t const*) source)[i]; 27 | break; 28 | case 16: 29 | for (size_t i = 0; i < vertexCount; ++i) 30 | target[i] = ((uint16_t const*) source)[i]; 31 | break; 32 | case 32: 33 | for (size_t i = 0; i < vertexCount; ++i) 34 | target[i] = ((uint32_t const*) source)[i]; 35 | break; 36 | default: 37 | assert(false); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /librender/raytrace_backend.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "scene.h" 7 | #include "libdatacapture/raytrace.h" 8 | #include 9 | 10 | using rt_datacapture::RayQuery; 11 | using rt_datacapture::RaytraceResults; 12 | 13 | struct RaytraceBackend : public rt_datacapture::RaytraceBackend { 14 | virtual ~RaytraceBackend() { } 15 | virtual std::string name() const = 0; 16 | 17 | virtual void set_scene(const Scene &scene) = 0; 18 | virtual int trace_ray(RayQuery* queries, int num_queries, RaytraceResults aux_results) = 0; 19 | }; 20 | 21 | typedef RaytraceBackend* (*create_raytracer_function)(); 22 | 23 | -------------------------------------------------------------------------------- /librender/render_data.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | #ifndef GLM 9 | #define GLM(type) glm::type 10 | #endif 11 | #ifndef GLCPP_DEFAULT 12 | #define GLCPP_DEFAULT(...) __VA_ARGS__ 13 | #endif 14 | 15 | #define DEFAULT_GEOMETRY_BUFFER_TYPES 16 | #include "../rendering/rt/geometry.h.glsl" 17 | -------------------------------------------------------------------------------- /pch.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #define _USE_MATH_DEFINES 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | //#include // #include "unordered_vector.hpp" 20 | 21 | -------------------------------------------------------------------------------- /rendering/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | option(ENABLE_RENDERING_TESTS "Build additional rendering engineering tests" OFF) 5 | option(ENABLE_RENDERING_TOOLS "Build additional rendering dev tools" OFF) 6 | 7 | add_custom_target(rendering) 8 | add_project_files(rendering ${CMAKE_CURRENT_SOURCE_DIR} SOURCE_GROUP Shaders *.glsl *.h *.hpp) 9 | 10 | add_library(test_shaders STATIC tests/compile.cpp) 11 | target_link_libraries(test_shaders PUBLIC glm) 12 | 13 | if (ENABLE_RENDERING_TESTS) 14 | add_executable(test_gltf tests/gltf_bsdf.cpp) 15 | endif () 16 | 17 | if (ENABLE_RENDERING_TOOLS) 18 | add_executable(prepare_sobol tools/prepare_sobol.cpp) 19 | endif () 20 | 21 | # IDE filters 22 | set_main_targets(rendering) 23 | -------------------------------------------------------------------------------- /rendering/bsdfs/base_material.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef BASE_MATERIAL_PARAMS_HEADER 5 | #define BASE_MATERIAL_PARAMS_HEADER 6 | 7 | #define BASE_MATERIAL_NOALPHA 0x01 8 | #define BASE_MATERIAL_ONESIDED 0x02 9 | #define BASE_MATERIAL_VOLUME 0x04 10 | #define BASE_MATERIAL_EXTENDED 0x08 // enable specular transmission (todo: any others optional?) 11 | #define BASE_MATERIAL_NEURAL 0x10 12 | 13 | struct BaseMaterial { 14 | GLM(vec3) base_color GLCPP_DEFAULT(= GLM(vec3)(0.9f)); 15 | int32_t normal_map GLCPP_DEFAULT(= -1); 16 | 17 | uint32_t flags GLCPP_DEFAULT(= 0); 18 | float roughness GLCPP_DEFAULT(= 1); 19 | float specular GLCPP_DEFAULT(= 0.5f); 20 | float metallic GLCPP_DEFAULT(= 0); 21 | 22 | float sheen GLCPP_DEFAULT(= 0); 23 | float sheen_tint GLCPP_DEFAULT(= 0); 24 | float clearcoat GLCPP_DEFAULT(= 0); 25 | float clearcoat_gloss GLCPP_DEFAULT(= 0.1f); 26 | 27 | float ior GLCPP_DEFAULT(= 1.5); 28 | float specular_transmission GLCPP_DEFAULT(= 0); 29 | float anisotropy GLCPP_DEFAULT(= 0); 30 | float specular_tint GLCPP_DEFAULT(= 0); 31 | 32 | GLM(vec3) transmission_color GLCPP_DEFAULT(= GLM(vec3)(1.0f)); 33 | float emission_intensity GLCPP_DEFAULT(= 0.0f); 34 | }; 35 | 36 | #ifdef UNROLL_STANDARD_TEXTURES 37 | #define STANDARD_TEXTURE_COUNT 3 38 | #define STANDARD_TEXTURE_BASECOLOR_SLOT 1 39 | #define STANDARD_TEXTURE_NORMAL_SLOT 0 40 | #define STANDARD_TEXTURE_SPECULAR_SLOT 2 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /rendering/bsdfs/hit_point.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef HIT_POINT_H_GLSL 5 | #define HIT_POINT_H_GLSL 6 | 7 | struct HitPoint { 8 | vec3 p; // for volumetric textures, object space 9 | vec2 uv; 10 | mat2 duvdxy; 11 | vec3 d; // for volumetric textures, ray dir in object space 12 | }; 13 | 14 | struct InteractionPoint { 15 | vec3 p; 16 | vec3 gn; 17 | vec3 n; 18 | vec3 v_x, v_y; 19 | int primitiveId; 20 | int instanceId; 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /rendering/bsdfs/texture_channel_mask.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | // This header is shared across all backends 5 | 6 | #ifndef UTIL_TEXTURE_CHANNEL_MASK_H 7 | #define UTIL_TEXTURE_CHANNEL_MASK_H 8 | 9 | /* The material's float parameters (and the r component of the color) 10 | * can be a positive scalar, representing the input value, or if 11 | * negative correspond to a texture input. The bits are the interpreted as: 12 | * 13 | * [31]: 1, sign bit indicating this is a handle 14 | * [29:30]: 2 bits indicating the texture channel to use (base_color is 15 | * assumed to use all channels and this is ignored) 16 | * [0:28]: texture ID 17 | */ 18 | 19 | #define TEXTURED_PARAM_MASK 0x80000000 20 | #define IS_TEXTURED_PARAM(x) ((x) & 0x80000000) 21 | 22 | #define GET_TEXTURE_CHANNEL(x) (((x) >> 29) & 0x3) 23 | #define SET_TEXTURE_CHANNEL(x, c) x |= (uint32_t(c) & 0x3) << 29 24 | 25 | #define GET_TEXTURE_ID(x) ((x) & 0x1fffffff) 26 | #define SET_TEXTURE_ID(x, i) (x |= uint32_t(i) & 0x1fffffff) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /rendering/language.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef GLSL_LANGUAGE_ADAPTER 5 | #define GLSL_LANGUAGE_ADAPTER 6 | 7 | // types 8 | #define uint32_t uint 9 | #define int32_t int 10 | 11 | // qualifiers 12 | #define GLSL_out(type) out type 13 | #define GLSL_inout(type) inout type 14 | #define GLSL_in(type) in const type 15 | #define GLSL_to_out_ptr(lvalue) lvalue 16 | 17 | #define GLSL_construct 18 | #define GLSL_unused(x) x 19 | #define GLM(type) type 20 | #define GLCPP_DEFAULT(x) 21 | 22 | // language-wide configuration 23 | #extension GL_EXT_buffer_reference : enable 24 | 25 | #define GLSL_SPLIT_INT64 26 | #define GLSL_UINT64 uvec2 27 | 28 | #extension GL_KHR_shader_subgroup_ballot : enable 29 | #extension GL_KHR_shader_subgroup_vote : enable 30 | #extension GL_KHR_shader_subgroup_arithmetic : enable 31 | 32 | #extension GL_EXT_scalar_block_layout : require 33 | #extension GL_EXT_nonuniform_qualifier : enable 34 | 35 | #extension GL_EXT_control_flow_attributes : require 36 | 37 | #define UNROLL_FOR [[unroll]] for 38 | #define DYNAMIC_FOR [[dont_unroll]] for 39 | 40 | #define inline 41 | 42 | inline vec2 fma2(vec2 a, vec2 b, vec2 c) { 43 | return fma(a, b, c); 44 | } 45 | inline vec3 fma3(vec3 a, vec3 b, vec3 c) { 46 | return fma(a, b, c); 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /rendering/language.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef GLSL_LANGUAGE_ADAPTER 5 | #define GLSL_LANGUAGE_ADAPTER 6 | 7 | // qualifiers 8 | #define GLSL_out(type) type& 9 | #define GLSL_inout(type) type& 10 | #define GLSL_in(type) type const& 11 | #define GLSL_to_out_ptr(lvalue) &(lvalue) 12 | 13 | #define GLSL_construct(...) { __VA_ARGS__ } 14 | #define GLSL_unused(x) (void) x 15 | #ifndef GLM 16 | #define GLM(type) glm::type 17 | #endif 18 | #ifndef GLCPP_DEFAULT 19 | #define GLCPP_DEFAULT(...) __VA_ARGS__ 20 | #endif 21 | 22 | #define GLSL_UINT64 uint64_t 23 | 24 | #define UNROLL_FOR for // todo: specialize for CUDA? 25 | #define DYNAMIC_FOR for // todo: specialize for CUDA? 26 | 27 | inline vec2 fma2(vec2 a, vec2 b, vec2 c) { 28 | return vec2( 29 | fma(a.x, b.x, c.x) 30 | , fma(a.y, b.y, c.y) 31 | ); 32 | } 33 | 34 | inline vec3 fma3(vec3 a, vec3 b, vec3 c) { 35 | return vec3( 36 | fma(a.x, b.x, c.x) 37 | , fma(a.y, b.y, c.y) 38 | , fma(a.z, b.z, c.z) 39 | ); 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /rendering/lights/light.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef LIGHTS_H_GLSL 5 | #define LIGHTS_H_GLSL 6 | 7 | #define LIGHT_TYPE_POINT 0 8 | #define LIGHT_TYPE_TRIANGLE 1 9 | #define LIGHT_TYPE_QUAD 2 10 | 11 | struct LightData 12 | { 13 | GLM(vec3) positionWS GLCPP_DEFAULT(= GLM(vec3)(0.0f)); 14 | float range GLCPP_DEFAULT(= 1); 15 | 16 | GLM(vec3) radiance GLCPP_DEFAULT(= GLM(vec3)(0.0f)); 17 | float falloff GLCPP_DEFAULT(= 1); 18 | 19 | GLM(vec3) up GLCPP_DEFAULT(= GLM(vec3)(0.0f)); 20 | float width GLCPP_DEFAULT(= 1); 21 | 22 | GLM(vec3) right GLCPP_DEFAULT(= GLM(vec3)(0.0f)); 23 | float height GLCPP_DEFAULT(= 1); 24 | 25 | GLM(vec3) forward GLCPP_DEFAULT(= GLM(vec3)(0.0f)); 26 | uint32_t type GLCPP_DEFAULT(= 0); 27 | }; 28 | 29 | #endif // LIGHTS_H_GLSL 30 | -------------------------------------------------------------------------------- /rendering/lights/point.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef POINT_LIGHTS_H_GLSL 5 | #define POINT_LIGHTS_H_GLSL 6 | 7 | struct PointLight 8 | { 9 | GLM(vec3) positionWS; 10 | float range; 11 | GLM(vec3) radiance; 12 | float falloff; 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /rendering/lights/quad.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef QUAD_LIGHTS_GLSL 5 | #define QUAD_LIGHTS_GLSL 6 | 7 | #include "../language.glsl" 8 | 9 | #include "quad.h.glsl" 10 | 11 | vec3 sample_quad_light_position(const QuadLight light, vec2 samples) 12 | { 13 | return samples.x * light.v_x * light.width + samples.y * light.v_y * light.height + 14 | light.position; 15 | } 16 | 17 | /* Compute the PDF of sampling the sampled point p light with the ray specified by orig and 18 | * dir, assuming the light is not occluded 19 | */ 20 | float quad_light_pdf(const QuadLight light, 21 | const vec3 p, 22 | const vec3 orig, 23 | const vec3 dir) 24 | { 25 | float surface_area = light.width * light.height; 26 | vec3 to_pt = p - orig; 27 | float dist_sqr = dot(to_pt, to_pt); 28 | float n_dot_w = dot(light.normal, -dir); 29 | if (n_dot_w < EPSILON) { 30 | return 0.f; 31 | } 32 | return dist_sqr / (n_dot_w * surface_area); 33 | } 34 | 35 | bool quad_intersect(const QuadLight light, 36 | const vec3 orig, 37 | const vec3 dir, 38 | GLSL_out(float) t, 39 | GLSL_out(vec3) light_pos) 40 | { 41 | float denom = dot(dir, light.normal); 42 | if (denom != 0.f) { 43 | t = dot(light.position - orig, light.normal) / denom; 44 | if (t < 0.f) { 45 | return false; 46 | } 47 | 48 | // It's a finite plane so now see if the hit point is actually inside the plane 49 | light_pos = orig + dir * t; 50 | vec3 hit_v = light_pos - light.position; 51 | if (abs(dot(hit_v, light.v_x)) < light.width && 52 | abs(dot(hit_v, light.v_y)) < light.height) { 53 | return true; 54 | } 55 | } 56 | return false; 57 | } 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /rendering/lights/quad.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef QUAD_LIGHTS_H_GLSL 5 | #define QUAD_LIGHTS_H_GLSL 6 | 7 | // Quad-shaped light source 8 | struct QuadLight { 9 | GLM(vec3) emission; float _pad1; 10 | GLM(vec3) position; float _pad2; 11 | GLM(vec3) normal; float _pad3; 12 | // x and y vectors spanning the quad, with 13 | // the half-width and height 14 | GLM(vec3) v_x; 15 | float width; 16 | GLM(vec3) v_y; 17 | float height; 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /rendering/lights/sky_model_arhosek/sky_model.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef ARHOSEK_SKY_MODEL_PARAMS 5 | #define ARHOSEK_SKY_MODEL_PARAMS 6 | 7 | struct SkyModelParams { 8 | GLM(vec4) configs[9]; 9 | GLM(vec4) radiances; 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /rendering/lights/sun.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef SUN_LIGHT_GLSL 5 | #define SUN_LIGHT_GLSL 6 | 7 | #include "../util.glsl" 8 | 9 | inline vec3 sample_sun_dir(vec3 sun_dir, float cos_radius, vec2 sampl) { 10 | float phi = 2.0f * M_PI * sampl.x; 11 | float cosTheta = mix(1.0f, cos_radius, sampl.y); 12 | float sinTheta = sqrt(max(0.0f, 1.0f - cosTheta * cosTheta)); 13 | 14 | return ortho_frame(sun_dir) * vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); 15 | } 16 | 17 | inline float sample_sun_dir_pdf(vec3 sun_dir, float cos_radius, vec3 sampled) { 18 | float solid_angle = 2.0f * M_PI * (1.0f - cos_radius); 19 | return 1.0f / solid_angle; 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /rendering/lights/tri.h.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef TRI_LIGHTS_H_GLSL 5 | #define TRI_LIGHTS_H_GLSL 6 | 7 | // Tri-shaped light source 8 | struct TriLight { 9 | GLM(vec3) v0, v1, v2; 10 | GLM(vec3) radiance; 11 | }; 12 | 13 | struct TriLightData { 14 | #ifndef QUANTIZED_POSITIONS_TODO 15 | float v0_x, v0_y, v0_z; 16 | float v1_x, v1_y, v1_z; 17 | float v2_x, v2_y, v2_z; 18 | #else 19 | uint64_t tri; 20 | #endif 21 | #ifndef QUANTIZED_EMITTERS 22 | float radiance_x, radiance_y, radiance_z; 23 | #else 24 | uint32_t radiance; 25 | #endif 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /rendering/mc/light_sampling.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef RENDERING_LIGHT_SAMPLING_H 5 | #define RENDERING_LIGHT_SAMPLING_H 6 | 7 | /* 8 | * NOTE: If you add to the defines please keep the list of strings below 9 | * in sync! 10 | */ 11 | #define LIGHT_SAMPLING_VARIANT_NONE 0 12 | #define LIGHT_SAMPLING_VARIANT_RIS 1 13 | 14 | #define LIGHT_SAMPLING_VARIANT_NAMES \ 15 | "NONE", \ 16 | "RIS" 17 | 18 | // note: the default value will be omitted from build command lines 19 | #define RBO_light_sampling_variant_DEFAULT LIGHT_SAMPLING_VARIANT_RIS 20 | #define RBO_light_sampling_bucket_count_DEFAULT 16 21 | 22 | // ensure consistent defaults when option is omitted 23 | #ifndef RBO_light_sampling_variant 24 | #define RBO_light_sampling_variant RBO_light_sampling_variant_DEFAULT 25 | #endif 26 | 27 | #define RBO_light_sampling_variant_NAMES_PREFIX "LIGHT_SAMPLING_VARIANT_" 28 | #define RBO_light_sampling_variant_NAMES LIGHT_SAMPLING_VARIANT_NAMES 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /rendering/mc/lights_point.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef LIGHTS_POINT_GLSL 5 | #define LIGHTS_POINT_GLSL 6 | 7 | #include "../defaults.glsl" 8 | #include "../lights/light.h.glsl" 9 | 10 | float point_light_attenuation(in LightData lightData, float distance) 11 | { 12 | // Light attenuation 13 | float s = distance / lightData.range; 14 | float s2 = s*s; 15 | float p = (1- s2); 16 | return distance <= lightData.range ? p * p /(1 + lightData.falloff * s2) : 0.0; 17 | } 18 | 19 | vec3 eval_point_light(in LightData lightData, vec3 hit_point, vec3 hit_normal) 20 | { 21 | // Light vector 22 | vec3 L = (lightData.positionWS - hit_point); 23 | float distance = length(L); 24 | L /= max(distance, 1e-6); 25 | 26 | // Compute the distance attenuation 27 | float distance_att = point_light_attenuation(lightData, distance); 28 | 29 | // Evaluate the clamped NdotL 30 | float clampNdotL = clamp(dot(L, hit_normal), 0, 1); 31 | 32 | // TODO: Lambert lighting, need to be replaced by the disney_eval 33 | return M_1_PI * clampNdotL * lightData.radiance * distance_att; 34 | } 35 | 36 | #endif // LIGHTS_POINT_GLSL 37 | -------------------------------------------------------------------------------- /rendering/mc/lights_sun.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "../defaults.glsl" 5 | #include "../lights/sun.glsl" 6 | #include "../bsdfs/hit_point.glsl" 7 | 8 | inline vec3 sample_sun_light(const vec3 hit_point, const vec3 hit_normal 9 | , vec3 sun_dir, float sun_cap_cos 10 | , vec2 dir_sample, vec2 sel_sample 11 | , GLSL_out(vec3) light_dir, GLSL_out(float) pdf) 12 | { 13 | light_dir = sample_sun_dir(sun_dir, sun_cap_cos, dir_sample); 14 | pdf = sample_sun_dir_pdf(sun_dir, sun_cap_cos, light_dir); 15 | return vec3(1.0f) / pdf; 16 | } 17 | 18 | inline float eval_sun_light_pdf(const vec3 hit_point, const vec3 hit_normal, const vec3 w_i 19 | , vec3 sun_dir, float sun_cap_cos) 20 | { 21 | return sample_sun_dir_pdf(sun_dir, sun_cap_cos, w_i); 22 | } 23 | -------------------------------------------------------------------------------- /rendering/mc/nee_interface.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef MC_NEE_INTERFACE_HEADER 5 | #define MC_NEE_INTERFACE_HEADER 6 | 7 | #include "../defaults.glsl" 8 | #include "../bsdfs/hit_point.glsl" 9 | #include "../lights/light.h.glsl" 10 | 11 | inline float nee_mis_heuristic(float n_f, float pdf_f, float n_g, float pdf_g) { 12 | float f = n_f * pdf_f; 13 | float g = n_g * pdf_g; 14 | return f / (f + g); 15 | } 16 | 17 | struct NEEQueryInfo { 18 | // todo: potentially material properties (LTC info?) 19 | int reserved; 20 | }; 21 | struct NEEQueryPoint { 22 | vec3 point; 23 | vec3 normal; 24 | vec3 w_o; 25 | NEEQueryInfo info; 26 | }; 27 | 28 | struct NEESampledArea { 29 | float approx_solid_angle; 30 | int type; // currently ignored, as only triangles 31 | }; 32 | inline NEESampledArea no_nee_sampled_area() { 33 | NEESampledArea area; 34 | area.approx_solid_angle = 0.0f; 35 | area.type = -1; 36 | return area; 37 | } 38 | 39 | #ifdef MATERIAL_TYPE 40 | inline NEEQueryPoint nee_query_point(const MATERIAL_TYPE mat, GLSL_in(InteractionPoint) hit, const vec3 w_o) { 41 | return NEEQueryPoint GLSL_construct(hit.p, hit.n, w_o, NEEQueryInfo GLSL_construct(0)); 42 | } 43 | #endif 44 | 45 | #ifdef SUN_LIGHT_GLSL 46 | inline float eval_direct_sun_light_pdf(NEEQueryPoint query, vec3 w_i) { 47 | return scene_params.sun_radiance.w * eval_sun_light_pdf(query.point, query.normal, w_i, scene_params.sun_dir, scene_params.sun_cos_angle); 48 | } 49 | #endif 50 | 51 | #ifdef TRI_LIGHTS_GLSL 52 | inline float wpdf_direct_tri_light(float approx_solid_angle) { 53 | return (1.0f - scene_params.sun_radiance.w) * approx_tri_lights_pdf(approx_solid_angle); 54 | } 55 | 56 | inline float wpdf_direct_light(NEESampledArea light) { 57 | // if (light.type == LIGHT_TYPE_TRIANGLE) { 58 | return wpdf_direct_tri_light(light.approx_solid_angle); 59 | //} 60 | } 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /rendering/mc/shade_megakernel.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef MC_MEGAKERNEL_SHADE_HEADER 5 | #define MC_MEGAKERNEL_SHADE_HEADER 6 | 7 | #include "language.glsl" 8 | 9 | #include "mc/shading_interface.glsl" 10 | #include "shade_base_material.glsl" 11 | 12 | 13 | inline int shade_megakernel(GLSL_inout(ShadingSampleState) state 14 | , GLSL_inout(vec3) illum, GLSL_inout(vec3) path_throughput 15 | , int material_id, BaseMaterial params, HitPoint lookup_point 16 | , NEESampledArea nee_area 17 | , vec3 w_o, GLSL_inout(InteractionPoint) interaction 18 | , GLSL_inout(RANDOM_STATE) rng, GLSL_inout(vec3) w_i, GLSL_inout(ShadingQueryAux) aux 19 | , bool active_mask) { 20 | bool is_neural = false; 21 | int neural_result; 22 | #ifdef shade_neural 23 | is_neural = active_mask && (params.flags & BASE_MATERIAL_NEURAL) != 0; 24 | { 25 | neural_result = shade_neural(state 26 | , illum, path_throughput 27 | , material_id, params, lookup_point 28 | , nee_area 29 | , w_o, interaction 30 | , rng, w_i, aux, is_neural); 31 | } 32 | #endif 33 | if (is_neural) 34 | return neural_result; 35 | 36 | if (!active_mask) 37 | return SHADING_RESULT_TERMINATE; 38 | return shade_base_material(state 39 | , illum, path_throughput 40 | , material_id, params, lookup_point 41 | , nee_area 42 | , w_o, interaction 43 | , rng, w_i, aux); 44 | } 45 | 46 | #ifdef CUSTOM_MATERIAL_ALPHA 47 | 48 | inline float get_material_alpha(int material_id, GLSL_in(MATERIAL_PARAMS) p, GLSL_in(HitPoint) hit) 49 | { 50 | #ifdef get_neural_alpha 51 | if ((p.flags & BASE_MATERIAL_NEURAL) != 0) 52 | return get_neural_alpha(material_id, p, hit); 53 | #endif 54 | return get_base_material_alpha(material_id, p, hit); 55 | } 56 | 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /rendering/mc/shading_interface.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef MC_MATERIAL_SHADE_HEADER 5 | #define MC_MATERIAL_SHADE_HEADER 6 | 7 | #define SHADING_RESULT_TERMINATE -1 8 | #define SHADING_RESULT_NULL 0 9 | #define SHADING_RESULT_BOUNCE 1 10 | #define SHADING_RESULT_TRANSPARENT 2 11 | 12 | #include "../bsdfs/hit_point.glsl" 13 | #include "nee_interface.glsl" 14 | 15 | struct ShadingSampleState { 16 | int bounce; 17 | int output_channel; 18 | float prev_bounce_pdf; 19 | }; 20 | ShadingSampleState init_shading_sample_state() { 21 | return ShadingSampleState(0, 0, 2.e16f); 22 | } 23 | 24 | struct ShadingQueryAux { 25 | float sampling_pdf; 26 | float mis_pdf; 27 | }; 28 | 29 | inline int perform_shading(GLSL_inout(ShadingSampleState) state 30 | , GLSL_inout(vec3) illum, GLSL_inout(vec3) path_throughput 31 | , int material_id, BaseMaterial params, HitPoint lookup_point 32 | , NEESampledArea nee_area 33 | , vec3 wo, InteractionPoint interaction 34 | , GLSL_inout(RANDOM_STATE) rng, GLSL_inout(vec3) wi, GLSL_inout(ShadingQueryAux) aux); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /rendering/pathspace.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef PATHSPACE_H 5 | #define PATHSPACE_H 6 | 7 | // for now just a bunch of defines to map pointsets dimensions to path space 8 | // usually projections are optimized for 2D, so the right coupling is important 9 | // and the dimensions used should be a multiple of 2 10 | 11 | // Camera dimensions for a full-spec path tracer, not used for now 12 | #define DIM_LAMBDA 2 13 | #define DIM_TIME 3 14 | #define DIM_PIXEL_X 0 15 | #define DIM_PIXEL_Y 1 16 | #define DIM_APERTURE_X 4 17 | #define DIM_APERTURE_Y 5 18 | #define DIM_CAMERA_END 6 // number of dimensions used for the camera setup 19 | 20 | // simple cameras only use 2 resp. 4 dimensions 21 | #define DIM_SIMPLE_CAMERA_BEGIN DIM_PIXEL_X 22 | #define DIM_SIMPLE_CAMERA_END DIM_PIXEL_X+2 23 | 24 | // vertex dimensions used 25 | #define DIM_DIRECTION_X 0 26 | #define DIM_DIRECTION_Y 1 27 | #define DIM_LOBE 2 28 | #define DIM_FREE_PATH 3 29 | #define DIM_VERTEX_END 4 30 | 31 | #define DIM_RR (DIM_FREE_PATH-DIM_VERTEX_END) // using the currently unused free path slot before vertex end, after advancing to next vertex 32 | 33 | // next event estimation, first two for light (set) selection and cdf 34 | #define DIM_LIGHT_SEL_1 0 35 | #define DIM_LIGHT_SEL_2 1 36 | #define DIM_POSITION_X 2 37 | #define DIM_POSITION_Y 3 38 | #define DIM_LIGHT_END 4 39 | 40 | #ifdef USE_SIMPLIFIED_CAMERA 41 | #undef DIM_CAMERA_END 42 | #define DIM_CAMERA_END DIM_SIMPLE_CAMERA_END 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /rendering/pointsets/bn_data.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef BN_DATA_GLSL 5 | #define BN_DATA_GLSL 6 | 7 | #define BNData_SampleCount 256 8 | #define BNData_Dimensions 256 9 | #define BNData_ScramblingDimensions 8 10 | #define BNData_TileSize 128 11 | 12 | struct BNData 13 | { 14 | uint32_t sobol_spp_d[BNData_SampleCount * BNData_Dimensions]; 15 | 16 | uint32_t tile_scrambling_yx_d_1spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 17 | //uint32_t tile_ranking_yx_d_1spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; // = { 0 } 18 | 19 | uint32_t tile_scrambling_yx_d_4spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 20 | uint32_t tile_ranking_yx_d_4spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 21 | 22 | uint32_t tile_scrambling_yx_d_16spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 23 | uint32_t tile_ranking_yx_d_16spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 24 | 25 | uint32_t tile_scrambling_yx_d_256spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 26 | uint32_t tile_ranking_yx_d_256spp[BNData_TileSize * BNData_TileSize * BNData_ScramblingDimensions]; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /rendering/pointsets/hashing.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef RNG_HASHING_GLSL 5 | #define RNG_HASHING_GLSL 6 | 7 | // Copyright 2009-2020 Intel Corporation 8 | // SPDX-License-Identifier: Apache-2.0 9 | // https://github.com/ospray/ospray/blob/release-2.8.x/ospray/math/random.ih 10 | 11 | inline uint32_t murmur_hash3_mix(uint32_t hash, uint32_t k) 12 | { 13 | const uint32_t c1 = 0xcc9e2d51; 14 | const uint32_t c2 = 0x1b873593; 15 | const uint32_t r1 = 15; 16 | const uint32_t r2 = 13; 17 | const uint32_t m = 5; 18 | const uint32_t n = 0xe6546b64; 19 | 20 | k *= c1; 21 | k = (k << r1) | (k >> (32 - r1)); 22 | k *= c2; 23 | 24 | hash ^= k; 25 | hash = ((hash << r2) | (hash >> (32 - r2))) * m + n; 26 | 27 | return hash; 28 | } 29 | 30 | inline uint32_t murmur_hash3_finalize(uint32_t hash) 31 | { 32 | hash ^= hash >> 16; 33 | hash *= 0x85ebca6b; 34 | hash ^= hash >> 13; 35 | hash *= 0xc2b2ae35; 36 | hash ^= hash >> 16; 37 | 38 | return hash; 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /rendering/pointsets/lcg_rng.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef LCG_RNG_GLSL 5 | #define LCG_RNG_GLSL 6 | 7 | #include "../language.glsl" 8 | #include "hashing.glsl" 9 | 10 | // https://github.com/ospray/ospray/blob/master/ospray/math/random.ih 11 | struct LCGRand { 12 | uint32_t state; 13 | }; 14 | 15 | inline uint32_t lcg_random(GLSL_inout(LCGRand) rng) 16 | { 17 | const uint32_t m = 1664525; 18 | const uint32_t n = 1013904223; 19 | rng.state = rng.state * m + n; 20 | return rng.state; 21 | } 22 | 23 | inline float lcg_randomf(GLSL_inout(LCGRand) rng) 24 | { 25 | return ldexp(float(lcg_random(rng)), -32); 26 | } 27 | 28 | inline LCGRand get_lcg_rng(uint32_t index, uint32_t frame, uint32_t linear) 29 | { 30 | LCGRand rng; 31 | rng.state = murmur_hash3_mix(frame, linear); // note: low-quality randomization w.r.t. frame (not used for progressive rendering/temporal accumulation). should rename "frame" to "shot" 32 | rng.state = murmur_hash3_mix(rng.state, index); 33 | rng.state = murmur_hash3_finalize(rng.state); 34 | return rng; 35 | } 36 | inline LCGRand get_lcg_rng(uint32_t index, uint32_t frame, uvec4 pixel_and_dimensions) 37 | { 38 | return get_lcg_rng(index, frame, pixel_and_dimensions.x + pixel_and_dimensions.y * pixel_and_dimensions.z); 39 | } 40 | 41 | inline void pack_random_state(LCGRand rng, GLSL_out(uint32_t) state) 42 | { 43 | state = rng.state; 44 | } 45 | 46 | inline LCGRand unpack_random_state(uint32_t random_state) 47 | { 48 | LCGRand rng; 49 | rng.state = random_state; 50 | return rng; 51 | } 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /rendering/pointsets/selected_rng.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | // #include "../../librender/render_params.glsl.h" 5 | 6 | #if RBO_rng_variant == RNG_VARIANT_BN 7 | #include "bn_rng.glsl" 8 | #elif RBO_rng_variant == RNG_VARIANT_SOBOL 9 | #include "sobol.glsl" 10 | #elif RBO_rng_variant == RNG_VARIANT_Z_SBL 11 | #define Z_ORDER_SHUFFLING 12 | #include "sobol.glsl" 13 | #endif 14 | -------------------------------------------------------------------------------- /rendering/pointsets/sobol_data.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef SOBOL_DATA_GLSL 5 | #define SOBOL_DATA_GLSL 6 | 7 | #define SobolData_Dimensions 1024 8 | #define SobolData_MatrixSize 32 9 | #define SobolData_TileSize 256 10 | #define SobolData_InvertDim0 0 11 | #define SobolData_InvertDim1 1 12 | 13 | struct SobolData 14 | { 15 | uint32_t matrix[SobolData_Dimensions * SobolData_MatrixSize]; 16 | uint32_t tile_invert_1_0[SobolData_TileSize * SobolData_TileSize]; 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /rendering/postprocess/color_grading_utils.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef COLOR_GRADING_UTILS_GLSL 5 | #define COLOR_GRADING_UTILS_GLSL 6 | 7 | const mat3x3 LIN_2_LMS_MAT = mat3x3( 8 | 3.90405e-1, 5.49941e-1, 8.92632e-3, 9 | 7.08416e-2, 9.63172e-1, 1.35775e-3, 10 | 2.31082e-2, 1.28021e-1, 9.36245e-1 11 | ); 12 | 13 | const mat3x3 LMS_2_LIN_MAT = mat3( 14 | 2.85847e+0, -1.62879e+0, -2.48910e-2, 15 | -2.10182e-1, 1.15820e+0, 3.24281e-4, 16 | -4.18120e-2, -1.18169e-1, 1.06867e+0 17 | ); 18 | 19 | vec3 linear_to_lms(vec3 x) 20 | { 21 | return x * LIN_2_LMS_MAT; 22 | } 23 | 24 | vec3 lms_to_linear(vec3 x) 25 | { 26 | return x * LMS_2_LIN_MAT; 27 | } 28 | 29 | vec3 color_balance(vec3 linear_color) 30 | { 31 | // Move to lms space 32 | vec3 lms_color = linear_to_lms(linear_color); 33 | 34 | // Apply the color balance 35 | lms_color *= color_balance_operator.xyz; 36 | 37 | // Move back to linear space 38 | return lms_to_linear(lms_color); 39 | } 40 | 41 | #endif // COLOR_GRADING_UTILS_GLSL 42 | -------------------------------------------------------------------------------- /rendering/postprocess/reprojection.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef RENDERING_PROCESSING_REPROJECTION_H 5 | #define RENDERING_PROCESSING_REPROJECTION_H 6 | 7 | /* 8 | * NOTE: If you add to the defines please keep the list of strings below 9 | * in sync! 10 | */ 11 | #define REPROJECTION_MODE_NONE 0 12 | #define REPROJECTION_MODE_DISCARD_HISTORY 1 13 | #define REPROJECTION_MODE_ACCUMULATE 2 14 | 15 | #define REPROJECTION_MODE_NAMES \ 16 | "NONE", \ 17 | "DISCARD_HISTORY", \ 18 | "ACCUMULATE" 19 | 20 | #endif /* RENDERING_PROCESSING_REPROJECTION_H */ 21 | -------------------------------------------------------------------------------- /rendering/postprocess/tonemapping.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef TONEMAPPING_H_GLSL 5 | #define TONEMAPPING_H_GLSL 6 | 7 | // Tonemapping modes 8 | #define NO_TONE_MAPPING 0 9 | #define NEUTRAL_TONE_MAPPING 1 10 | #define FAST_TONE_MAPPING 2 11 | 12 | // note: order has to match numbers! 13 | #define TONEMAPPING_MODES_NAMES \ 14 | "NO_TONE_MAPPING", \ 15 | "NEUTRAL_TONE_MAPPING", \ 16 | "FAST_TONE_MAPPING" 17 | 18 | // remap old operator names 19 | #define COMPATIBILITY_TONEMAPPING_OPERATOR_NAMES \ 20 | "TONEMAPPING_OPERATOR_LINEAR", \ 21 | "TONEMAPPING_OPERATOR_LOG" 22 | 23 | 24 | #endif // TONEMAPPING_H_GLSL 25 | 26 | -------------------------------------------------------------------------------- /rendering/postprocess/tonemapping_utils.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef TONEMAPPING_UTILS_GLSL 5 | #define TONEMAPPING_UTILS_GLSL 6 | 7 | #include "tonemapping.h" 8 | 9 | vec3 neutral_tone_map(vec3 c) { 10 | const float luminance_level = max(max(c.x, c.y), max(c.z, 1.0f)); 11 | c *= mix(0.1f * log2(luminance_level), 1.0f, 0.8f) 12 | / luminance_level; 13 | return c; 14 | } 15 | 16 | vec3 tonemap(int tone_mapping_mode, vec3 colorLinear) 17 | { 18 | if (tone_mapping_mode == NO_TONE_MAPPING) 19 | { 20 | colorLinear = colorLinear; 21 | } 22 | else if (tone_mapping_mode == FAST_TONE_MAPPING) 23 | { 24 | colorLinear = colorLinear / (vec3(1.0 + colorLinear)); 25 | } 26 | else if (tone_mapping_mode == NEUTRAL_TONE_MAPPING) 27 | { 28 | colorLinear = neutral_tone_map(colorLinear); 29 | } 30 | return colorLinear; 31 | } 32 | 33 | #endif // TONEMAPPING_UTILS_GLSL 34 | -------------------------------------------------------------------------------- /rendering/rt/materials.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef MATERIAL_DECODE_HEADER 5 | #define MATERIAL_DECODE_HEADER 6 | 7 | #include "../bsdfs/texture_channel_mask.h" 8 | #include "../bsdfs/hit_point.glsl" 9 | 10 | // #define MATERIAL_PARAMS 11 | // #define MATERIAL_TYPE 12 | 13 | #ifndef MATERIAL_PARAMS 14 | #include "../bsdfs/base_material.h.glsl" 15 | #define MATERIAL_PARAMS BaseMaterial 16 | #endif 17 | 18 | struct EmitterInteraction { 19 | vec3 radiance; 20 | }; 21 | // backwards compatibility 22 | #ifndef EmitterParams 23 | #define EmitterParams EmitterInteraction 24 | #endif 25 | 26 | inline vec4 textured_color_param(const vec4 x, GLSL_in(HitPoint) hit); 27 | inline float textured_scalar_param(const float x, GLSL_in(HitPoint) hit); 28 | 29 | // accessors for potentially unrolled standard textures 30 | #if defined(UNROLL_STANDARD_TEXTURES) && !defined(MATERIAL_DECODE_CUSTOM_TEXTURES) 31 | 32 | inline vec4 textured_standard_param(uint32_t material_id, GLSL_in(HitPoint) hit, int slot); 33 | inline float textured_channel_dynamic(const vec4 x, uint32_t channel); 34 | 35 | #define textured_scalar_standard_param(material_id, value, hit, slot, channel) \ 36 | textured_channel_dynamic(textured_standard_param(material_id, hit, slot), channel) 37 | #define textured_color_standard_param(material_id, value, hit, slot) \ 38 | textured_standard_param(material_id, hit, slot) 39 | 40 | #else 41 | 42 | #ifndef textured_scalar_standard_param 43 | #define textured_scalar_standard_param(material_id, value, hit, slot, channel) \ 44 | textured_scalar_param(value, hit) 45 | #endif 46 | #ifndef textured_color_standard_param 47 | #define textured_color_standard_param(material_id, value, hit, slot) \ 48 | textured_color_param(value, hit) 49 | #endif 50 | 51 | #endif 52 | 53 | #ifndef ENABLE_MATERIAL_DECODE 54 | #define ENABLE_MATERIAL_DECODE // enable functionality in subsequent material headers 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /rendering/tests/compile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include 5 | 6 | namespace shaders_default { 7 | 8 | using namespace glm; 9 | #include "../language.hpp" 10 | 11 | #define MAKE_RANDOM_TABLE(TYPE, NAME) TYPE NAME; 12 | #include "../pointsets/sobol.glsl" 13 | #include "../pointsets/lcg_rng.glsl" 14 | 15 | #include "../util.glsl" 16 | 17 | #include "../bsdfs/base_material.h.glsl" 18 | 19 | #define NO_MATERIAL_REGISTRATION 20 | namespace glft_bsdf { 21 | #include "../bsdfs/gltf_bsdf.glsl" 22 | } 23 | 24 | #include "../lights/tri.glsl" 25 | 26 | uint32_t const global_num_lights = 10; 27 | TriLightData lights[global_num_lights] = {}; 28 | 29 | // assemble light transport algorithm 30 | #define SCENE_GET_LIGHT_SOURCE(light_id) decode_tri_light(lights[light_id]) 31 | #define SCENE_GET_LIGHT_SOURCE_COUNT() int(global_num_lights) 32 | 33 | namespace linear_light_selection { 34 | 35 | #include "../mc/lights_linear.glsl" 36 | 37 | } 38 | 39 | bool raytrace_test_visibility(const vec3 from, const vec3 dir, float dist) { return true; } 40 | 41 | } // namespace 42 | -------------------------------------------------------------------------------- /security.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. 3 | 4 | ## Reporting a Vulnerability 5 | Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). 6 | -------------------------------------------------------------------------------- /util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | begin_support_targets() # IDE filters 5 | add_subdirectory(display) 6 | 7 | 8 | 9 | add_library(util 10 | interactive_camera.cpp 11 | util.cpp 12 | profiling.cpp 13 | error_io.cpp 14 | file_mapping.cpp 15 | device_backend.cpp 16 | write_image.cpp 17 | image.cpp 18 | lod.cpp 19 | sha1_bytes.cpp 20 | 21 | ) 22 | add_project_files(util ${CMAKE_CURRENT_SOURCE_DIR} *.h) 23 | 24 | target_precompile_headers(util PRIVATE $<$:${CMAKE_CURRENT_SOURCE_DIR}/../pch.hpp>) 25 | target_precompile_headers(display REUSE_FROM util) 26 | 27 | # make these modules known to all dependent targets 28 | target_include_directories(util PUBLIC 29 | $ 30 | ${GLFW_INTERFACE_DEFINITIONS}) 31 | target_compile_definitions(util PUBLIC ${GLM_INTERFACE_DEFINITIONS}) 32 | 33 | target_link_libraries(util PUBLIC glm) 34 | target_link_libraries(util PUBLIC imgui) 35 | target_link_libraries(util PUBLIC tinyexr) 36 | target_link_libraries(util PUBLIC stb) 37 | target_link_libraries(util PRIVATE crypto-algorithms) 38 | #target_link_libraries(util PRIVATE parallel_hashmap json tiny_gltf) 39 | 40 | 41 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") 42 | add_executable(compare_exr compare_exr.cpp) 43 | target_link_libraries(compare_exr PRIVATE util tinyexr) 44 | 45 | # IDE filters 46 | end_support_targets() 47 | set_main_targets(util) 48 | -------------------------------------------------------------------------------- /util/device_backend.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "device_backend.h" 5 | #include "display/render_graphic.h" 6 | -------------------------------------------------------------------------------- /util/device_backend.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "ref_counted.h" 7 | #include 8 | #include 9 | #include 10 | 11 | // Opaque structure that needs to be defined per API 12 | struct SubmitParameters; 13 | 14 | struct CommandStream { 15 | virtual ~CommandStream() { } 16 | 17 | virtual void begin_record() = 0; 18 | virtual void end_submit(bool only_manual_wait = false) = 0; 19 | virtual void end_submit(const SubmitParameters* submit_params) = 0; 20 | virtual void wait_complete(int cursor = -1) = 0; 21 | }; 22 | 23 | struct GpuBuffer { 24 | virtual ~GpuBuffer() { } 25 | 26 | virtual void* map() = 0; 27 | virtual void unmap() = 0; 28 | virtual size_t size() const = 0; 29 | }; 30 | 31 | struct ComputePipeline { 32 | virtual ~ComputePipeline() { } 33 | virtual std::string name() = 0; 34 | 35 | virtual int add_buffer(int bindpoint, GpuBuffer* buffer, bool uniform_buffer = false) = 0; 36 | virtual int add_shader(char const* name) = 0; 37 | 38 | // inherit descriptor sets from another pipeline 39 | virtual int add_pipeline(int bindpoint, ComputePipeline* pipeline) = 0; 40 | 41 | virtual void finalize_build() = 0; 42 | virtual void run(CommandStream* stream, int shader_index, glm::uvec2 dispatch_dim) = 0; 43 | }; 44 | 45 | struct ComputeDevice { 46 | virtual ~ComputeDevice() { } 47 | 48 | virtual CommandStream* sync_command_stream() = 0; 49 | virtual std::unique_ptr create_uniform_buffer(size_t size) = 0; 50 | virtual std::unique_ptr create_buffer(size_t size) = 0; 51 | virtual std::unique_ptr create_pipeline() = 0; 52 | }; 53 | 54 | typedef std::unique_ptr (*create_compute_device_function)(const char *device_override); 55 | 56 | #ifdef ENABLE_VULKAN 57 | std::unique_ptr create_vulkan_compute_device(const char *device_override = nullptr); 58 | #endif 59 | -------------------------------------------------------------------------------- /util/display/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Intel Corporation. 2 | # SPDX-License-Identifier: MIT 3 | 4 | find_package(OpenGL REQUIRED) 5 | 6 | add_library(display 7 | imgui_backend.cpp 8 | gldisplay.cpp 9 | shader.cpp) 10 | target_link_libraries(display PUBLIC util glad) 11 | 12 | target_link_libraries(display PUBLIC imgui) 13 | target_link_libraries(display PUBLIC glfw) 14 | -------------------------------------------------------------------------------- /util/display/display.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | struct RenderGraphic; 10 | struct CommandStream; 11 | 12 | struct Display { 13 | static const int MAX_SWAP_IMAGES = 3; 14 | glm::ivec2 fb_dims; 15 | 16 | Display() = default; 17 | Display(Display const&) = delete; 18 | Display& operator=(Display const&) = delete; 19 | virtual ~Display() {} 20 | 21 | virtual std::string gpu_brand() const = 0; 22 | virtual std::string name() const = 0; 23 | 24 | virtual void resize(const int fb_width, const int fb_height) = 0; 25 | 26 | virtual void init_ui_frame() = 0; 27 | virtual void new_frame() = 0; 28 | 29 | virtual void display(const std::vector &img) = 0; 30 | virtual void display(RenderGraphic *renderer); 31 | 32 | virtual CommandStream* stream() { return nullptr; } 33 | 34 | private: 35 | // on-demand contains persistently allocated intermediate storage 36 | std::vector framebuffer; 37 | }; 38 | 39 | struct GLFWwindow; 40 | typedef Display* (*create_display_function)(GLFWwindow *window, const char *device_override); 41 | 42 | Display* create_opengl_display(GLFWwindow *window, const char *device_override = nullptr); 43 | #ifdef ENABLE_VULKAN 44 | Display* create_vulkan_display(GLFWwindow *window, const char *device_override = nullptr); 45 | #endif 46 | -------------------------------------------------------------------------------- /util/display/gldisplay.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include "display.h" 9 | #include "glad/glad.h" 10 | #include "shader.h" 11 | #include 12 | 13 | struct GLFWwindow; 14 | 15 | struct GLDisplay : Display { 16 | GLFWwindow *window; 17 | GLuint render_texture; 18 | GLuint vao; 19 | std::unique_ptr display_render; 20 | 21 | GLDisplay(GLFWwindow *window); 22 | 23 | ~GLDisplay() override; 24 | 25 | std::string gpu_brand() const override; 26 | 27 | std::string name() const override; 28 | 29 | void resize(const int fb_width, const int fb_height) override; 30 | 31 | void init_ui_frame() override; 32 | void new_frame() override; 33 | 34 | void display(const std::vector &img) override; 35 | void display_native(const GLuint img); 36 | void display(RenderGraphic *renderer) override; 37 | }; 38 | -------------------------------------------------------------------------------- /util/display/imgui_backend.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "backends/imgui_impl_glfw.cpp" 5 | 6 | IMGUI_IMPL_API void ImGui_Backend_PadFrame(GLFWwindow* window, unsigned to_total_ms) 7 | {/* 8 | ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData(); 9 | 10 | // Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution) 11 | static Uint64 frequency = SDL_GetPerformanceFrequency(); 12 | Uint64 current_time = SDL_GetPerformanceCounter(); 13 | if (bd->Time == 0 || bd->Time >= current_time) return; 14 | 15 | unsigned frame_time = unsigned((current_time - bd->Time) * 1000 / frequency); 16 | if (frame_time < to_total_ms) 17 | SDL_Delay(to_total_ms - frame_time); 18 | */} 19 | -------------------------------------------------------------------------------- /util/display/imgui_backend.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #include "backends/imgui_impl_glfw.h" 6 | 7 | // additional tools 8 | IMGUI_IMPL_API void ImGui_Backend_PadFrame(GLFWwindow* window, unsigned to_total_ms); 9 | -------------------------------------------------------------------------------- /util/display/render_graphic.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | struct RenderGraphic { 12 | enum AOVBufferIndex { 13 | AOVAlbedoRoughnessIndex = 0, 14 | AOVNormalDepthIndex, 15 | AOVMotionJitterIndex, 16 | AOVBufferCount 17 | }; 18 | 19 | static const int MAX_SWAP_BUFFERS = 2; 20 | static int DEFAULT_SWAP_BUFFER_COUNT; 21 | 22 | RenderGraphic() = default; 23 | RenderGraphic(const RenderGraphic &) = delete; 24 | RenderGraphic& operator=(const RenderGraphic &) = delete; 25 | virtual ~RenderGraphic() = default; 26 | 27 | /* Returns (width, height, channels) */ 28 | virtual glm::uvec3 get_framebuffer_size() const { return glm::uvec3{0u,0u,0u}; } 29 | 30 | virtual size_t readback_framebuffer(size_t bufferSize, 31 | unsigned char *buffer, 32 | bool force_refresh = false) { return 0; }; 33 | 34 | // returns true, if supported & successful 35 | virtual size_t readback_framebuffer(size_t bufferSize, 36 | float *buffer, 37 | bool force_refresh = false) { return 0; } 38 | 39 | // These are half float buffers! 40 | virtual size_t readback_aov(AOVBufferIndex aovIndex, 41 | size_t bufferSize, 42 | uint16_t *buffer, 43 | bool force_refesh = false) { return 0; } 44 | }; 45 | 46 | #ifdef GL_TRUE 47 | struct RenderGLGraphic { 48 | GLuint display_texture = -1; 49 | 50 | virtual ~RenderGLGraphic() = default; 51 | }; 52 | #endif 53 | -------------------------------------------------------------------------------- /util/display/shader.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include "unordered_vector.hpp" 8 | #include "glad/glad.h" 9 | 10 | struct Shader { 11 | GLuint program; 12 | unordered_vector uniforms; 13 | 14 | Shader(const std::string &vert_src, const std::string &frag_src); 15 | Shader(const Shader &) = delete; 16 | Shader& operator=(const Shader &) = delete; 17 | ~Shader(); 18 | template 19 | void uniform(const std::string &unif, const T &t); 20 | 21 | private: 22 | // Parse the uniform variable declarations in the src file and 23 | // add them to the uniforms map 24 | void parse_uniforms(const std::string &src); 25 | }; 26 | -------------------------------------------------------------------------------- /util/error_io.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | enum struct LogLevel { 10 | CRITICAL = 0, 11 | WARNING, 12 | INFORMATION, 13 | VERBOSE, 14 | DEVTEST 15 | }; 16 | typedef LogLevel CLL; 17 | 18 | void print(LogLevel level, char const* message, ...); 19 | void println(LogLevel level, char const* message, ...); 20 | 21 | void test_print(char const* message, ...); // level = DEVTEST 22 | void test_println(char const* message, ...); // level = DEVTEST 23 | 24 | void warning(char const* message, ...); // level = WARNING 25 | void warning(LogLevel level, char const* message, ...); 26 | 27 | struct logged_exception : std::runtime_error { using runtime_error::runtime_error; }; 28 | 29 | void throw_error(char const* message, ...); 30 | void print_error(char const* message, ...); 31 | std::string sprint_error(char const* message, ...); 32 | 33 | void stringf(std::string& dest, char const* format, ...); 34 | std::string to_stringf(char const* format, ...); 35 | -------------------------------------------------------------------------------- /util/image.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "file_mapping.h" 7 | 8 | enum ColorSpace { LINEAR, SRGB }; 9 | 10 | struct Image { 11 | std::string name; 12 | int width = 0; 13 | int height = 0; 14 | int channels = 0; 15 | mapped_vector img = {}; // todo: rename to bytes? 16 | ColorSpace color_space = LINEAR; 17 | int bcFormat = 0; 18 | 19 | int max_mip_levels() const; 20 | int mip_levels() const; 21 | int bits_per_pixel() const; 22 | 23 | static Image fromFile(const std::string &file, const std::string &name, ColorSpace color_space = LINEAR); 24 | mapped_vector decompressBytes() const; 25 | mapped_vector decompressBytes(Buffer& scratch) const; 26 | Image decompress() const; 27 | }; 28 | 29 | -------------------------------------------------------------------------------- /util/online_stats.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | /* 7 | * T is the sample type, AT is the type used for aggregate values. 8 | */ 9 | template 10 | struct OnlineStats 11 | { 12 | long long num_samples {0}; 13 | T current_sample {0}; 14 | T sample_min { std::numeric_limits::max() }; 15 | T sample_max { -std::numeric_limits::max() }; 16 | AT sample_mean {0}; 17 | AT sample_variance {0}; 18 | AT sample_stddev {0}; 19 | AT exponential_moving_average {0}; 20 | 21 | inline void update(const T &new_sample); 22 | 23 | private: 24 | AT S {0}; 25 | }; 26 | 27 | template 28 | void OnlineStats::update(const T &new_sample) 29 | { 30 | ++num_samples; 31 | current_sample = new_sample; 32 | sample_min = std::min(sample_min, new_sample); 33 | sample_max = std::max(sample_max, new_sample); 34 | 35 | const AT atsample = static_cast(new_sample); 36 | 37 | // This is Welford's algorithm, see e.g. Knuth, TAOCP Vol. 2, 4.2.2. 38 | if (num_samples == 1) { 39 | sample_mean = atsample; 40 | exponential_moving_average = atsample; 41 | S = T{0}; 42 | sample_variance = T{0}; 43 | sample_stddev = T{0}; 44 | } else { 45 | const T ema_factor = T{2}/T{10}; 46 | exponential_moving_average = 47 | exponential_moving_average * (T{1}-ema_factor) 48 | + atsample * ema_factor; 49 | 50 | const T d1 = atsample - sample_mean; 51 | sample_mean += d1 / static_cast(num_samples); 52 | const T d2 = atsample - sample_mean; 53 | S += d2 * d1; 54 | sample_variance = S / static_cast(num_samples-1); 55 | sample_stddev = std::sqrt(sample_variance); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /util/sha1_bytes.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "sha1_bytes.h" 5 | 6 | extern "C" { 7 | #include "sha1.h" 8 | } 9 | 10 | static_assert(SHA1_HASH_SIZE == SHA1_BLOCK_SIZE, "SHA hash size is inconsistent"); 11 | 12 | int sha1_bytes( 13 | unsigned char *hash, 14 | const unsigned char *data, 15 | size_t len) 16 | { 17 | if (!hash) 18 | return SHA1_BLOCK_SIZE; 19 | SHA1_CTX ctx; 20 | sha1_init(&ctx); 21 | sha1_update(&ctx, (BYTE*) data, len); 22 | sha1_final(&ctx, (BYTE*) hash); 23 | return SHA1_BLOCK_SIZE; 24 | } 25 | -------------------------------------------------------------------------------- /util/sha1_bytes.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #define SHA1_HASH_SIZE 20 7 | 8 | int sha1_bytes( 9 | unsigned char hash[SHA1_HASH_SIZE], 10 | const unsigned char *data, 11 | size_t len); 12 | -------------------------------------------------------------------------------- /util/unordered_vector.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #include 6 | #include 7 | 8 | template 9 | struct unordered_vector { 10 | typedef std::pair value_type; 11 | std::vector elements; 12 | 13 | typename std::vector::iterator find(K const& k) { 14 | auto it = this->elements.begin(); 15 | for (auto ite = this->elements.end(); it != ite; ++it) 16 | if (it->first == k) 17 | return it; 18 | return it; 19 | } 20 | typename std::vector::const_iterator find(K const& k) const { 21 | auto it = this->elements.begin(); 22 | for (auto ite = this->elements.end(); it != ite; ++it) 23 | if (it->first == k) 24 | return it; 25 | return it; 26 | } 27 | 28 | V& operator[] (K const& k) { 29 | auto it = this->find(k); 30 | if (it != this->elements.end()) 31 | return it->second; 32 | this->elements.push_back({k, V{}}); 33 | return this->elements.back().second; 34 | } 35 | 36 | typename std::vector::iterator begin() { return this->elements.begin(); } 37 | typename std::vector::iterator end() { return this->elements.end(); } 38 | typename std::vector::const_iterator begin() const { return this->elements.begin(); } 39 | typename std::vector::const_iterator end() const { return this->elements.end(); } 40 | 41 | bool empty() const { return elements.empty(); } 42 | void clear() { elements.clear(); } 43 | }; 44 | -------------------------------------------------------------------------------- /util/write_image.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | enum OutputImageFormat { 9 | OUTPUT_IMAGE_FORMAT_PNG, 10 | OUTPUT_IMAGE_FORMAT_PFM, 11 | OUTPUT_IMAGE_FORMAT_EXR, 12 | }; 13 | 14 | enum ExrCompression { 15 | EXR_COMPRESSION_ZIP, // Good general purpose. 16 | EXR_COMPRESSION_PIZ, // Good with noisy images. 17 | EXR_COMPRESSION_RLE, // Good with large areas of identical color. 18 | EXR_COMPRESSION_NONE 19 | }; 20 | 21 | struct WriteImage 22 | { 23 | // channels must be 4. 24 | static bool write_png(const char *filename, 25 | unsigned width, unsigned height, unsigned channels, 26 | const unsigned char *pixels); 27 | 28 | // 32 bit float. 29 | static bool write_pfm(const char *filename, 30 | unsigned width, unsigned height, unsigned channels, 31 | const float *pixels); 32 | 33 | // 32 bit float 34 | static bool write_exr(const char *filename, 35 | unsigned width, unsigned height, unsigned channels, 36 | const float *pixels, ExrCompression compression); 37 | 38 | // 16 bit float 39 | static bool write_exr(const char *filename, 40 | unsigned width, unsigned height, unsigned channels, 41 | const uint16_t *pixels, ExrCompression compression); 42 | }; 43 | -------------------------------------------------------------------------------- /vulkan/command_buffer_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace vkrt 9 | { 10 | namespace command_buffer 11 | { 12 | void enqueue_memory_barrier(VkCommandBuffer command_buffer, vkrt::Buffer &buffer, VkPipelineStageFlagBits stage = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); 13 | void enqueue_memory_barrier(VkCommandBuffer command_buffer, vkrt::Texture2D &texture, VkPipelineStageFlagBits stage = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT); 14 | void copy_texture(VkCommandBuffer command_buffer, vkrt::Texture2D& src, vkrt::Texture2D& dst); 15 | void copy_buffer(VkCommandBuffer command_buffer, vkrt::Buffer &src, vkrt::Buffer &dst); 16 | void clear_texture(VkCommandBuffer command_buffer, vkrt::Texture2D& dst, VkClearColorValue color); 17 | } // namespace 18 | } // namespace 19 | 20 | -------------------------------------------------------------------------------- /vulkan/hit.rchit: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | 7 | #extension GL_EXT_ray_tracing : require 8 | 9 | #include "setup_iterative_pt.glsl" 10 | #include "gpu_params.glsl" 11 | 12 | #include "geometry.glsl" 13 | #include "rt/hit.glsl" 14 | 15 | layout(shaderRecordEXT, std430) buffer SBT { 16 | RenderMeshParams geom; 17 | }; 18 | 19 | hitAttributeEXT vec2 attrib; 20 | 21 | layout(location = PRIMARY_RAY) rayPayloadInEXT RTHit payload; 22 | 23 | void main() { 24 | const uvec3 idx = 25 | #ifndef REQUIRE_UNROLLED_VERTICES 26 | ((geom.flags & GEOMETRY_FLAGS_IMPLICIT_INDICES) == 0) ? geom.indices.i[gl_PrimitiveID] : 27 | #endif 28 | uvec3(gl_PrimitiveID * 3) + uvec3(0, 1, 2); 29 | 30 | mat3 vertices = calc_hit_vertices(geom.vertices, 31 | #ifdef QUANTIZED_POSITIONS 32 | geom.quantized_scaling, geom.quantized_offset, 33 | #endif 34 | idx); 35 | RTHit hit = calc_hit_attributes(gl_RayTmaxEXT, gl_PrimitiveID, attrib, 36 | vertices, idx, transpose(mat3(gl_WorldToObjectEXT)), 37 | geom.normals, geom.num_normals > 0, 38 | #ifndef QUANTIZED_NORMALS_AND_UVS 39 | geom.uvs, 40 | #endif 41 | geom.num_uvs > 0, 42 | geom.material_id, geom.materials 43 | ); 44 | 45 | #if NEED_MESH_ID_FOR_VISUALIZATION 46 | hit.parameterized_mesh_id = geom.paramerterized_mesh_data_id; 47 | #endif 48 | 49 | payload = hit; 50 | } 51 | -------------------------------------------------------------------------------- /vulkan/light_sampling/render_binned_lights.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "../render_pipeline_vulkan.h" 7 | 8 | struct LightSamplingSetup; 9 | 10 | struct RenderBinnedLightsVulkan : RenderPipelineExtensionVulkan { 11 | vkrt::Device device; 12 | RenderVulkan* backend; 13 | 14 | std::unique_ptr lights; 15 | vkrt::Buffer light_params = nullptr; 16 | unsigned unique_scene_id = 0; 17 | unsigned lights_revision = ~0; 18 | // todo once dynamic: swap buffers 19 | 20 | RenderBinnedLightsVulkan(RenderVulkan* backend); 21 | virtual ~RenderBinnedLightsVulkan(); 22 | void internal_release_resources(); 23 | 24 | std::string name() const override; 25 | 26 | bool is_active_for(RenderBackendOptions const& rbo) const override; 27 | void preprocess(CommandStream* cmd_stream, int variant_idx) override; 28 | 29 | void initialize(const int fb_width, const int fb_height) override; 30 | void update_scene_from_backend(const Scene& scene) override; 31 | 32 | void register_descriptors(vkrt::BindingLayoutCollector collector, vkrt::RenderPipelineOptions const& options) const override; 33 | void update_shader_descriptor_table(vkrt::BindingCollector collector, vkrt::RenderPipelineOptions const& options, VkDescriptorSet desc_set) override; 34 | 35 | void update_lights(LightSamplingConfig const& params); 36 | }; 37 | -------------------------------------------------------------------------------- /vulkan/miss.rmiss: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | #extension GL_EXT_ray_tracing : require 7 | 8 | #include "setup_iterative_pt.glsl" 9 | #include "gpu_params.glsl" 10 | #include "defaults.glsl" 11 | 12 | 13 | layout(binding = SCENE_PARAMS_BIND_POINT, set = 0, std140) uniform GPBuf { 14 | GLOBAL_CONSTANT_PARAMETERS 15 | }; 16 | 17 | layout(location = PRIMARY_RAY) rayPayloadInEXT RayPayload payload; 18 | 19 | #include "lights/sky_model_arhosek/sky_model.glsl" 20 | 21 | void main() { 22 | payload.dist = -1; 23 | 24 | #ifndef TRIVIAL_BACKGROUND_MISS 25 | vec3 dir = gl_WorldRayDirectionEXT; 26 | float ocean_coeff = 1.0f; 27 | if (dir.y <= 0.0f) { 28 | dir.y = -dir.y; 29 | ocean_coeff = 0.7 * pow(max(1.0 - abs(dir.y), 0.0), 5); 30 | } 31 | 32 | payload.normal = max( skymodel_radiance(scene_params.sky_params, scene_params.sun_dir, dir), vec3(0.0f) ) * ocean_coeff; 33 | if (dot(dir, scene_params.sun_dir) >= scene_params.sun_cos_angle) 34 | payload.geo_normal = vec3(scene_params.sun_radiance) * ocean_coeff; 35 | else 36 | payload.geo_normal = vec3(0.0f); 37 | #else 38 | #endif 39 | } 40 | -------------------------------------------------------------------------------- /vulkan/pipeline_pt/accumulate.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #include "setup_recursive_pt.glsl" 5 | 6 | #include "util.glsl" 7 | #include "postprocess/tonemapping_utils.glsl" 8 | 9 | #extension GL_EXT_shader_atomic_float : require 10 | 11 | // Available feature flags: 12 | // #define ENABLE_RAYQUERIES 13 | 14 | layout(binding = FRAMEBUFFER_BIND_POINT, set = 0, rgba8) uniform writeonly image2D framebuffer; 15 | 16 | #define AOV_TARGET_PIXEL ivec2(gl_LaunchIDEXT.xy) 17 | #include "../accumulate.glsl" 18 | 19 | uint accumulation_index(AccumulationLocation location) { 20 | return uint(location); 21 | } 22 | uvec2 accumulation_location(AccumulationLocation location) { 23 | return uvec2(location & 0xffff, location >> 16); 24 | } 25 | 26 | void accumulate(AccumulationLocation location, vec4 new_result, uint sample_index) { 27 | #ifdef ENABLE_RAYQUERIES 28 | if (num_rayqueries > 0) { 29 | accumulate_query(location, new_result, view_params.frame_id); 30 | return; 31 | } 32 | #endif 33 | //ivec2 pixel = ivec2(accumulation_location(location)); 34 | ivec2 pixel = ivec2(gl_LaunchIDEXT.xy); 35 | 36 | // todo: we should either make this part of a more sensible function signature 37 | // or just pass everything via payload 38 | if ((payload.bounce_and_reliability & BOUNCE_FLAG_NOACCUM) != 0) 39 | new_result.a = 2.0f; 40 | 41 | accumulate(pixel, new_result, view_params.frame_id, (accumulation_flags & ACCUMULATION_FLAGS_ATOMIC) != 0); 42 | 43 | #ifdef REPORT_RAY_STATS 44 | imageStore(ray_stats, pixel, uvec4(ray_count)); 45 | #endif 46 | } 47 | -------------------------------------------------------------------------------- /vulkan/pipeline_pt/any_hit.rahit: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | #extension GL_EXT_ray_tracing : require 7 | 8 | #include "any_hit.glsl" 9 | -------------------------------------------------------------------------------- /vulkan/pipeline_pt/occlusion_miss.rmiss: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | #extension GL_EXT_ray_tracing : require 7 | 8 | #ifdef SANDBOX_PATH_TRACER 9 | #include "../setup_iterative_pt.glsl" 10 | #else 11 | #include "setup_recursive_pt.glsl" 12 | #endif 13 | 14 | rayPayloadInEXT int occlusion_hit; 15 | 16 | void main() { 17 | occlusion_hit = 0; 18 | } 19 | -------------------------------------------------------------------------------- /vulkan/pointsets/render_bn.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "../render_pipeline_vulkan.h" 7 | 8 | struct RenderBNPointsVulkan : RenderPipelineExtensionVulkan { 9 | vkrt::Device device; 10 | RenderVulkan* backend; 11 | 12 | vkrt::Buffer random_numbers_buf = nullptr; 13 | 14 | RenderBNPointsVulkan(RenderVulkan* backend); 15 | virtual ~RenderBNPointsVulkan(); 16 | void internal_release_resources(); 17 | 18 | std::string name() const override; 19 | 20 | void initialize(const int fb_width, const int fb_height) override; 21 | void update_scene_from_backend(const Scene& scene) override; 22 | 23 | bool is_active_for(RenderBackendOptions const& rbo) const override; 24 | 25 | void register_descriptors(vkrt::BindingLayoutCollector collector, vkrt::RenderPipelineOptions const& options) const override; 26 | void update_shader_descriptor_table(vkrt::BindingCollector collector, vkrt::RenderPipelineOptions const& options, VkDescriptorSet desc_set) override; 27 | 28 | void update_random_buf(); 29 | }; 30 | -------------------------------------------------------------------------------- /vulkan/pointsets/render_sobol.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "../render_pipeline_vulkan.h" 7 | 8 | struct RenderSobolVulkan : RenderPipelineExtensionVulkan { 9 | vkrt::Device device; 10 | RenderVulkan* backend; 11 | 12 | vkrt::Buffer random_numbers_buf = nullptr; 13 | 14 | RenderSobolVulkan(RenderVulkan* backend); 15 | virtual ~RenderSobolVulkan(); 16 | void internal_release_resources(); 17 | 18 | std::string name() const override; 19 | 20 | void initialize(const int fb_width, const int fb_height) override; 21 | void update_scene_from_backend(const Scene& scene) override; 22 | 23 | bool is_active_for(RenderBackendOptions const& rbo) const override; 24 | 25 | void register_descriptors(vkrt::BindingLayoutCollector collector, vkrt::RenderPipelineOptions const& options) const override; 26 | void update_shader_descriptor_table(vkrt::BindingCollector collector, vkrt::RenderPipelineOptions const& options, VkDescriptorSet desc_set) override; 27 | 28 | void update_random_buf(); 29 | }; 30 | -------------------------------------------------------------------------------- /vulkan/processing/process_example.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "../render_pipeline_vulkan.h" 7 | 8 | struct ProcessExampleVulkan : ProcessingPipelineExtensionVulkan { 9 | vkrt::Device device; 10 | RenderVulkan* backend; 11 | 12 | std::unique_ptr processing_pipeline; 13 | 14 | ProcessExampleVulkan(RenderVulkan* backend); 15 | virtual ~ProcessExampleVulkan(); 16 | void internal_release_resources(); 17 | 18 | std::string name() const override; 19 | 20 | void initialize(const int fb_width, const int fb_height) override; 21 | void update_scene_from_backend(const Scene& scene) override; 22 | 23 | void register_custom_descriptors(vkrt::BindingLayoutCollector collector, vkrt::RenderPipelineOptions const& options) const override; 24 | void update_custom_shader_descriptor_table(vkrt::BindingCollector collector, vkrt::RenderPipelineOptions const& options, VkDescriptorSet desc_set) override; 25 | 26 | void process(CommandStream* cmd_stream, int variant_idx) override; 27 | }; 28 | -------------------------------------------------------------------------------- /vulkan/processing/process_taa.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include "../render_pipeline_vulkan.h" 7 | 8 | struct ProcessTAAVulkan : ProcessingPipelineExtensionVulkan { 9 | vkrt::Device device; 10 | RenderVulkan* backend; 11 | 12 | std::unique_ptr processing_pipeline; 13 | 14 | ProcessTAAVulkan(RenderVulkan* backend); 15 | virtual ~ProcessTAAVulkan(); 16 | void internal_release_resources(); 17 | 18 | std::string name() const override; 19 | 20 | void initialize(const int fb_width, const int fb_height) override; 21 | void update_scene_from_backend(const Scene& scene) override; 22 | 23 | void register_custom_descriptors(vkrt::BindingLayoutCollector collector, vkrt::RenderPipelineOptions const& options) const override; 24 | void update_custom_shader_descriptor_table(vkrt::BindingCollector collector, vkrt::RenderPipelineOptions const& options, VkDescriptorSet desc_set) override; 25 | 26 | void process(CommandStream* cmd_stream, int variant_idx) override; 27 | }; 28 | -------------------------------------------------------------------------------- /vulkan/pt_megakernel.comp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | 7 | #ifdef USE_RT_PIPELINE 8 | #pragma shader_stage(raygen) 9 | #endif 10 | 11 | #include "pt_megakernel.glsl" 12 | -------------------------------------------------------------------------------- /vulkan/pt_megakernel.rgen: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #version 460 5 | #extension GL_GOOGLE_include_directive : require 6 | 7 | #extension GL_EXT_ray_tracing : require 8 | 9 | #include "pt_megakernel.glsl" 10 | -------------------------------------------------------------------------------- /vulkan/render_vulkan_spirv.h.in: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | #define SPIRV_EMBEDDED_PROGRAMS @SPIRV_EMBEDDED_PROGRAMS@ // comma-separated list of embedded-object variable identifiers 6 | #define SPIRV_EMBEDDED_PROGRAMS_PTR @SPIRV_EMBEDDED_PROGRAMS_PTR@ // comma-separated list of pointers to embedded-object variable identifiers 7 | #define SPIRV_EMBEDDED_COMPUTE @SPIRV_EMBEDDED_COMPUTE@ 8 | #define SPIRV_EMBEDDED_COMPUTE_PTR @SPIRV_EMBEDDED_COMPUTE_PTR@ 9 | #define SPIRV_EMBEDDED_COMPUTE_COUNT @SPIRV_EMBEDDED_COMPUTE_COUNT@ 10 | #define SPIRV_EMBEDDED_RAYTRACING @SPIRV_EMBEDDED_RAYTRACING@ 11 | #define SPIRV_EMBEDDED_RAYTRACING_PTR @SPIRV_EMBEDDED_RAYTRACING_PTR@ 12 | #define SPIRV_EMBEDDED_RASTERIZATION @SPIRV_EMBEDDED_RASTERIZATION@ 13 | #define SPIRV_EMBEDDED_RASTERIZATION_PTR @SPIRV_EMBEDDED_RASTERIZATION_PTR@ 14 | #define SPIRV_EMBEDDED_RASTERIZATION_COUNT @SPIRV_EMBEDDED_RASTERIZATION_COUNT@ 15 | 16 | #define SPIRV_EMBEDDED_INTEGRATORS @SPIRV_EMBEDDED_INTEGRATORS@ // comma-separated list of initializer lists of pointers to embedded-object variable identifiers 17 | #define SPIRV_EMBEDDED_INTEGRATOR_NAMES @SPIRV_EMBEDDED_INTEGRATOR_NAMES@ // comma-separated list of integrator names 18 | #define SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACERS @SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACERS@ // comma-separated list of initializer lists of pointers to embedded-object variable identifiers 19 | #define SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACER_NAMES @SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACER_NAMES@ // comma-separated list of comp. raytracer names 20 | #define SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACER_COUNT @SPIRV_EMBEDDED_COMPUTATIONAL_RAYTRACER_COUNT@ 21 | -------------------------------------------------------------------------------- /vulkan/resource_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | // External includes 7 | #include 8 | #include 9 | 10 | // Internal includes 11 | #include "vulkan_utils.h" 12 | #include "../librender/material.h" 13 | #include "image.h" 14 | 15 | void create_vulkan_textures_from_images(vkrt::CommandStream *async_commands, 16 | const std::vector &imageArray, 17 | std::vector& textureArray, 18 | vkrt::MemorySource& static_memory_arena, 19 | vkrt::MemorySource& scratch_memory_arena); 20 | -------------------------------------------------------------------------------- /vulkan/setup_iterative_pt.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef SETUP_ITERATIVE_PATHTRACER_GLSL 5 | #define SETUP_ITERATIVE_PATHTRACER_GLSL 6 | 7 | #include "language.glsl" 8 | 9 | #extension GL_EXT_ray_tracing : require 10 | #extension GL_EXT_shader_atomic_float : require 11 | 12 | #define PRIMARY_RAY 0 13 | #define OCCLUSION_RAY 1 14 | 15 | struct RayPayload { 16 | vec3 normal; 17 | float dist; 18 | vec3 geo_normal; 19 | uint material_id; 20 | vec3 tangent; 21 | float bitangent_l; 22 | vec2 uv; 23 | #if NEED_MESH_ID_FOR_VISUALIZATION 24 | uint parameterized_mesh_id; 25 | #endif 26 | #if RBO_lod_visualize == LOD_VISUALIZE_TS_INVOCATIONS 27 | uint ts_invocation_counter; 28 | #endif 29 | #if (RBO_debug_mode == DEBUG_MODE_ANY_HIT_COUNT_FULL_PATH || RBO_debug_mode == DEBUG_MODE_ANY_HIT_COUNT_PRIMARY_VISIBILITY) 30 | float any_hit_count; 31 | #endif 32 | }; 33 | 34 | #include "setup_pixel_assignment.glsl" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /vulkan/setup_pixel_assignment.glsl: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #ifndef SETUP_PIXEL_ASSIGNMENT 5 | #define SETUP_PIXEL_ASSIGNMENT 6 | 7 | #ifndef WORKGROUP_SIZE_X 8 | 9 | #define gl_GlobalInvocationID gl_LaunchIDEXT 10 | // note: these are not actually consecutive for consecutive subgroup invocations, 11 | // this could be enforced with the subgroup extension if needed 12 | #define gl_GlobalInvocationIndex (gl_LaunchSizeEXT.x * gl_LaunchIDEXT.x + gl_LaunchIDEXT.x) 13 | 14 | #define gl_GlobalInvocationLayer gl_LaunchIDEXT.z 15 | 16 | #else 17 | 18 | #define gl_GlobalInvocationID uvec3( (gl_GlobalInvocationID.xy & uvec2(~0x18u, ~0x3)) \ 19 | + uvec2((gl_GlobalInvocationID.y & 0x3) << 3, (gl_GlobalInvocationID.x & 0x18u) >> 3) \ 20 | , gl_GlobalInvocationID.z) 21 | #define gl_GlobalInvocationIndex (gl_LocalInvocationIndex + \ 22 | + (gl_WorkGroupID.x + gl_WorkGroupID.y * gl_NumWorkGroups.x) * gl_WorkGroupSize.x * gl_WorkGroupSize.y) 23 | 24 | #define gl_GlobalInvocationLayer gl_GlobalInvocationID.z 25 | 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /vulkan/vkdisplay.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Intel Corporation. 2 | // SPDX-License-Identifier: MIT 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "display/display.h" 11 | #include "vulkan_utils.h" 12 | #include 13 | 14 | struct GLFWwindow; 15 | 16 | struct VKDisplay : Display { 17 | vkrt::Device device; 18 | VkSurfaceKHR surface = VK_NULL_HANDLE; 19 | VkSwapchainKHR swap_chain = VK_NULL_HANDLE; 20 | 21 | int preferred_swap_image_count = Display::MAX_SWAP_IMAGES; 22 | // some platforms have up to 5 for some reason when asking for 3 23 | static const int MAX_SWAP_IMAGES = Display::MAX_SWAP_IMAGES+2; 24 | int swap_image_count = 0; 25 | VkImage swap_chain_images[MAX_SWAP_IMAGES] = { VK_NULL_HANDLE }; 26 | VkImageView swap_chain_image_views[MAX_SWAP_IMAGES] = { VK_NULL_HANDLE }; 27 | VkFramebuffer framebuffers[MAX_SWAP_IMAGES] = { VK_NULL_HANDLE }; 28 | 29 | vkrt::ParallelCommandStream command_stream; 30 | 31 | VkSemaphore img_avail_semaphores[MAX_SWAP_IMAGES] = { VK_NULL_HANDLE }; 32 | VkSemaphore present_ready_semaphores[MAX_SWAP_IMAGES] = { VK_NULL_HANDLE }; 33 | 34 | vkrt::Buffer upload_buffer = nullptr; 35 | vkrt::Texture2D upload_texture = nullptr; 36 | 37 | VkRenderPass imgui_render_pass = VK_NULL_HANDLE; 38 | VkDescriptorPool imgui_desc_pool = VK_NULL_HANDLE; 39 | 40 | VKDisplay(GLFWwindow *window, const char *device_override = nullptr); 41 | ~VKDisplay(); 42 | 43 | std::string name() const override; 44 | std::string gpu_brand() const override; 45 | 46 | void resize(const int fb_width, const int fb_height) override; 47 | 48 | void init_ui_frame() override; 49 | void new_frame() override; 50 | 51 | void display(const std::vector &img) override; 52 | void display_native(vkrt::Texture2D &img); 53 | void display(RenderGraphic *renderer) override; 54 | 55 | CommandStream* stream() override { return &command_stream; } 56 | }; 57 | --------------------------------------------------------------------------------