Add caps bit for inverse-hyperbolic support.

HLSL doesn't expose asinh/acosh/atanh intrinsics.

Change-Id: I116728adb9a9643034b962a1af44767782fac775
Bug: skia:12352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440259
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-08-17 15:58:03 -04:00 committed by SkCQ
parent 39822cf1e6
commit bc9222b615
7 changed files with 18 additions and 0 deletions

View File

@ -22,6 +22,7 @@ GrShaderCaps::GrShaderCaps(const GrContextOptions& options) {
fDualSourceBlendingSupport = false;
fIntegerSupport = false;
fNonsquareMatrixSupport = false;
fInverseHyperbolicSupport = false;
fFBFetchSupport = false;
fFBFetchNeedsCustomOutput = false;
fUsesPrecisionModifiers = false;
@ -95,6 +96,7 @@ void GrShaderCaps::dumpJSON(SkJSONWriter* writer) const {
writer->appendBool("Dual Source Blending Support", fDualSourceBlendingSupport);
writer->appendBool("Integer Support", fIntegerSupport);
writer->appendBool("Nonsquare Matrix Support", fNonsquareMatrixSupport);
writer->appendBool("Inverse Hyperbolic Support", fInverseHyperbolicSupport);
static const char* kAdvBlendEqInteractionStr[] = {
"Not Supported",

View File

@ -49,6 +49,9 @@ public:
bool integerSupport() const { return fIntegerSupport; }
bool nonsquareMatrixSupport() const { return fNonsquareMatrixSupport; }
// asinh(), acosh(), atanh()
bool inverseHyperbolicSupport() const { return fInverseHyperbolicSupport; }
/**
* Some helper functions for encapsulating various extensions to read FB Buffer on openglES
*
@ -283,6 +286,7 @@ private:
bool fDualSourceBlendingSupport : 1;
bool fIntegerSupport : 1;
bool fNonsquareMatrixSupport : 1;
bool fInverseHyperbolicSupport : 1;
bool fFBFetchSupport : 1;
bool fFBFetchNeedsCustomOutput : 1;
bool fUsesPrecisionModifiers : 1;

View File

@ -246,6 +246,8 @@ void GrD3DCaps::initShaderCaps(int vendorID, const D3D12_FEATURE_DATA_D3D12_OPTI
shaderCaps->fIntegerSupport = true;
shaderCaps->fNonsquareMatrixSupport = true;
// TODO(skia:12352) HLSL does not expose asinh/acosh/atanh
shaderCaps->fInverseHyperbolicSupport = false;
shaderCaps->fVertexIDSupport = true;
shaderCaps->fInfinitySupport = true;
shaderCaps->fBitManipulationSupport = true;

View File

@ -388,6 +388,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
ctxInfo.glslGeneration() >= k130_GrGLSLGeneration;
shaderCaps->fNonsquareMatrixSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration;
shaderCaps->fInverseHyperbolicSupport = ctxInfo.glslGeneration() >= k130_GrGLSLGeneration;
} else if (GR_IS_GR_GL_ES(standard)) {
shaderCaps->fDualSourceBlendingSupport = ctxInfo.hasExtension("GL_EXT_blend_func_extended");
@ -413,12 +414,14 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
shaderCaps->fIntegerSupport = version >= GR_GL_VER(3, 0) &&
ctxInfo.glslGeneration() >= k330_GrGLSLGeneration; // We use this value for GLSL ES 3.0.
shaderCaps->fNonsquareMatrixSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
shaderCaps->fInverseHyperbolicSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
} else if (GR_IS_GR_WEBGL(standard)) {
shaderCaps->fShaderDerivativeSupport = version >= GR_GL_VER(2, 0) ||
ctxInfo.hasExtension("GL_OES_standard_derivatives") ||
ctxInfo.hasExtension("OES_standard_derivatives");
shaderCaps->fIntegerSupport = (version >= GR_GL_VER(2, 0));
shaderCaps->fNonsquareMatrixSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
shaderCaps->fInverseHyperbolicSupport = ctxInfo.glslGeneration() >= k330_GrGLSLGeneration;
}
if (ctxInfo.hasExtension("GL_NV_conservative_raster")) {

View File

@ -475,6 +475,7 @@ void GrMtlCaps::initShaderCaps() {
shaderCaps->fIntegerSupport = true;
shaderCaps->fNonsquareMatrixSupport = true;
shaderCaps->fInverseHyperbolicSupport = true;
shaderCaps->fVertexIDSupport = true;
shaderCaps->fInfinitySupport = true;

View File

@ -715,6 +715,7 @@ void GrVkCaps::initShaderCaps(const VkPhysicalDeviceProperties& properties,
shaderCaps->fIntegerSupport = true;
shaderCaps->fNonsquareMatrixSupport = true;
shaderCaps->fInverseHyperbolicSupport = true;
shaderCaps->fVertexIDSupport = true;
shaderCaps->fInfinitySupport = true;
shaderCaps->fBitManipulationSupport = true;

View File

@ -174,6 +174,11 @@ public:
return fNonsquareMatrixSupport;
}
bool fInverseHyperbolicSupport = false;
bool inverseHyperbolicSupport() const {
return fInverseHyperbolicSupport;
}
bool fBuiltinFMASupport = false;
bool builtinFMASupport() const {
return fBuiltinFMASupport;