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

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: 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 18 matching lines...) Expand all
29 #include "GrVkTextureRenderTarget.h" 29 #include "GrVkTextureRenderTarget.h"
30 #include "GrVkTransferBuffer.h" 30 #include "GrVkTransferBuffer.h"
31 #include "GrVkVertexBuffer.h" 31 #include "GrVkVertexBuffer.h"
32 32
33 #include "SkConfig8888.h" 33 #include "SkConfig8888.h"
34 #include "SkMipMap.h" 34 #include "SkMipMap.h"
35 35
36 #include "vk/GrVkInterface.h" 36 #include "vk/GrVkInterface.h"
37 #include "vk/GrVkTypes.h" 37 #include "vk/GrVkTypes.h"
38 38
39 #if USE_SKSL
40 #include "SkSLCompiler.h"
41 #endif
42
39 #define VK_CALL(X) GR_VK_CALL(this->vkInterface(), X) 43 #define VK_CALL(X) GR_VK_CALL(this->vkInterface(), X)
40 #define VK_CALL_RET(RET, X) GR_VK_CALL_RET(this->vkInterface(), RET, X) 44 #define VK_CALL_RET(RET, X) GR_VK_CALL_RET(this->vkInterface(), RET, X)
41 #define VK_CALL_ERRCHECK(X) GR_VK_CALL_ERRCHECK(this->vkInterface(), X) 45 #define VK_CALL_ERRCHECK(X) GR_VK_CALL_ERRCHECK(this->vkInterface(), X)
42 46
43 #ifdef ENABLE_VK_LAYERS 47 #ifdef ENABLE_VK_LAYERS
44 VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback( 48 VKAPI_ATTR VkBool32 VKAPI_CALL DebugReportCallback(
45 VkDebugReportFlagsEXT flags, 49 VkDebugReportFlagsEXT flags,
46 VkDebugReportObjectTypeEXT objectType, 50 VkDebugReportObjectTypeEXT objectType,
47 uint64_t object, 51 uint64_t object,
48 size_t location, 52 size_t location,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; 107 VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
104 callbackCreateInfo.pfnCallback = &DebugReportCallback; 108 callbackCreateInfo.pfnCallback = &DebugReportCallback;
105 callbackCreateInfo.pUserData = nullptr; 109 callbackCreateInfo.pUserData = nullptr;
106 110
107 // Register the callback 111 // Register the callback
108 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT( 112 GR_VK_CALL_ERRCHECK(this->vkInterface(), CreateDebugReportCallbackEXT(
109 backendCtx->fInstance, &callbackCreateInfo, nullptr, &fCallback)); 113 backendCtx->fInstance, &callbackCreateInfo, nullptr, &fCallback));
110 } 114 }
111 #endif 115 #endif
112 116
117 #if USE_SKSL
118 fCompiler = new SkSL::Compiler();
119 #else
113 fCompiler = shaderc_compiler_initialize(); 120 fCompiler = shaderc_compiler_initialize();
121 #endif
114 122
115 fVkCaps.reset(new GrVkCaps(options, this->vkInterface(), backendCtx->fPhysic alDevice, 123 fVkCaps.reset(new GrVkCaps(options, this->vkInterface(), backendCtx->fPhysic alDevice,
116 backendCtx->fFeatures, backendCtx->fExtensions)); 124 backendCtx->fFeatures, backendCtx->fExtensions));
117 fCaps.reset(SkRef(fVkCaps.get())); 125 fCaps.reset(SkRef(fVkCaps.get()));
118 126
119 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy sDevMemProps)); 127 VK_CALL(GetPhysicalDeviceMemoryProperties(backendCtx->fPhysicalDevice, &fPhy sDevMemProps));
120 128
121 const VkCommandPoolCreateInfo cmdPoolInfo = { 129 const VkCommandPoolCreateInfo cmdPoolInfo = {
122 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType 130 VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, // sType
123 nullptr, // pNext 131 nullptr, // pNext
(...skipping 28 matching lines...) Expand all
152 fResourceProvider.checkCommandBuffers(); 160 fResourceProvider.checkCommandBuffers();
153 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue)); 161 SkDEBUGCODE(VkResult res = ) VK_CALL(QueueWaitIdle(fQueue));
154 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec) 162 // VK_ERROR_DEVICE_LOST is acceptable when tearing down (see 4.2.4 in spec)
155 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res); 163 SkASSERT(VK_SUCCESS == res || VK_ERROR_DEVICE_LOST == res);
156 164
157 // must call this just before we destroy the VkDevice 165 // must call this just before we destroy the VkDevice
158 fResourceProvider.destroyResources(); 166 fResourceProvider.destroyResources();
159 167
160 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr)); 168 VK_CALL(DestroyCommandPool(fDevice, fCmdPool, nullptr));
161 169
170 #if USE_SKSL
171 delete fCompiler;
172 #else
162 shaderc_compiler_release(fCompiler); 173 shaderc_compiler_release(fCompiler);
174 #endif
163 175
164 #ifdef ENABLE_VK_LAYERS 176 #ifdef ENABLE_VK_LAYERS
165 if (fCallback) { 177 if (fCallback) {
166 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr)); 178 VK_CALL(DestroyDebugReportCallbackEXT(fBackendContext->fInstance, fCallb ack, nullptr));
167 fCallback = VK_NULL_HANDLE; 179 fCallback = VK_NULL_HANDLE;
168 } 180 }
169 #endif 181 #endif
170 } 182 }
171 183
172 /////////////////////////////////////////////////////////////////////////////// 184 ///////////////////////////////////////////////////////////////////////////////
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1706 aglSwapBuffers(aglGetCurrentContext()); 1718 aglSwapBuffers(aglGetCurrentContext());
1707 int set_a_break_pt_here = 9; 1719 int set_a_break_pt_here = 9;
1708 aglSwapBuffers(aglGetCurrentContext()); 1720 aglSwapBuffers(aglGetCurrentContext());
1709 #elif defined(SK_BUILD_FOR_WIN32) 1721 #elif defined(SK_BUILD_FOR_WIN32)
1710 SwapBuf(); 1722 SwapBuf();
1711 int set_a_break_pt_here = 9; 1723 int set_a_break_pt_here = 9;
1712 SwapBuf(); 1724 SwapBuf();
1713 #endif 1725 #endif
1714 #endif 1726 #endif
1715 } 1727 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698