Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
GrD3DCpuDescriptorManager Class Reference

#include <GrD3DCpuDescriptorManager.h>

Public Member Functions

 GrD3DCpuDescriptorManager (GrD3DGpu *)
 
GrD3DDescriptorHeap::CPUHandle createRenderTargetView (GrD3DGpu *, ID3D12Resource *textureResource)
 
void recycleRenderTargetView (const GrD3DDescriptorHeap::CPUHandle &)
 
GrD3DDescriptorHeap::CPUHandle createDepthStencilView (GrD3DGpu *, ID3D12Resource *textureResource)
 
void recycleDepthStencilView (const GrD3DDescriptorHeap::CPUHandle &)
 
GrD3DDescriptorHeap::CPUHandle createConstantBufferView (GrD3DGpu *, ID3D12Resource *bufferResource, size_t offset, size_t size)
 
GrD3DDescriptorHeap::CPUHandle createShaderResourceView (GrD3DGpu *, ID3D12Resource *resource, unsigned int mostDetailedMip, unsigned int mipLevels)
 
GrD3DDescriptorHeap::CPUHandle createUnorderedAccessView (GrD3DGpu *, ID3D12Resource *resource, unsigned int mipSlice)
 
void recycleShaderView (const GrD3DDescriptorHeap::CPUHandle &)
 
GrD3DDescriptorHeap::CPUHandle createSampler (GrD3DGpu *, D3D12_FILTER filter, float maxLOD, unsigned int maxAnisotropy, D3D12_TEXTURE_ADDRESS_MODE addressModeU, D3D12_TEXTURE_ADDRESS_MODE addressModeV)
 
void recycleSampler (const GrD3DDescriptorHeap::CPUHandle &)
 

Detailed Description

Definition at line 16 of file GrD3DCpuDescriptorManager.h.

Constructor & Destructor Documentation

◆ GrD3DCpuDescriptorManager()

GrD3DCpuDescriptorManager::GrD3DCpuDescriptorManager ( GrD3DGpu gpu)

Definition at line 12 of file GrD3DCpuDescriptorManager.cpp.

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) {}

Member Function Documentation

◆ createConstantBufferView()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createConstantBufferView ( GrD3DGpu gpu,
ID3D12Resource *  bufferResource,
size_t  offset,
size_t  size 
)

Definition at line 42 of file GrD3DCpuDescriptorManager.cpp.

43 {
44 const GrD3DDescriptorHeap::CPUHandle& descriptor =
45 fShaderViewDescriptorPool.allocateHandle(gpu);
46 D3D12_CONSTANT_BUFFER_VIEW_DESC desc = {};
47 desc.BufferLocation = bufferResource->GetGPUVirtualAddress() + offset;
48 desc.SizeInBytes = size;
49 gpu->device()->CreateConstantBufferView(&desc, descriptor.fHandle);
50 return descriptor;
51}
ID3D12Device * device() const
Definition: GrD3DGpu.h:43
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
D3D12_CPU_DESCRIPTOR_HANDLE fHandle

◆ createDepthStencilView()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createDepthStencilView ( GrD3DGpu gpu,
ID3D12Resource *  textureResource 
)

Definition at line 30 of file GrD3DCpuDescriptorManager.cpp.

31 {
32 const GrD3DDescriptorHeap::CPUHandle& descriptor = fDSVDescriptorPool.allocateHandle(gpu);
33 gpu->device()->CreateDepthStencilView(textureResource, nullptr, descriptor.fHandle);
34 return descriptor;
35}

◆ createRenderTargetView()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createRenderTargetView ( GrD3DGpu gpu,
ID3D12Resource *  textureResource 
)

Definition at line 18 of file GrD3DCpuDescriptorManager.cpp.

19 {
20 const GrD3DDescriptorHeap::CPUHandle& descriptor = fRTVDescriptorPool.allocateHandle(gpu);
21 gpu->device()->CreateRenderTargetView(textureResource, nullptr, descriptor.fHandle);
22 return descriptor;
23}

◆ createSampler()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createSampler ( GrD3DGpu gpu,
D3D12_FILTER  filter,
float  maxLOD,
unsigned int  maxAnisotropy,
D3D12_TEXTURE_ADDRESS_MODE  addressModeU,
D3D12_TEXTURE_ADDRESS_MODE  addressModeV 
)

Definition at line 92 of file GrD3DCpuDescriptorManager.cpp.

98 {
99 const GrD3DDescriptorHeap::CPUHandle& descriptor = fSamplerDescriptorPool.allocateHandle(gpu);
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;
105 desc.MipLODBias = 0;
106 desc.MaxAnisotropy = maxAnisotropy;
107 desc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
108 // desc.BorderColor initialized to { 0, 0, 0, 0 } by default initializer, above.
109 desc.MinLOD = 0;
110 desc.MaxLOD = maxLOD;
111
112 gpu->device()->CreateSampler(&desc, descriptor.fHandle);
113 return descriptor;
114}

◆ createShaderResourceView()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createShaderResourceView ( GrD3DGpu gpu,
ID3D12Resource *  resource,
unsigned int  mostDetailedMip,
unsigned int  mipLevels 
)

Definition at line 53 of file GrD3DCpuDescriptorManager.cpp.

55 {
56 const GrD3DDescriptorHeap::CPUHandle& descriptor =
57 fShaderViewDescriptorPool.allocateHandle(gpu);
58 // TODO: for 4:2:0 YUV formats we'll need to map two different views, one for Y and one for UV.
59 // For now map the entire resource.
60 D3D12_SHADER_RESOURCE_VIEW_DESC desc = {};
61 desc.Format = resource->GetDesc().Format;
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;
66 gpu->device()->CreateShaderResourceView(resource, &desc, descriptor.fHandle);
67 return descriptor;
68}
static SkString resource(SkPDFResourceType type, int index)

◆ createUnorderedAccessView()

GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createUnorderedAccessView ( GrD3DGpu gpu,
ID3D12Resource *  resource,
unsigned int  mipSlice 
)

Definition at line 70 of file GrD3DCpuDescriptorManager.cpp.

71 {
72 const GrD3DDescriptorHeap::CPUHandle& descriptor =
73 fShaderViewDescriptorPool.allocateHandle(gpu);
74 if (resource->GetDesc().Dimension == D3D12_RESOURCE_DIMENSION_BUFFER) {
75 // TODO: figure out buffer setup
76 gpu->device()->CreateUnorderedAccessView(resource, nullptr, nullptr, descriptor.fHandle);
77 } else {
78 D3D12_UNORDERED_ACCESS_VIEW_DESC desc = {};
79 desc.Format = resource->GetDesc().Format;
80 desc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2D;
81 desc.Texture2D.MipSlice = mipSlice;
82 gpu->device()->CreateUnorderedAccessView(resource, nullptr, &desc, descriptor.fHandle);
83 }
84 return descriptor;
85}

◆ recycleDepthStencilView()

void GrD3DCpuDescriptorManager::recycleDepthStencilView ( const GrD3DDescriptorHeap::CPUHandle dsvDescriptor)

Definition at line 37 of file GrD3DCpuDescriptorManager.cpp.

38 {
39 fDSVDescriptorPool.releaseHandle(dsvDescriptor);
40}

◆ recycleRenderTargetView()

void GrD3DCpuDescriptorManager::recycleRenderTargetView ( const GrD3DDescriptorHeap::CPUHandle rtvDescriptor)

Definition at line 25 of file GrD3DCpuDescriptorManager.cpp.

26 {
27 fRTVDescriptorPool.releaseHandle(rtvDescriptor);
28}

◆ recycleSampler()

void GrD3DCpuDescriptorManager::recycleSampler ( const GrD3DDescriptorHeap::CPUHandle samplerDescriptor)

Definition at line 116 of file GrD3DCpuDescriptorManager.cpp.

117 {
118 fSamplerDescriptorPool.releaseHandle(samplerDescriptor);
119}

◆ recycleShaderView()

void GrD3DCpuDescriptorManager::recycleShaderView ( const GrD3DDescriptorHeap::CPUHandle view)

Definition at line 87 of file GrD3DCpuDescriptorManager.cpp.

88 {
89 fShaderViewDescriptorPool.releaseHandle(view);
90}

The documentation for this class was generated from the following files: