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

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

Issue 2159333002: Recycle small uniform buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update values Created 4 years, 5 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/GrVkResourceProvider.cpp ('k') | src/gpu/vk/GrVkUniformBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkUniformBuffer.h
diff --git a/src/gpu/vk/GrVkUniformBuffer.h b/src/gpu/vk/GrVkUniformBuffer.h
index ed6c8a0aaba435a111b65430bf5661e1696add19..7aa3af6f8d489c87259af6697b0e16eadc92bf2f 100644
--- a/src/gpu/vk/GrVkUniformBuffer.h
+++ b/src/gpu/vk/GrVkUniformBuffer.h
@@ -15,7 +15,9 @@ class GrVkGpu;
class GrVkUniformBuffer : public GrVkBuffer {
public:
- static GrVkUniformBuffer* Create(GrVkGpu* gpu, size_t size, bool dynamic);
+ static GrVkUniformBuffer* Create(GrVkGpu* gpu, size_t size);
+ static const GrVkResource* CreateResource(GrVkGpu* gpu, size_t size);
+ static const size_t kStandardSize = 256;
void* map(const GrVkGpu* gpu) {
return this->vkMap(gpu);
@@ -29,18 +31,27 @@ public:
bool* createdNewBuffer) {
return this->vkUpdateData(gpu, src, srcSizeInBytes, createdNewBuffer);
}
- void release(const GrVkGpu* gpu) {
- this->vkRelease(gpu);
- }
- void abandon() {
- this->vkAbandon();
- }
+ void release(const GrVkGpu* gpu) { this->vkRelease(gpu); }
+ void abandon() { this->vkAbandon(); }
private:
- GrVkUniformBuffer(const GrVkBuffer::Desc& desc, const GrVkBuffer::Resource* resource)
- : INHERITED(desc, resource) {
+ class Resource : public GrVkBuffer::Resource {
+ public:
+ Resource(VkBuffer buf, const GrVkAlloc& alloc)
+ : INHERITED(buf, alloc, kUniform_Type) {}
+
+ void onRecycle(GrVkGpu* gpu) const override;
+
+ typedef GrVkBuffer::Resource INHERITED;
};
+ GrVkUniformBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc,
+ const GrVkUniformBuffer::Resource* resource)
+ : INHERITED(desc, resource)
+ , fGpu(gpu) {}
+
+ GrVkGpu* fGpu;
+
typedef GrVkBuffer INHERITED;
};
« no previous file with comments | « src/gpu/vk/GrVkResourceProvider.cpp ('k') | src/gpu/vk/GrVkUniformBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698