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

Unified Diff: tools/vulkan/VulkanTestContext.h

Issue 1873453002: Some more improvements/fixes to the VulkanViewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary files Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: tools/vulkan/VulkanTestContext.h
diff --git a/tools/vulkan/VulkanTestContext.h b/tools/vulkan/VulkanTestContext.h
index b300a578a2a7d43a26c12c82a0788f554d3100af..0e0851c550b6be1171a25bab4c8fbd2978b654a1 100644
--- a/tools/vulkan/VulkanTestContext.h
+++ b/tools/vulkan/VulkanTestContext.h
@@ -1,92 +1,92 @@
-
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#ifndef VulkanTestContext_DEFINED
-#define VulkanTestContext_DEFINED
-
-#ifdef SK_VULKAN
-
-#include "GrTypes.h"
-#include "vk/GrVkBackendContext.h"
-
-class SkSurface;
-class GrContext;
-
-class VulkanTestContext {
-public:
- ~VulkanTestContext();
-
- // each platform will have to implement these in its CPP file
- VkSurfaceKHR createVkSurface(void* platformData);
- bool canPresent(uint32_t queueFamilyIndex);
-
- static VulkanTestContext* Create(void* platformData, int msaaSampleCount) {
- VulkanTestContext* ctx = new VulkanTestContext(platformData, msaaSampleCount);
- if (!ctx->isValid()) {
- delete ctx;
- return nullptr;
- }
- return ctx;
- }
-
- SkSurface* getBackbufferSurface();
- void swapBuffers();
-
- bool makeCurrent() { return true; }
- int getStencilBits() { return 0; }
- int getSampleCount() { return 0; }
-
- bool isValid() { return SkToBool(fBackendContext.get()); }
-
- void resize(uint32_t w, uint32_t h) {
- this->createSwapchain(w, h);
- }
-
- GrBackendContext getBackendContext() { return (GrBackendContext)fBackendContext.get(); }
-
-private:
- VulkanTestContext();
- VulkanTestContext(void*, int msaaSampleCount);
- void initializeContext(void*);
- void destroyContext();
-
- struct BackbufferInfo {
- uint32_t fImageIndex; // image this is associated with
- VkSemaphore fAcquireSemaphore; // we signal on this for acquisition of image
- VkSemaphore fRenderSemaphore; // we wait on this for rendering to be done
- VkCommandBuffer fTransitionCmdBuffers[2]; // to transition layout between present and render
- VkFence fUsageFences[2]; // used to ensure this data is no longer used on GPU
- };
-
- BackbufferInfo* getAvailableBackbuffer();
- bool createSwapchain(uint32_t width, uint32_t height);
- void createBuffers();
- void destroyBuffers();
-
- SkAutoTUnref<const GrVkBackendContext> fBackendContext;
-
- GrContext* fContext;
- VkSurfaceKHR fSurface;
- VkSwapchainKHR fSwapchain;
- uint32_t fPresentQueueIndex;
- VkQueue fPresentQueue;
- int fWidth;
- int fHeight;
- GrPixelConfig fPixelConfig;
-
- uint32_t fImageCount;
- VkImage* fImages; // images in the swapchain
- VkImageLayout* fImageLayouts; // layouts of these images when not color attachment
- sk_sp<SkSurface>* fSurfaces; // wrapped surface for those images
- VkCommandPool fCommandPool;
- BackbufferInfo* fBackbuffers;
- uint32_t fCurrentBackbufferIndex;
-};
-
-#endif // SK_VULKAN
-
-#endif
+
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef VulkanTestContext_DEFINED
+#define VulkanTestContext_DEFINED
+
+#ifdef SK_VULKAN
+
+#include "GrTypes.h"
+#include "vk/GrVkBackendContext.h"
+
+class SkSurface;
+class GrContext;
+
+class VulkanTestContext {
+public:
+ ~VulkanTestContext();
+
+ // each platform will have to implement these in its CPP file
+ VkSurfaceKHR createVkSurface(void* platformData);
+ bool canPresent(uint32_t queueFamilyIndex);
+
+ static VulkanTestContext* Create(void* platformData, int msaaSampleCount) {
+ VulkanTestContext* ctx = new VulkanTestContext(platformData, msaaSampleCount);
+ if (!ctx->isValid()) {
+ delete ctx;
+ return nullptr;
+ }
+ return ctx;
+ }
+
+ SkSurface* getBackbufferSurface();
+ void swapBuffers();
+
+ bool makeCurrent() { return true; }
+ int getStencilBits() { return 0; }
+ int getSampleCount() { return 0; }
+
+ bool isValid() { return SkToBool(fBackendContext.get()); }
+
+ void resize(uint32_t w, uint32_t h) {
+ this->createSwapchain(w, h);
+ }
+
+ GrBackendContext getBackendContext() { return (GrBackendContext)fBackendContext.get(); }
+
+private:
+ VulkanTestContext();
+ VulkanTestContext(void*, int msaaSampleCount);
+ void initializeContext(void*);
+ void destroyContext();
+
+ struct BackbufferInfo {
+ uint32_t fImageIndex; // image this is associated with
+ VkSemaphore fAcquireSemaphore; // we signal on this for acquisition of image
+ VkSemaphore fRenderSemaphore; // we wait on this for rendering to be done
+ VkCommandBuffer fTransitionCmdBuffers[2]; // to transition layout between present and render
+ VkFence fUsageFences[2]; // used to ensure this data is no longer used on GPU
+ };
+
+ BackbufferInfo* getAvailableBackbuffer();
+ bool createSwapchain(uint32_t width, uint32_t height);
+ void createBuffers();
+ void destroyBuffers();
+
+ SkAutoTUnref<const GrVkBackendContext> fBackendContext;
+
+ GrContext* fContext;
+ VkSurfaceKHR fSurface;
+ VkSwapchainKHR fSwapchain;
+ uint32_t fPresentQueueIndex;
+ VkQueue fPresentQueue;
+ int fWidth;
+ int fHeight;
+ GrPixelConfig fPixelConfig;
+
+ uint32_t fImageCount;
+ VkImage* fImages; // images in the swapchain
+ VkImageLayout* fImageLayouts; // layouts of these images when not color attachment
+ sk_sp<SkSurface>* fSurfaces; // wrapped surface for those images
egdaniel 2016/04/07 17:03:16 is this another line ending issue?
jvanverth1 2016/04/07 17:57:03 Done.
+ VkCommandPool fCommandPool;
+ BackbufferInfo* fBackbuffers;
+ uint32_t fCurrentBackbufferIndex;
+};
+
+#endif // SK_VULKAN
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698