289da86e37
This reverts commit f33b061e3b
.
Reason for revert: Google3 roll and wasm build
Original change's description:
> Add support for uniforms and layout(key)s to DSLCPPCodeGenerator.
>
> Change-Id: I77c386e3d72fb4a5986e5efb8bc9d409200534d1
> Bug: skia:11854
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398457
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I006ece639fa6051ff6ef1c496e648db9d5d0b30a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399498
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
78 lines
3.3 KiB
C++
78 lines
3.3 KiB
C++
/*
|
|
* Copyright 2021 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "gm/gm.h"
|
|
#include "include/core/SkBitmap.h"
|
|
#include "include/core/SkCanvas.h"
|
|
#include "include/core/SkData.h"
|
|
#include "include/core/SkFont.h"
|
|
#include "include/core/SkPaint.h"
|
|
#include "include/core/SkSize.h"
|
|
#include "include/core/SkString.h"
|
|
#include "include/core/SkSurface.h"
|
|
#include "src/gpu/GrDirectContextPriv.h"
|
|
#include "src/gpu/GrSurfaceDrawContext.h"
|
|
#include "tests/Test.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_DoStatement.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_ForStatement.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_IfStatement.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_SwitchStatement.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_Swizzle.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_Ternary.h"
|
|
#include "tests/sksl/dslfp/GrDSLFPTest_WhileStatement.h"
|
|
#include "tools/Resources.h"
|
|
#include "tools/ToolUtils.h"
|
|
|
|
template <typename FPClass>
|
|
static void test_dsl_fp(skiatest::Reporter* r, GrDirectContext* ctx, bool worksInES2) {
|
|
if (!worksInES2) {
|
|
// We don't have an ES2 caps bit, so we check for integer support and derivatives support.
|
|
// Our ES2 bots should return false for these.
|
|
if (!ctx->priv().caps()->shaderCaps()->shaderDerivativeSupport() ||
|
|
!ctx->priv().caps()->shaderCaps()->integerSupport()) {
|
|
return;
|
|
}
|
|
}
|
|
std::unique_ptr<GrSurfaceDrawContext> rtCtx =
|
|
GrSurfaceDrawContext::Make(ctx,
|
|
GrColorType::kRGBA_8888,
|
|
/*colorSpace=*/nullptr,
|
|
SkBackingFit::kApprox,
|
|
/*dimensions=*/{1, 1},
|
|
SkSurfaceProps{});
|
|
|
|
rtCtx->fillRectWithFP(SkIRect::MakeWH(1, 1), FPClass::Make());
|
|
|
|
SkImageInfo dstInfo = SkImageInfo::Make(/*width=*/1, /*height=*/1, kRGBA_8888_SkColorType,
|
|
kPremul_SkAlphaType, /*cs=*/nullptr);
|
|
GrPixmap dstPM = GrPixmap::Allocate(dstInfo);
|
|
REPORTER_ASSERT(r, rtCtx->readPixels(ctx, dstPM, /*srcPt=*/{0, 0}));
|
|
|
|
const GrColor* color = static_cast<const GrColor*>(dstPM.addr());
|
|
REPORTER_ASSERT(r, *color == GrColorPackRGBA(0x00, 0xFF, 0x00, 0xFF),
|
|
"Expected: solid green. Actual: A=%02X R=%02X G=%02X B=%02X.",
|
|
GrColorUnpackA(*color), GrColorUnpackR(*color),
|
|
GrColorUnpackG(*color), GrColorUnpackB(*color));
|
|
}
|
|
|
|
#define DSL_FP_TEST_ES2(FPClass) \
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FPClass, r, ctxInfo) { \
|
|
return test_dsl_fp<Gr##FPClass>(r, ctxInfo.directContext(), /*worksInES2=*/true); \
|
|
}
|
|
#define DSL_FP_TEST(FPClass) \
|
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FPClass, r, ctxInfo) { \
|
|
return test_dsl_fp<Gr##FPClass>(r, ctxInfo.directContext(), /*worksInES2=*/false); \
|
|
}
|
|
|
|
DSL_FP_TEST_ES2(DSLFPTest_IfStatement)
|
|
DSL_FP_TEST_ES2(DSLFPTest_Swizzle)
|
|
DSL_FP_TEST_ES2(DSLFPTest_Ternary)
|
|
DSL_FP_TEST(DSLFPTest_DoStatement)
|
|
DSL_FP_TEST(DSLFPTest_ForStatement)
|
|
DSL_FP_TEST(DSLFPTest_SwitchStatement)
|
|
DSL_FP_TEST(DSLFPTest_WhileStatement)
|