本文整理汇总了C++中DeviceContext::ExecuteCommandList方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceContext::ExecuteCommandList方法的具体用法?C++ DeviceContext::ExecuteCommandList怎么用?C++ DeviceContext::ExecuteCommandList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceContext
的用法示例。
在下文中一共展示了DeviceContext::ExecuteCommandList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: float
ObjectManager::SpriteBatch::SpriteBatch(DeviceContext & deviceContext, Texture & texture, std::shared_ptr<SpriteCoordinateReader>& coordinate, std::shared_ptr<SpriteSequenceReader>& sequence)
: _deviceContext(deviceContext), _texture(texture), _coordinate(coordinate), _sequence(sequence)
{
const auto width = float(coordinate->Width) / 2.f;
const auto height = float(coordinate->Height) / 2.f;
const UINT remapable = 1;
SpriteVertex vertices[] =
{
{ { -width, height, 0.5f }, remapable },
{ { width, height, 0.5f }, remapable },
{ { -width, -height, 0.5f }, remapable },
{ { width, -height, 0.5f }, remapable }
};
auto d3dDevice = _deviceContext.D3DDevice;
{
D3D12_DESCRIPTOR_HEAP_DESC heapDesc = {};
heapDesc.NumDescriptors = 1;
heapDesc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
// 此标志指示此描述符堆可以绑定到管道,并且其中包含的描述符可以由根表引用。
heapDesc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
ThrowIfFailed(d3dDevice->CreateDescriptorHeap(&heapDesc, IID_PPV_ARGS(&_sequenceUavHeap)));
}
ComPtr<ID3D12GraphicsCommandList> commandList;
_deviceContext.CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, nullptr, IID_PPV_ARGS(&commandList));
_vertexBuffer = _deviceContext.CreateVertexBuffer(commandList.Get(), std::begin(vertices), std::end(vertices), _vertexBufferView);
ThrowIfFailed(commandList->Close());
deviceContext.ExecuteCommandList(commandList.Get());
}