Check for SkSL ES3 capabilities in GrShaderCaps.

This lets us set the minimum bar for SkSL ES3 support in one place,
rather than checking this set of bits in multiple spots.

Change-Id: Icba58d8b6a93626ce2ffbe3c4b846cad4749cab5
Bug: skia:12347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/440518
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2021-08-18 12:17:21 -04:00 committed by SkCQ
parent 3cb09c0904
commit 0733d48428
3 changed files with 10 additions and 11 deletions

View File

@ -197,12 +197,8 @@ DEF_SIMPLE_GPU_GM_CAN_FAIL(runtime_intrinsics_trig_es3,
ctx, canvas, errorMsg,
columns_to_width(3),
rows_to_height(2)) {
// We don't have an ES2 caps bit, so we check the caps bits for features that ES2 explicitly
// doesn't support. Our ES2 bots should return false for these.
if (!ctx->priv().caps()->shaderCaps()->shaderDerivativeSupport() ||
!ctx->priv().caps()->shaderCaps()->integerSupport() ||
!ctx->priv().caps()->shaderCaps()->nonsquareMatrixSupport()) {
*errorMsg = "ES3 features are required.";
if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
*errorMsg = "SkSL ES3 is not supported.";
return skiagm::DrawResult::kSkip;
}

View File

@ -97,6 +97,13 @@ public:
// reduce the number of unique shaders generated.
bool reducedShaderMode() const { return fReducedShaderMode; }
/**
* SkSL ES3 requires support for derivatives, nonsquare matrices and bitwise integer operations.
*/
bool supportsSkSLES3() const {
return fShaderDerivativeSupport && fNonsquareMatrixSupport && fIntegerSupport;
}
// SkSL only.
bool builtinFMASupport() const { return fBuiltinFMASupport; }

View File

@ -123,11 +123,7 @@ static void test_gpu(skiatest::Reporter* r, GrDirectContext* ctx, const char* te
}
static void test_es3(skiatest::Reporter* r, GrDirectContext* ctx, const char* testFile) {
// We don't have an ES2 caps bit, so we check the caps bits for features that ES2 explicitly
// doesn't support. Our ES2 bots should return false for these.
if (!ctx->priv().caps()->shaderCaps()->shaderDerivativeSupport() ||
!ctx->priv().caps()->shaderCaps()->integerSupport() ||
!ctx->priv().caps()->shaderCaps()->nonsquareMatrixSupport()) {
if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
return;
}
// ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features.