@babylonjs/react-native 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/react-native-babylon.podspec +2 -0
- package/shared/BabylonNative/CMakeLists.txt +2 -0
- package/shared/BabylonNative/Repo/CMakeLists.txt +16 -12
- package/shared/BabylonNative/Repo/Core/Graphics/CMakeLists.txt +41 -21
- package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/iOS/Babylon/Graphics/Platform.h +2 -2
- package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/macOS/Babylon/Graphics/Platform.h +2 -2
- package/shared/BabylonNative/Repo/Core/Graphics/Include/Platform/visionOS/Babylon/Graphics/Platform.h +2 -2
- package/shared/BabylonNative/Repo/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h +6 -6
- package/shared/BabylonNative/Repo/Core/Graphics/InternalInclude/Babylon/Graphics/BgfxCallback.h +1 -1
- package/shared/BabylonNative/Repo/Core/Graphics/Source/BgfxCallback.cpp +32 -9
- package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl.cpp +7 -5
- package/shared/BabylonNative/Repo/Core/Graphics/Source/{DeviceImpl_Metal.cpp → DeviceImpl_Metal.mm} +4 -3
- package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_iOS.mm +5 -3
- package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_macOS.mm +10 -1
- package/shared/BabylonNative/Repo/Core/Graphics/Source/DeviceImpl_visionOS.mm +2 -4
- package/shared/BabylonNative/Repo/Dependencies/CMakeLists.txt +77 -12
- package/shared/BabylonNative/Repo/Dependencies/xr/CMakeLists.txt +1 -3
- package/shared/BabylonNative/Repo/Plugins/ExternalTexture/CMakeLists.txt +1 -6
- package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/ExternalTexture_D3D11.cpp +4 -0
- package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/ExternalTexture_D3D12.cpp +4 -0
- package/shared/BabylonNative/Repo/Plugins/ExternalTexture/Source/{ExternalTexture_Metal.mm → ExternalTexture_Metal.cpp} +128 -120
- package/shared/BabylonNative/Repo/Plugins/NativeCamera/CMakeLists.txt +2 -2
- package/shared/BabylonNative/Repo/Plugins/NativeCamera/Source/Apple/CameraDevice.mm +5 -5
- package/shared/BabylonNative/Repo/Plugins/NativeEngine/CMakeLists.txt +2 -1
- package/shared/BabylonNative/Repo/Plugins/NativeEngine/Source/NativeEngine.cpp +2 -1
- package/shared/BabylonNative/Repo/Plugins/NativeEngine/Source/ShaderProvider.cpp +6 -6
- package/shared/BabylonNative/Repo/Plugins/NativeOptimizations/CMakeLists.txt +1 -2
- package/shared/BabylonNative/Repo/Plugins/NativeTracing/CMakeLists.txt +1 -2
- package/shared/BabylonNative/Repo/Plugins/NativeXr/Source/NativeXrImpl.cpp +1 -0
- package/shared/BabylonNative/Repo/Plugins/ShaderCache/CMakeLists.txt +0 -2
- package/shared/BabylonNative/Repo/Plugins/ShaderCache/Include/Babylon/Plugins/ShaderCache.h +2 -2
- package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCache.cpp +2 -2
- package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCacheImpl.cpp +4 -4
- package/shared/BabylonNative/Repo/Plugins/ShaderCache/Source/ShaderCacheImpl.h +2 -2
- package/shared/BabylonNative/Repo/Plugins/ShaderCompiler/Source/ShaderCompilerCommon.cpp +2 -0
- package/shared/BabylonNative/Repo/Plugins/ShaderCompiler/Source/ShaderCompilerTraversers.cpp +4 -0
- package/shared/BabylonNative/Repo/Plugins/TestUtils/CMakeLists.txt +6 -8
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Include/Babylon/Plugins/TestUtils.h +0 -1
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils.cpp +20 -6
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils.h +13 -13
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Android/TestUtilsImpl.cpp → TestUtils_Android.cpp} +1 -10
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Unix/TestUtilsImpl.cpp → TestUtils_Unix.cpp} +10 -20
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{Win32/TestUtilsImpl.cpp → TestUtils_Win32.cpp} +10 -20
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/{WinRT/TestUtilsImpl.cpp → TestUtils_WinRT.cpp} +9 -13
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils_iOS.mm +25 -0
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtils_macOS.mm +50 -0
- package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_boxblur.h +1 -1
- package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_gaussblur.h +1 -1
- package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/fs_nanovg_fill.h +1 -1
- package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/vs_fspass.h +1 -1
- package/shared/BabylonNative/Repo/Polyfills/Canvas/Source/Shaders/dx11/vs_nanovg_fill.h +1 -1
- package/shared/BabylonNative/Repo/Polyfills/Canvas/shaderc.cmake +2 -2
- package/shared/BabylonNative/Repo/azure-pipelines.yml +36 -24
- package/shared/BabylonNative/deps/arcana.cpp-src/CMakeLists.txt +17 -1
- package/shared/BabylonNative/deps/arcana.cpp-src/README.md +1 -1
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/arcana/string.h +0 -12
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/arcana/threading/cancellation.h +25 -12
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows.Test/Threading/CancellationMemoryLeakTest.cpp +37 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/CMakeLists.txt +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/README.md +5 -5
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/LICENSE +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/README.md +31 -14
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/args.h +5 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/aviwriter.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bgfx_utils.cpp +4 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bgfx_utils.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/common.h +43 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/common.sh +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/debugdraw.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/debugdraw.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill.bin.h +180 -29
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.bin.h +305 -92
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_lit.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.bin.h +328 -26
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_fill_texture.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines.bin.h +227 -13
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.bin.h +290 -38
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/fs_debugdraw_lines_stipple.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill.bin.h +319 -95
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill.sc +2 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.bin.h +410 -133
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit.sc +2 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.bin.h +378 -120
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_lit_mesh.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.bin.h +290 -85
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_mesh.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.bin.h +259 -18
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_fill_texture.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines.bin.h +228 -14
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.bin.h +255 -16
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/debugdraw/vs_debugdraw_lines_stipple.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/cmd.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/cmd.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dbg.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dialog.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/dialog.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_android.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_glfw.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_html5.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_ios.mm +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_noop.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_osx.mm +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_p.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_sdl.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_windows.cpp +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/entry_x11.cpp +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/input.cpp +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/entry/input.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/example-glue.cpp +21 -9
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_basic.bin.h +391 -75
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field.bin.h +382 -119
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_drop_shadow.bin.h +587 -227
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_drop_shadow_image.bin.h +655 -265
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline.bin.h +452 -164
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline_drop_shadow_image.bin.h +719 -307
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_outline_image.bin.h +535 -208
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/fs_font_distance_field_subpixel.bin.h +495 -125
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_basic.bin.h +254 -16
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field.bin.h +254 -16
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_drop_shadow.bin.h +340 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_drop_shadow_image.bin.h +340 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline.bin.h +310 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline_drop_shadow_image.bin.h +340 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_outline_image.bin.h +310 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/font/vs_font_distance_field_subpixel.bin.h +254 -16
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image.bin.h +277 -59
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_ocornut_imgui.bin.h +324 -25
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/imgui.cpp +9 -9
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/imgui.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_image.bin.h +219 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_ocornut_imgui.bin.h +239 -7
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/fs_nanovg_fill.bin.h +925 -472
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/nanovg_bgfx.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/nanovg_bgfx.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/nanovg/vs_nanovg_fill.bin.h +223 -7
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/packrect.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/fs_particle.bin.h +382 -70
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/fs_particle.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/particle_system.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/particle_system.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/vs_particle.bin.h +263 -18
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/ps/vs_particle.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/shaderlib.sh +10 -7
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/bgfx.h +149 -7
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/c99/bgfx.h +225 -101
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/defines.h +30 -21
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/embedded_shader.h +110 -60
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/include/bgfx/platform.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/makefile +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bgfx.idl +189 -70
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bgfx.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-bf.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-c3.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-cs.lua +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/bindings-zig.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/example-common.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/genie.lua +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/geometryc.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/geometryv.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shader-embeded.mk +18 -4
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shader.mk +21 -6
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/shaderc.lua +139 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.h +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.hpp +2 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.bgfx.idl.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/temp.defines.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/texturec.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/texturev.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/scripts/tools.mk +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/amalgamated.cpp +2 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/amalgamated.mm +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx.cpp +406 -164
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx.idl.inl +37 -9
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_compute.sh +40 -43
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_p.h +795 -170
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/bgfx_shader.sh +205 -73
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/charset.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/config.h +18 -4
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/debug_renderdoc.cpp +8 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/debug_renderdoc.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/dxgi.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/dxgi.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/emscripten.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear0.bin.h +190 -36
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear0.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear1.bin.h +223 -46
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear1.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear2.bin.h +253 -55
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear2.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear3.bin.h +283 -65
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear3.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear4.bin.h +314 -75
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear4.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear5.bin.h +343 -85
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear5.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear6.bin.h +373 -94
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear6.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear7.bin.h +404 -105
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_clear7.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_debugfont.bin.h +401 -67
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/fs_debugfont.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_egl.cpp +114 -36
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_egl.h +5 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_html5.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_html5.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_wgl.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glcontext_wgl.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/glimports.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/makefile +17 -13
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/nvapi.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/nvapi.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer.h +50 -29
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_agc.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d.h +7 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d11.cpp +291 -180
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d11.h +5 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d12.cpp +635 -218
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_d3d12.h +78 -10
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gl.cpp +65 -45
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gl.h +24 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_gnm.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_mtl.h +50 -24
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_mtl.mm +158 -56
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_noop.cpp +8 -12
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_nvn.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_vk.cpp +810 -445
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_vk.h +194 -133
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_webgpu.cpp +6239 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/renderer_webgpu.h +897 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_dxbc.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_dxbc.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_spirv.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/shader_spirv.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/topology.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/topology.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/version.h +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vertexlayout.cpp +2 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vertexlayout.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_clear.bin.h +186 -24
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_clear.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_debugfont.bin.h +314 -44
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/src/vs_debugfont.sc +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/bc7/avpcl_mode4.cpp +2 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/nvcore/debug.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/3rdparty/nvtt/nvtt.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/LICENSE +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/README.md +2 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/bimg.h +5 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/decode.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/include/bimg/encode.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/makefile +183 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg_decode.lua +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/bimg_encode.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/genie.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/scripts/texturec.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/bimg_p.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/config.h +52 -40
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image.cpp +136 -120
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_cubemap_filter.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_decode.cpp +17 -5
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_encode.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/src/image_gnf.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bimg/tools/texturec/texturec.cpp +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/LICENSE +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/README.md +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/allocator.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/bounds.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/bx.h +43 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/commandline.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/config.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/constants.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/cpu.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/debug.h +15 -5
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/easing.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/endian.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/error.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/file.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/filepath.h +5 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/float4x4_t.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/handlealloc.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/hash.h +31 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/allocator.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/bounds.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/bx.inl +141 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/cpu.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/easing.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/endian.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/error.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/float4x4_t.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/handlealloc.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/hash.inl +28 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/math.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/mpscqueue.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/mutex.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/os.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/pixelformat.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/readerwriter.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/ringbuffer.inl +76 -8
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/rng.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_langext.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_neon.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_ref.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd128_sse.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd256_avx.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd256_ref.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/simd_ni.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/sort.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/spscqueue.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/string.inl +237 -48
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/timer.inl +67 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/typetraits.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/inline/uint32_t.inl +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/macros.h +6 -6
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/math.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/mpscqueue.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/mutex.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/os.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/pixelformat.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/platform.h +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/process.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/readerwriter.h +9 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/ringbuffer.h +145 -14
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/rng.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/semaphore.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/settings.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/simd_t.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/sort.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/spscqueue.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/string.h +111 -42
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/thread.h +5 -5
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/timer.h +59 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/typetraits.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/uint32_t.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/include/bx/url.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/bin2c.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/bx.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/genie.lua +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/scripts/toolchain.lua +36 -18
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/allocator.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/amalgamated.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/bounds.cpp +10 -10
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/bx.cpp +3 -3
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/commandline.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/crtnone.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/debug.cpp +866 -64
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/dtoa.cpp +3 -9
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/easing.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/file.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/filepath.cpp +7 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/hash.cpp +195 -37
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/math.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/mutex.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/os.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/process.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/semaphore.cpp +27 -6
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/settings.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/sort.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/string.cpp +206 -49
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/thread.cpp +35 -38
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/timer.cpp +5 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/src/url.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/allocator_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/atomic_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/cast_test.cpp +99 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/crt_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/dbg.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/easing_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/filepath_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/handle_bench.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/handle_test.cpp +6 -6
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/hash_test.cpp +37 -8
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/macros_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/main_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/math_bench.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/math_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/os_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/pixelformat_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/queue_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/readerwriter_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/ringbuffer_test.cpp +112 -7
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/rng_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/run_test.cpp +6 -4
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/settings_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/simd_bench.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/simd_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/sort_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/string_test.cpp +92 -39
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/test.h +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/thread_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/tokenizecmd_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/typetraits_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/uint32_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/url_test.cpp +1 -1
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tests/vsnprintf_test.cpp +365 -77
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/darwin/genie +0 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/linux/genie +0 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin/windows/genie.exe +0 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/bx/tools/bin2c/bin2c.cpp +2 -2
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/glslang.cmake +6 -5
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/spirv-opt.cmake +5 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/3rdparty/tint.cmake +98 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/CMakeLists.txt +1 -0
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/bgfx.cmake +11 -9
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/examples.cmake +16 -4
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bgfx/shaderc.cmake +21 -10
- package/shared/BabylonNative/deps/bgfx.cmake-src/cmake/bx/bx.cmake +5 -0
- package/shared/BabylonNative/deps/cmakeextensions-src/CMakeLists.txt +31 -5
- package/shared/BabylonNative/deps/cmakeextensions-src/README.md +6 -1
- package/shared/BabylonNative/deps/jsruntimehost-src/CMakeLists.txt +6 -5
- package/shared/BabylonNative/deps/jsruntimehost-src/Core/Node-API/Source/js_native_api_javascriptcore.cc +58 -4
- package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/CMakeLists.txt +4 -0
- package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/CMakeLists.txt +15 -0
- package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/Include/Babylon/Polyfills/TextDecoder.h +9 -0
- package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/README.md +39 -0
- package/shared/BabylonNative/deps/jsruntimehost-src/Polyfills/TextDecoder/Source/TextDecoder.cpp +91 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/Foundation.hpp +47 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSArray.hpp +124 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSAutoreleasePool.hpp +83 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSBundle.hpp +374 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSData.hpp +54 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDate.hpp +53 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDefines.hpp +45 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSDictionary.hpp +128 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSEnumerator.hpp +78 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSError.hpp +173 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSLock.hpp +118 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSNotification.hpp +110 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSNumber.hpp +501 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSObjCRuntime.hpp +43 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSObject.hpp +302 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSPrivate.hpp +531 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSProcessInfo.hpp +386 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSRange.hpp +83 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSSet.hpp +87 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSSharedPtr.hpp +310 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSString.hpp +255 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSTypes.hpp +51 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Foundation/NSURL.hpp +90 -0
- package/shared/BabylonNative/deps/metal-cpp-src/LICENSE.txt +202 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4AccelerationStructure.hpp +1395 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Archive.hpp +93 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ArgumentTable.hpp +187 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4BinaryFunction.hpp +50 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4BinaryFunctionDescriptor.hpp +97 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandAllocator.hpp +100 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandBuffer.hpp +193 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandEncoder.hpp +134 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommandQueue.hpp +283 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CommitFeedback.hpp +62 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Compiler.hpp +345 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4CompilerTask.hpp +63 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ComputeCommandEncoder.hpp +300 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4ComputePipeline.hpp +158 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4Counters.hpp +138 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4FunctionDescriptor.hpp +49 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LibraryDescriptor.hpp +98 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LibraryFunctionDescriptor.hpp +86 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4LinkingDescriptor.hpp +204 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MachineLearningCommandEncoder.hpp +66 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MachineLearningPipeline.hpp +172 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4MeshRenderPipeline.hpp +413 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4PipelineDataSetSerializer.hpp +85 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4PipelineState.hpp +150 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderCommandEncoder.hpp +340 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderPass.hpp +280 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4RenderPipeline.hpp +587 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4SpecializedFunctionDescriptor.hpp +100 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4StitchedFunctionDescriptor.hpp +86 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTL4TileRenderPipeline.hpp +173 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructure.hpp +1887 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructureCommandEncoder.hpp +260 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAccelerationStructureTypes.hpp +292 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLAllocation.hpp +40 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLArgument.hpp +787 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLArgumentEncoder.hpp +235 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBinaryArchive.hpp +152 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBlitCommandEncoder.hpp +226 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBlitPass.hpp +154 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLBuffer.hpp +119 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCaptureManager.hpp +217 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCaptureScope.hpp +91 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandBuffer.hpp +464 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandEncoder.hpp +117 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCommandQueue.hpp +158 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputeCommandEncoder.hpp +324 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputePass.hpp +169 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLComputePipeline.hpp +439 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLCounters.hpp +243 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDataType.hpp +129 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDefines.hpp +41 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDepthStencil.hpp +277 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDevice.hpp +1493 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDrawable.hpp +90 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLDynamicLibrary.hpp +78 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLEvent.hpp +170 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFence.hpp +55 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionConstantValues.hpp +76 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionDescriptor.hpp +153 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionHandle.hpp +65 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionLog.hpp +101 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLFunctionStitching.hpp +319 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLGPUAddress.hpp +36 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLHeaderBridge.hpp +3120 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLHeap.hpp +318 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCommandBuffer.hpp +182 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCommandQueue.hpp +211 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIOCompressor.hpp +94 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIndirectCommandBuffer.hpp +376 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIndirectCommandEncoder.hpp +272 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLIntersectionFunctionTable.hpp +173 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLibrary.hpp +786 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLinkedFunctions.hpp +110 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLLogState.hpp +111 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLParallelRenderCommandEncoder.hpp +83 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPipeline.hpp +104 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPixelFormat.hpp +173 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLPrivate.hpp +156 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRasterizationRate.hpp +337 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderCommandEncoder.hpp +1019 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderPass.hpp +792 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLRenderPipeline.hpp +1876 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResidencySet.hpp +178 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResource.hpp +190 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceStateCommandEncoder.hpp +98 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceStatePass.hpp +154 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLResourceViewPool.hpp +118 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLSampler.hpp +345 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLStageInputOutputDescriptor.hpp +356 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTensor.hpp +297 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTexture.hpp +803 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTextureViewPool.hpp +59 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLTypes.hpp +164 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVersion.hpp +32 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVertexDescriptor.hpp +326 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/MTLVisibleFunctionTable.hpp +96 -0
- package/shared/BabylonNative/deps/metal-cpp-src/Metal/Metal.hpp +120 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXFrameInterpolator.hpp +47 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXSpatialScaler.hpp +49 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXTemporalDenoisedScaler.hpp +49 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTL4FXTemporalScaler.hpp +49 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXDefines.hpp +41 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXFrameInterpolator.hpp +719 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXPrivate.hpp +482 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXSpatialScaler.hpp +397 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXTemporalDenoisedScaler.hpp +1208 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MTLFXTemporalScaler.hpp +803 -0
- package/shared/BabylonNative/deps/metal-cpp-src/MetalFX/MetalFX.hpp +35 -0
- package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CADefines.hpp +41 -0
- package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAMetalDrawable.hpp +57 -0
- package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAMetalLayer.hpp +216 -0
- package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/CAPrivate.hpp +150 -0
- package/shared/BabylonNative/deps/metal-cpp-src/QuartzCore/QuartzCore.hpp +28 -0
- package/shared/BabylonNative/deps/metal-cpp-src/README.md +313 -0
- package/shared/BabylonNative/deps/metal-cpp-src/SingleHeader/MakeSingleHeader.py +271 -0
- package/shared/BabylonNative/deps/metal-cpp-src/SingleHeader/Metal.hpp +28735 -0
- package/shared/BabylonNative/deps/spirv-cross-src/spirv_hlsl.cpp +173 -222
- package/shared/BabylonNative/deps/urllib-src/CMakeLists.txt +6 -7
- package/shared/BabylonNative/deps/urllib-src/Source/UrlRequest_Unix.cpp +1 -1
- package/shared/BabylonNative.cpp +4 -0
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/Apple/TestUtilsImpl.mm +0 -57
- package/shared/BabylonNative/Repo/Plugins/TestUtils/Source/TestUtilsImplData.h +0 -18
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Android/Arcana.Android.vcxproj +0 -186
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Shared/Arcana.vcxitems +0 -47
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows/Arcana.Windows.Reference.vcxitems +0 -30
- package/shared/BabylonNative/deps/arcana.cpp-src/Source/Windows/Arcana.Windows.vcxproj +0 -218
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bounds.cpp +0 -2178
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/bounds.h +0 -448
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_color.bin.h +0 -100
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_color.sc +0 -13
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_cubemap.bin.h +0 -223
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_cubemap.sc +0 -21
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image_swizz.bin.h +0 -256
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_image_swizz.sc +0 -22
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_latlong.bin.h +0 -308
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_latlong.sc +0 -38
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_texture.bin.h +0 -180
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/fs_imgui_texture.sc +0 -16
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_color.bin.h +0 -195
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_color.sc +0 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_cubemap.bin.h +0 -203
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_cubemap.sc +0 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_latlong.bin.h +0 -205
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_latlong.sc +0 -15
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_texture.bin.h +0 -233
- package/shared/BabylonNative/deps/bgfx.cmake-src/bgfx/examples/common/imgui/vs_imgui_texture.sc +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2011-
|
|
2
|
+
* Copyright 2011-2026 Branimir Karadzic. All rights reserved.
|
|
3
3
|
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -57,6 +57,24 @@ namespace bgfx { namespace vk
|
|
|
57
57
|
{ 16, VK_SAMPLE_COUNT_16_BIT },
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
struct ShadingRateVk
|
|
61
|
+
{
|
|
62
|
+
VkExtent2D fragmentSize;
|
|
63
|
+
const VkExtent2D initFragmentSize;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
static ShadingRateVk s_shadingRate[] =
|
|
67
|
+
{
|
|
68
|
+
{ { 1, 1 }, { 1, 1 } },
|
|
69
|
+
{ { 1, 2 }, { 1, 2 } },
|
|
70
|
+
{ { 2, 1 }, { 2, 1 } },
|
|
71
|
+
{ { 2, 2 }, { 2, 2 } },
|
|
72
|
+
{ { 2, 4 }, { 2, 4 } },
|
|
73
|
+
{ { 4, 2 }, { 4, 2 } },
|
|
74
|
+
{ { 4, 4 }, { 4, 4 } },
|
|
75
|
+
};
|
|
76
|
+
static_assert(ShadingRate::Count == BX_COUNTOF(s_shadingRate) );
|
|
77
|
+
|
|
60
78
|
static const VkBlendFactor s_blendFactor[][2] =
|
|
61
79
|
{
|
|
62
80
|
{ VkBlendFactor(0), VkBlendFactor(0) }, // ignored
|
|
@@ -178,6 +196,10 @@ VK_IMPORT_DEVICE
|
|
|
178
196
|
{ VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, { $_, $_, $_, $_ } }, // ETC2
|
|
179
197
|
{ VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, { $_, $_, $_, $_ } }, // ETC2A
|
|
180
198
|
{ VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, { $_, $_, $_, $_ } }, // ETC2A1
|
|
199
|
+
{ VK_FORMAT_EAC_R11_UNORM_BLOCK, VK_FORMAT_EAC_R11_UNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // EACR11
|
|
200
|
+
{ VK_FORMAT_EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11_SNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // EACR11S
|
|
201
|
+
{ VK_FORMAT_EAC_R11G11_UNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // EACRG11
|
|
202
|
+
{ VK_FORMAT_EAC_R11G11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_SNORM_BLOCK, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // EACRG11S
|
|
181
203
|
{ VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // PTC12
|
|
182
204
|
{ VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // PTC14
|
|
183
205
|
{ VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // PTC12A
|
|
@@ -229,14 +251,14 @@ VK_IMPORT_DEVICE
|
|
|
229
251
|
{ VK_FORMAT_R32G32_UINT, VK_FORMAT_R32G32_UINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RG32U
|
|
230
252
|
{ VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RG32F
|
|
231
253
|
{ VK_FORMAT_R8G8B8_UNORM, VK_FORMAT_R8G8B8_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_R8G8B8_SRGB, { $_, $_, $_, $_ } }, // RGB8
|
|
232
|
-
{ VK_FORMAT_R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT, VK_FORMAT_UNDEFINED,
|
|
233
|
-
{ VK_FORMAT_R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT, VK_FORMAT_UNDEFINED,
|
|
254
|
+
{ VK_FORMAT_R8G8B8_SINT, VK_FORMAT_R8G8B8_SINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGB8I
|
|
255
|
+
{ VK_FORMAT_R8G8B8_UINT, VK_FORMAT_R8G8B8_UINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGB8U
|
|
234
256
|
{ VK_FORMAT_R8G8B8_SNORM, VK_FORMAT_R8G8B8_SNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGB8S
|
|
235
257
|
{ VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGB9E5F
|
|
236
258
|
{ VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_B8G8R8A8_SRGB, { $_, $_, $_, $_ } }, // BGRA8
|
|
237
259
|
{ VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_R8G8B8A8_SRGB, { $_, $_, $_, $_ } }, // RGBA8
|
|
238
|
-
{ VK_FORMAT_R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT, VK_FORMAT_UNDEFINED,
|
|
239
|
-
{ VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_UNDEFINED,
|
|
260
|
+
{ VK_FORMAT_R8G8B8A8_SINT, VK_FORMAT_R8G8B8A8_SINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGBA8I
|
|
261
|
+
{ VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_R8G8B8A8_UINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGBA8U
|
|
240
262
|
{ VK_FORMAT_R8G8B8A8_SNORM, VK_FORMAT_R8G8B8A8_SNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGBA8S
|
|
241
263
|
{ VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_R16G16B16A16_UNORM, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGBA16
|
|
242
264
|
{ VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_R16G16B16A16_SINT, VK_FORMAT_UNDEFINED, VK_FORMAT_UNDEFINED, { $_, $_, $_, $_ } }, // RGBA16I
|
|
@@ -360,6 +382,7 @@ VK_IMPORT_DEVICE
|
|
|
360
382
|
EXT_memory_budget,
|
|
361
383
|
EXT_shader_viewport_index_layer,
|
|
362
384
|
KHR_draw_indirect_count,
|
|
385
|
+
KHR_fragment_shading_rate,
|
|
363
386
|
KHR_get_physical_device_properties2,
|
|
364
387
|
|
|
365
388
|
# if BX_PLATFORM_ANDROID
|
|
@@ -399,6 +422,7 @@ VK_IMPORT_DEVICE
|
|
|
399
422
|
{ "VK_EXT_memory_budget", 1, false, false, true, Layer::Count },
|
|
400
423
|
{ "VK_EXT_shader_viewport_index_layer", 1, false, false, true, Layer::Count },
|
|
401
424
|
{ "VK_KHR_draw_indirect_count", 1, false, false, true, Layer::Count },
|
|
425
|
+
{ "VK_KHR_fragment_shading_rate", 1, false, false, true, Layer::Count },
|
|
402
426
|
{ "VK_KHR_get_physical_device_properties2", 1, false, false, true, Layer::Count },
|
|
403
427
|
# if BX_PLATFORM_ANDROID
|
|
404
428
|
{ VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, 1, false, false, true, Layer::Count },
|
|
@@ -882,8 +906,6 @@ VK_IMPORT_DEVICE
|
|
|
882
906
|
VKENUM(VK_INCOMPLETE);
|
|
883
907
|
VKENUM(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
884
908
|
VKENUM(VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
|
885
|
-
VKENUM(VK_ERROR_OUT_OF_POOL_MEMORY);
|
|
886
|
-
VKENUM(VK_ERROR_FRAGMENTED_POOL);
|
|
887
909
|
VKENUM(VK_ERROR_INITIALIZATION_FAILED);
|
|
888
910
|
VKENUM(VK_ERROR_DEVICE_LOST);
|
|
889
911
|
VKENUM(VK_ERROR_MEMORY_MAP_FAILED);
|
|
@@ -893,12 +915,20 @@ VK_IMPORT_DEVICE
|
|
|
893
915
|
VKENUM(VK_ERROR_INCOMPATIBLE_DRIVER);
|
|
894
916
|
VKENUM(VK_ERROR_TOO_MANY_OBJECTS);
|
|
895
917
|
VKENUM(VK_ERROR_FORMAT_NOT_SUPPORTED);
|
|
918
|
+
VKENUM(VK_ERROR_FRAGMENTED_POOL);
|
|
919
|
+
VKENUM(VK_ERROR_UNKNOWN);
|
|
920
|
+
VKENUM(VK_ERROR_VALIDATION_FAILED);
|
|
921
|
+
VKENUM(VK_ERROR_OUT_OF_POOL_MEMORY);
|
|
922
|
+
VKENUM(VK_ERROR_INVALID_EXTERNAL_HANDLE);
|
|
923
|
+
VKENUM(VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS);
|
|
924
|
+
VKENUM(VK_ERROR_FRAGMENTATION);
|
|
925
|
+
VKENUM(VK_PIPELINE_COMPILE_REQUIRED);
|
|
926
|
+
VKENUM(VK_ERROR_NOT_PERMITTED);
|
|
896
927
|
VKENUM(VK_ERROR_SURFACE_LOST_KHR);
|
|
897
928
|
VKENUM(VK_ERROR_NATIVE_WINDOW_IN_USE_KHR);
|
|
898
929
|
VKENUM(VK_SUBOPTIMAL_KHR);
|
|
899
930
|
VKENUM(VK_ERROR_OUT_OF_DATE_KHR);
|
|
900
931
|
VKENUM(VK_ERROR_INCOMPATIBLE_DISPLAY_KHR);
|
|
901
|
-
VKENUM(VK_ERROR_VALIDATION_FAILED_EXT);
|
|
902
932
|
#undef VKENUM
|
|
903
933
|
default: break;
|
|
904
934
|
}
|
|
@@ -910,26 +940,26 @@ VK_IMPORT_DEVICE
|
|
|
910
940
|
template<typename Ty>
|
|
911
941
|
constexpr VkObjectType getType();
|
|
912
942
|
|
|
913
|
-
template<> VkObjectType getType<VkBuffer >() { return VK_OBJECT_TYPE_BUFFER; }
|
|
914
|
-
template<> VkObjectType getType<VkCommandPool >() { return VK_OBJECT_TYPE_COMMAND_POOL; }
|
|
915
|
-
template<> VkObjectType getType<VkDescriptorPool >() { return VK_OBJECT_TYPE_DESCRIPTOR_POOL; }
|
|
916
|
-
template<> VkObjectType getType<VkDescriptorSet >() { return VK_OBJECT_TYPE_DESCRIPTOR_SET; }
|
|
917
|
-
template<> VkObjectType getType<VkDescriptorSetLayout>() { return VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; }
|
|
918
|
-
template<> VkObjectType getType<VkDeviceMemory >() { return VK_OBJECT_TYPE_DEVICE_MEMORY; }
|
|
919
|
-
template<> VkObjectType getType<VkFence >() { return VK_OBJECT_TYPE_FENCE; }
|
|
920
|
-
template<> VkObjectType getType<VkFramebuffer >() { return VK_OBJECT_TYPE_FRAMEBUFFER; }
|
|
921
|
-
template<> VkObjectType getType<VkImage >() { return VK_OBJECT_TYPE_IMAGE; }
|
|
922
|
-
template<> VkObjectType getType<VkImageView >() { return VK_OBJECT_TYPE_IMAGE_VIEW; }
|
|
923
|
-
template<> VkObjectType getType<VkPipeline >() { return VK_OBJECT_TYPE_PIPELINE; }
|
|
924
|
-
template<> VkObjectType getType<VkPipelineCache >() { return VK_OBJECT_TYPE_PIPELINE_CACHE; }
|
|
925
|
-
template<> VkObjectType getType<VkPipelineLayout >() { return VK_OBJECT_TYPE_PIPELINE_LAYOUT; }
|
|
926
|
-
template<> VkObjectType getType<VkQueryPool >() { return VK_OBJECT_TYPE_QUERY_POOL; }
|
|
927
|
-
template<> VkObjectType getType<VkRenderPass >() { return VK_OBJECT_TYPE_RENDER_PASS; }
|
|
928
|
-
template<> VkObjectType getType<VkSampler >() { return VK_OBJECT_TYPE_SAMPLER; }
|
|
929
|
-
template<> VkObjectType getType<VkSemaphore >() { return VK_OBJECT_TYPE_SEMAPHORE; }
|
|
930
|
-
template<> VkObjectType getType<VkShaderModule >() { return VK_OBJECT_TYPE_SHADER_MODULE; }
|
|
931
|
-
template<> VkObjectType getType<VkSurfaceKHR >() { return VK_OBJECT_TYPE_SURFACE_KHR; }
|
|
932
|
-
template<> VkObjectType getType<VkSwapchainKHR >() { return VK_OBJECT_TYPE_SWAPCHAIN_KHR; }
|
|
943
|
+
template<> constexpr VkObjectType getType<VkBuffer >() { return VK_OBJECT_TYPE_BUFFER; }
|
|
944
|
+
template<> constexpr VkObjectType getType<VkCommandPool >() { return VK_OBJECT_TYPE_COMMAND_POOL; }
|
|
945
|
+
template<> constexpr VkObjectType getType<VkDescriptorPool >() { return VK_OBJECT_TYPE_DESCRIPTOR_POOL; }
|
|
946
|
+
template<> constexpr VkObjectType getType<VkDescriptorSet >() { return VK_OBJECT_TYPE_DESCRIPTOR_SET; }
|
|
947
|
+
template<> constexpr VkObjectType getType<VkDescriptorSetLayout>() { return VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT; }
|
|
948
|
+
template<> constexpr VkObjectType getType<VkDeviceMemory >() { return VK_OBJECT_TYPE_DEVICE_MEMORY; }
|
|
949
|
+
template<> constexpr VkObjectType getType<VkFence >() { return VK_OBJECT_TYPE_FENCE; }
|
|
950
|
+
template<> constexpr VkObjectType getType<VkFramebuffer >() { return VK_OBJECT_TYPE_FRAMEBUFFER; }
|
|
951
|
+
template<> constexpr VkObjectType getType<VkImage >() { return VK_OBJECT_TYPE_IMAGE; }
|
|
952
|
+
template<> constexpr VkObjectType getType<VkImageView >() { return VK_OBJECT_TYPE_IMAGE_VIEW; }
|
|
953
|
+
template<> constexpr VkObjectType getType<VkPipeline >() { return VK_OBJECT_TYPE_PIPELINE; }
|
|
954
|
+
template<> constexpr VkObjectType getType<VkPipelineCache >() { return VK_OBJECT_TYPE_PIPELINE_CACHE; }
|
|
955
|
+
template<> constexpr VkObjectType getType<VkPipelineLayout >() { return VK_OBJECT_TYPE_PIPELINE_LAYOUT; }
|
|
956
|
+
template<> constexpr VkObjectType getType<VkQueryPool >() { return VK_OBJECT_TYPE_QUERY_POOL; }
|
|
957
|
+
template<> constexpr VkObjectType getType<VkRenderPass >() { return VK_OBJECT_TYPE_RENDER_PASS; }
|
|
958
|
+
template<> constexpr VkObjectType getType<VkSampler >() { return VK_OBJECT_TYPE_SAMPLER; }
|
|
959
|
+
template<> constexpr VkObjectType getType<VkSemaphore >() { return VK_OBJECT_TYPE_SEMAPHORE; }
|
|
960
|
+
template<> constexpr VkObjectType getType<VkShaderModule >() { return VK_OBJECT_TYPE_SHADER_MODULE; }
|
|
961
|
+
template<> constexpr VkObjectType getType<VkSurfaceKHR >() { return VK_OBJECT_TYPE_SURFACE_KHR; }
|
|
962
|
+
template<> constexpr VkObjectType getType<VkSwapchainKHR >() { return VK_OBJECT_TYPE_SWAPCHAIN_KHR; }
|
|
933
963
|
|
|
934
964
|
template<typename Ty>
|
|
935
965
|
static BX_NO_INLINE void setDebugObjectName(VkDevice _device, Ty _object, const char* _format, ...)
|
|
@@ -951,7 +981,7 @@ VK_IMPORT_DEVICE
|
|
|
951
981
|
ni.objectHandle = uint64_t(_object.vk);
|
|
952
982
|
ni.pObjectName = temp;
|
|
953
983
|
|
|
954
|
-
|
|
984
|
+
VK_CHECK_W(vkSetDebugUtilsObjectNameEXT(_device, &ni) );
|
|
955
985
|
}
|
|
956
986
|
}
|
|
957
987
|
|
|
@@ -993,11 +1023,11 @@ VK_IMPORT_DEVICE
|
|
|
993
1023
|
, uint32_t _layerCount = VK_REMAINING_ARRAY_LAYERS
|
|
994
1024
|
)
|
|
995
1025
|
{
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1026
|
+
if (_newLayout == VK_IMAGE_LAYOUT_UNDEFINED
|
|
1027
|
+
|| _newLayout == VK_IMAGE_LAYOUT_PREINITIALIZED)
|
|
1028
|
+
{
|
|
1029
|
+
_newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
|
1030
|
+
}
|
|
1001
1031
|
|
|
1002
1032
|
constexpr VkPipelineStageFlags depthStageMask = 0
|
|
1003
1033
|
| VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT
|
|
@@ -1148,6 +1178,8 @@ VK_IMPORT_DEVICE
|
|
|
1148
1178
|
RendererContextVK()
|
|
1149
1179
|
: m_allocatorCb(NULL)
|
|
1150
1180
|
, m_memoryLru()
|
|
1181
|
+
, m_device(NULL)
|
|
1182
|
+
, m_externalDevice(NULL)
|
|
1151
1183
|
, m_renderDocDll(NULL)
|
|
1152
1184
|
, m_vulkan1Dll(NULL)
|
|
1153
1185
|
, m_maxAnisotropy(1.0f)
|
|
@@ -1156,6 +1188,7 @@ VK_IMPORT_DEVICE
|
|
|
1156
1188
|
, m_captureBuffer(VK_NULL_HANDLE)
|
|
1157
1189
|
, m_captureMemory()
|
|
1158
1190
|
, m_captureSize(0)
|
|
1191
|
+
, m_variableRateShadingSupported(false)
|
|
1159
1192
|
{
|
|
1160
1193
|
}
|
|
1161
1194
|
|
|
@@ -1185,11 +1218,10 @@ VK_IMPORT_DEVICE
|
|
|
1185
1218
|
const bool headless = NULL == g_platformData.nwh;
|
|
1186
1219
|
|
|
1187
1220
|
const void* nextFeatures = NULL;
|
|
1188
|
-
VkPhysicalDeviceLineRasterizationFeaturesEXT lineRasterizationFeatures;
|
|
1189
|
-
VkPhysicalDeviceCustomBorderColorFeaturesEXT customBorderColorFeatures;
|
|
1190
1221
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1222
|
+
VkPhysicalDeviceLineRasterizationFeaturesEXT lineRasterizationFeatures = {};
|
|
1223
|
+
VkPhysicalDeviceCustomBorderColorFeaturesEXT customBorderColorFeatures = {};
|
|
1224
|
+
VkPhysicalDeviceFragmentShadingRateFeaturesKHR fragmentShadingRate = {};
|
|
1193
1225
|
|
|
1194
1226
|
m_fbh = BGFX_INVALID_HANDLE;
|
|
1195
1227
|
bx::memSet(m_uniforms, 0, sizeof(m_uniforms) );
|
|
@@ -1232,13 +1264,11 @@ VK_IMPORT_DEVICE
|
|
|
1232
1264
|
|
|
1233
1265
|
BX_TRACE("Shared library functions:");
|
|
1234
1266
|
|
|
1235
|
-
#define VK_IMPORT_FUNC(_optional, _func)
|
|
1236
|
-
_func = (PFN_##_func)bx::dlsym(m_vulkan1Dll, #_func);
|
|
1237
|
-
BX_TRACE("\t%
|
|
1267
|
+
#define VK_IMPORT_FUNC(_optional, _func) \
|
|
1268
|
+
_func = (PFN_##_func)bx::dlsym(m_vulkan1Dll, #_func); \
|
|
1269
|
+
BX_TRACE("\t%16p %s" #_func, _func, _optional ? "[opt]" : " "); \
|
|
1238
1270
|
imported &= _optional || NULL != _func
|
|
1239
|
-
|
|
1240
1271
|
VK_IMPORT
|
|
1241
|
-
|
|
1242
1272
|
#undef VK_IMPORT_FUNC
|
|
1243
1273
|
|
|
1244
1274
|
if (!imported)
|
|
@@ -1255,9 +1285,10 @@ VK_IMPORT
|
|
|
1255
1285
|
|
|
1256
1286
|
s_extension[Extension::EXT_debug_report].m_initialize = _init.debug;
|
|
1257
1287
|
|
|
1258
|
-
s_extension[Extension::
|
|
1259
|
-
s_extension[Extension::
|
|
1260
|
-
s_extension[Extension::KHR_draw_indirect_count ].m_initialize = !!(_init.capabilities & BGFX_CAPS_DRAW_INDIRECT_COUNT
|
|
1288
|
+
s_extension[Extension::EXT_conservative_rasterization ].m_initialize = !!(_init.capabilities & BGFX_CAPS_CONSERVATIVE_RASTER );
|
|
1289
|
+
s_extension[Extension::EXT_shader_viewport_index_layer].m_initialize = !!(_init.capabilities & BGFX_CAPS_VIEWPORT_LAYER_ARRAY );
|
|
1290
|
+
s_extension[Extension::KHR_draw_indirect_count ].m_initialize = !!(_init.capabilities & BGFX_CAPS_DRAW_INDIRECT_COUNT );
|
|
1291
|
+
s_extension[Extension::KHR_fragment_shading_rate ].m_initialize = !!(_init.capabilities & BGFX_CAPS_VARIABLE_RATE_SHADING);
|
|
1261
1292
|
|
|
1262
1293
|
dumpExtensions(VK_NULL_HANDLE, s_extension);
|
|
1263
1294
|
|
|
@@ -1335,7 +1366,7 @@ VK_IMPORT
|
|
|
1335
1366
|
}
|
|
1336
1367
|
}
|
|
1337
1368
|
|
|
1338
|
-
vulkanApiVersionSelector = bx::max(vulkanApiVersionSelector,
|
|
1369
|
+
vulkanApiVersionSelector = bx::max(vulkanApiVersionSelector, VK_API_VERSION_1_0);
|
|
1339
1370
|
|
|
1340
1371
|
VkApplicationInfo appInfo;
|
|
1341
1372
|
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
|
@@ -1398,9 +1429,9 @@ VK_IMPORT
|
|
|
1398
1429
|
|
|
1399
1430
|
BX_TRACE("Instance functions:");
|
|
1400
1431
|
|
|
1401
|
-
#define VK_IMPORT_INSTANCE_FUNC(_optional, _func)
|
|
1402
|
-
_func = (PFN_##_func)vkGetInstanceProcAddr(m_instance, #_func);
|
|
1403
|
-
BX_TRACE("\t%
|
|
1432
|
+
#define VK_IMPORT_INSTANCE_FUNC(_optional, _func) \
|
|
1433
|
+
_func = (PFN_##_func)vkGetInstanceProcAddr(m_instance, #_func); \
|
|
1434
|
+
BX_TRACE("\t%16p %s " #_func, _func, _optional ? "[opt]" : " "); \
|
|
1404
1435
|
imported &= _optional || NULL != _func
|
|
1405
1436
|
VK_IMPORT_INSTANCE
|
|
1406
1437
|
#undef VK_IMPORT_INSTANCE_FUNC
|
|
@@ -1468,7 +1499,16 @@ VK_IMPORT_INSTANCE
|
|
|
1468
1499
|
for (uint32_t ii = 0; ii < numPhysicalDevices; ++ii)
|
|
1469
1500
|
{
|
|
1470
1501
|
VkPhysicalDeviceProperties pdp;
|
|
1471
|
-
|
|
1502
|
+
if (vkGetPhysicalDeviceProperties2KHR) {
|
|
1503
|
+
VkPhysicalDeviceProperties2KHR pdp2;
|
|
1504
|
+
pdp2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
|
1505
|
+
pdp2.pNext = NULL;
|
|
1506
|
+
vkGetPhysicalDeviceProperties2KHR(physicalDevices[ii], &pdp2);
|
|
1507
|
+
pdp = pdp2.properties;
|
|
1508
|
+
} else
|
|
1509
|
+
{
|
|
1510
|
+
vkGetPhysicalDeviceProperties(physicalDevices[ii], &pdp);
|
|
1511
|
+
}
|
|
1472
1512
|
|
|
1473
1513
|
BX_TRACE("Physical device %d:", ii);
|
|
1474
1514
|
BX_TRACE("\t Name: %s", pdp.deviceName);
|
|
@@ -1557,7 +1597,21 @@ VK_IMPORT_INSTANCE
|
|
|
1557
1597
|
|
|
1558
1598
|
bx::memCopy(&s_extension[0], &physicalDeviceExtensions[physicalDeviceIdx][0], sizeof(s_extension) );
|
|
1559
1599
|
|
|
1560
|
-
|
|
1600
|
+
m_deviceShadingRateImageProperties = {};
|
|
1601
|
+
m_deviceShadingRateImageProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR;
|
|
1602
|
+
|
|
1603
|
+
if (vkGetPhysicalDeviceProperties2KHR) {
|
|
1604
|
+
VkPhysicalDeviceProperties2KHR pdp2;
|
|
1605
|
+
pdp2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
|
|
1606
|
+
pdp2.pNext = &m_deviceShadingRateImageProperties;
|
|
1607
|
+
|
|
1608
|
+
vkGetPhysicalDeviceProperties2KHR(m_physicalDevice, &pdp2);
|
|
1609
|
+
m_deviceProperties = pdp2.properties;
|
|
1610
|
+
} else
|
|
1611
|
+
{
|
|
1612
|
+
vkGetPhysicalDeviceProperties(m_physicalDevice, &m_deviceProperties);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1561
1615
|
g_caps.vendorId = uint16_t(m_deviceProperties.vendorID);
|
|
1562
1616
|
g_caps.deviceId = uint16_t(m_deviceProperties.deviceID);
|
|
1563
1617
|
|
|
@@ -1599,6 +1653,40 @@ VK_IMPORT_INSTANCE
|
|
|
1599
1653
|
vkGetPhysicalDeviceFeatures(m_physicalDevice, &supportedFeatures);
|
|
1600
1654
|
}
|
|
1601
1655
|
|
|
1656
|
+
if (s_extension[Extension::KHR_fragment_shading_rate].m_supported)
|
|
1657
|
+
{
|
|
1658
|
+
VkPhysicalDeviceFeatures2KHR deviceFeatures2;
|
|
1659
|
+
deviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR;
|
|
1660
|
+
deviceFeatures2.pNext = NULL;
|
|
1661
|
+
|
|
1662
|
+
VkBaseOutStructure* next = (VkBaseOutStructure*)&deviceFeatures2;
|
|
1663
|
+
|
|
1664
|
+
next->pNext = (VkBaseOutStructure*)&fragmentShadingRate;
|
|
1665
|
+
fragmentShadingRate.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR;
|
|
1666
|
+
fragmentShadingRate.pNext = NULL;
|
|
1667
|
+
|
|
1668
|
+
BX_ASSERT(vkGetPhysicalDeviceFeatures2KHR,
|
|
1669
|
+
"vkGetPhysicalDeviceFeatures2KHR should not be NULL when the "
|
|
1670
|
+
"KHR_fragment_shading_rate extension is supported.");
|
|
1671
|
+
vkGetPhysicalDeviceFeatures2KHR(m_physicalDevice, &deviceFeatures2);
|
|
1672
|
+
|
|
1673
|
+
if (!fragmentShadingRate.pipelineFragmentShadingRate
|
|
1674
|
+
|| !fragmentShadingRate.primitiveFragmentShadingRate)
|
|
1675
|
+
{
|
|
1676
|
+
s_extension[Extension::KHR_fragment_shading_rate].m_supported = false;
|
|
1677
|
+
}
|
|
1678
|
+
else
|
|
1679
|
+
{
|
|
1680
|
+
fragmentShadingRate.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR;
|
|
1681
|
+
fragmentShadingRate.pNext = (VkBaseOutStructure*)nextFeatures;
|
|
1682
|
+
fragmentShadingRate.pipelineFragmentShadingRate = VK_TRUE;
|
|
1683
|
+
fragmentShadingRate.primitiveFragmentShadingRate = VK_TRUE;
|
|
1684
|
+
fragmentShadingRate.attachmentFragmentShadingRate = VK_FALSE;
|
|
1685
|
+
|
|
1686
|
+
nextFeatures = &fragmentShadingRate;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1602
1690
|
bx::memSet(&m_deviceFeatures, 0, sizeof(m_deviceFeatures) );
|
|
1603
1691
|
|
|
1604
1692
|
m_deviceFeatures.fullDrawIndexUint32 = supportedFeatures.fullDrawIndexUint32;
|
|
@@ -1654,6 +1742,7 @@ VK_IMPORT_INSTANCE
|
|
|
1654
1742
|
| BGFX_CAPS_TEXTURE_BLIT
|
|
1655
1743
|
| BGFX_CAPS_TEXTURE_COMPARE_ALL
|
|
1656
1744
|
| (m_deviceFeatures.imageCubeArray ? BGFX_CAPS_TEXTURE_CUBE_ARRAY : 0)
|
|
1745
|
+
| BGFX_CAPS_TEXTURE_EXTERNAL
|
|
1657
1746
|
| BGFX_CAPS_TEXTURE_READ_BACK
|
|
1658
1747
|
| BGFX_CAPS_VERTEX_ATTRIB_HALF
|
|
1659
1748
|
| BGFX_CAPS_VERTEX_ATTRIB_UINT10
|
|
@@ -1665,9 +1754,18 @@ VK_IMPORT_INSTANCE
|
|
|
1665
1754
|
| (s_extension[Extension::EXT_conservative_rasterization ].m_supported ? BGFX_CAPS_CONSERVATIVE_RASTER : 0)
|
|
1666
1755
|
| (s_extension[Extension::EXT_shader_viewport_index_layer].m_supported ? BGFX_CAPS_VIEWPORT_LAYER_ARRAY : 0)
|
|
1667
1756
|
| (s_extension[Extension::KHR_draw_indirect_count ].m_supported && indirectDrawSupport ? BGFX_CAPS_DRAW_INDIRECT_COUNT : 0)
|
|
1757
|
+
| (s_extension[Extension::KHR_fragment_shading_rate ].m_supported ? BGFX_CAPS_VARIABLE_RATE_SHADING : 0)
|
|
1758
|
+
;
|
|
1759
|
+
|
|
1760
|
+
m_variableRateShadingSupported = true
|
|
1761
|
+
&& s_extension[Extension::KHR_fragment_shading_rate].m_supported
|
|
1762
|
+
&& NULL != vkCmdSetFragmentShadingRateKHR
|
|
1668
1763
|
;
|
|
1669
1764
|
|
|
1670
|
-
const uint32_t maxAttachments = bx::min<uint32_t>(
|
|
1765
|
+
const uint32_t maxAttachments = bx::min<uint32_t>(
|
|
1766
|
+
m_deviceProperties.limits.maxFragmentOutputAttachments
|
|
1767
|
+
, m_deviceProperties.limits.maxColorAttachments
|
|
1768
|
+
);
|
|
1671
1769
|
|
|
1672
1770
|
g_caps.limits.maxTextureSize = m_deviceProperties.limits.maxImageDimension2D;
|
|
1673
1771
|
g_caps.limits.maxTextureLayers = m_deviceProperties.limits.maxImageArrayLayers;
|
|
@@ -1682,7 +1780,7 @@ VK_IMPORT_INSTANCE
|
|
|
1682
1780
|
& m_deviceProperties.limits.framebufferDepthSampleCounts
|
|
1683
1781
|
;
|
|
1684
1782
|
|
|
1685
|
-
for (uint16_t ii = 0, last = 0; ii < BX_COUNTOF(s_msaa); ii
|
|
1783
|
+
for (uint16_t ii = 0, last = 0; ii < BX_COUNTOF(s_msaa); ++ii)
|
|
1686
1784
|
{
|
|
1687
1785
|
const VkSampleCountFlags sampleBit = s_msaa[ii].Sample;
|
|
1688
1786
|
|
|
@@ -1697,9 +1795,20 @@ VK_IMPORT_INSTANCE
|
|
|
1697
1795
|
}
|
|
1698
1796
|
}
|
|
1699
1797
|
|
|
1798
|
+
{
|
|
1799
|
+
const VkExtent2D maxFragmentSize = m_deviceShadingRateImageProperties.maxFragmentSize;
|
|
1800
|
+
|
|
1801
|
+
for (uint32_t ii = 0; ii < BX_COUNTOF(s_shadingRate); ++ii)
|
|
1802
|
+
{
|
|
1803
|
+
ShadingRateVk& shadingRate = s_shadingRate[ii];
|
|
1804
|
+
shadingRate.fragmentSize.width = bx::min(shadingRate.initFragmentSize.width, maxFragmentSize.width);
|
|
1805
|
+
shadingRate.fragmentSize.height = bx::min(shadingRate.initFragmentSize.height, maxFragmentSize.height);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1700
1809
|
for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
|
|
1701
1810
|
{
|
|
1702
|
-
|
|
1811
|
+
uint32_t support = BGFX_CAPS_FORMAT_TEXTURE_NONE;
|
|
1703
1812
|
|
|
1704
1813
|
const bool depth = bimg::isDepth(bimg::TextureFormat::Enum(ii) );
|
|
1705
1814
|
VkFormat fmt = depth
|
|
@@ -1808,6 +1917,12 @@ VK_IMPORT_INSTANCE
|
|
|
1808
1917
|
}
|
|
1809
1918
|
}
|
|
1810
1919
|
|
|
1920
|
+
if (NULL != g_platformData.context)
|
|
1921
|
+
{
|
|
1922
|
+
m_device =
|
|
1923
|
+
m_externalDevice = (VkDevice)g_platformData.context;
|
|
1924
|
+
}
|
|
1925
|
+
else
|
|
1811
1926
|
{
|
|
1812
1927
|
uint32_t numEnabledLayers = 0;
|
|
1813
1928
|
const char* enabledLayer[Layer::Count];
|
|
@@ -1903,9 +2018,9 @@ VK_IMPORT_INSTANCE
|
|
|
1903
2018
|
errorState = ErrorState::DeviceCreated;
|
|
1904
2019
|
|
|
1905
2020
|
BX_TRACE("Device functions:");
|
|
1906
|
-
#define VK_IMPORT_DEVICE_FUNC(_optional, _func)
|
|
1907
|
-
_func = (PFN_##_func)vkGetDeviceProcAddr(m_device, #_func);
|
|
1908
|
-
BX_TRACE("\t%
|
|
2021
|
+
#define VK_IMPORT_DEVICE_FUNC(_optional, _func) \
|
|
2022
|
+
_func = (PFN_##_func)vkGetDeviceProcAddr(m_device, #_func); \
|
|
2023
|
+
BX_TRACE("\t%16p %s " #_func, _func, _optional ? "[opt]" : " "); \
|
|
1909
2024
|
imported &= _optional || NULL != _func
|
|
1910
2025
|
VK_IMPORT_DEVICE
|
|
1911
2026
|
#undef VK_IMPORT_DEVICE_FUNC
|
|
@@ -1919,12 +2034,12 @@ VK_IMPORT_DEVICE
|
|
|
1919
2034
|
vkGetDeviceQueue(m_device, m_globalQueueFamily, 0, &m_globalQueue);
|
|
1920
2035
|
|
|
1921
2036
|
{
|
|
1922
|
-
|
|
2037
|
+
m_maxFrameLatency = _init.resolution.maxFrameLatency == 0
|
|
1923
2038
|
? BGFX_CONFIG_MAX_FRAME_LATENCY
|
|
1924
2039
|
: _init.resolution.maxFrameLatency
|
|
1925
2040
|
;
|
|
1926
2041
|
|
|
1927
|
-
result = m_cmd.init(m_globalQueueFamily, m_globalQueue
|
|
2042
|
+
result = m_cmd.init(m_globalQueueFamily, m_globalQueue);
|
|
1928
2043
|
|
|
1929
2044
|
if (VK_SUCCESS != result)
|
|
1930
2045
|
{
|
|
@@ -1956,11 +2071,6 @@ VK_IMPORT_DEVICE
|
|
|
1956
2071
|
m_textVideoMem.resize(false, _init.resolution.width, _init.resolution.height);
|
|
1957
2072
|
m_textVideoMem.clear();
|
|
1958
2073
|
|
|
1959
|
-
for (uint8_t ii = 0; ii < BX_COUNTOF(m_swapChainFormats); ++ii)
|
|
1960
|
-
{
|
|
1961
|
-
m_swapChainFormats[ii] = TextureFormat::Enum(ii);
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
2074
|
result = m_backBuffer.create(
|
|
1965
2075
|
UINT16_MAX
|
|
1966
2076
|
, g_platformData.nwh
|
|
@@ -1979,6 +2089,39 @@ VK_IMPORT_DEVICE
|
|
|
1979
2089
|
m_numWindows++;
|
|
1980
2090
|
|
|
1981
2091
|
postReset();
|
|
2092
|
+
|
|
2093
|
+
{
|
|
2094
|
+
VkSurfaceKHR surface = m_backBuffer.m_swapChain.m_surface;
|
|
2095
|
+
|
|
2096
|
+
uint32_t numSurfaceFormats;
|
|
2097
|
+
result = vkGetPhysicalDeviceSurfaceFormatsKHR(m_physicalDevice, surface, &numSurfaceFormats, NULL);
|
|
2098
|
+
|
|
2099
|
+
if (VK_SUCCESS == result)
|
|
2100
|
+
{
|
|
2101
|
+
VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)BX_STACK_ALLOC(numSurfaceFormats * sizeof(VkSurfaceFormatKHR) );
|
|
2102
|
+
result = vkGetPhysicalDeviceSurfaceFormatsKHR(m_physicalDevice, surface, &numSurfaceFormats, surfaceFormats);
|
|
2103
|
+
|
|
2104
|
+
for (uint32_t sfidx = 0; sfidx < numSurfaceFormats; ++sfidx)
|
|
2105
|
+
{
|
|
2106
|
+
const VkSurfaceFormatKHR& surfaceFormat = surfaceFormats[sfidx];
|
|
2107
|
+
|
|
2108
|
+
for (uint32_t ii = TextureFormat::Unknown+1; ii < TextureFormat::UnknownDepth; ++ii)
|
|
2109
|
+
{
|
|
2110
|
+
if (0 != (g_caps.formats[ii] & BGFX_CAPS_FORMAT_TEXTURE_BACKBUFFER) )
|
|
2111
|
+
{
|
|
2112
|
+
continue;
|
|
2113
|
+
}
|
|
2114
|
+
|
|
2115
|
+
if (surfaceFormat.format == s_textureFormat[ii].m_fmt
|
|
2116
|
+
|| surfaceFormat.format == s_textureFormat[ii].m_fmtSrgb)
|
|
2117
|
+
{
|
|
2118
|
+
g_caps.formats[ii] |= BGFX_CAPS_FORMAT_TEXTURE_BACKBUFFER;
|
|
2119
|
+
break;
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
1982
2125
|
}
|
|
1983
2126
|
}
|
|
1984
2127
|
|
|
@@ -2002,12 +2145,15 @@ VK_IMPORT_DEVICE
|
|
|
2002
2145
|
dpci.poolSizeCount = BX_COUNTOF(dps);
|
|
2003
2146
|
dpci.pPoolSizes = dps;
|
|
2004
2147
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
if (VK_SUCCESS != result)
|
|
2148
|
+
for (uint32_t ii = 0; ii < m_maxFrameLatency; ++ii)
|
|
2008
2149
|
{
|
|
2009
|
-
|
|
2010
|
-
|
|
2150
|
+
result = vkCreateDescriptorPool(m_device, &dpci, m_allocatorCb, &m_descriptorPool[ii]);
|
|
2151
|
+
|
|
2152
|
+
if (VK_SUCCESS != result)
|
|
2153
|
+
{
|
|
2154
|
+
BX_TRACE("Init error: vkCreateDescriptorPool failed %d: %s.", result, getName(result) );
|
|
2155
|
+
goto error;
|
|
2156
|
+
}
|
|
2011
2157
|
}
|
|
2012
2158
|
|
|
2013
2159
|
VkPipelineCacheCreateInfo pcci;
|
|
@@ -2026,16 +2172,9 @@ VK_IMPORT_DEVICE
|
|
|
2026
2172
|
}
|
|
2027
2173
|
|
|
2028
2174
|
{
|
|
2029
|
-
|
|
2030
|
-
const uint32_t count = BGFX_CONFIG_MAX_DRAW_CALLS;
|
|
2175
|
+
m_uniformScratchBuffer.createUniform(2<<20, m_maxFrameLatency*2);
|
|
2031
2176
|
|
|
2032
|
-
for (uint32_t ii = 0; ii <
|
|
2033
|
-
{
|
|
2034
|
-
BX_TRACE("Create scratch buffer %d", ii);
|
|
2035
|
-
m_scratchBuffer[ii].createUniform(size, count);
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
for (uint32_t ii = 0; ii < m_numFramesInFlight; ++ii)
|
|
2177
|
+
for (uint32_t ii = 0; ii < m_maxFrameLatency; ++ii)
|
|
2039
2178
|
{
|
|
2040
2179
|
BX_TRACE("Create scratch staging buffer %d", ii);
|
|
2041
2180
|
m_scratchStagingBuffer[ii].createStaging(BGFX_CONFIG_MAX_SCRATCH_STAGING_BUFFER_PER_FRAME_SIZE);
|
|
@@ -2103,13 +2242,14 @@ VK_IMPORT_DEVICE
|
|
|
2103
2242
|
[[fallthrough]];
|
|
2104
2243
|
|
|
2105
2244
|
case ErrorState::DescriptorCreated:
|
|
2106
|
-
|
|
2245
|
+
m_uniformScratchBuffer.destroy();
|
|
2246
|
+
|
|
2247
|
+
for (uint32_t ii = 0; ii < m_maxFrameLatency; ++ii)
|
|
2107
2248
|
{
|
|
2108
|
-
m_scratchBuffer[ii].destroy();
|
|
2109
2249
|
m_scratchStagingBuffer[ii].destroy();
|
|
2250
|
+
vkDestroy(m_descriptorPool[ii]);
|
|
2110
2251
|
}
|
|
2111
2252
|
vkDestroy(m_pipelineCache);
|
|
2112
|
-
vkDestroy(m_descriptorPool);
|
|
2113
2253
|
[[fallthrough]];
|
|
2114
2254
|
|
|
2115
2255
|
case ErrorState::SwapChainCreated:
|
|
@@ -2166,12 +2306,9 @@ VK_IMPORT_DEVICE
|
|
|
2166
2306
|
m_samplerBorderColorCache.invalidate();
|
|
2167
2307
|
m_imageViewCache.invalidate();
|
|
2168
2308
|
|
|
2169
|
-
|
|
2170
|
-
{
|
|
2171
|
-
m_scratchBuffer[ii].destroy();
|
|
2172
|
-
}
|
|
2309
|
+
m_uniformScratchBuffer.destroy();
|
|
2173
2310
|
|
|
2174
|
-
for (uint32_t ii = 0; ii <
|
|
2311
|
+
for (uint32_t ii = 0; ii < m_maxFrameLatency; ++ii)
|
|
2175
2312
|
{
|
|
2176
2313
|
m_scratchStagingBuffer[ii].destroy();
|
|
2177
2314
|
}
|
|
@@ -2208,9 +2345,22 @@ VK_IMPORT_DEVICE
|
|
|
2208
2345
|
m_cmd.shutdown();
|
|
2209
2346
|
|
|
2210
2347
|
vkDestroy(m_pipelineCache);
|
|
2211
|
-
vkDestroy(m_descriptorPool);
|
|
2212
2348
|
|
|
2213
|
-
|
|
2349
|
+
for (uint32_t ii = 0; ii < m_maxFrameLatency; ++ii)
|
|
2350
|
+
{
|
|
2351
|
+
vkDestroy(m_descriptorPool[ii]);
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
if (NULL != m_externalDevice)
|
|
2355
|
+
{
|
|
2356
|
+
m_externalDevice = NULL;
|
|
2357
|
+
m_device = NULL;
|
|
2358
|
+
}
|
|
2359
|
+
else
|
|
2360
|
+
{
|
|
2361
|
+
vkDestroyDevice(m_device, m_allocatorCb);
|
|
2362
|
+
m_device = NULL;
|
|
2363
|
+
}
|
|
2214
2364
|
|
|
2215
2365
|
if (VK_NULL_HANDLE != m_debugReportCallback)
|
|
2216
2366
|
{
|
|
@@ -2254,7 +2404,7 @@ VK_IMPORT_DEVICE
|
|
|
2254
2404
|
fb.present();
|
|
2255
2405
|
}
|
|
2256
2406
|
|
|
2257
|
-
int64_t now = bx::getHPCounter();
|
|
2407
|
+
const int64_t now = bx::getHPCounter();
|
|
2258
2408
|
|
|
2259
2409
|
m_presentElapsed += now - start;
|
|
2260
2410
|
}
|
|
@@ -2341,13 +2491,9 @@ VK_IMPORT_DEVICE
|
|
|
2341
2491
|
m_program[_handle.idx].destroy();
|
|
2342
2492
|
}
|
|
2343
2493
|
|
|
2344
|
-
void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip) override
|
|
2345
|
-
{
|
|
2346
|
-
return m_textures[_handle.idx].create(m_commandBuffer, _mem, _flags, _skip);
|
|
2347
|
-
}
|
|
2348
|
-
|
|
2349
|
-
void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) override
|
|
2494
|
+
void* createTexture(TextureHandle _handle, const Memory* _mem, uint64_t _flags, uint8_t _skip, uint64_t _external) override
|
|
2350
2495
|
{
|
|
2496
|
+
return m_textures[_handle.idx].create(m_commandBuffer, _mem, _flags, _skip, _external);
|
|
2351
2497
|
}
|
|
2352
2498
|
|
|
2353
2499
|
void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) override
|
|
@@ -2355,10 +2501,6 @@ VK_IMPORT_DEVICE
|
|
|
2355
2501
|
m_textures[_handle.idx].update(m_commandBuffer, _side, _mip, _rect, _z, _depth, _pitch, _mem);
|
|
2356
2502
|
}
|
|
2357
2503
|
|
|
2358
|
-
void updateTextureEnd() override
|
|
2359
|
-
{
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
2504
|
void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override
|
|
2363
2505
|
{
|
|
2364
2506
|
TextureVK& texture = m_textures[_handle.idx];
|
|
@@ -2412,7 +2554,7 @@ VK_IMPORT_DEVICE
|
|
|
2412
2554
|
bx::write(&writer, tc, bx::ErrorAssert{});
|
|
2413
2555
|
|
|
2414
2556
|
destroyTexture(_handle);
|
|
2415
|
-
createTexture(_handle, mem, flags, 0);
|
|
2557
|
+
createTexture(_handle, mem, flags, 0, 0);
|
|
2416
2558
|
|
|
2417
2559
|
bgfx::release(mem);
|
|
2418
2560
|
}
|
|
@@ -2509,7 +2651,7 @@ VK_IMPORT_DEVICE
|
|
|
2509
2651
|
return;
|
|
2510
2652
|
}
|
|
2511
2653
|
|
|
2512
|
-
auto callback = [](void* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _userData)
|
|
2654
|
+
auto callback = [](void* _src, uint32_t _width, uint32_t _height, bgfx::TextureFormat::Enum _format, uint32_t _pitch, const void* _userData)
|
|
2513
2655
|
{
|
|
2514
2656
|
const char* filePath = (const char*)_userData;
|
|
2515
2657
|
g_callback->screenShot(
|
|
@@ -2517,13 +2659,14 @@ VK_IMPORT_DEVICE
|
|
|
2517
2659
|
, _width
|
|
2518
2660
|
, _height
|
|
2519
2661
|
, _pitch
|
|
2662
|
+
, _format
|
|
2520
2663
|
, _src
|
|
2521
2664
|
, _height * _pitch
|
|
2522
2665
|
, false
|
|
2523
2666
|
);
|
|
2524
2667
|
};
|
|
2525
2668
|
|
|
2526
|
-
const uint8_t
|
|
2669
|
+
const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(swapChain.m_colorFormat) );
|
|
2527
2670
|
const uint32_t size = frameBuffer.m_width * frameBuffer.m_height * bpp / 8;
|
|
2528
2671
|
|
|
2529
2672
|
DeviceMemoryAllocationVK stagingMemory;
|
|
@@ -2623,9 +2766,11 @@ VK_IMPORT_DEVICE
|
|
|
2623
2766
|
|
|
2624
2767
|
void submitBlit(BlitState& _bs, uint16_t _view);
|
|
2625
2768
|
|
|
2769
|
+
void submitUniformCache(UniformCacheState& _ucs, uint16_t _view);
|
|
2770
|
+
|
|
2626
2771
|
void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) override;
|
|
2627
2772
|
|
|
2628
|
-
void
|
|
2773
|
+
void dbgTextRenderBegin(TextVideoMemBlitter& _blitter) override
|
|
2629
2774
|
{
|
|
2630
2775
|
const uint32_t width = m_backBuffer.m_width;
|
|
2631
2776
|
const uint32_t height = m_backBuffer.m_height;
|
|
@@ -2680,8 +2825,10 @@ VK_IMPORT_DEVICE
|
|
|
2680
2825
|
commit(*vcb);
|
|
2681
2826
|
}
|
|
2682
2827
|
|
|
2683
|
-
|
|
2684
|
-
|
|
2828
|
+
ChunkedScratchBufferVK& uniformScratchBuffer = m_uniformScratchBuffer;
|
|
2829
|
+
|
|
2830
|
+
ChunkedScratchBufferOffset sbo;
|
|
2831
|
+
uniformScratchBuffer.write(sbo, m_vsScratch, program.m_vsh->m_size);
|
|
2685
2832
|
|
|
2686
2833
|
const TextureVK& texture = m_textures[_blitter.m_texture.idx];
|
|
2687
2834
|
|
|
@@ -2691,7 +2838,7 @@ VK_IMPORT_DEVICE
|
|
|
2691
2838
|
bind.m_bind[0].m_idx = _blitter.m_texture.idx;
|
|
2692
2839
|
bind.m_bind[0].m_samplerFlags = (uint32_t)(texture.m_flags & BGFX_SAMPLER_BITS_MASK);
|
|
2693
2840
|
|
|
2694
|
-
const VkDescriptorSet descriptorSet = getDescriptorSet(program, bind,
|
|
2841
|
+
const VkDescriptorSet descriptorSet = getDescriptorSet(program, bind, sbo.buffer, NULL);
|
|
2695
2842
|
|
|
2696
2843
|
vkCmdBindDescriptorSets(
|
|
2697
2844
|
m_commandBuffer
|
|
@@ -2701,7 +2848,7 @@ VK_IMPORT_DEVICE
|
|
|
2701
2848
|
, 1
|
|
2702
2849
|
, &descriptorSet
|
|
2703
2850
|
, 1
|
|
2704
|
-
,
|
|
2851
|
+
, sbo.offsets
|
|
2705
2852
|
);
|
|
2706
2853
|
|
|
2707
2854
|
const VertexBufferVK& vb = m_vertexBuffers[_blitter.m_vb->handle.idx];
|
|
@@ -2717,7 +2864,7 @@ VK_IMPORT_DEVICE
|
|
|
2717
2864
|
);
|
|
2718
2865
|
}
|
|
2719
2866
|
|
|
2720
|
-
void
|
|
2867
|
+
void dbgTextRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) override
|
|
2721
2868
|
{
|
|
2722
2869
|
const uint32_t numVertices = _numIndices*4/6;
|
|
2723
2870
|
|
|
@@ -2745,6 +2892,10 @@ VK_IMPORT_DEVICE
|
|
|
2745
2892
|
}
|
|
2746
2893
|
}
|
|
2747
2894
|
|
|
2895
|
+
void dbgTextRenderEnd(TextVideoMemBlitter& /*_blitter*/) override
|
|
2896
|
+
{
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2748
2899
|
void preReset()
|
|
2749
2900
|
{
|
|
2750
2901
|
for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii)
|
|
@@ -2771,11 +2922,9 @@ VK_IMPORT_DEVICE
|
|
|
2771
2922
|
|
|
2772
2923
|
if (m_resolution.reset & BGFX_RESET_CAPTURE)
|
|
2773
2924
|
{
|
|
2774
|
-
const uint8_t
|
|
2775
|
-
const uint32_t
|
|
2776
|
-
|
|
2777
|
-
const uint8_t dstBpp = bimg::getBitsPerPixel(bimg::TextureFormat::BGRA8);
|
|
2778
|
-
const uint32_t dstPitch = m_backBuffer.m_width * dstBpp / 8;
|
|
2925
|
+
const uint8_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_backBuffer.m_swapChain.m_colorFormat) );
|
|
2926
|
+
const uint32_t pitch = m_backBuffer.m_width * bpp / 8;
|
|
2927
|
+
const uint32_t captureSize = m_backBuffer.m_width * pitch;
|
|
2779
2928
|
|
|
2780
2929
|
if (captureSize > m_captureSize)
|
|
2781
2930
|
{
|
|
@@ -2786,7 +2935,7 @@ VK_IMPORT_DEVICE
|
|
|
2786
2935
|
VK_CHECK(createReadbackBuffer(m_captureSize, &m_captureBuffer, &m_captureMemory) );
|
|
2787
2936
|
}
|
|
2788
2937
|
|
|
2789
|
-
g_callback->captureBegin(m_resolution.width, m_resolution.height,
|
|
2938
|
+
g_callback->captureBegin(m_resolution.width, m_resolution.height, pitch, m_resolution.formatColor, false);
|
|
2790
2939
|
}
|
|
2791
2940
|
}
|
|
2792
2941
|
|
|
@@ -2912,10 +3061,10 @@ VK_IMPORT_DEVICE
|
|
|
2912
3061
|
for (uint8_t ii = 0, num = oldFrameBuffer.m_num; ii < num; ++ii)
|
|
2913
3062
|
{
|
|
2914
3063
|
TextureVK& texture = m_textures[oldFrameBuffer.m_texture[ii].idx];
|
|
2915
|
-
texture.
|
|
3064
|
+
texture.setState(m_commandBuffer, texture.m_sampledLayout);
|
|
2916
3065
|
if (VK_NULL_HANDLE != texture.m_singleMsaaImage)
|
|
2917
3066
|
{
|
|
2918
|
-
texture.
|
|
3067
|
+
texture.setState(m_commandBuffer, texture.m_sampledLayout, true);
|
|
2919
3068
|
}
|
|
2920
3069
|
}
|
|
2921
3070
|
|
|
@@ -2926,7 +3075,7 @@ VK_IMPORT_DEVICE
|
|
|
2926
3075
|
|
|
2927
3076
|
if (!writeOnly)
|
|
2928
3077
|
{
|
|
2929
|
-
texture.
|
|
3078
|
+
texture.setState(m_commandBuffer, texture.m_sampledLayout);
|
|
2930
3079
|
}
|
|
2931
3080
|
}
|
|
2932
3081
|
}
|
|
@@ -2936,7 +3085,7 @@ VK_IMPORT_DEVICE
|
|
|
2936
3085
|
for (uint8_t ii = 0, num = newFrameBuffer.m_num; ii < num; ++ii)
|
|
2937
3086
|
{
|
|
2938
3087
|
TextureVK& texture = m_textures[newFrameBuffer.m_texture[ii].idx];
|
|
2939
|
-
texture.
|
|
3088
|
+
texture.setState(
|
|
2940
3089
|
m_commandBuffer
|
|
2941
3090
|
, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
|
|
2942
3091
|
);
|
|
@@ -2945,7 +3094,7 @@ VK_IMPORT_DEVICE
|
|
|
2945
3094
|
if (isValid(newFrameBuffer.m_depth) )
|
|
2946
3095
|
{
|
|
2947
3096
|
TextureVK& texture = m_textures[newFrameBuffer.m_depth.idx];
|
|
2948
|
-
texture.
|
|
3097
|
+
texture.setState(
|
|
2949
3098
|
m_commandBuffer
|
|
2950
3099
|
, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
|
|
2951
3100
|
);
|
|
@@ -2960,7 +3109,7 @@ VK_IMPORT_DEVICE
|
|
|
2960
3109
|
|
|
2961
3110
|
newFrameBuffer.acquire(m_commandBuffer);
|
|
2962
3111
|
|
|
2963
|
-
int64_t now = bx::getHPCounter();
|
|
3112
|
+
const int64_t now = bx::getHPCounter();
|
|
2964
3113
|
|
|
2965
3114
|
if (NULL != newFrameBuffer.m_nwh)
|
|
2966
3115
|
{
|
|
@@ -3629,7 +3778,7 @@ VK_IMPORT_DEVICE
|
|
|
3629
3778
|
| BGFX_STATE_PT_MASK
|
|
3630
3779
|
;
|
|
3631
3780
|
|
|
3632
|
-
_stencil &=
|
|
3781
|
+
_stencil &= kStencilNoRefMask;
|
|
3633
3782
|
|
|
3634
3783
|
VertexLayout layout;
|
|
3635
3784
|
if (0 < _numStreams)
|
|
@@ -3729,14 +3878,17 @@ VK_IMPORT_DEVICE
|
|
|
3729
3878
|
VK_DYNAMIC_STATE_SCISSOR,
|
|
3730
3879
|
VK_DYNAMIC_STATE_BLEND_CONSTANTS,
|
|
3731
3880
|
VK_DYNAMIC_STATE_STENCIL_REFERENCE,
|
|
3881
|
+
VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR, // optional
|
|
3732
3882
|
};
|
|
3733
3883
|
|
|
3734
3884
|
VkPipelineDynamicStateCreateInfo dynamicState;
|
|
3735
3885
|
dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
|
3736
3886
|
dynamicState.pNext = NULL;
|
|
3737
3887
|
dynamicState.flags = 0;
|
|
3738
|
-
dynamicState.dynamicStateCount = BX_COUNTOF(dynamicStates)
|
|
3739
|
-
|
|
3888
|
+
dynamicState.dynamicStateCount = BX_COUNTOF(dynamicStates) -
|
|
3889
|
+
(m_variableRateShadingSupported ? 0 : 1)
|
|
3890
|
+
;
|
|
3891
|
+
dynamicState.pDynamicStates = dynamicStates;
|
|
3740
3892
|
|
|
3741
3893
|
VkPipelineShaderStageCreateInfo shaderStages[2];
|
|
3742
3894
|
shaderStages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
|
@@ -3862,16 +4014,16 @@ VK_IMPORT_DEVICE
|
|
|
3862
4014
|
return pipeline;
|
|
3863
4015
|
}
|
|
3864
4016
|
|
|
3865
|
-
VkDescriptorSet getDescriptorSet(const ProgramVK&
|
|
4017
|
+
VkDescriptorSet getDescriptorSet(const ProgramVK& _program, const RenderBind& _renderBind, VkBuffer _uniformBuffer, const float _palette[][4])
|
|
3866
4018
|
{
|
|
3867
4019
|
VkDescriptorSet descriptorSet;
|
|
3868
4020
|
|
|
3869
4021
|
VkDescriptorSetAllocateInfo dsai;
|
|
3870
4022
|
dsai.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
|
3871
4023
|
dsai.pNext = NULL;
|
|
3872
|
-
dsai.descriptorPool = m_descriptorPool;
|
|
4024
|
+
dsai.descriptorPool = m_descriptorPool[m_cmd.m_currentFrameInFlight];
|
|
3873
4025
|
dsai.descriptorSetCount = 1;
|
|
3874
|
-
dsai.pSetLayouts = &
|
|
4026
|
+
dsai.pSetLayouts = &_program.m_descriptorSetLayout;
|
|
3875
4027
|
|
|
3876
4028
|
VK_CHECK(vkAllocateDescriptorSets(m_device, &dsai, &descriptorSet) );
|
|
3877
4029
|
|
|
@@ -3887,8 +4039,8 @@ VK_IMPORT_DEVICE
|
|
|
3887
4039
|
|
|
3888
4040
|
for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
|
|
3889
4041
|
{
|
|
3890
|
-
const Binding& bind =
|
|
3891
|
-
const BindInfo& bindInfo =
|
|
4042
|
+
const Binding& bind = _renderBind.m_bind[stage];
|
|
4043
|
+
const BindInfo& bindInfo = _program.m_bindInfo[stage];
|
|
3892
4044
|
|
|
3893
4045
|
if (kInvalidHandle != bind.m_idx
|
|
3894
4046
|
&& isValid(bindInfo.uniformHandle) )
|
|
@@ -3918,7 +4070,7 @@ VK_IMPORT_DEVICE
|
|
|
3918
4070
|
VkImageViewType type = texture.m_type;
|
|
3919
4071
|
if (UINT32_MAX != bindInfo.index)
|
|
3920
4072
|
{
|
|
3921
|
-
type =
|
|
4073
|
+
type = _program.m_textures[bindInfo.index].type;
|
|
3922
4074
|
}
|
|
3923
4075
|
else if (type == VK_IMAGE_VIEW_TYPE_CUBE
|
|
3924
4076
|
|| type == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY)
|
|
@@ -3987,7 +4139,7 @@ VK_IMPORT_DEVICE
|
|
|
3987
4139
|
|
|
3988
4140
|
const VkImageViewType type = UINT32_MAX == bindInfo.index
|
|
3989
4141
|
? texture.m_type
|
|
3990
|
-
:
|
|
4142
|
+
: _program.m_textures[bindInfo.index].type
|
|
3991
4143
|
;
|
|
3992
4144
|
|
|
3993
4145
|
BX_ASSERT(
|
|
@@ -4036,19 +4188,19 @@ VK_IMPORT_DEVICE
|
|
|
4036
4188
|
}
|
|
4037
4189
|
}
|
|
4038
4190
|
|
|
4039
|
-
const uint32_t
|
|
4040
|
-
const uint32_t
|
|
4191
|
+
const uint32_t vsSize = _program.m_vsh->m_size;
|
|
4192
|
+
const uint32_t fsSize = NULL != _program.m_fsh ? _program.m_fsh->m_size : 0;
|
|
4041
4193
|
|
|
4042
|
-
if (
|
|
4194
|
+
if (0 < vsSize)
|
|
4043
4195
|
{
|
|
4044
|
-
bufferInfo[bufferCount].buffer =
|
|
4196
|
+
bufferInfo[bufferCount].buffer = _uniformBuffer;
|
|
4045
4197
|
bufferInfo[bufferCount].offset = 0;
|
|
4046
|
-
bufferInfo[bufferCount].range =
|
|
4198
|
+
bufferInfo[bufferCount].range = vsSize;
|
|
4047
4199
|
|
|
4048
4200
|
wds[wdsCount].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
4049
4201
|
wds[wdsCount].pNext = NULL;
|
|
4050
4202
|
wds[wdsCount].dstSet = descriptorSet;
|
|
4051
|
-
wds[wdsCount].dstBinding =
|
|
4203
|
+
wds[wdsCount].dstBinding = _program.m_vsh->m_uniformBinding;
|
|
4052
4204
|
wds[wdsCount].dstArrayElement = 0;
|
|
4053
4205
|
wds[wdsCount].descriptorCount = 1;
|
|
4054
4206
|
wds[wdsCount].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
|
@@ -4059,16 +4211,16 @@ VK_IMPORT_DEVICE
|
|
|
4059
4211
|
++bufferCount;
|
|
4060
4212
|
}
|
|
4061
4213
|
|
|
4062
|
-
if (
|
|
4214
|
+
if (0 < fsSize)
|
|
4063
4215
|
{
|
|
4064
|
-
bufferInfo[bufferCount].buffer =
|
|
4216
|
+
bufferInfo[bufferCount].buffer = _uniformBuffer;
|
|
4065
4217
|
bufferInfo[bufferCount].offset = 0;
|
|
4066
|
-
bufferInfo[bufferCount].range =
|
|
4218
|
+
bufferInfo[bufferCount].range = fsSize;
|
|
4067
4219
|
|
|
4068
4220
|
wds[wdsCount].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
|
4069
4221
|
wds[wdsCount].pNext = NULL;
|
|
4070
4222
|
wds[wdsCount].dstSet = descriptorSet;
|
|
4071
|
-
wds[wdsCount].dstBinding =
|
|
4223
|
+
wds[wdsCount].dstBinding = _program.m_fsh->m_uniformBinding;
|
|
4072
4224
|
wds[wdsCount].dstArrayElement = 0;
|
|
4073
4225
|
wds[wdsCount].descriptorCount = 1;
|
|
4074
4226
|
wds[wdsCount].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
|
@@ -4093,18 +4245,17 @@ VK_IMPORT_DEVICE
|
|
|
4093
4245
|
&& NULL != _swapChain.m_nwh
|
|
4094
4246
|
&& _swapChain.m_needPresent
|
|
4095
4247
|
&& _swapChain.m_supportsReadback
|
|
4096
|
-
&& bimg::imageConvert(bimg::TextureFormat::BGRA8, bimg::TextureFormat::Enum(_swapChain.m_colorFormat) )
|
|
4097
4248
|
;
|
|
4098
4249
|
}
|
|
4099
4250
|
|
|
4100
|
-
typedef void (*
|
|
4251
|
+
typedef void (*SwapChainReadFn)(void* _src, uint32_t _width, uint32_t _height, bgfx::TextureFormat::Enum _format, uint32_t _pitch, const void* _userData);
|
|
4101
4252
|
|
|
4102
|
-
bool readSwapChain(const SwapChainVK& _swapChain, VkBuffer _buffer, DeviceMemoryAllocationVK _memory,
|
|
4253
|
+
bool readSwapChain(const SwapChainVK& _swapChain, VkBuffer _buffer, DeviceMemoryAllocationVK _memory, SwapChainReadFn _func, const void* _userData = NULL)
|
|
4103
4254
|
{
|
|
4104
4255
|
if (isSwapChainReadable(_swapChain) )
|
|
4105
4256
|
{
|
|
4106
4257
|
// source for the copy is the last rendered swapchain image
|
|
4107
|
-
const VkImage
|
|
4258
|
+
const VkImage image = _swapChain.m_backBufferColorImage[_swapChain.m_backBufferColorIdx];
|
|
4108
4259
|
const VkImageLayout layout = _swapChain.m_backBufferColorImageLayout[_swapChain.m_backBufferColorIdx];
|
|
4109
4260
|
|
|
4110
4261
|
const uint32_t width = _swapChain.m_sci.imageExtent.width;
|
|
@@ -4122,29 +4273,7 @@ VK_IMPORT_DEVICE
|
|
|
4122
4273
|
uint8_t* src;
|
|
4123
4274
|
VK_CHECK(vkMapMemory(m_device, _memory.mem, _memory.offset, _memory.size, 0, (void**)&src) );
|
|
4124
4275
|
|
|
4125
|
-
|
|
4126
|
-
{
|
|
4127
|
-
bimg::imageSwizzleBgra8(src, pitch, width, height, src, pitch);
|
|
4128
|
-
_func(src, width, height, pitch, _userData);
|
|
4129
|
-
}
|
|
4130
|
-
else if (_swapChain.m_colorFormat == TextureFormat::BGRA8)
|
|
4131
|
-
{
|
|
4132
|
-
_func(src, width, height, pitch, _userData);
|
|
4133
|
-
}
|
|
4134
|
-
else
|
|
4135
|
-
{
|
|
4136
|
-
const uint8_t dstBpp = bimg::getBitsPerPixel(bimg::TextureFormat::BGRA8);
|
|
4137
|
-
const uint32_t dstPitch = width * dstBpp / 8;
|
|
4138
|
-
const uint32_t dstSize = height * dstPitch;
|
|
4139
|
-
|
|
4140
|
-
void* dst = bx::alloc(g_allocator, dstSize);
|
|
4141
|
-
|
|
4142
|
-
bimg::imageConvert(g_allocator, dst, bimg::TextureFormat::BGRA8, src, bimg::TextureFormat::Enum(_swapChain.m_colorFormat), width, height, 1);
|
|
4143
|
-
|
|
4144
|
-
_func(dst, width, height, dstPitch, _userData);
|
|
4145
|
-
|
|
4146
|
-
bx::free(g_allocator, dst);
|
|
4147
|
-
}
|
|
4276
|
+
_func(src, width, height, _swapChain.m_colorFormat, pitch, _userData);
|
|
4148
4277
|
|
|
4149
4278
|
vkUnmapMemory(m_device, _memory.mem);
|
|
4150
4279
|
|
|
@@ -4162,7 +4291,7 @@ VK_IMPORT_DEVICE
|
|
|
4162
4291
|
{
|
|
4163
4292
|
m_backBuffer.resolve();
|
|
4164
4293
|
|
|
4165
|
-
auto callback = [](void* _src, uint32_t /*_width*/, uint32_t _height, uint32_t _pitch, const void* /*_userData*/)
|
|
4294
|
+
auto callback = [](void* _src, uint32_t /*_width*/, uint32_t _height, TextureFormat::Enum /*_format*/, uint32_t _pitch, const void* /*_userData*/)
|
|
4166
4295
|
{
|
|
4167
4296
|
const uint32_t size = _height * _pitch;
|
|
4168
4297
|
g_callback->captureFrame(_src, size);
|
|
@@ -4528,7 +4657,7 @@ VK_IMPORT_DEVICE
|
|
|
4528
4657
|
BGFX_PROFILER_SCOPE("RendererContextVK::allocFromScratchStagingBuffer", kColorResource);
|
|
4529
4658
|
|
|
4530
4659
|
StagingBufferVK result;
|
|
4531
|
-
|
|
4660
|
+
StagingScratchBufferVK& scratch = m_scratchStagingBuffer[m_cmd.m_currentFrameInFlight];
|
|
4532
4661
|
|
|
4533
4662
|
if (_size <= BGFX_CONFIG_MAX_STAGING_SCRATCH_BUFFER_SIZE)
|
|
4534
4663
|
{
|
|
@@ -4582,16 +4711,16 @@ VK_IMPORT_DEVICE
|
|
|
4582
4711
|
VkPhysicalDevice m_physicalDevice;
|
|
4583
4712
|
uint32_t m_instanceApiVersion;
|
|
4584
4713
|
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4714
|
+
VkPhysicalDeviceFragmentShadingRatePropertiesKHR m_deviceShadingRateImageProperties;
|
|
4715
|
+
VkPhysicalDeviceProperties m_deviceProperties;
|
|
4716
|
+
VkPhysicalDeviceMemoryProperties m_memoryProperties;
|
|
4717
|
+
VkPhysicalDeviceFeatures m_deviceFeatures;
|
|
4588
4718
|
|
|
4589
4719
|
bool m_lineAASupport;
|
|
4590
4720
|
bool m_borderColorSupport;
|
|
4591
4721
|
bool m_timerQuerySupport;
|
|
4592
4722
|
|
|
4593
4723
|
FrameBufferVK m_backBuffer;
|
|
4594
|
-
TextureFormat::Enum m_swapChainFormats[TextureFormat::Count];
|
|
4595
4724
|
|
|
4596
4725
|
uint16_t m_numWindows;
|
|
4597
4726
|
FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS];
|
|
@@ -4599,17 +4728,18 @@ VK_IMPORT_DEVICE
|
|
|
4599
4728
|
|
|
4600
4729
|
MemoryLruVK m_memoryLru;
|
|
4601
4730
|
|
|
4602
|
-
|
|
4603
|
-
|
|
4731
|
+
ChunkedScratchBufferVK m_uniformScratchBuffer;
|
|
4732
|
+
StagingScratchBufferVK m_scratchStagingBuffer[BGFX_CONFIG_MAX_FRAME_LATENCY];
|
|
4604
4733
|
|
|
4605
|
-
uint32_t
|
|
4734
|
+
uint32_t m_maxFrameLatency;
|
|
4606
4735
|
CommandQueueVK m_cmd;
|
|
4607
4736
|
VkCommandBuffer m_commandBuffer;
|
|
4608
4737
|
|
|
4609
4738
|
VkDevice m_device;
|
|
4739
|
+
VkDevice m_externalDevice;
|
|
4610
4740
|
uint32_t m_globalQueueFamily;
|
|
4611
4741
|
VkQueue m_globalQueue;
|
|
4612
|
-
VkDescriptorPool m_descriptorPool;
|
|
4742
|
+
VkDescriptorPool m_descriptorPool[BGFX_CONFIG_MAX_FRAME_LATENCY];
|
|
4613
4743
|
VkPipelineCache m_pipelineCache;
|
|
4614
4744
|
|
|
4615
4745
|
TimerQueryVK m_gpuTimer;
|
|
@@ -4646,6 +4776,8 @@ VK_IMPORT_DEVICE
|
|
|
4646
4776
|
DeviceMemoryAllocationVK m_captureMemory;
|
|
4647
4777
|
uint32_t m_captureSize;
|
|
4648
4778
|
|
|
4779
|
+
bool m_variableRateShadingSupported;
|
|
4780
|
+
|
|
4649
4781
|
TextVideoMem m_textVideoMem;
|
|
4650
4782
|
|
|
4651
4783
|
uint8_t m_fsScratch[64<<10];
|
|
@@ -4715,8 +4847,6 @@ VK_DESTROY
|
|
|
4715
4847
|
{
|
|
4716
4848
|
if (VK_NULL_HANDLE != _obj)
|
|
4717
4849
|
{
|
|
4718
|
-
BGFX_PROFILER_SCOPE("vkFreeDescriptorSets", kColorResource);
|
|
4719
|
-
vkFreeDescriptorSets(s_renderVK->m_device, s_renderVK->m_descriptorPool, 1, &_obj);
|
|
4720
4850
|
_obj = VK_NULL_HANDLE;
|
|
4721
4851
|
}
|
|
4722
4852
|
}
|
|
@@ -4736,31 +4866,33 @@ VK_DESTROY
|
|
|
4736
4866
|
s_renderVK->release(_obj);
|
|
4737
4867
|
}
|
|
4738
4868
|
|
|
4739
|
-
void MemoryLruVK::recycle(DeviceMemoryAllocationVK
|
|
4869
|
+
void MemoryLruVK::recycle(DeviceMemoryAllocationVK& _alloc)
|
|
4740
4870
|
{
|
|
4741
4871
|
if (MAX_ENTRIES == lru.getNumHandles() )
|
|
4742
4872
|
{
|
|
4743
4873
|
// Evict LRU
|
|
4744
4874
|
uint16_t handle = lru.getBack();
|
|
4745
|
-
DeviceMemoryAllocationVK
|
|
4875
|
+
DeviceMemoryAllocationVK& alloc = entries[handle];
|
|
4746
4876
|
totalSizeCached -= alloc.size;
|
|
4747
4877
|
release(alloc.mem);
|
|
4748
4878
|
|
|
4749
4879
|
// Touch slot and overwrite
|
|
4750
4880
|
lru.touch(handle);
|
|
4751
4881
|
alloc = _alloc;
|
|
4752
|
-
}
|
|
4882
|
+
}
|
|
4883
|
+
else
|
|
4753
4884
|
{
|
|
4754
4885
|
uint16_t handle = lru.alloc();
|
|
4755
4886
|
entries[handle] = _alloc;
|
|
4756
4887
|
}
|
|
4888
|
+
|
|
4757
4889
|
totalSizeCached += _alloc.size;
|
|
4758
4890
|
|
|
4759
4891
|
while (totalSizeCached > BGFX_CONFIG_CACHED_DEVICE_MEMORY_ALLOCATIONS_SIZE)
|
|
4760
4892
|
{
|
|
4761
4893
|
BX_ASSERT(lru.getNumHandles() > 0, "Memory badly counted.");
|
|
4762
4894
|
uint16_t handle = lru.getBack();
|
|
4763
|
-
DeviceMemoryAllocationVK
|
|
4895
|
+
DeviceMemoryAllocationVK& alloc = entries[handle];
|
|
4764
4896
|
totalSizeCached -= alloc.size;
|
|
4765
4897
|
release(alloc.mem);
|
|
4766
4898
|
lru.free(handle);
|
|
@@ -4772,25 +4904,33 @@ VK_DESTROY
|
|
|
4772
4904
|
BGFX_PROFILER_SCOPE("MemoryLruVK::find", kColorResource);
|
|
4773
4905
|
// Find best fit.
|
|
4774
4906
|
uint16_t slot;
|
|
4907
|
+
|
|
4775
4908
|
{
|
|
4776
|
-
int16_t
|
|
4909
|
+
int16_t bestIdx = MAX_ENTRIES;
|
|
4777
4910
|
uint32_t bestWaste = 0xffff'ffff;
|
|
4911
|
+
|
|
4778
4912
|
slot = lru.getFront();
|
|
4913
|
+
|
|
4779
4914
|
while (UINT16_MAX != slot)
|
|
4780
4915
|
{
|
|
4781
|
-
DeviceMemoryAllocationVK
|
|
4916
|
+
DeviceMemoryAllocationVK& alloc = entries[slot];
|
|
4917
|
+
|
|
4782
4918
|
if (alloc.memoryTypeIndex == _memoryTypeIndex)
|
|
4783
4919
|
{
|
|
4784
4920
|
// 50% waste allowed, otherwise we'll just allocate a new one.
|
|
4785
4921
|
// This is to prevent we trash this cache of useful allocations
|
|
4786
4922
|
// with a handful of tiny allocations.
|
|
4787
|
-
|
|
4923
|
+
|
|
4924
|
+
if (alloc.size >= _size
|
|
4925
|
+
&& alloc.size <= _size * 2)
|
|
4788
4926
|
{
|
|
4789
|
-
uint32_t waste = bx::narrowCast<uint32_t>(alloc.size - _size);
|
|
4927
|
+
const uint32_t waste = bx::narrowCast<uint32_t>(alloc.size - _size);
|
|
4928
|
+
|
|
4790
4929
|
if (waste < bestWaste)
|
|
4791
4930
|
{
|
|
4792
4931
|
bestIdx = slot;
|
|
4793
4932
|
bestWaste = waste;
|
|
4933
|
+
|
|
4794
4934
|
if (waste == 0)
|
|
4795
4935
|
{
|
|
4796
4936
|
break;
|
|
@@ -4798,8 +4938,10 @@ VK_DESTROY
|
|
|
4798
4938
|
}
|
|
4799
4939
|
}
|
|
4800
4940
|
}
|
|
4941
|
+
|
|
4801
4942
|
slot = lru.getNext(slot);
|
|
4802
4943
|
}
|
|
4944
|
+
|
|
4803
4945
|
slot = bestIdx;
|
|
4804
4946
|
}
|
|
4805
4947
|
|
|
@@ -4808,37 +4950,40 @@ VK_DESTROY
|
|
|
4808
4950
|
*_alloc = entries[slot];
|
|
4809
4951
|
lru.free(slot);
|
|
4810
4952
|
totalSizeCached -= _alloc->size;
|
|
4953
|
+
|
|
4811
4954
|
return true;
|
|
4812
|
-
} else {
|
|
4813
|
-
return false;
|
|
4814
4955
|
}
|
|
4956
|
+
|
|
4957
|
+
return false;
|
|
4815
4958
|
}
|
|
4816
4959
|
|
|
4817
4960
|
void MemoryLruVK::evictAll()
|
|
4818
4961
|
{
|
|
4819
4962
|
uint16_t slot = lru.getFront();
|
|
4963
|
+
|
|
4820
4964
|
while (slot != UINT16_MAX)
|
|
4821
4965
|
{
|
|
4822
4966
|
release(entries[slot].mem);
|
|
4823
4967
|
slot = lru.getNext(slot);
|
|
4824
4968
|
}
|
|
4969
|
+
|
|
4825
4970
|
lru.reset();
|
|
4826
4971
|
totalSizeCached = 0;
|
|
4827
4972
|
}
|
|
4828
4973
|
|
|
4829
|
-
void
|
|
4974
|
+
void StagingScratchBufferVK::create(uint32_t _size, uint32_t _count, VkBufferUsageFlags usage, uint32_t _align)
|
|
4830
4975
|
{
|
|
4831
4976
|
const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
|
|
4832
4977
|
const VkDevice device = s_renderVK->m_device;
|
|
4833
4978
|
|
|
4834
4979
|
const uint32_t entrySize = bx::strideAlign(_size, _align);
|
|
4835
|
-
const uint32_t
|
|
4980
|
+
const uint32_t chunkSize = entrySize * _count;
|
|
4836
4981
|
|
|
4837
4982
|
VkBufferCreateInfo bci;
|
|
4838
4983
|
bci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
|
4839
4984
|
bci.pNext = NULL;
|
|
4840
4985
|
bci.flags = 0;
|
|
4841
|
-
bci.size =
|
|
4986
|
+
bci.size = chunkSize;
|
|
4842
4987
|
bci.usage = usage;
|
|
4843
4988
|
bci.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
|
4844
4989
|
bci.queueFamilyIndexCount = 0;
|
|
@@ -4868,7 +5013,7 @@ VK_DESTROY
|
|
|
4868
5013
|
}
|
|
4869
5014
|
|
|
4870
5015
|
m_size = (uint32_t)mr.size;
|
|
4871
|
-
|
|
5016
|
+
m_chunkPos = 0;
|
|
4872
5017
|
m_align = _align;
|
|
4873
5018
|
|
|
4874
5019
|
VK_CHECK(vkBindBufferMemory(device, m_buffer, m_deviceMem.mem, m_deviceMem.offset) );
|
|
@@ -4876,7 +5021,7 @@ VK_DESTROY
|
|
|
4876
5021
|
VK_CHECK(vkMapMemory(device, m_deviceMem.mem, m_deviceMem.offset, m_size, 0, (void**)&m_data) );
|
|
4877
5022
|
}
|
|
4878
5023
|
|
|
4879
|
-
void
|
|
5024
|
+
void StagingScratchBufferVK::createUniform(uint32_t _size, uint32_t _count)
|
|
4880
5025
|
{
|
|
4881
5026
|
const VkPhysicalDeviceLimits& deviceLimits = s_renderVK->m_deviceProperties.limits;
|
|
4882
5027
|
const uint32_t align = uint32_t(deviceLimits.minUniformBufferOffsetAlignment);
|
|
@@ -4884,7 +5029,7 @@ VK_DESTROY
|
|
|
4884
5029
|
create(_size, _count, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, align);
|
|
4885
5030
|
}
|
|
4886
5031
|
|
|
4887
|
-
void
|
|
5032
|
+
void StagingScratchBufferVK::createStaging(uint32_t _size)
|
|
4888
5033
|
{
|
|
4889
5034
|
const VkPhysicalDeviceLimits& deviceLimits = s_renderVK->m_deviceProperties.limits;
|
|
4890
5035
|
const uint32_t align = uint32_t(deviceLimits.optimalBufferCopyOffsetAlignment);
|
|
@@ -4892,7 +5037,7 @@ VK_DESTROY
|
|
|
4892
5037
|
create(_size, 1, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, align);
|
|
4893
5038
|
}
|
|
4894
5039
|
|
|
4895
|
-
void
|
|
5040
|
+
void StagingScratchBufferVK::destroy()
|
|
4896
5041
|
{
|
|
4897
5042
|
vkUnmapMemory(s_renderVK->m_device, m_deviceMem.mem);
|
|
4898
5043
|
|
|
@@ -4900,42 +5045,40 @@ VK_DESTROY
|
|
|
4900
5045
|
s_renderVK->recycleMemory(m_deviceMem);
|
|
4901
5046
|
}
|
|
4902
5047
|
|
|
4903
|
-
|
|
4904
|
-
uint32_t ScratchBufferVK::alloc(uint32_t _size, uint32_t _minAlign)
|
|
5048
|
+
uint32_t StagingScratchBufferVK::alloc(uint32_t _size, uint32_t _minAlign)
|
|
4905
5049
|
{
|
|
4906
5050
|
const uint32_t align = bx::uint32_lcm(m_align, _minAlign);
|
|
4907
|
-
const uint32_t
|
|
5051
|
+
const uint32_t offset = bx::strideAlign(m_chunkPos, align);
|
|
4908
5052
|
|
|
4909
|
-
if (
|
|
5053
|
+
if (offset + _size <= m_size)
|
|
4910
5054
|
{
|
|
4911
|
-
|
|
4912
|
-
return
|
|
5055
|
+
m_chunkPos = offset + _size;
|
|
5056
|
+
return offset;
|
|
4913
5057
|
}
|
|
4914
5058
|
|
|
4915
5059
|
return UINT32_MAX;
|
|
4916
5060
|
}
|
|
4917
5061
|
|
|
4918
|
-
uint32_t
|
|
5062
|
+
uint32_t StagingScratchBufferVK::write(const void* _data, uint32_t _size, uint32_t _minAlign)
|
|
4919
5063
|
{
|
|
4920
|
-
uint32_t
|
|
4921
|
-
BX_ASSERT(
|
|
5064
|
+
uint32_t offset = alloc(_size, _minAlign);
|
|
5065
|
+
BX_ASSERT(offset != UINT32_MAX, "Not enough space on ScratchBuffer left to allocate %u bytes with alignment %u.", _size, _minAlign);
|
|
4922
5066
|
|
|
4923
5067
|
if (_size > 0)
|
|
4924
5068
|
{
|
|
4925
|
-
bx::memCopy(&m_data[
|
|
5069
|
+
bx::memCopy(&m_data[offset], _data, _size);
|
|
4926
5070
|
}
|
|
4927
5071
|
|
|
4928
|
-
return
|
|
5072
|
+
return offset;
|
|
4929
5073
|
}
|
|
4930
5074
|
|
|
4931
|
-
|
|
4932
|
-
void ScratchBufferVK::flush(bool _reset)
|
|
5075
|
+
void StagingScratchBufferVK::flush(bool _reset)
|
|
4933
5076
|
{
|
|
4934
5077
|
const VkPhysicalDeviceLimits& deviceLimits = s_renderVK->m_deviceProperties.limits;
|
|
4935
5078
|
VkDevice device = s_renderVK->m_device;
|
|
4936
5079
|
|
|
4937
5080
|
const uint32_t align = uint32_t(deviceLimits.nonCoherentAtomSize);
|
|
4938
|
-
const uint32_t size = bx::min(bx::strideAlign(
|
|
5081
|
+
const uint32_t size = bx::min(bx::strideAlign(m_chunkPos, align), m_size);
|
|
4939
5082
|
|
|
4940
5083
|
VkMappedMemoryRange range;
|
|
4941
5084
|
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
|
@@ -4947,10 +5090,230 @@ VK_DESTROY
|
|
|
4947
5090
|
|
|
4948
5091
|
if (_reset)
|
|
4949
5092
|
{
|
|
4950
|
-
|
|
5093
|
+
m_chunkPos = 0;
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
void ChunkedScratchBufferVK::create(uint32_t _chunkSize, uint32_t _numChunks, VkBufferUsageFlags usage, uint32_t _align)
|
|
5098
|
+
{
|
|
5099
|
+
const uint32_t chunkSize = bx::alignUp(_chunkSize, 1<<20);
|
|
5100
|
+
|
|
5101
|
+
m_chunkPos = 0;
|
|
5102
|
+
m_chunkSize = chunkSize;
|
|
5103
|
+
m_align = _align;
|
|
5104
|
+
m_usage = usage;
|
|
5105
|
+
|
|
5106
|
+
m_chunkControl.m_size = 0;
|
|
5107
|
+
m_chunkControl.reset();
|
|
5108
|
+
|
|
5109
|
+
bx::memSet(m_consume, 0, sizeof(m_consume) );
|
|
5110
|
+
m_totalUsed = 0;
|
|
5111
|
+
|
|
5112
|
+
for (uint32_t ii = 0; ii < _numChunks; ++ii)
|
|
5113
|
+
{
|
|
5114
|
+
addChunk();
|
|
4951
5115
|
}
|
|
4952
5116
|
}
|
|
4953
5117
|
|
|
5118
|
+
void ChunkedScratchBufferVK::createUniform(uint32_t _chunkSize, uint32_t _numChunks)
|
|
5119
|
+
{
|
|
5120
|
+
const VkPhysicalDeviceLimits& deviceLimits = s_renderVK->m_deviceProperties.limits;
|
|
5121
|
+
const uint32_t align = uint32_t(deviceLimits.minUniformBufferOffsetAlignment);
|
|
5122
|
+
|
|
5123
|
+
create(_chunkSize, _numChunks, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, align);
|
|
5124
|
+
}
|
|
5125
|
+
|
|
5126
|
+
void ChunkedScratchBufferVK::destroy()
|
|
5127
|
+
{
|
|
5128
|
+
for (Chunk& sbc : m_chunks)
|
|
5129
|
+
{
|
|
5130
|
+
vkUnmapMemory(s_renderVK->m_device, sbc.deviceMem.mem);
|
|
5131
|
+
|
|
5132
|
+
s_renderVK->release(sbc.buffer);
|
|
5133
|
+
s_renderVK->recycleMemory(sbc.deviceMem);
|
|
5134
|
+
}
|
|
5135
|
+
}
|
|
5136
|
+
|
|
5137
|
+
void ChunkedScratchBufferVK::addChunk(uint32_t _at)
|
|
5138
|
+
{
|
|
5139
|
+
const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
|
|
5140
|
+
const VkDevice device = s_renderVK->m_device;
|
|
5141
|
+
|
|
5142
|
+
Chunk sbc;
|
|
5143
|
+
|
|
5144
|
+
VkBufferCreateInfo bci =
|
|
5145
|
+
{
|
|
5146
|
+
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
|
5147
|
+
.pNext = NULL,
|
|
5148
|
+
.flags = 0,
|
|
5149
|
+
.size = m_chunkSize,
|
|
5150
|
+
.usage = m_usage,
|
|
5151
|
+
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
|
5152
|
+
.queueFamilyIndexCount = 0,
|
|
5153
|
+
.pQueueFamilyIndices = NULL,
|
|
5154
|
+
};
|
|
5155
|
+
|
|
5156
|
+
VK_CHECK(vkCreateBuffer(
|
|
5157
|
+
device
|
|
5158
|
+
, &bci
|
|
5159
|
+
, allocatorCb
|
|
5160
|
+
, &sbc.buffer
|
|
5161
|
+
) );
|
|
5162
|
+
|
|
5163
|
+
VkMemoryRequirements mr;
|
|
5164
|
+
vkGetBufferMemoryRequirements(
|
|
5165
|
+
device
|
|
5166
|
+
, sbc.buffer
|
|
5167
|
+
, &mr
|
|
5168
|
+
);
|
|
5169
|
+
|
|
5170
|
+
VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
|
5171
|
+
VkResult result = s_renderVK->allocateMemory(&mr, flags, &sbc.deviceMem, true);
|
|
5172
|
+
|
|
5173
|
+
if (VK_SUCCESS != result)
|
|
5174
|
+
{
|
|
5175
|
+
flags &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
|
|
5176
|
+
VK_CHECK(s_renderVK->allocateMemory(&mr, flags, &sbc.deviceMem, true) );
|
|
5177
|
+
}
|
|
5178
|
+
|
|
5179
|
+
m_chunkSize = bx::narrowCast<uint32_t>(mr.size);
|
|
5180
|
+
|
|
5181
|
+
VK_CHECK(vkBindBufferMemory(device, sbc.buffer, sbc.deviceMem.mem, sbc.deviceMem.offset) );
|
|
5182
|
+
|
|
5183
|
+
VK_CHECK(vkMapMemory(device, sbc.deviceMem.mem, sbc.deviceMem.offset, m_chunkSize, 0, (void**)&sbc.data) );
|
|
5184
|
+
|
|
5185
|
+
const uint32_t lastChunk = bx::max(uint32_t(m_chunks.size()-1), 1);
|
|
5186
|
+
const uint32_t at = UINT32_MAX == _at ? lastChunk : _at;
|
|
5187
|
+
const uint32_t chunkIndex = at % bx::max(m_chunks.size(), 1);
|
|
5188
|
+
|
|
5189
|
+
m_chunkControl.resize(m_chunkSize);
|
|
5190
|
+
|
|
5191
|
+
m_chunks.insert(m_chunks.begin() + chunkIndex, sbc);
|
|
5192
|
+
}
|
|
5193
|
+
|
|
5194
|
+
ChunkedScratchBufferAlloc ChunkedScratchBufferVK::alloc(uint32_t _size)
|
|
5195
|
+
{
|
|
5196
|
+
BX_ASSERT(_size < m_chunkSize, "Size can't be larger than chunk size (size: %d, chunk size: %d)!", _size, m_chunkSize);
|
|
5197
|
+
|
|
5198
|
+
uint32_t offset = m_chunkPos;
|
|
5199
|
+
uint32_t nextOffset = offset + _size;
|
|
5200
|
+
uint32_t chunkIdx = m_chunkControl.m_write/m_chunkSize;
|
|
5201
|
+
|
|
5202
|
+
if (nextOffset >= m_chunkSize)
|
|
5203
|
+
{
|
|
5204
|
+
const uint32_t total = m_chunkSize - m_chunkPos + _size;
|
|
5205
|
+
uint32_t reserved = m_chunkControl.reserve(total, true);
|
|
5206
|
+
|
|
5207
|
+
if (total != reserved)
|
|
5208
|
+
{
|
|
5209
|
+
addChunk(chunkIdx + 1);
|
|
5210
|
+
reserved = m_chunkControl.reserve(total, true);
|
|
5211
|
+
BX_ASSERT(total == reserved, "Failed to reserve chunk memory after adding chunk.");
|
|
5212
|
+
}
|
|
5213
|
+
|
|
5214
|
+
m_chunkPos = 0;
|
|
5215
|
+
offset = 0;
|
|
5216
|
+
nextOffset = _size;
|
|
5217
|
+
chunkIdx = m_chunkControl.m_write/m_chunkSize;
|
|
5218
|
+
}
|
|
5219
|
+
else
|
|
5220
|
+
{
|
|
5221
|
+
const uint32_t size = m_chunkControl.reserve(_size, true);
|
|
5222
|
+
BX_ASSERT(size == _size, "Failed to reserve chunk memory.");
|
|
5223
|
+
BX_UNUSED(size);
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
m_chunkPos = nextOffset;
|
|
5227
|
+
|
|
5228
|
+
return { .offset = offset, .chunkIdx = chunkIdx };
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
void ChunkedScratchBufferVK::write(ChunkedScratchBufferOffset& _outSbo, const void* _vsData, uint32_t _vsSize, const void* _fsData, uint32_t _fsSize)
|
|
5232
|
+
{
|
|
5233
|
+
const uint32_t vsSize = bx::strideAlign(_vsSize, m_align);
|
|
5234
|
+
const uint32_t fsSize = bx::strideAlign(_fsSize, m_align);
|
|
5235
|
+
const uint32_t size = vsSize + fsSize;
|
|
5236
|
+
|
|
5237
|
+
const ChunkedScratchBufferAlloc sba = alloc(size);
|
|
5238
|
+
|
|
5239
|
+
const uint32_t offset0 = sba.offset;
|
|
5240
|
+
const uint32_t offset1 = offset0 + vsSize;
|
|
5241
|
+
|
|
5242
|
+
const Chunk& sbc = m_chunks[sba.chunkIdx];
|
|
5243
|
+
|
|
5244
|
+
_outSbo.buffer = sbc.buffer;
|
|
5245
|
+
_outSbo.offsets[0] = offset0;
|
|
5246
|
+
_outSbo.offsets[1] = offset1;
|
|
5247
|
+
|
|
5248
|
+
if (NULL != _vsData)
|
|
5249
|
+
{
|
|
5250
|
+
bx::memCopy(&sbc.data[offset0], _vsData, _vsSize);
|
|
5251
|
+
}
|
|
5252
|
+
|
|
5253
|
+
if (NULL != _fsData)
|
|
5254
|
+
{
|
|
5255
|
+
bx::memCopy(&sbc.data[offset1], _fsData, _fsSize);
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
|
|
5259
|
+
void ChunkedScratchBufferVK::begin()
|
|
5260
|
+
{
|
|
5261
|
+
BX_ASSERT(0 == m_chunkPos, "");
|
|
5262
|
+
const uint32_t numConsumed = m_consume[s_renderVK->m_cmd.m_currentFrameInFlight];
|
|
5263
|
+
m_chunkControl.consume(numConsumed);
|
|
5264
|
+
}
|
|
5265
|
+
|
|
5266
|
+
void ChunkedScratchBufferVK::end()
|
|
5267
|
+
{
|
|
5268
|
+
uint32_t numFlush = m_chunkControl.getNumReserved();
|
|
5269
|
+
|
|
5270
|
+
if (0 != m_chunkPos)
|
|
5271
|
+
{
|
|
5272
|
+
retry:
|
|
5273
|
+
const uint32_t remainder = m_chunkSize - m_chunkPos;
|
|
5274
|
+
const uint32_t rem = m_chunkControl.reserve(remainder, true);
|
|
5275
|
+
|
|
5276
|
+
if (rem != remainder)
|
|
5277
|
+
{
|
|
5278
|
+
const uint32_t chunkIdx = m_chunkControl.m_write/m_chunkSize;
|
|
5279
|
+
addChunk(chunkIdx + 1);
|
|
5280
|
+
goto retry;
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
m_chunkPos = 0;
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5286
|
+
const VkPhysicalDeviceLimits& deviceLimits = s_renderVK->m_deviceProperties.limits;
|
|
5287
|
+
const uint32_t align = uint32_t(deviceLimits.nonCoherentAtomSize);
|
|
5288
|
+
|
|
5289
|
+
VkDevice device = s_renderVK->m_device;
|
|
5290
|
+
|
|
5291
|
+
const uint32_t numReserved = m_chunkControl.getNumReserved();
|
|
5292
|
+
BX_ASSERT(0 == numReserved % m_chunkSize, "Number of reserved must always be aligned to chunk size!");
|
|
5293
|
+
|
|
5294
|
+
const uint32_t first = m_chunkControl.m_current / m_chunkSize;
|
|
5295
|
+
|
|
5296
|
+
for (uint32_t ii = first, end = numReserved / m_chunkSize + first; ii < end; ++ii)
|
|
5297
|
+
{
|
|
5298
|
+
const Chunk& chunk = m_chunks[ii % m_chunks.size()];
|
|
5299
|
+
|
|
5300
|
+
VkMappedMemoryRange range;
|
|
5301
|
+
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
|
5302
|
+
range.pNext = NULL;
|
|
5303
|
+
range.memory = chunk.deviceMem.mem;
|
|
5304
|
+
range.offset = chunk.deviceMem.offset;
|
|
5305
|
+
range.size = bx::alignUp(bx::min(numFlush, m_chunkSize), align);
|
|
5306
|
+
VK_CHECK(vkFlushMappedMemoryRanges(device, 1, &range) );
|
|
5307
|
+
|
|
5308
|
+
m_chunkControl.commit(m_chunkSize);
|
|
5309
|
+
numFlush -= m_chunkSize;
|
|
5310
|
+
}
|
|
5311
|
+
|
|
5312
|
+
m_consume[s_renderVK->m_cmd.m_currentFrameInFlight] = numReserved;
|
|
5313
|
+
|
|
5314
|
+
m_totalUsed = m_chunkControl.getNumUsed();
|
|
5315
|
+
}
|
|
5316
|
+
|
|
4954
5317
|
void BufferVK::create(VkCommandBuffer _commandBuffer, uint32_t _size, void* _data, uint16_t _flags, bool _vertex, uint32_t _stride)
|
|
4955
5318
|
{
|
|
4956
5319
|
BX_UNUSED(_stride);
|
|
@@ -4999,7 +5362,7 @@ VK_DESTROY
|
|
|
4999
5362
|
BGFX_PROFILER_SCOPE("BufferVK::update", kColorFrame);
|
|
5000
5363
|
BX_UNUSED(_discard);
|
|
5001
5364
|
|
|
5002
|
-
StagingBufferVK stagingBuffer = s_renderVK->allocFromScratchStagingBuffer(_size,
|
|
5365
|
+
StagingBufferVK stagingBuffer = s_renderVK->allocFromScratchStagingBuffer(_size, 16, _data);
|
|
5003
5366
|
|
|
5004
5367
|
VkBufferCopy region;
|
|
5005
5368
|
region.srcOffset = stagingBuffer.m_offset;
|
|
@@ -5289,6 +5652,7 @@ VK_DESTROY
|
|
|
5289
5652
|
smci.codeSize = m_code->size;
|
|
5290
5653
|
smci.pCode = (const uint32_t*)m_code->data;
|
|
5291
5654
|
|
|
5655
|
+
BX_TRACE("%x", bx::hash<bx::HashMurmur3>(code, shaderSize) );
|
|
5292
5656
|
VK_CHECK(vkCreateShaderModule(
|
|
5293
5657
|
s_renderVK->m_device
|
|
5294
5658
|
, &smci
|
|
@@ -5505,7 +5869,7 @@ VK_DESTROY
|
|
|
5505
5869
|
|
|
5506
5870
|
if (NULL != m_fsh)
|
|
5507
5871
|
{
|
|
5508
|
-
for (uint16_t ii = 0; ii < m_fsh->m_numBindings; ii
|
|
5872
|
+
for (uint16_t ii = 0; ii < m_fsh->m_numBindings; ++ii)
|
|
5509
5873
|
{
|
|
5510
5874
|
const VkDescriptorSetLayoutBinding& fsBinding = m_fsh->m_bindings[ii];
|
|
5511
5875
|
uint16_t vsBindingIdx = UINT16_MAX;
|
|
@@ -5675,7 +6039,7 @@ VK_DESTROY
|
|
|
5675
6039
|
|
|
5676
6040
|
Query& query = m_query[_idx];
|
|
5677
6041
|
query.m_ready = true;
|
|
5678
|
-
query.m_completed = s_renderVK->m_cmd.m_submitted + s_renderVK->
|
|
6042
|
+
query.m_completed = s_renderVK->m_cmd.m_submitted + s_renderVK->m_maxFrameLatency;
|
|
5679
6043
|
|
|
5680
6044
|
const VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
|
5681
6045
|
const uint32_t offset = _idx * 2 + 0;
|
|
@@ -5702,7 +6066,7 @@ VK_DESTROY
|
|
|
5702
6066
|
|
|
5703
6067
|
bool TimerQueryVK::update()
|
|
5704
6068
|
{
|
|
5705
|
-
if (0 != m_control.
|
|
6069
|
+
if (0 != m_control.getNumUsed() )
|
|
5706
6070
|
{
|
|
5707
6071
|
uint32_t idx = m_control.m_read;
|
|
5708
6072
|
Query& query = m_query[idx];
|
|
@@ -5819,7 +6183,7 @@ VK_DESTROY
|
|
|
5819
6183
|
{
|
|
5820
6184
|
BGFX_PROFILER_SCOPE("OcclusionQueryVK::flush", kColorFrame);
|
|
5821
6185
|
|
|
5822
|
-
if (0 < m_control.
|
|
6186
|
+
if (0 < m_control.getNumUsed() )
|
|
5823
6187
|
{
|
|
5824
6188
|
VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
|
5825
6189
|
|
|
@@ -5827,7 +6191,7 @@ VK_DESTROY
|
|
|
5827
6191
|
|
|
5828
6192
|
// need to copy each result individually because VK_QUERY_RESULT_WAIT_BIT causes
|
|
5829
6193
|
// vkWaitForFences to hang indefinitely if we copy all results (including unavailable ones)
|
|
5830
|
-
for (uint32_t ii = 0, num = m_control.
|
|
6194
|
+
for (uint32_t ii = 0, num = m_control.getNumUsed(); ii < num; ++ii)
|
|
5831
6195
|
{
|
|
5832
6196
|
const OcclusionQueryHandle& handle = m_handle[(m_control.m_read + ii) % size];
|
|
5833
6197
|
if (isValid(handle) )
|
|
@@ -5860,7 +6224,7 @@ VK_DESTROY
|
|
|
5860
6224
|
|
|
5861
6225
|
void OcclusionQueryVK::resolve(Frame* _render)
|
|
5862
6226
|
{
|
|
5863
|
-
while (0 != m_control.
|
|
6227
|
+
while (0 != m_control.getNumUsed() )
|
|
5864
6228
|
{
|
|
5865
6229
|
OcclusionQueryHandle handle = m_handle[m_control.m_read];
|
|
5866
6230
|
if (isValid(handle) )
|
|
@@ -5875,7 +6239,7 @@ VK_DESTROY
|
|
|
5875
6239
|
{
|
|
5876
6240
|
const uint32_t size = m_control.m_size;
|
|
5877
6241
|
|
|
5878
|
-
for (uint32_t ii = 0, num = m_control.
|
|
6242
|
+
for (uint32_t ii = 0, num = m_control.getNumUsed(); ii < num; ++ii)
|
|
5879
6243
|
{
|
|
5880
6244
|
OcclusionQueryHandle& handle = m_handle[(m_control.m_read + ii) % size];
|
|
5881
6245
|
if (handle.idx == _handle.idx)
|
|
@@ -6015,13 +6379,13 @@ VK_DESTROY
|
|
|
6015
6379
|
? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL
|
|
6016
6380
|
: VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL
|
|
6017
6381
|
;
|
|
6018
|
-
|
|
6382
|
+
setState(_commandBuffer, layout);
|
|
6019
6383
|
}
|
|
6020
6384
|
|
|
6021
6385
|
return result;
|
|
6022
6386
|
}
|
|
6023
6387
|
|
|
6024
|
-
VkResult TextureVK::createImages(VkCommandBuffer _commandBuffer)
|
|
6388
|
+
VkResult TextureVK::createImages(VkCommandBuffer _commandBuffer, uint64_t _external)
|
|
6025
6389
|
{
|
|
6026
6390
|
BGFX_PROFILER_SCOPE("TextureVK::createImages", kColorResource);
|
|
6027
6391
|
|
|
@@ -6080,28 +6444,40 @@ VK_DESTROY
|
|
|
6080
6444
|
;
|
|
6081
6445
|
ici.tiling = VK_IMAGE_TILING_OPTIMAL;
|
|
6082
6446
|
|
|
6083
|
-
|
|
6084
|
-
if (VK_SUCCESS != result)
|
|
6447
|
+
if (0 != _external)
|
|
6085
6448
|
{
|
|
6086
|
-
|
|
6087
|
-
|
|
6449
|
+
static_assert(sizeof(m_textureImage) == sizeof(_external), "Size must match!");
|
|
6450
|
+
bx::memCopy(&m_textureImage, &_external, sizeof(VkImage) );
|
|
6451
|
+
m_textureDeviceMem = {};
|
|
6452
|
+
m_flags |= BGFX_SAMPLER_INTERNAL_SHARED;
|
|
6453
|
+
|
|
6454
|
+
s_renderVK->m_cmd.addExternal({ uint16_t(this - s_renderVK->m_textures) });
|
|
6088
6455
|
}
|
|
6456
|
+
else
|
|
6457
|
+
{
|
|
6458
|
+
result = vkCreateImage(device, &ici, allocatorCb, &m_textureImage);
|
|
6459
|
+
if (VK_SUCCESS != result)
|
|
6460
|
+
{
|
|
6461
|
+
BX_TRACE("Create texture image error: vkCreateImage failed %d: %s.", result, getName(result) );
|
|
6462
|
+
return result;
|
|
6463
|
+
}
|
|
6089
6464
|
|
|
6090
|
-
|
|
6091
|
-
|
|
6465
|
+
VkMemoryRequirements imageMemReq;
|
|
6466
|
+
vkGetImageMemoryRequirements(device, m_textureImage, &imageMemReq);
|
|
6092
6467
|
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6468
|
+
result = s_renderVK->allocateMemory(&imageMemReq, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &m_textureDeviceMem, false);
|
|
6469
|
+
if (VK_SUCCESS != result)
|
|
6470
|
+
{
|
|
6471
|
+
BX_TRACE("Create texture image error: allocateMemory failed %d: %s.", result, getName(result) );
|
|
6472
|
+
return result;
|
|
6473
|
+
}
|
|
6099
6474
|
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6475
|
+
result = vkBindImageMemory(device, m_textureImage, m_textureDeviceMem.mem, m_textureDeviceMem.offset);
|
|
6476
|
+
if (VK_SUCCESS != result)
|
|
6477
|
+
{
|
|
6478
|
+
BX_TRACE("Create texture image error: vkBindImageMemory failed %d: %s.", result, getName(result) );
|
|
6479
|
+
return result;
|
|
6480
|
+
}
|
|
6105
6481
|
}
|
|
6106
6482
|
|
|
6107
6483
|
m_sampledLayout = m_flags & BGFX_TEXTURE_COMPUTE_WRITE
|
|
@@ -6147,13 +6523,13 @@ VK_DESTROY
|
|
|
6147
6523
|
return result;
|
|
6148
6524
|
}
|
|
6149
6525
|
|
|
6150
|
-
|
|
6526
|
+
setState(_commandBuffer, m_sampledLayout, true);
|
|
6151
6527
|
}
|
|
6152
6528
|
|
|
6153
6529
|
return result;
|
|
6154
6530
|
}
|
|
6155
6531
|
|
|
6156
|
-
void* TextureVK::create(VkCommandBuffer _commandBuffer, const Memory* _mem, uint64_t _flags, uint8_t _skip)
|
|
6532
|
+
void* TextureVK::create(VkCommandBuffer _commandBuffer, const Memory* _mem, uint64_t _flags, uint8_t _skip, uint64_t _external)
|
|
6157
6533
|
{
|
|
6158
6534
|
BGFX_PROFILER_SCOPE("TextureVK::create", kColorResource);
|
|
6159
6535
|
|
|
@@ -6227,12 +6603,13 @@ VK_DESTROY
|
|
|
6227
6603
|
const bool compressed = bimg::isCompressed(bimg::TextureFormat::Enum(m_textureFormat) );
|
|
6228
6604
|
const bool swizzle = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags & BGFX_TEXTURE_COMPUTE_WRITE);
|
|
6229
6605
|
|
|
6230
|
-
const bool writeOnly
|
|
6231
|
-
const bool computeWrite
|
|
6232
|
-
const bool renderTarget
|
|
6233
|
-
const bool blit
|
|
6606
|
+
const bool writeOnly = 0 != (m_flags & BGFX_TEXTURE_RT_WRITE_ONLY);
|
|
6607
|
+
const bool computeWrite = 0 != (m_flags & BGFX_TEXTURE_COMPUTE_WRITE);
|
|
6608
|
+
const bool renderTarget = 0 != (m_flags & BGFX_TEXTURE_RT_MASK);
|
|
6609
|
+
const bool blit = 0 != (m_flags & BGFX_TEXTURE_BLIT_DST);
|
|
6610
|
+
const bool externalShared = 0 != (m_flags & BGFX_TEXTURE_EXTERNAL_SHARED);
|
|
6234
6611
|
|
|
6235
|
-
BX_UNUSED(swizzle, writeOnly, computeWrite, renderTarget, blit);
|
|
6612
|
+
BX_UNUSED(swizzle, writeOnly, computeWrite, renderTarget, blit, externalShared);
|
|
6236
6613
|
|
|
6237
6614
|
BX_TRACE(
|
|
6238
6615
|
"Texture %3d: %s (requested: %s), %dx%dx%d%s RT[%c], BO[%c], CW[%c]%s."
|
|
@@ -6249,7 +6626,7 @@ VK_DESTROY
|
|
|
6249
6626
|
, swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
|
|
6250
6627
|
);
|
|
6251
6628
|
|
|
6252
|
-
VK_CHECK(createImages(_commandBuffer) );
|
|
6629
|
+
VK_CHECK(createImages(_commandBuffer, _external) );
|
|
6253
6630
|
|
|
6254
6631
|
// decode images
|
|
6255
6632
|
struct ImageInfo
|
|
@@ -6431,10 +6808,6 @@ VK_DESTROY
|
|
|
6431
6808
|
s_renderVK->recycleMemory(stagingBuffer.m_deviceMem);
|
|
6432
6809
|
}
|
|
6433
6810
|
}
|
|
6434
|
-
else
|
|
6435
|
-
{
|
|
6436
|
-
setImageMemoryBarrier(_commandBuffer, m_sampledLayout);
|
|
6437
|
-
}
|
|
6438
6811
|
|
|
6439
6812
|
bx::free(g_allocator, bufferCopyInfo);
|
|
6440
6813
|
|
|
@@ -6457,10 +6830,20 @@ VK_DESTROY
|
|
|
6457
6830
|
|
|
6458
6831
|
m_readback.destroy();
|
|
6459
6832
|
|
|
6460
|
-
|
|
6833
|
+
const bool external = 0 != (m_flags & BGFX_SAMPLER_INTERNAL_SHARED);
|
|
6834
|
+
// const bool externalShared = 0 != (m_flags & BGFX_TEXTURE_EXTERNAL_SHARED);
|
|
6835
|
+
|
|
6836
|
+
if (external)
|
|
6837
|
+
{
|
|
6838
|
+
s_renderVK->m_cmd.removeExternal({ uint16_t(this - s_renderVK->m_textures) });
|
|
6839
|
+
}
|
|
6840
|
+
else
|
|
6461
6841
|
{
|
|
6462
|
-
|
|
6463
|
-
|
|
6842
|
+
if (VK_NULL_HANDLE != m_textureImage)
|
|
6843
|
+
{
|
|
6844
|
+
s_renderVK->release(m_textureImage);
|
|
6845
|
+
s_renderVK->recycleMemory(m_textureDeviceMem);
|
|
6846
|
+
}
|
|
6464
6847
|
}
|
|
6465
6848
|
|
|
6466
6849
|
if (VK_NULL_HANDLE != m_singleMsaaImage)
|
|
@@ -6580,8 +6963,8 @@ VK_DESTROY
|
|
|
6580
6963
|
|
|
6581
6964
|
if (needResolve)
|
|
6582
6965
|
{
|
|
6583
|
-
|
|
6584
|
-
|
|
6966
|
+
setState(_commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
|
6967
|
+
setState(_commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true);
|
|
6585
6968
|
|
|
6586
6969
|
VkImageResolve resolve;
|
|
6587
6970
|
resolve.srcOffset.x = 0;
|
|
@@ -6617,7 +7000,7 @@ VK_DESTROY
|
|
|
6617
7000
|
{
|
|
6618
7001
|
BGFX_PROFILER_SCOPE("Resolve - Generate Mipmaps", kColorResource);
|
|
6619
7002
|
|
|
6620
|
-
|
|
7003
|
+
setState(_commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
|
6621
7004
|
|
|
6622
7005
|
int32_t mipWidth = bx::max<int32_t>(int32_t(m_width) >> _mip, 1);
|
|
6623
7006
|
int32_t mipHeight = bx::max<int32_t>(int32_t(m_height) >> _mip, 1);
|
|
@@ -6654,7 +7037,7 @@ VK_DESTROY
|
|
|
6654
7037
|
blit.dstOffsets[1] = { mipWidth, mipHeight, 1 };
|
|
6655
7038
|
blit.dstSubresource.mipLevel = i;
|
|
6656
7039
|
|
|
6657
|
-
|
|
7040
|
+
setImageMemoryBarrier(
|
|
6658
7041
|
_commandBuffer
|
|
6659
7042
|
, m_textureImage
|
|
6660
7043
|
, m_aspectFlags
|
|
@@ -6678,7 +7061,7 @@ VK_DESTROY
|
|
|
6678
7061
|
);
|
|
6679
7062
|
}
|
|
6680
7063
|
|
|
6681
|
-
|
|
7064
|
+
setImageMemoryBarrier(
|
|
6682
7065
|
_commandBuffer
|
|
6683
7066
|
, m_textureImage
|
|
6684
7067
|
, m_aspectFlags
|
|
@@ -6691,8 +7074,8 @@ VK_DESTROY
|
|
|
6691
7074
|
);
|
|
6692
7075
|
}
|
|
6693
7076
|
|
|
6694
|
-
|
|
6695
|
-
|
|
7077
|
+
setState(_commandBuffer, oldLayout);
|
|
7078
|
+
setState(_commandBuffer, oldSingleMsaaLayout, true);
|
|
6696
7079
|
}
|
|
6697
7080
|
|
|
6698
7081
|
void TextureVK::copyBufferToTexture(VkCommandBuffer _commandBuffer, VkBuffer _stagingBuffer, uint32_t _bufferImageCopyCount, VkBufferImageCopy* _bufferImageCopy)
|
|
@@ -6704,7 +7087,7 @@ VK_DESTROY
|
|
|
6704
7087
|
: m_currentImageLayout
|
|
6705
7088
|
;
|
|
6706
7089
|
|
|
6707
|
-
|
|
7090
|
+
setState(_commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
|
6708
7091
|
|
|
6709
7092
|
bimg::TextureFormat::Enum format = bimg::TextureFormat::Enum(m_textureFormat);
|
|
6710
7093
|
const bimg::ImageBlockInfo& blockInfo = bimg::getBlockInfo(format);
|
|
@@ -6727,14 +7110,15 @@ VK_DESTROY
|
|
|
6727
7110
|
, _bufferImageCopy
|
|
6728
7111
|
);
|
|
6729
7112
|
|
|
6730
|
-
|
|
7113
|
+
setState(_commandBuffer, oldLayout);
|
|
6731
7114
|
}
|
|
6732
7115
|
|
|
6733
|
-
|
|
7116
|
+
void TextureVK::setState(VkCommandBuffer _commandBuffer, VkImageLayout _newImageLayout, bool _singleMsaaImage)
|
|
6734
7117
|
{
|
|
6735
|
-
if (_singleMsaaImage
|
|
7118
|
+
if (_singleMsaaImage
|
|
7119
|
+
&& VK_NULL_HANDLE == m_singleMsaaImage)
|
|
6736
7120
|
{
|
|
6737
|
-
return
|
|
7121
|
+
return;
|
|
6738
7122
|
}
|
|
6739
7123
|
|
|
6740
7124
|
VkImageLayout& currentLayout = _singleMsaaImage
|
|
@@ -6742,28 +7126,23 @@ VK_DESTROY
|
|
|
6742
7126
|
: m_currentImageLayout
|
|
6743
7127
|
;
|
|
6744
7128
|
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
if (currentLayout == _newImageLayout)
|
|
7129
|
+
if (currentLayout != _newImageLayout)
|
|
6748
7130
|
{
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
? m_singleMsaaImage
|
|
6754
|
-
: m_textureImage
|
|
6755
|
-
;
|
|
7131
|
+
const VkImage image = _singleMsaaImage
|
|
7132
|
+
? m_singleMsaaImage
|
|
7133
|
+
: m_textureImage
|
|
7134
|
+
;
|
|
6756
7135
|
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
7136
|
+
setImageMemoryBarrier(
|
|
7137
|
+
_commandBuffer
|
|
7138
|
+
, image
|
|
7139
|
+
, m_aspectFlags
|
|
7140
|
+
, currentLayout
|
|
7141
|
+
, _newImageLayout
|
|
7142
|
+
);
|
|
6764
7143
|
|
|
6765
|
-
|
|
6766
|
-
|
|
7144
|
+
currentLayout = _newImageLayout;
|
|
7145
|
+
}
|
|
6767
7146
|
}
|
|
6768
7147
|
|
|
6769
7148
|
VkResult TextureVK::createView(uint32_t _layer, uint32_t _numLayers, uint32_t _mip, uint32_t _numMips, VkImageViewType _type, VkImageAspectFlags _aspectMask, bool _renderTarget, ::VkImageView* _view) const
|
|
@@ -6773,18 +7152,18 @@ VK_DESTROY
|
|
|
6773
7152
|
if (VK_IMAGE_VIEW_TYPE_3D == m_type)
|
|
6774
7153
|
{
|
|
6775
7154
|
BX_ASSERT(false
|
|
6776
|
-
|
|
6777
|
-
|
|
7155
|
+
|| !_renderTarget
|
|
7156
|
+
|| !(m_aspectFlags & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT) )
|
|
6778
7157
|
, "3D image can't be a depth attachment"
|
|
6779
|
-
|
|
7158
|
+
);
|
|
6780
7159
|
}
|
|
6781
7160
|
|
|
6782
7161
|
if (VK_IMAGE_VIEW_TYPE_CUBE == _type
|
|
6783
7162
|
|| VK_IMAGE_VIEW_TYPE_CUBE_ARRAY == _type)
|
|
6784
7163
|
{
|
|
6785
7164
|
BX_ASSERT(_numLayers % 6 == 0, "");
|
|
6786
|
-
BX_ASSERT(
|
|
6787
|
-
|
|
7165
|
+
BX_ASSERT(false
|
|
7166
|
+
|| VK_IMAGE_VIEW_TYPE_3D != m_type
|
|
6788
7167
|
, "3D image can't be aliased as a cube texture"
|
|
6789
7168
|
);
|
|
6790
7169
|
}
|
|
@@ -7323,7 +7702,7 @@ VK_DESTROY
|
|
|
7323
7702
|
const VkColorSpaceKHR surfaceColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
|
7324
7703
|
|
|
7325
7704
|
const bool srgb = !!(m_resolution.reset & BGFX_RESET_SRGB_BACKBUFFER);
|
|
7326
|
-
m_colorFormat =
|
|
7705
|
+
m_colorFormat = m_resolution.formatColor;
|
|
7327
7706
|
m_depthFormat = bgfx::TextureFormat::UnknownDepth;
|
|
7328
7707
|
|
|
7329
7708
|
if (TextureFormat::Count == m_colorFormat)
|
|
@@ -7769,81 +8148,6 @@ VK_DESTROY
|
|
|
7769
8148
|
return idx;
|
|
7770
8149
|
}
|
|
7771
8150
|
|
|
7772
|
-
TextureFormat::Enum SwapChainVK::findSurfaceFormat(TextureFormat::Enum _format, VkColorSpaceKHR _colorSpace, bool _srgb)
|
|
7773
|
-
{
|
|
7774
|
-
BGFX_PROFILER_SCOPE("SwapChainVK::findSurfaceFormat", kColorFrame);
|
|
7775
|
-
|
|
7776
|
-
VkResult result = VK_SUCCESS;
|
|
7777
|
-
|
|
7778
|
-
TextureFormat::Enum selectedFormat = TextureFormat::Count;
|
|
7779
|
-
|
|
7780
|
-
const VkPhysicalDevice physicalDevice = s_renderVK->m_physicalDevice;
|
|
7781
|
-
|
|
7782
|
-
uint32_t numSurfaceFormats;
|
|
7783
|
-
result = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &numSurfaceFormats, NULL);
|
|
7784
|
-
|
|
7785
|
-
if (VK_SUCCESS != result)
|
|
7786
|
-
{
|
|
7787
|
-
BX_TRACE("findSurfaceFormat error: vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) );
|
|
7788
|
-
return selectedFormat;
|
|
7789
|
-
}
|
|
7790
|
-
|
|
7791
|
-
VkSurfaceFormatKHR* surfaceFormats = (VkSurfaceFormatKHR*)bx::alloc(g_allocator, numSurfaceFormats * sizeof(VkSurfaceFormatKHR) );
|
|
7792
|
-
result = vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, m_surface, &numSurfaceFormats, surfaceFormats);
|
|
7793
|
-
|
|
7794
|
-
if (VK_SUCCESS != result)
|
|
7795
|
-
{
|
|
7796
|
-
BX_TRACE("findSurfaceFormat error: vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) );
|
|
7797
|
-
bx::free(g_allocator, surfaceFormats);
|
|
7798
|
-
return selectedFormat;
|
|
7799
|
-
}
|
|
7800
|
-
|
|
7801
|
-
const TextureFormat::Enum requestedFormats[] =
|
|
7802
|
-
{
|
|
7803
|
-
_format,
|
|
7804
|
-
TextureFormat::BGRA8,
|
|
7805
|
-
TextureFormat::RGBA8,
|
|
7806
|
-
};
|
|
7807
|
-
|
|
7808
|
-
for (uint32_t ii = 0; ii < BX_COUNTOF(requestedFormats) && TextureFormat::Count == selectedFormat; ii++)
|
|
7809
|
-
{
|
|
7810
|
-
const TextureFormat::Enum requested = requestedFormats[ii];
|
|
7811
|
-
const VkFormat requestedVkFormat = _srgb
|
|
7812
|
-
? s_textureFormat[requested].m_fmtSrgb
|
|
7813
|
-
: s_textureFormat[requested].m_fmt
|
|
7814
|
-
;
|
|
7815
|
-
|
|
7816
|
-
for (uint32_t jj = 0; jj < numSurfaceFormats; jj++)
|
|
7817
|
-
{
|
|
7818
|
-
if (_colorSpace == surfaceFormats[jj].colorSpace
|
|
7819
|
-
&& requestedVkFormat == surfaceFormats[jj].format)
|
|
7820
|
-
{
|
|
7821
|
-
selectedFormat = requested;
|
|
7822
|
-
if (0 != ii
|
|
7823
|
-
&& s_renderVK->m_swapChainFormats[_format] != selectedFormat)
|
|
7824
|
-
{
|
|
7825
|
-
s_renderVK->m_swapChainFormats[_format] = selectedFormat;
|
|
7826
|
-
BX_TRACE(
|
|
7827
|
-
"findSurfaceFormat: Surface format %s not found! Defaulting to %s."
|
|
7828
|
-
, bimg::getName(bimg::TextureFormat::Enum(_format) )
|
|
7829
|
-
, bimg::getName(bimg::TextureFormat::Enum(selectedFormat) )
|
|
7830
|
-
);
|
|
7831
|
-
}
|
|
7832
|
-
break;
|
|
7833
|
-
}
|
|
7834
|
-
}
|
|
7835
|
-
}
|
|
7836
|
-
|
|
7837
|
-
bx::free(g_allocator, surfaceFormats);
|
|
7838
|
-
|
|
7839
|
-
if (TextureFormat::Count == selectedFormat)
|
|
7840
|
-
{
|
|
7841
|
-
BX_TRACE("findSurfaceFormat error: No supported surface format found.");
|
|
7842
|
-
}
|
|
7843
|
-
|
|
7844
|
-
return selectedFormat;
|
|
7845
|
-
}
|
|
7846
|
-
|
|
7847
8151
|
bool SwapChainVK::acquire(VkCommandBuffer _commandBuffer)
|
|
7848
8152
|
{
|
|
7849
8153
|
BGFX_PROFILER_SCOPE("SwapChainVK::acquire", kColorFrame);
|
|
@@ -7904,7 +8208,7 @@ VK_DESTROY
|
|
|
7904
8208
|
|
|
7905
8209
|
if (VK_NULL_HANDLE != m_backBufferFence[m_backBufferColorIdx])
|
|
7906
8210
|
{
|
|
7907
|
-
BGFX_PROFILER_SCOPE("vkWaitForFences",
|
|
8211
|
+
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorWait);
|
|
7908
8212
|
|
|
7909
8213
|
VK_CHECK(vkWaitForFences(
|
|
7910
8214
|
device
|
|
@@ -8249,13 +8553,12 @@ VK_DESTROY
|
|
|
8249
8553
|
;
|
|
8250
8554
|
}
|
|
8251
8555
|
|
|
8252
|
-
VkResult CommandQueueVK::init(uint32_t _queueFamily, VkQueue _queue
|
|
8556
|
+
VkResult CommandQueueVK::init(uint32_t _queueFamily, VkQueue _queue)
|
|
8253
8557
|
{
|
|
8254
|
-
m_queueFamily
|
|
8255
|
-
m_queue
|
|
8256
|
-
m_numFramesInFlight = bx::clamp<uint32_t>(_numFramesInFlight, 1, BGFX_CONFIG_MAX_FRAME_LATENCY);
|
|
8558
|
+
m_queueFamily = _queueFamily;
|
|
8559
|
+
m_queue = _queue;
|
|
8257
8560
|
m_activeCommandBuffer = VK_NULL_HANDLE;
|
|
8258
|
-
m_consumeIndex
|
|
8561
|
+
m_consumeIndex = 0;
|
|
8259
8562
|
|
|
8260
8563
|
return reset();
|
|
8261
8564
|
}
|
|
@@ -8298,7 +8601,7 @@ VK_DESTROY
|
|
|
8298
8601
|
const VkAllocationCallbacks* allocatorCb = s_renderVK->m_allocatorCb;
|
|
8299
8602
|
const VkDevice device = s_renderVK->m_device;
|
|
8300
8603
|
|
|
8301
|
-
for (uint32_t ii = 0; ii <
|
|
8604
|
+
for (uint32_t ii = 0, maxFrameLatency = s_renderVK->m_maxFrameLatency; ii < maxFrameLatency; ++ii)
|
|
8302
8605
|
{
|
|
8303
8606
|
result = vkCreateCommandPool(
|
|
8304
8607
|
device
|
|
@@ -8349,7 +8652,7 @@ VK_DESTROY
|
|
|
8349
8652
|
kick(true);
|
|
8350
8653
|
finish(true);
|
|
8351
8654
|
|
|
8352
|
-
for (uint32_t ii = 0; ii <
|
|
8655
|
+
for (uint32_t ii = 0, maxFrameLatency = s_renderVK->m_maxFrameLatency; ii < maxFrameLatency; ++ii)
|
|
8353
8656
|
{
|
|
8354
8657
|
vkDestroy(m_commandList[ii].m_fence);
|
|
8355
8658
|
m_commandList[ii].m_commandBuffer = VK_NULL_HANDLE;
|
|
@@ -8357,7 +8660,7 @@ VK_DESTROY
|
|
|
8357
8660
|
}
|
|
8358
8661
|
}
|
|
8359
8662
|
|
|
8360
|
-
VkResult CommandQueueVK::alloc(VkCommandBuffer*
|
|
8663
|
+
VkResult CommandQueueVK::alloc(VkCommandBuffer* _outCommandBuffer)
|
|
8361
8664
|
{
|
|
8362
8665
|
BGFX_PROFILER_SCOPE("CommandQueueVK::alloc", kColorResource);
|
|
8363
8666
|
|
|
@@ -8369,7 +8672,7 @@ VK_DESTROY
|
|
|
8369
8672
|
CommandList& commandList = m_commandList[m_currentFrameInFlight];
|
|
8370
8673
|
|
|
8371
8674
|
{
|
|
8372
|
-
BGFX_PROFILER_SCOPE("vkWaitForFences",
|
|
8675
|
+
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorWait);
|
|
8373
8676
|
|
|
8374
8677
|
result = vkWaitForFences(device, 1, &commandList.m_fence, VK_TRUE, UINT64_MAX);
|
|
8375
8678
|
}
|
|
@@ -8406,9 +8709,9 @@ VK_DESTROY
|
|
|
8406
8709
|
m_currentFence = commandList.m_fence;
|
|
8407
8710
|
}
|
|
8408
8711
|
|
|
8409
|
-
if (NULL !=
|
|
8712
|
+
if (NULL != _outCommandBuffer)
|
|
8410
8713
|
{
|
|
8411
|
-
*
|
|
8714
|
+
*_outCommandBuffer = m_activeCommandBuffer;
|
|
8412
8715
|
}
|
|
8413
8716
|
|
|
8414
8717
|
return result;
|
|
@@ -8439,6 +8742,11 @@ VK_DESTROY
|
|
|
8439
8742
|
{
|
|
8440
8743
|
const VkDevice device = s_renderVK->m_device;
|
|
8441
8744
|
|
|
8745
|
+
for (TextureHandle th : m_external)
|
|
8746
|
+
{
|
|
8747
|
+
s_renderVK->m_textures[th.idx].setState(m_activeCommandBuffer, VK_IMAGE_LAYOUT_GENERAL);
|
|
8748
|
+
}
|
|
8749
|
+
|
|
8442
8750
|
setMemoryBarrier(
|
|
8443
8751
|
m_activeCommandBuffer
|
|
8444
8752
|
, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT
|
|
@@ -8474,13 +8782,14 @@ VK_DESTROY
|
|
|
8474
8782
|
|
|
8475
8783
|
if (_wait)
|
|
8476
8784
|
{
|
|
8477
|
-
BGFX_PROFILER_SCOPE("vkWaitForFences",
|
|
8785
|
+
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorWait);
|
|
8786
|
+
|
|
8478
8787
|
VK_CHECK(vkWaitForFences(device, 1, &m_completedFence, VK_TRUE, UINT64_MAX) );
|
|
8479
8788
|
}
|
|
8480
8789
|
|
|
8481
8790
|
m_activeCommandBuffer = VK_NULL_HANDLE;
|
|
8482
8791
|
|
|
8483
|
-
m_currentFrameInFlight = (m_currentFrameInFlight + 1) %
|
|
8792
|
+
m_currentFrameInFlight = (m_currentFrameInFlight + 1) % s_renderVK->m_maxFrameLatency;
|
|
8484
8793
|
m_submitted++;
|
|
8485
8794
|
}
|
|
8486
8795
|
}
|
|
@@ -8491,7 +8800,7 @@ VK_DESTROY
|
|
|
8491
8800
|
|
|
8492
8801
|
if (_finishAll)
|
|
8493
8802
|
{
|
|
8494
|
-
for (uint32_t ii = 0; ii <
|
|
8803
|
+
for (uint32_t ii = 0, maxFrameLatency = s_renderVK->m_maxFrameLatency; ii < maxFrameLatency; ++ii)
|
|
8495
8804
|
{
|
|
8496
8805
|
consume();
|
|
8497
8806
|
}
|
|
@@ -8521,12 +8830,13 @@ VK_DESTROY
|
|
|
8521
8830
|
{
|
|
8522
8831
|
BGFX_PROFILER_SCOPE("CommandQueueVK::consume", kColorResource);
|
|
8523
8832
|
|
|
8524
|
-
m_consumeIndex = (m_consumeIndex + 1) %
|
|
8833
|
+
m_consumeIndex = (m_consumeIndex + 1) % s_renderVK->m_maxFrameLatency;
|
|
8525
8834
|
|
|
8526
|
-
for (DeviceMemoryAllocationVK
|
|
8835
|
+
for (DeviceMemoryAllocationVK& alloc : m_recycleAllocs[m_consumeIndex])
|
|
8527
8836
|
{
|
|
8528
8837
|
s_renderVK->m_memoryLru.recycle(alloc);
|
|
8529
8838
|
}
|
|
8839
|
+
|
|
8530
8840
|
m_recycleAllocs[m_consumeIndex].clear();
|
|
8531
8841
|
|
|
8532
8842
|
for (const Resource& resource : m_release[m_consumeIndex])
|
|
@@ -8553,10 +8863,28 @@ VK_DESTROY
|
|
|
8553
8863
|
}
|
|
8554
8864
|
}
|
|
8555
8865
|
|
|
8556
|
-
|
|
8557
8866
|
m_release[m_consumeIndex].clear();
|
|
8558
8867
|
}
|
|
8559
8868
|
|
|
8869
|
+
void CommandQueueVK::addExternal(TextureHandle _handle)
|
|
8870
|
+
{
|
|
8871
|
+
m_external.push_back(_handle);
|
|
8872
|
+
}
|
|
8873
|
+
|
|
8874
|
+
void CommandQueueVK::removeExternal(TextureHandle _handle)
|
|
8875
|
+
{
|
|
8876
|
+
for (ExternalTextureArray::iterator it = m_external.begin(), itEnd = m_external.end(); it != itEnd; ++it)
|
|
8877
|
+
{
|
|
8878
|
+
if (it->idx == _handle.idx)
|
|
8879
|
+
{
|
|
8880
|
+
m_external.erase(it);
|
|
8881
|
+
return;
|
|
8882
|
+
}
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
BX_ASSERT(false, "Removing external texture failed!");
|
|
8886
|
+
}
|
|
8887
|
+
|
|
8560
8888
|
void RendererContextVK::submitBlit(BlitState& _bs, uint16_t _view)
|
|
8561
8889
|
{
|
|
8562
8890
|
BGFX_PROFILER_SCOPE("RendererContextVK::submitBlit", kColorFrame);
|
|
@@ -8588,15 +8916,17 @@ VK_DESTROY
|
|
|
8588
8916
|
TextureVK& src = m_textures[blit.m_src.idx];
|
|
8589
8917
|
TextureVK& dst = m_textures[blit.m_dst.idx];
|
|
8590
8918
|
|
|
8591
|
-
src.
|
|
8919
|
+
src.setState(
|
|
8592
8920
|
m_commandBuffer
|
|
8593
|
-
, blit.m_src.idx == blit.m_dst.idx
|
|
8921
|
+
, blit.m_src.idx == blit.m_dst.idx
|
|
8922
|
+
? VK_IMAGE_LAYOUT_GENERAL
|
|
8923
|
+
: VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
|
|
8594
8924
|
, VK_NULL_HANDLE != src.m_singleMsaaImage
|
|
8595
8925
|
);
|
|
8596
8926
|
|
|
8597
8927
|
if (blit.m_src.idx != blit.m_dst.idx)
|
|
8598
8928
|
{
|
|
8599
|
-
dst.
|
|
8929
|
+
dst.setState(m_commandBuffer, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
|
8600
8930
|
}
|
|
8601
8931
|
|
|
8602
8932
|
const uint16_t srcSamples = VK_NULL_HANDLE != src.m_singleMsaaImage ? 1 : src.m_sampler.Count;
|
|
@@ -8673,8 +9003,18 @@ VK_DESTROY
|
|
|
8673
9003
|
TextureVK& src = m_textures[blit.m_src.idx];
|
|
8674
9004
|
TextureVK& dst = m_textures[blit.m_dst.idx];
|
|
8675
9005
|
|
|
8676
|
-
src.
|
|
8677
|
-
dst.
|
|
9006
|
+
src.setState(m_commandBuffer, srcLayouts[item], VK_NULL_HANDLE != src.m_singleMsaaImage);
|
|
9007
|
+
dst.setState(m_commandBuffer, dstLayouts[item]);
|
|
9008
|
+
}
|
|
9009
|
+
}
|
|
9010
|
+
|
|
9011
|
+
void RendererContextVK::submitUniformCache(UniformCacheState& _ucs, uint16_t _view)
|
|
9012
|
+
{
|
|
9013
|
+
while (_ucs.hasItem(_view) )
|
|
9014
|
+
{
|
|
9015
|
+
const UniformCacheItem& uci = _ucs.advance();
|
|
9016
|
+
|
|
9017
|
+
bx::memCopy(m_uniforms[uci.m_handle], &_ucs.m_frame->m_uniformCacheFrame.m_data[uci.m_offset], uci.m_size);
|
|
8678
9018
|
}
|
|
8679
9019
|
}
|
|
8680
9020
|
|
|
@@ -8692,7 +9032,7 @@ VK_DESTROY
|
|
|
8692
9032
|
renderDocTriggerCapture();
|
|
8693
9033
|
}
|
|
8694
9034
|
|
|
8695
|
-
BGFX_VK_PROFILER_BEGIN_LITERAL("rendererSubmit",
|
|
9035
|
+
BGFX_VK_PROFILER_BEGIN_LITERAL("rendererSubmit", kColorFrame);
|
|
8696
9036
|
|
|
8697
9037
|
int64_t timeBegin = bx::getHPCounter();
|
|
8698
9038
|
int64_t captureElapsed = 0;
|
|
@@ -8744,6 +9084,7 @@ VK_DESTROY
|
|
|
8744
9084
|
uint16_t view = UINT16_MAX;
|
|
8745
9085
|
FrameBufferHandle fbh = { BGFX_CONFIG_MAX_FRAME_BUFFERS };
|
|
8746
9086
|
|
|
9087
|
+
UniformCacheState ucs(_render);
|
|
8747
9088
|
BlitState bs(_render);
|
|
8748
9089
|
|
|
8749
9090
|
uint64_t blendFactor = UINT64_MAX;
|
|
@@ -8767,8 +9108,13 @@ VK_DESTROY
|
|
|
8767
9108
|
const uint64_t f2 = BGFX_STATE_BLEND_FACTOR<<4;
|
|
8768
9109
|
const uint64_t f3 = BGFX_STATE_BLEND_INV_FACTOR<<4;
|
|
8769
9110
|
|
|
8770
|
-
|
|
8771
|
-
|
|
9111
|
+
VkDescriptorPool& descriptorPool = m_descriptorPool[m_cmd.m_currentFrameInFlight];
|
|
9112
|
+
vkResetDescriptorPool(m_device, descriptorPool, 0);
|
|
9113
|
+
|
|
9114
|
+
ChunkedScratchBufferVK& uniformScratchBuffer = m_uniformScratchBuffer;
|
|
9115
|
+
uniformScratchBuffer.begin();
|
|
9116
|
+
|
|
9117
|
+
StagingScratchBufferVK& stagingScratchBuffer = m_scratchStagingBuffer[m_cmd.m_currentFrameInFlight];
|
|
8772
9118
|
|
|
8773
9119
|
setMemoryBarrier(
|
|
8774
9120
|
m_commandBuffer
|
|
@@ -8833,7 +9179,8 @@ VK_DESTROY
|
|
|
8833
9179
|
}
|
|
8834
9180
|
}
|
|
8835
9181
|
|
|
8836
|
-
if(!isCompute
|
|
9182
|
+
if (!isCompute
|
|
9183
|
+
&& (viewChanged || wasCompute) )
|
|
8837
9184
|
{
|
|
8838
9185
|
if (wasCompute)
|
|
8839
9186
|
{
|
|
@@ -8842,11 +9189,8 @@ VK_DESTROY
|
|
|
8842
9189
|
}
|
|
8843
9190
|
|
|
8844
9191
|
if (beginRenderPass && (false
|
|
8845
|
-
|| _render->m_view[view].m_fbh.idx
|
|
8846
|
-
||
|
|
8847
|
-
|| _render->m_view[view].m_rect.m_y != viewState.m_rect.m_y
|
|
8848
|
-
|| _render->m_view[view].m_rect.m_width != viewState.m_rect.m_width
|
|
8849
|
-
|| _render->m_view[view].m_rect.m_height != viewState.m_rect.m_height
|
|
9192
|
+
|| _render->m_view[view].m_fbh.idx != fbh.idx
|
|
9193
|
+
|| !_render->m_view[view].m_rect.isEqual(viewState.m_rect)
|
|
8850
9194
|
) )
|
|
8851
9195
|
{
|
|
8852
9196
|
vkCmdEndRenderPass(m_commandBuffer);
|
|
@@ -8864,6 +9208,7 @@ VK_DESTROY
|
|
|
8864
9208
|
beginRenderPass = false;
|
|
8865
9209
|
}
|
|
8866
9210
|
|
|
9211
|
+
submitUniformCache(ucs, view);
|
|
8867
9212
|
submitBlit(bs, view);
|
|
8868
9213
|
|
|
8869
9214
|
BGFX_VK_PROFILER_END();
|
|
@@ -9032,6 +9377,21 @@ VK_DESTROY
|
|
|
9032
9377
|
|
|
9033
9378
|
}
|
|
9034
9379
|
}
|
|
9380
|
+
|
|
9381
|
+
if (m_variableRateShadingSupported)
|
|
9382
|
+
{
|
|
9383
|
+
VkFragmentShadingRateCombinerOpKHR combinerOp[] =
|
|
9384
|
+
{
|
|
9385
|
+
VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR,
|
|
9386
|
+
VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR
|
|
9387
|
+
};
|
|
9388
|
+
|
|
9389
|
+
vkCmdSetFragmentShadingRateKHR(
|
|
9390
|
+
m_commandBuffer
|
|
9391
|
+
, &s_shadingRate[_render->m_view[view].m_shadingRate].fragmentSize
|
|
9392
|
+
, combinerOp
|
|
9393
|
+
);
|
|
9394
|
+
}
|
|
9035
9395
|
}
|
|
9036
9396
|
}
|
|
9037
9397
|
|
|
@@ -9102,17 +9462,18 @@ VK_DESTROY
|
|
|
9102
9462
|
|
|
9103
9463
|
if (VK_NULL_HANDLE != program.m_descriptorSetLayout)
|
|
9104
9464
|
{
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
uint32_t
|
|
9465
|
+
ChunkedScratchBufferOffset sbo;
|
|
9466
|
+
|
|
9467
|
+
const uint32_t vsSize = program.m_vsh->m_size;
|
|
9468
|
+
uint32_t numOffsets = 0;
|
|
9108
9469
|
|
|
9109
9470
|
if (constantsChanged
|
|
9110
9471
|
|| hasPredefined)
|
|
9111
9472
|
{
|
|
9112
|
-
if (
|
|
9473
|
+
if (vsSize > 0)
|
|
9113
9474
|
{
|
|
9114
|
-
|
|
9115
|
-
|
|
9475
|
+
uniformScratchBuffer.write(sbo, m_vsScratch, vsSize);
|
|
9476
|
+
numOffsets = 1;
|
|
9116
9477
|
}
|
|
9117
9478
|
}
|
|
9118
9479
|
|
|
@@ -9120,7 +9481,8 @@ VK_DESTROY
|
|
|
9120
9481
|
hash.begin();
|
|
9121
9482
|
hash.add(program.m_descriptorSetLayout);
|
|
9122
9483
|
hash.add(renderBind.m_bind, sizeof(renderBind.m_bind) );
|
|
9123
|
-
hash.add(
|
|
9484
|
+
hash.add(sbo.buffer);
|
|
9485
|
+
hash.add(vsSize);
|
|
9124
9486
|
hash.add(0);
|
|
9125
9487
|
const uint32_t bindHash = hash.end();
|
|
9126
9488
|
|
|
@@ -9131,7 +9493,7 @@ VK_DESTROY
|
|
|
9131
9493
|
currentDescriptorSet = getDescriptorSet(
|
|
9132
9494
|
program
|
|
9133
9495
|
, renderBind
|
|
9134
|
-
,
|
|
9496
|
+
, sbo.buffer
|
|
9135
9497
|
, _render->m_colorPalette
|
|
9136
9498
|
);
|
|
9137
9499
|
|
|
@@ -9145,8 +9507,8 @@ VK_DESTROY
|
|
|
9145
9507
|
, 0
|
|
9146
9508
|
, 1
|
|
9147
9509
|
, ¤tDescriptorSet
|
|
9148
|
-
,
|
|
9149
|
-
,
|
|
9510
|
+
, numOffsets
|
|
9511
|
+
, sbo.offsets
|
|
9150
9512
|
);
|
|
9151
9513
|
}
|
|
9152
9514
|
|
|
@@ -9214,14 +9576,12 @@ VK_DESTROY
|
|
|
9214
9576
|
uint32_t numVertices = draw.m_numVertices;
|
|
9215
9577
|
if (UINT8_MAX != draw.m_streamMask)
|
|
9216
9578
|
{
|
|
9217
|
-
for (
|
|
9218
|
-
;
|
|
9219
|
-
;
|
|
9579
|
+
for (BitMaskToIndexIteratorT it(draw.m_streamMask)
|
|
9580
|
+
; !it.isDone()
|
|
9581
|
+
; it.next(), numStreams++
|
|
9220
9582
|
)
|
|
9221
9583
|
{
|
|
9222
|
-
const
|
|
9223
|
-
streamMask >>= ntz;
|
|
9224
|
-
idx += ntz;
|
|
9584
|
+
const uint8_t idx = it.idx;
|
|
9225
9585
|
|
|
9226
9586
|
currentState.m_stream[idx] = draw.m_stream[idx];
|
|
9227
9587
|
|
|
@@ -9389,31 +9749,28 @@ VK_DESTROY
|
|
|
9389
9749
|
|
|
9390
9750
|
if (VK_NULL_HANDLE != program.m_descriptorSetLayout)
|
|
9391
9751
|
{
|
|
9392
|
-
|
|
9393
|
-
const uint32_t fsize = NULL != program.m_fsh ? program.m_fsh->m_size : 0;
|
|
9394
|
-
uint32_t numOffset = 0;
|
|
9395
|
-
uint32_t offsets[2] = { 0, 0 };
|
|
9752
|
+
ChunkedScratchBufferOffset sbo;
|
|
9396
9753
|
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
if (vsize > 0)
|
|
9401
|
-
{
|
|
9402
|
-
offsets[numOffset++] = scratchBuffer.write(m_vsScratch, vsize);
|
|
9403
|
-
}
|
|
9754
|
+
const uint32_t vsSize = program.m_vsh->m_size;
|
|
9755
|
+
const uint32_t fsSize = NULL != program.m_fsh ? program.m_fsh->m_size : 0;
|
|
9756
|
+
uint32_t numOffsets = 0;
|
|
9404
9757
|
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9758
|
+
if (true
|
|
9759
|
+
&& (constantsChanged || hasPredefined)
|
|
9760
|
+
&& (0 < vsSize || 0 < fsSize)
|
|
9761
|
+
)
|
|
9762
|
+
{
|
|
9763
|
+
uniformScratchBuffer.write(sbo, m_vsScratch, vsSize, m_fsScratch, fsSize);
|
|
9764
|
+
numOffsets = (0 < vsSize) + (0 < fsSize);
|
|
9409
9765
|
}
|
|
9410
9766
|
|
|
9411
9767
|
bx::HashMurmur2A hash;
|
|
9412
9768
|
hash.begin();
|
|
9413
9769
|
hash.add(program.m_descriptorSetLayout);
|
|
9414
9770
|
hash.add(renderBind.m_bind, sizeof(renderBind.m_bind) );
|
|
9415
|
-
hash.add(
|
|
9416
|
-
hash.add(
|
|
9771
|
+
hash.add(sbo.buffer);
|
|
9772
|
+
hash.add(vsSize);
|
|
9773
|
+
hash.add(fsSize);
|
|
9417
9774
|
const uint32_t bindHash = hash.end();
|
|
9418
9775
|
|
|
9419
9776
|
if (currentBindHash != bindHash)
|
|
@@ -9423,9 +9780,9 @@ VK_DESTROY
|
|
|
9423
9780
|
currentDescriptorSet = getDescriptorSet(
|
|
9424
9781
|
program
|
|
9425
9782
|
, renderBind
|
|
9426
|
-
,
|
|
9783
|
+
, sbo.buffer
|
|
9427
9784
|
, _render->m_colorPalette
|
|
9428
|
-
|
|
9785
|
+
);
|
|
9429
9786
|
|
|
9430
9787
|
descriptorSetCount++;
|
|
9431
9788
|
}
|
|
@@ -9437,8 +9794,8 @@ VK_DESTROY
|
|
|
9437
9794
|
, 0
|
|
9438
9795
|
, 1
|
|
9439
9796
|
, ¤tDescriptorSet
|
|
9440
|
-
,
|
|
9441
|
-
, offsets
|
|
9797
|
+
, numOffsets
|
|
9798
|
+
, sbo.offsets
|
|
9442
9799
|
);
|
|
9443
9800
|
}
|
|
9444
9801
|
|
|
@@ -9651,7 +10008,7 @@ VK_DESTROY
|
|
|
9651
10008
|
maxGpuLatency = bx::uint32_imax(maxGpuLatency, result.m_pending-1);
|
|
9652
10009
|
}
|
|
9653
10010
|
|
|
9654
|
-
maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.
|
|
10011
|
+
maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.getNumUsed()-1);
|
|
9655
10012
|
|
|
9656
10013
|
const int64_t timerFreq = bx::getHPFrequency();
|
|
9657
10014
|
|
|
@@ -9807,7 +10164,7 @@ VK_DESTROY
|
|
|
9807
10164
|
tvm.printf(10, pos++, 0x8b, " DIB size: %7d ", _render->m_iboffset);
|
|
9808
10165
|
|
|
9809
10166
|
pos++;
|
|
9810
|
-
tvm.printf(10, pos++, 0x8b, " Occlusion queries: %3d ", m_occlusionQuery.m_control.
|
|
10167
|
+
tvm.printf(10, pos++, 0x8b, " Occlusion queries: %3d ", m_occlusionQuery.m_control.getNumUsed() );
|
|
9811
10168
|
|
|
9812
10169
|
pos++;
|
|
9813
10170
|
tvm.printf(10, pos++, 0x8b, " State cache: ");
|
|
@@ -9819,6 +10176,17 @@ VK_DESTROY
|
|
|
9819
10176
|
);
|
|
9820
10177
|
pos++;
|
|
9821
10178
|
|
|
10179
|
+
{
|
|
10180
|
+
char strUsed[64];
|
|
10181
|
+
bx::prettify(strUsed, sizeof(strUsed), m_uniformScratchBuffer.m_totalUsed);
|
|
10182
|
+
|
|
10183
|
+
char strTotal[64];
|
|
10184
|
+
bx::prettify(strTotal, sizeof(strTotal), m_uniformScratchBuffer.m_chunkControl.m_size);
|
|
10185
|
+
|
|
10186
|
+
tvm.printf(10, pos++, 0x8b, "Uniform scratch size: %s / %s.", strUsed, strTotal);
|
|
10187
|
+
}
|
|
10188
|
+
|
|
10189
|
+
pos++;
|
|
9822
10190
|
double captureMs = double(captureElapsed)*toMs;
|
|
9823
10191
|
tvm.printf(10, pos++, 0x8b, " Capture: %7.4f [ms] ", captureMs);
|
|
9824
10192
|
|
|
@@ -9834,7 +10202,7 @@ VK_DESTROY
|
|
|
9834
10202
|
presentMax = m_presentElapsed;
|
|
9835
10203
|
}
|
|
9836
10204
|
|
|
9837
|
-
|
|
10205
|
+
dbgTextSubmit(this, _textVideoMemBlitter, tvm);
|
|
9838
10206
|
|
|
9839
10207
|
BGFX_VK_PROFILER_END();
|
|
9840
10208
|
}
|
|
@@ -9842,21 +10210,18 @@ VK_DESTROY
|
|
|
9842
10210
|
{
|
|
9843
10211
|
BGFX_VK_PROFILER_BEGIN_LITERAL("debugtext", kColorFrame);
|
|
9844
10212
|
|
|
9845
|
-
|
|
10213
|
+
dbgTextSubmit(this, _textVideoMemBlitter, _render->m_textVideoMem);
|
|
9846
10214
|
|
|
9847
10215
|
BGFX_VK_PROFILER_END();
|
|
9848
10216
|
}
|
|
9849
10217
|
|
|
9850
10218
|
m_presentElapsed = 0;
|
|
9851
10219
|
|
|
9852
|
-
|
|
9853
|
-
BGFX_PROFILER_SCOPE("scratchBuffer::flush", kColorResource);
|
|
9854
|
-
scratchBuffer.flush();
|
|
9855
|
-
}
|
|
10220
|
+
uniformScratchBuffer.end();
|
|
9856
10221
|
|
|
9857
10222
|
{
|
|
9858
|
-
BGFX_PROFILER_SCOPE("
|
|
9859
|
-
|
|
10223
|
+
BGFX_PROFILER_SCOPE("stagingScratchBuffer::flush", kColorResource);
|
|
10224
|
+
stagingScratchBuffer.flush();
|
|
9860
10225
|
}
|
|
9861
10226
|
|
|
9862
10227
|
for (uint16_t ii = 0; ii < m_numWindows; ++ii)
|