OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrGpu_DEFINED | 8 #ifndef GrGpu_DEFINED |
9 #define GrGpu_DEFINED | 9 #define GrGpu_DEFINED |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 * @param size size in bytes of the index buffer | 112 * @param size size in bytes of the index buffer |
113 * @param dynamic hints whether the data will be frequently changed | 113 * @param dynamic hints whether the data will be frequently changed |
114 * by either GrIndexBuffer::map() or | 114 * by either GrIndexBuffer::map() or |
115 * GrIndexBuffer::updateData(). | 115 * GrIndexBuffer::updateData(). |
116 * | 116 * |
117 * @return The index buffer if successful, otherwise NULL. | 117 * @return The index buffer if successful, otherwise NULL. |
118 */ | 118 */ |
119 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); | 119 GrIndexBuffer* createIndexBuffer(size_t size, bool dynamic); |
120 | 120 |
121 /** | 121 /** |
| 122 * Creates an index buffer for instance drawing with a specific pattern. |
| 123 * |
| 124 * @param pattern the pattern to repeat |
| 125 * @param patternSize size in bytes of the pattern |
| 126 * @param reps number of times to repeat the pattern |
| 127 * @param vertCount number of vertices the pattern references |
| 128 * @param dynamic hints whether the data will be frequently changed |
| 129 * by either GrIndexBuffer::map() or |
| 130 * GrIndexBuffer::updateData(). |
| 131 * |
| 132 * @return The index buffer if successful, otherwise NULL. |
| 133 */ |
| 134 GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, |
| 135 int patternSize, |
| 136 int reps, |
| 137 int vertCount, |
| 138 bool isDynamic = false); |
| 139 |
| 140 /** |
| 141 * Returns an index buffer that can be used to render quads. |
| 142 * Six indices per quad: 0, 1, 2, 0, 2, 3, etc. |
| 143 * The max number of quads can be queried using GrIndexBuffer::maxQuads(). |
| 144 * Draw with kTriangles_GrPrimitiveType |
| 145 * @ return the quad index buffer |
| 146 */ |
| 147 const GrIndexBuffer* getQuadIndexBuffer() const; |
| 148 |
| 149 /** |
122 * Resolves MSAA. | 150 * Resolves MSAA. |
123 */ | 151 */ |
124 void resolveRenderTarget(GrRenderTarget* target); | 152 void resolveRenderTarget(GrRenderTarget* target); |
125 | 153 |
126 /** | 154 /** |
127 * Gets a preferred 8888 config to use for writing/reading pixel data to/fro
m a surface with | 155 * Gets a preferred 8888 config to use for writing/reading pixel data to/fro
m a surface with |
128 * config surfaceConfig. The returned config must have at least as many bits
per channel as the | 156 * config surfaceConfig. The returned config must have at least as many bits
per channel as the |
129 * readConfig or writeConfig param. | 157 * readConfig or writeConfig param. |
130 */ | 158 */ |
131 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, | 159 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 } | 513 } |
486 | 514 |
487 void handleDirtyContext() { | 515 void handleDirtyContext() { |
488 if (fResetBits) { | 516 if (fResetBits) { |
489 this->resetContext(); | 517 this->resetContext(); |
490 } | 518 } |
491 } | 519 } |
492 | 520 |
493 ResetTimestamp fResetTi
mestamp; | 521 ResetTimestamp fResetTi
mestamp; |
494 uint32_t fResetBi
ts; | 522 uint32_t fResetBi
ts; |
| 523 // these are mutable so they can be created on-demand |
| 524 mutable GrIndexBuffer* fQuadInd
exBuffer; |
495 // To keep track that we always have at least as many debug marker adds as r
emoves | 525 // To keep track that we always have at least as many debug marker adds as r
emoves |
496 int fGpuTrac
eMarkerCount; | 526 int fGpuTrac
eMarkerCount; |
497 GrTraceMarkerSet fActiveT
raceMarkers; | 527 GrTraceMarkerSet fActiveT
raceMarkers; |
498 GrTraceMarkerSet fStoredT
raceMarkers; | 528 GrTraceMarkerSet fStoredT
raceMarkers; |
499 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 529 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
500 GrContext* fContext
; | 530 GrContext* fContext
; |
501 | 531 |
502 typedef SkRefCnt INHERITED; | 532 typedef SkRefCnt INHERITED; |
503 }; | 533 }; |
504 | 534 |
505 #endif | 535 #endif |
OLD | NEW |