summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/skia/src/gpu/gl/GrGpuGL.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/src/gpu/gl/GrGpuGL.h')
-rw-r--r--chromium/third_party/skia/src/gpu/gl/GrGpuGL.h75
1 files changed, 52 insertions, 23 deletions
diff --git a/chromium/third_party/skia/src/gpu/gl/GrGpuGL.h b/chromium/third_party/skia/src/gpu/gl/GrGpuGL.h
index 1a3f1a29f35..a2c636d2aad 100644
--- a/chromium/third_party/skia/src/gpu/gl/GrGpuGL.h
+++ b/chromium/third_party/skia/src/gpu/gl/GrGpuGL.h
@@ -26,6 +26,8 @@
#define PROGRAM_CACHE_STATS
#endif
+class GrGLNameAllocator;
+
class GrGpuGL : public GrGpu {
public:
GrGpuGL(const GrGLContext& ctx, GrContext* context);
@@ -34,27 +36,30 @@ public:
const GrGLContext& glContext() const { return fGLContext; }
const GrGLInterface* glInterface() const { return fGLContext.interface(); }
- const GrGLContextInfo& ctxInfo() const { return fGLContext.info(); }
- GrGLBinding glBinding() const { return fGLContext.info().binding(); }
- GrGLVersion glVersion() const { return fGLContext.info().version(); }
- GrGLSLGeneration glslGeneration() const { return fGLContext.info().glslGeneration(); }
+ const GrGLContextInfo& ctxInfo() const { return fGLContext; }
+ GrGLStandard glStandard() const { return fGLContext.standard(); }
+ GrGLVersion glVersion() const { return fGLContext.version(); }
+ GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration(); }
+ const GrGLCaps& glCaps() const { return *fGLContext.caps(); }
+
+ virtual void discard(GrRenderTarget*) SK_OVERRIDE;
- // Used by GrGLProgram and GrGLTexGenProgramEffects to configure OpenGL state.
+ // Used by GrGLProgram and GrGLPathTexGenProgramEffects to configure OpenGL
+ // state.
void bindTexture(int unitIdx, const GrTextureParams& params, GrGLTexture* texture);
void setProjectionMatrix(const SkMatrix& matrix,
const SkISize& renderTargetSize,
GrSurfaceOrigin renderTargetOrigin);
- enum TexGenComponents {
- kS_TexGenComponents = 1,
- kST_TexGenComponents = 2,
- kSTR_TexGenComponents = 3
+ enum PathTexGenComponents {
+ kS_PathTexGenComponents = 1,
+ kST_PathTexGenComponents = 2,
+ kSTR_PathTexGenComponents = 3
};
- void enableTexGen(int unitIdx, TexGenComponents, const GrGLfloat* coefficients);
- void enableTexGen(int unitIdx, TexGenComponents, const SkMatrix& matrix);
- void flushTexGenSettings(int numUsedTexCoordSets);
+ void enablePathTexGen(int unitIdx, PathTexGenComponents, const GrGLfloat* coefficients);
+ void enablePathTexGen(int unitIdx, PathTexGenComponents, const SkMatrix& matrix);
+ void flushPathTexGenSettings(int numUsedTexCoordSets);
bool shouldUseFixedFunctionTexturing() const {
- return this->glCaps().fixedFunctionSupport() &&
- this->glCaps().pathRenderingSupport();
+ return this->glCaps().pathRenderingSupport();
}
bool programUnitTest(int maxStages);
@@ -77,8 +82,6 @@ public:
virtual void abandonResources() SK_OVERRIDE;
- const GrGLCaps& glCaps() const { return *fGLContext.info().caps(); }
-
// These functions should be used to bind GL objects. They track the GL state and skip redundant
// bindings. Making the equivalent glBind calls directly will confuse the state tracking.
void bindVertexArray(GrGLuint id) {
@@ -105,6 +108,11 @@ public:
void notifyTextureDelete(GrGLTexture* texture);
void notifyRenderTargetDelete(GrRenderTarget* renderTarget);
+ // These functions should be used to generate and delete GL path names. They have their own
+ // allocator that runs on the client side, so they are much faster than going through GenPaths.
+ GrGLuint createGLPathObject();
+ void deleteGLPathObject(GrGLuint);
+
protected:
virtual bool onCopySurface(GrSurface* dst,
GrSurface* src,
@@ -123,6 +131,8 @@ private:
virtual GrTexture* onCreateTexture(const GrTextureDesc& desc,
const void* srcData,
size_t rowBytes) SK_OVERRIDE;
+ virtual GrTexture* onCreateCompressedTexture(const GrTextureDesc& desc,
+ const void* srcData) SK_OVERRIDE;
virtual GrVertexBuffer* onCreateVertexBuffer(size_t size, bool dynamic) SK_OVERRIDE;
virtual GrIndexBuffer* onCreateIndexBuffer(size_t size, bool dynamic) SK_OVERRIDE;
virtual GrPath* onCreatePath(const SkPath&, const SkStrokeRec&) SK_OVERRIDE;
@@ -137,8 +147,6 @@ private:
virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect) SK_OVERRIDE;
- virtual void onForceRenderTargetFlush() SK_OVERRIDE;
-
virtual bool onReadPixels(GrRenderTarget* target,
int left, int top,
int width, int height,
@@ -157,12 +165,19 @@ private:
virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
+ virtual void onGpuDrawPaths(int, const GrPath**, const SkMatrix*,
+ SkPath::FillType,
+ SkStrokeRec::Style) SK_OVERRIDE;
virtual void clearStencil() SK_OVERRIDE;
virtual void clearStencilClip(const SkIRect& rect,
bool insideClip) SK_OVERRIDE;
virtual bool flushGraphicsState(DrawType, const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
+ // GrDrawTarget ovverides
+ virtual void didAddGpuTraceMarker() SK_OVERRIDE;
+ virtual void didRemoveGpuTraceMarker() SK_OVERRIDE;
+
// binds texture unit in GL
void setTextureUnit(int unitIdx);
@@ -177,7 +192,7 @@ private:
// have been accounted for).
void flushBlend(bool isLines, GrBlendCoeff srcCoeff, GrBlendCoeff dstCoeff);
- bool hasExtension(const char* ext) const { return fGLContext.info().hasExtension(ext); }
+ bool hasExtension(const char* ext) const { return fGLContext.hasExtension(ext); }
static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff);
@@ -195,7 +210,7 @@ private:
enum {
// We may actually have kMaxEntries+1 shaders in the GL context because we create a new
// shader before evicting from the cache.
- kMaxEntries = 32,
+ kMaxEntries = 128,
kHashBits = 6,
};
@@ -259,6 +274,18 @@ private:
const void* data,
size_t rowBytes);
+ // helper for onCreateCompressedTexture. If width and height are
+ // set to -1, then this function will use desc.fWidth and desc.fHeight
+ // for the size of the data. The isNewTexture flag should be set to true
+ // whenever a new texture needs to be created. Otherwise, we assume that
+ // the texture is already in GPU memory and that it's going to be updated
+ // with new data.
+ bool uploadCompressedTexData(const GrGLTexture::Desc& desc,
+ const void* data,
+ bool isNewTexture = true,
+ int left = 0, int top = 0,
+ int width = -1, int height = -1);
+
bool createRenderTargetObjects(int width, int height,
GrGLuint texID,
GrGLRenderTarget::Desc* desc);
@@ -440,19 +467,21 @@ private:
GrRenderTarget* fHWBoundRenderTarget;
SkTArray<GrTexture*, true> fHWBoundTextures;
- struct TexGenData {
+ struct PathTexGenData {
GrGLenum fMode;
GrGLint fNumComponents;
GrGLfloat fCoefficients[3 * 3];
};
- int fHWActiveTexGenSets;
- SkTArray<TexGenData, true> fHWTexGenSettings;
+ int fHWActivePathTexGenSets;
+ SkTArray<PathTexGenData, true> fHWPathTexGenSettings;
///@}
// we record what stencil format worked last time to hopefully exit early
// from our loop that tries stencil formats and calls check fb status.
int fLastSuccessfulStencilFmtIdx;
+ SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator;
+
typedef GrGpu INHERITED;
};