| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef GrVertices_DEFINED | 8 #ifndef GrVertices_DEFINED |
| 9 #define GrVertices_DEFINED | 9 #define GrVertices_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 GrVertices() {} | 22 GrVertices() {} |
| 23 GrVertices(const GrVertices& di) { (*this) = di; } | 23 GrVertices(const GrVertices& di) { (*this) = di; } |
| 24 GrVertices& operator =(const GrVertices& di); | 24 GrVertices& operator =(const GrVertices& di); |
| 25 | 25 |
| 26 void init(GrPrimitiveType primType, const GrVertexBuffer* vertexBuffer, int
startVertex, | 26 void init(GrPrimitiveType primType, const GrVertexBuffer* vertexBuffer, int
startVertex, |
| 27 int vertexCount) { | 27 int vertexCount) { |
| 28 SkASSERT(vertexBuffer); | 28 SkASSERT(vertexBuffer); |
| 29 SkASSERT(vertexCount); | 29 SkASSERT(vertexCount); |
| 30 SkASSERT(startVertex >= 0); | 30 SkASSERT(startVertex >= 0); |
| 31 fPrimitiveType = primType; | 31 fPrimitiveType = primType; |
| 32 fVertexBuffer.reset(SkRef(vertexBuffer)); | 32 fVertexBuffer.reset(vertexBuffer); |
| 33 fIndexBuffer.reset(NULL); | 33 fIndexBuffer.reset(NULL); |
| 34 fStartVertex = startVertex; | 34 fStartVertex = startVertex; |
| 35 fStartIndex = 0; | 35 fStartIndex = 0; |
| 36 fVertexCount = vertexCount; | 36 fVertexCount = vertexCount; |
| 37 fIndexCount = 0; | 37 fIndexCount = 0; |
| 38 fInstanceCount = 0; | 38 fInstanceCount = 0; |
| 39 fVerticesPerInstance = 0; | 39 fVerticesPerInstance = 0; |
| 40 fIndicesPerInstance = 0; | 40 fIndicesPerInstance = 0; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void initIndexed(GrPrimitiveType primType, | 43 void initIndexed(GrPrimitiveType primType, |
| 44 const GrVertexBuffer* vertexBuffer, | 44 const GrVertexBuffer* vertexBuffer, |
| 45 const GrIndexBuffer* indexBuffer, | 45 const GrIndexBuffer* indexBuffer, |
| 46 int startVertex, | 46 int startVertex, |
| 47 int startIndex, | 47 int startIndex, |
| 48 int vertexCount, | 48 int vertexCount, |
| 49 int indexCount) { | 49 int indexCount) { |
| 50 SkASSERT(indexBuffer); | 50 SkASSERT(indexBuffer); |
| 51 SkASSERT(vertexBuffer); | 51 SkASSERT(vertexBuffer); |
| 52 SkASSERT(indexCount); | 52 SkASSERT(indexCount); |
| 53 SkASSERT(vertexCount); | 53 SkASSERT(vertexCount); |
| 54 SkASSERT(startIndex >= 0); | 54 SkASSERT(startIndex >= 0); |
| 55 SkASSERT(startVertex >= 0); | 55 SkASSERT(startVertex >= 0); |
| 56 fPrimitiveType = primType; | 56 fPrimitiveType = primType; |
| 57 fVertexBuffer.reset(SkRef(vertexBuffer)); | 57 fVertexBuffer.reset(vertexBuffer); |
| 58 fIndexBuffer.reset(SkRef(indexBuffer)); | 58 fIndexBuffer.reset(indexBuffer); |
| 59 fStartVertex = startVertex; | 59 fStartVertex = startVertex; |
| 60 fStartIndex = startIndex; | 60 fStartIndex = startIndex; |
| 61 fVertexCount = vertexCount; | 61 fVertexCount = vertexCount; |
| 62 fIndexCount = indexCount; | 62 fIndexCount = indexCount; |
| 63 fInstanceCount = 0; | 63 fInstanceCount = 0; |
| 64 fVerticesPerInstance = 0; | 64 fVerticesPerInstance = 0; |
| 65 fIndicesPerInstance = 0; | 65 fIndicesPerInstance = 0; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void initInstanced(GrPrimitiveType primType, | 68 void initInstanced(GrPrimitiveType primType, |
| 69 const GrVertexBuffer* vertexBuffer, | 69 const GrVertexBuffer* vertexBuffer, |
| 70 const GrIndexBuffer* indexBuffer, | 70 const GrIndexBuffer* indexBuffer, |
| 71 int startVertex, | 71 int startVertex, |
| 72 int verticesPerInstance, | 72 int verticesPerInstance, |
| 73 int indicesPerInstance, | 73 int indicesPerInstance, |
| 74 int instanceCount) { | 74 int instanceCount) { |
| 75 SkASSERT(vertexBuffer); | 75 SkASSERT(vertexBuffer); |
| 76 SkASSERT(indexBuffer); | 76 SkASSERT(indexBuffer); |
| 77 SkASSERT(instanceCount); | 77 SkASSERT(instanceCount); |
| 78 SkASSERT(verticesPerInstance); | 78 SkASSERT(verticesPerInstance); |
| 79 SkASSERT(indicesPerInstance); | 79 SkASSERT(indicesPerInstance); |
| 80 SkASSERT(startVertex >= 0); | 80 SkASSERT(startVertex >= 0); |
| 81 fPrimitiveType = primType; | 81 fPrimitiveType = primType; |
| 82 fVertexBuffer.reset(SkRef(vertexBuffer)); | 82 fVertexBuffer.reset(vertexBuffer); |
| 83 fIndexBuffer.reset(SkRef(indexBuffer)); | 83 fIndexBuffer.reset(indexBuffer); |
| 84 fStartVertex = startVertex; | 84 fStartVertex = startVertex; |
| 85 fStartIndex = 0; | 85 fStartIndex = 0; |
| 86 fVerticesPerInstance = verticesPerInstance; | 86 fVerticesPerInstance = verticesPerInstance; |
| 87 fIndicesPerInstance = indicesPerInstance; | 87 fIndicesPerInstance = indicesPerInstance; |
| 88 fInstanceCount = instanceCount; | 88 fInstanceCount = instanceCount; |
| 89 fVertexCount = instanceCount * fVerticesPerInstance; | 89 fVertexCount = instanceCount * fVerticesPerInstance; |
| 90 fIndexCount = instanceCount * fIndicesPerInstance; | 90 fIndexCount = instanceCount * fIndicesPerInstance; |
| 91 } | 91 } |
| 92 | 92 |
| 93 /** Variation of the above that may be used when the total number of instanc
es may exceed | 93 /** Variation of the above that may be used when the total number of instanc
es may exceed |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 int fInstanceCount; | 153 int fInstanceCount; |
| 154 int fVerticesPerInstance; | 154 int fVerticesPerInstance; |
| 155 int fIndicesPerInstance; | 155 int fIndicesPerInstance; |
| 156 | 156 |
| 157 GrPendingIOResource<const GrVertexBuffer, kRead_GrIOType> fVertexBuffer; | 157 GrPendingIOResource<const GrVertexBuffer, kRead_GrIOType> fVertexBuffer; |
| 158 GrPendingIOResource<const GrIndexBuffer, kRead_GrIOType> fIndexBuffer; | 158 GrPendingIOResource<const GrIndexBuffer, kRead_GrIOType> fIndexBuffer; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 #endif | 161 #endif |
| OLD | NEW |