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

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

Issue 1142003003: Revert of Move copy-surface-as-draw fallback to GrGLGpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@vares
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.h ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11
12 12 void GrGLAttribArrayState::set(const GrGLGpu* gpu,
13 void GrGLAttribArrayState::set(GrGLGpu* gpu,
14 int index, 13 int index,
15 GrGLuint vertexBufferID, 14 GrGLVertexBuffer* buffer,
16 GrGLint size, 15 GrGLint size,
17 GrGLenum type, 16 GrGLenum type,
18 GrGLboolean normalized, 17 GrGLboolean normalized,
19 GrGLsizei stride, 18 GrGLsizei stride,
20 GrGLvoid* offset) { 19 GrGLvoid* offset) {
21 SkASSERT(index >= 0 && index < fAttribArrayStates.count()); 20 SkASSERT(index >= 0 && index < fAttribArrayStates.count());
22 AttribArrayState* array = &fAttribArrayStates[index]; 21 AttribArrayState* array = &fAttribArrayStates[index];
23 if (!array->fEnableIsValid || !array->fEnabled) { 22 if (!array->fEnableIsValid || !array->fEnabled) {
24 GR_GL_CALL(gpu->glInterface(), EnableVertexAttribArray(index)); 23 GR_GL_CALL(gpu->glInterface(), EnableVertexAttribArray(index));
25 array->fEnableIsValid = true; 24 array->fEnableIsValid = true;
26 array->fEnabled = true; 25 array->fEnabled = true;
27 } 26 }
28 if (!array->fAttribPointerIsValid || 27 if (!array->fAttribPointerIsValid ||
29 array->fVertexBufferID != vertexBufferID || 28 array->fVertexBufferID != buffer->bufferID() ||
30 array->fSize != size || 29 array->fSize != size ||
31 array->fNormalized != normalized || 30 array->fNormalized != normalized ||
32 array->fStride != stride || 31 array->fStride != stride ||
33 array->fOffset != offset) { 32 array->fOffset != offset) {
34 33
35 gpu->bindVertexBuffer(vertexBufferID); 34 buffer->bind();
36 GR_GL_CALL(gpu->glInterface(), VertexAttribPointer(index, 35 GR_GL_CALL(gpu->glInterface(), VertexAttribPointer(index,
37 size, 36 size,
38 type, 37 type,
39 normalized, 38 normalized,
40 stride, 39 stride,
41 offset)); 40 offset));
42 array->fAttribPointerIsValid = true; 41 array->fAttribPointerIsValid = true;
43 array->fVertexBufferID = vertexBufferID; 42 array->fVertexBufferID = buffer->bufferID();
44 array->fSize = size; 43 array->fSize = size;
45 array->fNormalized = normalized; 44 array->fNormalized = normalized;
46 array->fStride = stride; 45 array->fStride = stride;
47 array->fOffset = offset; 46 array->fOffset = offset;
48 } 47 }
49 } 48 }
50 49
51 void GrGLAttribArrayState::disableUnusedArrays(const GrGLGpu* gpu, uint64_t used Mask) { 50 void GrGLAttribArrayState::disableUnusedArrays(const GrGLGpu* gpu, uint64_t used Mask) {
52 int count = fAttribArrayStates.count(); 51 int count = fAttribArrayStates.count();
53 for (int i = 0; i < count; ++i) { 52 for (int i = 0; i < count; ++i) {
(...skipping 20 matching lines...) Expand all
74 } 73 }
75 74
76 GrGLAttribArrayState* GrGLVertexArray::bind(GrGLGpu* gpu) { 75 GrGLAttribArrayState* GrGLVertexArray::bind(GrGLGpu* gpu) {
77 if (0 == fID) { 76 if (0 == fID) {
78 return NULL; 77 return NULL;
79 } 78 }
80 gpu->bindVertexArray(fID); 79 gpu->bindVertexArray(fID);
81 return &fAttribArrays; 80 return &fAttribArrays;
82 } 81 }
83 82
84 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu, GrGLuin t ibufferID) { 83 GrGLAttribArrayState* GrGLVertexArray::bindWithIndexBuffer(GrGLGpu* gpu,
84 const GrGLIndexBuffer * buffer) {
85 GrGLAttribArrayState* state = this->bind(gpu); 85 GrGLAttribArrayState* state = this->bind(gpu);
86 if (state) { 86 if (state && buffer) {
87 if (!fIndexBufferIDIsValid || ibufferID != fIndexBufferID) { 87 GrGLuint bufferID = buffer->bufferID();
88 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER , ibufferID)); 88 if (!fIndexBufferIDIsValid || bufferID != fIndexBufferID) {
89 GR_GL_CALL(gpu->glInterface(), BindBuffer(GR_GL_ELEMENT_ARRAY_BUFFER , bufferID));
89 fIndexBufferIDIsValid = true; 90 fIndexBufferIDIsValid = true;
90 fIndexBufferID = ibufferID; 91 fIndexBufferID = bufferID;
91 } 92 }
92 } 93 }
93 return state; 94 return state;
94 } 95 }
95 96
96 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) { 97 void GrGLVertexArray::notifyIndexBufferDelete(GrGLuint bufferID) {
97 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) { 98 if (fIndexBufferIDIsValid && bufferID == fIndexBufferID) {
98 fIndexBufferID = 0; 99 fIndexBufferID = 0;
99 } 100 }
100 } 101 }
101 102
102 void GrGLVertexArray::invalidateCachedState() { 103 void GrGLVertexArray::invalidateCachedState() {
103 fAttribArrays.invalidate(); 104 fAttribArrays.invalidate();
104 fIndexBufferIDIsValid = false; 105 fIndexBufferIDIsValid = false;
105 } 106 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLVertexArray.h ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698