diff options
author | Ben Fletcher <[email protected]> | 2023-02-20 21:25:03 -0800 |
---|---|---|
committer | Ben Fletcher <[email protected]> | 2023-02-27 09:23:05 -0800 |
commit | 9ffa16baf0087faa9da692c74ae24c9f54b75395 (patch) | |
tree | 7443ddfd319c041302c61cc3a4166c4fe25891fc /src/gui/opengl | |
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 <[email protected]>
Reviewed-by: Laszlo Agocs <[email protected]>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopenglextensions_p.h | 3 | ||||
-rw-r--r-- | src/gui/opengl/qopenglfunctions.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 2924754e3ac..fdb9b51f067 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -58,7 +58,8 @@ public: TextureSwizzle = 0x01000000, StandardDerivatives = 0x02000000, ASTCTextureCompression = 0x04000000, - ETC2TextureCompression = 0x08000000 + ETC2TextureCompression = 0x08000000, + HalfFloatVertex = 0x10000000 }; Q_DECLARE_FLAGS(OpenGLExtensions, OpenGLExtension) diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index d8c8e4704d9..ee769875667 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -346,6 +346,8 @@ static int qt_gl_resolve_extensions() extensions |= QOpenGLExtensions::TextureSwizzle; if (extensionMatcher.match("GL_OES_standard_derivatives")) extensions |= QOpenGLExtensions::StandardDerivatives; + if (extensionMatcher.match("GL_ARB_half_float_vertex")) + extensions |= QOpenGLExtensions::HalfFloatVertex; if (ctx->isOpenGLES()) { if (format.majorVersion() >= 2) @@ -360,7 +362,8 @@ static int qt_gl_resolve_extensions() | QOpenGLExtensions::FramebufferMultisample | QOpenGLExtensions::Sized8Formats | QOpenGLExtensions::StandardDerivatives - | QOpenGLExtensions::ETC2TextureCompression; + | QOpenGLExtensions::ETC2TextureCompression + | QOpenGLExtensions::HalfFloatVertex; #ifndef Q_OS_WASM // WebGL 2.0 specification explicitly does not support texture swizzles // https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.19 |