aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-05 15:13:46 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-05 15:13:46 +0000
commit492093951ae2a7d7c14aa22f48faa8942f045caf (patch)
tree67a1855b72554cf761eb44e61bde4d3e979cd990 /src
parent691703cdd4ab51b23c59798e7018dd7920a34be3 (diff)
Move stuff from protected to private in GrGpuGL
Review URL: http://codereview.appspot.com/6295044/ git-svn-id: http://skia.googlecode.com/svn/trunk@4161 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGpuGL.cpp10
-rw-r--r--src/gpu/gl/GrGpuGL.h68
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp14
3 files changed, 48 insertions, 44 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index a1cd1e08f6..bf526c9a0f 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -481,7 +481,7 @@ void GrGpuGL::onResetContext() {
GL_CALL(LineWidth(1));
// invalid
- fActiveTextureUnitIdx = -1;
+ fHWActiveTextureUnitIdx = -1;
fHWBlendState.invalidate();
@@ -2395,16 +2395,16 @@ bool GrGpuGL::configToGLFormats(GrPixelConfig config,
void GrGpuGL::setTextureUnit(int unit) {
GrAssert(unit >= 0 && unit < GrDrawState::kNumStages);
- if (fActiveTextureUnitIdx != unit) {
+ if (fHWActiveTextureUnitIdx != unit) {
GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + unit));
- fActiveTextureUnitIdx = unit;
+ fHWActiveTextureUnitIdx = unit;
}
}
void GrGpuGL::setSpareTextureUnit() {
- if (fActiveTextureUnitIdx != (GR_GL_TEXTURE0 + SPARE_TEX_UNIT)) {
+ if (fHWActiveTextureUnitIdx != (GR_GL_TEXTURE0 + SPARE_TEX_UNIT)) {
GL_CALL(ActiveTexture(GR_GL_TEXTURE0 + SPARE_TEX_UNIT));
- fActiveTextureUnitIdx = SPARE_TEX_UNIT;
+ fHWActiveTextureUnitIdx = SPARE_TEX_UNIT;
}
}
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index f19981a8e6..5830348b6c 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -55,36 +55,8 @@ public:
bool programUnitTest();
-protected:
-
- enum TriState {
- kNo_TriState,
- kYes_TriState,
- kUnknown_TriState
- };
-
- struct {
- size_t fVertexOffset;
- GrVertexLayout fVertexLayout;
- const GrVertexBuffer* fVertexBuffer;
- const GrIndexBuffer* fIndexBuffer;
- bool fArrayPtrsDirty;
- } fHWGeometryState;
-
- enum UnpremulConversion {
- kUpOnWrite_DownOnRead_UnpremulConversion,
- kDownOnWrite_UpOnRead_UnpremulConversion
- } fUnpremulConversion;
-
- // last scissor / viewport scissor state seen by the GL.
- struct {
- bool fScissorEnabled;
- GrGLIRect fScissorRect;
- GrGLIRect fViewportRect;
- } fHWBounds;
-
- const GrGLCaps& glCaps() const { return fGLContextInfo.caps(); }
+protected:
// GrGpu overrides
virtual void onResetContext() SK_OVERRIDE;
@@ -146,6 +118,9 @@ protected:
int vertexCount,
int indexCount) SK_OVERRIDE;
+private:
+
+ const GrGLCaps& glCaps() const { return fGLContextInfo.caps(); }
// binds texture unit in GL
void setTextureUnit(int unitIdx);
@@ -182,7 +157,6 @@ protected:
static bool BlendCoeffReferencesConstant(GrBlendCoeff coeff);
-private:
// for readability of function impls
typedef GrGLProgram::ProgramDesc ProgramDesc;
typedef ProgramDesc::StageDesc StageDesc;
@@ -318,12 +292,36 @@ private:
// GL program-related state
ProgramCache* fProgramCache;
CachedData* fProgramData;
+ GrGLProgram fCurrentProgram;
+
+ ///////////////////////////////////////////////////////////////////////////
+ ///@name Caching of GL State
+ ///@{
+ int fHWActiveTextureUnitIdx;
GrGLuint fHWProgramID;
GrColor fHWConstAttribColor;
GrColor fHWConstAttribCoverage;
- GrGLProgram fCurrentProgram;
- int fActiveTextureUnitIdx;
+ // last scissor / viewport scissor state seen by the GL.
+ struct {
+ bool fScissorEnabled;
+ GrGLIRect fScissorRect;
+ GrGLIRect fViewportRect;
+ } fHWBounds;
+
+ enum TriState {
+ kNo_TriState,
+ kYes_TriState,
+ kUnknown_TriState
+ };
+
+ struct {
+ size_t fVertexOffset;
+ GrVertexLayout fVertexLayout;
+ const GrVertexBuffer* fVertexBuffer;
+ const GrIndexBuffer* fIndexBuffer;
+ bool fArrayPtrsDirty;
+ } fHWGeometryState;
struct {
GrBlendCoeff fSrcCoeff;
@@ -371,11 +369,17 @@ private:
TriState fHWDitherEnabled;
GrRenderTarget* fHWBoundRenderTarget;
GrTexture* fHWBoundTextures[GrDrawState::kNumStages];
+ ///@}
// 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;
+ enum UnpremulConversion {
+ kUpOnWrite_DownOnRead_UnpremulConversion,
+ kDownOnWrite_UpOnRead_UnpremulConversion
+ } fUnpremulConversion;
+
enum CanPreserveUnpremulRoundtrip {
kUnknown_CanPreserveUnpremulRoundtrip,
kNo_CanPreserveUnpremulRoundtrip,
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 99847db14a..f383ffceb8 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -79,7 +79,7 @@ GrGLProgram::CachedData* GrGpuGL::ProgramCache::getProgramData(
}
void GrGpuGL::DeleteProgram(const GrGLInterface* gl,
- CachedData* programData) {
+ CachedData* programData) {
GR_GL_CALL(gl, DeleteShader(programData->fVShaderID));
if (programData->fGShaderID) {
GR_GL_CALL(gl, DeleteShader(programData->fGShaderID));
@@ -478,9 +478,9 @@ bool GrGpuGL::flushGraphicsState(GrPrimitiveType type) {
#endif
void GrGpuGL::setupGeometry(int* startVertex,
- int* startIndex,
- int vertexCount,
- int indexCount) {
+ int* startIndex,
+ int vertexCount,
+ int indexCount) {
int newColorOffset;
int newCoverageOffset;
@@ -635,9 +635,9 @@ void setup_custom_stage(GrGLProgram::ProgramDesc::StageDesc* stage,
}
void GrGpuGL::buildProgram(GrPrimitiveType type,
- BlendOptFlags blendOpts,
- GrBlendCoeff dstCoeff,
- GrCustomStage** customStages) {
+ BlendOptFlags blendOpts,
+ GrBlendCoeff dstCoeff,
+ GrCustomStage** customStages) {
ProgramDesc& desc = fCurrentProgram.fProgramDesc;
const GrDrawState& drawState = this->getDrawState();