Add feature for per render target blending

Task-number: QTBUG-130334
Change-Id: I30ae0023ce8b5c26360e4255d64c209ebe404ede
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Antti Määttä 2024-05-20 08:47:41 +03:00
parent 36dca3c04f
commit c06c8eba50
8 changed files with 21 additions and 2 deletions

View File

@ -1069,6 +1069,11 @@ Q_STATIC_LOGGING_CATEGORY(QRHI_LOG_RUB, "qt.rhi.rub")
specification of the shading rate is supported via regular textures. In
practice this may be supported with Direct 3D 12 and Vulkan. This enum value
has been introduced in Qt 6.9.
\value PerRenderTargetBlending Indicates that per rendertarget blending is
supported i.e. different render targets in MRT framebuffer can have different
blending modes. Currently always returns false for OpenGL.
This enum value has been introduced in Qt 6.9.
*/
/*!

View File

@ -1907,7 +1907,8 @@ public:
ResolveDepthStencil,
VariableRateShading,
VariableRateShadingMap,
VariableRateShadingMapWithTexture
VariableRateShadingMapWithTexture,
PerRenderTargetBlending,
};
enum BeginFrameFlag {

View File

@ -656,6 +656,8 @@ bool QRhiD3D11::isFeatureSupported(QRhi::Feature feature) const
case QRhi::VariableRateShadingMap:
case QRhi::VariableRateShadingMapWithTexture:
return false;
case QRhi::PerRenderTargetBlending:
return true;
default:
Q_UNREACHABLE();
return false;

View File

@ -807,6 +807,8 @@ bool QRhiD3D12::isFeatureSupported(QRhi::Feature feature) const
case QRhi::VariableRateShadingMap:
case QRhi::VariableRateShadingMapWithTexture:
return caps.vrsMap;
case QRhi::PerRenderTargetBlending:
return true;
}
return false;
}

View File

@ -1117,6 +1117,7 @@ bool QRhiGles2::create(QRhi::Flags flags)
}
caps.unpackRowLength = !caps.gles || caps.ctxMajor >= 3;
caps.perRenderTargetBlending = false;
nativeHandlesStruct.context = ctx;
@ -1507,6 +1508,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const
case QRhi::VariableRateShadingMap:
case QRhi::VariableRateShadingMapWithTexture:
return false;
case QRhi::PerRenderTargetBlending:
return caps.perRenderTargetBlending;
default:
Q_UNREACHABLE_RETURN(false);
}

View File

@ -1025,7 +1025,8 @@ public:
objectLabel(false),
glesMultisampleRenderToTexture(false),
glesMultiviewMultisampleRenderToTexture(false),
unpackRowLength(false)
unpackRowLength(false),
perRenderTargetBlending(false)
{ }
int ctxMajor;
int ctxMinor;
@ -1085,6 +1086,7 @@ public:
uint glesMultisampleRenderToTexture : 1;
uint glesMultiviewMultisampleRenderToTexture : 1;
uint unpackRowLength : 1;
uint perRenderTargetBlending : 1;
} caps;
QGles2SwapChain *currentSwapChain = nullptr;
QSet<GLint> supportedCompressedFormats;

View File

@ -867,6 +867,8 @@ bool QRhiMetal::isFeatureSupported(QRhi::Feature feature) const
return caps.shadingRateMap;
case QRhi::VariableRateShadingMapWithTexture:
return false;
case QRhi::PerRenderTargetBlending:
return true;
default:
Q_UNREACHABLE();
return false;

View File

@ -5202,6 +5202,8 @@ bool QRhiVulkan::isFeatureSupported(QRhi::Feature feature) const
case QRhi::VariableRateShadingMap:
case QRhi::VariableRateShadingMapWithTexture:
return caps.renderPass2KHR && caps.imageBasedShadingRate;
case QRhi::PerRenderTargetBlending:
return true;
default:
Q_UNREACHABLE_RETURN(false);
}