Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1094)

Side by Side Diff: src/gpu/vk/GrVkGpu.cpp

Issue 2038583002: Add GpuCommandBuffer support. (Closed) Base URL: https://skia.googlesource.com/skia.git@secondaryCB
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkGpuCommandBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "GrGeometryProcessor.h" 11 #include "GrGeometryProcessor.h"
12 #include "GrGpuResourceCacheAccess.h" 12 #include "GrGpuResourceCacheAccess.h"
13 #include "GrMesh.h" 13 #include "GrMesh.h"
14 #include "GrPipeline.h" 14 #include "GrPipeline.h"
15 #include "GrRenderTargetPriv.h" 15 #include "GrRenderTargetPriv.h"
16 #include "GrSurfacePriv.h" 16 #include "GrSurfacePriv.h"
17 #include "GrTexturePriv.h" 17 #include "GrTexturePriv.h"
18 18
19 #include "GrVkCommandBuffer.h" 19 #include "GrVkCommandBuffer.h"
20 #include "GrVkGpuCommandBuffer.h"
20 #include "GrVkImage.h" 21 #include "GrVkImage.h"
21 #include "GrVkIndexBuffer.h" 22 #include "GrVkIndexBuffer.h"
22 #include "GrVkMemory.h" 23 #include "GrVkMemory.h"
23 #include "GrVkPipeline.h" 24 #include "GrVkPipeline.h"
24 #include "GrVkPipelineState.h" 25 #include "GrVkPipelineState.h"
25 #include "GrVkRenderPass.h" 26 #include "GrVkRenderPass.h"
26 #include "GrVkResourceProvider.h" 27 #include "GrVkResourceProvider.h"
27 #include "GrVkTexture.h" 28 #include "GrVkTexture.h"
28 #include "GrVkTextureRenderTarget.h" 29 #include "GrVkTextureRenderTarget.h"
29 #include "GrVkTransferBuffer.h" 30 #include "GrVkTransferBuffer.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 #ifdef ENABLE_VK_LAYERS 154 #ifdef ENABLE_VK_LAYERS
154 if (fCallback) { 155 if (fCallback) {
155 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr)); 156 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr));
156 fCallback = VK_NULL_HANDLE; 157 fCallback = VK_NULL_HANDLE;
157 } 158 }
158 #endif 159 #endif
159 } 160 }
160 161
161 /////////////////////////////////////////////////////////////////////////////// 162 ///////////////////////////////////////////////////////////////////////////////
162 163
164 GrGpuCommandBuffer* GrVkGpu::createCommandBuffer(const GrRenderTarget& target,
165 GrGpuCommandBuffer::LoadAndStor eOp colorOp,
166 GrColor colorClear,
167 GrGpuCommandBuffer::LoadAndStor eOp stencilOp,
168 GrColor stencilClear) {
169 const GrVkRenderTarget& vkRT = static_cast<const GrVkRenderTarget&>(target);
170 return new GrVkGpuCommandBuffer(this, vkRT, colorOp, colorClear, stencilOp, stencilClear);
171 }
172
163 void GrVkGpu::submitCommandBuffer(SyncQueue sync) { 173 void GrVkGpu::submitCommandBuffer(SyncQueue sync) {
164 SkASSERT(fCurrentCmdBuffer); 174 SkASSERT(fCurrentCmdBuffer);
165 fCurrentCmdBuffer->end(this); 175 fCurrentCmdBuffer->end(this);
166 176
167 fCurrentCmdBuffer->submitToQueue(this, fQueue, sync); 177 fCurrentCmdBuffer->submitToQueue(this, fQueue, sync);
168 fResourceProvider.checkCommandBuffers(); 178 fResourceProvider.checkCommandBuffers();
169 179
170 // Release old command buffer and create a new one 180 // Release old command buffer and create a new one
171 fCurrentCmdBuffer->unref(this); 181 fCurrentCmdBuffer->unref(this);
172 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer(); 182 fCurrentCmdBuffer = fResourceProvider.createPrimaryCommandBuffer();
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 memcpy(tmpRow, top, tightRowBytes); 1572 memcpy(tmpRow, top, tightRowBytes);
1563 memcpy(top, bottom, tightRowBytes); 1573 memcpy(top, bottom, tightRowBytes);
1564 memcpy(bottom, tmpRow, tightRowBytes); 1574 memcpy(bottom, tmpRow, tightRowBytes);
1565 top += rowBytes; 1575 top += rowBytes;
1566 bottom -= rowBytes; 1576 bottom -= rowBytes;
1567 } 1577 }
1568 } 1578 }
1569 1579
1570 return true; 1580 return true;
1571 } 1581 }
1582
1583 void GrVkGpu::submitSecondaryCommandBuffer(const GrVkSecondaryCommandBuffer* buf fer) {
1584 fCurrentCmdBuffer->executeCommands(this, buffer);
1585 }
1586
1572 sk_sp<GrVkPipelineState> GrVkGpu::prepareDrawState(const GrPipeline& pipeline, 1587 sk_sp<GrVkPipelineState> GrVkGpu::prepareDrawState(const GrPipeline& pipeline,
1573 const GrPrimitiveProcessor& p rimProc, 1588 const GrPrimitiveProcessor& p rimProc,
1574 GrPrimitiveType primitiveType , 1589 GrPrimitiveType primitiveType ,
1575 const GrVkRenderPass& renderP ass) { 1590 const GrVkRenderPass& renderP ass) {
1576 sk_sp<GrVkPipelineState> pipelineState = 1591 sk_sp<GrVkPipelineState> pipelineState =
1577 fResourceProvider.findOrCreateCompatiblePipelineState(pipeline, 1592 fResourceProvider.findOrCreateCompatiblePipelineState(pipeline,
1578 primProc, 1593 primProc,
1579 primitiveType, 1594 primitiveType,
1580 renderPass); 1595 renderPass);
1581 if (!pipelineState) { 1596 if (!pipelineState) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 aglSwapBuffers(aglGetCurrentContext()); 1702 aglSwapBuffers(aglGetCurrentContext());
1688 int set_a_break_pt_here = 9; 1703 int set_a_break_pt_here = 9;
1689 aglSwapBuffers(aglGetCurrentContext()); 1704 aglSwapBuffers(aglGetCurrentContext());
1690 #elif defined(SK_BUILD_FOR_WIN32) 1705 #elif defined(SK_BUILD_FOR_WIN32)
1691 SwapBuf(); 1706 SwapBuf();
1692 int set_a_break_pt_here = 9; 1707 int set_a_break_pt_here = 9;
1693 SwapBuf(); 1708 SwapBuf();
1694 #endif 1709 #endif
1695 #endif 1710 #endif
1696 } 1711 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkGpuCommandBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698