diff options
author | 2016-02-08 10:11:47 -0800 | |
---|---|---|
committer | 2016-02-08 10:11:47 -0800 | |
commit | 793dc26ca6ba2543bf50e5215b858d1c265af50c (patch) | |
tree | 7231d4f0f24139a4397433cdca66971f72a0866b /src/gpu/gl/GrGLVertexArray.h | |
parent | 2f8c9bf96ceea9d13fb0fc29285ecaf1673f2e8b (diff) |
Improve GLSL integer support
- Adds shader types for uint.
- Adds a cap for integer support.
- Uses glVertexAttribIPointer for integer attribs.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1669853002
Committed: https://skia.googlesource.com/skia/+/3a2caf8ecf38124f4ad21a0f6c4dabfcfa17911a
Review URL: https://codereview.chromium.org/1669853002
Diffstat (limited to 'src/gpu/gl/GrGLVertexArray.h')
-rw-r--r-- | src/gpu/gl/GrGLVertexArray.h | 49 |
1 files changed, 8 insertions, 41 deletions
diff --git a/src/gpu/gl/GrGLVertexArray.h b/src/gpu/gl/GrGLVertexArray.h index 0a5dea6a1e..f5a97672f3 100644 --- a/src/gpu/gl/GrGLVertexArray.h +++ b/src/gpu/gl/GrGLVertexArray.h @@ -17,35 +17,6 @@ class GrGLVertexBuffer; class GrGLIndexBuffer; class GrGLGpu; -struct GrGLAttribLayout { - GrGLint fCount; - GrGLenum fType; - GrGLboolean fNormalized; -}; - -static inline const GrGLAttribLayout& GrGLAttribTypeToLayout(GrVertexAttribType type) { - static const GrGLAttribLayout kLayouts[kGrVertexAttribTypeCount] = { - {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType - {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType - {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType - {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType - {1, GR_GL_UNSIGNED_BYTE, true}, // kUByte_GrVertexAttribType - {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType - {2, GR_GL_SHORT, false}, // kVec2s_GrVertexAttribType - {4, GR_GL_INT, false}, // kInt_GrVertexAttribType - }; - GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); - GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); - GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); - GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); - GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); - GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); - GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); - GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType); - GR_STATIC_ASSERT(SK_ARRAY_COUNT(kLayouts) == kGrVertexAttribTypeCount); - return kLayouts[type]; -} - /** * This sets and tracks the vertex attribute array state. It is used internally by GrGLVertexArray * (below) but is separate because it is also used to track the state of vertex array object 0. @@ -71,9 +42,7 @@ public: void set(GrGLGpu*, int attribIndex, GrGLuint vertexBufferID, - GrGLint size, - GrGLenum type, - GrGLboolean normalized, + GrVertexAttribType type, GrGLsizei stride, GrGLvoid* offset); @@ -115,15 +84,13 @@ private: fAttribPointerIsValid = false; } - bool fEnableIsValid; - bool fAttribPointerIsValid; - bool fEnabled; - GrGLuint fVertexBufferID; - GrGLint fSize; - GrGLenum fType; - GrGLboolean fNormalized; - GrGLsizei fStride; - GrGLvoid* fOffset; + bool fEnableIsValid; + bool fAttribPointerIsValid; + bool fEnabled; + GrGLuint fVertexBufferID; + GrVertexAttribType fType; + GrGLsizei fStride; + GrGLvoid* fOffset; }; SkSTArray<16, AttribArrayState, true> fAttribArrayStates; |