Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrD3DAMDMemoryAllocator.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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#ifndef GrD3DAMDMemoryAllocator_DEFINED
9#define GrD3DAMDMemoryAllocator_DEFINED
10
13
14#if defined(__clang__)
15#pragma clang diagnostic push
16#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
17#endif
18#include "D3D12MemAlloc.h" // NO_G3_REWRITE
19#if defined(__clang__)
20#pragma clang diagnostic pop
21#endif
22
24public:
25 static sk_sp<GrD3DMemoryAllocator> Make(IDXGIAdapter* adapter, ID3D12Device* device);
26
27 ~GrD3DAMDMemoryAllocator() override { fAllocator->Release(); }
28
29 gr_cp<ID3D12Resource> createResource(D3D12_HEAP_TYPE, const D3D12_RESOURCE_DESC*,
30 D3D12_RESOURCE_STATES initialResourceState,
31 sk_sp<GrD3DAlloc>* allocation,
32 const D3D12_CLEAR_VALUE*) override;
33
35 uint64_t localOffset,
36 const D3D12_RESOURCE_DESC*,
37 D3D12_RESOURCE_STATES initialResourceState,
38 const D3D12_CLEAR_VALUE*) override;
39
40 class Alloc : public GrD3DAlloc {
41 public:
42 Alloc(D3D12MA::Allocation* allocation) : fAllocation(allocation) {}
43 ~Alloc() override {
44 fAllocation->Release();
45 }
46 private:
48 D3D12MA::Allocation* fAllocation;
49 };
50
51private:
52 GrD3DAMDMemoryAllocator(D3D12MA::Allocator* allocator) : fAllocator(allocator) {}
53
54 D3D12MA::Allocator* fAllocator;
55};
56
57#endif
Alloc(D3D12MA::Allocation *allocation)
static sk_sp< GrD3DMemoryAllocator > Make(IDXGIAdapter *adapter, ID3D12Device *device)
gr_cp< ID3D12Resource > createAliasingResource(sk_sp< GrD3DAlloc > &allocation, uint64_t localOffset, const D3D12_RESOURCE_DESC *, D3D12_RESOURCE_STATES initialResourceState, const D3D12_CLEAR_VALUE *) override
gr_cp< ID3D12Resource > createResource(D3D12_HEAP_TYPE, const D3D12_RESOURCE_DESC *, D3D12_RESOURCE_STATES initialResourceState, sk_sp< GrD3DAlloc > *allocation, const D3D12_CLEAR_VALUE *) override
VkDevice device
Definition main.cc:53