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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
// cuda-command-encoder.cpp
#include "cuda-command-encoder.h"
#include "cuda-command-buffer.h"
#include "cuda-device.h"
namespace gfx
{
#ifdef GFX_ENABLE_CUDA
using namespace Slang;
namespace cuda
{
void ResourceCommandEncoderImpl::init(CommandBufferImpl* cmdBuffer)
{
m_writer = cmdBuffer;
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::copyBuffer(
IBufferResource* dst,
Offset dstOffset,
IBufferResource* src,
Offset srcOffset,
Size size)
{
m_writer->copyBuffer(dst, dstOffset, src, srcOffset, size);
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::uploadBufferData(
IBufferResource* dst, Offset offset, Size size, void* data)
{
m_writer->uploadBufferData(dst, offset, size, data);
}
SLANG_NO_THROW void SLANG_MCALL
ResourceCommandEncoderImpl::writeTimestamp(IQueryPool* pool, GfxIndex index)
{
m_writer->writeTimestamp(pool, index);
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::copyTexture(
ITextureResource* dst,
ResourceState dstState,
SubresourceRange dstSubresource,
ITextureResource::Offset3D dstOffset,
ITextureResource* src,
ResourceState srcState,
SubresourceRange srcSubresource,
ITextureResource::Offset3D srcOffset,
ITextureResource::Extents extent)
{
SLANG_UNUSED(dst);
SLANG_UNUSED(dstState);
SLANG_UNUSED(dstSubresource);
SLANG_UNUSED(dstOffset);
SLANG_UNUSED(src);
SLANG_UNUSED(srcState);
SLANG_UNUSED(srcSubresource);
SLANG_UNUSED(srcOffset);
SLANG_UNUSED(extent);
SLANG_UNIMPLEMENTED_X("copyTexture");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::uploadTextureData(
ITextureResource* dst,
SubresourceRange subResourceRange,
ITextureResource::Offset3D offset,
ITextureResource::Extents extent,
ITextureResource::SubresourceData* subResourceData,
GfxCount subResourceDataCount)
{
SLANG_UNUSED(dst);
SLANG_UNUSED(subResourceRange);
SLANG_UNUSED(offset);
SLANG_UNUSED(extent);
SLANG_UNUSED(subResourceData);
SLANG_UNUSED(subResourceDataCount);
SLANG_UNIMPLEMENTED_X("uploadTextureData");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::clearResourceView(
IResourceView* view,
ClearValue* clearValue,
ClearResourceViewFlags::Enum flags)
{
SLANG_UNUSED(view);
SLANG_UNUSED(clearValue);
SLANG_UNUSED(flags);
SLANG_UNIMPLEMENTED_X("clearResourceView");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::resolveResource(
ITextureResource* source,
ResourceState sourceState,
SubresourceRange sourceRange,
ITextureResource* dest,
ResourceState destState,
SubresourceRange destRange)
{
SLANG_UNUSED(source);
SLANG_UNUSED(sourceState);
SLANG_UNUSED(sourceRange);
SLANG_UNUSED(dest);
SLANG_UNUSED(destState);
SLANG_UNUSED(destRange);
SLANG_UNIMPLEMENTED_X("resolveResource");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::resolveQuery(
IQueryPool* queryPool,
GfxIndex index,
GfxCount count,
IBufferResource* buffer,
Offset offset)
{
SLANG_UNUSED(queryPool);
SLANG_UNUSED(index);
SLANG_UNUSED(count);
SLANG_UNUSED(buffer);
SLANG_UNUSED(offset);
SLANG_UNIMPLEMENTED_X("resolveQuery");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::copyTextureToBuffer(
IBufferResource* dst,
Offset dstOffset,
Size dstSize,
Size dstRowStride,
ITextureResource* src,
ResourceState srcState,
SubresourceRange srcSubresource,
ITextureResource::Offset3D srcOffset,
ITextureResource::Extents extent)
{
SLANG_UNUSED(dst);
SLANG_UNUSED(dstOffset);
SLANG_UNUSED(dstSize);
SLANG_UNUSED(dstRowStride);
SLANG_UNUSED(src);
SLANG_UNUSED(srcState);
SLANG_UNUSED(srcSubresource);
SLANG_UNUSED(srcOffset);
SLANG_UNUSED(extent);
SLANG_UNIMPLEMENTED_X("copyTextureToBuffer");
}
SLANG_NO_THROW void SLANG_MCALL ResourceCommandEncoderImpl::textureSubresourceBarrier(
ITextureResource* texture,
SubresourceRange subresourceRange,
ResourceState src,
ResourceState dst)
{
SLANG_UNUSED(texture);
SLANG_UNUSED(subresourceRange);
SLANG_UNUSED(src);
SLANG_UNUSED(dst);
SLANG_UNIMPLEMENTED_X("textureSubresourceBarrier");
}
SLANG_NO_THROW void SLANG_MCALL
ResourceCommandEncoderImpl::beginDebugEvent(const char* name, float rgbColor[3])
{
SLANG_UNUSED(name);
SLANG_UNUSED(rgbColor);
}
void ComputeCommandEncoderImpl::init(CommandBufferImpl* cmdBuffer)
{
m_writer = cmdBuffer;
m_commandBuffer = cmdBuffer;
}
SLANG_NO_THROW Result SLANG_MCALL
ComputeCommandEncoderImpl::bindPipeline(IPipelineState* state, IShaderObject** outRootObject)
{
m_writer->setPipelineState(state);
PipelineStateBase* pipelineImpl = static_cast<PipelineStateBase*>(state);
SLANG_RETURN_ON_FAIL(m_commandBuffer->m_device->createRootShaderObject(
pipelineImpl->m_program, m_rootObject.writeRef()));
returnComPtr(outRootObject, m_rootObject);
return SLANG_OK;
}
SLANG_NO_THROW Result SLANG_MCALL
ComputeCommandEncoderImpl::bindPipelineWithRootObject(IPipelineState* state, IShaderObject* rootObject)
{
m_writer->setPipelineState(state);
PipelineStateBase* pipelineImpl = static_cast<PipelineStateBase*>(state);
SLANG_RETURN_ON_FAIL(m_commandBuffer->m_device->createRootShaderObject(
pipelineImpl->m_program, m_rootObject.writeRef()));
m_rootObject->copyFrom(rootObject, m_commandBuffer->m_transientHeap);
return SLANG_OK;
}
SLANG_NO_THROW void SLANG_MCALL ComputeCommandEncoderImpl::dispatchCompute(int x, int y, int z)
{
m_writer->bindRootShaderObject(m_rootObject);
m_writer->dispatchCompute(x, y, z);
}
SLANG_NO_THROW void SLANG_MCALL
ComputeCommandEncoderImpl::dispatchComputeIndirect(IBufferResource* argBuffer, Offset offset)
{
SLANG_UNIMPLEMENTED_X("dispatchComputeIndirect");
}
} // namespace cuda
#endif
} // namespace gfx
|