| Index: src/gpu/vk/GrVkResourceProvider.h
|
| diff --git a/src/gpu/vk/GrVkResourceProvider.h b/src/gpu/vk/GrVkResourceProvider.h
|
| index 37ec6fdee5160b47f1fe2529bbe785e291ff7e05..5368a212b4563fa1cd9cc248b94d2cec470a234e 100644
|
| --- a/src/gpu/vk/GrVkResourceProvider.h
|
| +++ b/src/gpu/vk/GrVkResourceProvider.h
|
| @@ -9,6 +9,7 @@
|
| #define GrVkResourceProvider_DEFINED
|
|
|
| #include "GrGpu.h"
|
| +#include "GrResourceHandle.h"
|
| #include "GrVkDescriptorPool.h"
|
| #include "GrVkPipelineState.h"
|
| #include "GrVkResource.h"
|
| @@ -46,9 +47,33 @@ public:
|
| const GrVkRenderPass& renderPass,
|
| VkPipelineLayout layout);
|
|
|
| + GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle);
|
| +
|
| // Finds or creates a simple render pass that matches the target, increments the refcount,
|
| - // and returns.
|
| - const GrVkRenderPass* findOrCreateCompatibleRenderPass(const GrVkRenderTarget& target);
|
| + // and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. If this is
|
| + // non null it will be set to a handle that can be used in the furutre to quickly return a
|
| + // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarget.
|
| + const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& target,
|
| + CompatibleRPHandle* compatibleHandle = nullptr);
|
| + // The CompatibleRPHandle must be a valid handle previously set by a call to
|
| + // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*).
|
| + const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& compatibleHandle);
|
| +
|
| +#if 0
|
| + // TODO:
|
| + const GrVkRenderPass* findRenderPass(const GrVkRenderTarget& target,
|
| + VkAttachmentLoadOp colorLoad,
|
| + VkAttachmentStoreOp colorStore,
|
| + VkAttachmentLoadOp stencilLoad,
|
| + VkAttachmentStoreOp stencilStore,
|
| + CompatibleRPHandle* compatibleHandle = nullptr);
|
| +
|
| + const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHandle,
|
| + VkAttachmentLoadOp colorLoad,
|
| + VkAttachmentStoreOp colorStore,
|
| + VkAttachmentLoadOp stencilLoad,
|
| + VkAttachmentStoreOp stencilStore);
|
| +#endif
|
|
|
| GrVkCommandBuffer* createCommandBuffer();
|
| void checkCommandBuffers();
|
| @@ -94,7 +119,6 @@ public:
|
| void abandonResources();
|
|
|
| private:
|
| -
|
| #ifdef SK_DEBUG
|
| #define GR_PIPELINE_STATE_CACHE_STATS
|
| #endif
|
| @@ -134,6 +158,31 @@ private:
|
| #endif
|
| };
|
|
|
| +
|
| + class CompatibleRenderPassSet {
|
| + public:
|
| + // This will always construct the basic load store render pass (all attachments load and
|
| + // store their data) so that there is at least one compatible VkRenderPass that can be used
|
| + // with this set.
|
| + CompatibleRenderPassSet(const GrVkGpu* gpu, const GrVkRenderTarget& target);
|
| +
|
| + bool isCompatible(const GrVkRenderTarget& target) const;
|
| +
|
| + GrVkRenderPass* getCompatibleRenderPass() const {
|
| + // The first GrVkRenderpass should always exist since we create the basic load store
|
| + // render pass on create
|
| + SkASSERT(fRenderPasses[0]);
|
| + return fRenderPasses[0];
|
| + }
|
| +
|
| + void releaseResources(const GrVkGpu* gpu);
|
| + void abandonResources();
|
| +
|
| + private:
|
| + SkSTArray<4, GrVkRenderPass*> fRenderPasses;
|
| + int fLastReturnedIndex;
|
| + };
|
| +
|
| // Initialiaze the vkDescriptorSetLayout used for allocating new uniform buffer descritpor sets.
|
| void initUniformDescObjects();
|
|
|
| @@ -142,9 +191,7 @@ private:
|
| // Central cache for creating pipelines
|
| VkPipelineCache fPipelineCache;
|
|
|
| - // Array of RenderPasses that only have a single color attachment, optional stencil attachment,
|
| - // optional resolve attachment, and only one subpass
|
| - SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses;
|
| + SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray;
|
|
|
| // Array of CommandBuffers that are currently in flight
|
| SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers;
|
|
|