blob: 6edfd65f508f1e392f46937fd497603cad08ed10 [file] [log] [blame]
Robert Phillips4217ea72019-01-30 13:08:28 -05001/*
2 * Copyright 2019 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrRecordingContext.h"
9
Robert Phillipsa41c6852019-02-07 10:44:10 -050010#include "GrCaps.h"
Robert Phillipsd6841482019-02-08 10:29:20 -050011#include "GrMemoryPool.h"
Robert Phillipsa41c6852019-02-07 10:44:10 -050012#include "GrRecordingContextPriv.h"
13#include "GrSkSLFPFactoryCache.h"
14
Robert Phillipsc1541ae2019-02-04 12:05:37 -050015GrRecordingContext::GrRecordingContext(GrBackendApi backend,
16 const GrContextOptions& options,
Robert Phillipsa41c6852019-02-07 10:44:10 -050017 uint32_t contextID)
18 : INHERITED(backend, options, contextID) {
Robert Phillips4217ea72019-01-30 13:08:28 -050019}
20
21GrRecordingContext::~GrRecordingContext() { }
22
Robert Phillipsd6841482019-02-08 10:29:20 -050023sk_sp<GrOpMemoryPool> GrRecordingContext::refOpMemoryPool() {
24 if (!fOpMemoryPool) {
25 // DDL TODO: should the size of the memory pool be decreased in DDL mode? CPU-side memory
26 // consumed in DDL mode vs. normal mode for a single skp might be a good metric of wasted
27 // memory.
28 fOpMemoryPool = sk_sp<GrOpMemoryPool>(new GrOpMemoryPool(16384, 16384));
29 }
30
31 SkASSERT(fOpMemoryPool);
32 return fOpMemoryPool;
33}
34
35GrOpMemoryPool* GrRecordingContext::opMemoryPool() {
36 return this->refOpMemoryPool().get();
37}
38
39
Robert Phillipsa41c6852019-02-07 10:44:10 -050040///////////////////////////////////////////////////////////////////////////////////////////////////
41sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
42 return fContext->refCaps();
43}
44
45sk_sp<GrSkSLFPFactoryCache> GrRecordingContextPriv::fpFactoryCache() {
46 return fContext->fpFactoryCache();
47}
Robert Phillipsd6841482019-02-08 10:29:20 -050048
49sk_sp<GrOpMemoryPool> GrRecordingContextPriv::refOpMemoryPool() {
50 return fContext->refOpMemoryPool();
51}