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 #include "GrVkGpu.h" | 8 #include "GrVkGpu.h" |
9 | 9 |
10 #include "GrContextOptions.h" | 10 #include "GrContextOptions.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Release old command buffer and create a new one | 166 // Release old command buffer and create a new one |
167 fCurrentCmdBuffer->unref(this); | 167 fCurrentCmdBuffer->unref(this); |
168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); | 168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); |
169 SkASSERT(fCurrentCmdBuffer); | 169 SkASSERT(fCurrentCmdBuffer); |
170 | 170 |
171 fCurrentCmdBuffer->begin(this); | 171 fCurrentCmdBuffer->begin(this); |
172 } | 172 } |
173 | 173 |
174 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
175 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
n accessPattern) { | 175 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
n accessPattern, |
| 176 const void* data) { |
| 177 GrBuffer* buff; |
176 switch (type) { | 178 switch (type) { |
177 case kVertex_GrBufferType: | 179 case kVertex_GrBufferType: |
178 SkASSERT(kDynamic_GrAccessPattern == accessPattern || | 180 SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
179 kStatic_GrAccessPattern == accessPattern); | 181 kStatic_GrAccessPattern == accessPattern); |
180 return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); | 182 buff = GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); |
181 case kIndex_GrBufferType: | 183 case kIndex_GrBufferType: |
182 SkASSERT(kDynamic_GrAccessPattern == accessPattern || | 184 SkASSERT(kDynamic_GrAccessPattern == accessPattern || |
183 kStatic_GrAccessPattern == accessPattern); | 185 kStatic_GrAccessPattern == accessPattern); |
184 return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); | 186 buff = GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern
== accessPattern); |
185 case kXferCpuToGpu_GrBufferType: | 187 case kXferCpuToGpu_GrBufferType: |
186 SkASSERT(kStream_GrAccessPattern == accessPattern); | 188 SkASSERT(kStream_GrAccessPattern == accessPattern); |
187 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_
Type); | 189 buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_
Type); |
188 case kXferGpuToCpu_GrBufferType: | 190 case kXferGpuToCpu_GrBufferType: |
189 SkASSERT(kStream_GrAccessPattern == accessPattern); | 191 SkASSERT(kStream_GrAccessPattern == accessPattern); |
190 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite
_Type); | 192 buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite
_Type); |
191 default: | 193 default: |
192 SkFAIL("Unknown buffer type."); | 194 SkFAIL("Unknown buffer type."); |
193 return nullptr; | 195 return nullptr; |
194 } | 196 } |
| 197 if (data && buff) { |
| 198 buff->updateData(data, size); |
| 199 } |
| 200 return buff; |
195 } | 201 } |
196 | 202 |
197 //////////////////////////////////////////////////////////////////////////////// | 203 //////////////////////////////////////////////////////////////////////////////// |
198 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, | 204 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, |
199 GrPixelConfig srcConfig, DrawPreference* draw
Preference, | 205 GrPixelConfig srcConfig, DrawPreference* draw
Preference, |
200 WritePixelTempDrawInfo* tempDrawInfo) { | 206 WritePixelTempDrawInfo* tempDrawInfo) { |
201 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { | 207 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf
ace->config())) { |
202 return false; | 208 return false; |
203 } | 209 } |
204 | 210 |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 aglSwapBuffers(aglGetCurrentContext()); | 1586 aglSwapBuffers(aglGetCurrentContext()); |
1581 int set_a_break_pt_here = 9; | 1587 int set_a_break_pt_here = 9; |
1582 aglSwapBuffers(aglGetCurrentContext()); | 1588 aglSwapBuffers(aglGetCurrentContext()); |
1583 #elif defined(SK_BUILD_FOR_WIN32) | 1589 #elif defined(SK_BUILD_FOR_WIN32) |
1584 SwapBuf(); | 1590 SwapBuf(); |
1585 int set_a_break_pt_here = 9; | 1591 int set_a_break_pt_here = 9; |
1586 SwapBuf(); | 1592 SwapBuf(); |
1587 #endif | 1593 #endif |
1588 #endif | 1594 #endif |
1589 } | 1595 } |
OLD | NEW |