aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGpuGL.h
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2014-08-20 01:36:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-20 01:36:24 -0700
commitccdaa0422501e5cbcba53d6bd19f2736f1beaef3 (patch)
tree906738bcb15b393917e80d64a30cd23d7343e29c /src/gpu/gl/GrGpuGL.h
parentcecc91c4446c9c2f9b95736e206bfd1d507a75a9 (diff)
Separate GL path rendering state from GrGpuGL to GrGLPathRendering
Separate GL path rendering state from GrGpuGL to GrGLPathRendering. This makes GrGpuGL code simpler. The intention is that while GrGpuGL represents the global environment for GL, the GrGLPathRendering represents the global environment for path rendering extension. Add GrPathRendering, a base class for path rendering, and inherit GrGLPathRendering from that. Move the path rendering virtual functions from GrGpu to GrPathRendering. R=bsalomon@google.com, cdalton@nvidia.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/452823002
Diffstat (limited to 'src/gpu/gl/GrGpuGL.h')
-rw-r--r--src/gpu/gl/GrGpuGL.h42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index b39aedb824..40104f8825 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -12,6 +12,7 @@
#include "GrGLContext.h"
#include "GrGLIRect.h"
#include "GrGLIndexBuffer.h"
+#include "GrGLPathRendering.h"
#include "GrGLProgram.h"
#include "GrGLStencilBuffer.h"
#include "GrGLTexture.h"
@@ -24,8 +25,6 @@
#define PROGRAM_CACHE_STATS
#endif
-class GrGLPathRendering;
-
class GrGpuGL : public GrGpu {
public:
GrGpuGL(const GrGLContext& ctx, GrContext* context);
@@ -40,9 +39,9 @@ public:
GrGLSLGeneration glslGeneration() const { return fGLContext.glslGeneration(); }
const GrGLCaps& glCaps() const { return *fGLContext.caps(); }
- GrGLPathRendering* pathRendering() const {
+ GrGLPathRendering* glPathRendering() {
SkASSERT(glCaps().pathRenderingSupport());
- return fPathRendering.get();
+ return static_cast<GrGLPathRendering*>(pathRendering());
}
virtual void discard(GrRenderTarget*) SK_OVERRIDE;
@@ -50,17 +49,7 @@ public:
// 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 PathTexGenComponents {
- kS_PathTexGenComponents = 1,
- kST_PathTexGenComponents = 2,
- kSTR_PathTexGenComponents = 3
- };
- 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().pathRenderingSupport();
}
@@ -131,8 +120,6 @@ private:
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;
- virtual GrPathRange* onCreatePathRange(size_t size, const SkStrokeRec&) SK_OVERRIDE;
virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&) SK_OVERRIDE;
virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&) SK_OVERRIDE;
virtual bool createStencilBufferForRenderTarget(GrRenderTarget* rt,
@@ -160,12 +147,6 @@ private:
virtual void onGpuDraw(const DrawInfo&) SK_OVERRIDE;
- virtual void onGpuStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
- virtual void onGpuDrawPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
- virtual void onGpuDrawPaths(const GrPathRange*,
- const uint32_t indices[], int count,
- const float transforms[], PathTransformType,
- SkPath::FillType) SK_OVERRIDE;
virtual void clearStencil() SK_OVERRIDE;
virtual void clearStencilClip(const SkIRect& rect,
@@ -257,7 +238,6 @@ private:
void flushRenderTarget(const SkIRect* bound);
void flushStencil(DrawType);
void flushAAState(DrawType);
- void flushPathStencilSettings(SkPath::FillType fill);
bool configToGLFormats(GrPixelConfig config,
bool getSizedInternal,
@@ -445,11 +425,9 @@ private:
TriState fMSAAEnabled;
- GrGLProgram::MatrixState fHWProjectionMatrixState;
-
GrStencilSettings fHWStencilSettings;
TriState fHWStencilTestEnabled;
- GrStencilSettings fHWPathStencilSettings;
+
GrDrawState::DrawFace fHWDrawFace;
TriState fHWWriteToColor;
@@ -457,22 +435,14 @@ private:
uint32_t fHWBoundRenderTargetUniqueID;
SkTArray<uint32_t, true> fHWBoundTextureUniqueIDs;
- struct PathTexGenData {
- GrGLenum fMode;
- GrGLint fNumComponents;
- GrGLfloat fCoefficients[3 * 3];
- };
- 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<GrGLPathRendering> fPathRendering;
-
typedef GrGpu INHERITED;
+ friend class GrGLPathRendering; // For accessing setTextureUnit.
};
#endif