Make the size of program/pipeline caches configurable in GrContextOptions

Change-Id: I988fd8cc7e78e2124f20b7d8a815f160bb166756
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239756
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Osman 2019-09-06 10:16:02 -04:00 committed by Skia Commit-Bot
parent 43ad1a4e30
commit 172bb44f2d
7 changed files with 21 additions and 13 deletions

View File

@ -4,6 +4,12 @@ This file includes a list of high level updates for each milestone release.
-----
Milestone 79
* Make the size of program/pipeline caches configurable via
GrContextOptions::fRuntimeProgramCacheSize
https://review.skia.org/239756
Milestone 78
* Added RELEASE_NOTES.txt file

View File

@ -182,6 +182,11 @@ struct SK_API GrContextOptions {
*/
bool fDisableDriverCorrectnessWorkarounds = false;
/**
* Maximum number of GPU programs or pipelines to keep active in the runtime cache.
*/
int fRuntimeProgramCacheSize = 256;
/**
* Cache in which to store compiled shader binaries between runs.
*/

View File

@ -319,10 +319,6 @@ private:
const GrPipeline&, bool hasPointSize);
private:
// We may actually have kMaxEntries+1 shaders in the GL context because we create a new
// shader before evicting from the cache.
static const int kMaxEntries = 128;
struct Entry;
struct DescHash {

View File

@ -7,6 +7,8 @@
#include "src/gpu/gl/GrGLGpu.h"
#include "include/gpu/GrContextOptions.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrProgramDesc.h"
#include "src/gpu/gl/builders/GrGLProgramBuilder.h"
@ -19,7 +21,7 @@ struct GrGLGpu::ProgramCache::Entry {
};
GrGLGpu::ProgramCache::ProgramCache(GrGLGpu* gpu)
: fMap(kMaxEntries)
: fMap(gpu->getContext()->priv().options().fRuntimeProgramCacheSize)
, fGpu(gpu) {}
GrGLGpu::ProgramCache::~ProgramCache() {}

View File

@ -7,6 +7,8 @@
#include "src/gpu/mtl/GrMtlResourceProvider.h"
#include "include/gpu/GrContextOptions.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/mtl/GrMtlCommandBuffer.h"
#include "src/gpu/mtl/GrMtlGpu.h"
#include "src/gpu/mtl/GrMtlPipelineState.h"
@ -107,7 +109,8 @@ struct GrMtlResourceProvider::PipelineStateCache::Entry {
};
GrMtlResourceProvider::PipelineStateCache::PipelineStateCache(GrMtlGpu* gpu)
: fMap(kMaxEntries)
// Temporary hack to keep this as large as Chrome wants, until they update GrContextOptions
: fMap(SkTMax(gpu->getContext()->priv().options().fRuntimeProgramCacheSize, 1024))
, fGpu(gpu)
#ifdef GR_PIPELINE_STATE_CACHE_STATS
, fTotalRequests(0)

View File

@ -6,7 +6,9 @@
*/
#include "include/gpu/GrContextOptions.h"
#include "src/core/SkOpts.h"
#include "src/gpu/GrContextPriv.h"
#include "src/gpu/GrProcessor.h"
#include "src/gpu/GrRenderTargetPriv.h"
#include "src/gpu/GrStencilSettings.h"
@ -38,7 +40,7 @@ struct GrVkResourceProvider::PipelineStateCache::Entry {
};
GrVkResourceProvider::PipelineStateCache::PipelineStateCache(GrVkGpu* gpu)
: fMap(kMaxEntries)
: fMap(gpu->getContext()->priv().options().fRuntimeProgramCacheSize)
, fGpu(gpu)
#ifdef GR_PIPELINE_STATE_CACHE_STATS
, fTotalRequests(0)

View File

@ -205,12 +205,6 @@ private:
VkRenderPass compatibleRenderPass);
private:
enum {
// We may actually have kMaxEntries+1 PipelineStates in context because we create a new
// PipelineState before evicting from the cache.
kMaxEntries = 128,
};
struct Entry;
struct DescHash {