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

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

Issue 1836863002: Change VkPipelineStateCahce to use Hash and LRU LList. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update macro name 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/GrVkPipelineStateCache.cpp ('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
index 5e2d1723a1406f62ff360a230defc52980245e14..56a35160f337544646f1d60446fb7aee27131e49 100644
--- a/src/gpu/vk/GrVkResourceProvider.h
+++ b/src/gpu/vk/GrVkResourceProvider.h
@@ -15,6 +15,8 @@
#include "GrVkUtil.h"
#include "SkTArray.h"
#include "SkTDynamicHash.h"
+#include "SkTHash.h"
+#include "SkTInternalLList.h"
#include "vulkan/vulkan.h"
@@ -63,10 +65,10 @@ public:
// The refcount is incremented and a pointer returned.
GrVkSampler* findOrCreateCompatibleSampler(const GrTextureParams&);
- GrVkPipelineState* findOrCreateCompatiblePipelineState(const GrPipeline&,
- const GrPrimitiveProcessor&,
- GrPrimitiveType,
- const GrVkRenderPass& renderPass);
+ sk_sp<GrVkPipelineState> findOrCreateCompatiblePipelineState(const GrPipeline&,
+ const GrPrimitiveProcessor&,
+ GrPrimitiveType,
+ const GrVkRenderPass& renderPass);
// 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.
@@ -80,6 +82,11 @@ public:
void abandonResources();
private:
+
+#ifdef SK_DEVELOPER
+#define GR_PIPELINE_STATE_CACHE_STATS
+#endif
+
class PipelineStateCache : public ::SkNoncopyable {
public:
PipelineStateCache(GrVkGpu* gpu);
@@ -87,42 +94,31 @@ private:
void abandon();
void release();
- GrVkPipelineState* refPipelineState(const GrPipeline&,
- const GrPrimitiveProcessor&,
- GrPrimitiveType,
- const GrVkRenderPass& renderPass);
+ sk_sp<GrVkPipelineState> refPipelineState(const GrPipeline&,
+ const GrPrimitiveProcessor&,
+ GrPrimitiveType,
+ const GrVkRenderPass& renderPass);
private:
enum {
// We may actually have kMaxEntries+1 PipelineStates in context because we create a new
// PipelineState before evicting from the cache.
kMaxEntries = 128,
- kHashBits = 6,
};
struct Entry;
- struct PipelineDescLess;
-
void reset();
- // binary search for entry matching desc. returns index into fEntries that matches desc or ~
- // of the index of where it should be inserted.
- int search(const GrVkPipelineState::Desc& desc) const;
-
- // sorted array of all the entries
- Entry* fEntries[kMaxEntries];
- // hash table based on lowest kHashBits bits of the pipeline state key. Used to avoid binary
- // searching fEntries.
- Entry* fHashTable[1 << kHashBits];
-
int fCount;
- unsigned int fCurrLRUStamp;
+ SkTHashTable<Entry*, const GrVkPipelineState::Desc&, Entry> fHashTable;
+ SkTInternalLList<Entry> fLRUList;
+
GrVkGpu* fGpu;
-#ifdef PIPELINE_STATE_CACHE_STATS
+
+#ifdef GR_PIPELINE_STATE_CACHE_STATS
int fTotalRequests;
int fCacheMisses;
- int fHashMisses; // cache hit but hash table missed
#endif
};
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateCache.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698