diff options
author | Brian Salomon <bsalomon@google.com> | 2018-05-11 10:14:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-11 14:47:27 +0000 |
commit | c7fe0f708ccbf12bf2ad1374ff307940d2c93880 (patch) | |
tree | cc4e63c994ac6af6ddab2f0fa063dbf800e2dd8a /tests | |
parent | 244f754cdd6ba1c5917a65cd94fe0bf87e3a7339 (diff) |
Make GrCaps and GrShaderCaps private.
Moves getCaps() from GrContext to GrContextPriv and removes unused refCaps().
Change-Id: Ic6a8951b656c0d1b2773eae73bff8e88af819866
Reviewed-on: https://skia-review.googlesource.com/127389
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ApplyGammaTest.cpp | 3 | ||||
-rw-r--r-- | tests/ClipStackTest.cpp | 12 | ||||
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 45 | ||||
-rw-r--r-- | tests/DrawOpAtlasTest.cpp | 2 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 4 | ||||
-rw-r--r-- | tests/GrContextFactoryTest.cpp | 14 | ||||
-rw-r--r-- | tests/GrMeshTest.cpp | 15 | ||||
-rw-r--r-- | tests/GrMipMappedTest.cpp | 6 | ||||
-rw-r--r-- | tests/GrPorterDuffTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 6 | ||||
-rw-r--r-- | tests/ImageFilterTest.cpp | 4 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 6 | ||||
-rw-r--r-- | tests/PrimitiveProcessorTest.cpp | 3 | ||||
-rw-r--r-- | tests/ProcessorTest.cpp | 3 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 4 | ||||
-rw-r--r-- | tests/ResourceAllocatorTest.cpp | 4 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 19 | ||||
-rw-r--r-- | tests/SRGBMipMapTest.cpp | 2 | ||||
-rw-r--r-- | tests/SRGBReadWritePixelsTest.cpp | 8 | ||||
-rw-r--r-- | tests/SpecialImageTest.cpp | 5 | ||||
-rw-r--r-- | tests/SpecialSurfaceTest.cpp | 4 | ||||
-rw-r--r-- | tests/SurfaceSemaphoreTest.cpp | 4 | ||||
-rw-r--r-- | tests/SurfaceTest.cpp | 13 | ||||
-rwxr-xr-x | tests/TransferPixelsTest.cpp | 6 | ||||
-rw-r--r-- | tests/WindowRectanglesTest.cpp | 1 |
25 files changed, 104 insertions, 91 deletions
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp index 8eb35e19a3..d210e9e947 100644 --- a/tests/ApplyGammaTest.cpp +++ b/tests/ApplyGammaTest.cpp @@ -12,6 +12,7 @@ #include "GrCaps.h" #include "GrContext.h" #include "GrContextFactory.h" +#include "GrContextPriv.h" #include "GrShaderCaps.h" #include "GrTypes.h" #include "SkBitmap.h" @@ -120,7 +121,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ApplyGamma, reporter, ctxInfo) { SkAutoTMalloc<uint32_t> read(kW * kH); // We allow more error on GPUs with lower precision shader variables. - float error = context->caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f; + float error = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f; for (auto toSRGB : { false, true }) { sk_sp<SkSurface> dst(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii)); diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index eeef831df1..a716c04239 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -1045,7 +1045,7 @@ static void test_reduced_clip_stack(skiatest::Reporter* reporter) { } auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); // Zero the memory we will new the GrReducedClip into. This ensures the elements gen ID // will be kInvalidGenID if left uninitialized. @@ -1116,7 +1116,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); SkAlignedSTStorage<1, GrReducedClip> storage; memset(storage.get(), 0, sizeof(GrReducedClip)); @@ -1205,7 +1205,7 @@ static void test_reduced_clip_stack_genid(skiatest::Reporter* reporter) { #undef XYWH #undef IXYWH auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); for (size_t i = 0; i < SK_ARRAY_COUNT(testCases); ++i) { const GrReducedClip reduced(stack, testCases[i].testBounds, caps); @@ -1233,7 +1233,7 @@ static void test_reduced_clip_stack_no_aa_crash(skiatest::Reporter* reporter) { SkRect bounds = SkRect::MakeXYWH(0, 0, 100, 100); auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); // At the time, this would crash. const GrReducedClip reduced(stack, bounds, caps); @@ -1252,7 +1252,7 @@ static void test_aa_query(skiatest::Reporter* reporter, const SkString& testName const SkRect& preXformQuery, ClipMethod expectedMethod, int numExpectedElems = 0) { auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); SkRect queryBounds; queryXform.mapRect(&queryBounds, preXformQuery); @@ -1414,7 +1414,7 @@ static void test_tiny_query_bounds_assertion_bug(skiatest::Reporter* reporter) { pathStack.clipPath(clipPath, SkMatrix::I(), kIntersect_SkClipOp, true); auto context = GrContext::MakeMock(nullptr); - const auto* caps = context->caps()->shaderCaps(); + const auto* caps = context->contextPriv().caps()->shaderCaps(); for (const SkClipStack& stack : {rectStack, pathStack}) { for (SkRect queryBounds : {SkRect::MakeXYWH(53, 60, GrClip::kBoundsTolerance, 1000), diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 9716477591..d033f890d8 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -10,22 +10,21 @@ #if SK_SUPPORT_GPU #include "GrBackendSurface.h" +#include "GrContextPriv.h" #include "GrGpu.h" #include "GrTextureProxyPriv.h" - #include "SkCanvas.h" #include "SkColorSpacePriv.h" #include "SkDeferredDisplayListRecorder.h" #include "SkGpuDevice.h" #include "SkImage_Gpu.h" #include "SkSurface.h" -#include "SkSurface_Gpu.h" #include "SkSurfaceCharacterization.h" #include "SkSurfaceProps.h" +#include "SkSurface_Gpu.h" #include "Test.h" - -#include "gl/GrGLDefines.h" #include "gl/GrGLCaps.h" +#include "gl/GrGLDefines.h" #ifdef SK_VULKAN #include "vk/GrVkDefines.h" #endif @@ -35,13 +34,13 @@ static GrBackendFormat create_backend_format(GrContext* context, SkColorType ct, SkColorSpace* cs, GrPixelConfig config) { - const GrCaps* caps = context->caps(); + const GrCaps* caps = context->contextPriv().caps(); // TODO: what should be done if we have a colorspace that doesn't have a gammaCloseToSRGB? switch (context->contextPriv().getBackend()) { case kOpenGL_GrBackend: { - const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(context->caps()); + const GrGLCaps* glCaps = static_cast<const GrGLCaps*>(caps); GrGLStandard standard = glCaps->standard(); switch (ct) { @@ -418,7 +417,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLOperatorEqTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); for (int i = 0; i < SurfaceParameters::kNumParams; ++i) { - SurfaceParameters params1(context->caps()); + SurfaceParameters params1(context->contextPriv().caps()); params1.modify(i); SkSurfaceCharacterization char1 = params1.createCharacterization(context); @@ -427,7 +426,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLOperatorEqTest, reporter, ctxInfo) { } for (int j = 0; j < SurfaceParameters::kNumParams; ++j) { - SurfaceParameters params2(context->caps()); + SurfaceParameters params2(context->contextPriv().caps()); params2.modify(j); SkSurfaceCharacterization char2 = params2.createCharacterization(context); @@ -445,7 +444,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLOperatorEqTest, reporter, ctxInfo) { } { - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); SkSurfaceCharacterization valid = params.createCharacterization(context); SkASSERT(valid.isValid()); @@ -475,7 +474,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx // First, create a DDL using the stock SkSurface parameters { - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); ddl = params.createDDL(context); SkAssertResult(ddl); @@ -497,7 +496,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx // Then, alter each parameter in turn and check that the DDL & surface are incompatible for (int i = 0; i < SurfaceParameters::kNumParams; ++i) { - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); params.modify(i); GrBackendTexture backend; @@ -509,9 +508,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx if (SurfaceParameters::kSampleCount == i) { SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get()); - int supportedSampleCount = context->caps()->getRenderTargetSampleCount( - params.sampleCount(), - gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config()); + int supportedSampleCount = context->contextPriv().caps()->getRenderTargetSampleCount( + params.sampleCount(), + gpuSurf->getDevice() + ->accessRenderTargetContext() + ->asRenderTargetProxy() + ->config()); if (1 == supportedSampleCount) { // If changing the sample count won't result in a different // surface characterization, skip this step @@ -521,7 +523,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx } } - if (SurfaceParameters::kMipMipCount == i && !context->caps()->mipMapSupport()) { + if (SurfaceParameters::kMipMipCount == i && + !context->contextPriv().caps()->mipMapSupport()) { // If changing the mipmap setting won't result in a different surface characterization, // skip this step s = nullptr; @@ -540,7 +543,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx // Next test the compatibility of resource cache parameters { - const SurfaceParameters params(context->caps()); + const SurfaceParameters params(context->contextPriv().caps()); GrBackendTexture backend; sk_sp<SkSurface> s = params.make(context, &backend, false); @@ -578,7 +581,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx // Test that the textureability of the DDL characterization can block a DDL draw { GrBackendTexture backend; - const SurfaceParameters params(context->caps()); + const SurfaceParameters params(context->contextPriv().caps()); sk_sp<SkSurface> s = params.make(context, &backend, true); if (s) { REPORTER_ASSERT(reporter, !s->draw(ddl.get())); @@ -601,7 +604,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLSurfaceCharacterizationTest, reporter, ctx // Exercise the createResized method { - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); GrBackendTexture backend; sk_sp<SkSurface> s = params.make(context, &backend, false); @@ -638,7 +641,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLMakeRenderTargetTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); for (int i = 0; i < SurfaceParameters::kNumParams; ++i) { - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); params.modify(i); SkSurfaceCharacterization c = params.createCharacterization(context); @@ -698,7 +701,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DDLWrapBackendTest, reporter, ctxInfo) { return; } - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); GrBackendTexture backend; sk_sp<SkSurface> s = params.make(context, &backend, false); @@ -860,7 +863,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(DDLCompatibilityTest, reporter, ctxInfo) { for (int config = 0; config < kGrPixelConfigCnt; ++config) { GrPixelConfig pixelConfig = static_cast<GrPixelConfig>(config); - SurfaceParameters params(context->caps()); + SurfaceParameters params(context->contextPriv().caps()); params.setColorType(colorType); params.setConfig(pixelConfig); diff --git a/tests/DrawOpAtlasTest.cpp b/tests/DrawOpAtlasTest.cpp index ef219d9412..584ae64825 100644 --- a/tests/DrawOpAtlasTest.cpp +++ b/tests/DrawOpAtlasTest.cpp @@ -184,7 +184,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrAtlasTextOpPreparation, reporter, ctxInfo) rtc.get(), paint, SkMatrix::I(), text, 16, 16); - op->finalize(*context->caps(), nullptr, GrPixelConfigIsClamped::kNo); + op->finalize(*context->contextPriv().caps(), nullptr, GrPixelConfigIsClamped::kNo); TestingUploadTarget uploadTarget; diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index e3639fbce6..3e4ed5f5ce 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -300,8 +300,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma static const int NUM_TESTS = 1024; for (int t = 0; t < NUM_TESTS; t++) { // setup random render target(can fail) - sk_sp<GrRenderTargetContext> renderTargetContext(random_render_target_context( - context, &random, context->caps())); + sk_sp<GrRenderTargetContext> renderTargetContext( + random_render_target_context(context, &random, context->contextPriv().caps())); if (!renderTargetContext) { SkDebugf("Could not allocate renderTargetContext"); return false; diff --git a/tests/GrContextFactoryTest.cpp b/tests/GrContextFactoryTest.cpp index bebfd4d530..d98fe096a4 100644 --- a/tests/GrContextFactoryTest.cpp +++ b/tests/GrContextFactoryTest.cpp @@ -29,9 +29,8 @@ DEF_GPUTEST(GrContextFactory_NVPRContextOptionHasPathRenderingSupport, reporter, if (!context) { continue; } - REPORTER_ASSERT( - reporter, - context->caps()->shaderCaps()->pathRenderingSupport()); + REPORTER_ASSERT(reporter, + context->contextPriv().caps()->shaderCaps()->pathRenderingSupport()); } } @@ -44,9 +43,8 @@ DEF_GPUTEST(GrContextFactory_NoPathRenderingIfNVPRDisabled, reporter, options) { GrContext* context = testFactory.get(ctxType, GrContextFactory::ContextOverrides::kDisableNVPR); if (context) { - REPORTER_ASSERT( - reporter, - !context->caps()->shaderCaps()->pathRenderingSupport()); + REPORTER_ASSERT(reporter, + !context->contextPriv().caps()->shaderCaps()->pathRenderingSupport()); } } } @@ -63,11 +61,11 @@ DEF_GPUTEST(GrContextFactory_RequiredSRGBSupport, reporter, options) { testFactory.get(ctxType, GrContextFactory::ContextOverrides::kRequireSRGBSupport); if (context) { - REPORTER_ASSERT(reporter, context->caps()->srgbSupport()); + REPORTER_ASSERT(reporter, context->contextPriv().caps()->srgbSupport()); } else { context = testFactory.get(ctxType); if (context) { - REPORTER_ASSERT(reporter, !context->caps()->srgbSupport()); + REPORTER_ASSERT(reporter, !context->contextPriv().caps()->srgbSupport()); } } } diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp index 80788ddc07..5afe56291d 100644 --- a/tests/GrMeshTest.cpp +++ b/tests/GrMeshTest.cpp @@ -10,23 +10,24 @@ #if SK_SUPPORT_GPU +#include <array> +#include <vector> +#include "GrCaps.h" #include "GrContext.h" +#include "GrContextPriv.h" #include "GrGeometryProcessor.h" #include "GrGpuCommandBuffer.h" #include "GrOpFlushState.h" #include "GrRenderTargetContext.h" #include "GrRenderTargetContextPriv.h" -#include "GrResourceProvider.h" #include "GrResourceKey.h" +#include "GrResourceProvider.h" #include "SkBitmap.h" #include "SkMakeUnique.h" -#include "glsl/GrGLSLVertexGeoBuilder.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLVarying.h" -#include <array> -#include <vector> - +#include "glsl/GrGLSLVertexGeoBuilder.h" GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey); @@ -197,7 +198,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) { }); for (bool indexed : {false, true}) { - if (!context->caps()->instanceAttribSupport()) { + if (!context->contextPriv().caps()->instanceAttribSupport()) { break; } @@ -226,7 +227,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) { } switch (y % 3) { case 0: - if (context->caps()->shaderCaps()->vertexIDSupport()) { + if (context->contextPriv().caps()->shaderCaps()->vertexIDSupport()) { if (y % 2) { // We don't need this call because it's the initial state of GrMesh. mesh.setVertexData(nullptr); diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index 95604fa5a3..e356779044 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -34,7 +34,7 @@ static constexpr int kSize = 8; // SkImages and SkSurfaces DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - if (!context->caps()->mipMapSupport()) { + if (!context->contextPriv().caps()->mipMapSupport()) { return; } GrGpu* gpu = context->contextPriv().getGpu(); @@ -103,7 +103,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { // 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(); - if (!context->caps()->mipMapSupport()) { + if (!context->contextPriv().caps()->mipMapSupport()) { return; } GrGpu* gpu = context->contextPriv().getGpu(); @@ -229,7 +229,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, // resource we took the snapshot of. DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - if (!context->caps()->mipMapSupport()) { + if (!context->contextPriv().caps()->mipMapSupport()) { return; } diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 8a94084c0e..cceebbbf5f 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -1063,7 +1063,7 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) { GrGpu* gpu = ctx->contextPriv().getGpu(); GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); - const GrCaps& caps = *ctx->caps(); + const GrCaps& caps = *ctx->contextPriv().caps(); if (caps.shaderCaps()->dualSourceBlendingSupport()) { SK_ABORT("Null context failed to honor request for no ARB_blend_func_extended."); return; diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index c56b1eabbb..4323ed6045 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -74,7 +74,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider(); - const GrCaps* caps = context->caps(); + const GrCaps* caps = context->contextPriv().caps(); GrPixelConfig configs[] = { kUnknown_GrPixelConfig, @@ -157,12 +157,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) if (GrPixelConfigIsSRGB(desc.fConfig)) { colorSpace = SkColorSpace::MakeSRGB(); } - if (!context_info.grContext()->caps()->isConfigTexturable(desc.fConfig)) { + if (!context->contextPriv().caps()->isConfigTexturable(desc.fConfig)) { continue; } desc.fFlags = kPerformInitialClear_GrSurfaceFlag; for (bool rt : {false, true}) { - if (rt && !context->caps()->isConfigRenderable(desc.fConfig)) { + if (rt && !context->contextPriv().caps()->isConfigRenderable(desc.fConfig)) { continue; } desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp index 0aad960e7b..e3c7e35e74 100644 --- a/tests/ImageFilterTest.cpp +++ b/tests/ImageFilterTest.cpp @@ -43,7 +43,9 @@ #include "sk_tool_utils.h" #if SK_SUPPORT_GPU +#include "GrCaps.h" #include "GrContext.h" +#include "GrContextPriv.h" #endif static const int kBitmapSize = 4; @@ -1671,7 +1673,7 @@ static void test_large_blur_input(skiatest::Reporter* reporter, SkCanvas* canvas #if SK_SUPPORT_GPU // If we're GPU-backed make the bitmap too large to be converted into a texture. if (GrContext* ctx = canvas->getGrContext()) { - largeW = ctx->caps()->maxTextureSize() + 1; + largeW = ctx->contextPriv().caps()->maxTextureSize() + 1; } #endif diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index 679dc8add9..b69dd2e1b2 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -850,7 +850,7 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte // If we don't have proper support for this feature, the factory will fallback to returning // codec-backed images. Those will "work", but some of our checks will fail because we // expect the cross-context images not to work on multiple contexts at once. - if (!ctx->caps()->crossContextTextureSupport()) { + if (!ctx->contextPriv().caps()->crossContextTextureSupport()) { continue; } @@ -1026,7 +1026,7 @@ DEF_GPUTEST(SkImage_CrossContextGrayAlphaConfigs, reporter, options) { GrContextFactory::ContextType ctxType = static_cast<GrContextFactory::ContextType>(i); ContextInfo ctxInfo = testFactory.getContextInfo(ctxType); GrContext* ctx = ctxInfo.grContext(); - if (!ctx || !ctx->caps()->crossContextTextureSupport()) { + if (!ctx || !ctx->contextPriv().caps()->crossContextTextureSupport()) { continue; } @@ -1055,7 +1055,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(makeBackendTexture, reporter, ctxInfo) { testContext->makeCurrent(); REPORTER_ASSERT(reporter, proxy); auto createLarge = [context] { - return create_image_large(context->caps()->maxTextureSize()); + return create_image_large(context->contextPriv().caps()->maxTextureSize()); }; struct { std::function<sk_sp<SkImage> ()> fImageFactory; diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index b5f508bb7a..3a9ab8d461 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -12,6 +12,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" +#include "GrContextPriv.h" #include "GrGeometryProcessor.h" #include "GrGpu.h" #include "GrOpFlushState.h" @@ -123,7 +124,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { ERRORF(reporter, "Could not create render target context."); return; } - int attribCnt = context->caps()->maxVertexAttributes(); + int attribCnt = context->contextPriv().caps()->maxVertexAttributes(); if (!attribCnt) { ERRORF(reporter, "No attributes allowed?!"); return; diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index d4350595b7..9cb23ac5c3 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -172,7 +172,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { SkBackingFit::kApprox, 1, 1, kRGBA_8888_GrPixelConfig, nullptr)); { - bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport(); + bool texelBufferSupport = + context->contextPriv().caps()->shaderCaps()->texelBufferSupport(); sk_sp<GrTextureProxy> proxy1 = proxyProvider->createProxy( desc, kTopLeft_GrSurfaceOrigin, SkBackingFit::kExact, SkBudgeted::kYes); sk_sp<GrTextureProxy> proxy2 = proxyProvider->createProxy( diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 5721a41b6b..369cd1c7a6 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -108,7 +108,7 @@ static void check_texture(skiatest::Reporter* reporter, DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider(); GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider(); - const GrCaps& caps = *ctxInfo.grContext()->caps(); + const GrCaps& caps = *ctxInfo.grContext()->contextPriv().caps(); int attempt = 0; // useful for debugging @@ -198,7 +198,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { GrProxyProvider* proxyProvider = ctxInfo.grContext()->contextPriv().proxyProvider(); GrResourceProvider* resourceProvider = ctxInfo.grContext()->contextPriv().resourceProvider(); GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu(); - const GrCaps& caps = *ctxInfo.grContext()->caps(); + const GrCaps& caps = *ctxInfo.grContext()->contextPriv().caps(); static const int kWidthHeight = 100; diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index a0d67bb2e3..e4df621253 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -157,8 +157,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) { std::move(p1), std::move(p2), test.fExpectation); } - int k2 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(2, kRGBA); - int k4 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(4, kRGBA); + int k2 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(2, kRGBA); + int k4 = ctxInfo.grContext()->contextPriv().caps()->getRenderTargetSampleCount(4, kRGBA); //-------------------------------------------------------------------------------------------- TestCase gNonOverlappingTests[] = { diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 11dcdd43b6..857286ab6c 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -122,7 +122,7 @@ static sk_sp<GrRenderTarget> create_RT_with_SB(GrResourceProvider* provider, DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angle_es3, reporter, ctxInfo, nullptr) { GrContext* context = ctxInfo.grContext(); - if (context->caps()->avoidStencilBuffers()) { + if (context->contextPriv().caps()->avoidStencilBuffers()) { return; } @@ -155,7 +155,8 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get())); } - int smallSampleCount = context->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig); + int smallSampleCount = + context->contextPriv().caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig); if (smallSampleCount > 1) { // An RT with a different sample count should not share. sk_sp<GrRenderTarget> smallMSAART0 = create_RT_with_SB(resourceProvider, 4, @@ -183,8 +184,8 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl // But one with a larger sample count should not. (Also check that the two requests didn't // rounded up to the same actual sample count or else they could share.). - int bigSampleCount = - context->caps()->getRenderTargetSampleCount(5, kRGBA_8888_GrPixelConfig); + int bigSampleCount = context->contextPriv().caps()->getRenderTargetSampleCount( + 5, kRGBA_8888_GrPixelConfig); if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) { sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4, bigSampleCount, @@ -1766,8 +1767,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { size_t size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); - size_t sampleCount = - (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = (size_t)context->contextPriv().caps()->getRenderTargetSampleCount( + 4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); @@ -1785,15 +1786,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { // Mipmapped versions - if (context->caps()->mipMapSupport()) { + if (context->contextPriv().caps()->mipMapSupport()) { sk_sp<GrTextureProxy> proxy; proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1); size_t size = proxy->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); - size_t sampleCount = - (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = (size_t)context->contextPriv().caps()->getRenderTargetSampleCount( + 4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp index 7be4db68d7..2da7102658 100644 --- a/tests/SRGBMipMapTest.cpp +++ b/tests/SRGBMipMapTest.cpp @@ -80,7 +80,7 @@ void read_and_check_pixels(skiatest::Reporter* reporter, GrSurfaceContext* conte DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - if (!context->caps()->srgbSupport()) { + if (!context->contextPriv().caps()->srgbSupport()) { return; } diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index 569490cf7a..d090237b2d 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -258,16 +258,16 @@ static void test_write_read(Encoding contextEncoding, Encoding writeEncoding, En // are sRGB, linear, or untagged RGBA_8888. DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - if (!context->caps()->isConfigRenderable(kSRGBA_8888_GrPixelConfig) && - !context->caps()->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) { + if (!context->contextPriv().caps()->isConfigRenderable(kSRGBA_8888_GrPixelConfig) && + !context->contextPriv().caps()->isConfigTexturable(kSRGBA_8888_GrPixelConfig)) { return; } // We allow more error on GPUs with lower precision shader variables. - float error = context->caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f; + float error = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.5f : 1.2f; // For the all-sRGB case, we allow a small error only for devices that have // precision variation because the sRGB data gets converted to linear and back in // the shader. - float smallError = context->caps()->shaderCaps()->halfIs32Bits() ? 0.0f : 1.f; + float smallError = context->contextPriv().caps()->shaderCaps()->halfIs32Bits() ? 0.0f : 1.f; /////////////////////////////////////////////////////////////////////////////////////////////// // Write sRGB data to a sRGB context - no conversion on the write. diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index a9cd1c7b56..719a3afec6 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -239,7 +239,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) { // gpu - const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps()); + const GrSurfaceDesc desc = + GrImageInfoToSurfaceDesc(bm.info(), *context->contextPriv().caps()); sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy( desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes()); @@ -272,7 +273,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); SkBitmap bm = create_bm(); - const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps()); + const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->contextPriv().caps()); sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes()); diff --git a/tests/SpecialSurfaceTest.cpp b/tests/SpecialSurfaceTest.cpp index 40de08de85..3c6de0a1a1 100644 --- a/tests/SpecialSurfaceTest.cpp +++ b/tests/SpecialSurfaceTest.cpp @@ -12,7 +12,9 @@ #include "Test.h" #if SK_SUPPORT_GPU +#include "GrCaps.h" #include "GrContext.h" +#include "GrContextPriv.h" #include "SkGr.h" #endif @@ -81,7 +83,7 @@ DEF_TEST(SpecialSurface_Raster2, reporter) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) { for (auto config : { kRGBA_8888_GrPixelConfig, kRGBA_1010102_GrPixelConfig }) { - if (!ctxInfo.grContext()->caps()->isConfigRenderable(config)) { + if (!ctxInfo.grContext()->contextPriv().caps()->isConfigRenderable(config)) { continue; } sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(), diff --git a/tests/SurfaceSemaphoreTest.cpp b/tests/SurfaceSemaphoreTest.cpp index 980478bcef..b3a030e7c9 100644 --- a/tests/SurfaceSemaphoreTest.cpp +++ b/tests/SurfaceSemaphoreTest.cpp @@ -111,7 +111,7 @@ void surface_semaphore_test(skiatest::Reporter* reporter, const sk_gpu_test::ContextInfo& childInfo2, bool flushContext) { GrContext* mainCtx = mainInfo.grContext(); - if (!mainCtx->caps()->fenceSyncSupport()) { + if (!mainCtx->contextPriv().caps()->fenceSyncSupport()) { return; } @@ -213,7 +213,7 @@ DEF_GPUTEST(SurfaceSemaphores, reporter, options) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EmptySurfaceSemaphoreTest, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); - if (!ctx->caps()->fenceSyncSupport()) { + if (!ctx->contextPriv().caps()->fenceSyncSupport()) { return; } diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index e757230aa1..965298a816 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -148,7 +148,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report if (surf) { auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); int storedCnt = rtc->numStencilSamples(); - int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( + int allowedCnt = ctxInfo.grContext()->contextPriv().caps()->getSampleCount( storedCnt, rtc->asSurfaceProxy()->config()); REPORTER_ASSERT(reporter, storedCnt == allowedCnt, "Should store an allowed sample count (%d vs %d)", allowedCnt, @@ -164,7 +164,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, report if (surf) { auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); int storedCnt = rtc->numStencilSamples(); - int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( + int allowedCnt = ctxInfo.grContext()->contextPriv().caps()->getSampleCount( storedCnt, rtc->asSurfaceProxy()->config()); REPORTER_ASSERT(reporter, storedCnt == allowedCnt, "Should store an allowed sample count (%d vs %d)", allowedCnt, @@ -993,10 +993,11 @@ DEF_TEST(SurfaceCreationWithColorSpace, reporter) { #if SK_SUPPORT_GPU DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) { - GrContext* context = ctxInfo.grContext(); + auto context = ctxInfo.grContext(); - bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig); - bool supports1010102 = context->caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig); + bool f16Support = context->contextPriv().caps()->isConfigRenderable(kRGBA_half_GrPixelConfig); + bool supports1010102 = + context->contextPriv().caps()->isConfigRenderable(kRGBA_1010102_GrPixelConfig); auto surfaceMaker = [context](const SkImageInfo& info) { return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info); }; @@ -1009,7 +1010,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, GrGpu* gpu = context->contextPriv().getGpu(); static const int kSize = 10; - GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->caps()); + GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->contextPriv().caps()); SkASSERT(kUnknown_GrPixelConfig != config); GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index e17dfac14b..5ff2386b01 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -64,7 +64,7 @@ bool does_full_buffer_contain_correct_values(GrColor* srcBuffer, void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrColorType colorType, GrSurfaceOrigin origin, bool renderTarget) { - if (GrCaps::kNone_MapFlags == context->caps()->mapBufferFlags()) { + if (GrCaps::kNone_MapFlags == context->contextPriv().caps()->mapBufferFlags()) { return; } @@ -111,8 +111,8 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrCol continue; } - if (!context->caps()->isConfigTexturable(desc.fConfig) || - (renderTarget && !context->caps()->isConfigRenderable(desc.fConfig))) { + if (!context->contextPriv().caps()->isConfigTexturable(desc.fConfig) || + (renderTarget && !context->contextPriv().caps()->isConfigRenderable(desc.fConfig))) { continue; } diff --git a/tests/WindowRectanglesTest.cpp b/tests/WindowRectanglesTest.cpp index d6c4756168..ed4e4039ec 100644 --- a/tests/WindowRectanglesTest.cpp +++ b/tests/WindowRectanglesTest.cpp @@ -11,6 +11,7 @@ #if SK_SUPPORT_GPU #include "GrWindowRectangles.h" +#include "SkRandom.h" #include "SkRectPriv.h" static SkIRect next_irect(SkRandom& r) { |