Skip to content

Commit e219c7e

Browse files
rphilliSkia Commit-Bot
authored andcommitted
Require a direct context to precompile shaders in DM
Change-Id: I44051f0e00ac47c53631084e2221594ec30bddfc Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310067 Reviewed-by: Adlai Holler <[email protected]> Commit-Queue: Robert Phillips <[email protected]>
1 parent 1cf2c8d commit e219c7e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

dm/DMSrcSink.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ bool GPUSink::readBack(SkSurface* surface, SkBitmap* dst) const {
15151515

15161516
Result GPUSink::onDraw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log,
15171517
const GrContextOptions& baseOptions,
1518-
std::function<void(GrContext*)> initContext) const {
1518+
std::function<void(GrDirectContext*)> initContext) const {
15191519
GrContextOptions grOptions = baseOptions;
15201520

15211521
// We don't expect the src to mess with the persistent cache or the executor.
@@ -1675,9 +1675,11 @@ Result GPUPrecompileTestingSink::draw(const Src& src, SkBitmap* dst, SkWStream*
16751675
return result;
16761676
}
16771677

1678-
auto precompileShaders = [&memoryCache](GrContext* context) {
1679-
memoryCache.foreach([context](sk_sp<const SkData> key, sk_sp<SkData> data, int /*count*/) {
1680-
SkAssertResult(context->precompileShader(*key, *data));
1678+
auto precompileShaders = [&memoryCache](GrDirectContext* dContext) {
1679+
memoryCache.foreach([dContext](sk_sp<const SkData> key,
1680+
sk_sp<SkData> data,
1681+
int /*count*/) {
1682+
SkAssertResult(dContext->precompileShader(*key, *data));
16811683
});
16821684
};
16831685

@@ -1911,7 +1913,7 @@ Result GPUDDLSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log
19111913
// with the main context
19121914
ContextInfo otherCtxInfo = factory.getSharedContextInfo(mainCtx);
19131915
sk_gpu_test::TestContext* otherTestCtx = otherCtxInfo.testContext();
1914-
GrContext* otherCtx = otherCtxInfo.grContext();
1916+
auto otherCtx = otherCtxInfo.directContext();
19151917
if (!otherCtx) {
19161918
return Result::Fatal("Cound not create shared context.");
19171919
}

dm/DMSrcSink.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class GPUSink : public Sink {
386386
Result draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override;
387387
Result onDraw(const Src&, SkBitmap*, SkWStream*, SkString*,
388388
const GrContextOptions& baseOptions,
389-
std::function<void(GrContext*)> initContext = nullptr) const;
389+
std::function<void(GrDirectContext*)> initContext = nullptr) const;
390390

391391
sk_gpu_test::GrContextFactory::ContextType contextType() const { return fContextType; }
392392
const sk_gpu_test::GrContextFactory::ContextOverrides& contextOverrides() const {

0 commit comments

Comments
 (0)