summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/skia/include/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/include/gpu')
-rw-r--r--chromium/third_party/skia/include/gpu/GrBackendEffectFactory.h4
-rwxr-xr-xchromium/third_party/skia/include/gpu/GrBitmapTextContext.h46
-rw-r--r--chromium/third_party/skia/include/gpu/GrCacheable.h73
-rw-r--r--chromium/third_party/skia/include/gpu/GrClipData.h11
-rw-r--r--chromium/third_party/skia/include/gpu/GrColor.h47
-rw-r--r--chromium/third_party/skia/include/gpu/GrConfig.h17
-rw-r--r--chromium/third_party/skia/include/gpu/GrContext.h218
-rw-r--r--chromium/third_party/skia/include/gpu/GrContextFactory.h35
-rw-r--r--chromium/third_party/skia/include/gpu/GrCoordTransform.h2
-rwxr-xr-xchromium/third_party/skia/include/gpu/GrDistanceFieldTextContext.h46
-rw-r--r--chromium/third_party/skia/include/gpu/GrEffectUnitTest.h6
-rw-r--r--chromium/third_party/skia/include/gpu/GrFontScaler.h8
-rw-r--r--chromium/third_party/skia/include/gpu/GrGlyph.h10
-rw-r--r--chromium/third_party/skia/include/gpu/GrGpuObject.h (renamed from chromium/third_party/skia/include/gpu/GrResource.h)75
-rw-r--r--chromium/third_party/skia/include/gpu/GrPoint.h30
-rw-r--r--chromium/third_party/skia/include/gpu/GrRect.h8
-rw-r--r--chromium/third_party/skia/include/gpu/GrRenderTarget.h8
-rw-r--r--chromium/third_party/skia/include/gpu/GrSurface.h8
-rw-r--r--chromium/third_party/skia/include/gpu/GrTBackendEffectFactory.h2
-rw-r--r--chromium/third_party/skia/include/gpu/GrTextContext.h40
-rw-r--r--chromium/third_party/skia/include/gpu/GrTexture.h167
-rw-r--r--chromium/third_party/skia/include/gpu/GrTextureAccess.h2
-rw-r--r--chromium/third_party/skia/include/gpu/GrTypes.h105
-rw-r--r--chromium/third_party/skia/include/gpu/GrTypesPriv.h57
-rw-r--r--chromium/third_party/skia/include/gpu/GrUserConfig.h6
-rw-r--r--chromium/third_party/skia/include/gpu/SkGpuDevice.h93
-rw-r--r--chromium/third_party/skia/include/gpu/SkGr.h37
-rw-r--r--chromium/third_party/skia/include/gpu/SkGrPixelRef.h11
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLConfig.h17
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLExtensions.h40
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h56
-rw-r--r--chromium/third_party/skia/include/gpu/gl/GrGLInterface.h529
-rw-r--r--chromium/third_party/skia/include/gpu/gl/SkGLContextHelper.h18
-rw-r--r--chromium/third_party/skia/include/gpu/gl/SkNullGLContext.h2
34 files changed, 1039 insertions, 795 deletions
diff --git a/chromium/third_party/skia/include/gpu/GrBackendEffectFactory.h b/chromium/third_party/skia/include/gpu/GrBackendEffectFactory.h
index b3f52fbb04a..0fc981cbe9a 100644
--- a/chromium/third_party/skia/include/gpu/GrBackendEffectFactory.h
+++ b/chromium/third_party/skia/include/gpu/GrBackendEffectFactory.h
@@ -10,7 +10,7 @@
#include "GrTypes.h"
#include "SkTemplates.h"
-#include "SkThread_platform.h"
+#include "SkThread.h"
#include "SkTypes.h"
/** Given a GrEffect of a particular type, creates the corresponding graphics-backend-specific
@@ -28,7 +28,7 @@ class GrGLEffect;
class GrGLCaps;
class GrDrawEffect;
-class GrBackendEffectFactory : public SkNoncopyable {
+class GrBackendEffectFactory : SkNoncopyable {
public:
typedef uint32_t EffectKey;
enum {
diff --git a/chromium/third_party/skia/include/gpu/GrBitmapTextContext.h b/chromium/third_party/skia/include/gpu/GrBitmapTextContext.h
deleted file mode 100755
index e0900ecd7d6..00000000000
--- a/chromium/third_party/skia/include/gpu/GrBitmapTextContext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrBitmapTextContext_DEFINED
-#define GrBitmapTextContext_DEFINED
-
-#include "GrTextContext.h"
-
-class GrTextStrike;
-
-/*
- * This class implements GrTextContext using standard bitmap fonts
- */
-class GrBitmapTextContext : public GrTextContext {
-public:
- GrBitmapTextContext(GrContext*, const GrPaint&, SkColor);
- virtual ~GrBitmapTextContext();
-
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) SK_OVERRIDE;
-
-private:
- GrContext::AutoMatrix fAutoMatrix;
- GrTextStrike* fStrike;
-
- void flushGlyphs(); // automatically called by destructor
-
- enum {
- kMinRequestedGlyphs = 1,
- kDefaultRequestedGlyphs = 64,
- kMinRequestedVerts = kMinRequestedGlyphs * 4,
- kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
- };
-
- SkColor fSkPaintColor;
- SkPoint* fVertices;
- int32_t fMaxVertices;
- GrTexture* fCurrTexture;
- int fCurrVertex;
-};
-
-#endif
diff --git a/chromium/third_party/skia/include/gpu/GrCacheable.h b/chromium/third_party/skia/include/gpu/GrCacheable.h
new file mode 100644
index 00000000000..344ae6b5831
--- /dev/null
+++ b/chromium/third_party/skia/include/gpu/GrCacheable.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrCacheable_DEFINED
+#define GrCacheable_DEFINED
+
+#include "SkRefCnt.h"
+
+class GrResourceCacheEntry;
+
+/**
+ * Base class for objects that can be kept in the GrResourceCache.
+ */
+class GrCacheable : public SkRefCnt {
+public:
+ SK_DECLARE_INST_COUNT(GrCacheable)
+
+ /**
+ * Retrieves the amount of GPU memory used by this resource in bytes. It is
+ * approximate since we aren't aware of additional padding or copies made
+ * by the driver.
+ *
+ * @return the amount of GPU memory used in bytes
+ */
+ virtual size_t gpuMemorySize() const = 0;
+
+ /**
+ * Checks whether the GPU memory allocated to this resource is still in effect.
+ * It can become invalid if its context is destroyed or lost, in which case it
+ * should no longer count against the GrResourceCache budget.
+ *
+ * @return true if this resource is still holding GPU memory
+ * false otherwise.
+ */
+ virtual bool isValidOnGpu() const = 0;
+
+ void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEntry; }
+ GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; }
+
+ /**
+ * Gets an id that is unique for this GrCacheable object. It is static in that it does
+ * not change when the content of the GrCacheable object changes. This will never return
+ * 0.
+ */
+ uint32_t getGenerationID() const;
+
+protected:
+ GrCacheable()
+ : fCacheEntry(NULL)
+ , fGenID(0) {}
+
+ bool isInCache() const { return NULL != fCacheEntry; }
+
+ /**
+ * This entry point should be called whenever gpuMemorySize() begins
+ * reporting a different size. If the object is in the cache, it will call
+ * gpuMemorySize() immediately and pass the new size on to the resource
+ * cache.
+ */
+ void didChangeGpuMemorySize() const;
+
+private:
+ GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
+ mutable uint32_t fGenID;
+
+ typedef SkRefCnt INHERITED;
+};
+
+#endif
diff --git a/chromium/third_party/skia/include/gpu/GrClipData.h b/chromium/third_party/skia/include/gpu/GrClipData.h
index bced74183b3..1dc4b0d5f8c 100644
--- a/chromium/third_party/skia/include/gpu/GrClipData.h
+++ b/chromium/third_party/skia/include/gpu/GrClipData.h
@@ -9,8 +9,8 @@
#define GrClip_DEFINED
#include "SkClipStack.h"
+#include "GrSurface.h"
-class GrSurface;
struct SkIRect;
/**
@@ -20,7 +20,7 @@ struct SkIRect;
* device coordinates (i.e., they have been translated by -fOrigin w.r.t.
* the canvas' device coordinates).
*/
-class GrClipData : public SkNoncopyable {
+class GrClipData : SkNoncopyable {
public:
const SkClipStack* fClipStack;
SkIPoint fOrigin;
@@ -48,6 +48,13 @@ public:
void getConservativeBounds(const GrSurface* surface,
SkIRect* devResult,
+ bool* isIntersectionOfRects = NULL) const {
+ this->getConservativeBounds(surface->width(), surface->height(),
+ devResult, isIntersectionOfRects);
+ }
+
+ void getConservativeBounds(int width, int height,
+ SkIRect* devResult,
bool* isIntersectionOfRects = NULL) const;
};
diff --git a/chromium/third_party/skia/include/gpu/GrColor.h b/chromium/third_party/skia/include/gpu/GrColor.h
index cf7e7df8431..1994cc50107 100644
--- a/chromium/third_party/skia/include/gpu/GrColor.h
+++ b/chromium/third_party/skia/include/gpu/GrColor.h
@@ -14,21 +14,26 @@
#include "GrTypes.h"
/**
- * GrColor is 4 bytes for R, G, B, A, in a compile-time specific order. The
- * components are stored premultiplied.
+ * GrColor is 4 bytes for R, G, B, A, in a specific order defined below. The components are stored
+ * premultiplied.
*/
typedef uint32_t GrColor;
-
// shift amount to assign a component to a GrColor int
// These shift values are chosen for compatibility with GL attrib arrays
// ES doesn't allow BGRA vertex attrib order so if they were not in this order
-// we'd have to swizzle in shaders. Note the assumption that the cpu is little
-// endian.
-#define GrColor_SHIFT_R 0
-#define GrColor_SHIFT_G 8
-#define GrColor_SHIFT_B 16
-#define GrColor_SHIFT_A 24
+// we'd have to swizzle in shaders.
+#ifdef SK_CPU_BENDIAN
+ #define GrColor_SHIFT_R 24
+ #define GrColor_SHIFT_G 16
+ #define GrColor_SHIFT_B 8
+ #define GrColor_SHIFT_A 0
+#else
+ #define GrColor_SHIFT_R 0
+ #define GrColor_SHIFT_G 8
+ #define GrColor_SHIFT_B 16
+ #define GrColor_SHIFT_A 24
+#endif
/**
* Pack 4 components (RGBA) into a GrColor int
@@ -58,6 +63,22 @@ static inline GrColor GrColorPackRGBA(unsigned r, unsigned g,
*/
#define GrColor_ILLEGAL (~(0xFF << GrColor_SHIFT_A))
+/**
+ * Assert in debug builds that a GrColor is premultiplied.
+ */
+static inline void GrColorIsPMAssert(GrColor c) {
+#ifdef SK_DEBUG
+ unsigned a = GrColorUnpackA(c);
+ unsigned r = GrColorUnpackR(c);
+ unsigned g = GrColorUnpackG(c);
+ unsigned b = GrColorUnpackB(c);
+
+ SkASSERT(r <= a);
+ SkASSERT(g <= a);
+ SkASSERT(b <= a);
+#endif
+}
+
/** Converts a GrColor to an rgba array of GrGLfloat */
static inline void GrColorToRGBAFloat(GrColor color, float rgba[4]) {
static const float ONE_OVER_255 = 1.f / 255.f;
@@ -85,7 +106,7 @@ enum GrColorComponentFlags {
};
static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) {
- SkASSERT(GrIsPow2(component));
+ SkASSERT(SkIsPow2(component));
switch (component) {
case kR_GrColorComponentFlag:
return 'r';
@@ -96,7 +117,7 @@ static inline char GrColorComponentFlagToChar(GrColorComponentFlags component) {
case kA_GrColorComponentFlag:
return 'a';
default:
- GrCrash("Invalid color component flag.");
+ SkFAIL("Invalid color component flag.");
return '\0';
}
}
@@ -111,6 +132,8 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
kRGBA_GrColorComponentFlags, // kRGBA_4444_GrPixelConfig
kRGBA_GrColorComponentFlags, // kRGBA_8888_GrPixelConfig
kRGBA_GrColorComponentFlags, // kBGRA_8888_GrPixelConfig
+ kRGB_GrColorComponentFlags, // kETC1_GrPixelConfig
+ kA_GrColorComponentFlag, // kLATC_GrPixelConfig
};
return kFlags[config];
@@ -121,6 +144,8 @@ static inline uint32_t GrPixelConfigComponentMask(GrPixelConfig config) {
GR_STATIC_ASSERT(4 == kRGBA_4444_GrPixelConfig);
GR_STATIC_ASSERT(5 == kRGBA_8888_GrPixelConfig);
GR_STATIC_ASSERT(6 == kBGRA_8888_GrPixelConfig);
+ GR_STATIC_ASSERT(7 == kETC1_GrPixelConfig);
+ GR_STATIC_ASSERT(8 == kLATC_GrPixelConfig);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kFlags) == kGrPixelConfigCnt);
}
diff --git a/chromium/third_party/skia/include/gpu/GrConfig.h b/chromium/third_party/skia/include/gpu/GrConfig.h
index fc464c5038b..c0d90a36804 100644
--- a/chromium/third_party/skia/include/gpu/GrConfig.h
+++ b/chromium/third_party/skia/include/gpu/GrConfig.h
@@ -178,15 +178,6 @@ typedef unsigned __int64 uint64_t;
#define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND)
/**
- * Crash from unrecoverable condition, optionally with a message. The debug variants only
- * crash in a debug build. The message versions print the message regardless of release vs debug.
- */
-inline void GrCrash() { GrAlwaysAssert(false); }
-inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); }
-inline void GrDebugCrash() { SkASSERT(false); }
-inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); }
-
-/**
* GR_STATIC_ASSERT is a compile time assertion. Depending on the platform
* it may print the message in the compiler log. Obviously, the condition must
* be evaluatable at compile time.
@@ -206,13 +197,13 @@ inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); }
#endif
/**
- * GR_GEOM_BUFFER_LOCK_THRESHOLD gives a threshold (in bytes) for when Gr should
- * lock a GrGeometryBuffer to update its contents. It will use lock() if the
+ * GR_GEOM_BUFFER_MAP_THRESHOLD gives a threshold (in bytes) for when Gr should
+ * map a GrGeometryBuffer to update its contents. It will use map() if the
* size of the updated region is greater than the threshold. Otherwise it will
* use updateData().
*/
-#if !defined(GR_GEOM_BUFFER_LOCK_THRESHOLD)
- #define GR_GEOM_BUFFER_LOCK_THRESHOLD (1 << 15)
+#if !defined(GR_GEOM_BUFFER_MAP_THRESHOLD)
+ #define GR_GEOM_BUFFER_MAP_THRESHOLD (1 << 15)
#endif
/**
diff --git a/chromium/third_party/skia/include/gpu/GrContext.h b/chromium/third_party/skia/include/gpu/GrContext.h
index 1770fa6ee4d..608ec507b29 100644
--- a/chromium/third_party/skia/include/gpu/GrContext.h
+++ b/chromium/third_party/skia/include/gpu/GrContext.h
@@ -12,22 +12,25 @@
#include "GrColor.h"
#include "GrPaint.h"
#include "GrPathRendererChain.h"
-#include "GrPoint.h"
#include "GrRenderTarget.h"
#include "GrTexture.h"
#include "SkMatrix.h"
+#include "SkPathEffect.h"
#include "SkTypes.h"
class GrAARectRenderer;
class GrAutoScratchTexture;
+class GrCacheable;
class GrDrawState;
class GrDrawTarget;
class GrEffect;
class GrFontCache;
class GrGpu;
+class GrGpuTraceMarker;
class GrIndexBuffer;
class GrIndexBufferAllocPool;
class GrInOrderDrawBuffer;
+class GrLayerCache;
class GrOvalRenderer;
class GrPath;
class GrPathRenderer;
@@ -38,6 +41,7 @@ class GrTestTarget;
class GrTextureParams;
class GrVertexBuffer;
class GrVertexBufferAllocPool;
+class GrStrokeInfo;
class GrSoftwarePathRenderer;
class SkStrokeRec;
@@ -86,8 +90,8 @@ public:
* buffer, etc. references/IDs are now invalid. Should be called even when
* GrContext is no longer going to be used for two reasons:
* 1) ~GrContext will not try to free the objects in the 3D API.
- * 2) If you've created GrResources that outlive the GrContext they will
- * be marked as invalid (GrResource::isValid()) and won't attempt to
+ * 2) If you've created GrGpuObjects that outlive the GrContext they will
+ * be marked as invalid (GrGpuObjects::isValid()) and won't attempt to
* free their underlying resource in the 3D API.
* Content drawn since the last GrContext::flush() may be lost.
*/
@@ -100,6 +104,62 @@ public:
*/
void contextDestroyed();
+ ///////////////////////////////////////////////////////////////////////////
+ // Resource Cache
+
+ /**
+ * Return the current GPU resource cache limits.
+ *
+ * @param maxResources If non-null, returns maximum number of resources that
+ * can be held in the cache.
+ * @param maxResourceBytes If non-null, returns maximum number of bytes of
+ * video memory that can be held in the cache.
+ */
+ void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const;
+ SK_ATTR_DEPRECATED("This function has been renamed to getResourceCacheLimits().")
+ void getTextureCacheLimits(int* maxTextures, size_t* maxTextureBytes) const {
+ this->getResourceCacheLimits(maxTextures, maxTextureBytes);
+ }
+
+ /**
+ * Gets the current GPU resource cache usage.
+ *
+ * @param resourceCount If non-null, returns the number of resources that are held in the
+ * cache.
+ * @param maxResourceBytes If non-null, returns the total number of bytes of video memory held
+ * in the cache.
+ */
+ void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const;
+
+ SK_ATTR_DEPRECATED("Use getResourceCacheUsage().")
+ size_t getGpuTextureCacheBytes() const {
+ size_t bytes;
+ this->getResourceCacheUsage(NULL, &bytes);
+ return bytes;
+ }
+
+ SK_ATTR_DEPRECATED("Use getResourceCacheUsage().")
+ int getGpuTextureCacheResourceCount() const {
+ int count;
+ this->getResourceCacheUsage(&count, NULL);
+ return count;
+ }
+
+ /**
+ * Specify the GPU resource cache limits. If the current cache exceeds either
+ * of these, it will be purged (LRU) to keep the cache within these limits.
+ *
+ * @param maxResources The maximum number of resources that can be held in
+ * the cache.
+ * @param maxResourceBytes The maximum number of bytes of video memory
+ * that can be held in the cache.
+ */
+ void setResourceCacheLimits(int maxResources, size_t maxResourceBytes);
+ SK_ATTR_DEPRECATED("This function has been renamed to setResourceCacheLimits().")
+ void setTextureCacheLimits(int maxTextures, size_t maxTextureBytes) {
+ this->setResourceCacheLimits(maxTextures, maxTextureBytes);
+ }
+
/**
* Frees GPU created by the context. Can be called to reduce GPU memory
* pressure.
@@ -107,9 +167,32 @@ public:
void freeGpuResources();
/**
- * Returns the number of bytes of GPU memory hosted by the texture cache.
+ * This method should be called whenever a GrResource is unreffed or
+ * switched from exclusive to non-exclusive. This
+ * gives the resource cache a chance to discard unneeded resources.
+ * Note: this entry point will be removed once totally ref-driven
+ * cache maintenance is implemented.
+ */
+ void purgeCache();
+
+ /**
+ * Purge all the unlocked resources from the cache.
+ * This entry point is mainly meant for timing texture uploads
+ * and is not defined in normal builds of Skia.
*/
- size_t getGpuTextureCacheBytes() const;
+ void purgeAllUnlockedResources();
+
+ /**
+ * Stores a custom resource in the cache, based on the specified key.
+ */
+ void addResourceToCache(const GrResourceKey&, GrCacheable*);
+
+ /**
+ * Finds a resource in the cache, based on the specified key. This is intended for use in
+ * conjunction with addResourceToCache(). The return value will be NULL if not found. The
+ * caller must balance with a call to unref().
+ */
+ GrCacheable* findAndRefCachedResource(const GrResourceKey&);
///////////////////////////////////////////////////////////////////////////
// Textures
@@ -123,19 +206,19 @@ public:
* for different wrap modes on GPUs with limited NPOT
* texture support). NULL implies clamp wrap modes.
* @param desc Description of the texture properties.
- * @param cacheID Cache-specific properties (e.g., texture gen ID)
+ * @param cacheID Cache-specific properties (e.g., texture gen ID)
* @param srcData Pointer to the pixel values.
* @param rowBytes The number of bytes between rows of the texture. Zero
- * implies tightly packed rows.
+ * implies tightly packed rows. For compressed pixel configs, this
+ * field is ignored.
* @param cacheKey (optional) If non-NULL, we'll write the cache key we used to cacheKey.
*/
GrTexture* createTexture(const GrTextureParams* params,
const GrTextureDesc& desc,
const GrCacheID& cacheID,
- void* srcData,
+ const void* srcData,
size_t rowBytes,
GrResourceKey* cacheKey = NULL);
-
/**
* Search for an entry based on key and dimensions. If found, ref it and return it. The return
* value will be NULL if not found. The caller must balance with a call to unref.
@@ -201,15 +284,6 @@ public:
void unlockScratchTexture(GrTexture* texture);
/**
- * This method should be called whenever a GrTexture is unreffed or
- * switched from exclusive to non-exclusive. This
- * gives the resource cache a chance to discard unneeded textures.
- * Note: this entry point will be removed once totally ref-driven
- * cache maintenance is implemented
- */
- void purgeCache();
-
- /**
* Creates a texture that is outside the cache. Does not count against
* cache's budget.
*/
@@ -228,27 +302,6 @@ public:
int height) const;
/**
- * Return the current texture cache limits.
- *
- * @param maxTextures If non-null, returns maximum number of textures that
- * can be held in the cache.
- * @param maxTextureBytes If non-null, returns maximum number of bytes of
- * texture memory that can be held in the cache.
- */
- void getTextureCacheLimits(int* maxTextures, size_t* maxTextureBytes) const;
-
- /**
- * Specify the texture cache limits. If the current cache exceeds either
- * of these, it will be purged (LRU) to keep the cache within these limits.
- *
- * @param maxTextures The maximum number of textures that can be held in
- * the cache.
- * @param maxTextureBytes The maximum number of bytes of texture memory
- * that can be held in the cache.
- */
- void setTextureCacheLimits(int maxTextures, size_t maxTextureBytes);
-
- /**
* Return the max width or height of a texture supported by the current GPU.
*/
int getMaxTextureSize() const;
@@ -280,8 +333,6 @@ public:
const GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); }
GrRenderTarget* getRenderTarget() { return fRenderTarget.get(); }
- GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
-
/**
* Can the provided configuration act as a color render target?
*/
@@ -299,6 +350,19 @@ public:
*/
int getMaxSampleCount() const;
+ /**
+ * Returns the recommended sample count for a render target when using this
+ * context.
+ *
+ * @param config the configuration of the render target.
+ * @param dpi the display density in dots per inch.
+ *
+ * @return sample count that should be perform well and have good enough
+ * rendering quality for the display. Alternatively returns 0 if
+ * MSAA is not supported or recommended to be used by default.
+ */
+ int getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) const;
+
///////////////////////////////////////////////////////////////////////////
// Backend Surfaces
@@ -391,18 +455,20 @@ public:
/**
* Draw the rect using a paint.
* @param paint describes how to color pixels.
- * @param stroke the stroke information (width, join, cap).
- * If stroke == NULL, then the rect is filled.
+ * @param strokeInfo the stroke information (width, join, cap), and.
+ * the dash information (intervals, count, phase).
+ * If strokeInfo == NULL, then the rect is filled.
* Otherwise, if stroke width == 0, then the stroke
* is always a single pixel thick, else the rect is
* mitered/beveled stroked based on stroke width.
+ * If the stroke is dashed the rect is sent to drawPath.
* @param matrix Optional matrix applied to the rect. Applied before
* context's matrix or the paint's matrix.
* The rects coords are used to access the paint (through texture matrix)
*/
void drawRect(const GrPaint& paint,
const SkRect&,
- const SkStrokeRec* stroke = NULL,
+ const GrStrokeInfo* strokeInfo = NULL,
const SkMatrix* matrix = NULL);
/**
@@ -429,20 +495,32 @@ public:
*
* @param paint describes how to color pixels.
* @param rrect the roundrect to draw
- * @param stroke the stroke information (width, join, cap)
+ * @param strokeInfo the stroke information (width, join, cap) and
+ * the dash information (intervals, count, phase).
*/
- void drawRRect(const GrPaint& paint,
- const SkRRect& rrect,
- const SkStrokeRec& stroke);
+ void drawRRect(const GrPaint& paint, const SkRRect& rrect, const GrStrokeInfo& strokeInfo);
+
+ /**
+ * Shortcut for drawing an SkPath consisting of nested rrects using a paint.
+ * Does not support stroking. The result is undefined if outer does not contain
+ * inner.
+ *
+ * @param paint describes how to color pixels.
+ * @param outer the outer roundrect
+ * @param inner the inner roundrect
+ */
+ void drawDRRect(const GrPaint& paint, const SkRRect& outer, const SkRRect& inner);
+
/**
* Draws a path.
*
* @param paint describes how to color pixels.
* @param path the path to draw
- * @param stroke the stroke information (width, join, cap)
+ * @param strokeInfo the stroke information (width, join, cap) and
+ * the dash information (intervals, count, phase).
*/
- void drawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& stroke);
+ void drawPath(const GrPaint& paint, const SkPath& path, const GrStrokeInfo& strokeInfo);
/**
* Draws vertices with a paint.
@@ -463,8 +541,8 @@ public:
void drawVertices(const GrPaint& paint,
GrPrimitiveType primitiveType,
int vertexCount,
- const GrPoint positions[],
- const GrPoint texs[],
+ const SkPoint positions[],
+ const SkPoint texs[],
const GrColor colors[],
const uint16_t indices[],
int indexCount);
@@ -474,11 +552,12 @@ public:
*
* @param paint describes how to color pixels.
* @param oval the bounding rect of the oval.
- * @param stroke the stroke information (width, style)
+ * @param strokeInfo the stroke information (width, join, cap) and
+ * the dash information (intervals, count, phase).
*/
void drawOval(const GrPaint& paint,
const SkRect& oval,
- const SkStrokeRec& stroke);
+ const GrStrokeInfo& strokeInfo);
///////////////////////////////////////////////////////////////////////////
// Misc.
@@ -605,7 +684,6 @@ public:
size_t rowBytes,
uint32_t pixelOpsFlags = 0);
-
/**
* Copies a rectangle of texels from src to dst. The size of dst is the size of the rectangle
* copied and topLeft is the position of the rect in src. The rectangle is clipped to src's
@@ -628,7 +706,13 @@ public:
* perform a resolve to a GrTexture used as the source of a draw or before
* reading pixels back from a GrTexture or GrRenderTarget.
*/
- void resolveRenderTarget(GrRenderTarget* target);
+ void resolveRenderTarget(GrRenderTarget*);
+
+ /**
+ * Provides a perfomance hint that the render target's contents are allowed
+ * to become undefined.
+ */
+ void discardRenderTarget(GrRenderTarget*);
#ifdef SK_DEVELOPER
void dumpFontCache() const;
@@ -829,12 +913,22 @@ public:
GrGpu* getGpu() { return fGpu; }
const GrGpu* getGpu() const { return fGpu; }
GrFontCache* getFontCache() { return fFontCache; }
+ GrLayerCache* getLayerCache() { return fLayerCache.get(); }
GrDrawTarget* getTextTarget();
const GrIndexBuffer* getQuadIndexBuffer() const;
+ GrAARectRenderer* getAARectRenderer() { return fAARectRenderer; }
// Called by tests that draw directly to the context via GrDrawTarget
void getTestTarget(GrTestTarget*);
+ // Functions for managing gpu trace markers
+ bool isGpuTracingEnabled() const { return fGpuTracingEnabled; }
+ void enableGpuTracing() { fGpuTracingEnabled = true; }
+ void disableGpuTracing() { fGpuTracingEnabled = false; }
+
+ void addGpuTraceMarker(const GrGpuTraceMarker* marker);
+ void removeGpuTraceMarker(const GrGpuTraceMarker* marker);
+
/**
* Stencil buffers add themselves to the cache using addStencilBuffer. findStencilBuffer is
* called to check the cache for a SB that matches an RT's criteria.
@@ -850,7 +944,6 @@ public:
GrPathRendererChain::DrawType drawType = GrPathRendererChain::kColor_DrawType,
GrPathRendererChain::StencilSupport* stencilSupport = NULL);
-
#if GR_CACHE_STATS
void printCacheStats() const;
#endif
@@ -869,8 +962,9 @@ private:
const GrClipData* fClip; // TODO: make this ref counted
GrDrawState* fDrawState;
- GrResourceCache* fTextureCache;
+ GrResourceCache* fResourceCache;
GrFontCache* fFontCache;
+ SkAutoTDelete<GrLayerCache> fLayerCache;
GrPathRendererChain* fPathRendererChain;
GrSoftwarePathRenderer* fSoftwarePathRenderer;
@@ -898,6 +992,8 @@ private:
int fMaxTextureSizeOverride;
+ bool fGpuTracingEnabled;
+
GrContext(); // init must be called after the constructor.
bool init(GrBackend, GrBackendContext);
@@ -910,11 +1006,11 @@ private:
GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects*, AutoCheckFlush*);
void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path,
- const SkStrokeRec& stroke);
+ const GrStrokeInfo& stroke);
GrTexture* createResizedTexture(const GrTextureDesc& desc,
const GrCacheID& cacheID,
- void* srcData,
+ const void* srcData,
size_t rowBytes,
bool filter);
@@ -1012,7 +1108,7 @@ public:
// lets go of the ref and the ref count goes to 0 internal_dispose will see this flag is
// set and re-ref the texture, thereby restoring the cache's ref.
SkASSERT(texture->getRefCnt() > 1);
- texture->setFlag((GrTextureFlags) GrTexture::kReturnToCache_FlagBit);
+ texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_FlagBit);
texture->unref();
SkASSERT(NULL != texture->getCacheEntry());
diff --git a/chromium/third_party/skia/include/gpu/GrContextFactory.h b/chromium/third_party/skia/include/gpu/GrContextFactory.h
index 389c398c7c5..f09bad932b8 100644
--- a/chromium/third_party/skia/include/gpu/GrContextFactory.h
+++ b/chromium/third_party/skia/include/gpu/GrContextFactory.h
@@ -26,12 +26,15 @@
* GrContexts backed by different types of GL contexts. It manages creating the
* GL context and a GrContext that uses it. The GL/Gr contexts persist until the
* factory is destroyed (though the caller can always grab a ref on the returned
- * GrContext to make it outlive the factory).
+ * Gr and GL contexts to make them outlive the factory).
*/
-class GrContextFactory : public SkNoncopyable {
+class GrContextFactory : SkNoncopyable {
public:
/**
- * Types of GL contexts supported.
+ * Types of GL contexts supported. For historical and testing reasons the native GrContext will
+ * not use "GL_NV_path_rendering" even when the driver supports it. There is a separate context
+ * type that does not remove NVPR support and which will fail when the driver does not support
+ * the extension.
*/
enum GLContextType {
kNative_GLContextType,
@@ -41,6 +44,9 @@ public:
#if SK_MESA
kMESA_GLContextType,
#endif
+ /** Similar to kNative but does not filter NVPR. It will fail if the GL driver does not
+ support NVPR */
+ kNVPR_GLContextType,
kNull_GLContextType,
kDebug_GLContextType,
@@ -73,10 +79,12 @@ public:
case kMESA_GLContextType:
return "mesa";
#endif
+ case kNVPR_GLContextType:
+ return "nvpr";
case kDebug_GLContextType:
return "debug";
default:
- GrCrash("Unknown GL Context type.");
+ SkFAIL("Unknown GL Context type.");
}
}
@@ -87,6 +95,7 @@ public:
void destroyContexts() {
for (int i = 0; i < fContexts.count(); ++i) {
+ fContexts[i].fGLContext->makeCurrent();
fContexts[i].fGrContext->unref();
fContexts[i].fGLContext->unref();
}
@@ -107,6 +116,7 @@ public:
SkAutoTUnref<SkGLContextHelper> glCtx;
SkAutoTUnref<GrContext> grCtx;
switch (type) {
+ case kNVPR_GLContextType: // fallthru
case kNative_GLContextType:
glCtx.reset(SkNEW(SkNativeGLContext));
break;
@@ -134,7 +144,22 @@ public:
if (!glCtx.get()->init(kBogusSize, kBogusSize)) {
return NULL;
}
- GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glCtx.get()->gl());
+
+ // Ensure NVPR is available for the NVPR type and block it from other types.
+ SkAutoTUnref<const GrGLInterface> glInterface(SkRef(glCtx.get()->gl()));
+ if (kNVPR_GLContextType == type) {
+ if (!glInterface->hasExtension("GL_NV_path_rendering")) {
+ return NULL;
+ }
+ } else {
+ glInterface.reset(GrGLInterfaceRemoveNVPR(glInterface));
+ if (!glInterface) {
+ return NULL;
+ }
+ }
+
+ glCtx->makeCurrent();
+ GrBackendContext p3dctx = reinterpret_cast<GrBackendContext>(glInterface.get());
grCtx.reset(GrContext::Create(kOpenGL_GrBackend, p3dctx));
if (!grCtx.get()) {
return NULL;
diff --git a/chromium/third_party/skia/include/gpu/GrCoordTransform.h b/chromium/third_party/skia/include/gpu/GrCoordTransform.h
index 14e2620e44b..f266577ec62 100644
--- a/chromium/third_party/skia/include/gpu/GrCoordTransform.h
+++ b/chromium/third_party/skia/include/gpu/GrCoordTransform.h
@@ -39,7 +39,7 @@ enum GrCoordSet {
* position). GrEffects just define these transformations, and the framework does the rest of the
* work to make the transformed coordinates available in their fragment shader.
*/
-class GrCoordTransform : public SkNoncopyable {
+class GrCoordTransform : SkNoncopyable {
public:
GrCoordTransform() { SkDEBUGCODE(fInEffect = false); }
diff --git a/chromium/third_party/skia/include/gpu/GrDistanceFieldTextContext.h b/chromium/third_party/skia/include/gpu/GrDistanceFieldTextContext.h
deleted file mode 100755
index 217faf3cb02..00000000000
--- a/chromium/third_party/skia/include/gpu/GrDistanceFieldTextContext.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrDistanceFieldTextContext_DEFINED
-#define GrDistanceFieldTextContext_DEFINED
-
-#include "GrTextContext.h"
-
-class GrTextStrike;
-
-/*
- * This class implements GrTextContext using distance field fonts
- */
-class GrDistanceFieldTextContext : public GrTextContext {
-public:
- GrDistanceFieldTextContext(GrContext*, const GrPaint&, SkColor, SkScalar textRatio);
- virtual ~GrDistanceFieldTextContext();
-
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) SK_OVERRIDE;
-
-private:
- GrTextStrike* fStrike;
- SkScalar fTextRatio;
-
- void flushGlyphs(); // automatically called by destructor
-
- enum {
- kMinRequestedGlyphs = 1,
- kDefaultRequestedGlyphs = 64,
- kMinRequestedVerts = kMinRequestedGlyphs * 4,
- kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
- };
-
- SkColor fSkPaintColor;
- SkPoint* fVertices;
- int32_t fMaxVertices;
- GrTexture* fCurrTexture;
- int fCurrVertex;
-};
-
-#endif
diff --git a/chromium/third_party/skia/include/gpu/GrEffectUnitTest.h b/chromium/third_party/skia/include/gpu/GrEffectUnitTest.h
index f0089c9df4d..f71ab54e7e3 100644
--- a/chromium/third_party/skia/include/gpu/GrEffectUnitTest.h
+++ b/chromium/third_party/skia/include/gpu/GrEffectUnitTest.h
@@ -35,7 +35,7 @@ class GrContext;
class GrEffectRef;
class GrTexture;
-class GrEffectTestFactory : public SkNoncopyable {
+class GrEffectTestFactory : SkNoncopyable {
public:
typedef GrEffectRef* (*CreateProc)(SkRandom*,
@@ -67,7 +67,7 @@ private:
*/
#define GR_DECLARE_EFFECT_TEST \
static GrEffectTestFactory gTestFactory; \
- static GrEffectRef* TestCreate(SkRandom*, \
+ static GrEffectRef* TestCreate(SkRandom*, \
GrContext*, \
const GrDrawTargetCaps&, \
GrTexture* dummyTextures[2])
@@ -91,7 +91,7 @@ private:
// The unit test relies on static initializers. Just declare the TestCreate function so that
// its definitions will compile.
#define GR_DECLARE_EFFECT_TEST \
- static GrEffectRef* TestCreate(SkRandom*, \
+ static GrEffectRef* TestCreate(SkRandom*, \
GrContext*, \
const GrDrawTargetCaps&, \
GrTexture* dummyTextures[2])
diff --git a/chromium/third_party/skia/include/gpu/GrFontScaler.h b/chromium/third_party/skia/include/gpu/GrFontScaler.h
index e51c4ac9a50..0132d513042 100644
--- a/chromium/third_party/skia/include/gpu/GrFontScaler.h
+++ b/chromium/third_party/skia/include/gpu/GrFontScaler.h
@@ -18,7 +18,7 @@ class SkPath;
* font scaler.
*
* The client is responsible for subclassing, and instantiating this. The
- * instance is create for a specific font+size+matrix.
+ * instance is created for a specific font+size+matrix.
*/
class GrFontScaler : public SkRefCnt {
public:
@@ -29,6 +29,12 @@ public:
virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds) = 0;
virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
int rowBytes, void* image) = 0;
+ // get bounds for distance field associated with packed ID
+ virtual bool getPackedGlyphDFBounds(GrGlyph::PackedID, SkIRect* bounds) = 0;
+ // copies distance field bytes into pre-allocated dfImage
+ // (should be width*height bytes in size)
+ virtual bool getPackedGlyphDFImage(GrGlyph::PackedID, int width, int height,
+ void* dfImage) = 0;
virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0;
private:
diff --git a/chromium/third_party/skia/include/gpu/GrGlyph.h b/chromium/third_party/skia/include/gpu/GrGlyph.h
index fe4c835773c..a7d834153f4 100644
--- a/chromium/third_party/skia/include/gpu/GrGlyph.h
+++ b/chromium/third_party/skia/include/gpu/GrGlyph.h
@@ -26,7 +26,7 @@ struct GrGlyph {
SkPath* fPath;
PackedID fPackedID;
GrIRect16 fBounds;
- GrIPoint16 fAtlasLocation;
+ SkIPoint16 fAtlasLocation;
void init(GrGlyph::PackedID packed, const SkIRect& bounds) {
fPlot = NULL;
@@ -50,22 +50,22 @@ struct GrGlyph {
///////////////////////////////////////////////////////////////////////////
- static inline unsigned ExtractSubPixelBitsFromFixed(GrFixed pos) {
+ static inline unsigned ExtractSubPixelBitsFromFixed(SkFixed pos) {
// two most significant fraction bits from fixed-point
return (pos >> 14) & 3;
}
- static inline PackedID Pack(uint16_t glyphID, GrFixed x, GrFixed y) {
+ static inline PackedID Pack(uint16_t glyphID, SkFixed x, SkFixed y) {
x = ExtractSubPixelBitsFromFixed(x);
y = ExtractSubPixelBitsFromFixed(y);
return (x << 18) | (y << 16) | glyphID;
}
- static inline GrFixed UnpackFixedX(PackedID packed) {
+ static inline SkFixed UnpackFixedX(PackedID packed) {
return ((packed >> 18) & 3) << 14;
}
- static inline GrFixed UnpackFixedY(PackedID packed) {
+ static inline SkFixed UnpackFixedY(PackedID packed) {
return ((packed >> 16) & 3) << 14;
}
diff --git a/chromium/third_party/skia/include/gpu/GrResource.h b/chromium/third_party/skia/include/gpu/GrGpuObject.h
index 93dec58d806..72d2f892be9 100644
--- a/chromium/third_party/skia/include/gpu/GrResource.h
+++ b/chromium/third_party/skia/include/gpu/GrGpuObject.h
@@ -5,26 +5,25 @@
* found in the LICENSE file.
*/
-#ifndef GrResource_DEFINED
-#define GrResource_DEFINED
+#ifndef GrGpuObject_DEFINED
+#define GrGpuObject_DEFINED
-#include "SkRefCnt.h"
+#include "GrCacheable.h"
#include "SkTInternalLList.h"
class GrGpu;
class GrContext;
-class GrResourceEntry;
/**
- * Base class for the GPU resources created by a GrContext.
+ * Base class for the GPU objects created by a GrContext.
*/
-class GrResource : public SkRefCnt {
+class GrGpuObject : public GrCacheable {
public:
- SK_DECLARE_INST_COUNT(GrResource)
+ SK_DECLARE_INST_COUNT(GrGpuObject)
/**
- * Frees the resource in the underlying 3D API. It must be safe to call this
- * when the resource has been previously abandoned.
+ * Frees the object in the underlying 3D API. It must be safe to call this
+ * when the object has been previously abandoned.
*/
void release();
@@ -35,37 +34,26 @@ public:
void abandon();
/**
- * Tests whether a resource has been abandoned or released. All resources
- * will be in this state after their creating GrContext is destroyed or has
- * contextLost called. It's up to the client to test isValid() before
- * attempting to use a resource if it holds refs on resources across
+ * Tests whether a object has been abandoned or released. All objects will
+ * be in this state after their creating GrContext is destroyed or has
+ * contextLost called. It's up to the client to test wasDestroyed() before
+ * attempting to use an object if it holds refs on objects across
* ~GrContext, freeResources with the force flag, or contextLost.
*
- * @return true if the resource has been released or abandoned,
+ * @return true if the object has been released or abandoned,
* false otherwise.
*/
- bool isValid() const { return NULL != fGpu; }
+ bool wasDestroyed() const { return NULL == fGpu; }
/**
- * Retrieves the size of the object in GPU memory. This is approximate since
- * we aren't aware of additional padding or copies made by the driver.
- *
- * @return the size of the buffer in bytes
- */
- virtual size_t sizeInBytes() const = 0;
-
- /**
- * Retrieves the context that owns the resource. Note that it is possible
- * for this to return NULL. When resources have been release()ed or
- * abandon()ed they no longer have an owning context. Destroying a
- * GrContext automatically releases all its resources.
+ * Retrieves the context that owns the object. Note that it is possible for
+ * this to return NULL. When objects have been release()ed or abandon()ed
+ * they no longer have an owning context. Destroying a GrContext
+ * automatically releases all its resources.
*/
const GrContext* getContext() const;
GrContext* getContext();
- void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry; }
- GrResourceEntry* getCacheEntry() { return fCacheEntry; }
-
void incDeferredRefCount() const {
SkASSERT(fDeferredRefCount >= 0);
++fDeferredRefCount;
@@ -84,14 +72,16 @@ public:
void setNeedsDeferredUnref() { fFlags |= kDeferredUnref_FlagBit; }
+ virtual bool isValidOnGpu() const SK_OVERRIDE { return !this->wasDestroyed(); }
+
protected:
/**
- * isWrapped indicates we have wrapped a client-created backend resource in a GrResource. If it
- * is true then the client is responsible for the lifetime of the underlying backend resource.
- * Otherwise, our onRelease() should free the resource.
+ * isWrapped indicates we have wrapped a client-created backend object in a GrGpuObject. If it
+ * is true then the client is responsible for the lifetime of the underlying backend object.
+ * Otherwise, our onRelease() should free the object.
*/
- GrResource(GrGpu* gpu, bool isWrapped);
- virtual ~GrResource();
+ GrGpuObject(GrGpu* gpu, bool isWrapped);
+ virtual ~GrGpuObject();
GrGpu* getGpu() const { return fGpu; }
@@ -100,7 +90,6 @@ protected:
virtual void onRelease() {};
virtual void onAbandon() {};
- bool isInCache() const { return NULL != fCacheEntry; }
bool isWrapped() const { return kWrapped_FlagBit & fFlags; }
bool needsDeferredUnref() const { return SkToBool(kDeferredUnref_FlagBit & fFlags); }
@@ -110,18 +99,16 @@ private:
#endif
// We're in an internal doubly linked list
- SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResource);
+ SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuObject);
GrGpu* fGpu; // not reffed. The GrGpu can be deleted while there
- // are still live GrResources. It will call
- // release() on all such resources in its
- // destructor.
- GrResourceEntry* fCacheEntry; // NULL if not in cache
+ // are still live GrGpuObjects. It will call
+ // release() on all such objects in its destructor.
mutable int fDeferredRefCount; // How many references in deferred drawing buffers.
enum Flags {
/**
- * This resource wraps a GPU resource given to us by the user.
+ * This object wraps a GPU object given to us by the user.
* Lifetime management is left up to the user (i.e., we will not
* free it).
*/
@@ -129,7 +116,7 @@ private:
/**
* This texture should be de-refed when the deferred ref count goes
- * to zero. A resource gets into this state when the resource cache
+ * to zero. An object gets into this state when the resource cache
* is holding a ref-of-obligation (i.e., someone needs to own it but
* no one else wants to) but doesn't really want to keep it around.
*/
@@ -137,7 +124,7 @@ private:
};
uint32_t fFlags;
- typedef SkRefCnt INHERITED;
+ typedef GrCacheable INHERITED;
};
#endif
diff --git a/chromium/third_party/skia/include/gpu/GrPoint.h b/chromium/third_party/skia/include/gpu/GrPoint.h
deleted file mode 100644
index c987b011342..00000000000
--- a/chromium/third_party/skia/include/gpu/GrPoint.h
+++ /dev/null
@@ -1,30 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#ifndef GrPoint_DEFINED
-#define GrPoint_DEFINED
-
-#include "GrTypes.h"
-#include "SkScalar.h"
-#include "SkPoint.h"
-
-#define GrPoint SkPoint
-#define GrVec SkVector
-
-struct GrIPoint16 {
- int16_t fX, fY;
-
- void set(intptr_t x, intptr_t y) {
- fX = GrToS16(x);
- fY = GrToS16(y);
- }
-};
-
-#endif
diff --git a/chromium/third_party/skia/include/gpu/GrRect.h b/chromium/third_party/skia/include/gpu/GrRect.h
index cacc5117b53..ddb23b5a19c 100644
--- a/chromium/third_party/skia/include/gpu/GrRect.h
+++ b/chromium/third_party/skia/include/gpu/GrRect.h
@@ -14,11 +14,19 @@
struct GrIRect16 {
int16_t fLeft, fTop, fRight, fBottom;
+ static GrIRect16 SK_WARN_UNUSED_RESULT MakeEmpty() {
+ GrIRect16 r;
+ r.setEmpty();
+ return r;
+ }
+
int width() const { return fRight - fLeft; }
int height() const { return fBottom - fTop; }
int area() const { return this->width() * this->height(); }
bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
+ void setEmpty() { memset(this, 0, sizeof(*this)); }
+
void set(const SkIRect& r) {
fLeft = SkToS16(r.fLeft);
fTop = SkToS16(r.fTop);
diff --git a/chromium/third_party/skia/include/gpu/GrRenderTarget.h b/chromium/third_party/skia/include/gpu/GrRenderTarget.h
index f43aba9d589..6a3f26fe702 100644
--- a/chromium/third_party/skia/include/gpu/GrRenderTarget.h
+++ b/chromium/third_party/skia/include/gpu/GrRenderTarget.h
@@ -26,7 +26,7 @@ public:
SK_DECLARE_INST_COUNT(GrRenderTarget)
// GrResource overrides
- virtual size_t sizeInBytes() const SK_OVERRIDE;
+ virtual size_t gpuMemorySize() const SK_OVERRIDE;
// GrSurface overrides
/**
@@ -121,6 +121,12 @@ public:
*/
void resolve();
+ /**
+ * Provide a performance hint that the render target's contents are allowed
+ * to become undefined.
+ */
+ void discard();
+
// a MSAA RT may require explicit resolving , it may auto-resolve (e.g. FBO
// 0 in GL), or be unresolvable because the client didn't give us the
// resolve destination.
diff --git a/chromium/third_party/skia/include/gpu/GrSurface.h b/chromium/third_party/skia/include/gpu/GrSurface.h
index 15e44ab5936..a851c9e03c4 100644
--- a/chromium/third_party/skia/include/gpu/GrSurface.h
+++ b/chromium/third_party/skia/include/gpu/GrSurface.h
@@ -10,14 +10,14 @@
#define GrSurface_DEFINED
#include "GrTypes.h"
-#include "GrResource.h"
+#include "GrGpuObject.h"
#include "SkRect.h"
class GrTexture;
class GrRenderTarget;
struct SkImageInfo;
-class GrSurface : public GrResource {
+class GrSurface : public GrGpuObject {
public:
SK_DECLARE_INST_COUNT(GrSurface);
@@ -59,7 +59,7 @@ public:
*/
const GrTextureDesc& desc() const { return fDesc; }
- void asImageInfo(SkImageInfo*) const;
+ SkImageInfo info() const;
/**
* @return the texture associated with the surface, may be NULL.
@@ -144,7 +144,7 @@ protected:
GrTextureDesc fDesc;
private:
- typedef GrResource INHERITED;
+ typedef GrGpuObject INHERITED;
};
#endif // GrSurface_DEFINED
diff --git a/chromium/third_party/skia/include/gpu/GrTBackendEffectFactory.h b/chromium/third_party/skia/include/gpu/GrTBackendEffectFactory.h
index 3711c7e8693..fd14b4fa8ec 100644
--- a/chromium/third_party/skia/include/gpu/GrTBackendEffectFactory.h
+++ b/chromium/third_party/skia/include/gpu/GrTBackendEffectFactory.h
@@ -64,7 +64,7 @@ public:
/** Returns a new instance of the appropriate *GL* implementation class
for the given GrEffect; caller is responsible for deleting
the object. */
- virtual GLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_OVERRIDE {
+ virtual GrGLEffect* createGLInstance(const GrDrawEffect& drawEffect) const SK_OVERRIDE {
return SkNEW_ARGS(GLEffect, (*this, drawEffect));
}
diff --git a/chromium/third_party/skia/include/gpu/GrTextContext.h b/chromium/third_party/skia/include/gpu/GrTextContext.h
deleted file mode 100644
index b367cf228d5..00000000000
--- a/chromium/third_party/skia/include/gpu/GrTextContext.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextContext_DEFINED
-#define GrTextContext_DEFINED
-
-#include "GrContext.h"
-#include "GrGlyph.h"
-#include "GrPaint.h"
-
-class GrContext;
-class GrDrawTarget;
-class GrFontScaler;
-
-/*
- * This class wraps the state for a single text render
- */
-class GrTextContext {
-public:
- virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
- GrFontScaler*) = 0;
-
-protected:
- GrTextContext(GrContext*, const GrPaint&);
- virtual ~GrTextContext() {}
-
- GrPaint fPaint;
- GrContext* fContext;
- GrDrawTarget* fDrawTarget;
-
- SkIRect fClipRect;
-
-private:
-};
-
-#endif
diff --git a/chromium/third_party/skia/include/gpu/GrTexture.h b/chromium/third_party/skia/include/gpu/GrTexture.h
index e56f6f401c0..047bd18186e 100644
--- a/chromium/third_party/skia/include/gpu/GrTexture.h
+++ b/chromium/third_party/skia/include/gpu/GrTexture.h
@@ -15,51 +15,14 @@
class GrResourceKey;
class GrTextureParams;
+class GrTextureImpl;
class GrTexture : public GrSurface {
-
public:
- SK_DECLARE_INST_COUNT(GrTexture)
- // from GrResource
- /**
- * Informational texture flags
- */
- enum FlagBits {
- kFirstBit = (kLastPublic_GrTextureFlagBit << 1),
-
- /**
- * This texture should be returned to the texture cache when
- * it is no longer reffed
- */
- kReturnToCache_FlagBit = kFirstBit,
- };
-
- void setFlag(GrTextureFlags flags) {
- fDesc.fFlags = fDesc.fFlags | flags;
- }
- void resetFlag(GrTextureFlags flags) {
- fDesc.fFlags = fDesc.fFlags & ~flags;
- }
- bool isSetFlag(GrTextureFlags flags) const {
- return 0 != (fDesc.fFlags & flags);
- }
-
- void dirtyMipMaps(bool mipMapsDirty) {
- fMipMapsDirty = mipMapsDirty;
- }
-
- bool mipMapsAreDirty() const {
- return fMipMapsDirty;
- }
-
/**
* Approximate number of bytes used by the texture
*/
- virtual size_t sizeInBytes() const SK_OVERRIDE {
- return (size_t) fDesc.fWidth *
- fDesc.fHeight *
- GrBytesPerPixel(fDesc.fConfig);
- }
+ virtual size_t gpuMemorySize() const SK_OVERRIDE;
// GrSurface overrides
virtual bool readPixels(int left, int top, int width, int height,
@@ -74,37 +37,21 @@ public:
size_t rowBytes = 0,
uint32_t pixelOpsFlags = 0) SK_OVERRIDE;
- /**
- * @return this texture
- */
virtual GrTexture* asTexture() SK_OVERRIDE { return this; }
virtual const GrTexture* asTexture() const SK_OVERRIDE { return this; }
+ virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return fRenderTarget.get(); }
+ virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return fRenderTarget.get(); }
/**
- * Retrieves the render target underlying this texture that can be passed to
- * GrGpu::setRenderTarget().
- *
- * @return handle to render target or NULL if the texture is not a
- * render target
+ * Convert from texels to normalized texture coords for POT textures only. Please don't add
+ * new callsites for these functions. They are slated for removal.
*/
- virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE {
- return fRenderTarget.get();
- }
- virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE {
- return fRenderTarget.get();
- }
-
- // GrTexture
- /**
- * Convert from texels to normalized texture coords for POT textures
- * only.
- */
- GrFixed normalizeFixedX(GrFixed x) const {
- SkASSERT(GrIsPow2(fDesc.fWidth));
+ SkFixed normalizeFixedX(SkFixed x) const {
+ SkASSERT(SkIsPow2(fDesc.fWidth));
return x >> fShiftFixedX;
}
- GrFixed normalizeFixedY(GrFixed y) const {
- SkASSERT(GrIsPow2(fDesc.fHeight));
+ SkFixed normalizeFixedY(SkFixed y) const {
+ SkASSERT(SkIsPow2(fDesc.fHeight));
return y >> fShiftFixedY;
}
@@ -115,10 +62,29 @@ public:
virtual GrBackendObject getTextureHandle() const = 0;
/**
- * Call this when the state of the native API texture object is
- * altered directly, without being tracked by skia.
+ * This function indicates that the texture parameters (wrap mode, filtering, ...) have been
+ * changed externally to Skia.
*/
- virtual void invalidateCachedState() = 0;
+ virtual void textureParamsModified() = 0;
+ SK_ATTR_DEPRECATED("Renamed to textureParamsModified.")
+ void invalidateCachedState() { this->textureParamsModified(); }
+
+ /**
+ * Informational texture flags. This will be moved to the private GrTextureImpl class soon.
+ */
+ enum FlagBits {
+ kFirstBit = (kLastPublic_GrTextureFlagBit << 1),
+
+ /**
+ * This texture should be returned to the texture cache when
+ * it is no longer reffed
+ */
+ kReturnToCache_FlagBit = kFirstBit,
+ };
+
+ void resetFlag(GrTextureFlags flags) {
+ fDesc.fFlags = fDesc.fFlags & ~flags;
+ }
#ifdef SK_DEBUG
void validate() const {
@@ -128,13 +94,8 @@ public:
}
#endif
- static GrResourceKey ComputeKey(const GrGpu* gpu,
- const GrTextureParams* params,
- const GrTextureDesc& desc,
- const GrCacheID& cacheID);
- static GrResourceKey ComputeScratchKey(const GrTextureDesc& desc);
- static bool NeedsResizing(const GrResourceKey& key);
- static bool NeedsBilerp(const GrResourceKey& key);
+ GrTextureImpl* impl() { return reinterpret_cast<GrTextureImpl*>(this); }
+ const GrTextureImpl* impl() const { return reinterpret_cast<const GrTextureImpl*>(this); }
protected:
// A texture refs its rt representation but not vice-versa. It is up to
@@ -143,13 +104,12 @@ protected:
GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
: INHERITED(gpu, isWrapped, desc)
- , fRenderTarget(NULL)
- , fMipMapsDirty(true) {
-
+ , fRenderTarget(NULL) {
// only make sense if alloc size is pow2
fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
}
+
virtual ~GrTexture();
// GrResource overrides
@@ -159,16 +119,64 @@ protected:
void validateDesc() const;
private:
+ virtual void internal_dispose() const SK_OVERRIDE;
+
// these two shift a fixed-point value into normalized coordinates
// for this texture if the texture is power of two sized.
int fShiftFixedX;
int fShiftFixedY;
- bool fMipMapsDirty;
+ typedef GrSurface INHERITED;
+};
- virtual void internal_dispose() const SK_OVERRIDE;
+class GrTextureImpl : public GrTexture {
+public:
+ SK_DECLARE_INST_COUNT(GrTextureImpl)
- typedef GrSurface INHERITED;
+ void setFlag(GrTextureFlags flags) {
+ fDesc.fFlags = fDesc.fFlags | flags;
+ }
+ void resetFlag(GrTextureFlags flags) {
+ fDesc.fFlags = fDesc.fFlags & ~flags;
+ }
+ bool isSetFlag(GrTextureFlags flags) const {
+ return 0 != (fDesc.fFlags & flags);
+ }
+
+ void dirtyMipMaps(bool mipMapsDirty);
+
+ bool mipMapsAreDirty() const {
+ return kValid_MipMapsStatus != fMipMapsStatus;
+ }
+
+ bool hasMipMaps() const {
+ return kNotAllocated_MipMapsStatus != fMipMapsStatus;
+ }
+
+ static GrResourceKey ComputeKey(const GrGpu* gpu,
+ const GrTextureParams* params,
+ const GrTextureDesc& desc,
+ const GrCacheID& cacheID);
+ static GrResourceKey ComputeScratchKey(const GrTextureDesc& desc);
+ static bool NeedsResizing(const GrResourceKey& key);
+ static bool NeedsBilerp(const GrResourceKey& key);
+
+protected:
+ GrTextureImpl(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
+ : INHERITED(gpu, isWrapped, desc)
+ , fMipMapsStatus(kNotAllocated_MipMapsStatus) {
+ }
+
+private:
+ enum MipMapsStatus {
+ kNotAllocated_MipMapsStatus,
+ kAllocated_MipMapsStatus,
+ kValid_MipMapsStatus
+ };
+
+ MipMapsStatus fMipMapsStatus;
+
+ typedef GrTexture INHERITED;
};
/**
@@ -204,6 +212,7 @@ public:
fTexture.reset(SkSafeRef(texture));
return texture;
}
+
private:
SkAutoTUnref<GrTexture> fTexture;
SkIPoint fOffset;
diff --git a/chromium/third_party/skia/include/gpu/GrTextureAccess.h b/chromium/third_party/skia/include/gpu/GrTextureAccess.h
index 87b8d827cd0..9f56171c60a 100644
--- a/chromium/third_party/skia/include/gpu/GrTextureAccess.h
+++ b/chromium/third_party/skia/include/gpu/GrTextureAccess.h
@@ -112,7 +112,7 @@ private:
* key. However, if a GrEffect uses different swizzles based on its input then it must
* consider that variation in its key-generation.
*/
-class GrTextureAccess : public SkNoncopyable {
+class GrTextureAccess : SkNoncopyable {
public:
/**
* A default GrTextureAccess must have reset() called on it in a GrEffect subclass's
diff --git a/chromium/third_party/skia/include/gpu/GrTypes.h b/chromium/third_party/skia/include/gpu/GrTypes.h
index 0bb432d663c..a529eed4206 100644
--- a/chromium/third_party/skia/include/gpu/GrTypes.h
+++ b/chromium/third_party/skia/include/gpu/GrTypes.h
@@ -15,6 +15,8 @@
#include "GrConfig.h"
#include "SkMath.h"
+//#define SK_SUPPORT_LEGACY_GRTYPES
+
////////////////////////////////////////////////////////////////////////////////
/**
@@ -50,6 +52,7 @@
friend X operator & (X a, T b); \
////////////////////////////////////////////////////////////////////////////////
+#ifdef SK_SUPPORT_LEGACY_GRTYPES
/**
* Macro to round n up to the next multiple of 4, or return it unchanged if
@@ -66,6 +69,31 @@ template <typename T> const T& GrMax(const T& a, const T& b) {
return (b < a) ? a : b;
}
+/**
+ * Count elements in an array
+ */
+#define GR_ARRAY_COUNT(array) SK_ARRAY_COUNT(array)
+
+/**
+ * 16.16 fixed point type
+ */
+typedef int32_t GrFixed;
+
+#ifdef SK_DEBUG
+
+static inline int16_t GrToS16(intptr_t x) {
+ SkASSERT((int16_t)x == x);
+ return (int16_t)x;
+}
+
+#else
+
+#define GrToS16(x) x
+
+#endif
+
+#endif
+
// compile time versions of min/max
#define GR_CT_MAX(a, b) (((b) < (a)) ? (a) : (b))
#define GR_CT_MIN(a, b) (((b) < (a)) ? (b) : (a))
@@ -120,21 +148,9 @@ static inline size_t GrSizeAlignDown(size_t x, uint32_t alignment) {
return (x / alignment) * alignment;
}
-/**
- * Count elements in an array
- */
-#define GR_ARRAY_COUNT(array) SK_ARRAY_COUNT(array)
-
///////////////////////////////////////////////////////////////////////////////
/**
- * Return true if n is a power of 2
- */
-static inline bool GrIsPow2(unsigned n) {
- return n && 0 == (n & (n - 1));
-}
-
-/**
* Return the next power of 2 >= n.
*/
static inline uint32_t GrNextPow2(uint32_t n) {
@@ -149,27 +165,6 @@ static inline int GrNextPow2(int n) {
///////////////////////////////////////////////////////////////////////////////
/**
- * 16.16 fixed point type
- */
-typedef int32_t GrFixed;
-
-#ifdef SK_DEBUG
-
-static inline int16_t GrToS16(intptr_t x) {
- SkASSERT((int16_t)x == x);
- return (int16_t)x;
-}
-
-#else
-
-#define GrToS16(x) x
-
-#endif
-
-
-///////////////////////////////////////////////////////////////////////////////
-
-/**
* Possible 3D APIs that may be used by Ganesh.
*/
enum GrBackend {
@@ -279,8 +274,16 @@ enum GrPixelConfig {
* Premultiplied. Byte order is b,g,r,a.
*/
kBGRA_8888_GrPixelConfig,
+ /**
+ * ETC1 Compressed Data
+ */
+ kETC1_GrPixelConfig,
+ /**
+ * LATC/RGTC/3Dc/BC4 Compressed Data
+ */
+ kLATC_GrPixelConfig,
- kLast_GrPixelConfig = kBGRA_8888_GrPixelConfig
+ kLast_GrPixelConfig = kLATC_GrPixelConfig
};
static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
@@ -296,6 +299,18 @@ static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
#error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
#endif
+// Returns true if the pixel config is a GPU-specific compressed format
+// representation.
+static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
+ switch (config) {
+ case kETC1_GrPixelConfig:
+ case kLATC_GrPixelConfig:
+ return true;
+ default:
+ return false;
+ }
+}
+
// Returns true if the pixel config is 32 bits per pixel
static inline bool GrPixelConfigIs8888(GrPixelConfig config) {
switch (config) {
@@ -338,6 +353,7 @@ static inline size_t GrBytesPerPixel(GrPixelConfig config) {
static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
switch (config) {
+ case kETC1_GrPixelConfig:
case kRGB_565_GrPixelConfig:
return true;
default:
@@ -347,6 +363,7 @@ static inline bool GrPixelConfigIsOpaque(GrPixelConfig config) {
static inline bool GrPixelConfigIsAlphaOnly(GrPixelConfig config) {
switch (config) {
+ case kLATC_GrPixelConfig:
case kAlpha_8_GrPixelConfig:
return true;
default:
@@ -618,6 +635,26 @@ enum GrGLBackendState {
};
/**
+ * Returns the data size for the given compressed pixel config
+ */
+static inline size_t GrCompressedFormatDataSize(GrPixelConfig config,
+ int width, int height) {
+ SkASSERT(GrPixelConfigIsCompressed(config));
+
+ switch (config) {
+ case kLATC_GrPixelConfig:
+ case kETC1_GrPixelConfig:
+ SkASSERT((width & 3) == 0);
+ SkASSERT((height & 3) == 0);
+ return (width >> 2) * (height >> 2) * 8;
+
+ default:
+ SkFAIL("Unknown compressed pixel config");
+ return 4 * width * height;
+ }
+}
+
+/**
* This value translates to reseting all the context state for any backend.
*/
static const uint32_t kAll_GrBackendState = 0xffffffff;
diff --git a/chromium/third_party/skia/include/gpu/GrTypesPriv.h b/chromium/third_party/skia/include/gpu/GrTypesPriv.h
index 8888066d4fa..dfe415345a4 100644
--- a/chromium/third_party/skia/include/gpu/GrTypesPriv.h
+++ b/chromium/third_party/skia/include/gpu/GrTypesPriv.h
@@ -45,7 +45,7 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
GR_STATIC_ASSERT(5 == kMat33f_GrSLType);
GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
- GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
}
/** Return the type enum for a vector of floats of length n (1..4),
@@ -60,6 +60,8 @@ static inline GrSLType GrSLFloatVectorType(int count) {
GR_STATIC_ASSERT(kVec4f_GrSLType == 4);
}
+//////////////////////////////////////////////////////////////////////////////
+
/**
* Types used to describe format of vertices in arrays.
*/
@@ -87,7 +89,7 @@ static inline int GrVertexAttribTypeVectorCount(GrVertexAttribType type) {
GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
- GR_STATIC_ASSERT(GR_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrVertexAttribTypeCount);
}
/**
@@ -109,7 +111,7 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
GR_STATIC_ASSERT(4 == kVec4ub_GrVertexAttribType);
- GR_STATIC_ASSERT(GR_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(kSizes) == kGrVertexAttribTypeCount);
}
/**
@@ -166,4 +168,53 @@ struct GrVertexAttrib {
template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib, true> {};
+//////////////////////////////////////////////////////////////////////////////
+
+/**
+* We have coverage effects that clip rendering to the edge of some geometric primitive.
+* This enum specifies how that clipping is performed. Not all factories that take a
+* GrEffectEdgeType will succeed with all values and it is up to the caller to check for
+* a NULL return.
+*/
+enum GrEffectEdgeType {
+ kFillBW_GrEffectEdgeType,
+ kFillAA_GrEffectEdgeType,
+ kInverseFillBW_GrEffectEdgeType,
+ kInverseFillAA_GrEffectEdgeType,
+ kHairlineAA_GrEffectEdgeType,
+
+ kLast_GrEffectEdgeType = kHairlineAA_GrEffectEdgeType
+};
+
+static const int kGrEffectEdgeTypeCnt = kLast_GrEffectEdgeType + 1;
+
+static inline bool GrEffectEdgeTypeIsFill(const GrEffectEdgeType edgeType) {
+ return (kFillAA_GrEffectEdgeType == edgeType || kFillBW_GrEffectEdgeType == edgeType);
+}
+
+static inline bool GrEffectEdgeTypeIsInverseFill(const GrEffectEdgeType edgeType) {
+ return (kInverseFillAA_GrEffectEdgeType == edgeType ||
+ kInverseFillBW_GrEffectEdgeType == edgeType);
+}
+
+static inline bool GrEffectEdgeTypeIsAA(const GrEffectEdgeType edgeType) {
+ return (kFillBW_GrEffectEdgeType != edgeType && kInverseFillBW_GrEffectEdgeType != edgeType);
+}
+
+static inline GrEffectEdgeType GrInvertEffectEdgeType(const GrEffectEdgeType edgeType) {
+ switch (edgeType) {
+ case kFillBW_GrEffectEdgeType:
+ return kInverseFillBW_GrEffectEdgeType;
+ case kFillAA_GrEffectEdgeType:
+ return kInverseFillAA_GrEffectEdgeType;
+ case kInverseFillBW_GrEffectEdgeType:
+ return kFillBW_GrEffectEdgeType;
+ case kInverseFillAA_GrEffectEdgeType:
+ return kFillAA_GrEffectEdgeType;
+ case kHairlineAA_GrEffectEdgeType:
+ SkFAIL("Hairline fill isn't invertible.");
+ }
+ return kFillAA_GrEffectEdgeType; // suppress warning.
+}
+
#endif
diff --git a/chromium/third_party/skia/include/gpu/GrUserConfig.h b/chromium/third_party/skia/include/gpu/GrUserConfig.h
index 81294f11a1c..092ff9d8bcc 100644
--- a/chromium/third_party/skia/include/gpu/GrUserConfig.h
+++ b/chromium/third_party/skia/include/gpu/GrUserConfig.h
@@ -13,11 +13,11 @@
#endif
/**
- * This gives a threshold in bytes of when to lock a GrGeometryBuffer vs using
+ * This gives a threshold in bytes of when to map a GrGeometryBuffer vs using
* updateData. (Note the depending on the underlying 3D API the update functions
- * may always be implemented using a lock)
+ * may always be implemented using a map)
*/
-//#define GR_GEOM_BUFFER_LOCK_THRESHOLD (1<<15)
+//#define GR_GEOM_BUFFER_MAP_THRESHOLD (1<<15)
/**
* This gives a threshold in megabytes for the maximum size of the texture cache
diff --git a/chromium/third_party/skia/include/gpu/SkGpuDevice.h b/chromium/third_party/skia/include/gpu/SkGpuDevice.h
index 198bad37887..0b6bbc18570 100644
--- a/chromium/third_party/skia/include/gpu/SkGpuDevice.h
+++ b/chromium/third_party/skia/include/gpu/SkGpuDevice.h
@@ -14,11 +14,13 @@
#include "SkGr.h"
#include "SkBitmap.h"
#include "SkBitmapDevice.h"
+#include "SkPicture.h"
#include "SkRegion.h"
#include "GrContext.h"
struct SkDrawProcs;
struct GrSkDrawProcs;
+
class GrTextContext;
/**
@@ -27,26 +29,33 @@ class GrTextContext;
*/
class SK_API SkGpuDevice : public SkBitmapDevice {
public:
+ enum Flags {
+ kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
+ kCached_Flag = 1 << 1, //!< Surface is cached and needs to be unlocked when released
+ kDFFonts_Flag = 1 << 2, //!< Surface should render fonts using signed distance fields
+ };
/**
* Creates an SkGpuDevice from a GrSurface. This will fail if the surface is not a render
- * target. The caller owns a ref on the returned device.
+ * target. The caller owns a ref on the returned device. If the surface is cached,
+ * the kCached_Flag should be specified to make the device responsible for unlocking
+ * the surface when it is released.
*/
- static SkGpuDevice* Create(GrSurface* surface);
+ static SkGpuDevice* Create(GrSurface* surface, unsigned flags = 0);
/**
* New device that will create an offscreen renderTarget based on the
- * config, width, height, and sampleCount. The device's storage will not
+ * ImageInfo and sampleCount. The device's storage will not
* count against the GrContext's texture cache budget. The device's pixels
- * will be uninitialized. TODO: This can fail, replace with a factory function.
+ * will be uninitialized. On failure, returns NULL.
*/
- SkGpuDevice(GrContext*, SkBitmap::Config, int width, int height, int sampleCount = 0);
+ static SkGpuDevice* Create(GrContext*, const SkImageInfo&, int sampleCount);
/**
* DEPRECATED -- need to make this private, call Create(surface)
* New device that will render to the specified renderTarget.
*/
- SkGpuDevice(GrContext*, GrRenderTarget*);
+ SkGpuDevice(GrContext*, GrRenderTarget*, unsigned flags = 0);
/**
* DEPRECATED -- need to make this private, call Create(surface)
@@ -54,7 +63,7 @@ public:
* The GrTexture's asRenderTarget() must be non-NULL or device will not
* function.
*/
- SkGpuDevice(GrContext*, GrTexture*);
+ SkGpuDevice(GrContext*, GrTexture*, unsigned flags = 0);
virtual ~SkGpuDevice();
@@ -62,26 +71,11 @@ public:
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
- // overrides from SkBaseDevice
- virtual uint32_t getDeviceCapabilities() SK_OVERRIDE {
- return 0;
- }
- virtual int width() const SK_OVERRIDE {
- return NULL == fRenderTarget ? 0 : fRenderTarget->width();
- }
- virtual int height() const SK_OVERRIDE {
- return NULL == fRenderTarget ? 0 : fRenderTarget->height();
- }
- virtual bool isOpaque() const SK_OVERRIDE {
- return NULL == fRenderTarget ? false
- : kRGB_565_GrPixelConfig == fRenderTarget->config();
+ virtual SkImageInfo imageInfo() const SK_OVERRIDE {
+ return fRenderTarget ? fRenderTarget->info() : SkImageInfo::MakeUnknown();
}
- virtual SkBitmap::Config config() const SK_OVERRIDE;
virtual void clear(SkColor color) SK_OVERRIDE;
- virtual void writePixels(const SkBitmap& bitmap, int x, int y,
- SkCanvas::Config8888 config8888) SK_OVERRIDE;
-
virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
@@ -89,6 +83,8 @@ public:
const SkPaint& paint) SK_OVERRIDE;
virtual void drawRRect(const SkDraw&, const SkRRect& r,
const SkPaint& paint) SK_OVERRIDE;
+ virtual void drawDRRect(const SkDraw& draw, const SkRRect& outer,
+ const SkRRect& inner, const SkPaint& paint) SK_OVERRIDE;
virtual void drawOval(const SkDraw&, const SkRect& oval,
const SkPaint& paint) SK_OVERRIDE;
virtual void drawPath(const SkDraw&, const SkPath& path,
@@ -124,23 +120,32 @@ public:
virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
virtual void onDetachFromCanvas() SK_OVERRIDE;
+ virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
+
/**
* Make's this device's rendertarget current in the underlying 3D API.
* Also implicitly flushes.
*/
virtual void makeRenderTargetCurrent();
- virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE;
- virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
+ virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE;
+ virtual bool filterImage(const SkImageFilter*, const SkBitmap&,
+ const SkImageFilter::Context&,
SkBitmap*, SkIPoint*) SK_OVERRIDE;
class SkAutoCachedTexture; // used internally
+
protected:
- // overrides from SkBaseDevice
- virtual bool onReadPixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) SK_OVERRIDE;
+ virtual bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) SK_OVERRIDE;
+ virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVERRIDE;
+
+ /** PRIVATE / EXPERIMENTAL -- do not call */
+ virtual void EXPERIMENTAL_optimize(const SkPicture* picture) SK_OVERRIDE;
+ /** PRIVATE / EXPERIMENTAL -- do not call */
+ virtual void EXPERIMENTAL_purge(const SkPicture* picture) SK_OVERRIDE;
+ /** PRIVATE / EXPERIMENTAL -- do not call */
+ virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* picture) SK_OVERRIDE;
private:
GrContext* fContext;
@@ -149,23 +154,19 @@ private:
GrClipData fClipData;
+ GrTextContext* fMainTextContext;
+ GrTextContext* fFallbackTextContext;
+
// state for our render-target
GrRenderTarget* fRenderTarget;
bool fNeedClear;
// called from rt and tex cons
- void initFromRenderTarget(GrContext*, GrRenderTarget*, bool cached);
-
- // used by createCompatibleDevice
- SkGpuDevice(GrContext*, GrTexture* texture, bool needClear);
+ void initFromRenderTarget(GrContext*, GrRenderTarget*, unsigned flags);
- // override from SkBaseDevice
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE;
- SkDrawProcs* initDrawForText(GrTextContext*);
+ virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE;
// sets the render target, clip, and matrix on GrContext. Use forceIdenity to override
// SkDraw's matrix and draw in device coords.
@@ -177,7 +178,7 @@ private:
void drawBitmapCommon(const SkDraw&,
const SkBitmap& bitmap,
const SkRect* srcRectPtr,
- const SkMatrix&,
+ const SkSize* dstSizePtr, // ignored iff srcRectPtr == NULL
const SkPaint&,
SkCanvas::DrawBitmapRectFlags flags);
@@ -198,7 +199,8 @@ private:
const GrTextureParams& params,
const SkPaint& paint,
SkCanvas::DrawBitmapRectFlags flags,
- bool bicubic);
+ bool bicubic,
+ bool needsTextureDomain);
void drawTiledBitmap(const SkBitmap& bitmap,
const SkRect& srcRect,
const SkIRect& clippedSrcRect,
@@ -208,10 +210,9 @@ private:
int tileSize,
bool bicubic);
- /**
- * Returns non-initialized instance.
- */
- GrTextContext* getTextContext();
+ bool drawDashLine(const SkPoint pts[2], const SkPaint& paint);
+
+ static SkPicture::AccelData::Key ComputeAccelDataKey();
typedef SkBitmapDevice INHERITED;
};
diff --git a/chromium/third_party/skia/include/gpu/SkGr.h b/chromium/third_party/skia/include/gpu/SkGr.h
index db08548f5d5..1adac654a68 100644
--- a/chromium/third_party/skia/include/gpu/SkGr.h
+++ b/chromium/third_party/skia/include/gpu/SkGr.h
@@ -45,11 +45,19 @@ GR_STATIC_ASSERT((int)kIDA_GrBlendCoeff == (int)SkXfermode::kIDA_Coeff);
#include "SkColorPriv.h"
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
/**
* Convert the SkBitmap::Config to the corresponding PixelConfig, or
* kUnknown_PixelConfig if the conversion cannot be done.
*/
GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config);
+#endif
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType, SkAlphaType);
+
+static inline GrPixelConfig SkImageInfo2GrPixelConfig(const SkImageInfo& info) {
+ return SkImageInfo2GrPixelConfig(info.colorType(), info.alphaType());
+}
+
bool GrPixelConfig2ColorType(GrPixelConfig, SkColorType*);
static inline GrColor SkColor2GrColor(SkColor c) {
@@ -61,6 +69,11 @@ static inline GrColor SkColor2GrColor(SkColor c) {
return GrColorPackRGBA(r, g, b, a);
}
+static inline GrColor SkColor2GrColorJustAlpha(SkColor c) {
+ U8CPU a = SkColorGetA(c);
+ return GrColorPackRGBA(a, a, a, a);
+}
+
////////////////////////////////////////////////////////////////////////////////
bool GrIsBitmapInCache(const GrContext*, const SkBitmap&, const GrTextureParams*);
@@ -70,6 +83,23 @@ GrTexture* GrLockAndRefCachedBitmapTexture(GrContext*, const SkBitmap&, const Gr
void GrUnlockAndUnrefCachedBitmapTexture(GrTexture*);
////////////////////////////////////////////////////////////////////////////////
+
+// Converts a SkPaint to a GrPaint, ignoring the SkPaint's shader.
+// Sets the color of GrPaint to the value of the parameter grColor
+// Callers may subsequently modify the GrPaint. Setting constantColor indicates
+// that the final paint will draw the same color at every pixel. This allows
+// an optimization where the the color filter can be applied to the SkPaint's
+// color once while converting to GrPaint and then ignored.
+void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor grColor,
+ bool constantColor, GrPaint* grPaint);
+
+// This function is similar to skPaint2GrPaintNoShader but also converts
+// skPaint's shader to a GrTexture/GrEffectStage if possible.
+// constantColor has the same meaning as in skPaint2GrPaintNoShader.
+void SkPaint2GrPaintShader(GrContext* context, const SkPaint& skPaint,
+ bool constantColor, GrPaint* grPaint);
+
+////////////////////////////////////////////////////////////////////////////////
// Classes
class SkGlyphCache;
@@ -82,9 +112,12 @@ public:
// overrides
virtual const GrKey* getKey();
virtual GrMaskFormat getMaskFormat();
- virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds);
+ virtual bool getPackedGlyphBounds(GrGlyph::PackedID, SkIRect* bounds) SK_OVERRIDE;
virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
- int rowBytes, void* image);
+ int rowBytes, void* image) SK_OVERRIDE;
+ virtual bool getPackedGlyphDFBounds(GrGlyph::PackedID, SkIRect* bounds) SK_OVERRIDE;
+ virtual bool getPackedGlyphDFImage(GrGlyph::PackedID, int width, int height,
+ void* image) SK_OVERRIDE;
virtual bool getGlyphPath(uint16_t glyphID, SkPath*);
private:
diff --git a/chromium/third_party/skia/include/gpu/SkGrPixelRef.h b/chromium/third_party/skia/include/gpu/SkGrPixelRef.h
index d8933724fbb..36802a05589 100644
--- a/chromium/third_party/skia/include/gpu/SkGrPixelRef.h
+++ b/chromium/third_party/skia/include/gpu/SkGrPixelRef.h
@@ -20,14 +20,14 @@
*/
class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef)
SkROLockPixelsPixelRef(const SkImageInfo&);
virtual ~SkROLockPixelsPixelRef();
protected:
- // override from SkPixelRef
- virtual void* onLockPixels(SkColorTable** ptr);
- virtual void onUnlockPixels();
- virtual bool onLockPixelsAreWritable() const; // return false;
+ virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
+ virtual void onUnlockPixels() SK_OVERRIDE;
+ virtual bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false;
private:
SkBitmap fBitmap;
@@ -39,6 +39,7 @@ private:
*/
class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
public:
+ SK_DECLARE_INST_COUNT(SkGrPixelRef)
/**
* Constructs a pixel ref around a GrSurface. If the caller has locked the GrSurface in the
* cache and would like the pixel ref to unlock it in its destructor then transferCacheLock
@@ -55,7 +56,7 @@ public:
protected:
// overrides from SkPixelRef
virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE;
- virtual SkPixelRef* deepCopy(SkBitmap::Config dstConfig, const SkIRect* subset) SK_OVERRIDE;
+ virtual SkPixelRef* deepCopy(SkColorType, const SkIRect* subset) SK_OVERRIDE;
private:
GrSurface* fSurface;
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLConfig.h b/chromium/third_party/skia/include/gpu/gl/GrGLConfig.h
index 490ad0ab53f..444be00f158 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLConfig.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLConfig.h
@@ -93,10 +93,6 @@
* stencil formats as attachments. If the FBO is complete we will assume
* subsequent attachments with the same formats are complete as well.
*
- * GR_GL_USE_NV_PATH_RENDERING: Enable experimental support for
- * GL_NV_path_rendering. There are known issues with clipping, non-AA paths, and
- * perspective.
- *
* GR_GL_MUST_USE_VBO: Indicates that all vertices and indices must be rendered
* from VBOs. Chromium's command buffer doesn't allow glVertexAttribArray with
* ARARY_BUFFER 0 bound or glDrawElements with ELEMENT_ARRAY_BUFFER 0 bound.
@@ -158,10 +154,6 @@
#define GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT 0
#endif
-#if !defined(GR_GL_USE_NV_PATH_RENDERING)
- #define GR_GL_USE_NV_PATH_RENDERING 0
-#endif
-
#if !defined(GR_GL_MUST_USE_VBO)
#define GR_GL_MUST_USE_VBO 0
#endif
@@ -170,15 +162,6 @@
#define GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE 0
#endif
-// We now have a separate GrGLInterface function pointer entry for the IMG/EXT version of
-// glRenderbufferStorageMultisampled. However, Chrome is setting the one we now use for
-// ES3 MSAA to point to the IMG/EXT function. This macro exists to make Skia ignore the
-// ES3 MSAA and instead use the IMG/EXT version with the old function pointer entry. It will
-// be removed as soon as Chrome is updated to set the new function pointer.
-#if !defined(GR_GL_IGNORE_ES3_MSAA)
- #define GR_GL_IGNORE_ES3_MSAA 0
-#endif
-
/**
* There is a strange bug that occurs on Macs with NVIDIA GPUs. We don't
* fully understand it. When (element) array buffers are continually
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLExtensions.h b/chromium/third_party/skia/include/gpu/gl/GrGLExtensions.h
index ffb673336a6..89adadfc48e 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLExtensions.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLExtensions.h
@@ -8,42 +8,64 @@
#ifndef GrGLExtensions_DEFINED
#define GrGLExtensions_DEFINED
-#include "GrGLInterface.h"
+#include "GrGLFunctions.h"
#include "SkString.h"
#include "SkTArray.h"
+struct GrGLInterface;
+
/**
* This helper queries the current GL context for its extensions, remembers them, and can be
* queried. It supports both glGetString- and glGetStringi-style extension string APIs and will
* use the latter if it is available.
*/
-class GrGLExtensions {
+class SK_API GrGLExtensions {
public:
- bool init(GrGLBinding binding, const GrGLInterface* iface) {
- SkASSERT(binding & iface->fBindingsExported);
- return this->init(binding, iface->fGetString, iface->fGetStringi, iface->fGetIntegerv);
+ GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {}
+
+ GrGLExtensions(const GrGLExtensions&);
+
+ GrGLExtensions& operator=(const GrGLExtensions&);
+
+ void swap(GrGLExtensions* that) {
+ fStrings.swap(&that->fStrings);
+ SkTSwap(fInitialized, that->fInitialized);
}
+
/**
* We sometimes need to use this class without having yet created a GrGLInterface. This version
* of init expects that getString is always non-NULL while getIntegerv and getStringi are non-
* NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
*/
- bool init(GrGLBinding binding,
+ bool init(GrGLStandard standard,
GrGLGetStringProc getString,
GrGLGetStringiProc getStringi,
GrGLGetIntegervProc getIntegerv);
+ bool isInitialized() const { return fInitialized; }
+
/**
* Queries whether an extension is present. This will fail if init() has not been called.
*/
- bool has(const char*) const;
+ bool has(const char[]) const;
+
+ /**
+ * Removes an extension if present. Returns true if the extension was present before the call.
+ */
+ bool remove(const char[]);
+
+ /**
+ * Adds an extension to list
+ */
+ void add(const char[]);
- void reset() { fStrings.reset(); }
+ void reset() { fStrings->reset(); }
void print(const char* sep = "\n") const;
private:
- SkTArray<SkString> fStrings;
+ bool fInitialized;
+ SkAutoTDelete<SkTArray<SkString> > fStrings;
};
#endif
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h b/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
index 7417685b28a..5ac77a25560 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLFunctions.h
@@ -11,12 +11,24 @@
#include "GrGLConfig.h"
+////////////////////////////////////////////////////////////////////////////////
+
/**
- * Declares typedefs for all the GL functions used in GrGLInterface
+ * Classifies GL contexts by which standard they implement (currently as Desktop
+ * vs. ES).
*/
+enum GrGLStandard {
+ kNone_GrGLStandard,
+ kGL_GrGLStandard,
+ kGLES_GrGLStandard,
+};
///////////////////////////////////////////////////////////////////////////////
+/**
+ * Declares typedefs for all the GL functions used in GrGLInterface
+ */
+
typedef unsigned int GrGLenum;
typedef unsigned char GrGLboolean;
typedef unsigned int GrGLbitfield;
@@ -35,8 +47,18 @@ typedef float GrGLclampf;
typedef double GrGLdouble;
typedef double GrGLclampd;
typedef void GrGLvoid;
-typedef long GrGLintptr;
-typedef long GrGLsizeiptr;
+#ifndef SK_IGNORE_64BIT_OPENGL_CHANGES
+#ifdef _WIN64
+typedef signed long long int GrGLintptr;
+typedef signed long long int GrGLsizeiptr;
+#else
+typedef signed long int GrGLintptr;
+typedef signed long int GrGLsizeiptr;
+#endif
+#else
+typedef signed long int GrGLintptr;
+typedef signed long int GrGLsizeiptr;
+#endif
///////////////////////////////////////////////////////////////////////////////
@@ -65,6 +87,7 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLColorMaskProc)(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompileShaderProc)(GrGLuint shader);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexImage2DProc)(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCompressedTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLCopyTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLCreateProgramProc)(void);
typedef GrGLuint (GR_GL_FUNCTION_TYPE* GrGLCreateShaderProc)(GrGLenum type);
@@ -79,18 +102,17 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDeleteVertexArraysProc)(GrGLsizei n, const GrGLuint *arrays);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDepthMaskProc)(GrGLboolean flag);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableProc)(GrGLenum cap);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableClientStateProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDisableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawArraysProc)(GrGLenum mode, GrGLint first, GrGLsizei count);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBufferProc)(GrGLenum mode);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawBuffersProc)(GrGLsizei n, const GrGLenum* bufs);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLDrawElementsProc)(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableProc)(GrGLenum cap);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableClientStateProc)(GrGLenum cap);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEnableVertexAttribArrayProc)(GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLEndQueryProc)(GrGLenum target);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFinishProc)();
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFlushProc)();
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFlushMappedBufferRangeProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferRenderbufferProc)(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferTexture2DProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLFramebufferTexture2DMultisampleProc)(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples);
@@ -120,10 +142,22 @@ extern "C" {
typedef const GrGLubyte* (GR_GL_FUNCTION_TYPE* GrGLGetStringiProc)(GrGLenum name, GrGLuint index);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLGetTexLevelParameterivProc)(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params);
typedef GrGLint (GR_GL_FUNCTION_TYPE* GrGLGetUniformLocationProc)(GrGLuint program, const char* name);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInsertEventMarkerProc)(GrGLsizei length, const char* marker);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateBufferDataProc)(GrGLuint buffer);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateBufferSubDataProc)(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateFramebufferProc)(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateSubFramebufferProc)(GrGLenum target, GrGLsizei numAttachments, const GrGLenum *attachments, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateTexImageProc)(GrGLuint texture, GrGLint level);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLInvalidateTexSubImageProc)(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLineWidthProc)(GrGLfloat width);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLinkProgramProc)(GrGLuint program);
typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferProc)(GrGLenum target, GrGLenum access);
+ typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferRangeProc)(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access);
+ typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapBufferSubDataProc)(GrGLuint target, GrGLintptr offset, GrGLsizeiptr size, GrGLenum access);
+ typedef GrGLvoid* (GR_GL_FUNCTION_TYPE* GrGLMapTexSubImage2DProc)(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPixelStoreiProc)(GrGLenum pname, GrGLint param);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPopGroupMarkerProc)();
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPushGroupMarkerProc)(GrGLsizei length, const char* marker);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLQueryCounterProc)(GrGLuint id, GrGLenum target);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLReadBufferProc)(GrGLenum src);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLReadPixelsProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels);
@@ -144,9 +178,6 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilMaskSeparateProc)(GrGLenum face, GrGLuint mask);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpProc)(GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLStencilOpSeparateProc)(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfProc)(GrGLenum coord, GrGLenum pname, GrGLfloat param);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGenfvProc)(GrGLenum coord, GrGLenum pname, const GrGLfloat* params);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexGeniProc)(GrGLenum coord, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexImage2DProc)(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameteriProc)(GrGLenum target, GrGLenum pname, GrGLint param);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLTexParameterivProc)(GrGLenum target, GrGLenum pname, const GrGLint* params);
@@ -173,18 +204,18 @@ extern "C" {
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniformMatrix3fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUniformMatrix4fvProc)(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value);
typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLUnmapBufferProc)(GrGLenum target);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUnmapBufferSubDataProc)(const GrGLvoid* mem);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUnmapTexSubImage2DProc)(const GrGLvoid* mem);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLUseProgramProc)(GrGLuint program);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttrib4fvProc)(GrGLuint indx, const GrGLfloat* values);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexAttribPointerProc)(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLVertexPointerProc)(GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* pointer);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLViewportProc)(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height);
// Experimental: Functions for GL_NV_path_rendering. These will be
// alphabetized with the above functions once this is fully supported
// (and functions we are unlikely to use will possibly be omitted).
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixModeProc)(GrGLenum);
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLoadIdentityProc)();
- typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLLoadMatrixfProc)(const GrGLfloat* m);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadfProc)(GrGLenum matrixMode, const GrGLfloat* m);
+ typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLMatrixLoadIdentityProc)(GrGLenum);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCommandsProc)(GrGLuint path, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathCoordsProc)(GrGLuint path, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GrGLPathSubCommandsProc)(GrGLuint path, GrGLsizei commandStart, GrGLsizei commandsToDelete, GrGLsizei numCommands, const GrGLubyte *commands, GrGLsizei numCoords, GrGLenum coordType, const GrGLvoid *coords);
@@ -234,6 +265,7 @@ extern "C" {
typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLIsPointInStrokePathProc)(GrGLuint path, GrGLfloat x, GrGLfloat y);
typedef GrGLfloat (GR_GL_FUNCTION_TYPE* GrGLGetPathLengthProc)(GrGLuint path, GrGLsizei startSegment, GrGLsizei numSegments);
typedef GrGLboolean (GR_GL_FUNCTION_TYPE* GrGLPointAlongPathProc)(GrGLuint path, GrGLsizei startSegment, GrGLsizei numSegments, GrGLfloat distance, GrGLfloat *x, GrGLfloat *y, GrGLfloat *tangentX, GrGLfloat *tangentY);
+
} // extern "C"
#endif
diff --git a/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h b/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
index 0d4749a836e..6c5ab24fdc4 100644
--- a/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
+++ b/chromium/third_party/skia/include/gpu/gl/GrGLInterface.h
@@ -9,45 +9,21 @@
#define GrGLInterface_DEFINED
#include "GrGLFunctions.h"
+#include "GrGLExtensions.h"
#include "SkRefCnt.h"
////////////////////////////////////////////////////////////////////////////////
/**
- * Classifies GL contexts (currently as Desktop vs. ES2). This is a bitfield.
- * A GrGLInterface (defined below) may support multiple bindings.
- */
-enum GrGLBinding {
- kNone_GrGLBinding = 0x0,
-
- kDesktop_GrGLBinding = 0x01,
- kES_GrGLBinding = 0x02, // ES2+ only
-
- // for iteration of GrGLBindings
- kFirstGrGLBinding = kDesktop_GrGLBinding,
- kLastGrGLBinding = kES_GrGLBinding
-};
-
-// Temporary alias until Chromium can be updated.
-static const GrGLBinding kES2_GrGLBinding = kES_GrGLBinding;
-
-////////////////////////////////////////////////////////////////////////////////
-
-/**
* Rather than depend on platform-specific GL headers and libraries, we require
* the client to provide a struct of GL function pointers. This struct can be
* specified per-GrContext as a parameter to GrContext::Create. If NULL is
- * passed to Create then the "default" GL interface is used. If the default is
+ * passed to Create then a "default" GL interface is created. If the default is
* also NULL GrContext creation will fail.
*
* The default interface is returned by GrGLDefaultInterface. This function's
* implementation is platform-specific. Several have been provided, along with
- * an implementation that simply returns NULL. It is implementation-specific
- * whether the same GrGLInterface is returned or whether a new one is created
- * at each call. Some platforms may not be able to use a single GrGLInterface
- * because extension function ptrs vary across contexts. Note that GrGLInterface
- * is ref-counted. So if the same object is returned by multiple calls to
- * GrGLDefaultInterface, each should bump the ref count.
+ * an implementation that simply returns NULL.
*
* By defining GR_GL_PER_GL_CALL_IFACE_CALLBACK to 1 the client can specify a
* callback function that will be called prior to each GL function call. See
@@ -60,9 +36,8 @@ const GrGLInterface* GrGLDefaultInterface();
/**
* Creates a GrGLInterface for a "native" GL context (e.g. WGL on windows,
- * GLX on linux, AGL on Mac). On platforms that have context-specific function
- * pointers for GL extensions (e.g. windows) the returned interface is only
- * valid for the context that was current at creation.
+ * GLX on linux, AGL on Mac). The interface is only valid for the GL context
+ * that is current when the interface is created.
*/
const GrGLInterface* GrGLCreateNativeInterface();
@@ -97,7 +72,18 @@ typedef void (*GrGLInterfaceCallbackProc)(const GrGLInterface*);
typedef intptr_t GrGLInterfaceCallbackData;
#endif
-/*
+/** Function that returns a new interface identical to "interface" but without support for
+ GL_NV_path_rendering. */
+const GrGLInterface* GrGLInterfaceRemoveNVPR(const GrGLInterface*);
+
+/** Function that returns a new interface identical to "interface" but with support for
+ test version of GL_EXT_debug_marker. */
+const GrGLInterface* GrGLInterfaceAddTestDebugMarker(const GrGLInterface*,
+ GrGLInsertEventMarkerProc insertEventMarkerFn,
+ GrGLPushGroupMarkerProc pushGroupMarkerFn,
+ GrGLPopGroupMarkerProc popGroupMarkerFn);
+
+/**
* GrContext uses the following interface to make all calls into OpenGL. When a
* GrContext is created it is given a GrGLInterface. The interface's function
* pointers must be valid for the OpenGL context associated with the GrContext.
@@ -114,12 +100,22 @@ private:
template <typename FNPTR_TYPE> class GLPtr {
public:
GLPtr() : fPtr(NULL) {}
- GLPtr operator =(FNPTR_TYPE ptr) { fPtr = ptr; return *this; }
+ GLPtr operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; }
operator FNPTR_TYPE() const { return fPtr; }
private:
FNPTR_TYPE fPtr;
};
+ // This is a temporary workaround to keep Chromium's GrGLInterface factories compiling until
+ // they're updated to use the Functions struct.
+ template <typename FNPTR_TYPE> class GLPtrAlias {
+ public:
+ GLPtrAlias(GLPtr<FNPTR_TYPE>* base) : fBase(base) {}
+ void operator=(FNPTR_TYPE ptr) { *fBase = ptr; }
+ private:
+ GLPtr<FNPTR_TYPE>* fBase;
+ };
+
typedef SkRefCnt INHERITED;
public:
@@ -127,237 +123,256 @@ public:
GrGLInterface();
- // Validates that the GrGLInterface supports a binding. This means that
- // the GrGLinterface advertises the binding in fBindingsExported and all
- // the necessary function pointers have been initialized. The interface is
- // validated for the current OpenGL context.
- bool validate(GrGLBinding binding) const;
-
- // Indicator variable specifying the type of GL implementation
- // exported: GLES2 and/or Desktop.
- GrGLBinding fBindingsExported;
-
- GLPtr<GrGLActiveTextureProc> fActiveTexture;
- GLPtr<GrGLAttachShaderProc> fAttachShader;
- GLPtr<GrGLBeginQueryProc> fBeginQuery;
- GLPtr<GrGLBindAttribLocationProc> fBindAttribLocation;
- GLPtr<GrGLBindBufferProc> fBindBuffer;
- GLPtr<GrGLBindFragDataLocationProc> fBindFragDataLocation;
- GLPtr<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed;
- GLPtr<GrGLBindFramebufferProc> fBindFramebuffer;
- GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer;
- GLPtr<GrGLBindTextureProc> fBindTexture;
- GLPtr<GrGLBindVertexArrayProc> fBindVertexArray;
- GLPtr<GrGLBlendColorProc> fBlendColor;
- GLPtr<GrGLBlendFuncProc> fBlendFunc;
- GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer;
- GLPtr<GrGLBufferDataProc> fBufferData;
- GLPtr<GrGLBufferSubDataProc> fBufferSubData;
- GLPtr<GrGLCheckFramebufferStatusProc> fCheckFramebufferStatus;
- GLPtr<GrGLClearProc> fClear;
- GLPtr<GrGLClearColorProc> fClearColor;
- GLPtr<GrGLClearStencilProc> fClearStencil;
- GLPtr<GrGLClientActiveTextureProc> fClientActiveTexture;
- GLPtr<GrGLColorMaskProc> fColorMask;
- GLPtr<GrGLCompileShaderProc> fCompileShader;
- GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
- GLPtr<GrGLCopyTexSubImage2DProc> fCopyTexSubImage2D;
- GLPtr<GrGLCreateProgramProc> fCreateProgram;
- GLPtr<GrGLCreateShaderProc> fCreateShader;
- GLPtr<GrGLCullFaceProc> fCullFace;
- GLPtr<GrGLDeleteBuffersProc> fDeleteBuffers;
- GLPtr<GrGLDeleteFramebuffersProc> fDeleteFramebuffers;
- GLPtr<GrGLDeleteProgramProc> fDeleteProgram;
- GLPtr<GrGLDeleteQueriesProc> fDeleteQueries;
- GLPtr<GrGLDeleteRenderbuffersProc> fDeleteRenderbuffers;
- GLPtr<GrGLDeleteShaderProc> fDeleteShader;
- GLPtr<GrGLDeleteTexturesProc> fDeleteTextures;
- GLPtr<GrGLDeleteVertexArraysProc> fDeleteVertexArrays;
- GLPtr<GrGLDepthMaskProc> fDepthMask;
- GLPtr<GrGLDisableProc> fDisable;
- GLPtr<GrGLDisableClientStateProc> fDisableClientState;
- GLPtr<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray;
- GLPtr<GrGLDrawArraysProc> fDrawArrays;
- GLPtr<GrGLDrawBufferProc> fDrawBuffer;
- GLPtr<GrGLDrawBuffersProc> fDrawBuffers;
- GLPtr<GrGLDrawElementsProc> fDrawElements;
- GLPtr<GrGLEnableProc> fEnable;
- GLPtr<GrGLEnableClientStateProc> fEnableClientState;
- GLPtr<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray;
- GLPtr<GrGLEndQueryProc> fEndQuery;
- GLPtr<GrGLFinishProc> fFinish;
- GLPtr<GrGLFlushProc> fFlush;
- GLPtr<GrGLFramebufferRenderbufferProc> fFramebufferRenderbuffer;
- GLPtr<GrGLFramebufferTexture2DProc> fFramebufferTexture2D;
- GLPtr<GrGLFramebufferTexture2DMultisampleProc> fFramebufferTexture2DMultisample;
- GLPtr<GrGLFrontFaceProc> fFrontFace;
- GLPtr<GrGLGenBuffersProc> fGenBuffers;
- GLPtr<GrGLGenFramebuffersProc> fGenFramebuffers;
- GLPtr<GrGLGenerateMipmapProc> fGenerateMipmap;
- GLPtr<GrGLGenQueriesProc> fGenQueries;
- GLPtr<GrGLGenRenderbuffersProc> fGenRenderbuffers;
- GLPtr<GrGLGenTexturesProc> fGenTextures;
- GLPtr<GrGLGenVertexArraysProc> fGenVertexArrays;
- GLPtr<GrGLGetBufferParameterivProc> fGetBufferParameteriv;
- GLPtr<GrGLGetErrorProc> fGetError;
- GLPtr<GrGLGetFramebufferAttachmentParameterivProc> fGetFramebufferAttachmentParameteriv;
- GLPtr<GrGLGetIntegervProc> fGetIntegerv;
- GLPtr<GrGLGetQueryObjecti64vProc> fGetQueryObjecti64v;
- GLPtr<GrGLGetQueryObjectivProc> fGetQueryObjectiv;
- GLPtr<GrGLGetQueryObjectui64vProc> fGetQueryObjectui64v;
- GLPtr<GrGLGetQueryObjectuivProc> fGetQueryObjectuiv;
- GLPtr<GrGLGetQueryivProc> fGetQueryiv;
- GLPtr<GrGLGetProgramInfoLogProc> fGetProgramInfoLog;
- GLPtr<GrGLGetProgramivProc> fGetProgramiv;
- GLPtr<GrGLGetRenderbufferParameterivProc> fGetRenderbufferParameteriv;
- GLPtr<GrGLGetShaderInfoLogProc> fGetShaderInfoLog;
- GLPtr<GrGLGetShaderivProc> fGetShaderiv;
- GLPtr<GrGLGetStringProc> fGetString;
- GLPtr<GrGLGetStringiProc> fGetStringi;
- GLPtr<GrGLGetTexLevelParameterivProc> fGetTexLevelParameteriv;
- GLPtr<GrGLGetUniformLocationProc> fGetUniformLocation;
- GLPtr<GrGLLineWidthProc> fLineWidth;
- GLPtr<GrGLLinkProgramProc> fLinkProgram;
- GLPtr<GrGLLoadIdentityProc> fLoadIdentity;
- GLPtr<GrGLLoadMatrixfProc> fLoadMatrixf;
- GLPtr<GrGLMapBufferProc> fMapBuffer;
- GLPtr<GrGLMatrixModeProc> fMatrixMode;
- GLPtr<GrGLPixelStoreiProc> fPixelStorei;
- GLPtr<GrGLQueryCounterProc> fQueryCounter;
- GLPtr<GrGLReadBufferProc> fReadBuffer;
- GLPtr<GrGLReadPixelsProc> fReadPixels;
- GLPtr<GrGLRenderbufferStorageProc> fRenderbufferStorage;
-
-#if !GR_GL_IGNORE_ES3_MSAA
- // On OpenGL ES there are multiple incompatible extensions that add support for MSAA
- // and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the
- // older extensions for performance reasons or due to ES3 driver bugs. We want the function
- // that creates the GrGLInterface to provide all available functions and internally
- // we will select among them. They all have a method called glRenderbufferStorageMultisample*.
- // So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture,
- // GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample
- // variations.
- //
- // If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will
- // assume the function pointers for the standard (or equivalent GL_ARB) version have
- // been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced
- // functionality.
-
- // GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture
- GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2EXT;
- // GL_APPLE_framebuffer_multisample
- GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2APPLE;
-#endif
- // This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or
- // the standard function in ES3+ or GL 3.0+.
- GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisample;
-
- // Pointer to BindUniformLocationCHROMIUM from the GL_CHROMIUM_bind_uniform_location extension.
- GLPtr<GrGLBindUniformLocation> fBindUniformLocation;
-
- GLPtr<GrGLResolveMultisampleFramebufferProc> fResolveMultisampleFramebuffer;
- GLPtr<GrGLScissorProc> fScissor;
- GLPtr<GrGLShaderSourceProc> fShaderSource;
- GLPtr<GrGLStencilFuncProc> fStencilFunc;
- GLPtr<GrGLStencilFuncSeparateProc> fStencilFuncSeparate;
- GLPtr<GrGLStencilMaskProc> fStencilMask;
- GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
- GLPtr<GrGLStencilOpProc> fStencilOp;
- GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate;
- GLPtr<GrGLTexGenfProc> fTexGenf;
- GLPtr<GrGLTexGenfvProc> fTexGenfv;
- GLPtr<GrGLTexGeniProc> fTexGeni;
- GLPtr<GrGLTexImage2DProc> fTexImage2D;
- GLPtr<GrGLTexParameteriProc> fTexParameteri;
- GLPtr<GrGLTexParameterivProc> fTexParameteriv;
- GLPtr<GrGLTexSubImage2DProc> fTexSubImage2D;
- GLPtr<GrGLTexStorage2DProc> fTexStorage2D;
- GLPtr<GrGLDiscardFramebufferProc> fDiscardFramebuffer;
- GLPtr<GrGLUniform1fProc> fUniform1f;
- GLPtr<GrGLUniform1iProc> fUniform1i;
- GLPtr<GrGLUniform1fvProc> fUniform1fv;
- GLPtr<GrGLUniform1ivProc> fUniform1iv;
- GLPtr<GrGLUniform2fProc> fUniform2f;
- GLPtr<GrGLUniform2iProc> fUniform2i;
- GLPtr<GrGLUniform2fvProc> fUniform2fv;
- GLPtr<GrGLUniform2ivProc> fUniform2iv;
- GLPtr<GrGLUniform3fProc> fUniform3f;
- GLPtr<GrGLUniform3iProc> fUniform3i;
- GLPtr<GrGLUniform3fvProc> fUniform3fv;
- GLPtr<GrGLUniform3ivProc> fUniform3iv;
- GLPtr<GrGLUniform4fProc> fUniform4f;
- GLPtr<GrGLUniform4iProc> fUniform4i;
- GLPtr<GrGLUniform4fvProc> fUniform4fv;
- GLPtr<GrGLUniform4ivProc> fUniform4iv;
- GLPtr<GrGLUniformMatrix2fvProc> fUniformMatrix2fv;
- GLPtr<GrGLUniformMatrix3fvProc> fUniformMatrix3fv;
- GLPtr<GrGLUniformMatrix4fvProc> fUniformMatrix4fv;
- GLPtr<GrGLUnmapBufferProc> fUnmapBuffer;
- GLPtr<GrGLUseProgramProc> fUseProgram;
- GLPtr<GrGLVertexAttrib4fvProc> fVertexAttrib4fv;
- GLPtr<GrGLVertexAttribPointerProc> fVertexAttribPointer;
- GLPtr<GrGLVertexPointerProc> fVertexPointer;
- GLPtr<GrGLViewportProc> fViewport;
-
- // Experimental: Functions for GL_NV_path_rendering. These will be
- // alphabetized with the above functions once this is fully supported
- // (and functions we are unlikely to use will possibly be omitted).
- GLPtr<GrGLPathCommandsProc> fPathCommands;
- GLPtr<GrGLPathCoordsProc> fPathCoords;
- GLPtr<GrGLPathSubCommandsProc> fPathSubCommands;
- GLPtr<GrGLPathSubCoordsProc> fPathSubCoords;
- GLPtr<GrGLPathStringProc> fPathString;
- GLPtr<GrGLPathGlyphsProc> fPathGlyphs;
- GLPtr<GrGLPathGlyphRangeProc> fPathGlyphRange;
- GLPtr<GrGLWeightPathsProc> fWeightPaths;
- GLPtr<GrGLCopyPathProc> fCopyPath;
- GLPtr<GrGLInterpolatePathsProc> fInterpolatePaths;
- GLPtr<GrGLTransformPathProc> fTransformPath;
- GLPtr<GrGLPathParameterivProc> fPathParameteriv;
- GLPtr<GrGLPathParameteriProc> fPathParameteri;
- GLPtr<GrGLPathParameterfvProc> fPathParameterfv;
- GLPtr<GrGLPathParameterfProc> fPathParameterf;
- GLPtr<GrGLPathDashArrayProc> fPathDashArray;
- GLPtr<GrGLGenPathsProc> fGenPaths;
- GLPtr<GrGLDeletePathsProc> fDeletePaths;
- GLPtr<GrGLIsPathProc> fIsPath;
- GLPtr<GrGLPathStencilFuncProc> fPathStencilFunc;
- GLPtr<GrGLPathStencilDepthOffsetProc> fPathStencilDepthOffset;
- GLPtr<GrGLStencilFillPathProc> fStencilFillPath;
- GLPtr<GrGLStencilStrokePathProc> fStencilStrokePath;
- GLPtr<GrGLStencilFillPathInstancedProc> fStencilFillPathInstanced;
- GLPtr<GrGLStencilStrokePathInstancedProc> fStencilStrokePathInstanced;
- GLPtr<GrGLPathCoverDepthFuncProc> fPathCoverDepthFunc;
- GLPtr<GrGLPathColorGenProc> fPathColorGen;
- GLPtr<GrGLPathTexGenProc> fPathTexGen;
- GLPtr<GrGLPathFogGenProc> fPathFogGen;
- GLPtr<GrGLCoverFillPathProc> fCoverFillPath;
- GLPtr<GrGLCoverStrokePathProc> fCoverStrokePath;
- GLPtr<GrGLCoverFillPathInstancedProc> fCoverFillPathInstanced;
- GLPtr<GrGLCoverStrokePathInstancedProc> fCoverStrokePathInstanced;
- GLPtr<GrGLGetPathParameterivProc> fGetPathParameteriv;
- GLPtr<GrGLGetPathParameterfvProc> fGetPathParameterfv;
- GLPtr<GrGLGetPathCommandsProc> fGetPathCommands;
- GLPtr<GrGLGetPathCoordsProc> fGetPathCoords;
- GLPtr<GrGLGetPathDashArrayProc> fGetPathDashArray;
- GLPtr<GrGLGetPathMetricsProc> fGetPathMetrics;
- GLPtr<GrGLGetPathMetricRangeProc> fGetPathMetricRange;
- GLPtr<GrGLGetPathSpacingProc> fGetPathSpacing;
- GLPtr<GrGLGetPathColorGenivProc> fGetPathColorGeniv;
- GLPtr<GrGLGetPathColorGenfvProc> fGetPathColorGenfv;
- GLPtr<GrGLGetPathTexGenivProc> fGetPathTexGeniv;
- GLPtr<GrGLGetPathTexGenfvProc> fGetPathTexGenfv;
- GLPtr<GrGLIsPointInFillPathProc> fIsPointInFillPath;
- GLPtr<GrGLIsPointInStrokePathProc> fIsPointInStrokePath;
- GLPtr<GrGLGetPathLengthProc> fGetPathLength;
- GLPtr<GrGLPointAlongPathProc> fPointAlongPath;
+ static GrGLInterface* NewClone(const GrGLInterface*);
+
+ // Validates that the GrGLInterface supports its advertised standard. This means the necessary
+ // function pointers have been initialized for both the GL version and any advertised
+ // extensions.
+ bool validate() const;
+
+ // Indicates the type of GL implementation
+ union {
+ GrGLStandard fStandard;
+ GrGLStandard fBindingsExported; // Legacy name, will be remove when Chromium is updated.
+ };
+
+ GrGLExtensions fExtensions;
+
+ bool hasExtension(const char ext[]) const { return fExtensions.has(ext); }
+
+ /**
+ * The function pointers are in a struct so that we can have a compiler generated assignment
+ * operator.
+ */
+ struct Functions {
+ GLPtr<GrGLActiveTextureProc> fActiveTexture;
+ GLPtr<GrGLAttachShaderProc> fAttachShader;
+ GLPtr<GrGLBeginQueryProc> fBeginQuery;
+ GLPtr<GrGLBindAttribLocationProc> fBindAttribLocation;
+ GLPtr<GrGLBindBufferProc> fBindBuffer;
+ GLPtr<GrGLBindFragDataLocationProc> fBindFragDataLocation;
+ GLPtr<GrGLBindFragDataLocationIndexedProc> fBindFragDataLocationIndexed;
+ GLPtr<GrGLBindFramebufferProc> fBindFramebuffer;
+ GLPtr<GrGLBindRenderbufferProc> fBindRenderbuffer;
+ GLPtr<GrGLBindTextureProc> fBindTexture;
+ GLPtr<GrGLBindVertexArrayProc> fBindVertexArray;
+ GLPtr<GrGLBlendColorProc> fBlendColor;
+ GLPtr<GrGLBlendFuncProc> fBlendFunc;
+ GLPtr<GrGLBlitFramebufferProc> fBlitFramebuffer;
+ GLPtr<GrGLBufferDataProc> fBufferData;
+ GLPtr<GrGLBufferSubDataProc> fBufferSubData;
+ GLPtr<GrGLCheckFramebufferStatusProc> fCheckFramebufferStatus;
+ GLPtr<GrGLClearProc> fClear;
+ GLPtr<GrGLClearColorProc> fClearColor;
+ GLPtr<GrGLClearStencilProc> fClearStencil;
+ GLPtr<GrGLColorMaskProc> fColorMask;
+ GLPtr<GrGLCompileShaderProc> fCompileShader;
+ GLPtr<GrGLCompressedTexImage2DProc> fCompressedTexImage2D;
+ GLPtr<GrGLCompressedTexSubImage2DProc> fCompressedTexSubImage2D;
+ GLPtr<GrGLCopyTexSubImage2DProc> fCopyTexSubImage2D;
+ GLPtr<GrGLCreateProgramProc> fCreateProgram;
+ GLPtr<GrGLCreateShaderProc> fCreateShader;
+ GLPtr<GrGLCullFaceProc> fCullFace;
+ GLPtr<GrGLDeleteBuffersProc> fDeleteBuffers;
+ GLPtr<GrGLDeleteFramebuffersProc> fDeleteFramebuffers;
+ GLPtr<GrGLDeleteProgramProc> fDeleteProgram;
+ GLPtr<GrGLDeleteQueriesProc> fDeleteQueries;
+ GLPtr<GrGLDeleteRenderbuffersProc> fDeleteRenderbuffers;
+ GLPtr<GrGLDeleteShaderProc> fDeleteShader;
+ GLPtr<GrGLDeleteTexturesProc> fDeleteTextures;
+ GLPtr<GrGLDeleteVertexArraysProc> fDeleteVertexArrays;
+ GLPtr<GrGLDepthMaskProc> fDepthMask;
+ GLPtr<GrGLDisableProc> fDisable;
+ GLPtr<GrGLDisableVertexAttribArrayProc> fDisableVertexAttribArray;
+ GLPtr<GrGLDrawArraysProc> fDrawArrays;
+ GLPtr<GrGLDrawBufferProc> fDrawBuffer;
+ GLPtr<GrGLDrawBuffersProc> fDrawBuffers;
+ GLPtr<GrGLDrawElementsProc> fDrawElements;
+ GLPtr<GrGLEnableProc> fEnable;
+ GLPtr<GrGLEnableVertexAttribArrayProc> fEnableVertexAttribArray;
+ GLPtr<GrGLEndQueryProc> fEndQuery;
+ GLPtr<GrGLFinishProc> fFinish;
+ GLPtr<GrGLFlushProc> fFlush;
+ GLPtr<GrGLFlushMappedBufferRangeProc> fFlushMappedBufferRange;
+ GLPtr<GrGLFramebufferRenderbufferProc> fFramebufferRenderbuffer;
+ GLPtr<GrGLFramebufferTexture2DProc> fFramebufferTexture2D;
+ GLPtr<GrGLFramebufferTexture2DMultisampleProc> fFramebufferTexture2DMultisample;
+ GLPtr<GrGLFrontFaceProc> fFrontFace;
+ GLPtr<GrGLGenBuffersProc> fGenBuffers;
+ GLPtr<GrGLGenFramebuffersProc> fGenFramebuffers;
+ GLPtr<GrGLGenerateMipmapProc> fGenerateMipmap;
+ GLPtr<GrGLGenQueriesProc> fGenQueries;
+ GLPtr<GrGLGenRenderbuffersProc> fGenRenderbuffers;
+ GLPtr<GrGLGenTexturesProc> fGenTextures;
+ GLPtr<GrGLGenVertexArraysProc> fGenVertexArrays;
+ GLPtr<GrGLGetBufferParameterivProc> fGetBufferParameteriv;
+ GLPtr<GrGLGetErrorProc> fGetError;
+ GLPtr<GrGLGetFramebufferAttachmentParameterivProc> fGetFramebufferAttachmentParameteriv;
+ GLPtr<GrGLGetIntegervProc> fGetIntegerv;
+ GLPtr<GrGLGetQueryObjecti64vProc> fGetQueryObjecti64v;
+ GLPtr<GrGLGetQueryObjectivProc> fGetQueryObjectiv;
+ GLPtr<GrGLGetQueryObjectui64vProc> fGetQueryObjectui64v;
+ GLPtr<GrGLGetQueryObjectuivProc> fGetQueryObjectuiv;
+ GLPtr<GrGLGetQueryivProc> fGetQueryiv;
+ GLPtr<GrGLGetProgramInfoLogProc> fGetProgramInfoLog;
+ GLPtr<GrGLGetProgramivProc> fGetProgramiv;
+ GLPtr<GrGLGetRenderbufferParameterivProc> fGetRenderbufferParameteriv;
+ GLPtr<GrGLGetShaderInfoLogProc> fGetShaderInfoLog;
+ GLPtr<GrGLGetShaderivProc> fGetShaderiv;
+ GLPtr<GrGLGetStringProc> fGetString;
+ GLPtr<GrGLGetStringiProc> fGetStringi;
+ GLPtr<GrGLGetTexLevelParameterivProc> fGetTexLevelParameteriv;
+ GLPtr<GrGLGetUniformLocationProc> fGetUniformLocation;
+ GLPtr<GrGLInsertEventMarkerProc> fInsertEventMarker;
+ GLPtr<GrGLInvalidateBufferDataProc> fInvalidateBufferData;
+ GLPtr<GrGLInvalidateBufferSubDataProc> fInvalidateBufferSubData;
+ GLPtr<GrGLInvalidateFramebufferProc> fInvalidateFramebuffer;
+ GLPtr<GrGLInvalidateSubFramebufferProc> fInvalidateSubFramebuffer;
+ GLPtr<GrGLInvalidateTexImageProc> fInvalidateTexImage;
+ GLPtr<GrGLInvalidateTexSubImageProc> fInvalidateTexSubImage;
+ GLPtr<GrGLLineWidthProc> fLineWidth;
+ GLPtr<GrGLLinkProgramProc> fLinkProgram;
+ GLPtr<GrGLMapBufferProc> fMapBuffer;
+ GLPtr<GrGLMapBufferRangeProc> fMapBufferRange;
+ GLPtr<GrGLMapBufferSubDataProc> fMapBufferSubData;
+ GLPtr<GrGLMapTexSubImage2DProc> fMapTexSubImage2D;
+ GLPtr<GrGLMatrixLoadfProc> fMatrixLoadf;
+ GLPtr<GrGLMatrixLoadIdentityProc> fMatrixLoadIdentity;
+ GLPtr<GrGLPixelStoreiProc> fPixelStorei;
+ GLPtr<GrGLPopGroupMarkerProc> fPopGroupMarker;
+ GLPtr<GrGLPushGroupMarkerProc> fPushGroupMarker;
+ GLPtr<GrGLQueryCounterProc> fQueryCounter;
+ GLPtr<GrGLReadBufferProc> fReadBuffer;
+ GLPtr<GrGLReadPixelsProc> fReadPixels;
+ GLPtr<GrGLRenderbufferStorageProc> fRenderbufferStorage;
+
+ // On OpenGL ES there are multiple incompatible extensions that add support for MSAA
+ // and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the
+ // older extensions for performance reasons or due to ES3 driver bugs. We want the function
+ // that creates the GrGLInterface to provide all available functions and internally
+ // we will select among them. They all have a method called glRenderbufferStorageMultisample*.
+ // So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture,
+ // GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample
+ // variations.
+ //
+ // If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will
+ // assume the function pointers for the standard (or equivalent GL_ARB) version have
+ // been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced
+ // functionality.
+
+ // GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture
+ GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2EXT;
+ // GL_APPLE_framebuffer_multisample
+ GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisampleES2APPLE;
+
+ // This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or
+ // the standard function in ES3+ or GL 3.0+.
+ GLPtr<GrGLRenderbufferStorageMultisampleProc> fRenderbufferStorageMultisample;
+
+ // Pointer to BindUniformLocationCHROMIUM from the GL_CHROMIUM_bind_uniform_location extension.
+ GLPtr<GrGLBindUniformLocation> fBindUniformLocation;
+
+ GLPtr<GrGLResolveMultisampleFramebufferProc> fResolveMultisampleFramebuffer;
+ GLPtr<GrGLScissorProc> fScissor;
+ GLPtr<GrGLShaderSourceProc> fShaderSource;
+ GLPtr<GrGLStencilFuncProc> fStencilFunc;
+ GLPtr<GrGLStencilFuncSeparateProc> fStencilFuncSeparate;
+ GLPtr<GrGLStencilMaskProc> fStencilMask;
+ GLPtr<GrGLStencilMaskSeparateProc> fStencilMaskSeparate;
+ GLPtr<GrGLStencilOpProc> fStencilOp;
+ GLPtr<GrGLStencilOpSeparateProc> fStencilOpSeparate;
+ GLPtr<GrGLTexImage2DProc> fTexImage2D;
+ GLPtr<GrGLTexParameteriProc> fTexParameteri;
+ GLPtr<GrGLTexParameterivProc> fTexParameteriv;
+ GLPtr<GrGLTexSubImage2DProc> fTexSubImage2D;
+ GLPtr<GrGLTexStorage2DProc> fTexStorage2D;
+ GLPtr<GrGLDiscardFramebufferProc> fDiscardFramebuffer;
+ GLPtr<GrGLUniform1fProc> fUniform1f;
+ GLPtr<GrGLUniform1iProc> fUniform1i;
+ GLPtr<GrGLUniform1fvProc> fUniform1fv;
+ GLPtr<GrGLUniform1ivProc> fUniform1iv;
+ GLPtr<GrGLUniform2fProc> fUniform2f;
+ GLPtr<GrGLUniform2iProc> fUniform2i;
+ GLPtr<GrGLUniform2fvProc> fUniform2fv;
+ GLPtr<GrGLUniform2ivProc> fUniform2iv;
+ GLPtr<GrGLUniform3fProc> fUniform3f;
+ GLPtr<GrGLUniform3iProc> fUniform3i;
+ GLPtr<GrGLUniform3fvProc> fUniform3fv;
+ GLPtr<GrGLUniform3ivProc> fUniform3iv;
+ GLPtr<GrGLUniform4fProc> fUniform4f;
+ GLPtr<GrGLUniform4iProc> fUniform4i;
+ GLPtr<GrGLUniform4fvProc> fUniform4fv;
+ GLPtr<GrGLUniform4ivProc> fUniform4iv;
+ GLPtr<GrGLUniformMatrix2fvProc> fUniformMatrix2fv;
+ GLPtr<GrGLUniformMatrix3fvProc> fUniformMatrix3fv;
+ GLPtr<GrGLUniformMatrix4fvProc> fUniformMatrix4fv;
+ GLPtr<GrGLUnmapBufferProc> fUnmapBuffer;
+ GLPtr<GrGLUnmapBufferSubDataProc> fUnmapBufferSubData;
+ GLPtr<GrGLUnmapTexSubImage2DProc> fUnmapTexSubImage2D;
+ GLPtr<GrGLUseProgramProc> fUseProgram;
+ GLPtr<GrGLVertexAttrib4fvProc> fVertexAttrib4fv;
+ GLPtr<GrGLVertexAttribPointerProc> fVertexAttribPointer;
+ GLPtr<GrGLViewportProc> fViewport;
+
+ // Experimental: Functions for GL_NV_path_rendering. These will be
+ // alphabetized with the above functions once this is fully supported
+ // (and functions we are unlikely to use will possibly be omitted).
+ GLPtr<GrGLPathCommandsProc> fPathCommands;
+ GLPtr<GrGLPathCoordsProc> fPathCoords;
+ GLPtr<GrGLPathSubCommandsProc> fPathSubCommands;
+ GLPtr<GrGLPathSubCoordsProc> fPathSubCoords;
+ GLPtr<GrGLPathStringProc> fPathString;
+ GLPtr<GrGLPathGlyphsProc> fPathGlyphs;
+ GLPtr<GrGLPathGlyphRangeProc> fPathGlyphRange;
+ GLPtr<GrGLWeightPathsProc> fWeightPaths;
+ GLPtr<GrGLCopyPathProc> fCopyPath;
+ GLPtr<GrGLInterpolatePathsProc> fInterpolatePaths;
+ GLPtr<GrGLTransformPathProc> fTransformPath;
+ GLPtr<GrGLPathParameterivProc> fPathParameteriv;
+ GLPtr<GrGLPathParameteriProc> fPathParameteri;
+ GLPtr<GrGLPathParameterfvProc> fPathParameterfv;
+ GLPtr<GrGLPathParameterfProc> fPathParameterf;
+ GLPtr<GrGLPathDashArrayProc> fPathDashArray;
+ GLPtr<GrGLGenPathsProc> fGenPaths;
+ GLPtr<GrGLDeletePathsProc> fDeletePaths;
+ GLPtr<GrGLIsPathProc> fIsPath;
+ GLPtr<GrGLPathStencilFuncProc> fPathStencilFunc;
+ GLPtr<GrGLPathStencilDepthOffsetProc> fPathStencilDepthOffset;
+ GLPtr<GrGLStencilFillPathProc> fStencilFillPath;
+ GLPtr<GrGLStencilStrokePathProc> fStencilStrokePath;
+ GLPtr<GrGLStencilFillPathInstancedProc> fStencilFillPathInstanced;
+ GLPtr<GrGLStencilStrokePathInstancedProc> fStencilStrokePathInstanced;
+ GLPtr<GrGLPathCoverDepthFuncProc> fPathCoverDepthFunc;
+ GLPtr<GrGLPathColorGenProc> fPathColorGen;
+ GLPtr<GrGLPathTexGenProc> fPathTexGen;
+ GLPtr<GrGLPathFogGenProc> fPathFogGen;
+ GLPtr<GrGLCoverFillPathProc> fCoverFillPath;
+ GLPtr<GrGLCoverStrokePathProc> fCoverStrokePath;
+ GLPtr<GrGLCoverFillPathInstancedProc> fCoverFillPathInstanced;
+ GLPtr<GrGLCoverStrokePathInstancedProc> fCoverStrokePathInstanced;
+ GLPtr<GrGLGetPathParameterivProc> fGetPathParameteriv;
+ GLPtr<GrGLGetPathParameterfvProc> fGetPathParameterfv;
+ GLPtr<GrGLGetPathCommandsProc> fGetPathCommands;
+ GLPtr<GrGLGetPathCoordsProc> fGetPathCoords;
+ GLPtr<GrGLGetPathDashArrayProc> fGetPathDashArray;
+ GLPtr<GrGLGetPathMetricsProc> fGetPathMetrics;
+ GLPtr<GrGLGetPathMetricRangeProc> fGetPathMetricRange;
+ GLPtr<GrGLGetPathSpacingProc> fGetPathSpacing;
+ GLPtr<GrGLGetPathColorGenivProc> fGetPathColorGeniv;
+ GLPtr<GrGLGetPathColorGenfvProc> fGetPathColorGenfv;
+ GLPtr<GrGLGetPathTexGenivProc> fGetPathTexGeniv;
+ GLPtr<GrGLGetPathTexGenfvProc> fGetPathTexGenfv;
+ GLPtr<GrGLIsPointInFillPathProc> fIsPointInFillPath;
+ GLPtr<GrGLIsPointInStrokePathProc> fIsPointInStrokePath;
+ GLPtr<GrGLGetPathLengthProc> fGetPathLength;
+ GLPtr<GrGLPointAlongPathProc> fPointAlongPath;
+ } fFunctions;
// Per-GL func callback
#if GR_GL_PER_GL_FUNC_CALLBACK
GrGLInterfaceCallbackProc fCallback;
GrGLInterfaceCallbackData fCallbackData;
#endif
-
};
#endif
diff --git a/chromium/third_party/skia/include/gpu/gl/SkGLContextHelper.h b/chromium/third_party/skia/include/gpu/gl/SkGLContextHelper.h
index 44eb509a044..ea940c8bc05 100644
--- a/chromium/third_party/skia/include/gpu/gl/SkGLContextHelper.h
+++ b/chromium/third_party/skia/include/gpu/gl/SkGLContextHelper.h
@@ -8,7 +8,6 @@
#ifndef SkGLContextHelper_DEFINED
#define SkGLContextHelper_DEFINED
-#include "GrGLExtensions.h"
#include "GrGLInterface.h"
/**
@@ -16,7 +15,7 @@
* Provides a GrGLInterface struct of function pointers for the context.
*/
-class SkGLContextHelper : public SkRefCnt {
+class SK_API SkGLContextHelper : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkGLContextHelper)
@@ -48,7 +47,7 @@ public:
bool hasExtension(const char* extensionName) const {
SkASSERT(NULL != fGL);
- return fExtensions.has(extensionName);
+ return fGL->hasExtension(extensionName);
}
protected:
@@ -66,7 +65,6 @@ protected:
virtual void destroyGLContext() = 0;
private:
- GrGLExtensions fExtensions;
GrGLuint fFBO;
GrGLuint fColorBufferID;
GrGLuint fDepthStencilBufferID;
@@ -79,11 +77,11 @@ private:
* Helper macros for using the GL context through the GrGLInterface. Example:
* SK_GL(glCtx, GenTextures(1, &texID));
*/
-#define SK_GL(ctx, X) (ctx).gl()->f ## X; \
- SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError())
-#define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->f ## X; \
- SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fGetError())
-#define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->f ## X
-#define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->f ## X
+#define SK_GL(ctx, X) (ctx).gl()->fFunctions.f ## X; \
+ SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetError())
+#define SK_GL_RET(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X; \
+ SkASSERT(GR_GL_NO_ERROR == (ctx).gl()->fFunctions.fGetError())
+#define SK_GL_NOERRCHECK(ctx, X) (ctx).gl()->fFunctions.f ## X
+#define SK_GL_RET_NOERRCHECK(ctx, RET, X) (RET) = (ctx).gl()->fFunctions.f ## X
#endif
diff --git a/chromium/third_party/skia/include/gpu/gl/SkNullGLContext.h b/chromium/third_party/skia/include/gpu/gl/SkNullGLContext.h
index df7812b98fb..02d968eeff4 100644
--- a/chromium/third_party/skia/include/gpu/gl/SkNullGLContext.h
+++ b/chromium/third_party/skia/include/gpu/gl/SkNullGLContext.h
@@ -10,7 +10,7 @@
#include "SkGLContextHelper.h"
-class SkNullGLContext : public SkGLContextHelper {
+class SK_API SkNullGLContext : public SkGLContextHelper {
public:
SkNullGLContext() {};