summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhigles2.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-08 12:16:14 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-06-12 09:26:15 +0200
commiteb72d788fe9d6301e6254fd86d388783c4484873 (patch)
tree68deb45173af3bc9c1c19bccdd87f5cd2ab3d95e /src/gui/rhi/qrhigles2.cpp
parent3f6142f5a1a01f201593f6711930ec77640dea46 (diff)
Add RHI feature check for screen space derivatives
Fragment shader functions like fwidth() are useful for antialiasing distance field text in the case of perspective projections. In order to enable this as an alternative code path, we need to detect support. - OpenGL: Supported with GL_OES_standard_derivatives or GLES3 and up - Direct 3D: Supported for ps_2_x, so always supported on Direct3D 11 - Vulkan/Metal: Always supported Task-number: QTBUG-84695 Change-Id: I5e3fa8014c808a9a2d639305c5e90ec25d44655c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r--src/gui/rhi/qrhigles2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index ebe66f302b..632a5154e7 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -522,6 +522,7 @@ bool QRhiGles2::create(QRhi::Flags flags)
caps.texelFetch = caps.ctxMajor >= 3; // 3.0 or ES 3.0
caps.uintAttributes = caps.ctxMajor >= 3; // 3.0 or ES 3.0
+ caps.screenSpaceDerivatives = f->hasOpenGLExtension(QOpenGLExtensions::StandardDerivatives);
if (!caps.gles) {
f->glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
@@ -872,6 +873,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
return caps.nonBaseLevelFramebufferTexture;
case QRhi::UIntAttributes:
return caps.uintAttributes;
+ case QRhi::ScreenSpaceDerivatives:
+ return caps.screenSpaceDerivatives;
default:
Q_UNREACHABLE();
return false;