aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAAConvexPathRenderer.cpp2
-rw-r--r--src/gpu/GrAAHairLinePathRenderer.cpp2
-rw-r--r--src/gpu/GrBufferAllocPool.cpp4
-rw-r--r--src/gpu/GrClipMaskManager.cpp6
-rw-r--r--src/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrDrawTarget.cpp33
-rw-r--r--src/gpu/GrDrawTarget.h57
-rw-r--r--src/gpu/GrGpu.cpp2
-rw-r--r--src/gpu/GrPathRendererChain.cpp4
-rw-r--r--src/gpu/GrStencilAndCoverPathRenderer.cpp4
-rw-r--r--src/gpu/GrTexture.cpp4
-rw-r--r--src/gpu/gl/GrGLIndexBuffer.cpp4
-rw-r--r--src/gpu/gl/GrGLVertexBuffer.cpp4
-rw-r--r--src/gpu/gl/GrGpuGL.cpp56
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp2
15 files changed, 111 insertions, 81 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 718cfdd199..81695088ab 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -434,7 +434,7 @@ bool GrAAConvexPathRenderer::canDrawPath(const SkPath& path,
GrPathFill fill,
const GrDrawTarget* target,
bool antiAlias) const {
- if (!target->getCaps().fShaderDerivativeSupport || !antiAlias ||
+ if (!target->getCaps().shaderDerivativeSupport() || !antiAlias ||
kHairLine_GrPathFill == fill || GrIsFillInverted(fill) ||
!path.isConvex()) {
return false;
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 94b607ce12..819092dd36 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -573,7 +573,7 @@ bool GrAAHairLinePathRenderer::canDrawPath(const SkPath& path,
static const uint32_t gReqDerivMask = SkPath::kCubic_SegmentMask |
SkPath::kQuad_SegmentMask;
- if (!target->getCaps().fShaderDerivativeSupport &&
+ if (!target->getCaps().shaderDerivativeSupport() &&
(gReqDerivMask & path.getSegmentMasks())) {
return false;
}
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index c2ee357ed5..66b74e4295 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -296,7 +296,7 @@ bool GrBufferAllocPool::createBlock(size_t requestSize) {
GrAssert(NULL == fBufferPtr);
- if (fGpu->getCaps().fBufferLockSupport &&
+ if (fGpu->getCaps().bufferLockSupport() &&
size > GR_GEOM_BUFFER_LOCK_THRESHOLD &&
(!fFrequentResetHint || requestSize > GR_GEOM_BUFFER_LOCK_THRESHOLD)) {
fBufferPtr = block.fBuffer->lock();
@@ -338,7 +338,7 @@ void GrBufferAllocPool::flushCpuData(GrGeometryBuffer* buffer,
GrAssert(flushSize <= buffer->sizeInBytes());
VALIDATE(true);
- if (fGpu->getCaps().fBufferLockSupport &&
+ if (fGpu->getCaps().bufferLockSupport() &&
flushSize > GR_GEOM_BUFFER_LOCK_THRESHOLD) {
void* data = buffer->lock();
if (NULL != data) {
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index de8f323ce6..4968c0bdfb 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -1016,9 +1016,9 @@ void GrClipMaskManager::setGpuStencil() {
stencilBits = stencilBuffer->bits();
}
- GrAssert(fGpu->getCaps().fStencilWrapOpsSupport ||
+ GrAssert(fGpu->getCaps().stencilWrapOpsSupport() ||
!settings.usesWrapOp());
- GrAssert(fGpu->getCaps().fTwoSidedStencilSupport || !settings.isTwoSided());
+ GrAssert(fGpu->getCaps().twoSidedStencilSupport() || !settings.isTwoSided());
this->adjustStencilParams(&settings, clipMode, stencilBits);
fGpu->setStencilSettings(settings);
}
@@ -1038,7 +1038,7 @@ void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
unsigned int userBits = clipBit - 1;
GrStencilSettings::Face face = GrStencilSettings::kFront_Face;
- bool twoSided = fGpu->getCaps().fTwoSidedStencilSupport;
+ bool twoSided = fGpu->getCaps().twoSidedStencilSupport();
bool finished = false;
while (!finished) {
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 8175d150c6..13ada9a677 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -515,11 +515,11 @@ void GrContext::setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) {
}
int GrContext::getMaxTextureSize() const {
- return fGpu->getCaps().fMaxTextureSize;
+ return fGpu->getCaps().maxTextureSize();
}
int GrContext::getMaxRenderTargetSize() const {
- return fGpu->getCaps().fMaxRenderTargetSize;
+ return fGpu->getCaps().maxRenderTargetSize();
}
///////////////////////////////////////////////////////////////////////////////
@@ -537,7 +537,7 @@ GrRenderTarget* GrContext::createPlatformRenderTarget(const GrPlatformRenderTarg
bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params,
int width, int height) const {
const GrDrawTarget::Caps& caps = fGpu->getCaps();
- if (!caps.f8BitPaletteSupport) {
+ if (!caps.eightBitPaletteSupport()) {
return false;
}
@@ -545,7 +545,7 @@ bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params,
if (!isPow2) {
bool tiled = NULL != params && params->isTiled();
- if (tiled && !caps.fNPOTTextureTileSupport) {
+ if (tiled && !caps.npotTextureTileSupport()) {
return false;
}
}
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index a567699560..0b61f6e531 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -786,7 +786,7 @@ void GrDrawTarget::drawNonIndexed(GrPrimitiveType type,
void GrDrawTarget::stencilPath(const GrPath* path, GrPathFill fill) {
// TODO: extract portions of checkDraw that are relevant to path stenciling.
GrAssert(NULL != path);
- GrAssert(fCaps.fPathStencilingSupport);
+ GrAssert(fCaps.pathStencilingSupport());
GrAssert(kHairLine_GrPathFill != fill);
GrAssert(!GrIsFillInverted(fill));
this->onStencilPath(path, fill);
@@ -979,7 +979,7 @@ bool GrDrawTarget::willUseHWAALines() const {
// premultiplied alpha. Smooth lines tweak the incoming alpha value
// but not in a premul-alpha way. So we only use them when our alpha
// is 0xff and tweaking the color for partial coverage is OK
- if (!fCaps.fHWAALineSupport ||
+ if (!fCaps.hwAALineSupport() ||
!this->getDrawState().isHWAntialiasState()) {
return false;
}
@@ -991,7 +991,7 @@ bool GrDrawTarget::willUseHWAALines() const {
bool GrDrawTarget::canApplyCoverage() const {
// we can correctly apply coverage if a) we have dual source blending
// or b) one of our blend optimizations applies.
- return this->getCaps().fDualSourceBlendingSupport ||
+ return this->getCaps().dualSourceBlendingSupport() ||
kNone_BlendOpt != this->getBlendOpts(true);
}
@@ -1237,18 +1237,17 @@ void GrDrawTarget::AutoReleaseGeometry::reset() {
void GrDrawTarget::Caps::print() const {
static const char* gNY[] = {"NO", "YES"};
- GrPrintf("8 Bit Palette Support : %s\n", gNY[f8BitPaletteSupport]);
- GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fNPOTTextureTileSupport]);
- GrPrintf("Two Sided Stencil Support : %s\n", gNY[fTwoSidedStencilSupport]);
- GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fStencilWrapOpsSupport]);
- GrPrintf("HW AA Lines Support : %s\n", gNY[fHWAALineSupport]);
- GrPrintf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]);
- GrPrintf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]);
- GrPrintf("FSAA Support : %s\n", gNY[fFSAASupport]);
- GrPrintf("Dual Source Blending Support: %s\n", gNY[fDualSourceBlendingSupport]);
- GrPrintf("Buffer Lock Support : %s\n", gNY[fBufferLockSupport]);
- GrPrintf("Max Texture Size : %d\n", fMaxTextureSize);
- GrPrintf("Max Render Target Size : %d\n", fMaxRenderTargetSize);
+ GrPrintf("8 Bit Palette Support : %s\n", gNY[fInternals.f8BitPaletteSupport]);
+ GrPrintf("NPOT Texture Tile Support : %s\n", gNY[fInternals.fNPOTTextureTileSupport]);
+ GrPrintf("Two Sided Stencil Support : %s\n", gNY[fInternals.fTwoSidedStencilSupport]);
+ GrPrintf("Stencil Wrap Ops Support : %s\n", gNY[fInternals.fStencilWrapOpsSupport]);
+ GrPrintf("HW AA Lines Support : %s\n", gNY[fInternals.fHWAALineSupport]);
+ GrPrintf("Shader Derivative Support : %s\n", gNY[fInternals.fShaderDerivativeSupport]);
+ GrPrintf("Geometry Shader Support : %s\n", gNY[fInternals.fGeometryShaderSupport]);
+ GrPrintf("FSAA Support : %s\n", gNY[fInternals.fFSAASupport]);
+ GrPrintf("Dual Source Blending Support: %s\n", gNY[fInternals.fDualSourceBlendingSupport]);
+ GrPrintf("Buffer Lock Support : %s\n", gNY[fInternals.fBufferLockSupport]);
+ GrPrintf("Path Stenciling Support : %s\n", gNY[fInternals.fPathStencilingSupport]);
+ GrPrintf("Max Texture Size : %d\n", fInternals.fMaxTextureSize);
+ GrPrintf("Max Render Target Size : %d\n", fInternals.fMaxRenderTargetSize);
}
-
-
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 5f241a6bff..862ace01c0 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -26,20 +26,11 @@ class GrPath;
class GrVertexBuffer;
class GrDrawTarget : public GrRefCnt {
-public:
- SK_DECLARE_INST_COUNT(GrDrawTarget)
-
- /**
- * Represents the draw target capabilities.
- */
- struct Caps {
- Caps() { memset(this, 0, sizeof(Caps)); }
- Caps(const Caps& c) { *this = c; }
- Caps& operator= (const Caps& c) {
- memcpy(this, &c, sizeof(Caps));
- return *this;
- }
- void print() const;
+protected:
+ /** This helper class allows GrDrawTarget subclasses to set the caps values without having to be
+ made a friend of GrDrawTarget::Caps. */
+ class CapsInternals {
+ public:
bool f8BitPaletteSupport : 1;
bool fNPOTTextureTileSupport : 1;
bool fTwoSidedStencilSupport : 1;
@@ -55,6 +46,41 @@ public:
int fMaxTextureSize;
};
+public:
+ SK_DECLARE_INST_COUNT(GrDrawTarget)
+
+ /**
+ * Represents the draw target capabilities.
+ */
+ class Caps {
+ public:
+ Caps() { memset(this, 0, sizeof(Caps)); }
+ Caps(const Caps& c) { *this = c; }
+ Caps& operator= (const Caps& c) {
+ memcpy(this, &c, sizeof(Caps));
+ return *this;
+ }
+ void print() const;
+
+ bool eightBitPaletteSupport() const { return fInternals.f8BitPaletteSupport; }
+ bool npotTextureTileSupport() const { return fInternals.fNPOTTextureTileSupport; }
+ bool twoSidedStencilSupport() const { return fInternals.fTwoSidedStencilSupport; }
+ bool stencilWrapOpsSupport() const { return fInternals.fStencilWrapOpsSupport; }
+ bool hwAALineSupport() const { return fInternals.fHWAALineSupport; }
+ bool shaderDerivativeSupport() const { return fInternals.fShaderDerivativeSupport; }
+ bool geometryShaderSupport() const { return fInternals.fGeometryShaderSupport; }
+ bool fsaaSupport() const { return fInternals.fFSAASupport; }
+ bool dualSourceBlendingSupport() const { return fInternals.fDualSourceBlendingSupport; }
+ bool bufferLockSupport() const { return fInternals.fBufferLockSupport; }
+ bool pathStencilingSupport() const { return fInternals.fPathStencilingSupport; }
+
+ int maxRenderTargetSize() const { return fInternals.fMaxRenderTargetSize; }
+ int maxTextureSize() const { return fInternals.fMaxTextureSize; }
+ private:
+ CapsInternals fInternals;
+ friend GrDrawTarget; // to set values of fInternals
+ };
+
///////////////////////////////////////////////////////////////////////////
GrDrawTarget();
@@ -1013,6 +1039,9 @@ protected:
return this->getGeomSrc().fVertexLayout;
}
+ // allows derived class to set the caps
+ CapsInternals* capsInternals() { return &fCaps.fInternals; }
+
const GrClipData* fClip;
GrDrawState* fDrawState;
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index f38b819556..b6f5bb7839 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -228,7 +228,7 @@ GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) {
}
GrPath* GrGpu::createPath(const SkPath& path) {
- GrAssert(fCaps.fPathStencilingSupport);
+ GrAssert(fCaps.pathStencilingSupport());
this->handleDirtyContext();
return this->onCreatePath(path);
}
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 038f83697a..2814f999be 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -51,8 +51,8 @@ GrPathRenderer* GrPathRendererChain::getPathRenderer(const SkPath& path,
void GrPathRendererChain::init() {
GrAssert(!fInit);
GrGpu* gpu = fOwner->getGpu();
- bool twoSided = gpu->getCaps().fTwoSidedStencilSupport;
- bool wrapOp = gpu->getCaps().fStencilWrapOpsSupport;
+ bool twoSided = gpu->getCaps().twoSidedStencilSupport();
+ bool wrapOp = gpu->getCaps().stencilWrapOpsSupport();
GrPathRenderer::AddPathRenderers(fOwner, fFlags, this);
this->addPathRenderer(SkNEW_ARGS(GrDefaultPathRenderer,
(twoSided, wrapOp)))->unref();
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index 646a6d8392..3042cecb97 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -15,7 +15,7 @@
GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) {
GrAssert(NULL != context);
GrAssert(NULL != context->getGpu());
- if (context->getGpu()->getCaps().fPathStencilingSupport) {
+ if (context->getGpu()->getCaps().pathStencilingSupport()) {
return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu()));
} else {
return NULL;
@@ -23,7 +23,7 @@ GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) {
}
GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) {
- GrAssert(gpu->getCaps().fPathStencilingSupport);
+ GrAssert(gpu->getCaps().pathStencilingSupport());
fGpu = gpu;
gpu->ref();
}
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index ce6109bf4a..027521bf93 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -157,13 +157,13 @@ void gen_texture_key_values(const GrGpu* gpu,
// we assume we only need 16 bits of width and height
// assert that texture creation will fail anyway if this assumption
// would cause key collisions.
- GrAssert(gpu->getCaps().fMaxTextureSize <= SK_MaxU16);
+ GrAssert(gpu->getCaps().maxTextureSize() <= SK_MaxU16);
cacheID->fResourceSpecific32 = desc.fWidth | (desc.fHeight << 16);
GrAssert(desc.fSampleCnt >= 0 && desc.fSampleCnt < 256);
cacheID->fResourceSpecific16 = desc.fSampleCnt << 8;
- if (!gpu->getCaps().fNPOTTextureTileSupport) {
+ if (!gpu->getCaps().npotTextureTileSupport()) {
bool isPow2 = GrIsPow2(desc.fWidth) && GrIsPow2(desc.fHeight);
bool tiled = NULL != params && params->isTiled();
diff --git a/src/gpu/gl/GrGLIndexBuffer.cpp b/src/gpu/gl/GrGLIndexBuffer.cpp
index 9c019c149b..26fdeb6687 100644
--- a/src/gpu/gl/GrGLIndexBuffer.cpp
+++ b/src/gpu/gl/GrGLIndexBuffer.cpp
@@ -50,7 +50,7 @@ GrGLuint GrGLIndexBuffer::bufferID() const {
void* GrGLIndexBuffer::lock() {
GrAssert(fBufferID);
GrAssert(!isLocked());
- if (this->getGpu()->getCaps().fBufferLockSupport) {
+ if (this->getGpu()->getCaps().bufferLockSupport()) {
this->bind();
// Let driver know it can discard the old data
GL_CALL(BufferData(GR_GL_ELEMENT_ARRAY_BUFFER,
@@ -75,7 +75,7 @@ void* GrGLIndexBuffer::lockPtr() const {
void GrGLIndexBuffer::unlock() {
GrAssert(fBufferID);
GrAssert(isLocked());
- GrAssert(this->getGpu()->getCaps().fBufferLockSupport);
+ GrAssert(this->getGpu()->getCaps().bufferLockSupport());
this->bind();
GL_CALL(UnmapBuffer(GR_GL_ELEMENT_ARRAY_BUFFER));
diff --git a/src/gpu/gl/GrGLVertexBuffer.cpp b/src/gpu/gl/GrGLVertexBuffer.cpp
index 3d6062dc59..71ea66df69 100644
--- a/src/gpu/gl/GrGLVertexBuffer.cpp
+++ b/src/gpu/gl/GrGLVertexBuffer.cpp
@@ -49,7 +49,7 @@ GrGLuint GrGLVertexBuffer::bufferID() const {
void* GrGLVertexBuffer::lock() {
GrAssert(fBufferID);
GrAssert(!isLocked());
- if (this->getGpu()->getCaps().fBufferLockSupport) {
+ if (this->getGpu()->getCaps().bufferLockSupport()) {
this->bind();
// Let driver know it can discard the old data
GL_CALL(BufferData(GR_GL_ARRAY_BUFFER, this->sizeInBytes(), NULL,
@@ -71,7 +71,7 @@ void GrGLVertexBuffer::unlock() {
GrAssert(fBufferID);
GrAssert(isLocked());
- GrAssert(this->getGpu()->getCaps().fBufferLockSupport);
+ GrAssert(this->getGpu()->getCaps().bufferLockSupport());
this->bind();
GL_CALL(UnmapBuffer(GR_GL_ARRAY_BUFFER));
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 8e6e43c7b5..2af77fa395 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -211,13 +211,15 @@ void GrGpuGL::initCaps() {
GR_GL_GetIntegerv(gl, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits);
GrAssert(maxTextureUnits > GrDrawState::kNumStages);
+ CapsInternals* caps = this->capsInternals();
+
GrGLint numFormats;
GR_GL_GetIntegerv(gl, GR_GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numFormats);
SkAutoSTMalloc<10, GrGLint> formats(numFormats);
GR_GL_GetIntegerv(gl, GR_GL_COMPRESSED_TEXTURE_FORMATS, formats);
for (int i = 0; i < numFormats; ++i) {
if (formats[i] == GR_GL_PALETTE8_RGBA8) {
- fCaps.f8BitPaletteSupport = true;
+ caps->f8BitPaletteSupport = true;
break;
}
}
@@ -226,59 +228,59 @@ void GrGpuGL::initCaps() {
// we could also look for GL_ATI_separate_stencil extension or
// GL_EXT_stencil_two_side but they use different function signatures
// than GL2.0+ (and than each other).
- fCaps.fTwoSidedStencilSupport = (this->glVersion() >= GR_GL_VER(2,0));
+ caps->fTwoSidedStencilSupport = (this->glVersion() >= GR_GL_VER(2,0));
// supported on GL 1.4 and higher or by extension
- fCaps.fStencilWrapOpsSupport = (this->glVersion() >= GR_GL_VER(1,4)) ||
+ caps->fStencilWrapOpsSupport = (this->glVersion() >= GR_GL_VER(1,4)) ||
this->hasExtension("GL_EXT_stencil_wrap");
} else {
// ES 2 has two sided stencil and stencil wrap
- fCaps.fTwoSidedStencilSupport = true;
- fCaps.fStencilWrapOpsSupport = true;
+ caps->fTwoSidedStencilSupport = true;
+ caps->fStencilWrapOpsSupport = true;
}
if (kDesktop_GrGLBinding == this->glBinding()) {
- fCaps.fBufferLockSupport = true; // we require VBO support and the desktop VBO
+ caps->fBufferLockSupport = true; // we require VBO support and the desktop VBO
// extension includes glMapBuffer.
} else {
- fCaps.fBufferLockSupport = this->hasExtension("GL_OES_mapbuffer");
+ caps->fBufferLockSupport = this->hasExtension("GL_OES_mapbuffer");
}
if (kDesktop_GrGLBinding == this->glBinding()) {
if (this->glVersion() >= GR_GL_VER(2,0) ||
this->hasExtension("GL_ARB_texture_non_power_of_two")) {
- fCaps.fNPOTTextureTileSupport = true;
+ caps->fNPOTTextureTileSupport = true;
} else {
- fCaps.fNPOTTextureTileSupport = false;
+ caps->fNPOTTextureTileSupport = false;
}
} else {
// Unextended ES2 supports NPOT textures with clamp_to_edge and non-mip filters only
- fCaps.fNPOTTextureTileSupport = this->hasExtension("GL_OES_texture_npot");
+ caps->fNPOTTextureTileSupport = this->hasExtension("GL_OES_texture_npot");
}
- fCaps.fHWAALineSupport = (kDesktop_GrGLBinding == this->glBinding());
+ caps->fHWAALineSupport = (kDesktop_GrGLBinding == this->glBinding());
- GR_GL_GetIntegerv(gl, GR_GL_MAX_TEXTURE_SIZE, &fCaps.fMaxTextureSize);
- GR_GL_GetIntegerv(gl, GR_GL_MAX_RENDERBUFFER_SIZE, &fCaps.fMaxRenderTargetSize);
+ GR_GL_GetIntegerv(gl, GR_GL_MAX_TEXTURE_SIZE, &caps->fMaxTextureSize);
+ GR_GL_GetIntegerv(gl, GR_GL_MAX_RENDERBUFFER_SIZE, &caps->fMaxRenderTargetSize);
// Our render targets are always created with textures as the color
// attachment, hence this min:
- fCaps.fMaxRenderTargetSize = GrMin(fCaps.fMaxTextureSize, fCaps.fMaxRenderTargetSize);
+ caps->fMaxRenderTargetSize = GrMin(caps->fMaxTextureSize, caps->fMaxRenderTargetSize);
- fCaps.fFSAASupport = GrGLCaps::kNone_MSFBOType != this->glCaps().msFBOType();
- fCaps.fPathStencilingSupport = GR_GL_USE_NV_PATH_RENDERING &&
+ caps->fFSAASupport = GrGLCaps::kNone_MSFBOType != this->glCaps().msFBOType();
+ caps->fPathStencilingSupport = GR_GL_USE_NV_PATH_RENDERING &&
this->hasExtension("GL_NV_path_rendering");
// Enable supported shader-related caps
if (kDesktop_GrGLBinding == this->glBinding()) {
- fCaps.fDualSourceBlendingSupport =
+ caps->fDualSourceBlendingSupport =
this->glVersion() >= GR_GL_VER(3,3) ||
this->hasExtension("GL_ARB_blend_func_extended");
- fCaps.fShaderDerivativeSupport = true;
+ caps->fShaderDerivativeSupport = true;
// we don't support GL_ARB_geometry_shader4, just GL 3.2+ GS
- fCaps.fGeometryShaderSupport =
+ caps->fGeometryShaderSupport =
this->glVersion() >= GR_GL_VER(3,2) &&
this->glslGeneration() >= k150_GrGLSLGeneration;
} else {
- fCaps.fShaderDerivativeSupport =
+ caps->fShaderDerivativeSupport =
this->hasExtension("GL_OES_standard_derivatives");
}
}
@@ -426,7 +428,7 @@ void GrGpuGL::onResetContext() {
fHWBoundRenderTarget = NULL;
fHWPathMatrixState.invalidate();
- if (fCaps.fPathStencilingSupport) {
+ if (fCaps.pathStencilingSupport()) {
// we don't use the model view matrix.
GL_CALL(MatrixMode(GR_GL_MODELVIEW));
GL_CALL(LoadIdentity());
@@ -956,8 +958,8 @@ GrTexture* GrGpuGL::onCreateTexture(const GrTextureDesc& desc,
}
if (renderTarget) {
- if (glTexDesc.fWidth > caps.fMaxRenderTargetSize ||
- glTexDesc.fHeight > caps.fMaxRenderTargetSize) {
+ if (glTexDesc.fWidth > caps.maxRenderTargetSize() ||
+ glTexDesc.fHeight > caps.maxRenderTargetSize()) {
return return_null_texture();
}
}
@@ -1243,7 +1245,7 @@ GrIndexBuffer* GrGpuGL::onCreateIndexBuffer(uint32_t size, bool dynamic) {
}
GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) {
- GrAssert(fCaps.fPathStencilingSupport);
+ GrAssert(fCaps.pathStencilingSupport());
return SkNEW_ARGS(GrGLPath, (this, inPath));
}
@@ -1686,7 +1688,7 @@ void GrGpuGL::setStencilPathSettings(const GrPath&,
}
void GrGpuGL::onGpuStencilPath(const GrPath* path, GrPathFill fill) {
- GrAssert(fCaps.fPathStencilingSupport);
+ GrAssert(fCaps.pathStencilingSupport());
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
GrDrawState* drawState = this->drawState();
@@ -1871,7 +1873,7 @@ void GrGpuGL::flushStencil(DrawType type) {
}
}
if (!fStencilSettings.isDisabled()) {
- if (this->getCaps().fTwoSidedStencilSupport) {
+ if (this->getCaps().twoSidedStencilSupport()) {
set_gl_stencil(this->glInterface(),
fStencilSettings,
GR_GL_FRONT,
@@ -2284,7 +2286,7 @@ bool GrGpuGL::configToGLFormats(GrPixelConfig config,
*externalType = GR_GL_UNSIGNED_SHORT_4_4_4_4;
break;
case kIndex_8_GrPixelConfig:
- if (this->getCaps().f8BitPaletteSupport) {
+ if (this->getCaps().eightBitPaletteSupport()) {
*internalFormat = GR_GL_PALETTE8_RGBA8;
// glCompressedTexImage doesn't take external params
*externalFormat = GR_GL_PALETTE8_RGBA8;
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 174f5cb18d..7e62f93cbb 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -774,7 +774,7 @@ void GrGpuGL::buildProgram(bool isPoints,
desc->fFirstCoverageStage = firstCoverageStage;
}
- if (this->getCaps().fDualSourceBlendingSupport &&
+ if (this->getCaps().dualSourceBlendingSupport() &&
!(blendOpts & (kEmitCoverage_BlendOptFlag | kCoverageAsAlpha_BlendOptFlag))) {
if (kZero_GrBlendCoeff == dstCoeff) {
// write the coverage value to second color