summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/rhi/qrhi.cpp12
-rw-r--r--src/gui/rhi/qrhi_p.h3
-rw-r--r--src/gui/rhi/qrhid3d11.cpp2
-rw-r--r--src/gui/rhi/qrhigles2.cpp3
-rw-r--r--src/gui/rhi/qrhimetal.mm2
-rw-r--r--src/gui/rhi/qrhivulkan.cpp2
6 files changed, 23 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index f7ecacf456..6e7c975753 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -596,6 +596,18 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
type attributes will be broken. In practice this feature will be unsupported
with OpenGL ES 2.0 and OpenGL 2.x, while it will likely be supported
everywhere else.
+
+ \value ScreenSpaceDerivatives Indicates that functions such as dFdx(),
+ dFdy(), and fwidth() are supported in shaders.
+
+ \value ReadBackAnyTextureFormat Indicates that reading back texture
+ contents can be expected to work for any QRhiTexture::Format. When reported
+ as false, which will typically happen with OpenGL, only the formats
+ QRhiTexture::RGBA8 and QRhiTexture::BGRA8 are guaranteed to be supported
+ for readbacks. In addition, with OpenGL, but not OpenGL ES, reading back
+ the 1 byte per component formats QRhiTexture::R8 and
+ QRhiTexture::RED_OR_ALPHA8 are supported as well. Backends other than
+ OpenGL can be expected to return true for this feature.
*/
/*!
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 9f94fea1dc..12fd3c46c2 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -1457,7 +1457,8 @@ public:
TexelFetch,
RenderToNonBaseMipLevel,
UIntAttributes,
- ScreenSpaceDerivatives
+ ScreenSpaceDerivatives,
+ ReadBackAnyTextureFormat
};
enum BeginFrameFlag {
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index 710ebd62cc..38f2993049 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -481,6 +481,8 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::ScreenSpaceDerivatives:
return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
default:
Q_UNREACHABLE();
return false;
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index 383b65cda7..139375fbec 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -875,6 +875,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
return caps.uintAttributes;
case QRhi::ScreenSpaceDerivatives:
return caps.screenSpaceDerivatives;
+ case QRhi::ReadBackAnyTextureFormat:
+ return false;
default:
Q_UNREACHABLE();
return false;
@@ -2400,6 +2402,7 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
const int h = result->pixelSize.height();
if (mipLevel == 0 || caps.nonBaseLevelFramebufferTexture) {
// With GLES, GL_RGBA is the only mandated readback format, so stick with it.
+ // (and that's why we return false for the ReadBackAnyTextureFormat feature)
if (result->format == QRhiTexture::R8 || result->format == QRhiTexture::RED_OR_ALPHA8) {
result->data.resize(w * h);
QByteArray tmpBuf;
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index 0c42eaa3e9..46a121c812 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -570,6 +570,8 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::ScreenSpaceDerivatives:
return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
default:
Q_UNREACHABLE();
return false;
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index fdc80e1e80..ad6f5ebd8b 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -4052,6 +4052,8 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
return true;
case QRhi::ScreenSpaceDerivatives:
return true;
+ case QRhi::ReadBackAnyTextureFormat:
+ return true;
default:
Q_UNREACHABLE();
return false;