Refactor how Gr handles vertex and index data. GrGpu and GrInOrderDrawBuffer both GrBufferAllocPool to manage reserved and set-to-array vertex and index data.
rietveld issue 4188049
git-svn-id: http://skia.googlecode.com/svn/trunk@786 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGpuGLShaders.h b/gpu/src/GrGpuGLShaders.h
index e5a5665..a048e93 100644
--- a/gpu/src/GrGpuGLShaders.h
+++ b/gpu/src/GrGpuGLShaders.h
@@ -25,7 +25,7 @@
public:
GrGpuGLShaders();
virtual ~GrGpuGLShaders();
-
+
virtual void resetContext();
// type of colors used by a program
@@ -37,27 +37,27 @@
protected:
// overrides from GrGpu
virtual bool flushGraphicsState(PrimitiveType type);
- virtual void setupGeometry(uint32_t startVertex,
- uint32_t startIndex,
- uint32_t vertexCount,
- uint32_t indexCount);
-
+ virtual void setupGeometry(int* startVertex,
+ int* startIndex,
+ int vertexCount,
+ int indexCount);
+
private:
void resetContextHelper();
-
+
// sets the texture matrix uniform for currently bound program
- void flushTexMatrix(GLint location,
+ void flushTexMatrix(GLint location,
GrGLTexture::Orientation orientation);
// sets the MVP matrix uniform for currently bound program
void flushMatrix(GLint location);
-
+
void flushTwoPointRadial(GLint paramsLocation, const GrSamplerState&);
-
+
// reads shader from array and compiles it with GL, returns shader ID or 0 if failed
GLuint loadShader(GLenum type, const char* src);
-
+
struct ProgramData;
- // creates a GL program with two shaders attached.
+ // creates a GL program with two shaders attached.
// Gets the relevant uniform locations.
// Sets the texture sampler if present to texture 0
// Binds the program
@@ -74,17 +74,17 @@
void flushProgram(PrimitiveType type);
enum Programs {
- // use vertex coordinates
+ // use vertex coordinates
kTextureVertCoords_Program = 0,
kTextureVertCoordsProj_Program,
-
+
// use separate tex coords
kTextureTexCoords_Program,
kTextureTexCoordsProj_Program,
// constant color texture, no proj
// verts as a tex coords
- kTextureVertCoordsNoColor_Program,
+ kTextureVertCoordsNoColor_Program,
// constant color texture, no proj
// separate tex coords
@@ -99,12 +99,12 @@
// programs for sweep texture lookup
kSweepTextureVertCoords_Program,
- kSweepTextureTexCoords_Program,
-
+ kSweepTextureTexCoords_Program,
+
// programs for two-point radial lookup
kTwoPointRadialTextureVertCoords_Program,
kTwoPointRadialTextureTexCoords_Program,
-
+
// color only drawing
kNoTexture_Program,
@@ -113,23 +113,23 @@
// Records per-program information
// we can specify the attribute locations so that they are constant
- // across our shaders. But the driver determines the uniform locations
+ // across our shaders. But the driver determines the uniform locations
// at link time. We don't need to remember the sampler uniform location
// because we will bind a texture slot to it and never change it
- // Uniforms are program-local so we can't rely on fHWState to hold the
+ // Uniforms are program-local so we can't rely on fHWState to hold the
// previous uniform state after a program change.
struct ProgramData {
// IDs
GLuint fVShaderID;
GLuint fFShaderID;
GLuint fProgramID;
-
+
// shader uniform locations (-1 if shader doesn't use them)
GLint fMatrixLocation;
GLint fTexMatrixLocation;
GLint fColorLocation;
GLint fTwoPointParamsLocation;
-
+
ColorType fColorType;
// these reflect the current values of uniforms
@@ -142,10 +142,10 @@
GrScalar fRadial2Radius0;
bool fRadial2PosRoot;
};
-
+
ProgramData fPrograms[kProgramCount];
Programs fHWProgram;
-
+
GrGLTexture::Orientation fTextureOrientation;
typedef GrGpuGL INHERITED;