-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[glTF] Support accessors with UNSIGNED_BYTE 5121 componentType #453
Comments
While glTF supports specifying indices in UINT8, Vulkan only supports UINT16 and UINT32 index buffers (without extensions). If we detect a UINT8 index buffer (componentType = 5121) then we repack it into the next best thing: a UINT16 buffer. This increases the size of the indices in the resulting repacked GPU buffer but allows us to support these scenes without extensions. This allows us to load more Khronos glTF-Sample-Assets like TextureCoordinateTest. Fixes google#453
Without extensions, Vulkan only supports UINT16 and UINT32 index buffers. However, glTF allows UINT8 index buffers. We can support scenes with UINT8 indices by repacking them into a UINT16 buffer instead. This comes at the cost of a larger GPU buffer. This allows us to load more Khronos glTF-Sample-Assets like TextureCoordinateTest. Fixes google#453
Without extensions, Vulkan only supports UINT16 and UINT32 index buffers. However, glTF allows UINT8 index buffers. We can support scenes with UINT8 indices by repacking them into a UINT16 buffer instead. This comes at the cost of a larger GPU buffer. This allows us to load more Khronos glTF-Sample-Assets like TextureCoordinateTest. Fixes google#453
For Vulkan we can use VK_EXT_index_type_uint8 to load these buffers 1:1. gpuinfo.org claims 62% support. For DX12, docs claim that DXGI_FORMAT_R8_UINT is "Disallowed or not available." for Input Assembler Index Buffer. Only DXGI_FORMAT_R16_UINT and DXGI_FORMAT_R32_UINT are labelled as "Hardware support is required." https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/hardware-support-for-direct3d-12-0-formats As a fallback (either the Vulkan extension is not support, or we're on DX12), we can load the data into new 16bit index buffers instead and take a 2x memory hit. |
For Vulkan, we must ask for the VK_EXT_index_type_uint8 device extension and enable the indexTypeUint8 feature. For DX12, the docs claim that there is no support: https://learn.microsoft.com/en-us/windows/win32/direct3ddxgi/hardware-support-for-direct3d-12-0-formats This is required to load uint8 index buffers from glTF files more efficiently. See #453
Using
scene::GltfLoader
, some models in glTF-Sample-Assets fail to load because they use index buffers with unsigned byte components (componentType=5121
).Refer to 5.24.2:
Filtering 5.1.3 for that criteria leaves 5121 UNSIGNED_BYTE (unimplemented), 5123 UNSIGNED_SHORT (implemented), and 5125 UNSIGNED_INT (implemented)
This would allow BigWheels to load more models like:
The text was updated successfully, but these errors were encountered: