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

View File

@ -97,6 +97,13 @@ public:
// reduce the number of unique shaders generated. // reduce the number of unique shaders generated.
bool reducedShaderMode() const { return fReducedShaderMode; } 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. // SkSL only.
bool builtinFMASupport() const { return fBuiltinFMASupport; } 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) { 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 if (!ctx->priv().caps()->shaderCaps()->supportsSkSLES3()) {
// 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()) {
return; return;
} }
// ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features. // ES3-only tests never run on the CPU, because SkVM lacks support for many non-ES2 features.