Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/gpu/gl/GrGLVertexArray.cpp

Issue 1713693002: Use unorm shorts for texture coordinates when rendering text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix tabbing Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLVertexArray.h" 8 #include "GrGLVertexArray.h"
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 10
11 struct AttribLayout { 11 struct AttribLayout {
12 GrGLint fCount; 12 GrGLint fCount;
13 GrGLenum fType; 13 GrGLenum fType;
14 GrGLboolean fNormalized; // Only used by floating point types. 14 GrGLboolean fNormalized; // Only used by floating point types.
15 }; 15 };
16 16
17 static const AttribLayout gLayouts[kGrVertexAttribTypeCount] = { 17 static const AttribLayout gLayouts[kGrVertexAttribTypeCount] = {
18 {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType 18 {1, GR_GL_FLOAT, false}, // kFloat_GrVertexAttribType
19 {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType 19 {2, GR_GL_FLOAT, false}, // kVec2f_GrVertexAttribType
20 {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType 20 {3, GR_GL_FLOAT, false}, // kVec3f_GrVertexAttribType
21 {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType 21 {4, GR_GL_FLOAT, false}, // kVec4f_GrVertexAttribType
22 {1, GR_GL_UNSIGNED_BYTE, true}, // kUByte_GrVertexAttribType 22 {1, GR_GL_UNSIGNED_BYTE, true}, // kUByte_GrVertexAttribType
23 {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType 23 {4, GR_GL_UNSIGNED_BYTE, true}, // kVec4ub_GrVertexAttribType
24 {2, GR_GL_SHORT, false}, // kVec2s_GrVertexAttribType 24 {2, GR_GL_UNSIGNED_SHORT, true}, // kVec2s_GrVertexAttribType
25 {1, GR_GL_INT, false}, // kInt_GrVertexAttribType 25 {1, GR_GL_INT, false}, // kInt_GrVertexAttribType
26 {1, GR_GL_UNSIGNED_INT, false}, // kUint_GrVertexAttribType 26 {1, GR_GL_UNSIGNED_INT, false}, // kUint_GrVertexAttribType
27 }; 27 };
28 28
29 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType); 29 GR_STATIC_ASSERT(0 == kFloat_GrVertexAttribType);
30 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType); 30 GR_STATIC_ASSERT(1 == kVec2f_GrVertexAttribType);
31 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType); 31 GR_STATIC_ASSERT(2 == kVec3f_GrVertexAttribType);
32 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType); 32 GR_STATIC_ASSERT(3 == kVec4f_GrVertexAttribType);
33 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType); 33 GR_STATIC_ASSERT(4 == kUByte_GrVertexAttribType);
34 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType); 34 GR_STATIC_ASSERT(5 == kVec4ub_GrVertexAttribType);
35 GR_STATIC_ASSERT(6 == kVec2s_GrVertexAttribType); 35 GR_STATIC_ASSERT(6 == kVec2us_GrVertexAttribType);
36 GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType); 36 GR_STATIC_ASSERT(7 == kInt_GrVertexAttribType);
37 GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType); 37 GR_STATIC_ASSERT(8 == kUint_GrVertexAttribType);
38 38
39 void GrGLAttribArrayState::set(GrGLGpu* gpu, 39 void GrGLAttribArrayState::set(GrGLGpu* gpu,
40 int index, 40 int index,
41 GrGLuint vertexBufferID, 41 GrGLuint vertexBufferID,
42 GrVertexAttribType type, 42 GrVertexAttribType type,
43 GrGLsizei stride, 43 GrGLsizei stride,
44 GrGLvoid* offset) { 44 GrGLvoid* offset) {
45 SkASSERT(index >= 0 && index < fAttribArrayStates.count()); 45 SkASSERT(index >= 0 && index < fAttribArrayStates.count());
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { 129 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) {
130 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { 130 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) {
131 fIndexBufferID = 0; 131 fIndexBufferID = 0;
132 } 132 }
133 } 133 }
134 134
135 void GrGLVertexArray::invalidateCachedState() { 135 void GrGLVertexArray::invalidateCachedState() {
136 fAttribArrays.invalidate(); 136 fAttribArrays.invalidate();
137 fIndexBufferIDIsValid = false; 137 fIndexBufferIDIsValid = false;
138 } 138 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDistanceFieldGeoProc.cpp ('k') | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698