summaryrefslogtreecommitdiffstats
path: root/tools/gfx/d3d12/d3d12-submitter.cpp
blob: 2870d8836a79628f272ba13129f88c96c10182cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// d3d12-submitter.cpp
#include "d3d12-submitter.h"

#include "d3d12-pipeline-state.h"

namespace gfx
{
namespace d3d12
{

using namespace Slang;

void GraphicsSubmitter::setRootConstantBufferView(
    int index,
    D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetGraphicsRootConstantBufferView(index, gpuBufferLocation);
}

void GraphicsSubmitter::setRootUAV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetGraphicsRootUnorderedAccessView(index, gpuBufferLocation);
}

void GraphicsSubmitter::setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetGraphicsRootShaderResourceView(index, gpuBufferLocation);
}

void GraphicsSubmitter::setRootDescriptorTable(
    int index,
    D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor)
{
    m_commandList->SetGraphicsRootDescriptorTable(index, baseDescriptor);
}

void GraphicsSubmitter::setRootSignature(ID3D12RootSignature* rootSignature)
{
    m_commandList->SetGraphicsRootSignature(rootSignature);
}

void GraphicsSubmitter::setRootConstants(
    Index rootParamIndex,
    Index dstOffsetIn32BitValues,
    Index countOf32BitValues,
    void const* srcData)
{
    m_commandList->SetGraphicsRoot32BitConstants(
        UINT(rootParamIndex),
        UINT(countOf32BitValues),
        srcData,
        UINT(dstOffsetIn32BitValues));
}

void GraphicsSubmitter::setPipelineState(PipelineStateBase* pipeline)
{
    auto pipelineImpl = static_cast<PipelineStateImpl*>(pipeline);
    m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get());
}

void ComputeSubmitter::setRootConstantBufferView(
    int index,
    D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetComputeRootConstantBufferView(index, gpuBufferLocation);
}

void ComputeSubmitter::setRootUAV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetComputeRootUnorderedAccessView(index, gpuBufferLocation);
}

void ComputeSubmitter::setRootSRV(int index, D3D12_GPU_VIRTUAL_ADDRESS gpuBufferLocation)
{
    m_commandList->SetComputeRootShaderResourceView(index, gpuBufferLocation);
}

void ComputeSubmitter::setRootDescriptorTable(int index, D3D12_GPU_DESCRIPTOR_HANDLE baseDescriptor)
{
    m_commandList->SetComputeRootDescriptorTable(index, baseDescriptor);
}

void ComputeSubmitter::setRootSignature(ID3D12RootSignature* rootSignature)
{
    m_commandList->SetComputeRootSignature(rootSignature);
}

void ComputeSubmitter::setRootConstants(
    Index rootParamIndex,
    Index dstOffsetIn32BitValues,
    Index countOf32BitValues,
    void const* srcData)
{
    m_commandList->SetComputeRoot32BitConstants(
        UINT(rootParamIndex),
        UINT(countOf32BitValues),
        srcData,
        UINT(dstOffsetIn32BitValues));
}

void ComputeSubmitter::setPipelineState(PipelineStateBase* pipeline)
{
    auto pipelineImpl = static_cast<PipelineStateImpl*>(pipeline);
    m_commandList->SetPipelineState(pipelineImpl->m_pipelineState.get());
}

} // namespace d3d12
} // namespace gfx