Update unit tests to accept GrDirectContext
This CL makes it explicit that the unit tests always get a direct context.
It is mainly a mechanical CL.
Change-Id: I49e0628851d9c81eb47386ef978edf905c6469d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299866
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/AdvancedBlendTest.cpp b/tests/AdvancedBlendTest.cpp
index 176bf83..b69dd2e3 100644
--- a/tests/AdvancedBlendTest.cpp
+++ b/tests/AdvancedBlendTest.cpp
@@ -6,7 +6,7 @@
*/
#include "include/core/SkBlendMode.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h"
#include "src/gpu/GrBlend.h"
@@ -26,7 +26,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(AdvancedBlendTest, reporter, ctxInfo) {
static constexpr auto opaque = GrProcessorAnalysisColor::Opaque::kYes;
static constexpr auto coverage = GrProcessorAnalysisCoverage::kSingleChannel;
- const GrCaps& caps = *ctxInfo.grContext()->priv().caps();
+ const GrCaps& caps = *ctxInfo.directContext()->priv().caps();
for (int mode = (int)SkBlendMode::kLastMode; mode > (int)SkBlendMode::kLastCoeffMode; --mode) {
const SkBlendMode blendMode = (SkBlendMode)mode;
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp
index f2a16e9..904d94f 100644
--- a/tests/ApplyGammaTest.cpp
+++ b/tests/ApplyGammaTest.cpp
@@ -17,7 +17,7 @@
#include "include/core/SkScalar.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkTemplates.h"
#include "src/core/SkUtils.h"
@@ -94,7 +94,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static constexpr SkISize kBaseSize{256, 256};
static const size_t kRowBytes = sizeof(uint32_t) * kBaseSize.fWidth;
diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp
index d4c16d3..5ebd917 100644
--- a/tests/BackendAllocationTest.cpp
+++ b/tests/BackendAllocationTest.cpp
@@ -8,7 +8,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/core/SkSurfaceCharacterization.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/GrContextPriv.h"
#include "src/image/SkImage_Base.h"
@@ -575,7 +575,7 @@
// SkSurface we can create in Ganesh, we can also create a backend texture that is compatible with
// its characterization and then create a new surface that wraps that backend texture.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CharacterizationBackendAllocationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
for (int ct = 0; ct <= kLastEnum_SkColorType; ++ct) {
SkColorType colorType = static_cast<SkColorType>(ct);
@@ -662,7 +662,7 @@
///////////////////////////////////////////////////////////////////////////////
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ColorTypeBackendAllocationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
constexpr SkColor4f kTransCol { 0, 0.25f, 0.75f, 0.5f };
@@ -828,7 +828,7 @@
DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLBackendAllocationTest, reporter, ctxInfo) {
sk_gpu_test::GLTestContext* glCtx = ctxInfo.glContext();
GrGLStandard standard = glCtx->gl()->fStandard;
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(context->priv().caps());
constexpr SkColor4f kTransCol { 0, 0.25f, 0.75f, 0.5f };
@@ -985,7 +985,7 @@
#include "src/gpu/vk/GrVkCaps.h"
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendAllocationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrVkCaps* vkCaps = static_cast<const GrVkCaps*>(context->priv().caps());
constexpr SkColor4f kTransCol { 0, 0.25f, 0.75f, 0.5f };
diff --git a/tests/BackendSurfaceMutableStateTest.cpp b/tests/BackendSurfaceMutableStateTest.cpp
index 3816bb4..4ae2ebe 100644
--- a/tests/BackendSurfaceMutableStateTest.cpp
+++ b/tests/BackendSurfaceMutableStateTest.cpp
@@ -7,7 +7,7 @@
#include "include/core/SkImage.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/vk/GrVkTypes.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrTexture.h"
@@ -20,7 +20,7 @@
#include "src/gpu/vk/GrVkTexture.h"
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkBackendSurfaceMutableStateTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrBackendFormat format = GrBackendFormat::MakeVk(VK_FORMAT_R8G8B8A8_UNORM);
GrBackendTexture backendTex = context->createBackendTexture(
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 4be3330..f0bfb93 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -18,7 +18,7 @@
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrCaps.h"
@@ -89,7 +89,7 @@
namespace {
static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
- GrContext* context, int sampleCnt, SkISize dimensions, SkColorType colorType,
+ GrDirectContext* context, int sampleCnt, SkISize dimensions, SkColorType colorType,
GrSurfaceOrigin origin, sk_sp<GrTexture>* backingSurface) {
auto ct = SkColorTypeToGrColorType(colorType);
auto format = context->priv().caps()->getDefaultBackendFormat(ct, GrRenderable::kYes);
@@ -115,7 +115,7 @@
// Tests blending to a surface with no texture available.
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static constexpr SkISize kDimensions{10, 10};
const SkColorType kColorType = kRGBA_8888_SkColorType;
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 4e80266..255e720 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -30,6 +30,7 @@
#include "include/effects/SkBlurDrawLooper.h"
#include "include/effects/SkLayerDrawLooper.h"
#include "include/effects/SkPerlinNoiseShader.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/SkFloatBits.h"
#include "src/core/SkBlurMask.h"
#include "src/core/SkBlurPriv.h"
@@ -46,8 +47,6 @@
#include <initializer_list>
#include <utility>
-class GrContext;
-
#define WRITE_CSV 0
///////////////////////////////////////////////////////////////////////////////
@@ -504,7 +503,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctxInfo) {
SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
- auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info));
+ auto surface(SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info));
SkCanvas* canvas = surface->getCanvas();
SkRect r = SkRect::MakeXYWH(10, 10, 100, 100);
@@ -706,7 +705,7 @@
///////////////////////////////////////////////////////////////////////////////////////////
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BlurMaskBiggerThanDest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::Make(32, 32, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
diff --git a/tests/BulkRectTest.cpp b/tests/BulkRectTest.cpp
index a4de496..f7d6900 100644
--- a/tests/BulkRectTest.cpp
+++ b/tests/BulkRectTest.cpp
@@ -4,6 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkBlendModePriv.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
@@ -215,9 +217,9 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkFillRectTest, reporter, ctxInfo) {
- run_test(ctxInfo.grContext(), reporter, bulk_fill_rect_create_test);
+ run_test(ctxInfo.directContext(), reporter, bulk_fill_rect_create_test);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BulkTextureRectTest, reporter, ctxInfo) {
- run_test(ctxInfo.grContext(), reporter, bulk_texture_rect_create_test);
+ run_test(ctxInfo.directContext(), reporter, bulk_texture_rect_create_test);
}
diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp
index 73d168d..7969ca6 100644
--- a/tests/ClearTest.cpp
+++ b/tests/ClearTest.cpp
@@ -15,13 +15,12 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
-#include "include/gpu/GrContext.h"
#include "include/gpu/GrContextOptions.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/gpu/GrColor.h"
-#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "tests/Test.h"
@@ -228,7 +227,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ClearOp, reporter, ctxInfo) {
// Regular clear
- clear_op_test(reporter, ctxInfo.grContext());
+ clear_op_test(reporter, ctxInfo.directContext());
// Force drawing for clears
GrContextOptions options(ctxInfo.options());
@@ -294,7 +293,7 @@
// From crbug.com/768134
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FullScreenClearWithLayers, reporter, ctxInfo) {
// Regular clear
- fullscreen_clear_with_layer_test(reporter, ctxInfo.grContext());
+ fullscreen_clear_with_layer_test(reporter, ctxInfo.directContext());
// Use draws for clears
GrContextOptions options(ctxInfo.options());
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index e3562eb..6504d64 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -22,7 +22,7 @@
#include "include/core/SkTypes.h"
#include "include/effects/SkGradientShader.h"
#include "include/gpu/GrConfig.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrResourceKey.h"
#include "include/private/SkTemplates.h"
#include "include/utils/SkRandom.h"
@@ -1555,7 +1555,7 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(ClipMaskCache, reporter, ctxInfo) {
// This test uses resource key tags which only function in debug builds.
#ifdef SK_DEBUG
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkClipStack stack;
SkPath path;
diff --git a/tests/CompressedBackendAllocationTest.cpp b/tests/CompressedBackendAllocationTest.cpp
index 6aec353..1fa6ea8 100644
--- a/tests/CompressedBackendAllocationTest.cpp
+++ b/tests/CompressedBackendAllocationTest.cpp
@@ -6,7 +6,7 @@
*/
#include "include/core/SkCanvas.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/core/SkMipMap.h"
@@ -236,7 +236,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CompressedBackendAllocationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
struct {
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index e17ad00..2780daf 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkTemplates.h"
@@ -31,7 +31,8 @@
#include <utility>
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
- auto context = ctxInfo.directContext();
+ auto direct = ctxInfo.directContext();
+
static const int kW = 10;
static const int kH = 10;
static const size_t kRowBytes = sizeof(uint32_t) * kW;
@@ -78,10 +79,10 @@
for (auto dstPoint : kDstPoints) {
for (auto ii: kImageInfos) {
auto src = sk_gpu_test::MakeTextureProxyFromData(
- context, sRenderable, sOrigin, ii, srcPixels.get(),
+ direct, sRenderable, sOrigin, ii, srcPixels.get(),
kRowBytes);
auto dst = sk_gpu_test::MakeTextureProxyFromData(
- context, dRenderable, dOrigin, ii, dstPixels.get(),
+ direct, dRenderable, dOrigin, ii, dstPixels.get(),
kRowBytes);
// Should always work if the color type is RGBA, but may not work
@@ -93,7 +94,7 @@
continue;
}
} else {
- if (!context->defaultBackendFormat(
+ if (!direct->defaultBackendFormat(
kBGRA_8888_SkColorType, GrRenderable::kNo).isValid()) {
continue;
}
@@ -105,10 +106,10 @@
}
GrColorType grColorType = SkColorTypeToGrColorType(ii.colorType());
- GrSwizzle dstSwizzle = context->priv().caps()->getReadSwizzle(
+ GrSwizzle dstSwizzle = direct->priv().caps()->getReadSwizzle(
dst->backendFormat(), grColorType);
GrSurfaceProxyView dstView(std::move(dst), dOrigin, dstSwizzle);
- auto dstContext = GrSurfaceContext::Make(context,
+ auto dstContext = GrSurfaceContext::Make(direct,
std::move(dstView),
grColorType,
ii.alphaType(), nullptr);
@@ -118,7 +119,7 @@
result = dstContext->testCopy(src.get(), srcRect, dstPoint);
} else if (dRenderable == GrRenderable::kYes) {
SkASSERT(dstContext->asRenderTargetContext());
- GrSwizzle srcSwizzle = context->priv().caps()->getReadSwizzle(
+ GrSwizzle srcSwizzle = direct->priv().caps()->getReadSwizzle(
src->backendFormat(), grColorType);
GrSurfaceProxyView view(std::move(src), sOrigin, srcSwizzle);
result = dstContext->asRenderTargetContext()->blitTexture(
diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp
index 658889b..8d88e76 100644
--- a/tests/DefaultPathRendererTest.cpp
+++ b/tests/DefaultPathRendererTest.cpp
@@ -17,8 +17,8 @@
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
#include "include/gpu/GrContextOptions.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrTypesPriv.h"
#include "include/private/SkColorData.h"
@@ -133,7 +133,7 @@
DEF_GPUTEST_FOR_CONTEXTS(GrDefaultPathRendererTest,
sk_gpu_test::GrContextFactory::IsRenderingContext,
reporter, ctxInfo, only_allow_default) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
run_test(ctx, reporter);
}
diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp
index fd6ad72..a24a3ef 100644
--- a/tests/DeferredDisplayListTest.cpp
+++ b/tests/DeferredDisplayListTest.cpp
@@ -22,8 +22,8 @@
#include "include/core/SkSurfaceProps.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
#include "include/gpu/GrContextThreadSafeProxy.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/gpu/gl/GrGLTypes.h"
#include "include/private/GrTypesPriv.h"
@@ -266,7 +266,7 @@
// Test out operator== && operator!=
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLOperatorEqTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
bool mipMapSupport = context->priv().caps()->mipMapSupport();
for (int i = 0; i < SurfaceParameters::kNumParams; ++i) {
@@ -640,7 +640,7 @@
// and then tries all sixteen combinations to check the expected compatibility.
// Note: this is a GL-only test
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(CharacterizationFBO0nessTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
sk_sp<GrContextThreadSafeProxy> proxy = context->threadSafeProxy();
const size_t resourceCacheLimit = context->getResourceCacheLimit();
@@ -706,7 +706,7 @@
#endif
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
DDLSurfaceCharacterizationTestImpl(context, reporter);
}
@@ -716,7 +716,7 @@
// textureable DDL cannot be played into a non-textureable destination but can be replayed
// into a textureable destination.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLNonTextureabilityTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGpu* gpu = context->priv().getGpu();
// Create a bitmap that we can readback into
@@ -855,7 +855,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMakeRenderTargetTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
DDLMakeRenderTargetTestImpl(context, reporter);
}
@@ -875,7 +875,7 @@
// This tests the ability to create and use wrapped textures in a DDL world
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrBackendTexture backendTex;
CreateBackendTexture(context, &backendTex, kSize, kSize, kRGBA_8888_SkColorType,
@@ -942,7 +942,7 @@
////////////////////////////////////////////////////////////////////////////////
// Test out the behavior of an invalid DDLRecorder
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLInvalidRecorder, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
{
SkImageInfo ii = SkImageInfo::MakeN32Premul(32, 32);
@@ -987,7 +987,7 @@
////////////////////////////////////////////////////////////////////////////////
// Ensure that flushing while DDL recording doesn't cause a crash
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLFlushWhileRecording, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::MakeN32Premul(32, 32);
sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii);
@@ -1028,7 +1028,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSkSurfaceFlush, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::Make(32, 32, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii);
@@ -1104,7 +1104,7 @@
////////////////////////////////////////////////////////////////////////////////
// Ensure that reusing a single DDLRecorder to create multiple DDLs works cleanly
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMultipleDDLs, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::MakeN32Premul(32, 32);
sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii);
@@ -1161,7 +1161,7 @@
// Check that the texture-specific flags (i.e., for external & rectangle textures) work
// for promise images. As such, this is a GL-only test.
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLTextureFlagsTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::MakeN32Premul(32, 32);
sk_sp<SkSurface> s = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii);
@@ -1207,7 +1207,7 @@
////////////////////////////////////////////////////////////////////////////////
// Test colorType and pixelConfig compatibility.
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLCompatibilityTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
for (int ct = 0; ct <= kLastEnum_SkColorType; ++ct) {
SkColorType colorType = static_cast<SkColorType>(ct);
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index c9cd505..bb04099 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/GrTypesPriv.h"
#include "src/gpu/GrCaps.h"
@@ -388,7 +388,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DetermineDomainModeTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
proxy_test(reporter, context);
}
diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp
index 1ecf907..32453a4 100644
--- a/tests/DeviceTest.cpp
+++ b/tests/DeviceTest.cpp
@@ -11,6 +11,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrTypes.h"
#include "src/core/SkDevice.h"
#include "src/core/SkSpecialImage.h"
@@ -77,7 +78,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static const int kWidth = 100;
static const int kHeight = 90;
diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp
index 7d0d0d7..c614579 100644
--- a/tests/DrawOpAtlasTest.cpp
+++ b/tests/DrawOpAtlasTest.cpp
@@ -17,7 +17,7 @@
#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrTypesPriv.h"
#include "src/core/SkIPoint16.h"
#include "src/gpu/GrCaps.h"
@@ -132,7 +132,7 @@
// This is a basic DrawOpAtlas test. It simply verifies that multitexture atlases correctly
// add and remove pages. Note that this is simulating flush-time behavior.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(BasicDrawOpAtlas, reporter, ctxInfo) {
- auto context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto proxyProvider = context->priv().proxyProvider();
auto resourceProvider = context->priv().resourceProvider();
auto drawingManager = context->priv().drawingManager();
@@ -191,7 +191,7 @@
// when allocating an atlas page.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo) {
- auto context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto gpu = context->priv().getGpu();
auto resourceProvider = context->priv().resourceProvider();
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index cd19c92..f6f6b6b 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetContext.h"
@@ -47,7 +47,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
- GrContext* context0 = ctxInfo.grContext();
+ auto context0 = ctxInfo.directContext();
sk_gpu_test::GLTestContext* glCtx0 = ctxInfo.glContext();
// Try to create a second GL context and then check if the contexts have necessary
diff --git a/tests/ExtendedSkColorTypeTests.cpp b/tests/ExtendedSkColorTypeTests.cpp
index 0402973..a6cc599 100644
--- a/tests/ExtendedSkColorTypeTests.cpp
+++ b/tests/ExtendedSkColorTypeTests.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "tests/Test.h"
@@ -302,7 +303,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ExtendedSkColorTypeTests_gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
gpu_tests(context, reporter, gTests[i]);
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 933294b..8ddaa70 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -77,7 +77,7 @@
static const SkHalf kMaxIntegerRepresentableInHalfFloatingPoint = 0x6800; // 2 ^ 11
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatAlphaTextureTest, reporter, ctxInfo) {
- auto direct = ctxInfo.grContext()->asDirectContext();
+ auto direct = ctxInfo.directContext();
runFPTest<SkHalf>(reporter, direct, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint, HALF_ALPHA_CONTROL_ARRAY_SIZE,
@@ -87,7 +87,7 @@
static const int HALF_RGBA_CONTROL_ARRAY_SIZE = DEV_W * DEV_H * 4 /*RGBA*/;
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(HalfFloatRGBATextureTest, reporter, ctxInfo) {
- auto direct = ctxInfo.grContext()->asDirectContext();
+ auto direct = ctxInfo.directContext();
runFPTest<SkHalf>(reporter, direct, SK_HalfMin, SK_HalfMax, SK_HalfEpsilon,
kMaxIntegerRepresentableInHalfFloatingPoint, HALF_RGBA_CONTROL_ARRAY_SIZE,
diff --git a/tests/GLBackendSurfaceTest.cpp b/tests/GLBackendSurfaceTest.cpp
index 7773137..f5a61e2 100644
--- a/tests/GLBackendSurfaceTest.cpp
+++ b/tests/GLBackendSurfaceTest.cpp
@@ -14,6 +14,7 @@
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/gl/GrGLTypes.h"
#include "include/private/GrGLTypesPriv.h"
#include "src/gpu/GrContextPriv.h"
@@ -46,7 +47,7 @@
}
DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GLTextureParameters, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrBackendTexture backendTex = context->createBackendTexture(
1, 1, kRGBA_8888_SkColorType, GrMipMapped::kNo, GrRenderable::kNo, GrProtected::kNo);
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index e8ea898..813b542 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -16,7 +16,7 @@
#include "include/core/SkRect.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkDashPathEffect.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrPath.h"
#include "src/gpu/geometry/GrStyledShape.h"
#include "tests/Test.h"
@@ -79,7 +79,7 @@
for (auto& sampleCount : {1, 4, 16}) {
SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255);
auto surface(
- SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info,
+ SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info,
sampleCount, nullptr));
if (!surface) {
continue;
@@ -94,7 +94,7 @@
// path to be accepted by AAConvexPathRenderer, then be transformed to something without a
// computable first direction by a perspective matrix.
SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
- auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info));
+ auto surface(SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info));
SkPaint paint;
paint.setAntiAlias(true);
diff --git a/tests/GrAHardwareBufferTest.cpp b/tests/GrAHardwareBufferTest.cpp
index 03ed00f..c5fb7c7 100644
--- a/tests/GrAHardwareBufferTest.cpp
+++ b/tests/GrAHardwareBufferTest.cpp
@@ -14,7 +14,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrAHardwareBufferImageGenerator.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
@@ -102,7 +102,7 @@
const sk_gpu_test::ContextInfo& info,
GrSurfaceOrigin surfaceOrigin) {
- GrContext* context = info.grContext();
+ auto context = info.directContext();
if (!context->priv().caps()->supportsAHardwareBufferImages()) {
return;
}
@@ -212,7 +212,7 @@
const sk_gpu_test::ContextInfo& info,
GrSurfaceOrigin surfaceOrigin) {
- GrContext* context = info.grContext();
+ auto context = info.directContext();
if (!context->priv().caps()->supportsAHardwareBufferImages()) {
return;
}
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index aee2c01..d7c713f 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -10,6 +10,8 @@
#include "include/core/SkMatrix.h"
#include "include/core/SkRect.h"
+#include "include/gpu/GrDirectContext.h"
+#include "include/gpu/GrRecordingContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/gpu/mock/GrMockTypes.h"
#include "src/core/SkPathPriv.h"
@@ -883,8 +885,8 @@
#define DEF_CCPR_RENDERING_TEST(name) \
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(name, reporter, ctxInfo) { \
name test; \
- test.run(reporter, ctxInfo.grContext(), DoStroke::kNo); \
- test.run(reporter, ctxInfo.grContext(), DoStroke::kYes); \
+ test.run(reporter, ctxInfo.directContext(), DoStroke::kNo); \
+ test.run(reporter, ctxInfo.directContext(), DoStroke::kYes); \
}
class CCPR_busyPath : public CCPRRenderingTest {
diff --git a/tests/GrContextAbandonTest.cpp b/tests/GrContextAbandonTest.cpp
index 0300caa..ecc6347 100644
--- a/tests/GrContextAbandonTest.cpp
+++ b/tests/GrContextAbandonTest.cpp
@@ -7,6 +7,7 @@
#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
#include "tools/gpu/GrContextFactory.h"
@@ -18,7 +19,7 @@
GrContextFactory testFactory(options);
GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
ContextInfo info = testFactory.getContextInfo(ctxType);
- if (GrContext* context = info.grContext()) {
+ if (auto context = info.directContext()) {
switch (testType) {
case 0:
context->abandonContext();
diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp
index 642947b..94950e8 100644
--- a/tests/GrContextFactoryTest.cpp
+++ b/tests/GrContextFactoryTest.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkTypes.h"
#include "include/core/SkExecutor.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "tests/Test.h"
@@ -20,23 +21,23 @@
GrContextFactory testFactory(options);
GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
ContextInfo info1 = testFactory.getContextInfo(ctxType);
- if (!info1.grContext()) {
+ if (!info1.directContext()) {
continue;
}
REPORTER_ASSERT(reporter, info1.testContext());
// Ref for comparison. The API does not explicitly say that this stays alive.
- info1.grContext()->ref();
+ info1.directContext()->ref();
testFactory.abandonContexts();
// Test that we get different context after abandon.
ContextInfo info2 = testFactory.getContextInfo(ctxType);
- REPORTER_ASSERT(reporter, info2.grContext());
+ REPORTER_ASSERT(reporter, info2.directContext());
REPORTER_ASSERT(reporter, info2.testContext());
- REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext());
+ REPORTER_ASSERT(reporter, info1.directContext() != info2.directContext());
// The GL context should also change, but it also could get the same address.
- info1.grContext()->unref();
+ info1.directContext()->unref();
}
}
@@ -45,35 +46,35 @@
GrContextFactory testFactory(options);
GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i);
ContextInfo info1 = testFactory.getContextInfo(ctxType);
- if (!info1.grContext()) {
+ if (!info1.directContext()) {
continue;
}
// Ref for passing in. The API does not explicitly say that this stays alive.
- info1.grContext()->ref();
+ info1.directContext()->ref();
testFactory.abandonContexts();
// Test that creating a context in a share group with an abandoned context fails.
ContextInfo info2 = testFactory.getSharedContextInfo(info1.directContext());
- REPORTER_ASSERT(reporter, !info2.grContext());
- info1.grContext()->unref();
+ REPORTER_ASSERT(reporter, !info2.directContext());
+ info1.directContext()->unref();
// Create a new base context
ContextInfo info3 = testFactory.getContextInfo(ctxType);
// Creating a context in a share group may fail, but should never crash.
ContextInfo info4 = testFactory.getSharedContextInfo(info3.directContext());
- if (!info4.grContext()) {
+ if (!info4.directContext()) {
continue;
}
- REPORTER_ASSERT(reporter, info3.grContext() != info4.grContext());
+ REPORTER_ASSERT(reporter, info3.directContext() != info4.directContext());
REPORTER_ASSERT(reporter, info3.testContext() != info4.testContext());
// Passing a different index should create a new (unique) context.
ContextInfo info5 = testFactory.getSharedContextInfo(info3.directContext(), 1);
- REPORTER_ASSERT(reporter, info5.grContext());
+ REPORTER_ASSERT(reporter, info5.directContext());
REPORTER_ASSERT(reporter, info5.testContext());
- REPORTER_ASSERT(reporter, info5.grContext() != info4.grContext());
+ REPORTER_ASSERT(reporter, info5.directContext() != info4.directContext());
REPORTER_ASSERT(reporter, info5.testContext() != info4.testContext());
}
}
@@ -91,12 +92,12 @@
GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i);
ContextInfo serialInfo = serialFactory.getContextInfo(ctxType);
- if (GrContext* serialContext = serialInfo.grContext()) {
+ if (auto serialContext = serialInfo.directContext()) {
REPORTER_ASSERT(reporter, nullptr == serialContext->priv().getTaskGroup());
}
ContextInfo threadedInfo = threadedFactory.getContextInfo(ctxType);
- if (GrContext* threadedContext = threadedInfo.grContext()) {
+ if (auto threadedContext = threadedInfo.directContext()) {
REPORTER_ASSERT(reporter, nullptr != threadedContext->priv().getTaskGroup());
}
}
@@ -105,7 +106,7 @@
#ifdef SK_ENABLE_DUMP_GPU
DEF_GPUTEST_FOR_ALL_CONTEXTS(GrContextDump, reporter, ctxInfo) {
// Ensure that GrContext::dump doesn't assert (which is possible, if the JSON code is wrong)
- SkString result = ctxInfo.grContext()->dump();
+ SkString result = ctxInfo.directContext()->dump();
REPORTER_ASSERT(reporter, !result.isEmpty());
}
#endif
diff --git a/tests/GrContextOOM.cpp b/tests/GrContextOOM.cpp
index 64355e6..31d8e4c 100644
--- a/tests/GrContextOOM.cpp
+++ b/tests/GrContextOOM.cpp
@@ -10,7 +10,7 @@
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
DEF_GPUTEST(GrContext_oomed, reporter, originalOptions) {
@@ -20,7 +20,7 @@
sk_gpu_test::GrContextFactory factory(options);
for (int ct = 0; ct < sk_gpu_test::GrContextFactory::kContextTypeCnt; ++ct) {
auto contextType = static_cast<sk_gpu_test::GrContextFactory::ContextType>(ct);
- GrContext* context = factory.get(contextType);
+ auto context = factory.get(contextType);
if (!context) {
continue;
}
diff --git a/tests/GrFinishedFlushTest.cpp b/tests/GrFinishedFlushTest.cpp
index 8f71eee..2636d9b 100644
--- a/tests/GrFinishedFlushTest.cpp
+++ b/tests/GrFinishedFlushTest.cpp
@@ -10,7 +10,7 @@
#include <chrono>
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
@@ -37,7 +37,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FlushFinishedProcTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
SkImageInfo info =
SkImageInfo::Make(8, 8, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 39619eb..2d14678 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -10,7 +10,7 @@
#include <array>
#include <vector>
#include "include/core/SkBitmap.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/GrResourceKey.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
@@ -108,7 +108,7 @@
#else
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) {
#endif
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto rtc = GrRenderTargetContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index edf987a..773ddd8 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -11,9 +11,8 @@
#include "include/core/SkPoint.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrBackendTextureImageGenerator.h"
-#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDrawingManager.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrProxyProvider.h"
@@ -34,7 +33,7 @@
// Test that the correct mip map states are on the GrTextures when wrapping GrBackendTextures in
// SkImages and SkSurfaces
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->mipMapSupport()) {
return;
}
@@ -109,7 +108,7 @@
// Test that we correctly copy or don't copy GrBackendTextures in the GrBackendTextureImageGenerator
// based on if we will use mips in the draw and the mip status of the GrBackendTexture.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->mipMapSupport()) {
return;
}
@@ -249,7 +248,7 @@
// Test that when we call makeImageSnapshot on an SkSurface we retains the same mip status as the
// resource we took the snapshot of.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->mipMapSupport()) {
return;
}
@@ -314,7 +313,7 @@
// Test that we don't create a mip mapped texture if the size is 1x1 even if the filter mode is set
// to use mips. This test passes by not crashing or hitting asserts in code.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(Gr1x1TextureMipMappedTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->mipMapSupport()) {
return;
}
diff --git a/tests/GrOpListFlushTest.cpp b/tests/GrOpListFlushTest.cpp
index 4dea416..9bfc889 100644
--- a/tests/GrOpListFlushTest.cpp
+++ b/tests/GrOpListFlushTest.cpp
@@ -7,7 +7,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "tests/Test.h"
@@ -26,7 +26,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrOpsTaskFlushCount, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGpu* gpu = context->priv().getGpu();
SkImageInfo imageInfo = SkImageInfo::Make(1000, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index e7f6ec4..ced0bfa 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -8,7 +8,7 @@
#include "include/core/SkTypes.h"
#include "tests/Test.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/gpu/GrColor.h"
#include "src/gpu/GrContextPriv.h"
@@ -185,7 +185,7 @@
};
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrResourceProvider* rp = context->priv().resourceProvider();
auto rtc = GrRenderTargetContext::Make(
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 39ecf4a..3a8444e 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -9,6 +9,7 @@
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/GrContextOptions.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrProxyProvider.h"
@@ -987,7 +988,7 @@
GrContextOptions opts = options;
opts.fSuppressDualSourceBlending = true;
sk_gpu_test::GrContextFactory mockFactory(opts);
- GrContext* ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kMock_ContextType);
+ auto ctx = mockFactory.get(sk_gpu_test::GrContextFactory::kMock_ContextType);
if (!ctx) {
SK_ABORT("Failed to create mock context without ARB_blend_func_extended.");
}
diff --git a/tests/GrSubmittedFlushTest.cpp b/tests/GrSubmittedFlushTest.cpp
index 47cdaf2..a652789 100644
--- a/tests/GrSubmittedFlushTest.cpp
+++ b/tests/GrSubmittedFlushTest.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
using namespace sk_gpu_test;
@@ -27,7 +27,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(FlushSubmittedProcTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
SkImageInfo info = SkImageInfo::Make(8, 8, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info);
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 4cc62a8..4ed7515 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -7,7 +7,7 @@
#include <set>
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/gpu/GrBackendUtils.h"
@@ -27,7 +27,7 @@
// Tests that GrSurface::asTexture(), GrSurface::asRenderTarget(), and static upcasting of texture
// and render targets to GrSurface all work as expected.
DEF_GPUTEST_FOR_MOCK_CONTEXT(GrSurface, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto resourceProvider = context->priv().resourceProvider();
static constexpr SkISize kDesc = {256, 256};
@@ -75,7 +75,7 @@
// This test checks that the isFormatTexturable and isFormatRenderable are
// consistent with createTexture's result.
DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
const GrCaps* caps = context->priv().caps();
@@ -350,7 +350,7 @@
return (0xFFU << 24) | (x << 16) | (y << 8) | uint8_t((x * y) & 0xFF);
});
- GrContext* context = context_info.grContext();
+ auto context = context_info.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
// We test both kRW in addition to kRead mostly to ensure that the calls are structured such
@@ -693,7 +693,7 @@
// Tests an idle proc that unrefs another resource down to zero.
DEF_GPUTEST_FOR_ALL_CONTEXTS(TextureIdleProcCacheManipulationTest, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
// idle proc that releases another texture.
auto idleProc = [](void* texture) { reinterpret_cast<GrTexture*>(texture)->unref(); };
@@ -716,7 +716,7 @@
// Similar to above but more complicated. This flushes the context from the idle proc.
// crbug.com/933526.
DEF_GPUTEST_FOR_ALL_CONTEXTS(TextureIdleProcFlushTest, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
// idle proc that flushes the context.
auto idleProc = [](void* context) { reinterpret_cast<GrContext*>(context)->flushAndSubmit(); };
@@ -752,7 +752,7 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(TextureIdleProcRerefTest, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
// idle proc that refs the texture
auto idleProc = [](void* texture) { reinterpret_cast<GrTexture*>(texture)->ref(); };
// release proc to check whether the texture was released or not.
@@ -775,7 +775,7 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(TextureIdleStateTest, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
for (const auto& idleMaker : {make_wrapped_texture, make_normal_texture}) {
auto idleTexture = idleMaker(context, GrRenderable::kNo);
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index 5dd4a09..2d6fbff 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -97,11 +97,11 @@
for (auto colorType: { kRGBA_8888_SkColorType, kBGRA_8888_SkColorType }) {
for (auto renderable: { GrRenderable::kYes, GrRenderable::kNo }) {
for (bool doDataUpload: {true, false}) {
- testing_only_texture_test(reporter, ctxInfo.grContext(), colorType,
+ testing_only_texture_test(reporter, ctxInfo.directContext(), colorType,
renderable, doDataUpload, GrMipMapped::kNo);
if (!doDataUpload) {
- testing_only_texture_test(reporter, ctxInfo.grContext(), colorType,
+ testing_only_texture_test(reporter, ctxInfo.directContext(), colorType,
renderable, doDataUpload, GrMipMapped::kYes);
}
}
diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp
index cdc5d8f..a01b887 100644
--- a/tests/GrTextureMipMapInvalidationTest.cpp
+++ b/tests/GrTextureMipMapInvalidationTest.cpp
@@ -7,7 +7,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrTexturePriv.h"
#include "src/image/SkImage_Base.h"
@@ -16,7 +16,7 @@
// Tests that MIP maps are created and invalidated as expected when drawing to and from GrTextures.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrTextureMipMapInvalidationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->mipMapSupport()) {
return;
}
@@ -65,7 +65,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReimportImageTextureWithMipLevels, reporter, ctxInfo) {
- auto* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
if (!ctx->priv().caps()->mipMapSupport()) {
return;
}
diff --git a/tests/GrUploadPixelsTests.cpp b/tests/GrUploadPixelsTests.cpp
index 0c511e8..a1294cd 100644
--- a/tests/GrUploadPixelsTests.cpp
+++ b/tests/GrUploadPixelsTests.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrSurfaceContext.h"
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index e5fb544..46aa8c3 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -198,7 +198,7 @@
test_image_backed(reporter, nullptr, srcImage);
}
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
@@ -214,7 +214,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrSurfaceProxyView srcView = create_proxy_view(context);
if (!srcView.proxy()) {
@@ -255,7 +255,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrSurfaceProxyView srcView = create_proxy_view(context);
if (!srcView.proxy()) {
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 4684c6b..f8de5dc 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -18,19 +18,18 @@
#include "include/effects/SkImageFilters.h"
#include "include/effects/SkPerlinNoiseShader.h"
#include "include/effects/SkTableColorFilter.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkColorFilterBase.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkSpecialImage.h"
#include "src/core/SkSpecialSurface.h"
+#include "src/gpu/GrCaps.h"
+#include "src/gpu/GrRecordingContextPriv.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
-#include "include/gpu/GrContext.h"
-#include "src/gpu/GrCaps.h"
-#include "src/gpu/GrContextPriv.h"
-
static const int kBitmapSize = 4;
namespace {
@@ -582,7 +581,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterNegativeBlurSigma_Gpu, reporter, ctxInfo) {
- test_negative_blur_sigma(reporter, ctxInfo.grContext());
+ test_negative_blur_sigma(reporter, ctxInfo.directContext());
}
static void test_morphology_radius_with_mirror_ctm(skiatest::Reporter* reporter, GrContext* context) {
@@ -662,7 +661,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(MorphologyFilterRadiusWithMirrorCTM_Gpu, reporter, ctxInfo) {
- test_morphology_radius_with_mirror_ctm(reporter, ctxInfo.grContext());
+ test_morphology_radius_with_mirror_ctm(reporter, ctxInfo.directContext());
}
static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* context) {
@@ -704,7 +703,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxInfo) {
- test_zero_blur_sigma(reporter, ctxInfo.grContext());
+ test_zero_blur_sigma(reporter, ctxInfo.directContext());
}
@@ -734,7 +733,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterFailAffectsTransparentBlack_Gpu, reporter, ctxInfo) {
- test_fail_affects_transparent_black(reporter, ctxInfo.grContext());
+ test_fail_affects_transparent_black(reporter, ctxInfo.directContext());
}
DEF_TEST(ImageFilterDrawTiled, reporter) {
@@ -1012,7 +1011,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMergeResultSize_Gpu, reporter, ctxInfo) {
- test_imagefilter_merge_result_size(reporter, ctxInfo.grContext());
+ test_imagefilter_merge_result_size(reporter, ctxInfo.directContext());
}
static void draw_blurred_rect(SkCanvas* canvas) {
@@ -1171,7 +1170,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMatrixConvolutionBigKernel_Gpu,
reporter, ctxInfo) {
- test_big_kernel(reporter, ctxInfo.grContext());
+ test_big_kernel(reporter, ctxInfo.directContext());
}
DEF_TEST(ImageFilterCropRect, reporter) {
@@ -1179,7 +1178,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCropRect_Gpu, reporter, ctxInfo) {
- test_cropRects(reporter, ctxInfo.grContext());
+ test_cropRects(reporter, ctxInfo.directContext());
}
DEF_TEST(ImageFilterMatrix, reporter) {
@@ -1241,7 +1240,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterClippedPictureImageFilter_Gpu, reporter, ctxInfo) {
- test_clipped_picture_imagefilter(reporter, ctxInfo.grContext());
+ test_clipped_picture_imagefilter(reporter, ctxInfo.directContext());
}
DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
@@ -1468,7 +1467,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterOffset_Gpu, reporter, ctxInfo) {
- test_composed_imagefilter_offset(reporter, ctxInfo.grContext());
+ test_composed_imagefilter_offset(reporter, ctxInfo.directContext());
}
static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrContext* context) {
@@ -1509,7 +1508,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ComposedImageFilterBounds_Gpu, reporter, ctxInfo) {
- test_composed_imagefilter_bounds(reporter, ctxInfo.grContext());
+ test_composed_imagefilter_bounds(reporter, ctxInfo.directContext());
}
DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
@@ -1612,7 +1611,7 @@
int largeW = 5000;
int largeH = 5000;
// If we're GPU-backed make the bitmap too large to be converted into a texture.
- if (GrContext* ctx = canvas->getGrContext()) {
+ if (auto ctx = canvas->recordingContext()) {
largeW = ctx->priv().caps()->maxTextureSize() + 1;
}
@@ -1717,12 +1716,12 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterMakeWithFilter_Gpu, reporter, ctxInfo) {
- test_make_with_filter(reporter, ctxInfo.grContext());
+ test_make_with_filter(reporter, ctxInfo.directContext());
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterHugeBlur_Gpu, reporter, ctxInfo) {
- sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.directContext(),
SkBudgeted::kNo,
SkImageInfo::MakeN32Premul(100, 100)));
@@ -1734,7 +1733,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(XfermodeImageFilterCroppedInput_Gpu, reporter, ctxInfo) {
sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(
- ctxInfo.grContext(),
+ ctxInfo.directContext(),
SkBudgeted::kNo,
SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
@@ -1743,7 +1742,7 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo) {
auto surface(SkSurface::MakeRenderTarget(
- ctxInfo.grContext(), SkBudgeted::kYes,
+ ctxInfo.directContext(), SkBudgeted::kYes,
SkImageInfo::Make(100, 100, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
test_large_blur_input(reporter, surface->getCanvas());
}
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index d7fced9..67b5e87 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -12,7 +12,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
@@ -33,7 +33,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, infoTransparent));
check_isopaque(reporter, surfaceTransparent, false);
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index 6dae947..f5c22f1 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -10,10 +10,9 @@
#include "include/core/SkShader.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
-#include "include/gpu/GrContext.h"
-
static void test_bitmap_equality(skiatest::Reporter* reporter, SkBitmap& bm1, SkBitmap& bm2) {
REPORTER_ASSERT(reporter, bm1.computeByteSize() == bm2.computeByteSize());
REPORTER_ASSERT(reporter, 0 == memcmp(bm1.getPixels(), bm2.getPixels(), bm1.computeByteSize()));
@@ -132,12 +131,14 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageNewShader_GPU, reporter, ctxInfo) {
+ auto context = ctxInfo.directContext();
+
// GPU -> GPU
- gpu_to_gpu(reporter, ctxInfo.grContext());
+ gpu_to_gpu(reporter, context);
// GPU -> RASTER
- gpu_to_raster(reporter, ctxInfo.grContext());
+ gpu_to_raster(reporter, context);
// RASTER -> GPU
- raster_to_gpu(reporter, ctxInfo.grContext());
+ raster_to_gpu(reporter, context);
}
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 32c4b0c..e90af19 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -21,6 +21,7 @@
#include "include/core/SkStream.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrContextThreadSafeProxy.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkImagePriv.h"
@@ -182,7 +183,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageEncode_Gpu, reporter, ctxInfo) {
- test_encode(reporter, create_gpu_image(ctxInfo.grContext()).get());
+ test_encode(reporter, create_gpu_image(ctxInfo.directContext()).get());
}
DEF_TEST(Image_MakeFromRasterBitmap, reporter) {
@@ -338,7 +339,7 @@
*/
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_Gpu2Cpu, reporter, ctxInfo) {
SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
- sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
+ sk_sp<SkImage> image(create_gpu_image(ctxInfo.directContext()));
const auto desc = SkBitmapCacheDesc::Make(image.get());
auto surface(SkSurface::MakeRaster(info));
@@ -371,7 +372,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeTextureImage, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
sk_gpu_test::TestContext* testContext = contextInfo.testContext();
GrContextFactory otherFactory;
ContextInfo otherContextInfo = otherFactory.getContextInfo(contextInfo.type());
@@ -387,8 +388,8 @@
// Create a texture image in a another GrContext.
[otherContextInfo] {
auto restore = otherContextInfo.testContext()->makeCurrentAndAutoRestore();
- sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext());
- otherContextInfo.grContext()->flushAndSubmit();
+ auto otherContextImage = create_gpu_image(otherContextInfo.directContext());
+ otherContextInfo.directContext()->flushAndSubmit();
return otherContextImage;
}};
for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) {
@@ -448,7 +449,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkImage_makeNonTextureImage, reporter, contextInfo) {
- GrContext* context = contextInfo.grContext();
+ auto context = contextInfo.directContext();
std::function<sk_sp<SkImage>()> imageFactories[] = {
create_image,
@@ -475,7 +476,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static constexpr int kSize = 10;
@@ -509,7 +510,7 @@
SkColorSetARGB((U8CPU)y, 255 - (U8CPU)y, (U8CPU)x, 255 - (U8CPU)x);
}
}
- auto texImage = SkImage::MakeFromBitmap(bmp)->makeTextureImage(ctxInfo.grContext());
+ auto texImage = SkImage::MakeFromBitmap(bmp)->makeTextureImage(ctxInfo.directContext());
if (!texImage || texImage->alphaType() != kUnpremul_SkAlphaType) {
ERRORF(reporter, "Failed to make unpremul texture image.");
return;
@@ -705,7 +706,7 @@
image_test_read_pixels(reporter, image.get());
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageReadPixels_Gpu, reporter, ctxInfo) {
- image_test_read_pixels(reporter, create_gpu_image(ctxInfo.grContext()).get());
+ image_test_read_pixels(reporter, create_gpu_image(ctxInfo.directContext()).get());
}
static void check_legacy_bitmap(skiatest::Reporter* reporter, const SkImage* image,
@@ -761,7 +762,7 @@
test_legacy_bitmap(reporter, image.get());
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageLegacyBitmap_Gpu, reporter, ctxInfo) {
- sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
+ sk_sp<SkImage> image(create_gpu_image(ctxInfo.directContext()));
test_legacy_bitmap(reporter, image.get());
}
@@ -801,7 +802,7 @@
test_peek(reporter, image.get(), false);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImagePeek_Gpu, reporter, ctxInfo) {
- sk_sp<SkImage> image(create_gpu_image(ctxInfo.grContext()));
+ sk_sp<SkImage> image(create_gpu_image(ctxInfo.directContext()));
test_peek(reporter, image.get(), false);
}
@@ -817,7 +818,7 @@
const int kWidth = 10;
const int kHeight = 10;
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
SkImageInfo ii = SkImageInfo::Make(kWidth, kHeight, SkColorType::kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
@@ -919,7 +920,7 @@
sk_gpu_test::TestContext* testContext = ctxInfo.testContext();
ContextInfo otherContextInfo = testFactory.getSharedContextInfo(ctx);
- GrContext* otherCtx = otherContextInfo.grContext();
+ auto otherCtx = otherContextInfo.directContext();
sk_gpu_test::TestContext* otherTestContext = otherContextInfo.testContext();
// Creating a context in a share group may fail
@@ -1032,7 +1033,7 @@
GrContextFactory testFactory(options);
GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i);
ContextInfo ctxInfo = testFactory.getContextInfo(ctxType);
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
if (!ctx || !ctx->priv().caps()->crossContextTextureSupport()) {
continue;
}
@@ -1051,7 +1052,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(makeBackendTexture, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
sk_gpu_test::TestContext* testContext = ctxInfo.testContext();
sk_sp<GrContextThreadSafeProxy> proxy = context->threadSafeProxy();
@@ -1076,8 +1077,8 @@
// Create a texture image in a another GrContext.
{ [otherContextInfo] {
auto restore = otherContextInfo.testContext()->makeCurrentAndAutoRestore();
- sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.grContext());
- otherContextInfo.grContext()->flushAndSubmit();
+ sk_sp<SkImage> otherContextImage = create_gpu_image(otherContextInfo.directContext());
+ otherContextInfo.directContext()->flushAndSubmit();
return otherContextImage;
}, false, false },
// Create an image that is too large to be texture backed.
@@ -1315,8 +1316,8 @@
const SkColor red = SK_ColorRED;
SkImageInfo info = SkImageInfo::MakeN32Premul(16, 16);
- sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo,
- info);
+ sk_sp<SkSurface> surface = SkSurface::MakeRenderTarget(ctxInfo.directContext(),
+ SkBudgeted::kNo, info);
surface->getCanvas()->clear(red);
sk_sp<SkImage> gpuImage = surface->makeImageSnapshot();
test_scale_pixels(reporter, gpuImage.get(), pmRed);
@@ -1364,9 +1365,9 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(ImageFlush, reporter, ctxInfo) {
- auto c = ctxInfo.grContext();
+ auto direct = ctxInfo.directContext();
auto ii = SkImageInfo::Make(10, 10, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
- auto s = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, ii, 1, nullptr);
+ auto s = SkSurface::MakeRenderTarget(direct, SkBudgeted::kYes, ii, 1, nullptr);
s->getCanvas()->clear(SK_ColorRED);
auto i0 = s->makeImageSnapshot();
@@ -1374,57 +1375,58 @@
auto i1 = s->makeImageSnapshot();
s->getCanvas()->clear(SK_ColorGREEN);
// Make a YUVA image.
- auto i2 = make_yuva_image(c);
+ auto i2 = make_yuva_image(direct);
// Flush all the setup work we did above and then make little lambda that reports the flush
// count delta since the last time it was called.
- c->flushAndSubmit();
- auto numSubmits = [c, submitCnt = c->priv().getGpu()->stats()->numSubmitToGpus()]() mutable {
- int curr = c->priv().getGpu()->stats()->numSubmitToGpus();
+ direct->flushAndSubmit();
+ auto numSubmits = [direct,
+ submitCnt = direct->priv().getGpu()->stats()->numSubmitToGpus()]() mutable {
+ int curr = direct->priv().getGpu()->stats()->numSubmitToGpus();
int n = curr - submitCnt;
submitCnt = curr;
return n;
};
// Images aren't used therefore flush is ignored, but submit is still called.
- i0->flushAndSubmit(c);
- i1->flushAndSubmit(c);
- i2->flushAndSubmit(c);
+ i0->flushAndSubmit(direct);
+ i1->flushAndSubmit(direct);
+ i2->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 3);
// Syncing forces the flush to happen even if the images aren't used.
- i0->flush(c);
- c->submit(true);
+ i0->flush(direct);
+ direct->submit(true);
REPORTER_ASSERT(reporter, numSubmits() == 1);
- i1->flush(c);
- c->submit(true);
+ i1->flush(direct);
+ direct->submit(true);
REPORTER_ASSERT(reporter, numSubmits() == 1);
- i2->flush(c);
- c->submit(true);
+ i2->flush(direct);
+ direct->submit(true);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Use image 1
s->getCanvas()->drawImage(i1, 0, 0);
// Flushing image 0 should do nothing, but submit is still called.
- i0->flushAndSubmit(c);
+ i0->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 1 should flush.
- i1->flushAndSubmit(c);
+ i1->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 2 should do nothing, but submit is still called.
- i2->flushAndSubmit(c);
+ i2->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Use image 2
s->getCanvas()->drawImage(i2, 0, 0);
// Flushing image 0 should do nothing, but submit is still called.
- i0->flushAndSubmit(c);
+ i0->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 1 do nothing, but submit is still called.
- i1->flushAndSubmit(c);
+ i1->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 2 should flush.
- i2->flushAndSubmit(c);
+ i2->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Since we just did a simple image draw it should not have been flattened.
REPORTER_ASSERT(reporter,
@@ -1432,40 +1434,40 @@
REPORTER_ASSERT(reporter, static_cast<SkImage_GpuYUVA*>(as_IB(i2.get()))->isTextureBacked());
// Flatten it and repeat.
- as_IB(i2.get())->view(c);
+ as_IB(i2.get())->view(direct);
REPORTER_ASSERT(reporter,
static_cast<SkImage_GpuYUVA*>(as_IB(i2.get()))->testingOnly_IsFlattened());
REPORTER_ASSERT(reporter, static_cast<SkImage_GpuYUVA*>(as_IB(i2.get()))->isTextureBacked());
s->getCanvas()->drawImage(i2, 0, 0);
// Flushing image 0 should do nothing, but submit is still called.
- i0->flushAndSubmit(c);
+ i0->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 1 do nothing, but submit is still called.
- i1->flushAndSubmit(c);
+ i1->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 2 should flush.
- i2->flushAndSubmit(c);
+ i2->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Test case where flatten happens before the first flush.
- i2 = make_yuva_image(c);
+ i2 = make_yuva_image(direct);
// On some systems where preferVRAMUseOverFlushes is false (ANGLE on Windows) the above may
// actually flush in order to make textures for the YUV planes. TODO: Remove this when we
// make the YUVA planes from backend textures rather than pixmaps that GrContext must upload.
// Calling numSubmits rebases the flush count from here.
numSubmits();
- as_IB(i2.get())->view(c);
+ as_IB(i2.get())->view(direct);
REPORTER_ASSERT(reporter,
static_cast<SkImage_GpuYUVA*>(as_IB(i2.get()))->testingOnly_IsFlattened());
REPORTER_ASSERT(reporter, static_cast<SkImage_GpuYUVA*>(as_IB(i2.get()))->isTextureBacked());
s->getCanvas()->drawImage(i2, 0, 0);
// Flushing image 0 should do nothing, but submit is still called.
- i0->flushAndSubmit(c);
+ i0->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 1 do nothing, but submit is still called.
- i1->flushAndSubmit(c);
+ i1->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
// Flushing image 2 should flush, but submit is still called.
- i2->flushAndSubmit(c);
+ i2->flushAndSubmit(direct);
REPORTER_ASSERT(reporter, numSubmits() == 1);
}
diff --git a/tests/MatrixColorFilterTest.cpp b/tests/MatrixColorFilterTest.cpp
index ea558cf..62507c8 100644
--- a/tests/MatrixColorFilterTest.cpp
+++ b/tests/MatrixColorFilterTest.cpp
@@ -10,12 +10,13 @@
#include "include/core/SkPaint.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkColorMatrix.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "tests/Test.h"
#include "tests/TestUtils.h"
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(MatrixColorFilter_TransparentBlack, reporter, info) {
- auto* context = info.grContext();
+ auto context = info.directContext();
// Make a transparent black image rather than use a paint color to avoid an optimization that
// applies the color filter on the CPU to paint colors.
auto imgSurf = SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
diff --git a/tests/MtlBackendAllocationTest.mm b/tests/MtlBackendAllocationTest.mm
index fe16472..f90a38f 100644
--- a/tests/MtlBackendAllocationTest.mm
+++ b/tests/MtlBackendAllocationTest.mm
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "tests/Test.h"
@@ -34,7 +34,7 @@
}
DEF_GPUTEST_FOR_METAL_CONTEXT(MtlBackendAllocationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrMtlCaps* mtlCaps = static_cast<const GrMtlCaps*>(context->priv().caps());
constexpr SkColor4f kTransCol { 0, 0.25f, 0.75f, 0.5f };
diff --git a/tests/MtlCopySurfaceTest.mm b/tests/MtlCopySurfaceTest.mm
index 1bbfaea..41a0f62 100644
--- a/tests/MtlCopySurfaceTest.mm
+++ b/tests/MtlCopySurfaceTest.mm
@@ -6,7 +6,7 @@
*/
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/mtl/GrMtlGpu.h"
@@ -22,7 +22,7 @@
static const int kWidth = 1024;
static const int kHeight = 768;
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
// This is a bit weird, but it's the only way to get a framebufferOnly surface
GrMtlGpu* gpu = (GrMtlGpu*) context->priv().getGpu();
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 6a5e9c9..afaf4b8 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkBitmap.h"
#include "include/gpu/GrBackendSemaphore.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkPointPriv.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrDefaultGeoProcFactory.h"
@@ -561,7 +562,7 @@
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
static const int kNumViews = 3;
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto proxyProvider = context->priv().proxyProvider();
AtlasObject object(reporter);
diff --git a/tests/PackedConfigsTextureTest.cpp b/tests/PackedConfigsTextureTest.cpp
index 89ec515..cde1121 100644
--- a/tests/PackedConfigsTextureTest.cpp
+++ b/tests/PackedConfigsTextureTest.cpp
@@ -13,7 +13,7 @@
#include "tests/Test.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrProxyProvider.h"
@@ -146,13 +146,17 @@
static const int CONTROL_ARRAY_SIZE = DEV_W * DEV_H;
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGBA4444TextureTest, reporter, ctxInfo) {
- if (ctxInfo.grContext()->colorTypeSupportedAsImage(kARGB_4444_SkColorType)) {
- run_test(reporter, ctxInfo.directContext(), CONTROL_ARRAY_SIZE, kARGB_4444_SkColorType);
+ auto direct = ctxInfo.directContext();
+
+ if (direct->colorTypeSupportedAsImage(kARGB_4444_SkColorType)) {
+ run_test(reporter, direct, CONTROL_ARRAY_SIZE, kARGB_4444_SkColorType);
}
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RGB565TextureTest, reporter, ctxInfo) {
- if (ctxInfo.grContext()->colorTypeSupportedAsImage(kRGB_565_SkColorType)) {
- run_test(reporter, ctxInfo.directContext(), CONTROL_ARRAY_SIZE, kRGB_565_SkColorType);
+ auto direct = ctxInfo.directContext();
+
+ if (direct->colorTypeSupportedAsImage(kRGB_565_SkColorType)) {
+ run_test(reporter, direct, CONTROL_ARRAY_SIZE, kRGB_565_SkColorType);
}
}
diff --git a/tests/PinnedImageTest.cpp b/tests/PinnedImageTest.cpp
index 6ec2bb0..32697d2 100644
--- a/tests/PinnedImageTest.cpp
+++ b/tests/PinnedImageTest.cpp
@@ -15,6 +15,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkImagePriv.h"
static bool surface_is_expected_color(SkSurface* surf, const SkImageInfo& ii, SkColor color) {
@@ -98,12 +99,12 @@
{
sk_sp<SkImage> img;
- GrContext* context = nullptr;
+ GrDirectContext* context = nullptr;
{
GrContextFactory testFactory;
ContextInfo info = testFactory.getContextInfo(ctxType);
- context = info.grContext();
+ context = info.directContext();
if (!context) {
continue;
}
@@ -123,6 +124,6 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PinnedImageTest, reporter, ctxInfo) {
- basic_test(reporter, ctxInfo.grContext());
+ basic_test(reporter, ctxInfo.directContext());
cleanup_test(reporter);
}
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index f4a252b..c9a7073 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -7,6 +7,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
#include "tools/ToolUtils.h"
@@ -101,8 +102,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
- sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.grContext(),
- SkBudgeted::kNo,
- info));
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.directContext(),
+ SkBudgeted::kNo, info));
test_premul_alpha_roundtrip(reporter, surf.get());
}
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index e99d55a..85ed6a1 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -11,7 +11,7 @@
#include "tests/Test.h"
#include "include/core/SkString.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkPointPriv.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGeometryProcessor.h"
@@ -167,7 +167,7 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
#if GR_GPU_STATS
GrGpu* gpu = context->priv().getGpu();
#endif
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 3ed6a83..33ab5ba 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -7,7 +7,7 @@
#include "tests/Test.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrClip.h"
#include "src/gpu/GrContextPriv.h"
@@ -144,7 +144,7 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
static constexpr SkISize kDims = {10, 10};
@@ -476,7 +476,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto resourceProvider = context->priv().resourceProvider();
using FPFactory = GrFragmentProcessorTestFactory;
@@ -726,7 +726,7 @@
// Tests that a fragment processor returned by GrFragmentProcessor::clone() is equivalent to its
// progenitor.
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto resourceProvider = context->priv().resourceProvider();
SkRandom random;
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index eeb19a5..4801bf0 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/SkChecksum.h"
#include "include/utils/SkRandom.h"
#include "src/gpu/GrAutoLocaleSetter.h"
@@ -350,7 +351,7 @@
static int get_programs_max_stages(const sk_gpu_test::ContextInfo& ctxInfo) {
int maxStages = 6;
#ifdef SK_GL
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (skiatest::IsGLContextType(ctxInfo.type())) {
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
if (kGLES_GrGLStandard == gpu->glStandard()) {
@@ -390,7 +391,7 @@
maxTreeLevels = 2;
#endif
#ifdef SK_BUILD_FOR_ANDROID
- GrGLGpu* gpu = static_cast<GrGLGpu*>(ctxInfo.grContext()->priv().getGpu());
+ GrGLGpu* gpu = static_cast<GrGLGpu*>(ctxInfo.directContext()->priv().getGpu());
// Tecno Spark 3 Pro with Power VR Rogue GE8300 will fail shader compiles with
// no message if the shader is particularly long.
if (gpu->ctxInfo().vendor() == kImagination_GrGLVendor) {
@@ -416,7 +417,7 @@
return;
}
- REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.grContext(), maxStages,
+ REPORTER_ASSERT(reporter, GrDrawingManager::ProgramUnitTest(ctxInfo.directContext(), maxStages,
maxLevels));
}
diff --git a/tests/PromiseImageTest.cpp b/tests/PromiseImageTest.cpp
index c391770..3aff519 100644
--- a/tests/PromiseImageTest.cpp
+++ b/tests/PromiseImageTest.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkColorFilter.h"
#include "include/core/SkPromiseImageTexture.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrTexture.h"
@@ -165,7 +166,7 @@
const int kWidth = 10;
const int kHeight = 10;
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
GrGpu* gpu = ctx->priv().getGpu();
GrBackendTexture backendTex = ctx->createBackendTexture(
@@ -306,7 +307,7 @@
const int kWidth = 10;
const int kHeight = 10;
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
GrBackendTexture backendTex = ctx->createBackendTexture(
kWidth, kHeight, kAlpha_8_SkColorType,
@@ -373,7 +374,7 @@
const int kWidth = 10;
const int kHeight = 10;
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
// Do all this just to get a valid backend format for the image.
GrBackendTexture backendTex;
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 5a06c72..f370909 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -10,6 +10,7 @@
#include "tests/Test.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrProxyProvider.h"
@@ -56,8 +57,9 @@
// Test converting between RenderTargetProxies and TextureProxies for preinstantiated Proxies
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PreinstantiatedProxyConversionTest, reporter, ctxInfo) {
- GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
- GrGpu* gpu = ctxInfo.grContext()->priv().getGpu();
+ auto context = ctxInfo.directContext();
+ GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+ GrGpu* gpu = context->priv().getGpu();
static constexpr auto kSize = SkISize::Make(64, 64);
static constexpr auto kColorType = GrColorType::kRGBA_8888;
@@ -122,7 +124,7 @@
// Test converting between RenderTargetProxies and TextureProxies for deferred
// Proxies
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
const GrCaps* caps = context->priv().caps();
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 64de3de..6c846f9 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -9,6 +9,7 @@
#include "tests/Test.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetProxy.h"
@@ -40,12 +41,13 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
+ auto direct = ctxInfo.directContext();
+ GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
for (auto make : { make_deferred, make_wrapped }) {
// An extra ref
{
- sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
+ sk_sp<GrTextureProxy> proxy((*make)(direct));
if (proxy) {
sk_sp<GrTextureProxy> extraRef(proxy);
@@ -62,7 +64,7 @@
// Multiple normal refs
{
- sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
+ sk_sp<GrTextureProxy> proxy((*make)(direct));
if (proxy.get()) {
proxy->ref();
proxy->ref();
@@ -83,7 +85,7 @@
// Continue using (reffing) proxy after instantiation
{
- sk_sp<GrTextureProxy> proxy((*make)(ctxInfo.grContext()));
+ sk_sp<GrTextureProxy> proxy((*make)(direct));
if (proxy) {
sk_sp<GrTextureProxy> firstExtraRef(proxy);
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index d9c58cf..92a3cba 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -10,6 +10,7 @@
#include "tests/Test.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrRenderTargetPriv.h"
@@ -109,9 +110,10 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
- GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
- const GrCaps& caps = *ctxInfo.grContext()->priv().caps();
+ auto direct = ctxInfo.directContext();
+ GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
+ GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
+ const GrCaps& caps = *direct->priv().caps();
int attempt = 0; // useful for debugging
@@ -205,11 +207,11 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
- GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
- GrContext* context = ctxInfo.grContext();
- GrResourceProvider* resourceProvider = context->priv().resourceProvider();
- GrGpu* gpu = context->priv().getGpu();
- const GrCaps& caps = *context->priv().caps();
+ auto direct = ctxInfo.directContext();
+ GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
+ GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
+ GrGpu* gpu = direct->priv().getGpu();
+ const GrCaps& caps = *direct->priv().caps();
static const int kWidthHeight = 100;
@@ -221,7 +223,7 @@
// Tests wrapBackendRenderTarget with a GrBackendRenderTarget
// Our test-only function that creates a backend render target doesn't currently support
// sample counts :(.
- if (ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType)) {
+ if (direct->colorTypeSupportedAsSurface(colorType)) {
GrBackendRenderTarget backendRT = gpu->createTestingOnlyBackendRenderTarget(
kWidthHeight, kWidthHeight, grColorType);
sk_sp<GrSurfaceProxy> sProxy(
@@ -263,13 +265,13 @@
// Tests wrapBackendRenderTarget with a GrBackendTexture
{
GrBackendTexture backendTex;
- CreateBackendTexture(context, &backendTex, kWidthHeight, kWidthHeight, colorType,
+ CreateBackendTexture(direct, &backendTex, kWidthHeight, kWidthHeight, colorType,
SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes,
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget(
backendTex, supportedNumSamples);
if (!sProxy) {
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
@@ -278,13 +280,13 @@
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only renderable
{
GrBackendTexture backendTex;
- CreateBackendTexture(context, &backendTex, kWidthHeight, kWidthHeight, colorType,
+ CreateBackendTexture(direct, &backendTex, kWidthHeight, kWidthHeight, colorType,
SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kYes,
GrProtected::kNo);
@@ -292,7 +294,7 @@
backendTex, supportedNumSamples, kBorrow_GrWrapOwnership,
GrWrapCacheable::kNo, nullptr);
if (!sProxy) {
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
continue; // This can fail on Mesa
}
@@ -301,21 +303,21 @@
supportedNumSamples, SkBackingFit::kExact,
caps.maxWindowRectangles());
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
}
// Tests wrapBackendTexture that is only textureable
{
// Internal offscreen texture
GrBackendTexture backendTex;
- CreateBackendTexture(context, &backendTex, kWidthHeight, kWidthHeight, colorType,
+ CreateBackendTexture(direct, &backendTex, kWidthHeight, kWidthHeight, colorType,
SkColors::kTransparent, GrMipMapped::kNo, GrRenderable::kNo,
GrProtected::kNo);
sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRead_GrIOType);
if (!sProxy) {
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
continue;
}
@@ -323,15 +325,15 @@
check_texture(reporter, resourceProvider, sProxy->asTextureProxy(),
SkBackingFit::kExact);
- context->deleteBackendTexture(backendTex);
+ direct->deleteBackendTexture(backendTex);
}
}
}
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
- GrProxyProvider* provider = context->priv().proxyProvider();
+ auto direct = ctxInfo.directContext();
+ GrProxyProvider* provider = direct->priv().proxyProvider();
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) {
@@ -342,7 +344,7 @@
}
const GrBackendFormat format =
- context->priv().caps()->getDefaultBackendFormat(
+ direct->priv().caps()->getDefaultBackendFormat(
GrColorType::kRGBA_8888,
renderable);
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 15f66d3..b418d2c 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkGradientShader.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/SkColorData.h"
#include "include/private/SkHalf.h"
#include "include/private/SkImageInfoPriv.h"
@@ -422,19 +422,20 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Texture, reporter, ctxInfo) {
- auto context = ctxInfo.directContext();
+ auto direct = ctxInfo.directContext();
+
SkBitmap bmp = make_src_bitmap();
// On the GPU we will also try reading back from a non-renderable texture.
for (auto origin : {kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin}) {
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
sk_sp<GrTextureProxy> proxy = sk_gpu_test::MakeTextureProxyFromData(
- context, renderable, origin, bmp.info(), bmp.getPixels(), bmp.rowBytes());
+ direct, renderable, origin, bmp.info(), bmp.getPixels(), bmp.rowBytes());
GrColorType grColorType = SkColorTypeToGrColorType(bmp.colorType());
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
+ GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(proxy->backendFormat(),
grColorType);
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
- auto sContext = GrSurfaceContext::Make(context, std::move(view),
+ auto sContext = GrSurfaceContext::Make(direct, std::move(view),
grColorType, kPremul_SkAlphaType, nullptr);
auto info = SkImageInfo::Make(DEV_W, DEV_H, kN32_SkColorType, kPremul_SkAlphaType);
test_readpixels_texture(reporter, std::move(sContext), info);
@@ -977,7 +978,7 @@
for (GrSurfaceOrigin origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
auto factory = std::function<GpuSrcFactory<Surface>>(
- [context = ctxInfo.grContext(), origin](const SkPixmap& src) {
+ [context = ctxInfo.directContext(), origin](const SkPixmap& src) {
if (src.colorType() == kRGB_888x_SkColorType) {
return Surface();
}
@@ -994,7 +995,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageAsyncReadPixels, reporter, ctxInfo) {
using Image = sk_sp<SkImage>;
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto reader = std::function<GpuReadSrcFn<Image>>([context](const Image& image,
const SkIVector& offset,
const SkPixmap& pixels) {
@@ -1037,8 +1038,8 @@
if (src.colorType() == kRGB_888x_SkColorType) {
return Image();
}
- return sk_gpu_test::MakeBackendTextureImage(ctxInfo.grContext(), src, renderable,
- origin);
+ return sk_gpu_test::MakeBackendTextureImage(ctxInfo.directContext(), src,
+ renderable, origin);
});
gpu_read_pixels_test_driver(reporter, rules, factory, reader);
}
@@ -1059,7 +1060,7 @@
for (GrSurfaceOrigin origin : {kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) {
auto factory = std::function<GpuSrcFactory<Surface>>(
- [context = ctxInfo.grContext(), origin](const SkPixmap& src) {
+ [context = ctxInfo.directContext(), origin](const SkPixmap& src) {
if (src.colorType() == kRGB_888x_SkColorType) {
return Surface();
}
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 8cbd903..bebccf0 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/SkTo.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrContextPriv.h"
@@ -48,7 +48,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
- auto context = ctxInfo.directContext();
+ auto direct = ctxInfo.directContext();
unsigned char alphaData[X_SIZE * Y_SIZE];
@@ -67,17 +67,17 @@
SkBitmap bitmap;
bitmap.installPixels(ii, alphaDataCopy, ii.minRowBytes());
bitmap.setImmutable();
- GrBitmapTextureMaker maker(context, bitmap, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
+ GrBitmapTextureMaker maker(direct, bitmap, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
auto view = maker.view(GrMipMapped::kNo);
if (!view.proxy()) {
ERRORF(reporter, "Could not create alpha texture.");
return;
}
- auto sContext = GrSurfaceContext::Make(context, std::move(view), maker.colorType(),
+ auto sContext = GrSurfaceContext::Make(direct, std::move(view), maker.colorType(),
kPremul_SkAlphaType, nullptr);
- sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii));
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(direct, SkBudgeted::kNo, ii));
// create a distinctive texture
for (int y = 0; y < Y_SIZE; ++y) {
@@ -187,16 +187,16 @@
auto origin = GrRenderable::kYes == renderable ? kBottomLeft_GrSurfaceOrigin
: kTopLeft_GrSurfaceOrigin;
auto proxy = sk_gpu_test::MakeTextureProxyFromData(
- context, renderable, origin,
+ direct, renderable, origin,
{info.fColorType, info.fAlphaType, nullptr, X_SIZE, Y_SIZE}, rgbaData, 0);
if (!proxy) {
continue;
}
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(proxy->backendFormat(),
- info.fColorType);
+ GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(proxy->backendFormat(),
+ info.fColorType);
GrSurfaceProxyView view(std::move(proxy), origin, swizzle);
- auto sContext = GrSurfaceContext::Make(context, std::move(view), info.fColorType,
+ auto sContext = GrSurfaceContext::Make(direct, std::move(view), info.fColorType,
kPremul_SkAlphaType, nullptr);
for (auto rowBytes : kRowBytes) {
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 7e7648d..3f295ec 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -23,7 +23,7 @@
#include "tools/gpu/ProxyUtils.h"
// skbug.com/5932
-static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context,
+static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrRecordingContext* context,
GrSurfaceProxyView rectView, GrColorType colorType,
SkAlphaType alphaType, uint32_t expectedPixelValues[]) {
auto rtContext = GrRenderTargetContext::Make(
@@ -116,8 +116,9 @@
#ifdef SK_GL
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
- auto context = ctxInfo.directContext();
- GrProxyProvider* proxyProvider = context->priv().proxyProvider();
+ auto direct = ctxInfo.directContext();
+
+ GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
static const int kWidth = 16;
static const int kHeight = 16;
@@ -134,16 +135,16 @@
bool useBLOrigin = kBottomLeft_GrSurfaceOrigin == origin;
auto format = GrBackendFormat::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_RECTANGLE);
- GrBackendTexture rectangleTex = context->createBackendTexture(kWidth,
- kHeight,
- format,
- GrMipMapped::kNo,
- GrRenderable::kYes);
+ GrBackendTexture rectangleTex = direct->createBackendTexture(kWidth,
+ kHeight,
+ format,
+ GrMipMapped::kNo,
+ GrRenderable::kYes);
if (!rectangleTex.isValid()) {
continue;
}
- if (!context->updateBackendTexture(rectangleTex, &pm, 1, nullptr, nullptr)) {
+ if (!direct->updateBackendTexture(rectangleTex, &pm, 1, nullptr, nullptr)) {
continue;
}
@@ -159,7 +160,7 @@
rectangleTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
if (!rectProxy) {
- context->deleteBackendTexture(rectangleTex);
+ direct->deleteBackendTexture(rectangleTex);
continue;
}
@@ -172,31 +173,31 @@
SkASSERT(rectProxy->hasRestrictedSampling());
SkASSERT(rectProxy->peekTexture()->texturePriv().hasRestrictedSampling());
- GrSwizzle swizzle = context->priv().caps()->getReadSwizzle(rectangleTex.getBackendFormat(),
- GrColorType::kRGBA_8888);
+ GrSwizzle swizzle = direct->priv().caps()->getReadSwizzle(rectangleTex.getBackendFormat(),
+ GrColorType::kRGBA_8888);
GrSurfaceProxyView view(rectProxy, origin, swizzle);
- test_basic_draw_as_src(reporter, context, view, GrColorType::kRGBA_8888,
+ test_basic_draw_as_src(reporter, direct, view, GrColorType::kRGBA_8888,
kPremul_SkAlphaType, refPixels);
// Test copy to both a texture and RT
- TestCopyFromSurface(reporter, context, rectProxy.get(), origin, GrColorType::kRGBA_8888,
+ TestCopyFromSurface(reporter, direct, rectProxy.get(), origin, GrColorType::kRGBA_8888,
refPixels, "RectangleTexture-copy-from");
- auto rectContext = GrSurfaceContext::Make(context, std::move(view),
+ auto rectContext = GrSurfaceContext::Make(direct, std::move(view),
GrColorType::kRGBA_8888, kPremul_SkAlphaType,
nullptr);
SkASSERT(rectContext);
TestReadPixels(reporter, rectContext.get(), refPixels, "RectangleTexture-read");
- test_copy_to_surface(reporter, context, rectContext.get(), "RectangleTexture-copy-to");
+ test_copy_to_surface(reporter, direct, rectContext.get(), "RectangleTexture-copy-to");
TestWritePixels(reporter, rectContext.get(), true, "RectangleTexture-write");
test_clear(reporter, rectContext.get());
- context->deleteBackendTexture(rectangleTex);
+ direct->deleteBackendTexture(rectangleTex);
}
}
#endif
diff --git a/tests/RenderTargetContextTest.cpp b/tests/RenderTargetContextTest.cpp
index 395a09a..c44eadc 100644
--- a/tests/RenderTargetContextTest.cpp
+++ b/tests/RenderTargetContextTest.cpp
@@ -9,6 +9,7 @@
#include "tests/Test.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
#include "src/gpu/GrRenderTargetContext.h"
@@ -33,7 +34,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RenderTargetContextTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
// Calling instantiate on a GrRenderTargetContext's textureProxy also instantiates the
// GrRenderTargetContext
diff --git a/tests/RepeatedClippedBlurTest.cpp b/tests/RepeatedClippedBlurTest.cpp
index 6937d48..1db63be 100644
--- a/tests/RepeatedClippedBlurTest.cpp
+++ b/tests/RepeatedClippedBlurTest.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkImageFilters.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrResourceCache.h"
#include "tests/Test.h"
@@ -22,7 +23,7 @@
// 2D canvas and compositor image filtering. In this case Chrome doesn't regularly purge
// the cache. This would result in Ganesh quickly running up to its max cache limit.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(RepeatedClippedBlurTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrResourceCache* cache = context->priv().getResourceCache();
const SkImageInfo ii = SkImageInfo::Make(1024, 600, kRGBA_8888_SkColorType,
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 0293731..1658273 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -7,6 +7,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrProxyProvider.h"
@@ -115,9 +116,10 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) {
- const GrCaps* caps = ctxInfo.grContext()->priv().caps();
- GrProxyProvider* proxyProvider = ctxInfo.grContext()->priv().proxyProvider();
- GrResourceProvider* resourceProvider = ctxInfo.grContext()->priv().resourceProvider();
+ auto direct = ctxInfo.directContext();
+ const GrCaps* caps = direct->priv().caps();
+ GrProxyProvider* proxyProvider = direct->priv().proxyProvider();
+ GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
struct TestCase {
ProxyParams fP1;
@@ -158,8 +160,8 @@
}
auto beFormat = caps->getDefaultBackendFormat(GrColorType::kRGBA_8888, GrRenderable::kYes);
- int k2 = ctxInfo.grContext()->priv().caps()->getRenderTargetSampleCount(2, beFormat);
- int k4 = ctxInfo.grContext()->priv().caps()->getRenderTargetSampleCount(4, beFormat);
+ int k2 = direct->priv().caps()->getRenderTargetSampleCount(2, beFormat);
+ int k4 = direct->priv().caps()->getRenderTargetSampleCount(4, beFormat);
//--------------------------------------------------------------------------------------------
TestCase gNonOverlappingTests[] = {
@@ -214,13 +216,13 @@
{{64, kNotRT, kRGBA, kE, 1, kNotB}, {64, kNotRT, kRGBA, kE, 1, kNotB}, kDontShare}};
GrBackendTexture backEndTex;
- sk_sp<GrSurfaceProxy> p1 = make_backend(ctxInfo.grContext(), t[0].fP1, &backEndTex);
+ sk_sp<GrSurfaceProxy> p1 = make_backend(direct, t[0].fP1, &backEndTex);
sk_sp<GrSurfaceProxy> p2 = make_deferred(proxyProvider, caps, t[0].fP2);
non_overlap_test(reporter, resourceProvider, std::move(p1), std::move(p2),
t[0].fExpectation);
- cleanup_backend(ctxInfo.grContext(), backEndTex);
+ cleanup_backend(direct, backEndTex);
}
}
@@ -237,7 +239,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorStressTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
size_t maxBytes = context->getResourceCacheLimit();
@@ -282,7 +284,7 @@
// it is over budget. The two opsTasks should be flushed separately and the opsTask indices
// returned from assign should be correct.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorOverBudgetTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
@@ -340,7 +342,7 @@
// http://crbug.com/996610.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorCurOpsTaskIndexTest,
reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
@@ -370,8 +372,7 @@
// Wrapped proxy that will be ignored by the resourceAllocator. We use this to try and get the
// resource allocator fCurOpsTaskIndex to fall behind what it really should be.
GrBackendTexture backEndTex;
- sk_sp<GrSurfaceProxy> proxyWrapped = make_backend(ctxInfo.grContext(), params,
- &backEndTex);
+ sk_sp<GrSurfaceProxy> proxyWrapped = make_backend(context, params, &backEndTex);
if (!proxyWrapped) {
return;
}
@@ -379,10 +380,9 @@
// Same as above, but we actually need to have at least two intervals that don't go through the
// resource allocator to expose the index bug.
GrBackendTexture backEndTex2;
- sk_sp<GrSurfaceProxy> proxyWrapped2 = make_backend(ctxInfo.grContext(), params,
- &backEndTex2);
+ sk_sp<GrSurfaceProxy> proxyWrapped2 = make_backend(context, params, &backEndTex2);
if (!proxyWrapped2) {
- cleanup_backend(ctxInfo.grContext(), backEndTex);
+ cleanup_backend(context, backEndTex);
return;
}
@@ -423,8 +423,8 @@
REPORTER_ASSERT(reporter, GrResourceAllocator::AssignError::kNoError == error);
REPORTER_ASSERT(reporter, 3 == startIndex && 4 == stopIndex);
- cleanup_backend(ctxInfo.grContext(), backEndTex);
- cleanup_backend(ctxInfo.grContext(), backEndTex2);
+ cleanup_backend(context, backEndTex);
+ cleanup_backend(context, backEndTex2);
context->setResourceCacheLimit(origMaxBytes);
}
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index cf20b3b..d5c5486 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -7,7 +7,7 @@
#include "include/core/SkTypes.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrGpuResourceCacheAccess.h"
@@ -34,7 +34,7 @@
////////////////////////////////////////////////////////////////////////////////
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheCache, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
SkCanvas* canvas = surface->getCanvas();
@@ -110,7 +110,7 @@
// This currently fails on ES3 ANGLE contexts
DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter,
ctxInfo, nullptr) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
if (caps->avoidStencilBuffers()) {
@@ -184,7 +184,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceCacheWrappedResources, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
GrGpu* gpu = context->priv().getGpu();
// this test is only valid for GL
@@ -1557,7 +1557,7 @@
// This simulates a portion of Chrome's context abandonment processing.
// Please see: crbug.com/1011368 and crbug.com/1014993
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceMessagesAfterAbandon, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGpu* gpu = context->priv().getGpu();
GrResourceCache* cache = context->priv().getResourceCache();
@@ -1630,7 +1630,7 @@
// Exercise GrSurface::gpuMemorySize for different combos of MSAA, RT-only,
// Texture-only, both-RT-and-Texture and MIPmapped
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrResourceProvider* resourceProvider = context->priv().resourceProvider();
const GrCaps* caps = context->priv().caps();
@@ -1686,7 +1686,7 @@
#if GR_GPU_STATS
DEF_GPUTEST_FOR_MOCK_CONTEXT(OverbudgetFlush, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
context->setResourceCacheLimit(1);
// Helper that determines if cache is overbudget.
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index 5e85e01..1844870 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrImageInfo.h"
@@ -228,7 +229,7 @@
// Test all combinations of writePixels/readPixels where the surface context/write source/read dst
// are sRGB, linear, or untagged RGBA_8888.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
if (!context->priv().caps()->getDefaultBackendFormat(GrColorType::kRGBA_8888_SRGB,
GrRenderable::kNo).isValid()) {
return;
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 10fe52c..f5ed12f 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -8,6 +8,7 @@
#include "include/core/SkGraphics.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/private/SkMutex.h"
#include "src/core/SkDraw.h"
#include "src/core/SkRemoteGlyphCache.h"
@@ -16,15 +17,14 @@
#include "src/core/SkStrikeSpec.h"
#include "src/core/SkSurfacePriv.h"
#include "src/core/SkTypeface_remote.h"
+#include "src/gpu/GrContextPriv.h"
+#include "src/gpu/GrRecordingContextPriv.h"
+#include "src/gpu/text/GrSDFTOptions.h"
#include "tests/Test.h"
#include "tools/Resources.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/TestEmptyTypeface.h"
-#include "src/gpu/GrContextPriv.h"
-#include "src/gpu/GrRecordingContextPriv.h"
-#include "src/gpu/text/GrSDFTOptions.h"
-
class DiscardableManager : public SkStrikeServer::DiscardableHandleManager,
public SkStrikeClient::DiscardableHandleManager {
public:
@@ -199,6 +199,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_StrikeSerialization, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -210,9 +211,9 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- auto props = FindSurfaceProps(ctxInfo.grContext());
+ auto props = FindSurfaceProps(direct);
SkTextBlobCacheDiffCanvas cache_diff_canvas(10, 10, props, &server,
- ctxInfo.grContext()->supportsDistanceFieldText());
+ direct->supportsDistanceFieldText());
#ifdef SK_CAPTURE_DRAW_TEXT_BLOB
{
SkDynamicMemoryWStream wStream;
@@ -236,8 +237,8 @@
client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
auto clientBlob = buildTextBlob(clientTf, glyphCount);
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext());
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext());
+ SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, direct);
+ SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, direct);
compare_blobs(expected, actual, reporter);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
@@ -261,7 +262,7 @@
auto serverBlob = buildTextBlob(serverTf, glyphCount);
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 10, 10, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 10, 10, props, &server, ctxInfo.directContext()->supportsDistanceFieldText());
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
REPORTER_ASSERT(reporter, !serverTf->unique());
@@ -455,6 +456,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsPath, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -470,9 +472,9 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- auto props = FindSurfaceProps(ctxInfo.grContext());
+ auto props = FindSurfaceProps(direct);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 10, 10, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 10, 10, props, &server, direct->supportsDistanceFieldText());
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
std::vector<uint8_t> serverStrikeData;
@@ -484,8 +486,8 @@
client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
auto clientBlob = buildTextBlob(clientTf, glyphCount);
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext());
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext());
+ SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, direct);
+ SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, direct);
compare_blobs(expected, actual, reporter, 1);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
@@ -530,6 +532,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsMaskWithPathFallback,
reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -545,9 +548,9 @@
auto serverBlob = make_blob_causing_fallback(serverTf, serverTf.get(), reporter);
- auto props = FindSurfaceProps(ctxInfo.grContext());
+ auto props = FindSurfaceProps(direct);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 10, 10, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 10, 10, props, &server, direct->supportsDistanceFieldText());
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
std::vector<uint8_t> serverStrikeData;
@@ -560,8 +563,8 @@
auto clientBlob = make_blob_causing_fallback(clientTf, serverTf.get(), reporter);
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext());
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext());
+ SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, direct);
+ SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, direct);
compare_blobs(expected, actual, reporter);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
@@ -645,6 +648,7 @@
#endif
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextXY, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -657,9 +661,9 @@
int glyphCount = 10;
auto serverBlob = buildTextBlob(serverTf, glyphCount);
- auto props = FindSurfaceProps(ctxInfo.grContext());
+ auto props = FindSurfaceProps(direct);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 10, 10, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 10, 10, props, &server, direct->supportsDistanceFieldText());
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0.5, 0, paint);
std::vector<uint8_t> serverStrikeData;
@@ -671,8 +675,8 @@
client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
auto clientBlob = buildTextBlob(clientTf, glyphCount);
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext(), nullptr, 0.5);
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext(), nullptr, 0.5);
+ SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, direct, nullptr, 0.5);
+ SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, direct, nullptr, 0.5);
compare_blobs(expected, actual, reporter);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
@@ -681,6 +685,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsDFT, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -690,8 +695,7 @@
// A scale transform forces fallback to dft.
SkMatrix matrix = SkMatrix::Scale(16, 16);
SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry);
- GrSDFTOptions options =
- ctxInfo.grContext()->priv().asRecordingContext()->priv().SDFTOptions();
+ GrSDFTOptions options = direct->priv().asRecordingContext()->priv().SDFTOptions();
REPORTER_ASSERT(reporter,
options.canDrawAsDistanceFields(paint, font, matrix, surfaceProps, true));
@@ -703,7 +707,7 @@
auto serverBlob = buildTextBlob(serverTf, glyphCount);
const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 10, 10, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 10, 10, props, &server, direct->supportsDistanceFieldText());
cache_diff_canvas.concat(matrix);
cache_diff_canvas.drawTextBlob(serverBlob.get(), 0, 0, paint);
@@ -716,8 +720,8 @@
client.readStrikeData(serverStrikeData.data(), serverStrikeData.size()));
auto clientBlob = buildTextBlob(clientTf, glyphCount);
- SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, ctxInfo.grContext(), &matrix);
- SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext(), &matrix);
+ SkBitmap expected = RasterBlob(serverBlob, 10, 10, paint, direct, &matrix);
+ SkBitmap actual = RasterBlob(clientBlob, 10, 10, paint, direct, &matrix);
compare_blobs(expected, actual, reporter);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
@@ -740,7 +744,7 @@
// Raster the client-side blob without the glyph data, we should get cache miss notifications.
SkPaint paint;
SkMatrix matrix = SkMatrix::I();
- RasterBlob(clientBlob, 10, 10, paint, ctxInfo.grContext(), &matrix);
+ RasterBlob(clientBlob, 10, 10, paint, ctxInfo.directContext(), &matrix);
REPORTER_ASSERT(reporter,
discardableManager->cacheMissCount(SkStrikeClient::kFontMetrics) == 1);
REPORTER_ASSERT(reporter,
@@ -781,6 +785,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_TypefaceWithNoPaths, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
sk_sp<DiscardableManager> discardableManager = sk_make_sp<DiscardableManager>();
SkStrikeServer server(discardableManager.get());
SkStrikeClient client(discardableManager, false);
@@ -791,9 +796,9 @@
for (SkScalar textSize : { 70, 180, 270, 340}) {
auto serverBlob = MakeEmojiBlob(serverTf, textSize);
- auto props = FindSurfaceProps(ctxInfo.grContext());
+ auto props = FindSurfaceProps(direct);
SkTextBlobCacheDiffCanvas cache_diff_canvas(
- 500, 500, props, &server, ctxInfo.grContext()->supportsDistanceFieldText());
+ 500, 500, props, &server, direct->supportsDistanceFieldText());
SkPaint paint;
cache_diff_canvas.drawTextBlob(serverBlob.get(), 100, 100, paint);
@@ -807,7 +812,7 @@
auto clientBlob = MakeEmojiBlob(serverTf, textSize, clientTf);
REPORTER_ASSERT(reporter, clientBlob);
- RasterBlob(clientBlob, 500, 500, paint, ctxInfo.grContext());
+ RasterBlob(clientBlob, 500, 500, paint, direct);
REPORTER_ASSERT(reporter, !discardableManager->hasCacheMiss());
discardableManager->resetCacheMissCounts();
}
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 7fdf421..6d1000c 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkPaint.h"
#include "include/core/SkSurface.h"
#include "include/effects/SkRuntimeEffect.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkTLazy.h"
#include "tests/Test.h"
@@ -163,5 +163,5 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRuntimeEffectSimple_GPU, r, ctxInfo) {
- test_RuntimeEffect_Shaders(r, ctxInfo.grContext());
+ test_RuntimeEffect_Shaders(r, ctxInfo.directContext());
}
diff --git a/tests/Skbug5221.cpp b/tests/Skbug5221.cpp
index df83f9c..98ad5615 100644
--- a/tests/Skbug5221.cpp
+++ b/tests/Skbug5221.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkFont.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
// This passes by not crashing.
static void test(SkCanvas* canvas) {
@@ -24,7 +25,7 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) {
sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(
- contextInfo.grContext(), SkBudgeted::kYes,
+ contextInfo.directContext(), SkBudgeted::kYes,
SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
test(surface->getCanvas());
}
diff --git a/tests/Skbug6653.cpp b/tests/Skbug6653.cpp
index e8e29f9..383d7d4 100644
--- a/tests/Skbug6653.cpp
+++ b/tests/Skbug6653.cpp
@@ -5,12 +5,10 @@
* found in the LICENSE file.
*/
-#include "include/core/SkTypes.h"
-
#include "include/core/SkCanvas.h"
#include "include/core/SkSurface.h"
-
-#include "include/gpu/GrContext.h"
+#include "include/core/SkTypes.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "tests/Test.h"
@@ -97,7 +95,7 @@
// Tests that readPixels returns up-to-date results. This has failed on several GPUs,
// from multiple vendors, in MSAA mode.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(skbug6653, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
test_bug_6653(ctx, reporter, "Default");
}
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index c6c393a..45064e1 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -10,20 +10,18 @@
#include "include/core/SkImage.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkSpecialImage.h"
#include "src/core/SkSpecialSurface.h"
-#include "tests/Test.h"
-
-#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
#include "src/gpu/GrBitmapTextureMaker.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrSurfaceProxy.h"
#include "src/gpu/GrTextureProxy.h"
#include "src/gpu/SkGr.h"
-
+#include "tests/Test.h"
// This test creates backing resources exactly sized to [kFullSize x kFullSize].
// It then wraps them in an SkSpecialImage with only the center (red) region being active.
@@ -186,7 +184,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
SkBitmap bm = create_bm();
GrBitmapTextureMaker maker(context, bm, GrImageTexGenPolicy::kNew_Uncached_Budgeted);
auto view = maker.view(GrMipMapped::kNo);
diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp
index d98c209..c3f185e 100644
--- a/tests/SpecialSurfaceTest.cpp
+++ b/tests/SpecialSurfaceTest.cpp
@@ -7,14 +7,13 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkSpecialImage.h"
#include "src/core/SkSpecialSurface.h"
-#include "tests/Test.h"
-
-#include "include/gpu/GrContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/SkGr.h"
+#include "tests/Test.h"
class TestingSpecialSurfaceAccess {
public:
@@ -78,13 +77,14 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
+ auto direct = ctxInfo.directContext();
+
for (auto colorType : {GrColorType::kRGBA_8888, GrColorType::kRGBA_1010102}) {
- if (!ctxInfo.grContext()->colorTypeSupportedAsSurface(
- GrColorTypeToSkColorType(colorType))) {
+ if (!direct->colorTypeSupportedAsSurface(GrColorTypeToSkColorType(colorType))) {
continue;
}
sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(
- ctxInfo.grContext(), kSmallerSize, kSmallerSize, colorType, nullptr));
+ direct, kSmallerSize, kSmallerSize, colorType, nullptr));
test_surface(surf, reporter, 0);
}
}
diff --git a/tests/SrcSrcOverBatchTest.cpp b/tests/SrcSrcOverBatchTest.cpp
index 48e5a39..156de00 100644
--- a/tests/SrcSrcOverBatchTest.cpp
+++ b/tests/SrcSrcOverBatchTest.cpp
@@ -11,11 +11,12 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkShader.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
#include "tools/gpu/GrContextFactory.h"
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SrcSrcOverBatchTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
static const int kSize = 8;
const SkImageInfo ii = SkImageInfo::Make(kSize, kSize, kRGBA_8888_SkColorType,
diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp
index ec3c8fb..990e078 100644
--- a/tests/SurfaceSemaphoreTest.cpp
+++ b/tests/SurfaceSemaphoreTest.cpp
@@ -9,6 +9,7 @@
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSemaphore.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrCaps.h"
#include "src/gpu/GrContextPriv.h"
#include "tests/Test.h"
@@ -71,7 +72,7 @@
const SkImageInfo childII = SkImageInfo::Make(CHILD_W, CHILD_H, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
- GrContext* childCtx = childInfo.grContext();
+ auto childCtx = childInfo.directContext();
sk_sp<SkSurface> childSurface(SkSurface::MakeRenderTarget(childCtx, SkBudgeted::kNo,
childII, 0, kTopLeft_GrSurfaceOrigin,
nullptr));
@@ -112,7 +113,7 @@
const sk_gpu_test::ContextInfo& childInfo1,
const sk_gpu_test::ContextInfo& childInfo2,
FlushType flushType) {
- GrContext* mainCtx = mainInfo.grContext();
+ auto mainCtx = mainInfo.directContext();
if (!mainCtx->priv().caps()->semaphoreSupport()) {
return;
}
@@ -209,12 +210,12 @@
}
skiatest::ReporterContext ctx(
reporter, SkString(sk_gpu_test::GrContextFactory::ContextTypeName(contextType)));
- if (ctxInfo.grContext()) {
+ if (ctxInfo.directContext()) {
sk_gpu_test::ContextInfo child1 =
factory.getSharedContextInfo(ctxInfo.directContext(), 0);
sk_gpu_test::ContextInfo child2 =
factory.getSharedContextInfo(ctxInfo.directContext(), 1);
- if (!child1.grContext() || !child2.grContext()) {
+ if (!child1.directContext() || !child2.directContext()) {
continue;
}
@@ -226,7 +227,7 @@
#endif
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
if (!ctx->priv().caps()->semaphoreSupport()) {
return;
}
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 6ec303e..c2a81dc 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -13,7 +13,7 @@
#include "include/core/SkRegion.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkAutoPixmapStorage.h"
#include "src/core/SkDevice.h"
#include "src/core/SkUtils.h"
@@ -88,11 +88,11 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) {
const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
REPORTER_ASSERT(reporter, nullptr ==
- SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info));
+ SkSurface::MakeRenderTarget(ctxInfo.directContext(), SkBudgeted::kNo, info));
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) {
static constexpr int kSize = 10;
@@ -201,7 +201,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static constexpr int kSize = 10;
@@ -281,7 +281,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
SkImageInfo requestInfo;
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, &requestInfo));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, &requestInfo));
test_canvas_peek(reporter, surface, requestInfo, false);
}
}
@@ -309,7 +309,7 @@
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
// GPU doesn't support creating unpremul surfaces, so only test opaque + premul
for (auto& at : { kOpaque_SkAlphaType, kPremul_SkAlphaType }) {
- auto surface(surface_func(ctxInfo.grContext(), at, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), at, nullptr));
test_snapshot_alphatype(reporter, surface, at);
}
}
@@ -350,11 +350,11 @@
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
for (auto& accessMode : accessModes) {
{
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_backend_texture_access_copy_on_write(reporter, surface.get(), accessMode);
}
{
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_backend_rendertarget_access_copy_on_write(reporter, surface.get(), accessMode);
}
}
@@ -389,12 +389,12 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBackendHandleAccessIDs_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
{
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_backend_unique_id<GrBackendTexture, &SkSurface::getBackendTexture>(reporter,
surface.get());
}
{
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_backend_unique_id<GrBackendRenderTarget, &SkSurface::getBackendRenderTarget>(
reporter, surface.get());
}
@@ -463,7 +463,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_copy_on_write(reporter, surface.get());
}
}
@@ -483,7 +483,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_writable_after_snapshot_release(reporter, surface.get());
}
}
@@ -528,8 +528,8 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
- auto surface1(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
- auto surface2(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface1(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
+ auto surface2(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_crbug263329(reporter, surface1.get(), surface2.get());
}
}
@@ -543,7 +543,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) {
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
sk_sp<SkImage> image(surface->makeImageSnapshot());
REPORTER_ASSERT(reporter, as_IB(image)->isTextureBacked());
@@ -575,7 +575,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceBudget, reporter, ctxInfo) {
SkImageInfo info = SkImageInfo::MakeN32Premul(8,8);
for (auto budgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
- auto surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), budgeted, info));
+ auto surface(SkSurface::MakeRenderTarget(ctxInfo.directContext(), budgeted, info));
SkASSERT(surface);
REPORTER_ASSERT(reporter, budgeted == is_budgeted(surface));
@@ -628,7 +628,7 @@
for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
for (auto& test_func : { &test_no_canvas1, &test_no_canvas2 }) {
for (auto& mode : modes) {
- auto surface(surface_func(ctxInfo.grContext(), kPremul_SkAlphaType, nullptr));
+ auto surface(surface_func(ctxInfo.directContext(), kPremul_SkAlphaType, nullptr));
test_func(reporter, surface.get(), mode);
}
}
@@ -795,7 +795,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
// Snaps an image from a surface and then makes a GrSurfaceContext from the image's texture.
auto makeImageSurfaceContext = [context](SkSurface* surface) {
sk_sp<SkImage> i(surface->makeImageSnapshot());
@@ -897,7 +897,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static const SkColor4f kOrigColor { 0.667f, 0.733f, 0.8f, 1 };
@@ -933,7 +933,7 @@
const int kWidth = 10;
const int kHeight = 10;
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
GrGpu* gpu = ctx->priv().getGpu();
for (bool useTexture : {false, true}) {
@@ -992,7 +992,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
const GrCaps* caps = context->priv().caps();
if (caps->avoidStencilBuffers()) {
@@ -1025,7 +1025,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReplaceSurfaceBackendTexture, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
for (int sampleCnt : {1, 2}) {
GrBackendTexture backendTexture1;
@@ -1149,7 +1149,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(OverdrawSurface_Gpu, r, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
sk_sp<SkSurface> surface = create_gpu_surface(context);
test_overdraw_surface(r, surface.get());
}
diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp
index 8039b87..13d6ef4 100644
--- a/tests/TestTest.cpp
+++ b/tests/TestTest.cpp
@@ -24,19 +24,19 @@
// Note: Some of the contexts might not produce a rendering output.
DEF_GPUTEST_FOR_ALL_CONTEXTS(TestGpuAllContexts, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, reporter);
- REPORTER_ASSERT(reporter, ctxInfo.grContext());
+ REPORTER_ASSERT(reporter, ctxInfo.directContext());
}
// This is an example of a GPU test that tests a property that should work for all GPU contexts that
// produce a rendering output.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TestGpuRenderingContexts, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, reporter);
- REPORTER_ASSERT(reporter, ctxInfo.grContext());
+ REPORTER_ASSERT(reporter, ctxInfo.directContext());
}
// This is an example of a GPU test that tests a property that uses the mock context. It should
// be used if the test tests some behavior that is mocked with the mock context.
DEF_GPUTEST_FOR_MOCK_CONTEXT(TestMockContext, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, reporter);
- REPORTER_ASSERT(reporter, ctxInfo.grContext());
+ REPORTER_ASSERT(reporter, ctxInfo.directContext());
}
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index 3e0b2d0..6e72d9e 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -17,6 +17,7 @@
#include "include/core/SkSurface.h"
#include "include/core/SkTextBlob.h"
#include "include/core/SkTypeface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/core/SkGlyphRun.h"
#include "tools/fonts/RandomScalerContext.h"
@@ -170,19 +171,19 @@
}
DEF_GPUTEST_FOR_MOCK_CONTEXT(TextBlobCache, reporter, ctxInfo) {
- text_blob_cache_inner(reporter, ctxInfo.grContext(), 1024, 256, 30, true, false);
+ text_blob_cache_inner(reporter, ctxInfo.directContext(), 1024, 256, 30, true, false);
}
DEF_GPUTEST_FOR_MOCK_CONTEXT(TextBlobStressCache, reporter, ctxInfo) {
- text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, true, true);
+ text_blob_cache_inner(reporter, ctxInfo.directContext(), 256, 256, 10, true, true);
}
DEF_GPUTEST_FOR_MOCK_CONTEXT(TextBlobAbnormal, reporter, ctxInfo) {
- text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, false, false);
+ text_blob_cache_inner(reporter, ctxInfo.directContext(), 256, 256, 10, false, false);
}
DEF_GPUTEST_FOR_MOCK_CONTEXT(TextBlobStressAbnormal, reporter, ctxInfo) {
- text_blob_cache_inner(reporter, ctxInfo.grContext(), 256, 256, 10, false, true);
+ text_blob_cache_inner(reporter, ctxInfo.directContext(), 256, 256, 10, false, true);
}
static const int kScreenDim = 160;
@@ -297,10 +298,10 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextBlobJaggedGlyph, reporter, ctxInfo) {
- auto grContext = ctxInfo.grContext();
+ auto direct = ctxInfo.directContext();
const SkImageInfo info =
SkImageInfo::Make(kScreenDim, kScreenDim, kN32_SkColorType, kPremul_SkAlphaType);
- auto surface = SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info);
+ auto surface = SkSurface::MakeRenderTarget(direct, SkBudgeted::kNo, info);
auto blob = make_blob();
@@ -353,10 +354,10 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextBlobSmoothScroll, reporter, ctxInfo) {
- auto grContext = ctxInfo.grContext();
+ auto direct = ctxInfo.directContext();
const SkImageInfo info =
SkImageInfo::Make(kScreenDim, kScreenDim, kN32_SkColorType, kPremul_SkAlphaType);
- auto surface = SkSurface::MakeRenderTarget(grContext, SkBudgeted::kNo, info);
+ auto surface = SkSurface::MakeRenderTarget(direct, SkBudgeted::kNo, info);
auto movingBlob = make_blob();
diff --git a/tests/TextureBindingsResetTest.cpp b/tests/TextureBindingsResetTest.cpp
index d0f4c5a..acfbae6 100644
--- a/tests/TextureBindingsResetTest.cpp
+++ b/tests/TextureBindingsResetTest.cpp
@@ -6,6 +6,7 @@
*/
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/gl/GrGLDefines.h"
#include "src/gpu/gl/GrGLGpu.h"
@@ -17,7 +18,7 @@
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(TextureBindingsResetTest, reporter, ctxInfo) {
#define GL(F) GR_GL_CALL(ctxInfo.glContext()->gl(), F)
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGpu* gpu = context->priv().getGpu();
GrGLGpu* glGpu = static_cast<GrGLGpu*>(context->priv().getGpu());
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index 285db98..543b70d 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -10,6 +10,7 @@
#include "tests/Test.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProxyProvider.h"
#include "src/gpu/GrResourceCache.h"
@@ -287,7 +288,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextureProxyTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
GrResourceCache* cache = context->priv().getResourceCache();
diff --git a/tests/TextureStripAtlasManagerTest.cpp b/tests/TextureStripAtlasManagerTest.cpp
index 65cd523..bfead52 100644
--- a/tests/TextureStripAtlasManagerTest.cpp
+++ b/tests/TextureStripAtlasManagerTest.cpp
@@ -11,6 +11,7 @@
#include "include/core/SkSurface.h"
#include "include/effects/SkGradientShader.h"
#include "include/effects/SkTableColorFilter.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
#include "tools/Resources.h"
@@ -18,7 +19,7 @@
// The gradient shader will use the texture strip atlas if it has too many colors. Make sure
// abandoning the context works.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextureStripAtlasManagerGradientTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
static const SkColor gColors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
@@ -48,7 +49,7 @@
// The table color filter uses the texture strip atlas. Make sure abandoning the context works.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextureStripAtlasManagerColorFilterTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
sk_sp<SkImage> img = GetResourceAsImage("images/mandrill_128.png");
diff --git a/tests/TraceMemoryDumpTest.cpp b/tests/TraceMemoryDumpTest.cpp
index 6b1e59a..d22c200 100644
--- a/tests/TraceMemoryDumpTest.cpp
+++ b/tests/TraceMemoryDumpTest.cpp
@@ -6,6 +6,7 @@
*/
#include "include/core/SkTraceMemoryDump.h"
+#include "include/gpu/GrDirectContext.h"
#include "tests/Test.h"
@@ -75,7 +76,7 @@
#ifdef SK_GL
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_ownedGLBuffer, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
const size_t kMemorySize = 1024;
sk_sp<GrGLBuffer> buffer =
@@ -85,7 +86,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_ownedGLTexture, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrGLTexture::Desc desc;
@@ -102,7 +103,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_unownedGLTexture, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
GrGLTexture::Desc desc;
@@ -122,7 +123,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_ownedGLRenderTarget, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
static constexpr auto kSize = SkISize::Make(64, 64);
@@ -140,7 +141,7 @@
}
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkTraceMemoryDump_unownedGLRenderTarget, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrGLGpu* gpu = static_cast<GrGLGpu*>(context->priv().getGpu());
static constexpr auto kSize = SkISize::Make(64, 64);
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 91f8206..9685743 100644
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -10,6 +10,7 @@
#include "include/core/SkTypes.h"
#include "include/core/SkSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrImageInfo.h"
@@ -245,7 +246,7 @@
void basic_transfer_from_test(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& ctxInfo,
GrColorType colorType, GrRenderable renderable) {
- auto context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
auto caps = context->priv().caps();
if (GrCaps::kNone_MapFlags == caps->mapBufferFlags()) {
return;
@@ -400,7 +401,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TransferPixelsToTextureTest, reporter, ctxInfo) {
- if (!ctxInfo.grContext()->priv().caps()->transferFromBufferToTextureSupport()) {
+ if (!ctxInfo.directContext()->priv().caps()->transferFromBufferToTextureSupport()) {
return;
}
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
@@ -425,14 +426,14 @@
GrColorType::kRGBA_16161616,
GrColorType::kRG_F16,
}) {
- basic_transfer_to_test(reporter, ctxInfo.grContext(), colorType, renderable);
+ basic_transfer_to_test(reporter, ctxInfo.directContext(), colorType, renderable);
}
}
}
// TODO(bsalomon): Metal
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TransferPixelsFromTextureTest, reporter, ctxInfo) {
- if (!ctxInfo.grContext()->priv().caps()->transferFromSurfaceToBufferSupport()) {
+ if (!ctxInfo.directContext()->priv().caps()->transferFromSurfaceToBufferSupport()) {
return;
}
for (auto renderable : {GrRenderable::kNo, GrRenderable::kYes}) {
diff --git a/tests/TriangulatingPathRendererTests.cpp b/tests/TriangulatingPathRendererTests.cpp
index ff0fc3a..99eaac6 100644
--- a/tests/TriangulatingPathRendererTests.cpp
+++ b/tests/TriangulatingPathRendererTests.cpp
@@ -9,7 +9,7 @@
#include "include/core/SkPath.h"
#include "include/effects/SkGradientShader.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrStyle.h"
@@ -732,7 +732,7 @@
}
DEF_GPUTEST_FOR_ALL_CONTEXTS(TriangulatingPathRendererTests, reporter, ctxInfo) {
- GrContext* ctx = ctxInfo.grContext();
+ auto ctx = ctxInfo.directContext();
auto rtc = GrRenderTargetContext::Make(
ctx, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kApprox, {800, 800}, 1,
GrMipMapped::kNo, GrProtected::kNo, kTopLeft_GrSurfaceOrigin);
diff --git a/tests/VkBackendSurfaceTest.cpp b/tests/VkBackendSurfaceTest.cpp
index 764e73e..8508423 100644
--- a/tests/VkBackendSurfaceTest.cpp
+++ b/tests/VkBackendSurfaceTest.cpp
@@ -18,8 +18,8 @@
#include "include/core/SkImage.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/vk/GrVkTypes.h"
-#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTargetContext.h"
#include "src/gpu/GrTexture.h"
#include "src/gpu/GrTextureProxy.h"
@@ -32,7 +32,7 @@
#include "src/image/SkSurface_Gpu.h"
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkImageLayoutTest, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrBackendTexture backendTex;
CreateBackendTexture(context, &backendTex, 1, 1, kRGBA_8888_SkColorType, SkColors::kTransparent,
diff --git a/tests/VkDrawableTest.cpp b/tests/VkDrawableTest.cpp
index a2367eb..d3e6e8f 100644
--- a/tests/VkDrawableTest.cpp
+++ b/tests/VkDrawableTest.cpp
@@ -16,6 +16,7 @@
#include "include/core/SkDrawable.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendDrawableInfo.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/vk/GrVkGpu.h"
#include "src/gpu/vk/GrVkInterface.h"
@@ -263,7 +264,7 @@
}
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkDrawableTest, reporter, ctxInfo) {
- draw_drawable_test(reporter, ctxInfo.grContext(), nullptr);
+ draw_drawable_test(reporter, ctxInfo.directContext(), nullptr);
}
DEF_GPUTEST(VkDrawableImportTest, reporter, options) {
@@ -277,14 +278,14 @@
sk_gpu_test::ContextInfo ctxInfo = factory.getContextInfo(contextType);
skiatest::ReporterContext ctx(
reporter, SkString(sk_gpu_test::GrContextFactory::ContextTypeName(contextType)));
- if (ctxInfo.grContext()) {
+ if (ctxInfo.directContext()) {
sk_gpu_test::ContextInfo child =
factory.getSharedContextInfo(ctxInfo.directContext(), 0);
- if (!child.grContext()) {
+ if (!child.directContext()) {
continue;
}
- draw_drawable_test(reporter, ctxInfo.grContext(), child.grContext());
+ draw_drawable_test(reporter, ctxInfo.directContext(), child.directContext());
}
}
}
diff --git a/tests/VkHardwareBufferTest.cpp b/tests/VkHardwareBufferTest.cpp
index c1248bd..16811b9 100644
--- a/tests/VkHardwareBufferTest.cpp
+++ b/tests/VkHardwareBufferTest.cpp
@@ -15,7 +15,7 @@
#include "include/core/SkImage.h"
#include "include/core/SkSurface.h"
#include "include/gpu/GrBackendSemaphore.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "include/gpu/vk/GrVkBackendContext.h"
#include "include/gpu/vk/GrVkExtensions.h"
#include "src/core/SkAutoMalloc.h"
@@ -60,7 +60,7 @@
virtual void makeCurrent() = 0;
- virtual GrContext* grContext() = 0;
+ virtual GrDirectContext* directContext() = 0;
int getFdHandle() { return fFdHandle; }
@@ -110,7 +110,7 @@
void makeCurrent() override { fGLCtx->makeCurrent(); }
- GrContext* grContext() override { return fGrContext; }
+ GrDirectContext* directContext() override { return fDirectContext; }
private:
bool importHardwareBuffer(skiatest::Reporter* reporter, AHardwareBuffer* buffer);
@@ -136,14 +136,14 @@
sk_gpu_test::ContextInfo fGLESContextInfo;
sk_gpu_test::GLTestContext* fGLCtx = nullptr;
- GrContext* fGrContext = nullptr;
+ GrDirectContext* fDirectContext = nullptr;
};
bool EGLTestHelper::init(skiatest::Reporter* reporter) {
fGLESContextInfo = fFactory.getContextInfo(sk_gpu_test::GrContextFactory::kGLES_ContextType);
- fGrContext = fGLESContextInfo.grContext();
+ fDirectContext = fGLESContextInfo.directContext();
fGLCtx = fGLESContextInfo.glContext();
- if (!fGrContext || !fGLCtx) {
+ if (!fDirectContext || !fGLCtx) {
return false;
}
@@ -248,7 +248,7 @@
return false;
}
- fGrContext->resetContext(kTextureBinding_GrGLBackendState);
+ fDirectContext->resetContext(kTextureBinding_GrGLBackendState);
return true;
}
@@ -265,12 +265,12 @@
GrBackendTexture backendTex(DEV_W, DEV_H, GrMipMapped::kNo, textureInfo);
REPORTER_ASSERT(reporter, backendTex.isValid());
- sk_sp<SkImage> image = SkImage::MakeFromTexture(fGrContext,
- backendTex,
- kTopLeft_GrSurfaceOrigin,
- kRGBA_8888_SkColorType,
- kPremul_SkAlphaType,
- nullptr);
+ sk_sp<SkImage> image = SkImage::MakeFromTexture(fDirectContext,
+ backendTex,
+ kTopLeft_GrSurfaceOrigin,
+ kRGBA_8888_SkColorType,
+ kPremul_SkAlphaType,
+ nullptr);
if (!image) {
ERRORF(reporter, "Failed to make wrapped GL SkImage");
@@ -293,7 +293,7 @@
GrBackendTexture backendTex(DEV_W, DEV_H, GrMipMapped::kNo, textureInfo);
REPORTER_ASSERT(reporter, backendTex.isValid());
- sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(fGrContext,
+ sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(fDirectContext,
backendTex,
kTopLeft_GrSurfaceOrigin,
0,
@@ -357,8 +357,8 @@
}
void EGLTestHelper::doClientSync() {
- this->grContext()->flush();
- this->grContext()->submit(true);
+ this->directContext()->flush();
+ this->directContext()->submit(true);
}
#endif // SK_GL
@@ -404,7 +404,7 @@
}
}
void cleanup() override {
- fGrContext.reset();
+ fDirectContext.reset();
this->releaseImage();
if (fSignalSemaphore != VK_NULL_HANDLE) {
fVkDestroySemaphore(fDevice, fSignalSemaphore, nullptr);
@@ -435,11 +435,11 @@
bool init(skiatest::Reporter* reporter) override;
void doClientSync() override {
- if (!fGrContext) {
+ if (!fDirectContext) {
return;
}
- fGrContext->priv().getGpu()->testingOnly_flushGpuAndSync();
+ fDirectContext->priv().getGpu()->testingOnly_flushGpuAndSync();
}
bool flushSurfaceAndSignalSemaphore(skiatest::Reporter* reporter, sk_sp<SkSurface>) override;
@@ -454,7 +454,7 @@
void makeCurrent() override {}
- GrContext* grContext() override { return fGrContext.get(); }
+ GrDirectContext* directContext() override { return fDirectContext.get(); }
private:
bool checkOptimalHardwareBuffer(skiatest::Reporter* reporter);
@@ -502,7 +502,7 @@
VkDevice fDevice = VK_NULL_HANDLE;
GrVkBackendContext fBackendContext;
- sk_sp<GrContext> fGrContext;
+ sk_sp<GrDirectContext> fDirectContext;
};
bool VulkanTestHelper::init(skiatest::Reporter* reporter) {
@@ -576,9 +576,13 @@
ACQUIRE_DEVICE_VK_PROC(ImportSemaphoreFdKHR);
ACQUIRE_DEVICE_VK_PROC(DestroySemaphore);
- fGrContext = GrContext::MakeVulkan(fBackendContext);
- REPORTER_ASSERT(reporter, fGrContext.get());
- if (!fGrContext) {
+ // CONTEXT TODO: MakeVulkan should return an sk_sp<GrDirectContext>
+ auto tmp = GrContext::MakeVulkan(fBackendContext);
+ if (tmp) {
+ fDirectContext = sk_ref_sp<GrDirectContext>(tmp->asDirectContext());
+ }
+ REPORTER_ASSERT(reporter, fDirectContext.get());
+ if (!fDirectContext) {
return false;
}
@@ -802,7 +806,7 @@
GrBackendTexture backendTex(DEV_W, DEV_H, imageInfo);
- sk_sp<SkImage> wrappedImage = SkImage::MakeFromTexture(fGrContext.get(),
+ sk_sp<SkImage> wrappedImage = SkImage::MakeFromTexture(fDirectContext.get(),
backendTex,
kTopLeft_GrSurfaceOrigin,
kRGBA_8888_SkColorType,
@@ -828,8 +832,8 @@
GrFlushInfo info;
info.fNumSemaphores = 1;
info.fSignalSemaphores = &semaphore;
- GrSemaphoresSubmitted submitted = fGrContext->flush(info);
- fGrContext->submit();
+ GrSemaphoresSubmitted submitted = fDirectContext->flush(info);
+ fDirectContext->submit();
if (GrSemaphoresSubmitted::kNo == submitted) {
ERRORF(reporter, "Failing call to flush on GrContext");
return false;
@@ -964,7 +968,7 @@
GrBackendTexture backendTex(DEV_W, DEV_H, imageInfo);
- sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(fGrContext.get(),
+ sk_sp<SkSurface> surface = SkSurface::MakeFromBackendTexture(fDirectContext.get(),
backendTex,
kTopLeft_GrSurfaceOrigin,
0,
@@ -1239,13 +1243,13 @@
return;
}
- GrContext* grContext = dstHelper->grContext();
+ auto direct = dstHelper->directContext();
// Make SkSurface to render wrapped HWB into.
SkImageInfo imageInfo = SkImageInfo::Make(DEV_W, DEV_H, kRGBA_8888_SkColorType,
kPremul_SkAlphaType, nullptr);
- sk_sp<SkSurface> dstSurf = SkSurface::MakeRenderTarget(grContext,
+ sk_sp<SkSurface> dstSurf = SkSurface::MakeRenderTarget(direct,
SkBudgeted::kNo, imageInfo, 0,
kTopLeft_GrSurfaceOrigin,
nullptr, false);
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index bde86a1..3f37114 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -14,6 +14,7 @@
#include "include/gpu/vk/GrVkVulkan.h"
#include "include/gpu/GrBackendSurface.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrTexture.h"
@@ -174,9 +175,11 @@
}
DEF_GPUTEST_FOR_VULKAN_CONTEXT(VkWrapTests, reporter, ctxInfo) {
- wrap_tex_test(reporter, ctxInfo.grContext());
- wrap_rt_test(reporter, ctxInfo.grContext());
- wrap_trt_test(reporter, ctxInfo.grContext());
+ auto direct = ctxInfo.directContext();
+
+ wrap_tex_test(reporter, direct);
+ wrap_rt_test(reporter, direct);
+ wrap_trt_test(reporter, direct);
}
#endif
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 5b85ae4..ef5ab98 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -15,7 +15,7 @@
#include "tools/ToolUtils.h"
#include "include/gpu/GrBackendSurface.h"
-#include "include/gpu/GrContext.h"
+#include "include/gpu/GrDirectContext.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrGpu.h"
#include "src/gpu/GrProxyProvider.h"
@@ -444,11 +444,11 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
- test_write_pixels(reporter, ctxInfo.grContext(), 1);
+ test_write_pixels(reporter, ctxInfo.directContext(), 1);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsMSAA_Gpu, reporter, ctxInfo) {
- test_write_pixels(reporter, ctxInfo.grContext(), 1);
+ test_write_pixels(reporter, ctxInfo.directContext(), 1);
}
static void test_write_pixels_non_texture(skiatest::Reporter* reporter,
@@ -478,11 +478,11 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) {
- test_write_pixels_non_texture(reporter, ctxInfo.grContext(), 1);
+ test_write_pixels_non_texture(reporter, ctxInfo.directContext(), 1);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTextureMSAA_Gpu, reporter, ctxInfo) {
- test_write_pixels_non_texture(reporter, ctxInfo.grContext(), 4);
+ test_write_pixels_non_texture(reporter, ctxInfo.directContext(), 4);
}
static sk_sp<SkSurface> create_surf(GrContext* context, int width, int height) {
@@ -509,7 +509,7 @@
// second writePixels takes effect (i.e., that writePixels correctly flushes
// in between uses of the shared backing resource).
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsPendingIO, reporter, ctxInfo) {
- GrContext* context = ctxInfo.grContext();
+ auto context = ctxInfo.directContext();
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
const GrCaps* caps = context->priv().caps();