Various fixes in VulkanWindowContext
authorGreg Daniel <egdaniel@google.com>
Thu, 27 Oct 2016 20:37:17 +0000 (16:37 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 28 Oct 2016 21:14:17 +0000 (21:14 +0000)
BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4066

Change-Id: Ib42dbe70e868c83bdf06e370388e0cc7639a0992
Reviewed-on: https://skia-review.googlesource.com/4066
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>

gyp/gpu.gyp
tools/viewer/sk_app/VulkanWindowContext.cpp
tools/viewer/sk_app/VulkanWindowContext.h
tools/viewer/sk_app/WindowContext.cpp
tools/viewer/sk_app/WindowContext.h

index 0c09aa87197d786a7f48f8b5e88782d29d28eee3..8b50fdacea0e3f93808d06e964719cf31590d73c 100644 (file)
           'link_settings': {
             'libraries': [ '<(vulkan_lib_name)', ],
           },
-          'dependencies': [
-            'shaderc.gyp:shaderc_combined',
-          ],
           'conditions': [
             [ 'skia_os == "win"', {
              'variables': {
                   '../tools/viewer/sk_app/android',
                 ],
               },
-              'dependencies!': [
-                'shaderc.gyp:shaderc_combined',
-              ],
               'sources': [
                 # the gyp -> android.mk generator doesn't seem to like cpp files
                 # in directories outside of src, bench, or dm.  Until this gets fixed
index 8ce54f0b56a4e6701b20e61bb200d6c28d646f59..9d1e0430976541533b32a0217473041c356ebcc4 100644 (file)
@@ -310,7 +310,7 @@ void VulkanWindowContext::createBuffers(VkFormat format) {
     fenceInfo.pNext = nullptr;
     fenceInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT;
 
-    // we create one additional backbuffer structure here, because we want to 
+    // we create one additional backbuffer structure here, because we want to
     // give the command buffers they contain a chance to finish before we cycle back
     fBackbuffers = new BackbufferInfo[fImageCount + 1];
     for (uint32_t i = 0; i < fImageCount + 1; ++i) {
@@ -417,7 +417,6 @@ VulkanWindowContext::BackbufferInfo* VulkanWindowContext::getAvailableBackbuffer
     }
 
     BackbufferInfo* backbuffer = fBackbuffers + fCurrentBackbufferIndex;
-
     GR_VK_CALL_ERRCHECK(fBackendContext->fInterface,
                         WaitForFences(fBackendContext->fDevice, 2, backbuffer->fUsageFences,
                                       true, UINT64_MAX));
@@ -444,7 +443,7 @@ sk_sp<SkSurface> VulkanWindowContext::getBackbufferSurface() {
     }
     if (VK_ERROR_OUT_OF_DATE_KHR == res) {
         // tear swapchain down and try again
-        if (!this->createSwapchain(0, 0, fDisplayParams)) {
+        if (!this->createSwapchain(-1, -1, fDisplayParams)) {
             return nullptr;
         }
 
index abb873045fc1b9db5ec6a6752991adae486d92b1..c1ed871e8e45b65b57d7de0957e47dd76b1b8e8f 100644 (file)
@@ -36,8 +36,8 @@ public:
         this->createSwapchain(fWidth, fHeight, params);
     }
 
-    GrBackendContext getBackendContext() override { 
-        return (GrBackendContext) fBackendContext.get(); 
+    GrBackendContext getBackendContext() override {
+        return (GrBackendContext) fBackendContext.get();
     }
 
     /** Platform specific function that creates a VkSurfaceKHR for a window */
index a39bb20e5b9cb7ee3f2add7ca2ae8277a3adfe7a..3da8dd1532cb5b8b8bfd2091561834772f778320 100644 (file)
@@ -25,12 +25,13 @@ sk_sp<SkSurface> WindowContext::createOffscreenSurface(bool forceSRGB) {
     return createSurface(nullptr, 0, true, forceSRGB);
 }
 
-sk_sp<SkSurface> WindowContext::createRenderSurface(GrBackendRenderTargetDesc desc, int colorBits) {
+sk_sp<SkSurface> WindowContext::createRenderSurface(const GrBackendRenderTargetDesc& desc,
+                                                    int colorBits) {
     return createSurface(&desc, colorBits, false, false);
 }
 
 sk_sp<SkSurface> WindowContext::createSurface(
-        GrBackendRenderTargetDesc* rtDesc, int colorBits, bool offscreen, bool forceSRGB) {
+        const GrBackendRenderTargetDesc* rtDesc, int colorBits, bool offscreen, bool forceSRGB) {
     if (!this->isGpuContext() || colorBits > 24 || offscreen ||
         kRGBA_F16_SkColorType == fDisplayParams.fColorType) {
         // If we're rendering to F16, we need an off-screen surface - the current render
index 99d693af137d6ef148702c21ecbace45e849a497..438d3c0e630c7784a3e43a3495f0fd9e3cfcd57d 100644 (file)
@@ -49,7 +49,7 @@ public:
 protected:
     virtual bool isGpuContext() { return true;  }
 
-    sk_sp<SkSurface> createRenderSurface(GrBackendRenderTargetDesc, int colorBits);
+    sk_sp<SkSurface> createRenderSurface(const GrBackendRenderTargetDesc&, int colorBits);
 
     GrContext*        fContext;
 
@@ -61,7 +61,7 @@ protected:
 
 private:
     sk_sp<SkSurface> createSurface(
-            GrBackendRenderTargetDesc*, int colorBits, bool offscreen, bool forceSRGB);
+            const GrBackendRenderTargetDesc*, int colorBits, bool offscreen, bool forceSRGB);
 };
 
 }   // namespace sk_app