diff options
author | egdaniel <egdaniel@google.com> | 2015-09-14 12:56:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-14 12:56:10 -0700 |
commit | ec00d94199fad7723b5987b86c1abef8ddafe2d8 (patch) | |
tree | 4161bb293ffe433cbe0fd41a4ad0263b36eedffd /tests | |
parent | 37497dc9de9cf8df4f9dd972b50cbd35b9da6682 (diff) |
Move some of the adding stencil attachment logic of Gpu and into Render Target.
The new flow of calls for attaching a Stencil looks like:
Client
rt->attachStencilAttachment()
gpu->getStencilAttachment()
glgpu->createStencilAttachment()
glrt->completeStencilAttachment() //actually attaches
BUG=skia:
Review URL: https://codereview.chromium.org/1333383002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ResourceCacheTest.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp index d76da31920..6370b92490 100644 --- a/tests/ResourceCacheTest.cpp +++ b/tests/ResourceCacheTest.cpp @@ -78,33 +78,34 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex smallDesc.fSampleCnt = 0; GrTextureProvider* cache = context->textureProvider(); + GrResourceProvider* resourceProvider = context->resourceProvider(); // Test that two budgeted RTs with the same desc share a stencil buffer. SkAutoTUnref<GrTexture> smallRT0(cache->createTexture(smallDesc, true)); if (smallRT0 && smallRT0->asRenderTarget()) { - smallRT0->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()); } SkAutoTUnref<GrTexture> smallRT1(cache->createTexture(smallDesc, true)); if (smallRT1 && smallRT1->asRenderTarget()) { - smallRT1->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget()); } REPORTER_ASSERT(reporter, smallRT0 && smallRT1 && smallRT0->asRenderTarget() && smallRT1->asRenderTarget() && - smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() == - smallRT1->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) == + resourceProvider->attachStencilAttachment(smallRT1->asRenderTarget())); // An unbudgeted RT with the same desc should also share. SkAutoTUnref<GrTexture> smallRT2(cache->createTexture(smallDesc, false)); if (smallRT2 && smallRT2->asRenderTarget()) { - smallRT2->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget()); } REPORTER_ASSERT(reporter, smallRT0 && smallRT2 && smallRT0->asRenderTarget() && smallRT2->asRenderTarget() && - smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() == - smallRT2->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) == + resourceProvider->attachStencilAttachment(smallRT2->asRenderTarget())); // An RT with a much larger size should not share. GrSurfaceDesc bigDesc; @@ -115,13 +116,13 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex bigDesc.fSampleCnt = 0; SkAutoTUnref<GrTexture> bigRT(cache->createTexture(bigDesc, false)); if (bigRT && bigRT->asRenderTarget()) { - bigRT->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(bigRT->asRenderTarget()); } REPORTER_ASSERT(reporter, smallRT0 && bigRT && smallRT0->asRenderTarget() && bigRT->asRenderTarget() && - smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() != - bigRT->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) != + resourceProvider->attachStencilAttachment(bigRT->asRenderTarget())); if (context->caps()->maxSampleCount() >= 4) { // An RT with a different sample count should not share. @@ -129,7 +130,7 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex smallMSAADesc.fSampleCnt = 4; SkAutoTUnref<GrTexture> smallMSAART0(cache->createTexture(smallMSAADesc, false)); if (smallMSAART0 && smallMSAART0->asRenderTarget()) { - smallMSAART0->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()); } #ifdef SK_BUILD_FOR_ANDROID if (!smallMSAART0) { @@ -140,19 +141,19 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex REPORTER_ASSERT(reporter, smallRT0 && smallMSAART0 && smallRT0->asRenderTarget() && smallMSAART0->asRenderTarget() && - smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() != - smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallRT0->asRenderTarget()) != + resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget())); // A second MSAA RT should share with the first MSAA RT. SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false)); if (smallMSAART1 && smallMSAART1->asRenderTarget()) { - smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget()); } REPORTER_ASSERT(reporter, smallMSAART0 && smallMSAART1 && smallMSAART0->asRenderTarget() && smallMSAART1->asRenderTarget() && - smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment() == - smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()) == + resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget())); // 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.). if (context->caps()->maxSampleCount() >= 8 && @@ -162,14 +163,14 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex smallMSAART1.reset(cache->createTexture(smallMSAADesc, false)); SkAutoTUnref<GrTexture> smallMSAART1(cache->createTexture(smallMSAADesc, false)); if (smallMSAART1 && smallMSAART1->asRenderTarget()) { - smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAttachment(); + resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget()); } REPORTER_ASSERT(reporter, smallMSAART0 && smallMSAART1 && smallMSAART0->asRenderTarget() && smallMSAART1->asRenderTarget() && - smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment() != - smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment()); + resourceProvider->attachStencilAttachment(smallMSAART0->asRenderTarget()) != + resourceProvider->attachStencilAttachment(smallMSAART1->asRenderTarget())); } } } |