diff options
author | Ben Fletcher <ben.fletcher@me.com> | 2023-02-20 21:25:03 -0800 |
---|---|---|
committer | Ben Fletcher <ben.fletcher@me.com> | 2023-02-27 09:23:05 -0800 |
commit | 9ffa16baf0087faa9da692c74ae24c9f54b75395 (patch) | |
tree | 7443ddfd319c041302c61cc3a4166c4fe25891fc /src/gui/rhi/qrhid3d11.cpp | |
parent | 742e79312fc98711f68749937d0db433d961f546 (diff) |
rhi: Add support for half precision vertex atttributes
Runtime support is indicated via QRhi::Feature::HalfAttributes.
OpenGL support is available in OpenGL 3.0+, OpenGL ES 3.0+, and in
implementations that support the extension GL_ARB_half_float_vertex.
Other RHI backends (Vulkan, Metal, D3D11, and D3D12) all support this
feature.
Note that D3D does not support the half3 type. D3D backends pass half3
as half4.
tst_qrhi auto unit test included.
Change-Id: Ide05d7f62f6102ad5cae1b3681fdda98d52bca31
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhid3d11.cpp')
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index ab511d0cdf..86038b4ae5 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -528,6 +528,8 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const return true; case QRhi::OneDimensionalTextureMipmaps: return true; + case QRhi::HalfAttributes: + return true; default: Q_UNREACHABLE(); return false; @@ -4038,6 +4040,14 @@ static inline DXGI_FORMAT toD3DAttributeFormat(QRhiVertexInputAttribute::Format return DXGI_FORMAT_R32G32_SINT; case QRhiVertexInputAttribute::SInt: return DXGI_FORMAT_R32_SINT; + case QRhiVertexInputAttribute::Half4: + // Note: D3D does not support half3. Pass through half3 as half4. + case QRhiVertexInputAttribute::Half3: + return DXGI_FORMAT_R16G16B16A16_FLOAT; + case QRhiVertexInputAttribute::Half2: + return DXGI_FORMAT_R16G16_FLOAT; + case QRhiVertexInputAttribute::Half: + return DXGI_FORMAT_R16_FLOAT; default: Q_UNREACHABLE(); return DXGI_FORMAT_R32G32B32A32_FLOAT; |