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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType | 121 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType |
122 nullptr, // pNext | 122 nullptr, // pNext |
123 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // CmdPoolCreateFlags | 123 VK_COMMAND_POOL_CREATE_TRANSIENT_BIT, // CmdPoolCreateFlags |
124 backendCtx->fGraphicsQueueIndex, // queueFamilyIndex | 124 backendCtx->fGraphicsQueueIndex, // queueFamilyIndex |
125 }; | 125 }; |
126 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateCommandPool(fDevice, &cmdPool
Info, nullptr, | 126 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateCommandPool(fDevice, &cmdPool
Info, nullptr, |
127 &fCmdPool)); | 127 &fCmdPool)); |
128 | 128 |
129 // must call this after creating the CommandPool | 129 // must call this after creating the CommandPool |
130 fResourceProvider.init(); | 130 fResourceProvider.init(); |
131 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); | 131 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer(); |
132 SkASSERT(fCurrentCmdBuffer); | 132 SkASSERT(fCurrentCmdBuffer); |
133 fCurrentCmdBuffer->begin(this); | 133 fCurrentCmdBuffer->begin(this); |
134 } | 134 } |
135 | 135 |
136 GrVkGpu::~GrVkGpu() { | 136 GrVkGpu::~GrVkGpu() { |
137 fCurrentCmdBuffer->end(this); | 137 fCurrentCmdBuffer->end(this); |
138 fCurrentCmdBuffer->unref(this); | 138 fCurrentCmdBuffer->unref(this); |
139 | 139 |
140 // wait for all commands to finish | 140 // wait for all commands to finish |
141 fResourceProvider.checkCommandBuffers(); | 141 fResourceProvider.checkCommandBuffers(); |
(...skipping 20 matching lines...) Expand all Loading... |
162 | 162 |
163 void GrVkGpu::submitCommandBuffer(SyncQueue sync) { | 163 void GrVkGpu::submitCommandBuffer(SyncQueue sync) { |
164 SkASSERT(fCurrentCmdBuffer); | 164 SkASSERT(fCurrentCmdBuffer); |
165 fCurrentCmdBuffer->end(this); | 165 fCurrentCmdBuffer->end(this); |
166 | 166 |
167 fCurrentCmdBuffer->submitToQueue(this, fQueue, sync); | 167 fCurrentCmdBuffer->submitToQueue(this, fQueue, sync); |
168 fResourceProvider.checkCommandBuffers(); | 168 fResourceProvider.checkCommandBuffers(); |
169 | 169 |
170 // Release old command buffer and create a new one | 170 // Release old command buffer and create a new one |
171 fCurrentCmdBuffer->unref(this); | 171 fCurrentCmdBuffer->unref(this); |
172 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); | 172 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer(); |
173 SkASSERT(fCurrentCmdBuffer); | 173 SkASSERT(fCurrentCmdBuffer); |
174 | 174 |
175 fCurrentCmdBuffer->begin(this); | 175 fCurrentCmdBuffer->begin(this); |
176 } | 176 } |
177 | 177 |
178 /////////////////////////////////////////////////////////////////////////////// | 178 /////////////////////////////////////////////////////////////////////////////// |
179 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
n accessPattern, | 179 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter
n accessPattern, |
180 const void* data) { | 180 const void* data) { |
181 GrBuffer* buff; | 181 GrBuffer* buff; |
182 switch (type) { | 182 switch (type) { |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 aglSwapBuffers(aglGetCurrentContext()); | 1685 aglSwapBuffers(aglGetCurrentContext()); |
1686 int set_a_break_pt_here = 9; | 1686 int set_a_break_pt_here = 9; |
1687 aglSwapBuffers(aglGetCurrentContext()); | 1687 aglSwapBuffers(aglGetCurrentContext()); |
1688 #elif defined(SK_BUILD_FOR_WIN32) | 1688 #elif defined(SK_BUILD_FOR_WIN32) |
1689 SwapBuf(); | 1689 SwapBuf(); |
1690 int set_a_break_pt_here = 9; | 1690 int set_a_break_pt_here = 9; |
1691 SwapBuf(); | 1691 SwapBuf(); |
1692 #endif | 1692 #endif |
1693 #endif | 1693 #endif |
1694 } | 1694 } |
OLD | NEW |