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

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

Issue 1984363002: initial checkin of SkSL compiler (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: documentation and cleanups 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
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"
(...skipping 17 matching lines...) Expand all
28 #include "GrVkTextureRenderTarget.h" 28 #include "GrVkTextureRenderTarget.h"
29 #include "GrVkTransferBuffer.h" 29 #include "GrVkTransferBuffer.h"
30 #include "GrVkVertexBuffer.h" 30 #include "GrVkVertexBuffer.h"
31 31
32 #include "SkConfig8888.h" 32 #include "SkConfig8888.h"
33 #include "SkMipMap.h" 33 #include "SkMipMap.h"
34 34
35 #include "vk/GrVkInterface.h" 35 #include "vk/GrVkInterface.h"
36 #include "vk/GrVkTypes.h" 36 #include "vk/GrVkTypes.h"
37 37
38 #if USE_SKSL
39 #include "SkSLCompiler.h"
40 #endif
41
38 #define VK_CALL(X) GR_VK_CALL(this->vkInterface(), X) 42 #define VK_CALL(X) GR_VK_CALL(this->vkInterface(), X)
39 #define VK_CALL_RET(RET, X) GR_VK_CALL_RET(this->vkInterface(), RET, X) 43 #define VK_CALL_RET(RET, X) GR_VK_CALL_RET(this->vkInterface(), RET, X)
40 #define VK_CALL_ERRCHECK(X) GR_VK_CALL_ERRCHECK(this->vkInterface(), X) 44 #define VK_CALL_ERRCHECK(X) GR_VK_CALL_ERRCHECK(this->vkInterface(), X)
41 45
42 #ifdef ENABLE_VK_LAYERS 46 #ifdef ENABLE_VK_LAYERS
43 VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback( 47 VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(
44 VkDebugReportFlagsEXT flags, 48 VkDebugReportFlagsEXT flags,
45 VkDebugReportObjectTypeEXT objectType, 49 VkDebugReportObjectTypeEXT objectType,
46 uint64_t object, 50 uint64_t object,
47 size_t location, 51 size_t location,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; 106 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
103 callbackCreateInfo.pfnCallback = &DebugReportCallback; 107 callbackCreateInfo.pfnCallback = &DebugReportCallback;
104 callbackCreateInfo.pUserData = nullptr; 108 callbackCreateInfo.pUserData = nullptr;
105 109
106 // Register the callback 110 // Register the callback
107 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT( 111 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT(
108 backendCtx->fInstance, &callbackCreateInfo, nullptr, &fCallback)); 112 backendCtx->fInstance, &callbackCreateInfo, nullptr, &fCallback));
109 } 113 }
110 #endif 114 #endif
111 115
116 #if USE_SKSL
117 fCompiler = new SkSL::Compiler();
118 #else
112 fCompiler = shaderc_compiler_initialize(); 119 fCompiler = shaderc_compiler_initialize();
120 #endif
113 121
114 fVkCaps.reset(new GrVkCaps(options, this->vkInterface(), backendCtx->fPhysic alDevice, 122 fVkCaps.reset(new GrVkCaps(options, this->vkInterface(), backendCtx->fPhysic alDevice,
115 backendCtx->fFeatures, backendCtx->fExtensions)); 123 backendCtx->fFeatures, backendCtx->fExtensions));
116 fCaps.reset(SkRef(fVkCaps.get())); 124 fCaps.reset(SkRef(fVkCaps.get()));
117 125
118 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy sDevMemProps)); 126 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy sDevMemProps));
119 127
120 const VkCommandPoolCreateInfo cmdPoolInfo = { 128 const VkCommandPoolCreateInfo cmdPoolInfo = {
121 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType 129 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType
122 nullptr, // pNext 130 nullptr, // pNext
(...skipping 18 matching lines...) Expand all
141 fResourceProvider.checkCommandBuffers(); 149 fResourceProvider.checkCommandBuffers();
142 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue)); 150 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue));
143 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) 151 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec)
144 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); 152 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res);
145 153
146 // must call this just before we destroy the VkDevice 154 // must call this just before we destroy the VkDevice
147 fResourceProvider.destroyResources(); 155 fResourceProvider.destroyResources();
148 156
149 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); 157 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr));
150 158
159 #if USE_SKSL
160 delete fCompiler;
161 #else
151 shaderc_compiler_release(fCompiler); 162 shaderc_compiler_release(fCompiler);
163 #endif
152 164
153 #ifdef ENABLE_VK_LAYERS 165 #ifdef ENABLE_VK_LAYERS
154 if (fCallback) { 166 if (fCallback) {
155 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr)); 167 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr));
156 fCallback = VK_NULL_HANDLE; 168 fCallback = VK_NULL_HANDLE;
157 } 169 }
158 #endif 170 #endif
159 } 171 }
160 172
161 /////////////////////////////////////////////////////////////////////////////// 173 ///////////////////////////////////////////////////////////////////////////////
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 aglSwapBuffers(aglGetCurrentContext()); 1697 aglSwapBuffers(aglGetCurrentContext());
1686 int set_a_break_pt_here = 9; 1698 int set_a_break_pt_here = 9;
1687 aglSwapBuffers(aglGetCurrentContext()); 1699 aglSwapBuffers(aglGetCurrentContext());
1688 #elif defined(SK_BUILD_FOR_WIN32) 1700 #elif defined(SK_BUILD_FOR_WIN32)
1689 SwapBuf(); 1701 SwapBuf();
1690 int set_a_break_pt_here = 9; 1702 int set_a_break_pt_here = 9;
1691 SwapBuf(); 1703 SwapBuf();
1692 #endif 1704 #endif
1693 #endif 1705 #endif
1694 } 1706 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698