diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-02 13:51:50 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-02 23:37:59 +0000 |
commit | 5bb82cbecd740d21b92e8d2944280ab6eb6af7a6 (patch) | |
tree | 8171a4ea5d7f72dbba276b58a89a7e115066f24c /tests | |
parent | 1e5ef4f81ca18cd9448426891cda5120cea51de8 (diff) |
Revert "Revert "Revert "Revert "Redefine the meaning of sample counts in GPU backend.""""
This reverts commit 18c52a7b52211de5d0dcd86dc048adef758c6c75.
Also relands "More sample count cleanup:" and "Add new GrContext queries for imagability, surfacability, and max sample count of color types"
Bug: skia:
Change-Id: I4028105a3a1f16ce3944e134619eb6245af6b947
Reviewed-on: https://skia-review.googlesource.com/102940
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BlendTest.cpp | 4 | ||||
-rw-r--r-- | tests/DeferredDisplayListTest.cpp | 9 | ||||
-rw-r--r-- | tests/DeviceTest.cpp | 2 | ||||
-rw-r--r-- | tests/EGLImageTest.cpp | 2 | ||||
-rw-r--r-- | tests/GLProgramsTest.cpp | 5 | ||||
-rw-r--r-- | tests/GpuDrawPathTest.cpp | 2 | ||||
-rw-r--r-- | tests/GpuSampleLocationsTest.cpp | 32 | ||||
-rw-r--r-- | tests/GrCCPRTest.cpp | 3 | ||||
-rw-r--r-- | tests/GrSurfaceTest.cpp | 28 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 24 | ||||
-rw-r--r-- | tests/LazyProxyTest.cpp | 3 | ||||
-rw-r--r-- | tests/PathRendererCacheTests.cpp | 4 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 19 | ||||
-rw-r--r-- | tests/ResourceAllocatorTest.cpp | 4 | ||||
-rw-r--r-- | tests/ResourceCacheTest.cpp | 40 | ||||
-rw-r--r-- | tests/SRGBReadWritePixelsTest.cpp | 2 | ||||
-rw-r--r-- | tests/SkpSkGrTest.cpp | 2 | ||||
-rw-r--r-- | tests/SurfaceTest.cpp | 137 | ||||
-rw-r--r-- | tests/TessellatingPathRendererTests.cpp | 9 | ||||
-rw-r--r-- | tests/TestConfigParsing.cpp | 10 | ||||
-rw-r--r-- | tests/TextureProxyTest.cpp | 2 | ||||
-rwxr-xr-x | tests/TransferPixelsTest.cpp | 2 | ||||
-rw-r--r-- | tests/VkClearTests.cpp | 4 | ||||
-rw-r--r-- | tests/VkUploadPixelsTests.cpp | 2 | ||||
-rw-r--r-- | tests/VkWrapTests.cpp | 20 | ||||
-rw-r--r-- | tests/WritePixelsTest.cpp | 6 |
26 files changed, 265 insertions, 112 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp index b17b9f1e45..3ac7e3c41c 100644 --- a/tests/BlendTest.cpp +++ b/tests/BlendTest.cpp @@ -140,7 +140,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) std::vector<TestCase> testCases; for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin}) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { for (auto rectAndPoints : allRectsAndPoints) { for (auto clip : {SkRect::MakeXYWH(0, 0, 10, 10), SkRect::MakeXYWH(1, 1, 8, 8)}) { testCases.push_back({rectAndPoints, clip, sampleCnt, origin}); @@ -162,7 +162,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ES2BlendWithNoTexture, reporter, ctxInfo) sk_sp<SkSurface> surface = create_gpu_surface_backend_texture_as_render_target( context, sampleCnt, kWidth, kHeight, kColorType, kConfig, origin, &backingSurface); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Some platforms don't support MSAA. continue; } diff --git a/tests/DeferredDisplayListTest.cpp b/tests/DeferredDisplayListTest.cpp index 049b97154c..b3637cbfa3 100644 --- a/tests/DeferredDisplayListTest.cpp +++ b/tests/DeferredDisplayListTest.cpp @@ -31,9 +31,8 @@ public: , fOrigin(kTopLeft_GrSurfaceOrigin) , fColorType(kRGBA_8888_SkColorType) , fColorSpace(SkColorSpace::MakeSRGB()) - , fSampleCount(0) - , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) { - } + , fSampleCount(1) + , fSurfaceProps(0x0, kUnknown_SkPixelGeometry) {} int sampleCount() const { return fSampleCount; } @@ -138,10 +137,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(SkSurfaceCharacterization, reporter, ctxInfo) { if (SurfaceParameters::kSampleCount == i) { SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(s.get()); - int supportedSampleCount = context->caps()->getSampleCount( + int supportedSampleCount = context->caps()->getRenderTargetSampleCount( params.sampleCount(), gpuSurf->getDevice()->accessRenderTargetContext()->asRenderTargetProxy()->config()); - if (0 == supportedSampleCount) { + if (1 == supportedSampleCount) { // If changing the sample count won't result in a different // surface characterization, skip this step continue; diff --git a/tests/DeviceTest.cpp b/tests/DeviceTest.cpp index 64b83fcb3c..58369cc149 100644 --- a/tests/DeviceTest.cpp +++ b/tests/DeviceTest.cpp @@ -81,7 +81,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_GPUDevice, reporter, ctxInfo) { SkImageInfo ii = SkImageInfo::MakeN32Premul(2*kWidth, 2*kHeight); sk_sp<SkBaseDevice> gpuDev(SkGpuDevice::Make(context, SkBudgeted::kNo, ii, - 0, kBottomLeft_GrSurfaceOrigin, nullptr, + 1, kBottomLeft_GrSurfaceOrigin, nullptr, GrMipMapped::kNo, SkGpuDevice::kClear_InitContents)); diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index dac78a89c0..b0631d0b3c 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -163,7 +163,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { { sk_sp<GrRenderTargetContext> temp = context0->contextPriv().makeBackendTextureRenderTargetContext( - backendTex, kBottomLeft_GrSurfaceOrigin, 0, nullptr); + backendTex, kBottomLeft_GrSurfaceOrigin, 1, nullptr); if (temp) { ERRORF(reporter, "Should not be able to wrap an EXTERNAL texture as a RT."); } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 6c2e8d2f04..f625a771bf 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -150,7 +150,10 @@ static sk_sp<GrRenderTargetContext> random_render_target_context(GrContext* cont const GrCaps* caps) { GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin; - int sampleCnt = random->nextBool() ? caps->getSampleCount(4, kRGBA_8888_GrPixelConfig) : 0; + int sampleCnt = + random->nextBool() ? caps->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig) : 1; + // Above could be 0 if msaa isn't supported. + sampleCnt = SkTMax(1, sampleCnt); sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext( SkBackingFit::kExact, diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp index 012dc61cb8..79afa63f2d 100644 --- a/tests/GpuDrawPathTest.cpp +++ b/tests/GpuDrawPathTest.cpp @@ -78,7 +78,7 @@ static void test_drawSameRectOvals(skiatest::Reporter*, SkCanvas* canvas) { DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(GpuDrawPath, reporter, ctxInfo) { for (auto& test_func : { &test_drawPathEmpty, &test_drawSameRectOvals }) { - for (auto& sampleCount : {0, 4, 16}) { + for (auto& sampleCount : {1, 4, 16}) { SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255); auto surface( SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, info, diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp index de15e03389..56764cfc9b 100644 --- a/tests/GpuSampleLocationsTest.cpp +++ b/tests/GpuSampleLocationsTest.cpp @@ -109,22 +109,36 @@ void assert_equal(skiatest::Reporter* reporter, const SamplePattern& pattern, } } +static int pick_random_sample_count(int testPatternSize, SkRandom* rand, const GrCaps* caps) { + GrAlwaysAssert(testPatternSize > 1 && SkIsPow2(testPatternSize)); + int randSampCnt = rand->nextRangeU(1 + testPatternSize / 2, testPatternSize); + do { + int cnt = caps->getRenderTargetSampleCount(randSampCnt, kRGBA_8888_GrPixelConfig); + if (cnt) { + return cnt; + } + --randSampCnt; + } while (randSampCnt); + // This test assumes an MSAA kRGBA_8888 RTC can be created. + GrAlwaysAssert(false); + return 0; +} + void test_sampleLocations(skiatest::Reporter* reporter, TestSampleLocationsInterface* testInterface, GrContext* ctx) { SkRandom rand; sk_sp<GrRenderTargetContext> bottomUps[numTestPatterns]; sk_sp<GrRenderTargetContext> topDowns[numTestPatterns]; for (int i = 0; i < numTestPatterns; ++i) { - int numSamples = (int)kTestPatterns[i].size(); - GrAlwaysAssert(numSamples > 1 && SkIsPow2(numSamples)); + int patternSize = (int)kTestPatterns[i].size(); + int randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); bottomUps[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, - rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, - kBottomLeft_GrSurfaceOrigin); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, + GrMipMapped::kNo, kBottomLeft_GrSurfaceOrigin); + randNumSamples = pick_random_sample_count(patternSize, &rand, ctx->caps()); topDowns[i] = ctx->makeDeferredRenderTargetContext( - SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, - rand.nextRangeU(1 + numSamples / 2, numSamples), GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin); + SkBackingFit::kExact, 100, 100, kRGBA_8888_GrPixelConfig, nullptr, randNumSamples, + GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin); } // Ensure all sample locations get queried and/or cached properly. @@ -189,7 +203,7 @@ DEF_GPUTEST(GLSampleLocations, reporter, /* options */) { sk_sp<GrContext> ctx(GrContext::MakeGL(testInterface)); // This test relies on at least 2 samples. - int supportedSample = ctx->caps()->getSampleCount(2, kRGBA_8888_GrPixelConfig); + int supportedSample = ctx->caps()->getRenderTargetSampleCount(2, kRGBA_8888_GrPixelConfig); if (supportedSample < 2) { return; } diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp index 9f770d6b50..cba94b4bf5 100644 --- a/tests/GrCCPRTest.cpp +++ b/tests/GrCCPRTest.cpp @@ -119,7 +119,8 @@ public: GrMockOptions mockOptions; mockOptions.fInstanceAttribSupport = true; mockOptions.fMapBufferFlags = GrCaps::kCanMap_MapFlag; - mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true; + mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability = + GrMockOptions::ConfigOptions::Renderability::kNonMSAA; mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true; mockOptions.fGeometryShaderSupport = true; mockOptions.fIntegerSupport = true; diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp index 3e246ccd93..32ac0c71e6 100644 --- a/tests/GrSurfaceTest.cpp +++ b/tests/GrSurfaceTest.cpp @@ -33,7 +33,7 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { desc.fWidth = 256; desc.fHeight = 256; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurface> texRT1 = resourceProvider->createTexture(desc, SkBudgeted::kNo); REPORTER_ASSERT(reporter, texRT1.get() == texRT1->asRenderTarget()); @@ -55,8 +55,8 @@ DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, 256, 256, kRGBA_8888_GrPixelConfig, false, GrMipMapped::kNo); - sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture( - backendTex, 0, kBorrow_GrWrapOwnership); + sk_sp<GrSurface> texRT2 = + resourceProvider->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget()); REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture()); @@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { desc.fFlags = kNone_GrSurfaceFlags; desc.fOrigin = origin; desc.fConfig = config; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); bool ict = caps->isConfigTexturable(desc.fConfig); @@ -143,17 +143,17 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) { desc.fFlags = kRenderTarget_GrSurfaceFlag; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); - bool icr = caps->isConfigRenderable(config, false); - REPORTER_ASSERT(reporter, SkToBool(tex) == icr, - "config:%d, tex:%d, isConfigRenderable(false):%d", config, - SkToBool(tex), icr); + bool isRenderable = caps->isConfigRenderable(config); + REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable, + "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex), + isRenderable); - desc.fSampleCnt = 4; + desc.fSampleCnt = 2; tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); - icr = caps->isConfigRenderable(config, true); - REPORTER_ASSERT(reporter, SkToBool(tex) == icr, - "config:%d, tex:%d, isConfigRenderable(true):%d", config, SkToBool(tex), - icr); + isRenderable = SkToBool(caps->getRenderTargetSampleCount(2, config)); + REPORTER_ASSERT(reporter, SkToBool(tex) == isRenderable, + "config:%d, tex:%d, isRenderable:%d", config, SkToBool(tex), + isRenderable); } } } @@ -178,7 +178,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info) } desc.fFlags = kPerformInitialClear_GrSurfaceFlag; for (bool rt : {false, true}) { - if (rt && !context->caps()->isConfigRenderable(desc.fConfig, false)) { + if (rt && !context->caps()->isConfigRenderable(desc.fConfig)) { continue; } desc.fFlags |= rt ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags; diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index a1472d42dd..9a89000748 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -38,6 +38,7 @@ #include "GrResourceCache.h" #include "GrTest.h" #include "GrTexture.h" +#include "SkGr.h" #endif using namespace sk_gpu_test; @@ -486,6 +487,29 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SkImage_drawAbandonedGpuImage, reporter, c surface->getCanvas()->drawImage(image, 0, 0); } +DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsImage, reporter, ctxInfo) { + for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { + static constexpr int kSize = 10; + SkColorType colorType = static_cast<SkColorType>(ct); + bool can = ctxInfo.grContext()->colorTypeSupportedAsImage(colorType); + auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( + nullptr, kSize, kSize, colorType, false, GrMipMapped::kNo); + auto img = + SkImage::MakeFromTexture(ctxInfo.grContext(), backendTex, kTopLeft_GrSurfaceOrigin, + colorType, kOpaque_SkAlphaType, nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(img), + "%d, colorTypeSupportedAsImage:%d, actual:%d, ct:%d", can, SkToBool(img), + colorType); + + img.reset(); + ctxInfo.grContext()->flush(); + if (backendTex.isValid()) { + gpu->deleteTestingOnlyBackendTexture(&backendTex); + } + } +} + #endif class EmptyGenerator : public SkImageGenerator { diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index f1bffa527b..5c0532701d 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -179,7 +179,8 @@ private: DEF_GPUTEST(LazyProxyTest, reporter, /* options */) { GrMockOptions mockOptions; - mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderable[0] = true; + mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fRenderability = + GrMockOptions::ConfigOptions::Renderability::kNonMSAA; mockOptions.fConfigOptions[kAlpha_half_GrPixelConfig].fTexturable = true; sk_sp<GrContext> ctx = GrContext::MakeMock(&mockOptions, GrContextOptions()); GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); diff --git a/tests/PathRendererCacheTests.cpp b/tests/PathRendererCacheTests.cpp index 15b1faa4ba..19197b0d5f 100644 --- a/tests/PathRendererCacheTests.cpp +++ b/tests/PathRendererCacheTests.cpp @@ -80,8 +80,8 @@ static void test_path(skiatest::Reporter* reporter, GrResourceCache* cache = ctx->contextPriv().getResourceCache(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( - SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 0, - GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 1, GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index 0636ed4ce4..dff230c9bb 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -118,7 +118,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { kRGBA_8888_GrPixelConfig }) { for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { - for (auto numSamples : { 0, 4, 16, 128 }) { + for (auto numSamples : {1, 4, 16, 128}) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fOrigin = origin; @@ -149,7 +149,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) { check_surface(reporter, proxy.get(), origin, widthHeight, widthHeight, config, budgeted); - int supportedSamples = caps.getSampleCount(numSamples, config); + int supportedSamples = + caps.getRenderTargetSampleCount(numSamples, config); check_rendertarget(reporter, caps, resourceProvider, proxy->asRenderTargetProxy(), supportedSamples, @@ -204,10 +205,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin }) { for (auto config : { kAlpha_8_GrPixelConfig, kRGBA_8888_GrPixelConfig }) { for (auto budgeted : { SkBudgeted::kYes, SkBudgeted::kNo }) { - for (auto numSamples: { 0, 4}) { - int supportedNumSamples = caps.getSampleCount(numSamples, config); - - bool renderable = caps.isConfigRenderable(config, numSamples > 0); + for (auto numSamples : {1, 4}) { + int supportedNumSamples = caps.getRenderTargetSampleCount(numSamples, config); GrSurfaceDesc desc; desc.fOrigin = origin; @@ -217,7 +216,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { desc.fSampleCnt = supportedNumSamples; // External on-screen render target. - if (renderable && kOpenGL_GrBackend == ctxInfo.backend()) { + if (supportedNumSamples && kOpenGL_GrBackend == ctxInfo.backend()) { GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8, @@ -232,7 +231,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { supportedNumSamples, SkBackingFit::kExact, 0, true); } - if (renderable) { + if (supportedNumSamples) { // Internal offscreen render target. desc.fFlags = kRenderTarget_GrSurfaceFlag; @@ -251,7 +250,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { } else { // Internal offscreen texture SkASSERT(kNone_GrSurfaceFlags == desc.fFlags ); - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrSurfaceProxy> sProxy = proxyProvider->createInstantiatedProxy( desc, SkBackingFit::kExact, budgeted); @@ -287,7 +286,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ZeroSizedProxyTest, reporter, ctxInfo) { desc.fWidth = width; desc.fHeight = height; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTextureProxy> proxy = provider->createProxy(desc, fit, SkBudgeted::kNo); REPORTER_ASSERT(reporter, !proxy); diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index 7dcb0ee942..173696be2b 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -148,8 +148,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ResourceAllocatorTest, reporter, ctxInfo) { std::move(p1), std::move(p2), test.fExpectation); } - int k2 = ctxInfo.grContext()->caps()->getSampleCount(2, kRGBA); - int k4 = ctxInfo.grContext()->caps()->getSampleCount(4, kRGBA); + int k2 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(2, kRGBA); + int k4 = ctxInfo.grContext()->caps()->getRenderTargetSampleCount(4, kRGBA); //-------------------------------------------------------------------------------------------- TestCase gNonOverlappingTests[] = { diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index 34ed4f7328..3bd6c4b4e3 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -129,21 +129,20 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider(); - sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kYes); + sk_sp<GrRenderTarget> smallRT0 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kYes); REPORTER_ASSERT(reporter, smallRT0); { // Two budgeted RTs with the same desc should share a stencil buffer. - sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 0, - SkBudgeted::kYes); - REPORTER_ASSERT(reporter, smallRT1); + sk_sp<GrRenderTarget> smallRT1 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kYes); + REPORTER_ASSERT(reporter, smallRT1); - REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get())); + REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT1.get())); } { // An unbudgeted RT with the same desc should also share. - sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 0, SkBudgeted::kNo); + sk_sp<GrRenderTarget> smallRT2 = create_RT_with_SB(resourceProvider, 4, 1, SkBudgeted::kNo); REPORTER_ASSERT(reporter, smallRT2); REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) == get_SB(smallRT2.get())); @@ -151,14 +150,14 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl { // An RT with a much larger size should not share. - sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 0, SkBudgeted::kNo); + sk_sp<GrRenderTarget> bigRT = create_RT_with_SB(resourceProvider, 400, 1, SkBudgeted::kNo); REPORTER_ASSERT(reporter, bigRT); REPORTER_ASSERT(reporter, get_SB(smallRT0.get()) != get_SB(bigRT.get())); } - int smallSampleCount = context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig); - if (smallSampleCount > 0) { + int smallSampleCount = context->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, smallSampleCount, SkBudgeted::kNo); @@ -183,10 +182,11 @@ DEF_GPUTEST_FOR_CONTEXTS(ResourceCacheStencilBuffers, &is_rendering_and_not_angl REPORTER_ASSERT(reporter, get_SB(smallMSAART0.get()) == get_SB(smallMSAART1.get())); } - // But not one with a larger sample count should not. (Also check that the request for 4 - // samples didn't get rounded up to >= 8 or else they could share.). - int bigSampleCount = context->caps()->getSampleCount(8, kRGBA_8888_GrPixelConfig); - if (bigSampleCount != smallSampleCount) { + // 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); + if (bigSampleCount > 0 && bigSampleCount != smallSampleCount) { sk_sp<GrRenderTarget> smallMSAART2 = create_RT_with_SB(resourceProvider, 4, bigSampleCount, SkBudgeted::kNo); @@ -1707,11 +1707,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { { sk_sp<GrTexture> tex; - tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0); + tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 1); size_t size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); - size_t sampleCount = (size_t)context->caps()->getSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = + (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { tex = make_normal_texture(resourceProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); @@ -1722,7 +1723,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { kSize*kSize*4*(sampleCount+1) == size); // explicit resolve buffer } - tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 0); + tex = make_normal_texture(resourceProvider, kNone_GrSurfaceFlags, kSize, kSize, 1); size = tex->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4 == size); } @@ -1732,11 +1733,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { if (context->caps()->mipMapSupport()) { sk_sp<GrTextureProxy> proxy; - proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, 0); + 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()->getSampleCount(4, kRGBA_8888_GrPixelConfig); + size_t sampleCount = + (size_t)context->caps()->getRenderTargetSampleCount(4, kRGBA_8888_GrPixelConfig); if (sampleCount >= 4) { proxy = make_mipmap_proxy(proxyProvider, kRenderTarget_GrSurfaceFlag, kSize, kSize, sampleCount); @@ -1747,7 +1749,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GPUMemorySize, reporter, ctxInfo) { kSize*kSize*4*(sampleCount+1)+(kSize*kSize*4)/3 == size); // explicit resolve buffer } - proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 0); + proxy = make_mipmap_proxy(proxyProvider, kNone_GrSurfaceFlags, kSize, kSize, 1); size = proxy->gpuMemorySize(); REPORTER_ASSERT(reporter, kSize*kSize*4+(kSize*kSize*4)/3 == size); } diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index 7013971b62..bb7b77c5b9 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -172,7 +172,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SRGBReadWritePixels, reporter, ctxInfo) { desc.fWidth = kW; desc.fHeight = kH; desc.fConfig = kSRGBA_8888_GrPixelConfig; - if (context->caps()->isConfigRenderable(desc.fConfig, false) && + if (context->caps()->isConfigRenderable(desc.fConfig) && context->caps()->isConfigTexturable(desc.fConfig)) { sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeDeferredSurfaceContext( diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index 24d1b9cc3a..898faf08a7 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -442,7 +442,7 @@ void TestResult::testOne() { desc.fFlags = kRenderTarget_GrTextureFlagBit; desc.fWidth = dim.fX; desc.fHeight = dim.fY; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTexture> texture(context->createUncachedTexture(desc, nullptr, 0)); if (!texture) { SkDebugf("unable to allocate texture for %s (w=%d h=%d)\n", fFilename, diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index 471953b373..de1cd9a984 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -19,13 +19,17 @@ #include "Test.h" #if SK_SUPPORT_GPU +#include <vector> #include "GrContext.h" #include "GrContextPriv.h" -#include "GrRenderTargetContext.h" #include "GrGpu.h" +#include "GrGpuResourcePriv.h" +#include "GrRenderTargetContext.h" #include "GrResourceProvider.h" #include "GrTest.h" -#include <vector> +#include "SkGpuDevice.h" +#include "SkImage_Gpu.h" +#include "SkSurface_Gpu.h" #endif #include <initializer_list> @@ -88,6 +92,121 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, ctxInfo) { } #endif +#if SK_SUPPORT_GPU +DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_colorTypeSupportedAsSurface, reporter, ctxInfo) { + for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { + static constexpr int kSize = 10; + + SkColorType colorType = static_cast<SkColorType>(ct); + auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr); + bool can = ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType); + auto surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, 1, + nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", + colorType, can, SkToBool(surf)); + + auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( + nullptr, kSize, kSize, colorType, true, GrMipMapped::kNo); + surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, + kTopLeft_GrSurfaceOrigin, 0, colorType, nullptr, + nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", + colorType, can, SkToBool(surf)); + + surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex, + kTopLeft_GrSurfaceOrigin, 1, + colorType, nullptr, nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", + colorType, can, SkToBool(surf)); + + surf.reset(); + ctxInfo.grContext()->flush(); + if (backendTex.isValid()) { + gpu->deleteTestingOnlyBackendTexture(&backendTex); + } + + static constexpr int kSampleCnt = 2; + + can = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType) >= kSampleCnt; + surf = SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kYes, info, kSampleCnt, + nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", + colorType, can, SkToBool(surf)); + + backendTex = gpu->createTestingOnlyBackendTexture(nullptr, kSize, kSize, colorType, true, + GrMipMapped::kNo); + surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, + kTopLeft_GrSurfaceOrigin, kSampleCnt, colorType, + nullptr, nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), + "colorTypeSupportedAsSurface:%d, surf:%d, ct:%d", can, SkToBool(surf), + colorType); + // Ensure that the sample count stored on the resulting SkSurface is a valid value. + if (surf) { + auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); + int storedCnt = rtc->numStencilSamples(); + int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( + storedCnt, rtc->asSurfaceProxy()->config()); + REPORTER_ASSERT(reporter, storedCnt == allowedCnt, + "Should store an allowed sample count (%d vs %d)", allowedCnt, + storedCnt); + } + + surf = SkSurface::MakeFromBackendTextureAsRenderTarget(ctxInfo.grContext(), backendTex, + kTopLeft_GrSurfaceOrigin, kSampleCnt, + colorType, nullptr, nullptr); + REPORTER_ASSERT(reporter, can == SkToBool(surf), + "colorTypeSupportedAsSurface:%d, surf:%d, ct:%d", can, SkToBool(surf), + colorType); + if (surf) { + auto* rtc = ((SkSurface_Gpu*)(surf.get()))->getDevice()->accessRenderTargetContext(); + int storedCnt = rtc->numStencilSamples(); + int allowedCnt = ctxInfo.grContext()->caps()->getSampleCount( + storedCnt, rtc->asSurfaceProxy()->config()); + REPORTER_ASSERT(reporter, storedCnt == allowedCnt, + "Should store an allowed sample count (%d vs %d)", allowedCnt, + storedCnt); + } + + surf.reset(); + ctxInfo.grContext()->flush(); + if (backendTex.isValid()) { + gpu->deleteTestingOnlyBackendTexture(&backendTex); + } + } +} + +DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrContext_maxSurfaceSamplesForColorType, reporter, ctxInfo) { + for (int ct = 0; ct < kLastEnum_SkColorType; ++ct) { + static constexpr int kSize = 10; + + SkColorType colorType = static_cast<SkColorType>(ct); + int max = ctxInfo.grContext()->maxSurfaceSampleCountForColorType(colorType); + if (!max) { + continue; + } + auto* gpu = ctxInfo.grContext()->contextPriv().getGpu(); + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( + nullptr, kSize, kSize, colorType, true, GrMipMapped::kNo); + + auto info = SkImageInfo::Make(kSize, kSize, colorType, kOpaque_SkAlphaType, nullptr); + auto surf = SkSurface::MakeFromBackendTexture(ctxInfo.grContext(), backendTex, + kTopLeft_GrSurfaceOrigin, max, + colorType, nullptr, nullptr); + REPORTER_ASSERT(reporter, surf); + if (!surf) { + continue; + } + int sampleCnt = ((SkSurface_Gpu*)(surf.get())) + ->getDevice() + ->accessRenderTargetContext() + ->numStencilSamples(); + REPORTER_ASSERT(reporter, sampleCnt == max, "Exected: %d, actual: %d", max, sampleCnt); + } +} +#endif + static void test_canvas_peek(skiatest::Reporter* reporter, sk_sp<SkSurface>& surface, const SkImageInfo& requestInfo, @@ -437,10 +556,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, ctxInfo) { #endif #if SK_SUPPORT_GPU -#include "GrGpuResourcePriv.h" -#include "SkGpuDevice.h" -#include "SkImage_Gpu.h" -#include "SkSurface_Gpu.h" static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) { SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get(); @@ -704,7 +819,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) { for (auto& surfaceFunc : {&create_gpu_surface_backend_texture, &create_gpu_surface_backend_texture_as_render_target}) { GrBackendTexture backendTex; - auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex); + auto surface = surfaceFunc(context, 1, kOrigColor, &backendTex); test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor); surface.reset(); gpu->deleteTestingOnlyBackendTexture(&backendTex); @@ -767,7 +882,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) { // preserved in pixels that aren't rendered to via the surface. // This works only for non-multisampled case. GrBackendTexture backendTex; - auto surface = surfaceFunc(ctxInfo.grContext(), 0, kOrigColor, &backendTex); + auto surface = surfaceFunc(ctxInfo.grContext(), 1, kOrigColor, &backendTex); if (surface) { test_surface_draw_partially(reporter, surface, kOrigColor); surface.reset(); @@ -791,11 +906,11 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInf for (auto& surfaceFunc : {&create_gpu_surface_backend_texture, &create_gpu_surface_backend_texture_as_render_target}) { - for (int sampleCnt : {0, 4, 8}) { + for (int sampleCnt : {1, 4, 8}) { GrBackendTexture backendTex; auto surface = surfaceFunc(ctxInfo.grContext(), sampleCnt, kOrigColor, &backendTex); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Certain platforms don't support MSAA, skip these. continue; } @@ -880,7 +995,7 @@ DEF_TEST(SurfaceCreationWithColorSpace, reporter) { DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false); + bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig); auto surfaceMaker = [context](const SkImageInfo& info) { return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info); }; diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 1eb055f53a..e24bf7a516 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -486,13 +486,8 @@ static void test_path(GrContext* ctx, DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { GrContext* ctx = ctxInfo.grContext(); sk_sp<GrRenderTargetContext> rtc(ctx->makeDeferredRenderTargetContext( - SkBackingFit::kApprox, - 800, 800, - kRGBA_8888_GrPixelConfig, - nullptr, - 0, - GrMipMapped::kNo, - kTopLeft_GrSurfaceOrigin)); + SkBackingFit::kApprox, 800, 800, kRGBA_8888_GrPixelConfig, nullptr, 1, GrMipMapped::kNo, + kTopLeft_GrSurfaceOrigin)); if (!rtc) { return; } diff --git a/tests/TestConfigParsing.cpp b/tests/TestConfigParsing.cpp index aa95ff7687..7e90730bfe 100644 --- a/tests/TestConfigParsing.cpp +++ b/tests/TestConfigParsing.cpp @@ -45,7 +45,7 @@ DEF_TEST(ParseConfigs_Gpu, reporter) { == GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false); - REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); + REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kRGBA_8888_SkColorType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == nullptr); #endif @@ -240,7 +240,7 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); + REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 1); REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() == GrContextFactory::kANGLE_D3D9_ES2_ContextType); REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()); @@ -254,18 +254,18 @@ DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { GrContextFactory::kGLES_ContextType); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); + REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 1); REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == GrContextFactory::kGL_ContextType); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); + REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 1); #ifdef SK_VULKAN REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == GrContextFactory::kVulkan_ContextType); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); - REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); + REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 1); #endif #ifdef SK_METAL REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getContextType() == diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index d422b076ad..059113033a 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -34,7 +34,7 @@ static GrSurfaceDesc make_desc(GrSurfaceFlags flags) { desc.fWidth = 64; desc.fHeight = 64; desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; return desc; } diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp index ce8d1edc4f..8f71528da6 100755 --- a/tests/TransferPixelsTest.cpp +++ b/tests/TransferPixelsTest.cpp @@ -104,7 +104,7 @@ void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPix desc.fWidth = kTextureWidth; desc.fHeight = kTextureHeight; desc.fConfig = config; - desc.fSampleCnt = 0; + desc.fSampleCnt = 1; sk_sp<GrTexture> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo); ////////////////////////// diff --git a/tests/VkClearTests.cpp b/tests/VkClearTests.cpp index c797ef2c33..0dcb446ee5 100644 --- a/tests/VkClearTests.cpp +++ b/tests/VkClearTests.cpp @@ -58,7 +58,7 @@ void basic_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelC surfDesc.fWidth = 5; surfDesc.fHeight = 5; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); @@ -114,7 +114,7 @@ void sub_clear_test(skiatest::Reporter* reporter, GrContext* context, GrPixelCon surfDesc.fWidth = width; surfDesc.fHeight = height; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo); SkASSERT(tex); SkASSERT(tex->asRenderTarget()); diff --git a/tests/VkUploadPixelsTests.cpp b/tests/VkUploadPixelsTests.cpp index 3b3fecae7f..f35480a6ce 100644 --- a/tests/VkUploadPixelsTests.cpp +++ b/tests/VkUploadPixelsTests.cpp @@ -69,7 +69,7 @@ void basic_texture_test(skiatest::Reporter* reporter, GrContext* context, GrPixe surfDesc.fWidth = kWidth; surfDesc.fHeight = kHeight; surfDesc.fConfig = config; - surfDesc.fSampleCnt = 0; + surfDesc.fSampleCnt = 1; SkColorType ct; SkAssertResult(GrPixelConfigToColorType(config, &ct)); diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp index 6cfbba65b6..9723d5763b 100644 --- a/tests/VkWrapTests.cpp +++ b/tests/VkWrapTests.cpp @@ -83,7 +83,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrMipMapped::kNo); const GrVkImageInfo* imageInfo = origBackendTex.getVkImageInfo(); - GrBackendRenderTarget origBackendRT(kW, kH, 0, 0, *imageInfo); + GrBackendRenderTarget origBackendRT(kW, kH, 1, 0, *imageInfo); sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(origBackendRT); REPORTER_ASSERT(reporter, rt); @@ -92,7 +92,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; - GrBackendRenderTarget backendRT(kW, kH, 0, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, !rt); } @@ -102,7 +102,7 @@ void wrap_rt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; // can wrap null alloc - GrBackendRenderTarget backendRT(kW, kH, 0, 0, backendCopy); + GrBackendRenderTarget backendRT(kW, kH, 1, 0, backendCopy); rt = gpu->wrapBackendRenderTarget(backendRT); REPORTER_ASSERT(reporter, rt); } @@ -120,8 +120,8 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrMipMapped::kNo); const GrVkImageInfo* imageInfo = origBackendTex.getVkImageInfo(); - sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(origBackendTex, 0, - kBorrow_GrWrapOwnership); + sk_sp<GrTexture> tex = + gpu->wrapRenderableBackendTexture(origBackendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); // image is null @@ -129,9 +129,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fImage = VK_NULL_HANDLE; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); } @@ -140,9 +140,9 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { GrVkImageInfo backendCopy = *imageInfo; backendCopy.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 }; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kBorrow_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, !tex); } @@ -150,7 +150,7 @@ void wrap_trt_test(skiatest::Reporter* reporter, GrContext* context) { { GrVkImageInfo backendCopy = *imageInfo; GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy); - tex = gpu->wrapRenderableBackendTexture(backendTex, 0, kAdopt_GrWrapOwnership); + tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership); REPORTER_ASSERT(reporter, tex); } diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp index a16752f229..2a2ee397ef 100644 --- a/tests/WritePixelsTest.cpp +++ b/tests/WritePixelsTest.cpp @@ -412,11 +412,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) { const SkImageInfo ii = SkImageInfo::MakeN32Premul(DEV_W, DEV_H); for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctxInfo.grContext(), SkBudgeted::kNo, ii, sampleCnt, origin, nullptr)); - if (!surface && sampleCnt > 0) { + if (!surface && sampleCnt > 1) { // Some platforms don't support MSAA continue; } @@ -430,7 +430,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixelsNonTexture_Gpu, reporter, ctxInfo) GrGpu* gpu = context->contextPriv().getGpu(); for (auto& origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) { - for (int sampleCnt : {0, 4}) { + for (int sampleCnt : {1, 4}) { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, DEV_W, DEV_H, kSkia8888_GrPixelConfig, true, GrMipMapped::kNo); SkColorType colorType; |