13 : fRTVDescriptorPool(gpu, D3D12_DESCRIPTOR_HEAP_TYPE_RTV)
14 , fDSVDescriptorPool(gpu, D3D12_DESCRIPTOR_HEAP_TYPE_DSV)
15 , fShaderViewDescriptorPool(gpu, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV)
16 , fSamplerDescriptorPool(gpu, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER) {}
19 GrD3DGpu* gpu, ID3D12Resource* textureResource) {
21 gpu->
device()->CreateRenderTargetView(textureResource,
nullptr, descriptor.
fHandle);
27 fRTVDescriptorPool.releaseHandle(rtvDescriptor);
31 GrD3DGpu* gpu, ID3D12Resource* textureResource) {
33 gpu->
device()->CreateDepthStencilView(textureResource,
nullptr, descriptor.
fHandle);
39 fDSVDescriptorPool.releaseHandle(dsvDescriptor);
45 fShaderViewDescriptorPool.allocateHandle(gpu);
46 D3D12_CONSTANT_BUFFER_VIEW_DESC
desc = {};
47 desc.BufferLocation = bufferResource->GetGPUVirtualAddress() +
offset;
55 unsigned int mostDetailedMip,
unsigned int mipLevels) {
57 fShaderViewDescriptorPool.allocateHandle(gpu);
60 D3D12_SHADER_RESOURCE_VIEW_DESC
desc = {};
62 desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
63 desc.Texture2D.MostDetailedMip = mostDetailedMip;
64 desc.Texture2D.MipLevels = mipLevels;
65 desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
73 fShaderViewDescriptorPool.allocateHandle(gpu);
74 if (
resource->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) {
78 D3D12_UNORDERED_ACCESS_VIEW_DESC
desc = {};
80 desc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
81 desc.Texture2D.MipSlice = mipSlice;
89 fShaderViewDescriptorPool.releaseHandle(view);
96 unsigned int maxAnisotropy,
97 D3D12_TEXTURE_ADDRESS_MODE addressModeU,
98 D3D12_TEXTURE_ADDRESS_MODE addressModeV) {
100 D3D12_SAMPLER_DESC
desc = {};
101 desc.Filter = filter;
102 desc.AddressU = addressModeU;
103 desc.AddressV = addressModeV;
104 desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
106 desc.MaxAnisotropy = maxAnisotropy;
107 desc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
110 desc.MaxLOD = maxLOD;
118 fSamplerDescriptorPool.releaseHandle(samplerDescriptor);
124 GrD3DGpu* gpu, D3D12_DESCRIPTOR_HEAP_TYPE
type,
unsigned int numDescriptors) {
125 std::unique_ptr<GrD3DDescriptorHeap> heap =
131 return std::unique_ptr<Heap>(
new Heap(heap, numDescriptors));
137 fFreeBlocks.reset(*freeBlock);
139 return fHeap->getCPUHandle(*freeBlock);
144 size_t index = fHeap->getIndex(handle);
145 fFreeBlocks.set(index);
151GrD3DCpuDescriptorManager::HeapPool::HeapPool(
GrD3DGpu* gpu, D3D12_DESCRIPTOR_HEAP_TYPE heapType)
152 : fMaxAvailableDescriptors(32)
153 , fHeapType(heapType) {
154 std::unique_ptr<GrD3DCpuDescriptorManager::Heap> heap =
156 fDescriptorHeaps.push_back(std::move(heap));
161 for (
unsigned int i = 0;
i < fDescriptorHeaps.size(); ++
i) {
162 if (fDescriptorHeaps[
i]->canAllocate()) {
169 std::unique_ptr<GrD3DCpuDescriptorManager::Heap> heap =
175 fDescriptorHeaps.push_back(std::move(heap));
176 fMaxAvailableDescriptors *= 2;
178 fDescriptorHeaps[fDescriptorHeaps.size() - 1]->allocateCPUHandle();
182void GrD3DCpuDescriptorManager::HeapPool::releaseHandle(
184 for (
unsigned int i = 0;
i < fDescriptorHeaps.size(); ++
i) {
185 if (fDescriptorHeaps[
i]->ownsHandle(dsvDescriptor)) {
186 fDescriptorHeaps[
i]->freeCPUHandle(dsvDescriptor);
static SkString resource(SkPDFResourceType type, int index)
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)
GrD3DCpuDescriptorManager(GrD3DGpu *)
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)
static std::unique_ptr< GrD3DDescriptorHeap > Make(GrD3DGpu *gpu, D3D12_DESCRIPTOR_HEAP_TYPE, unsigned int numDescriptors, D3D12_DESCRIPTOR_HEAP_FLAGS)
ID3D12Device * device() const
std::optional< size_t > OptionalIndex
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
D3D12_CPU_DESCRIPTOR_HANDLE fHandle