Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrD3DDescriptorHeap.cpp
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
10
11std::unique_ptr<GrD3DDescriptorHeap> GrD3DDescriptorHeap::Make(GrD3DGpu* gpu,
12 D3D12_DESCRIPTOR_HEAP_TYPE type,
13 unsigned int numDescriptors,
14 D3D12_DESCRIPTOR_HEAP_FLAGS flags) {
15 D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
16 heapDesc.Type = type;
17 heapDesc.NumDescriptors = numDescriptors;
18 heapDesc.Flags = flags;
19
20 ID3D12DescriptorHeap* heap;
21 gpu->device()->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&heap));
22
23 return std::unique_ptr<GrD3DDescriptorHeap>(
25 gpu->device()->GetDescriptorHandleIncrementSize(type)));
26}
27
29 unsigned int handleIncrementSize)
30 : fHeap(heap)
31 , fHandleIncrementSize(handleIncrementSize)
32 , fUniqueID(GenID()) {
33 fCPUHeapStart = fHeap->GetCPUDescriptorHandleForHeapStart();
34 fGPUHeapStart = fHeap->GetGPUDescriptorHandleForHeapStart();
35}
36
38 SkASSERT(index < fHeap->GetDesc().NumDescriptors);
39 D3D12_CPU_DESCRIPTOR_HANDLE handle = fCPUHeapStart;
40 handle.ptr += index * fHandleIncrementSize;
41 return {handle, fUniqueID};
42}
43
45 SkASSERT(index < fHeap->GetDesc().NumDescriptors);
46 D3D12_GPU_DESCRIPTOR_HANDLE handle = fGPUHeapStart;
47 handle.ptr += index * fHandleIncrementSize;
48 return {handle, fUniqueID};
49}
50
51
52
#define SkASSERT(cond)
Definition SkAssert.h:116
D3D12_GPU_DESCRIPTOR_HANDLE fGPUHeapStart
GPUHandle getGPUHandle(unsigned int index)
gr_cp< ID3D12DescriptorHeap > fHeap
CPUHandle getCPUHandle(unsigned int index)
GrD3DDescriptorHeap(const gr_cp< ID3D12DescriptorHeap > &, unsigned int handleIncrementSize)
static std::unique_ptr< GrD3DDescriptorHeap > Make(GrD3DGpu *gpu, D3D12_DESCRIPTOR_HEAP_TYPE, unsigned int numDescriptors, D3D12_DESCRIPTOR_HEAP_FLAGS)
D3D12_CPU_DESCRIPTOR_HANDLE fCPUHeapStart
ID3D12Device * device() const
Definition GrD3DGpu.h:43
FlutterSemanticsFlag flags