blob: c719101643af4a390c55c8e7bb9686f5ad8f1938 [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 Phillipsa9162df2019-02-11 14:12:03 -050023void GrRecordingContext::abandonContext() {
24 INHERITED::abandonContext();
25}
26
Robert Phillipsd6841482019-02-08 10:29:20 -050027sk_sp<GrOpMemoryPool> GrRecordingContext::refOpMemoryPool() {
28 if (!fOpMemoryPool) {
29 // DDL TODO: should the size of the memory pool be decreased in DDL mode? CPU-side memory
30 // consumed in DDL mode vs. normal mode for a single skp might be a good metric of wasted
31 // memory.
32 fOpMemoryPool = sk_sp<GrOpMemoryPool>(new GrOpMemoryPool(16384, 16384));
33 }
34
35 SkASSERT(fOpMemoryPool);
36 return fOpMemoryPool;
37}
38
39GrOpMemoryPool* GrRecordingContext::opMemoryPool() {
40 return this->refOpMemoryPool().get();
41}
42
43
Robert Phillipsa41c6852019-02-07 10:44:10 -050044///////////////////////////////////////////////////////////////////////////////////////////////////
45sk_sp<const GrCaps> GrRecordingContextPriv::refCaps() const {
46 return fContext->refCaps();
47}
48
49sk_sp<GrSkSLFPFactoryCache> GrRecordingContextPriv::fpFactoryCache() {
50 return fContext->fpFactoryCache();
51}
Robert Phillipsd6841482019-02-08 10:29:20 -050052
53sk_sp<GrOpMemoryPool> GrRecordingContextPriv::refOpMemoryPool() {
54 return fContext->refOpMemoryPool();
55}