diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrClipMaskManager.cpp | 24 | ||||
-rw-r--r-- | src/gpu/GrClipMaskManager.h | 2 | ||||
-rwxr-xr-x | src/gpu/GrContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.h | 2 | ||||
-rw-r--r-- | src/gpu/GrGpu.cpp | 20 | ||||
-rw-r--r-- | src/gpu/GrGpu.h | 16 | ||||
-rw-r--r-- | src/gpu/GrRenderTarget.cpp | 20 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetPriv.h | 8 | ||||
-rw-r--r-- | src/gpu/GrStencilAttachment.cpp (renamed from src/gpu/GrStencilBuffer.cpp) | 6 | ||||
-rw-r--r-- | src/gpu/GrStencilAttachment.h (renamed from src/gpu/GrStencilBuffer.h) | 17 | ||||
-rw-r--r-- | src/gpu/GrTest.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 6 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 8 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 38 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.h | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLStencilAttachment.cpp (renamed from src/gpu/gl/GrGLStencilBuffer.cpp) | 8 | ||||
-rw-r--r-- | src/gpu/gl/GrGLStencilAttachment.h (renamed from src/gpu/gl/GrGLStencilBuffer.h) | 14 |
18 files changed, 107 insertions, 105 deletions
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 2f6f635d04..078895d7e3 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -14,7 +14,7 @@ #include "GrPathRenderer.h" #include "GrRenderTarget.h" #include "GrRenderTargetPriv.h" -#include "GrStencilBuffer.h" +#include "GrStencilAttachment.h" #include "GrSWMaskHelper.h" #include "SkRasterClip.h" #include "SkStrokeRec.h" @@ -706,13 +706,13 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt, SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); SkASSERT(rt); - GrStencilBuffer* stencilBuffer = rt->renderTargetPriv().attachStencilBuffer(); - if (NULL == stencilBuffer) { + GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStencilAttachment(); + if (NULL == stencilAttachment) { return false; } - if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset)) { - stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset); + if (stencilAttachment->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset)) { + stencilAttachment->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset); // Set the matrix so that rendered clip elements are transformed from clip to stencil space. SkVector translate = { SkIntToScalar(clipSpaceToStencilOffset.fX), @@ -726,7 +726,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt, stencilSpaceIBounds.offset(clipSpaceToStencilOffset); GrClip clip(stencilSpaceIBounds); - int clipBit = stencilBuffer->bits(); + int clipBit = stencilAttachment->bits(); SkASSERT((clipBit <= 16) && "Ganesh only handles 16b or smaller stencil buffers"); clipBit = (1 << (clipBit-1)); @@ -952,9 +952,9 @@ void GrClipMaskManager::setPipelineBuilderStencil(GrPipelineBuilder* pipelineBui int stencilBits = 0; GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); - GrStencilBuffer* stencilBuffer = rt->renderTargetPriv().attachStencilBuffer(); - if (stencilBuffer) { - stencilBits = stencilBuffer->bits(); + GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().attachStencilAttachment(); + if (stencilAttachment) { + stencilBits = stencilAttachment->bits(); } SkASSERT(fClipTarget->caps()->stencilWrapOpsSupport() || !settings.usesWrapOp()); @@ -1127,10 +1127,10 @@ void GrClipMaskManager::setClipTarget(GrClipTarget* clipTarget) { fAACache.setContext(clipTarget->getContext()); } -void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBuffer, +void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stencilAttachment, GrStencilSettings* settings) { - if (stencilBuffer) { - int stencilBits = stencilBuffer->bits(); + if (stencilAttachment) { + int stencilBits = stencilAttachment->bits(); this->adjustStencilParams(settings, fClipMode, stencilBits); } } diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h index 935ffa15b8..33a77c1ba9 100644 --- a/src/gpu/GrClipMaskManager.h +++ b/src/gpu/GrClipMaskManager.h @@ -74,7 +74,7 @@ public: void setClipTarget(GrClipTarget*); - void adjustPathStencilParams(const GrStencilBuffer*, GrStencilSettings*); + void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*); private: /** diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 7d53071a0e..8e611b0d00 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -234,7 +234,7 @@ GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, leakyProperties, bool enableDistanceFieldFonts) { if (fGpu->caps()->pathRenderingSupport() && renderTarget->isMultisampled()) { - GrStencilBuffer* sb = renderTarget->renderTargetPriv().attachStencilBuffer(); + GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencilAttachment(); if (sb) { return GrStencilAndCoverTextContext::Create(this, gpuDevice, leakyProperties); } diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 7eef92290e..5b29b9e8b5 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -564,7 +564,7 @@ static const GrStencilSettings& even_odd_path_stencil_settings() { } void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill, - const GrStencilBuffer* sb, + const GrStencilAttachment* sb, GrStencilSettings* outStencilSettings) { switch (fill) { @@ -600,7 +600,7 @@ void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder, // set stencil settings for path GrStencilSettings stencilSettings; GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); - GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); + GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings); @@ -629,7 +629,7 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder, // set stencil settings for path GrStencilSettings stencilSettings; GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); - GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); + GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, pathProc, &devBounds, @@ -669,7 +669,7 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder, // set stencil settings for path GrStencilSettings stencilSettings; GrRenderTarget* rt = pipelineBuilder->getRenderTarget(); - GrStencilBuffer* sb = rt->renderTargetPriv().attachStencilBuffer(); + GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment(); this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings); // Don't compute a bounding box for dst copy texture, we'll opt diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 8a12a31ea9..c21366f736 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -788,7 +788,7 @@ private: // Check to see if this set of draw commands has been sent out virtual bool isIssued(uint32_t drawID) { return true; } void getPathStencilSettingsForFilltype(GrPathRendering::FillType, - const GrStencilBuffer*, + const GrStencilAttachment*, GrStencilSettings*); virtual GrClipMaskManager* clipMaskManager() = 0; virtual bool setupClip(GrPipelineBuilder*, diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index d7d4ae7fd4..88e2bb961e 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -16,7 +16,7 @@ #include "GrIndexBuffer.h" #include "GrResourceCache.h" #include "GrRenderTargetPriv.h" -#include "GrStencilBuffer.h" +#include "GrStencilAttachment.h" #include "GrVertexBuffer.h" //////////////////////////////////////////////////////////////////////////////// @@ -76,8 +76,8 @@ GrTexture* GrGpu::createTexture(const GrSurfaceDesc& desc, bool budgeted, return tex; } -bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { - SkASSERT(NULL == rt->renderTargetPriv().getStencilBuffer()); +bool GrGpu::attachStencilAttachmentToRenderTarget(GrRenderTarget* rt) { + SkASSERT(NULL == rt->renderTargetPriv().getStencilAttachment()); GrUniqueKey sbKey; int width = rt->width(); @@ -89,17 +89,17 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { } #endif - GrStencilBuffer::ComputeSharedStencilBufferKey(width, height, rt->numSamples(), &sbKey); - SkAutoTUnref<GrStencilBuffer> sb(static_cast<GrStencilBuffer*>( + GrStencilAttachment::ComputeSharedStencilAttachmentKey(width, height, rt->numSamples(), &sbKey); + SkAutoTUnref<GrStencilAttachment> sb(static_cast<GrStencilAttachment*>( this->getContext()->getResourceCache()->findAndRefUniqueResource(sbKey))); if (sb) { - if (this->attachStencilBufferToRenderTarget(sb, rt)) { - rt->renderTargetPriv().didAttachStencilBuffer(sb); + if (this->attachStencilAttachmentToRenderTarget(sb, rt)) { + rt->renderTargetPriv().didAttachStencilAttachment(sb); return true; } return false; } - if (this->createStencilBufferForRenderTarget(rt, width, height)) { + if (this->createStencilAttachmentForRenderTarget(rt, width, height)) { // Right now we're clearing the stencil buffer here after it is // attached to an RT for the first time. When we start matching // stencil buffers with smaller color targets this will no longer @@ -109,7 +109,7 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported // FBO status. this->clearStencil(rt); - GrStencilBuffer* sb = rt->renderTargetPriv().getStencilBuffer(); + GrStencilAttachment* sb = rt->renderTargetPriv().getStencilAttachment(); sb->resourcePriv().setUniqueKey(sbKey); return true; } else { @@ -125,7 +125,7 @@ GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { } // TODO: defer this and attach dynamically GrRenderTarget* tgt = tex->asRenderTarget(); - if (tgt && !this->attachStencilBufferToRenderTarget(tgt)) { + if (tgt && !this->attachStencilAttachmentToRenderTarget(tgt)) { tex->unref(); return NULL; } else { diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index 82f4931d6c..3df651f1e6 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -21,7 +21,7 @@ class GrPathRenderer; class GrPathRendererChain; class GrPipeline; class GrPrimitiveProcessor; -class GrStencilBuffer; +class GrStencilAttachment; class GrVertexBufferAllocPool; class GrGpu : public SkRefCnt { @@ -358,7 +358,7 @@ public: fShaderCompilations = 0; fTextureCreates = 0; fTextureUploads = 0; - fStencilBufferCreates = 0; + fStencilAttachmentCreates = 0; } int renderTargetBinds() const { return fRenderTargetBinds; } @@ -369,7 +369,7 @@ public: void incTextureCreates() { fTextureCreates++; } int textureUploads() const { return fTextureUploads; } void incTextureUploads() { fTextureUploads++; } - void incStencilBufferCreates() { fStencilBufferCreates++; } + void incStencilAttachmentCreates() { fStencilAttachmentCreates++; } void dump(SkString*); private: @@ -377,14 +377,14 @@ public: int fShaderCompilations; int fTextureCreates; int fTextureUploads; - int fStencilBufferCreates; + int fStencilAttachmentCreates; #else void dump(SkString*) {}; void incRenderTargetBinds() {} void incShaderCompilations() {} void incTextureCreates() {} void incTextureUploads() {} - void incStencilBufferCreates() {} + void incStencilAttachmentCreates() {} #endif }; @@ -410,7 +410,7 @@ public: void restoreActiveTraceMarkers(); // Given a rt, find or create a stencil buffer and attach it - bool attachStencilBufferToRenderTarget(GrRenderTarget* target); + bool attachStencilAttachmentToRenderTarget(GrRenderTarget* target); protected: // Functions used to map clip-respecting stencil tests into normal @@ -488,10 +488,10 @@ private: // width and height may be larger than rt (if underlying API allows it). // Should attach the SB to the RT. Returns false if compatible sb could // not be created. - virtual bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int height) = 0; + virtual bool createStencilAttachmentForRenderTarget(GrRenderTarget*, int width, int height) = 0; // attaches an existing SB to an existing RT. - virtual bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) = 0; + virtual bool attachStencilAttachmentToRenderTarget(GrStencilAttachment*, GrRenderTarget*) = 0; // clears target's entire stencil buffer to 0 virtual void clearStencil(GrRenderTarget* target) = 0; diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp index 042e19f6ad..d539c900f3 100644 --- a/src/gpu/GrRenderTarget.cpp +++ b/src/gpu/GrRenderTarget.cpp @@ -12,7 +12,7 @@ #include "GrContext.h" #include "GrGpu.h" #include "GrRenderTargetPriv.h" -#include "GrStencilBuffer.h" +#include "GrStencilAttachment.h" void GrRenderTarget::discard() { // go through context so that all necessary flushing occurs @@ -48,29 +48,29 @@ void GrRenderTarget::overrideResolveRect(const SkIRect rect) { } void GrRenderTarget::onRelease() { - this->renderTargetPriv().didAttachStencilBuffer(NULL); + this->renderTargetPriv().didAttachStencilAttachment(NULL); INHERITED::onRelease(); } void GrRenderTarget::onAbandon() { - this->renderTargetPriv().didAttachStencilBuffer(NULL); + this->renderTargetPriv().didAttachStencilAttachment(NULL); INHERITED::onAbandon(); } /////////////////////////////////////////////////////////////////////////////// -void GrRenderTargetPriv::didAttachStencilBuffer(GrStencilBuffer* stencilBuffer) { - SkRefCnt_SafeAssign(fRenderTarget->fStencilBuffer, stencilBuffer); +void GrRenderTargetPriv::didAttachStencilAttachment(GrStencilAttachment* stencilAttachment) { + SkRefCnt_SafeAssign(fRenderTarget->fStencilAttachment, stencilAttachment); } -GrStencilBuffer* GrRenderTargetPriv::attachStencilBuffer() const { - if (fRenderTarget->fStencilBuffer) { - return fRenderTarget->fStencilBuffer; +GrStencilAttachment* GrRenderTargetPriv::attachStencilAttachment() const { + if (fRenderTarget->fStencilAttachment) { + return fRenderTarget->fStencilAttachment; } if (!fRenderTarget->wasDestroyed() && fRenderTarget->canAttemptStencilAttachment()) { - fRenderTarget->getGpu()->attachStencilBufferToRenderTarget(fRenderTarget); + fRenderTarget->getGpu()->attachStencilAttachmentToRenderTarget(fRenderTarget); } - return fRenderTarget->fStencilBuffer; + return fRenderTarget->fStencilAttachment; } diff --git a/src/gpu/GrRenderTargetPriv.h b/src/gpu/GrRenderTargetPriv.h index 92ee30e49f..59262f4b11 100644 --- a/src/gpu/GrRenderTargetPriv.h +++ b/src/gpu/GrRenderTargetPriv.h @@ -16,17 +16,17 @@ class GrRenderTargetPriv { public: /** - * GrStencilBuffer is not part of the public API. + * GrStencilAttachment is not part of the public API. */ - GrStencilBuffer* getStencilBuffer() const { return fRenderTarget->fStencilBuffer; } + GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fStencilAttachment; } /** * If this render target already has a stencil buffer, return it. Otherwise attempt to attach * one. */ - GrStencilBuffer* attachStencilBuffer() const; + GrStencilAttachment* attachStencilAttachment() const; - void didAttachStencilBuffer(GrStencilBuffer*); + void didAttachStencilAttachment(GrStencilAttachment*); private: explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(renderTarget) {} diff --git a/src/gpu/GrStencilBuffer.cpp b/src/gpu/GrStencilAttachment.cpp index 3f2b28f501..9b07070b0f 100644 --- a/src/gpu/GrStencilBuffer.cpp +++ b/src/gpu/GrStencilAttachment.cpp @@ -6,11 +6,11 @@ * found in the LICENSE file. */ -#include "GrStencilBuffer.h" +#include "GrStencilAttachment.h" #include "GrResourceKey.h" -void GrStencilBuffer::ComputeSharedStencilBufferKey(int width, int height, int sampleCnt, - GrUniqueKey* key) { +void GrStencilAttachment::ComputeSharedStencilAttachmentKey(int width, int height, int sampleCnt, + GrUniqueKey* key) { static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); GrUniqueKey::Builder builder(key, kDomain, 3); builder[0] = width; diff --git a/src/gpu/GrStencilBuffer.h b/src/gpu/GrStencilAttachment.h index 0589935f39..ba9781d4ce 100644 --- a/src/gpu/GrStencilBuffer.h +++ b/src/gpu/GrStencilAttachment.h @@ -7,8 +7,8 @@ */ -#ifndef GrStencilBuffer_DEFINED -#define GrStencilBuffer_DEFINED +#ifndef GrStencilAttachment_DEFINED +#define GrStencilAttachment_DEFINED #include "GrClip.h" #include "GrGpuResource.h" @@ -16,11 +16,11 @@ class GrRenderTarget; class GrResourceKey; -class GrStencilBuffer : public GrGpuResource { +class GrStencilAttachment : public GrGpuResource { public: - SK_DECLARE_INST_COUNT(GrStencilBuffer); + SK_DECLARE_INST_COUNT(GrStencilAttachment); - virtual ~GrStencilBuffer() { + virtual ~GrStencilAttachment() { // TODO: allow SB to be purged and detach itself from rts } @@ -49,11 +49,12 @@ public: // We create a unique stencil buffer at each width, height and sampleCnt and share it for // all render targets that require a stencil with those params. - static void ComputeSharedStencilBufferKey(int width, int height, int sampleCnt, - GrUniqueKey* key); + static void ComputeSharedStencilAttachmentKey(int width, int height, int sampleCnt, + GrUniqueKey* key); protected: - GrStencilBuffer(GrGpu* gpu, LifeCycle lifeCycle, int width, int height, int bits, int sampleCnt) + GrStencilAttachment(GrGpu* gpu, LifeCycle lifeCycle, int width, int height, int bits, + int sampleCnt) : GrGpuResource(gpu, lifeCycle) , fWidth(width) , fHeight(height) diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp index aca7133215..09a221df78 100644 --- a/src/gpu/GrTest.cpp +++ b/src/gpu/GrTest.cpp @@ -71,7 +71,7 @@ void GrGpu::Stats::dump(SkString* out) { out->appendf("Shader Compilations: %d\n", fShaderCompilations); out->appendf("Textures Created: %d\n", fTextureCreates); out->appendf("Texture Uploads: %d\n", fTextureUploads); - out->appendf("Stencil Buffer Creates: %d\n", fStencilBufferCreates); + out->appendf("Stencil Buffer Creates: %d\n", fStencilAttachmentCreates); } #endif @@ -232,11 +232,11 @@ private: void onResolveRenderTarget(GrRenderTarget* target) override { return; } - bool createStencilBufferForRenderTarget(GrRenderTarget*, int width, int height) override { + bool createStencilAttachmentForRenderTarget(GrRenderTarget*, int width, int height) override { return false; } - bool attachStencilBufferToRenderTarget(GrStencilBuffer*, GrRenderTarget*) override { + bool attachStencilAttachmentToRenderTarget(GrStencilAttachment*, GrRenderTarget*) override { return false; } diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index fe52a540c6..895cce870e 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -791,7 +791,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa } namespace { -const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; +const GrGLuint kUnknownBitCount = GrGLStencilAttachment::kUnknownBitCount; } void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { @@ -929,7 +929,7 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr void GrGLCaps::markColorConfigAndStencilFormatAsVerified( GrPixelConfig config, - const GrGLStencilBuffer::Format& format) { + const GrGLStencilAttachment::Format& format) { #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT return; #endif @@ -952,7 +952,7 @@ void GrGLCaps::markColorConfigAndStencilFormatAsVerified( bool GrGLCaps::isColorConfigAndStencilFormatVerified( GrPixelConfig config, - const GrGLStencilBuffer::Format& format) const { + const GrGLStencilAttachment::Format& format) const { #if !GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT return false; #endif diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 53587e1ad6..a1d53e30fa 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -10,7 +10,7 @@ #define GrGLCaps_DEFINED #include "GrDrawTargetCaps.h" -#include "GrGLStencilBuffer.h" +#include "GrGLStencilAttachment.h" #include "SkChecksum.h" #include "SkTHash.h" #include "SkTArray.h" @@ -26,7 +26,7 @@ class GrGLCaps : public GrDrawTargetCaps { public: SK_DECLARE_INST_COUNT(GrGLCaps) - typedef GrGLStencilBuffer::Format StencilFormat; + typedef GrGLStencilAttachment::Format StencilFormat; /** * The type of MSAA for FBOs supported. Different extensions have different @@ -132,7 +132,7 @@ public: */ void markColorConfigAndStencilFormatAsVerified( GrPixelConfig config, - const GrGLStencilBuffer::Format& format); + const GrGLStencilAttachment::Format& format); /** * Call to check whether color config / stencil format pair has already @@ -140,7 +140,7 @@ public: */ bool isColorConfigAndStencilFormatVerified( GrPixelConfig config, - const GrGLStencilBuffer::Format& format) const; + const GrGLStencilAttachment::Format& format) const; /** * Reports the type of MSAA FBO support. diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index aff40ccc85..954ecc4f61 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -7,7 +7,7 @@ #include "GrGLGpu.h" -#include "GrGLStencilBuffer.h" +#include "GrGLStencilAttachment.h" #include "GrGLTextureRenderTarget.h" #include "GrGpuResourcePriv.h" #include "GrPipeline.h" @@ -447,20 +447,20 @@ GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDe GrRenderTarget* tgt = SkNEW_ARGS(GrGLRenderTarget, (this, desc, idDesc)); if (wrapDesc.fStencilBits) { - GrGLStencilBuffer::IDDesc sbDesc; - GrGLStencilBuffer::Format format; - format.fInternalFormat = GrGLStencilBuffer::kUnknownInternalFormat; + GrGLStencilAttachment::IDDesc sbDesc; + GrGLStencilAttachment::Format format; + format.fInternalFormat = GrGLStencilAttachment::kUnknownInternalFormat; format.fPacked = false; format.fStencilBits = wrapDesc.fStencilBits; format.fTotalBits = wrapDesc.fStencilBits; - GrGLStencilBuffer* sb = SkNEW_ARGS(GrGLStencilBuffer, + GrGLStencilAttachment* sb = SkNEW_ARGS(GrGLStencilAttachment, (this, sbDesc, desc.fWidth, desc.fHeight, desc.fSampleCnt, format)); - tgt->renderTargetPriv().didAttachStencilBuffer(sb); + tgt->renderTargetPriv().didAttachStencilAttachment(sb); sb->unref(); } return tgt; @@ -1108,10 +1108,10 @@ GrTexture* GrGLGpu::onCreateCompressedTexture(const GrSurfaceDesc& origDesc, boo namespace { -const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; +const GrGLuint kUnknownBitCount = GrGLStencilAttachment::kUnknownBitCount; void inline get_stencil_rb_sizes(const GrGLInterface* gl, - GrGLStencilBuffer::Format* format) { + GrGLStencilAttachment::Format* format) { // we shouldn't ever know one size and not the other SkASSERT((kUnknownBitCount == format->fStencilBits) == @@ -1132,7 +1132,7 @@ void inline get_stencil_rb_sizes(const GrGLInterface* gl, } } -bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, int height) { +bool GrGLGpu::createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int width, int height) { // All internally created RTs are also textures. We don't create // SBs for a client's standalone RT (that is a RT that isn't also a texture). SkASSERT(rt->asTexture()); @@ -1140,7 +1140,7 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, SkASSERT(height >= rt->height()); int samples = rt->numSamples(); - GrGLStencilBuffer::IDDesc sbDesc; + GrGLStencilAttachment::IDDesc sbDesc; int stencilFmtCnt = this->glCaps().stencilFormats().count(); for (int i = 0; i < stencilFmtCnt; ++i) { @@ -1172,16 +1172,16 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, created = (GR_GL_NO_ERROR == check_alloc_error(rt->desc(), this->glInterface())); } if (created) { - fStats.incStencilBufferCreates(); + fStats.incStencilAttachmentCreates(); // After sized formats we attempt an unsized format and take // whatever sizes GL gives us. In that case we query for the size. - GrGLStencilBuffer::Format format = sFmt; + GrGLStencilAttachment::Format format = sFmt; get_stencil_rb_sizes(this->glInterface(), &format); - SkAutoTUnref<GrGLStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, + SkAutoTUnref<GrGLStencilAttachment> sb(SkNEW_ARGS(GrGLStencilAttachment, (this, sbDesc, width, height, samples, format))); - if (this->attachStencilBufferToRenderTarget(sb, rt)) { + if (this->attachStencilAttachmentToRenderTarget(sb, rt)) { fLastSuccessfulStencilFmtIdx = sIdx; - rt->renderTargetPriv().didAttachStencilBuffer(sb); + rt->renderTargetPriv().didAttachStencilAttachment(sb); // This work around is currently breaking on windows 7 hd2000 bot when we bind a color buffer #if 0 // Clear the stencil buffer. We use a special purpose FBO for this so that the @@ -1248,13 +1248,13 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, return false; } -bool GrGLGpu::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTarget* rt) { +bool GrGLGpu::attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, GrRenderTarget* rt) { GrGLRenderTarget* glrt = static_cast<GrGLRenderTarget*>(rt); GrGLuint fbo = glrt->renderFBOID(); if (NULL == sb) { - if (rt->renderTargetPriv().getStencilBuffer()) { + if (rt->renderTargetPriv().getStencilAttachment()) { GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, GR_GL_STENCIL_ATTACHMENT, GR_GL_RENDERBUFFER, 0)); @@ -1269,7 +1269,7 @@ bool GrGLGpu::attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTar } return true; } else { - GrGLStencilBuffer* glsb = static_cast<GrGLStencilBuffer*>(sb); + GrGLStencilAttachment* glsb = static_cast<GrGLStencilAttachment*>(sb); GrGLuint rb = glsb->renderbufferID(); fHWBoundRenderTargetUniqueID = SK_InvalidUniqueID; @@ -1629,7 +1629,7 @@ void GrGLGpu::clearStencil(GrRenderTarget* target) { void GrGLGpu::onClearStencilClip(GrRenderTarget* target, const SkIRect& rect, bool insideClip) { SkASSERT(target); - GrStencilBuffer* sb = target->renderTargetPriv().getStencilBuffer(); + GrStencilAttachment* sb = target->renderTargetPriv().getStencilAttachment(); // this should only be called internally when we know we have a // stencil buffer. SkASSERT(sb); diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h index f6a48d7589..29d63fbd4f 100644 --- a/src/gpu/gl/GrGLGpu.h +++ b/src/gpu/gl/GrGLGpu.h @@ -14,7 +14,7 @@ #include "GrGLPathRendering.h" #include "GrGLProgram.h" #include "GrGLRenderTarget.h" -#include "GrGLStencilBuffer.h" +#include "GrGLStencilAttachment.h" #include "GrGLTexture.h" #include "GrGLVertexArray.h" #include "GrGLVertexBuffer.h" @@ -122,8 +122,9 @@ private: GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) override; GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) override; GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) override; - bool createStencilBufferForRenderTarget(GrRenderTarget* rt, int width, int height) override; - bool attachStencilBufferToRenderTarget(GrStencilBuffer* sb, GrRenderTarget* rt) override; + bool createStencilAttachmentForRenderTarget(GrRenderTarget* rt, int width, int height) override; + bool attachStencilAttachmentToRenderTarget(GrStencilAttachment* sb, + GrRenderTarget* rt) override; void onClear(GrRenderTarget*, const SkIRect* rect, GrColor color, bool canIgnoreRect) override; diff --git a/src/gpu/gl/GrGLStencilBuffer.cpp b/src/gpu/gl/GrGLStencilAttachment.cpp index b6dfbb551d..4ea08c8469 100644 --- a/src/gpu/gl/GrGLStencilBuffer.cpp +++ b/src/gpu/gl/GrGLStencilAttachment.cpp @@ -6,10 +6,10 @@ */ -#include "GrGLStencilBuffer.h" +#include "GrGLStencilAttachment.h" #include "GrGLGpu.h" -size_t GrGLStencilBuffer::onGpuMemorySize() const { +size_t GrGLStencilAttachment::onGpuMemorySize() const { uint64_t size = this->width(); size *= this->height(); size *= fFormat.fTotalBits; @@ -17,7 +17,7 @@ size_t GrGLStencilBuffer::onGpuMemorySize() const { return static_cast<size_t>(size / 8); } -void GrGLStencilBuffer::onRelease() { +void GrGLStencilAttachment::onRelease() { if (0 != fRenderbufferID && !this->isWrapped()) { GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu(); const GrGLInterface* gl = gpuGL->glInterface(); @@ -28,7 +28,7 @@ void GrGLStencilBuffer::onRelease() { INHERITED::onRelease(); } -void GrGLStencilBuffer::onAbandon() { +void GrGLStencilAttachment::onAbandon() { fRenderbufferID = 0; INHERITED::onAbandon(); diff --git a/src/gpu/gl/GrGLStencilBuffer.h b/src/gpu/gl/GrGLStencilAttachment.h index 0cce827a74..fd1214e576 100644 --- a/src/gpu/gl/GrGLStencilBuffer.h +++ b/src/gpu/gl/GrGLStencilAttachment.h @@ -6,13 +6,13 @@ */ -#ifndef GrGLStencilBuffer_DEFINED -#define GrGLStencilBuffer_DEFINED +#ifndef GrGLStencilAttachment_DEFINED +#define GrGLStencilAttachment_DEFINED #include "gl/GrGLInterface.h" -#include "GrStencilBuffer.h" +#include "GrStencilAttachment.h" -class GrGLStencilBuffer : public GrStencilBuffer { +class GrGLStencilAttachment : public GrStencilAttachment { public: static const GrGLenum kUnknownInternalFormat = ~0U; static const GrGLuint kUnknownBitCount = ~0U; @@ -29,12 +29,12 @@ public: GrGpuResource::LifeCycle fLifeCycle; }; - GrGLStencilBuffer(GrGpu* gpu, + GrGLStencilAttachment(GrGpu* gpu, const IDDesc& idDesc, int width, int height, int sampleCnt, const Format& format) - : GrStencilBuffer(gpu, idDesc.fLifeCycle, width, height, format.fStencilBits, sampleCnt) + : GrStencilAttachment(gpu, idDesc.fLifeCycle, width, height, format.fStencilBits, sampleCnt) , fFormat(format) , fRenderbufferID(idDesc.fRenderbufferID) { this->registerWithCache(); @@ -60,7 +60,7 @@ private: // us how many bits of stencil there are). GrGLuint fRenderbufferID; - typedef GrStencilBuffer INHERITED; + typedef GrStencilAttachment INHERITED; }; #endif |