Rhi: Add SampleVariables feature
The feature is required to check if gl_sampleID etc are available in the fragment shaders. Task-number: QTBUG-134999 Pick-to: 6.9 Change-Id: Id26c75780011a7553d332ae22e69aab632891998 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
7929852c1d
commit
86e3573671
@ -1091,6 +1091,12 @@ Q_LOGGING_CATEGORY(QRHI_LOG_RUB, "qt.rhi.rub")
|
||||
blending modes. In practice this can be expected to be supported everywhere
|
||||
except OpenGL ES, where it is only available with GLES 3.2 implementations.
|
||||
This enum value has been introduced in Qt 6.9.
|
||||
|
||||
\value SampleVariables Indicates that gl_SampleID, gl_SamplePosition,
|
||||
gl_SampleMaskIn and gl_SampleMask variables are available in fragment shaders.
|
||||
In practice this can be expected to be supported everywhere except OpenGL ES,
|
||||
where it is only available with GLES 3.2 implementations.
|
||||
This enum value has been introduced in Qt 6.9.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1931,6 +1931,7 @@ public:
|
||||
VariableRateShadingMap,
|
||||
VariableRateShadingMapWithTexture,
|
||||
PerRenderTargetBlending,
|
||||
SampleVariables
|
||||
};
|
||||
|
||||
enum BeginFrameFlag {
|
||||
|
@ -705,6 +705,7 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
|
||||
case QRhi::VariableRateShadingMapWithTexture:
|
||||
return false;
|
||||
case QRhi::PerRenderTargetBlending:
|
||||
case QRhi::SampleVariables:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
|
@ -857,6 +857,7 @@ bool QRhiD3D12::isFeatureSupported(QRhi::Feature feature) const
|
||||
case QRhi::VariableRateShadingMapWithTexture:
|
||||
return caps.vrsMap;
|
||||
case QRhi::PerRenderTargetBlending:
|
||||
case QRhi::SampleVariables:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1169,6 +1169,16 @@ bool QRhiGles2::create(QRhi::Flags flags)
|
||||
else
|
||||
caps.perRenderTargetBlending = caps.ctxMajor >= 4;
|
||||
|
||||
if (caps.gles) {
|
||||
if (caps.ctxMajor == 3 && caps.ctxMinor < 2) {
|
||||
caps.sampleVariables = ctx->hasExtension("GL_OES_sample_variables");
|
||||
} else {
|
||||
caps.sampleVariables = caps.ctxMajor > 3 || (caps.ctxMajor == 3 && caps.ctxMinor >= 2);
|
||||
}
|
||||
} else {
|
||||
caps.sampleVariables = caps.ctxMajor >= 4;
|
||||
}
|
||||
|
||||
nativeHandlesStruct.context = ctx;
|
||||
|
||||
contextLost = false;
|
||||
@ -1611,6 +1621,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
|
||||
return false;
|
||||
case QRhi::PerRenderTargetBlending:
|
||||
return caps.perRenderTargetBlending;
|
||||
case QRhi::SampleVariables:
|
||||
return caps.sampleVariables;
|
||||
default:
|
||||
Q_UNREACHABLE_RETURN(false);
|
||||
}
|
||||
|
@ -1092,6 +1092,7 @@ public:
|
||||
uint glesMultiviewMultisampleRenderToTexture : 1;
|
||||
uint unpackRowLength : 1;
|
||||
uint perRenderTargetBlending : 1;
|
||||
uint sampleVariables : 1;
|
||||
} caps;
|
||||
QGles2SwapChain *currentSwapChain = nullptr;
|
||||
QSet<GLint> supportedCompressedFormats;
|
||||
|
@ -868,6 +868,7 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
|
||||
case QRhi::VariableRateShadingMapWithTexture:
|
||||
return false;
|
||||
case QRhi::PerRenderTargetBlending:
|
||||
case QRhi::SampleVariables:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
|
@ -5327,6 +5327,7 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
|
||||
case QRhi::VariableRateShadingMapWithTexture:
|
||||
return caps.renderPass2KHR && caps.imageBasedShadingRate;
|
||||
case QRhi::PerRenderTargetBlending:
|
||||
case QRhi::SampleVariables:
|
||||
return true;
|
||||
default:
|
||||
Q_UNREACHABLE_RETURN(false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user