aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLProgram.h
diff options
context:
space:
mode:
authorGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-28 16:28:34 +0000
committerGravatar jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-28 16:28:34 +0000
commitb8b705b1b983a2ee3a254bed4dd03f926101e4e7 (patch)
tree700a965273fff93e1cc821bfdbcc22028e138d46 /src/gpu/gl/GrGLProgram.h
parent4aaaaeace7e617ddc473645756fb7c20790bc270 (diff)
Add new vertex attribute array specification.
This changes the old method of setting vertex layout to a new one where we specify vertex attribute data separately from attribute bindings (i.e. program functionality). Attribute data is now set up via an array of generic attribute types and offsets, and this is mapped to the old program functionality by setting specific attribute indices. This allows us to create more general inputs to shaders. git-svn-id: http://skia.googlecode.com/svn/trunk@7899 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLProgram.h')
-rw-r--r--src/gpu/gl/GrGLProgram.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 2c48d73e03..ea39fa8e53 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -79,17 +79,6 @@ public:
GrGLuint programID() const { return fProgramID; }
/**
- * Attribute indices. These should not overlap.
- */
- enum {
- kPositionAttributeIndex = 0,
- kColorAttributeIndex = 1,
- kCoverageAttributeIndex = 2,
- kEdgeAttributeIndex = 3,
- kTexCoordAttributeIndex = 4,
- };
-
- /**
* Some GL state that is relevant to programs is not stored per-program. In particular vertex
* attributes are global state. This struct is read and updated by GrGLProgram::setData to
* allow us to avoid setting this state redundantly.
@@ -182,7 +171,7 @@ public:
bool fDiscardIfOutsideEdge;
// stripped of bits that don't affect program generation
- GrVertexLayout fVertexLayout;
+ GrAttribBindings fAttribBindings;
/** Non-zero if this stage has an effect */
GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages];
@@ -199,9 +188,23 @@ public:
SkBool8 fEmitsPointSize;
uint8_t fColorFilterXfermode; // casts to enum SkXfermode::Mode
+ int8_t fPositionAttributeIndex;
+ int8_t fColorAttributeIndex;
+ int8_t fCoverageAttributeIndex;
+ int8_t fEdgeAttributeIndex;
+ int8_t fTexCoordAttributeIndex;
+
friend class GrGLProgram;
};
+ // Layout information for OpenGL vertex attributes
+ struct AttribLayout {
+ GrGLint fCount;
+ GrGLenum fType;
+ GrGLboolean fNormalized;
+ };
+ static const AttribLayout kAttribLayouts[kGrVertexAttribTypeCount];
+
private:
GrGLProgram(const GrGLContextInfo& gl,
const Desc& desc,