本文整理汇总了C++中microsoft::wrl::ComPtr::ReleaseAndGetAddressOf方法的典型用法代码示例。如果您正苦于以下问题:C++ ComPtr::ReleaseAndGetAddressOf方法的具体用法?C++ ComPtr::ReleaseAndGetAddressOf怎么用?C++ ComPtr::ReleaseAndGetAddressOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类microsoft::wrl::ComPtr
的用法示例。
在下文中一共展示了ComPtr::ReleaseAndGetAddressOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ppu_decoder_modes
//.........这里部分代码省略.........
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "Read color buffers" }, chbox_gs_read_color));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "Read depth buffer" }, chbox_gs_read_depth));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "VSync" }, chbox_gs_vsync));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "Debug output" }, chbox_gs_debug_output));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "Debug overlay" }, chbox_gs_overlay));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Video", "Use legacy OpenGL buffers (Debug)" }, chbox_gs_gl_legacy_buffers));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Audio", "Renderer" }, cbox_audio_out));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Audio", "Dump to file" }, chbox_audio_dump));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Audio", "Convert to 16-bit" }, chbox_audio_conv));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Input/Output", "Controller" }, cbox_pad_handler));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Input/Output", "Keyboard" }, cbox_keyboard_handler));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Input/Output", "Mouse" }, cbox_mouse_handler));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Input/Output", "Camera" }, cbox_camera));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Input/Output", "Camera type" }, cbox_camera_type));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Net", "Connection status" }, cbox_net_status));
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "System", "Language" }, cbox_sys_lang));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Miscellaneous", "Exit RPCS3 when process finishes" }, chbox_hle_exitonstop));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Miscellaneous", "Always start after boot" }, chbox_hle_always_start));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Miscellaneous", "Automatically pause at system call" }, chbox_dbg_ap_systemcall));
pads.emplace_back(std::make_unique<checkbox_pad>(cfg_location{ "Miscellaneous", "Automatically pause at function call" }, chbox_dbg_ap_functioncall));
#ifdef _MSC_VER
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgi_factory;
if (SUCCEEDED(CreateDXGIFactory(IID_PPV_ARGS(&dxgi_factory))))
{
Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
for (UINT id = 0; dxgi_factory->EnumAdapters(id, adapter.ReleaseAndGetAddressOf()) != DXGI_ERROR_NOT_FOUND; id++)
{
DXGI_ADAPTER_DESC desc;
adapter->GetDesc(&desc);
cbox_gs_d3d_adapter->Append(desc.Description);
}
pads.emplace_back(std::make_unique<combobox_pad>(cfg_location{ "Video", "D3D12", "Adapter" }, cbox_gs_d3d_adapter));
}
else
#endif
{
cbox_gs_d3d_adapter->Enable(false);
}
// Core
s_round_core_lle->Add(chbox_list_core_lle, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_core_lle->Add(s_module_search_box, wxSizerFlags().Border(wxALL, 5).Expand());
// Rendering
s_round_gs_render->Add(cbox_gs_render, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_gs_d3d_adapter->Add(cbox_gs_d3d_adapter, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_gs_res->Add(cbox_gs_resolution, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_gs_aspect->Add(cbox_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_gs_frame_limit->Add(cbox_gs_frame_limit, wxSizerFlags().Border(wxALL, 5).Expand());
// Input/Output
s_round_io_pad_handler->Add(cbox_pad_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io_keyboard_handler->Add(cbox_keyboard_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io_mouse_handler->Add(cbox_mouse_handler, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io_camera->Add(cbox_camera, wxSizerFlags().Border(wxALL, 5).Expand());
s_round_io_camera_type->Add(cbox_camera_type, wxSizerFlags().Border(wxALL, 5).Expand());
示例2: LoadLibrary
emu_settings::Render_Creator::Render_Creator()
{
// check for dx12 adapters
#ifdef _MSC_VER
HMODULE D3D12Module = LoadLibrary(L"d3d12.dll");
if (D3D12Module != NULL)
{
Microsoft::WRL::ComPtr<IDXGIAdapter1> pAdapter;
Microsoft::WRL::ComPtr<IDXGIFactory1> dxgi_factory;
if (SUCCEEDED(CreateDXGIFactory1(IID_PPV_ARGS(&dxgi_factory))))
{
PFN_D3D12_CREATE_DEVICE wrapD3D12CreateDevice = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(D3D12Module, "D3D12CreateDevice");
if (wrapD3D12CreateDevice != nullptr)
{
for (UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != dxgi_factory->EnumAdapters1(adapterIndex, pAdapter.ReleaseAndGetAddressOf()); ++adapterIndex)
{
if (SUCCEEDED(wrapD3D12CreateDevice(pAdapter.Get(), D3D_FEATURE_LEVEL_11_0, _uuidof(ID3D12Device), nullptr)))
{
//A device with D3D12 support found. Init data
supportsD3D12 = true;
DXGI_ADAPTER_DESC desc;
if (SUCCEEDED(pAdapter->GetDesc(&desc)))
D3D12Adapters.append(QString::fromWCharArray(desc.Description));
}
}
}
}
}
#endif
#if defined(WIN32) || defined(HAVE_VULKAN)
// check for vulkan adapters
vk::context device_enum_context;
u32 instance_handle = device_enum_context.createInstance("RPCS3", true);
if (instance_handle > 0)
{
device_enum_context.makeCurrentInstance(instance_handle);
std::vector<vk::physical_device>& gpus = device_enum_context.enumerateDevices();
if (gpus.size() > 0)
{
//A device with vulkan support found. Init data
supportsVulkan = true;
for (auto& gpu : gpus)
{
vulkanAdapters.append(qstr(gpu.get_name()));
}
}
}
#endif
// Graphics Adapter
D3D12 = Render_Info(name_D3D12, D3D12Adapters, supportsD3D12, emu_settings::D3D12Adapter);
Vulkan = Render_Info(name_Vulkan, vulkanAdapters, supportsVulkan, emu_settings::VulkanAdapter);
OpenGL = Render_Info(name_OpenGL);
NullRender = Render_Info(name_Null);
renderers = { &D3D12, &Vulkan, &OpenGL, &NullRender };
}
示例3: TestTextureTypes
void QtTestGui::TestTextureTypes(){
HRESULT hr = S_OK;
ImageUtils imgUtils;
auto decoder = imgUtils.CreateDecoder(L"mipSrc2.png");
auto frame = imgUtils.CreateFrameForDecode(decoder.Get());
auto frameSize = imgUtils.GetFrameSize(frame.Get());
/*std::vector<uint8_t> pixels(imgUtils.GetFrameByteSize(frame.Get()));
imgUtils.DecodePixels(frame.Get(), pixels.size(), pixels.data());*/
Microsoft::WRL::ComPtr<ID3D11Texture2D> tex;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> srv;
D3D11_TEXTURE2D_DESC texDesc;
texDesc.Width = frameSize.x / 8;// frameSize.x;
texDesc.Height = frameSize.y;
texDesc.MipLevels = 1;// 8;
texDesc.ArraySize = 1;
texDesc.Format = DXGI_FORMAT::DXGI_FORMAT_R8_UNORM;// DXGI_FORMAT::DXGI_FORMAT_R8G8B8A8_UNORM;
texDesc.SampleDesc.Count = 1;
texDesc.SampleDesc.Quality = 0;
texDesc.Usage = D3D11_USAGE::D3D11_USAGE_DEFAULT;
texDesc.BindFlags = D3D11_BIND_FLAG::D3D11_BIND_SHADER_RESOURCE;// | D3D11_BIND_FLAG::D3D11_BIND_RENDER_TARGET;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = 0;// D3D11_RESOURCE_MISC_GENERATE_MIPS;
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
srvDesc.Format = texDesc.Format;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION::D3D_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MostDetailedMip = 0;
srvDesc.Texture2D.MipLevels = texDesc.MipLevels;
D3D11_BOX box;
box.left = box.top = 0;
box.right = frameSize.x;
box.bottom = frameSize.y;
box.front = 0;
box.back = 1;
/*this->d3dCtx->UpdateSubresource(tex.Get(), 0, &box, pixels.data(), frameSize.x * 4, frameSize.x * frameSize.y * 4);*/
/*if (texDesc.MipLevels > 1){
this->d3dCtx->GenerateMips(srv.Get());
}*/
auto pixels0 = this->LoadTexture(L"Gray_mipSrc0.png");
auto pixels1 = this->LoadTexture(L"Gray_mipSrc1.png");
auto pixels2 = this->LoadTexture(L"Gray_mipSrc2.png");
auto pixels3 = this->LoadTexture(L"Gray_mipSrc3.png");
hr = this->d3dDev->CreateTexture2D(&texDesc, nullptr, tex.ReleaseAndGetAddressOf());
hr = this->d3dDev->CreateShaderResourceView(tex.Get(), &srvDesc, srv.ReleaseAndGetAddressOf());
this->d3dCtx->UpdateSubresource(tex.Get(), 0, &box, pixels0.data(), frameSize.x / 8, (frameSize.x * frameSize.y) / 8);
this->mipMapSrv0 = srv;
hr = this->d3dDev->CreateTexture2D(&texDesc, nullptr, tex.ReleaseAndGetAddressOf());
hr = this->d3dDev->CreateShaderResourceView(tex.Get(), &srvDesc, srv.ReleaseAndGetAddressOf());
this->d3dCtx->UpdateSubresource(tex.Get(), 0, &box, pixels1.data(), frameSize.x / 8, (frameSize.x * frameSize.y) / 8);
this->mipMapSrv1 = srv;
hr = this->d3dDev->CreateTexture2D(&texDesc, nullptr, tex.ReleaseAndGetAddressOf());
hr = this->d3dDev->CreateShaderResourceView(tex.Get(), &srvDesc, srv.ReleaseAndGetAddressOf());
this->d3dCtx->UpdateSubresource(tex.Get(), 0, &box, pixels2.data(), frameSize.x / 8, (frameSize.x * frameSize.y) / 8);
this->mipMapSrv2 = srv;
hr = this->d3dDev->CreateTexture2D(&texDesc, nullptr, tex.ReleaseAndGetAddressOf());
hr = this->d3dDev->CreateShaderResourceView(tex.Get(), &srvDesc, srv.ReleaseAndGetAddressOf());
this->d3dCtx->UpdateSubresource(tex.Get(), 0, &box, pixels3.data(), frameSize.x / 8, (frameSize.x * frameSize.y) / 8);
this->mipMapSrv3 = srv;
}