diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp index c591d90e62..801a8984f1 100644 --- a/src/gui/rhi/qrhi.cpp +++ b/src/gui/rhi/qrhi.cpp @@ -735,10 +735,10 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general") \value OneDimensionalTextures Indicates that 1D textures are supported. In practice this feature will be unsupported on OpenGL ES. - \value OneDimensionalTextureMipmaps Indicates that 1D texture mipmaps and - 1D texture render targets are supported. In practice this feature will be - unsupported on backends that do not report support for - \l{OneDimensionalTextures}, and Metal. + \value OneDimensionalTextureMipmaps Indicates that generating 1D texture + mipmaps are supported. In practice this feature will be unsupported on + backends that do not report support for + \l{OneDimensionalTextures}, Metal, and Direct 3D 12. \value HalfAttributes Indicates that specifying input attributes with half precision (16bit) floating point types for a shader pipeline is supported. @@ -750,6 +750,14 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general") half3 attributes as half4. To ensure cross platform compatibility, half3 inputs should be padded to 8 bytes. + \value RenderToOneDimensionalTexture Indicates that 1D texture render + targets are supported. In practice this feature will be unsupported on + backends that do not report support for + \l{OneDimensionalTextures}, and Metal. + + \value ThreeDimensionalTextureMipmaps Indicates that generating 3D texture + mipmaps are supported. In practice this feature will be unsupported with + Direct 3D 12. */ /*! diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h index 0a13b502ae..561ab2dd9e 100644 --- a/src/gui/rhi/qrhi_p.h +++ b/src/gui/rhi/qrhi_p.h @@ -1820,7 +1820,9 @@ public: NonFillPolygonMode, OneDimensionalTextures, OneDimensionalTextureMipmaps, - HalfAttributes + HalfAttributes, + RenderToOneDimensionalTexture, + ThreeDimensionalTextureMipmaps }; enum BeginFrameFlag { diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 86038b4ae5..c49b40bcd8 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -530,6 +530,10 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const return true; case QRhi::HalfAttributes: return true; + case QRhi::RenderToOneDimensionalTexture: + return true; + case QRhi::ThreeDimensionalTextureMipmaps: + return true; default: Q_UNREACHABLE(); return false; diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index 352c7d5d10..20d01db1fa 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -582,9 +582,13 @@ bool QRhiD3D12::isFeatureSupported(QRhi::Feature feature) const case QRhi::OneDimensionalTextures: return true; case QRhi::OneDimensionalTextureMipmaps: - return false; + return false; // we generate mipmaps ourselves with compute and this is not implemented case QRhi::HalfAttributes: return true; + case QRhi::RenderToOneDimensionalTexture: + return true; + case QRhi::ThreeDimensionalTextureMipmaps: + return false; // we generate mipmaps ourselves with compute and this is not implemented } return false; } diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index d36cc7067c..7bb7e1fe4a 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -1323,6 +1323,10 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const return caps.texture1D; case QRhi::HalfAttributes: return caps.halfAttributes; + case QRhi::RenderToOneDimensionalTexture: + return caps.texture1D; + case QRhi::ThreeDimensionalTextureMipmaps: + return caps.texture3D; default: Q_UNREACHABLE_RETURN(false); } diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 3fe8c8d219..5cb9ae0a05 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -796,6 +796,10 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const return false; case QRhi::HalfAttributes: return true; + case QRhi::RenderToOneDimensionalTexture: + return false; + case QRhi::ThreeDimensionalTextureMipmaps: + return true; default: Q_UNREACHABLE(); return false; diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index e387463be4..1128ea8f64 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -4267,6 +4267,10 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const return true; case QRhi::HalfAttributes: return true; + case QRhi::RenderToOneDimensionalTexture: + return true; + case QRhi::ThreeDimensionalTextureMipmaps: + return true; default: Q_UNREACHABLE_RETURN(false); } diff --git a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp index 08ddba7e02..ca5f48dc3e 100644 --- a/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp +++ b/tests/auto/gui/rhi/qrhi/tst_qrhi.cpp @@ -410,7 +410,12 @@ void tst_QRhi::create() QRhi::Tessellation, QRhi::GeometryShader, QRhi::TextureArrayRange, - QRhi::NonFillPolygonMode + QRhi::NonFillPolygonMode, + QRhi::OneDimensionalTextures, + QRhi::OneDimensionalTextureMipmaps, + QRhi::HalfAttributes, + QRhi::RenderToOneDimensionalTexture, + QRhi::ThreeDimensionalTextureMipmaps }; for (size_t i = 0; i isFeatureSupported(features[i]); @@ -4758,7 +4763,7 @@ void tst_QRhi::threeDimTexture() } // mipmaps - { + if (rhi->isFeatureSupported(QRhi::ThreeDimensionalTextureMipmaps)) { QScopedPointer texture(rhi->newTexture(QRhiTexture::RGBA8, WIDTH, HEIGHT, DEPTH, 1, QRhiTexture::MipMapped | QRhiTexture::UsedWithGenerateMips)); QVERIFY(texture->create()); @@ -4801,11 +4806,10 @@ void tst_QRhi::threeDimTexture() // Some software-based OpenGL implementations, such as Mesa llvmpipe builds that are // used both in Qt CI and are shipped with the official Qt binaries also seem to have // problems with this. - if (impl != QRhi::Null && impl != QRhi::OpenGLES2) { - // temporarily skip for D3D12 as well since 3D texture mipmap generation is not implemented there - if (impl != QRhi::D3D12) - QVERIFY(imageRGBAEquals(result, referenceImage, 2)); - } + if (impl != QRhi::Null && impl != QRhi::OpenGLES2) + QVERIFY(imageRGBAEquals(result, referenceImage, 2)); + } else { + qDebug("Skipping 3D texture mipmap generation test because it is reported as unsupported"); } // render target (one slice) @@ -5175,9 +5179,11 @@ void tst_QRhi::oneDimTexture() } // mipmaps and 1D render target - if (!rhi->isFeatureSupported(QRhi::OneDimensionalTextureMipmaps)) - QSKIP("Skipping testing 1D texture mipmaps and 1D render target because they are reported " - "as unsupported"); + if (!rhi->isFeatureSupported(QRhi::OneDimensionalTextureMipmaps) + || !rhi->isFeatureSupported(QRhi::RenderToOneDimensionalTexture)) + { + QSKIP("Skipping testing 1D texture mipmaps and 1D render target because they are reported as unsupported"); + } { QScopedPointer texture(