rhi: Allow detecting texelFetch support
Change-Id: I166c89af99e1289ae60febf2f41fab07eab9f7e8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>bb10
parent
35f973d222
commit
cd02e29319
|
|
@ -577,6 +577,11 @@ Q_LOGGING_CATEGORY(QRHI_LOG_INFO, "qt.rhi.general")
|
|||
specifying a non-zero level in QRhiReadbackDescription leads to returning
|
||||
an all-zero image. In practice this feature will be unsupported with OpenGL
|
||||
ES 2.0, while it will likely be supported everywhere else.
|
||||
|
||||
\value TexelFetch Indicates that texelFetch() is available in shaders. In
|
||||
practice this will be reported as unsupported with OpenGL ES 2.0 and OpenGL
|
||||
2.x contexts, because GLSL 100 es and versions before 130 do not support
|
||||
this function.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -1430,7 +1430,8 @@ public:
|
|||
BaseInstance,
|
||||
TriangleFanTopology,
|
||||
ReadBackNonUniformBuffer,
|
||||
ReadBackNonBaseMipLevel
|
||||
ReadBackNonBaseMipLevel,
|
||||
TexelFetch
|
||||
};
|
||||
|
||||
enum BeginFrameFlag {
|
||||
|
|
|
|||
|
|
@ -464,6 +464,8 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
|
|||
return true;
|
||||
case QRhi::ReadBackNonBaseMipLevel:
|
||||
return true;
|
||||
case QRhi::TexelFetch:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -514,6 +514,8 @@ bool QRhiGles2::create(QRhi::Flags flags)
|
|||
else
|
||||
caps.nonBaseLevelFramebufferTexture = true;
|
||||
|
||||
caps.texelFetch = caps.ctxMajor >= 3; // 3.0 or ES 3.0
|
||||
|
||||
if (!caps.gles) {
|
||||
f->glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
|
||||
f->glEnable(GL_POINT_SPRITE);
|
||||
|
|
@ -767,6 +769,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
|
|||
return !caps.gles || caps.properMapBuffer;
|
||||
case QRhi::ReadBackNonBaseMipLevel:
|
||||
return caps.nonBaseLevelFramebufferTexture;
|
||||
case QRhi::TexelFetch:
|
||||
return caps.texelFetch;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -778,7 +778,8 @@ public:
|
|||
compute(false),
|
||||
textureCompareMode(false),
|
||||
properMapBuffer(false),
|
||||
nonBaseLevelFramebufferTexture(false)
|
||||
nonBaseLevelFramebufferTexture(false),
|
||||
texelFetch(false)
|
||||
{ }
|
||||
int ctxMajor;
|
||||
int ctxMinor;
|
||||
|
|
@ -811,6 +812,7 @@ public:
|
|||
uint textureCompareMode : 1;
|
||||
uint properMapBuffer : 1;
|
||||
uint nonBaseLevelFramebufferTexture : 1;
|
||||
uint texelFetch : 1;
|
||||
} caps;
|
||||
QGles2SwapChain *currentSwapChain = nullptr;
|
||||
QVector<GLint> supportedCompressedFormats;
|
||||
|
|
|
|||
|
|
@ -562,6 +562,8 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
|
|||
return true;
|
||||
case QRhi::ReadBackNonBaseMipLevel:
|
||||
return true;
|
||||
case QRhi::TexelFetch:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -3990,6 +3990,8 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
|
|||
return true;
|
||||
case QRhi::ReadBackNonBaseMipLevel:
|
||||
return true;
|
||||
case QRhi::TexelFetch:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -294,7 +294,8 @@ void tst_QRhi::create()
|
|||
QRhi::BaseInstance,
|
||||
QRhi::TriangleFanTopology,
|
||||
QRhi::ReadBackNonUniformBuffer,
|
||||
QRhi::ReadBackNonBaseMipLevel
|
||||
QRhi::ReadBackNonBaseMipLevel,
|
||||
QRhi::TexelFetch
|
||||
};
|
||||
for (size_t i = 0; i <sizeof(features) / sizeof(QRhi::Feature); ++i)
|
||||
rhi->isFeatureSupported(features[i]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue