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 /** | |
150 * Resolves MSAA. | 122 * Resolves MSAA. |
151 */ | 123 */ |
152 void resolveRenderTarget(GrRenderTarget* target); | 124 void resolveRenderTarget(GrRenderTarget* target); |
153 | 125 |
154 /** | 126 /** |
155 * Gets a preferred 8888 config to use for writing/reading pixel data to/fro
m a surface with | 127 * Gets a preferred 8888 config to use for writing/reading pixel data to/fro
m a surface with |
156 * config surfaceConfig. The returned config must have at least as many bits
per channel as the | 128 * config surfaceConfig. The returned config must have at least as many bits
per channel as the |
157 * readConfig or writeConfig param. | 129 * readConfig or writeConfig param. |
158 */ | 130 */ |
159 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, | 131 virtual GrPixelConfig preferredReadPixelsConfig(GrPixelConfig readConfig, |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 } | 485 } |
514 | 486 |
515 void handleDirtyContext() { | 487 void handleDirtyContext() { |
516 if (fResetBits) { | 488 if (fResetBits) { |
517 this->resetContext(); | 489 this->resetContext(); |
518 } | 490 } |
519 } | 491 } |
520 | 492 |
521 ResetTimestamp fResetTi
mestamp; | 493 ResetTimestamp fResetTi
mestamp; |
522 uint32_t fResetBi
ts; | 494 uint32_t fResetBi
ts; |
523 // these are mutable so they can be created on-demand | |
524 mutable GrIndexBuffer* fQuadInd
exBuffer; | |
525 // To keep track that we always have at least as many debug marker adds as r
emoves | 495 // To keep track that we always have at least as many debug marker adds as r
emoves |
526 int fGpuTrac
eMarkerCount; | 496 int fGpuTrac
eMarkerCount; |
527 GrTraceMarkerSet fActiveT
raceMarkers; | 497 GrTraceMarkerSet fActiveT
raceMarkers; |
528 GrTraceMarkerSet fStoredT
raceMarkers; | 498 GrTraceMarkerSet fStoredT
raceMarkers; |
529 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. | 499 // The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu. |
530 GrContext* fContext
; | 500 GrContext* fContext
; |
531 | 501 |
532 typedef SkRefCnt INHERITED; | 502 typedef SkRefCnt INHERITED; |
533 }; | 503 }; |
534 | 504 |
535 #endif | 505 #endif |
OLD | NEW |