Flutter Engine
The Flutter Engine
GrD3DCpuDescriptorManager.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 GrD3DCpuDescriptorManager_DEFINED
9#define GrD3DCpuDescriptorManager_DEFINED
10
12#include <vector>
13
14class GrD3DGpu;
15
17public:
19
21 ID3D12Resource* textureResource);
23
25 ID3D12Resource* textureResource);
27
29 ID3D12Resource* bufferResource,
30 size_t offset,
31 size_t size);
33 ID3D12Resource* resource,
34 unsigned int mostDetailedMip,
35 unsigned int mipLevels);
37 ID3D12Resource* resource,
38 unsigned int mipSlice);
40
42 D3D12_FILTER filter,
43 float maxLOD,
44 unsigned int maxAnisotropy,
45 D3D12_TEXTURE_ADDRESS_MODE addressModeU,
46 D3D12_TEXTURE_ADDRESS_MODE addressModeV);
48
49private:
50 class Heap {
51 public:
52 static std::unique_ptr<Heap> Make(GrD3DGpu* gpu, D3D12_DESCRIPTOR_HEAP_TYPE type,
53 unsigned int numDescriptors);
54
55 GrD3DDescriptorHeap::CPUHandle allocateCPUHandle();
56 void freeCPUHandle(const GrD3DDescriptorHeap::CPUHandle&);
57 bool ownsHandle(const GrD3DDescriptorHeap::CPUHandle& handle) {
58 return handle.fHeapID == fHeap->uniqueID();
59 }
60
61 bool canAllocate() { return fFreeCount > 0; }
62
63 private:
64 Heap(std::unique_ptr<GrD3DDescriptorHeap>& heap, unsigned int numDescriptors)
65 : fHeap(std::move(heap))
66 , fFreeBlocks(numDescriptors)
67 , fFreeCount(numDescriptors) {
68 for (unsigned int i = 0; i < numDescriptors; ++i) {
69 fFreeBlocks.set(i);
70 }
71 }
72
73 std::unique_ptr<GrD3DDescriptorHeap> fHeap;
74 SkBitSet fFreeBlocks;
75 unsigned int fFreeCount;
76 };
77
78 class HeapPool {
79 public:
80 HeapPool(GrD3DGpu*, D3D12_DESCRIPTOR_HEAP_TYPE);
81
83 void releaseHandle(const GrD3DDescriptorHeap::CPUHandle&);
84
85 private:
86 std::vector<std::unique_ptr<Heap>> fDescriptorHeaps;
87 int fMaxAvailableDescriptors;
88 D3D12_DESCRIPTOR_HEAP_TYPE fHeapType;
89 };
90
91 HeapPool fRTVDescriptorPool;
92 HeapPool fDSVDescriptorPool;
93 HeapPool fShaderViewDescriptorPool;
94 HeapPool fSamplerDescriptorPool;
95};
96
97#endif
static SkString resource(SkPDFResourceType type, int index)
GLenum type
GrD3DDescriptorHeap::CPUHandle createUnorderedAccessView(GrD3DGpu *, ID3D12Resource *resource, unsigned int mipSlice)
void recycleSampler(const GrD3DDescriptorHeap::CPUHandle &)
void recycleRenderTargetView(const GrD3DDescriptorHeap::CPUHandle &)
GrD3DDescriptorHeap::CPUHandle createShaderResourceView(GrD3DGpu *, ID3D12Resource *resource, unsigned int mostDetailedMip, unsigned int mipLevels)
GrD3DDescriptorHeap::CPUHandle createDepthStencilView(GrD3DGpu *, ID3D12Resource *textureResource)
GrD3DDescriptorHeap::CPUHandle createConstantBufferView(GrD3DGpu *, ID3D12Resource *bufferResource, size_t offset, size_t size)
GrD3DDescriptorHeap::CPUHandle createSampler(GrD3DGpu *, D3D12_FILTER filter, float maxLOD, unsigned int maxAnisotropy, D3D12_TEXTURE_ADDRESS_MODE addressModeU, D3D12_TEXTURE_ADDRESS_MODE addressModeV)
void recycleDepthStencilView(const GrD3DDescriptorHeap::CPUHandle &)
void recycleShaderView(const GrD3DDescriptorHeap::CPUHandle &)
GrD3DDescriptorHeap::CPUHandle createRenderTargetView(GrD3DGpu *, ID3D12Resource *textureResource)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
SeparatedVector2 offset