本文整理汇总了C++中microsoft::wrl::ComPtr::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ ComPtr::Close方法的具体用法?C++ ComPtr::Close怎么用?C++ ComPtr::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类microsoft::wrl::ComPtr
的用法示例。
在下文中一共展示了ComPtr::Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Shape
Arc::Arc(FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2, FLOAT xRadius, FLOAT yRadius, FLOAT angle,
D2D1_SWEEP_DIRECTION sweep, D2D1_ARC_SIZE size, D2D1_FIGURE_END ending) : Shape(ShapeType::Arc),
m_StartPoint(D2D1::Point2F(x1, y1)),
m_ArcSegment(D2D1::ArcSegment(
D2D1::Point2F(x2, y2),
D2D1::SizeF(xRadius, yRadius),
angle,
sweep,
size)),
m_ShapeEnding(ending)
{
Microsoft::WRL::ComPtr<ID2D1GeometrySink> sink;
Microsoft::WRL::ComPtr<ID2D1PathGeometry> path;
HRESULT hr = Canvas::c_D2DFactory->CreatePathGeometry(path.GetAddressOf());
if (SUCCEEDED(hr))
{
hr = path->Open(sink.GetAddressOf());
if (SUCCEEDED(hr))
{
sink->BeginFigure(m_StartPoint, D2D1_FIGURE_BEGIN_FILLED);
sink->AddArc(m_ArcSegment);
sink->EndFigure(m_ShapeEnding);
sink->Close();
hr = path.CopyTo(m_Shape.GetAddressOf());
if (SUCCEEDED(hr)) return;
}
}
LogErrorF(L"Could not create arc object. X1=%i, Y1=%i, X2=%i, Y2=%i, XRadius=%i, YRadius=%i, Angle=%i",
(int)x1, (int)y1, (int)x2, (int)y2, (int)xRadius, (int)yRadius, (int)angle);
}
示例2: Create
void Model::Create()
{
CreateRootSignature();
CreatePipelineState();
Microsoft::WRL::ComPtr<ID3D12CommandAllocator> CommandAllocator;
Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> CommandList;
Microsoft::WRL::ComPtr<ID3D12Resource> VertexUploadResource;
Microsoft::WRL::ComPtr<ID3D12Resource> IndexUploadResource;
GPUFence Fence;
Fence.Initialize(DeviceContext.GetDevice());
Utility::ThrowOnFail(DeviceContext.GetDevice()->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&CommandAllocator)));
Utility::ThrowOnFail(DeviceContext.GetDevice()->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, CommandAllocator.Get(), nullptr, IID_PPV_ARGS(&CommandList)));
UploadVertices(CommandList, VertexUploadResource);
UploadIndices(CommandList, IndexUploadResource);
Utility::ThrowOnFail(CommandList->Close());
ID3D12CommandList * CommandListPointer = CommandList.Get();
DeviceContext.GetCommandQueue()->ExecuteCommandLists(1, &CommandListPointer);
Fence.SetAndWait(DeviceContext.GetCommandQueue());
}
示例3: LoadTextures
void TextureManager::LoadTextures(const std::vector<std::string>& TexturesLocation)
{
for (std::string TextureLoc : TexturesLocation)
{
const std::string &fixed = "..\\examples\\assets\\" + TextureLoc.substr(0, TextureLoc.find_last_of('.')) + ".DDS";
std::ifstream DDSFile(fixed, std::ifstream::binary);
irr::video::CImageLoaderDDS DDSPic(DDSFile);
#ifdef GLBUILD
WrapperResource *res = (WrapperResource*)malloc(sizeof(WrapperResource));
// TODO : clean it
GLTexture *tmptexture = new GLTexture(DDSPic.getLoadedImage());
res->GLValue.Resource = tmptexture->Id;
res->GLValue.Type = GL_TEXTURE_2D;
#endif
#ifdef DXBUILD
D3DTexture TextureInRam(DDSPic.getLoadedImage());
WrapperResource *res = (WrapperResource*)malloc(sizeof(WrapperResource));
HRESULT hr = Context::getInstance()->dev->CreateCommittedResource(
&CD3D12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_MISC_NONE,
&CD3D12_RESOURCE_DESC::Tex2D(TextureInRam.getFormat(), (UINT)TextureInRam.getWidth(), (UINT)TextureInRam.getHeight(), 1, (UINT16)TextureInRam.getMipLevelsCount()),
D3D12_RESOURCE_USAGE_GENERIC_READ,
nullptr,
IID_PPV_ARGS(&res->D3DValue.resource)
);
Microsoft::WRL::ComPtr<ID3D12CommandAllocator> cmdalloc;
Context::getInstance()->dev->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&cmdalloc));
Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> cmdlist;
Context::getInstance()->dev->CreateCommandList(1, D3D12_COMMAND_LIST_TYPE_DIRECT, cmdalloc.Get(), nullptr, IID_PPV_ARGS(&cmdlist));
TextureInRam.CreateUploadCommandToResourceInDefaultHeap(cmdlist.Get(), res->D3DValue.resource);
cmdlist->Close();
Context::getInstance()->cmdqueue->ExecuteCommandLists(1, (ID3D12CommandList**)cmdlist.GetAddressOf());
HANDLE handle = getCPUSyncHandle(Context::getInstance()->cmdqueue.Get());
res->D3DValue.description.TextureView.SRV = TextureInRam.getResourceViewDesc();
WaitForSingleObject(handle, INFINITE);
CloseHandle(handle);
#endif
textureSet.emplace(TextureLoc, res);
}
}