Rename GrStencilBuffer to GrStencilAttachment
BUG=skia: Review URL: https://codereview.chromium.org/1083133002
This commit is contained in:
parent
9c798207b7
commit
8dc7c3a839
@ -173,8 +173,8 @@
|
||||
'<(skia_src_path)/gpu/GrStencilAndCoverPathRenderer.h',
|
||||
'<(skia_src_path)/gpu/GrStencilAndCoverTextContext.cpp',
|
||||
'<(skia_src_path)/gpu/GrStencilAndCoverTextContext.h',
|
||||
'<(skia_src_path)/gpu/GrStencilBuffer.cpp',
|
||||
'<(skia_src_path)/gpu/GrStencilBuffer.h',
|
||||
'<(skia_src_path)/gpu/GrStencilAttachment.cpp',
|
||||
'<(skia_src_path)/gpu/GrStencilAttachment.h',
|
||||
'<(skia_src_path)/gpu/GrStrokeInfo.h',
|
||||
'<(skia_src_path)/gpu/GrTargetCommands.cpp',
|
||||
'<(skia_src_path)/gpu/GrTargetCommands.h',
|
||||
@ -295,8 +295,8 @@
|
||||
'<(skia_src_path)/gpu/gl/GrGLSL.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLSL.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLSL_impl.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLStencilBuffer.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLStencilBuffer.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLStencilAttachment.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLStencilAttachment.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLTexture.cpp',
|
||||
'<(skia_src_path)/gpu/gl/GrGLTexture.h',
|
||||
'<(skia_src_path)/gpu/gl/GrGLTextureRenderTarget.h',
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "GrSurface.h"
|
||||
#include "SkRect.h"
|
||||
|
||||
class GrStencilBuffer;
|
||||
class GrStencilAttachment;
|
||||
class GrRenderTargetPriv;
|
||||
|
||||
/**
|
||||
@ -96,7 +96,7 @@ public:
|
||||
protected:
|
||||
GrRenderTarget(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc)
|
||||
: INHERITED(gpu, lifeCycle, desc)
|
||||
, fStencilBuffer(NULL) {
|
||||
, fStencilAttachment(NULL) {
|
||||
fResolveRect.setLargestInverted();
|
||||
}
|
||||
|
||||
@ -110,9 +110,9 @@ private:
|
||||
|
||||
friend class GrRenderTargetPriv;
|
||||
|
||||
GrStencilBuffer* fStencilBuffer;
|
||||
GrStencilAttachment* fStencilAttachment;
|
||||
|
||||
SkIRect fResolveRect;
|
||||
SkIRect fResolveRect;
|
||||
|
||||
typedef GrSurface INHERITED;
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
|
||||
void setClipTarget(GrClipTarget*);
|
||||
|
||||
void adjustPathStencilParams(const GrStencilBuffer*, GrStencilSettings*);
|
||||
void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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*,
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {}
|
||||
|
@ -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;
|
@ -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)
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
@ -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
|
@ -79,28 +79,30 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
||||
// Test that two budgeted RTs with the same desc share a stencil buffer.
|
||||
SkAutoTUnref<GrTexture> smallRT0(context->createTexture(smallDesc, true));
|
||||
if (smallRT0 && smallRT0->asRenderTarget()) {
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
|
||||
SkAutoTUnref<GrTexture> smallRT1(context->createTexture(smallDesc, true));
|
||||
if (smallRT1 && smallRT1->asRenderTarget()) {
|
||||
smallRT1->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallRT1->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
|
||||
REPORTER_ASSERT(reporter, smallRT0 && smallRT1 &&
|
||||
smallRT0->asRenderTarget() && smallRT1->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilBuffer() ==
|
||||
smallRT1->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallRT0 && smallRT1 &&
|
||||
smallRT0->asRenderTarget() && smallRT1->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() ==
|
||||
smallRT1->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
|
||||
// An unbudgeted RT with the same desc should also share.
|
||||
SkAutoTUnref<GrTexture> smallRT2(context->createTexture(smallDesc, false));
|
||||
if (smallRT2 && smallRT2->asRenderTarget()) {
|
||||
smallRT2->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallRT2->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
REPORTER_ASSERT(reporter, smallRT0 && smallRT2 &&
|
||||
smallRT0->asRenderTarget() && smallRT2->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilBuffer() ==
|
||||
smallRT2->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallRT0 && smallRT2 &&
|
||||
smallRT0->asRenderTarget() && smallRT2->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() ==
|
||||
smallRT2->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
|
||||
// An RT with a much larger size should not share.
|
||||
GrSurfaceDesc bigDesc;
|
||||
@ -111,12 +113,13 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
||||
bigDesc.fSampleCnt = 0;
|
||||
SkAutoTUnref<GrTexture> bigRT(context->createTexture(bigDesc, false));
|
||||
if (bigRT && bigRT->asRenderTarget()) {
|
||||
bigRT->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
bigRT->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
REPORTER_ASSERT(reporter, smallRT0 && bigRT &&
|
||||
smallRT0->asRenderTarget() && bigRT->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilBuffer() !=
|
||||
bigRT->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallRT0 && bigRT &&
|
||||
smallRT0->asRenderTarget() && bigRT->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() !=
|
||||
bigRT->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
|
||||
if (context->getMaxSampleCount() >= 4) {
|
||||
// An RT with a different sample count should not share.
|
||||
@ -124,7 +127,7 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
||||
smallMSAADesc.fSampleCnt = 4;
|
||||
SkAutoTUnref<GrTexture> smallMSAART0(context->createTexture(smallMSAADesc, false));
|
||||
if (smallMSAART0 && smallMSAART0->asRenderTarget()) {
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
#ifdef SK_BUILD_FOR_ANDROID
|
||||
if (!smallMSAART0) {
|
||||
@ -135,19 +138,19 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallRT0 && smallMSAART0 &&
|
||||
smallRT0->asRenderTarget() && smallMSAART0->asRenderTarget() &&
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilBuffer() !=
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
smallRT0->asRenderTarget()->renderTargetPriv().getStencilAttachment() !=
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
// A second MSAA RT should share with the first MSAA RT.
|
||||
SkAutoTUnref<GrTexture> smallMSAART1(context->createTexture(smallMSAADesc, false));
|
||||
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallMSAART0 && smallMSAART1 &&
|
||||
smallMSAART0->asRenderTarget() &&
|
||||
smallMSAART1->asRenderTarget() &&
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilBuffer() ==
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment() ==
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
// 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->getMaxSampleCount() >= 8 && smallMSAART0 && smallMSAART0->asRenderTarget() &&
|
||||
@ -156,14 +159,14 @@ static void test_stencil_buffers(skiatest::Reporter* reporter, GrContext* contex
|
||||
smallMSAART1.reset(context->createTexture(smallMSAADesc, false));
|
||||
SkAutoTUnref<GrTexture> smallMSAART1(context->createTexture(smallMSAADesc, false));
|
||||
if (smallMSAART1 && smallMSAART1->asRenderTarget()) {
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilBuffer();
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().attachStencilAttachment();
|
||||
}
|
||||
REPORTER_ASSERT(reporter,
|
||||
smallMSAART0 && smallMSAART1 &&
|
||||
smallMSAART0->asRenderTarget() &&
|
||||
smallMSAART1->asRenderTarget() &&
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilBuffer() !=
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilBuffer());
|
||||
smallMSAART0 && smallMSAART1 &&
|
||||
smallMSAART0->asRenderTarget() &&
|
||||
smallMSAART1->asRenderTarget() &&
|
||||
smallMSAART0->asRenderTarget()->renderTargetPriv().getStencilAttachment() !=
|
||||
smallMSAART1->asRenderTarget()->renderTargetPriv().getStencilAttachment());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user