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

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

Issue 1718693002: Add vulkan files into skia repo. (Closed) Base URL: https://skia.googlesource.com/skia.git@merge
Patch Set: fix path Created 4 years, 10 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/GrVkResource.h ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkResourceProvider.h
diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h
new file mode 100644
index 0000000000000000000000000000000000000000..245062ea8df4827f69713b115373063ecd3400ac
--- /dev/null
+++ b/src/gpu/vk/GrVkResourceProvider.h
@@ -0,0 +1,77 @@
+/*
+* 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 GrVkResourceProvider_DEFINED
+#define GrVkResourceProvider_DEFINED
+
+#include "GrVkDescriptorPool.h"
+#include "GrVkResource.h"
+#include "GrVkUtil.h"
+#include "SkTArray.h"
+
+#include "vulkan/vulkan.h"
+
+class GrPipeline;
+class GrPrimitiveProcessor;
+class GrVkCommandBuffer;
+class GrVkGpu;
+class GrVkPipeline;
+class GrVkRenderPass;
+class GrVkRenderTarget;
+
+class GrVkResourceProvider {
+public:
+ GrVkResourceProvider(GrVkGpu* gpu);
+ ~GrVkResourceProvider();
+
+ GrVkPipeline* createPipeline(const GrPipeline& pipeline,
+ const GrPrimitiveProcessor& primProc,
+ VkPipelineShaderStageCreateInfo* shaderStageInfo,
+ int shaderStageCount,
+ GrPrimitiveType primitiveType,
+ const GrVkRenderPass& renderPass,
+ VkPipelineLayout layout);
+
+ // Finds or creates a simple render pass that matches the target, increments the refcount,
+ // and returns.
+ const GrVkRenderPass* findOrCreateCompatibleRenderPass(const GrVkRenderTarget& target);
+
+ GrVkCommandBuffer* createCommandBuffer();
+ void checkCommandBuffers();
+
+ // Finds or creates a compatible GrVkDescriptorPool for the requested DescriptorTypeCount.
+ // The refcount is incremented and a pointer returned.
+ // TODO: Currently this will just create a descriptor pool without holding onto a ref itself
+ // so we currently do not reuse them. Rquires knowing if another draw is currently using
+ // the GrVkDescriptorPool, the ability to reset pools, and the ability to purge pools out
+ // of our cache of GrVkDescriptorPools.
+ GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(
+ const GrVkDescriptorPool::DescriptorTypeCounts& typeCounts);
+
+ // Destroy any cached resources. To be called before destroying the VkDevice.
+ // The assumption is that all queues are idle and all command buffers are finished.
+ // For resource tracing to work properly, this should be called after unrefing all other
+ // resource usages.
+ void destroyResources();
+
+ // Abandon any cached resources. To be used when the context/VkDevice is lost.
+ // For resource tracing to work properly, this should be called after unrefing all other
+ // resource usages.
+ void abandonResources();
+
+private:
+ GrVkGpu* fGpu;
+
+ // Array of RenderPasses that only have a single color attachment, optional stencil attachment,
+ // optional resolve attachment, and only one subpass
+ SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses;
+
+ // Array of CommandBuffers that are currently in flight
+ SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers;
+};
+
+#endif
« no previous file with comments | « src/gpu/vk/GrVkResource.h ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698