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

Unified Diff: src/gpu/vk/GrVkGpu.h

Issue 1825593002: GrVkGpu initialization cleanup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments (and rebase to ToT) Created 4 years, 9 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
« no previous file with comments | « src/gpu/vk/GrVkExtensions.cpp ('k') | src/gpu/vk/GrVkGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkGpu.h
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index a686c721fd9f48b33bce58dbb49c6b114d10744d..b9f9027945cda69f445089925958cc3f6e79c8e5 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -10,6 +10,7 @@
#include "GrGpu.h"
#include "GrGpuFactory.h"
+#include "vk/GrVkBackendContext.h"
#include "GrVkCaps.h"
#include "GrVkIndexBuffer.h"
#include "GrVkProgram.h"
@@ -36,14 +37,12 @@ struct GrVkInterface;
class GrVkGpu : public GrGpu {
public:
- // Currently passing in the inst so that we can properly delete it when we are done.
- // Normally this would be done by the client.
- GrVkGpu(GrContext* context, const GrContextOptions& options,
- VkPhysicalDevice physDev, VkDevice device, VkQueue queue, VkCommandPool cmdPool,
- VkInstance inst);
+ static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions& options,
+ GrContext* context);
+
~GrVkGpu() override;
- const GrVkInterface* vkInterface() const { return fInterface.get(); }
+ const GrVkInterface* vkInterface() const { return fBackendContext->fInterface; }
const GrVkCaps& vkCaps() const { return *fVkCaps; }
VkDevice device() const { return fDevice; }
@@ -124,6 +123,9 @@ public:
void finishDrawTarget() override;
private:
+ GrVkGpu(GrContext* context, const GrContextOptions& options,
+ const GrVkBackendContext* backendContext);
+
void onResetContext(uint32_t resetBits) override {}
GrTexture* onCreateTexture(const GrSurfaceDesc& desc, GrGpuResource::LifeCycle,
@@ -211,27 +213,30 @@ private:
const void* data,
size_t rowBytes);
- SkAutoTUnref<const GrVkInterface> fInterface;
- SkAutoTUnref<GrVkCaps> fVkCaps;
- VkPhysicalDeviceMemoryProperties fPhysDevMemProps;
- VkDevice fDevice;
- VkQueue fQueue; // for now, one queue
- VkCommandPool fCmdPool;
- GrVkCommandBuffer* fCurrentCmdBuffer;
- GrVkResourceProvider fResourceProvider;
+ SkAutoTUnref<const GrVkBackendContext> fBackendContext;
+ SkAutoTUnref<GrVkCaps> fVkCaps;
+
+ // These Vulkan objects are provided by the client, and also stored in fBackendContext.
+ // They're copied here for convenient access.
+ VkInstance fVkInstance;
+ VkDevice fDevice;
+ VkQueue fQueue; // Must be Graphics queue
+
+ // Created by GrVkGpu
+ GrVkResourceProvider fResourceProvider;
+ VkCommandPool fCmdPool;
+ GrVkCommandBuffer* fCurrentCmdBuffer;
+ VkPhysicalDeviceMemoryProperties fPhysDevMemProps;
#ifdef ENABLE_VK_LAYERS
// For reporting validation layer errors
- VkDebugReportCallbackEXT fCallback;
+ VkDebugReportCallbackEXT fCallback;
#endif
// Shaderc compiler used for compiling glsl in spirv. We only want to create the compiler once
// since there is significant overhead to the first compile of any compiler.
shaderc_compiler_t fCompiler;
- // This is only for our current testing and building. The client should be holding on to the
- // VkInstance.
- VkInstance fVkInstance;
typedef GrGpu INHERITED;
};
« no previous file with comments | « src/gpu/vk/GrVkExtensions.cpp ('k') | src/gpu/vk/GrVkGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698