本文整理汇总了C++中IDirect3DDevice9::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirect3DDevice9::Release方法的具体用法?C++ IDirect3DDevice9::Release怎么用?C++ IDirect3DDevice9::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirect3DDevice9
的用法示例。
在下文中一共展示了IDirect3DDevice9::Release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call
static HRESULT STDMETHODCALLTYPE hook_present_swap(IDirect3DSwapChain9 *swap,
CONST RECT *src_rect, CONST RECT *dst_rect,
HWND override_window, CONST RGNDATA *dirty_region, DWORD flags)
{
IDirect3DSurface9 *backbuffer = nullptr;
IDirect3DDevice9 *device = nullptr;
HRESULT hr;
if (!present_recurse) {
hr = swap->GetDevice(&device);
if (SUCCEEDED(hr)) {
device->Release();
}
}
if (device) {
if (!hooked_reset)
setup_reset_hooks(device);
present_begin(device, backbuffer);
}
unhook(&present_swap);
present_swap_t call = (present_swap_t)present_swap.call_addr;
hr = call(swap, src_rect, dst_rect, override_window, dirty_region,
flags);
rehook(&present_swap);
if (device)
present_end(device, backbuffer);
return hr;
}
示例2: findOriginalDevice
static IDirect3DDevice9* findOriginalDevice(IDirect3DDevice9 *device) {
IDirect3DSwapChain9 *pSwap = NULL;
device->GetSwapChain(0, &pSwap);
if (pSwap) {
IDirect3DDevice9 *originalDevice = NULL;
if (SUCCEEDED(pSwap->GetDevice(&originalDevice))) {
if (originalDevice == device) {
// Found the original device. Release responsibility is passed
// to the caller.
} else {
device = findOriginalDevice(originalDevice);
originalDevice->Release();
}
} else {
ods("D3D9: Failed to recurse to find original device. Could not get Device from Swapchain.");
}
pSwap->Release();
} else {
ods("D3D9: Failed to recurse to find original device. Could not get Swapchain.");
}
return device;
}
示例3: nvDebugCheck
void D3DXCompressorDXT1::compress(nvtt::InputFormat inputFormat, nvtt::AlphaMode alphaMode, uint w, uint h, uint d, void * data, const nvtt::CompressionOptions::Private & compressionOptions, const nvtt::OutputOptions::Private & outputOptions)
{
nvDebugCheck(d == 1);
IDirect3D9 * d3d = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS presentParams;
ZeroMemory(&presentParams, sizeof(presentParams));
presentParams.Windowed = TRUE;
presentParams.SwapEffect = D3DSWAPEFFECT_COPY;
presentParams.BackBufferWidth = 8;
presentParams.BackBufferHeight = 8;
presentParams.BackBufferFormat = D3DFMT_UNKNOWN;
HRESULT err;
IDirect3DDevice9 * device = NULL;
err = d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, GetDesktopWindow(), D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentParams, &device);
IDirect3DTexture9 * texture = NULL;
err = D3DXCreateTexture(device, w, h, 1, 0, D3DFMT_DXT1, D3DPOOL_SYSTEMMEM, &texture);
IDirect3DSurface9 * surface = NULL;
err = texture->GetSurfaceLevel(0, &surface);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.bottom = h;
rect.right = w;
if (inputFormat == nvtt::InputFormat_BGRA_8UB)
{
err = D3DXLoadSurfaceFromMemory(surface, NULL, NULL, data, D3DFMT_A8R8G8B8, w * 4, NULL, &rect, D3DX_DEFAULT, 0);
}
else
{
err = D3DXLoadSurfaceFromMemory(surface, NULL, NULL, data, D3DFMT_A32B32G32R32F, w * 16, NULL, &rect, D3DX_DEFAULT, 0);
}
if (err != D3DERR_INVALIDCALL && err != D3DXERR_INVALIDDATA)
{
D3DLOCKED_RECT rect;
ZeroMemory(&rect, sizeof(rect));
err = surface->LockRect(&rect, NULL, D3DLOCK_READONLY);
if (outputOptions.outputHandler != NULL) {
int size = rect.Pitch * ((h + 3) / 4);
outputOptions.outputHandler->writeData(rect.pBits, size);
}
err = surface->UnlockRect();
}
surface->Release();
device->Release();
d3d->Release();
}
示例4: release
//應該重載此函數 在裡面增加 資源釋放操作 釋放資源
virtual void release()
{
if(_device)
{
_device->Release();
_device = NULL;
}
}
示例5: GetModuleHandle
//I don't think this code work for allthing
bool h3d::BeginD3D9CaptureHook() {
wchar_t sD3D9Path[MAX_PATH];
SHGetFolderPathW(NULL, CSIDL_SYSTEM, NULL, SHGFP_TYPE_CURRENT, sD3D9Path);
wcscat_s(sD3D9Path, MAX_PATH, L"\\d3d9.dll");
bool d3d9_support = false;
hD3D9Dll = GetModuleHandle(sD3D9Path);
if (hD3D9Dll) {
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = true;
d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
d3dpp.hDeviceWindow = hSender;
D3D9CREATEPROC fD3D9Create = (D3D9CREATEPROC)GetProcAddress(hD3D9Dll, "Direct3DCreate9");
if (fD3D9Create) {
LPDIRECT3D9 pD3D = fD3D9Create(D3D_SDK_VERSION);
if (pD3D) {
IDirect3DDevice9* device;
if (SUCCEEDED(pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, hSender, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device))) {
end_scene.Do(h3d::GetVirtual(device, D3D9ENDSCENE_OFFSET), (h3d::WINAPIPROC)EndScne);
device->Release();
d3d9_support = true;
}
pD3D->Release();
}
}
D3D9CREATEXPROC fD3D9CreateEx = (D3D9CREATEXPROC)GetProcAddress(hD3D9Dll, "Direct3DCreate9Ex");
if (fD3D9CreateEx) {
IDirect3D9Ex* pD3DEx = NULL;
if (SUCCEEDED(fD3D9CreateEx(D3D_SDK_VERSION, &pD3DEx))) {
IDirect3DDevice9Ex* deviceEx = NULL;
if (SUCCEEDED(pD3DEx->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, hSender, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, NULL, &deviceEx))) {
if (end_scene.GetTarget() != h3d::GetVirtual(deviceEx, D3D9ENDSCENE_OFFSET)) {
logstream << "IDirect3DDevice9Ex::EndScene != IDirect3DDevice9::EndScene" << std::endl;
end_sceneex.Do(h3d::GetVirtual(deviceEx, D3D9ENDSCENE_OFFSET), (h3d::WINAPIPROC)EndScne);
}
d3d9ex_support = true;
}
pD3DEx->Release();
}
}
}
return d3d9ex_support || d3d9_support;
}
示例6: Cleanup
HRESULT APPLICATION::Cleanup()
{
try
{
m_pFont->Release();
m_pLine->Release();
m_pDevice->Release();
debug.Print("Application terminated");
}
catch(...){}
return S_OK;
}
示例7:
void D3DGLSwapChain::releaseIface()
{
if(--mIfaceCount == 0)
{
if(mIsAuto)
mParent->Release();
else
{
IDirect3DDevice9 *device = mParent;
delete this;
device->Release();
}
}
}
示例8:
uintptr_t* Edo::GetD3D9DeviceVTable(HWND window)
{
IDirect3DDevice9* pDevice;
//Create dummy device.
CreateD3D9DummyDevice(window, &pDevice);
//Get the VTable.
uintptr_t* vTable = (uintptr_t*)*(uintptr_t*)pDevice;
//Release.
pDevice->Release();
return vTable;
}
示例9: Cleanup
HRESULT APPLICATION::Cleanup()
{
try
{
m_terrain.Release();
UnloadObjectResources();
m_pFont->Release();
m_pDevice->Release();
debug.Print("Application terminated");
}
catch(...){}
return S_OK;
}
示例10: mySwapPresent
static HRESULT __stdcall mySwapPresent(IDirect3DSwapChain9 * ids, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) {
ods("D3D9: SwapChain Present");
IDirect3DDevice9 *idd = NULL;
ids->GetDevice(&idd);
if (idd) {
doPresent(idd);
idd->Release();
}
//TODO: Move logic to HardHook.
// Call base without active hook in case of no trampoline.
SwapPresentType oSwapPresent = (SwapPresentType) hhSwapPresent.call;
hhSwapPresent.restore();
HRESULT hr = oSwapPresent(ids, pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion,dwFlags);
hhSwapPresent.inject();
return hr;
}
示例11: Cleanup
HRESULT APPLICATION::Cleanup()
{
try
{
if(m_pHeightMap != NULL)
{
delete m_pHeightMap;
m_pHeightMap = NULL;
}
m_pFont->Release();
m_pDevice->Release();
debug.Print("Application terminated");
}
catch(...){}
return S_OK;
}
示例12: EntryPoint
int EntryPoint()
{
IDirect3D9* d3d = Direct3DCreate9(D3D_SDK_VERSION);
if (d3d == NULL)
{
return 0;
}
g_dev_params.hDeviceWindow = InitWindow();
IDirect3DDevice9* device = NULL;
if (d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_dev_params.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &g_dev_params, &device) != S_OK)
{
return 0;
}
DemoInit(device);
MSG msg;
while (GetCurrentSample() < MAX_SAMPLES)
{
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
DemoUpdate(device, GetTickCount());
Sleep(10);
}
#ifndef RELEASE
DemoDestroy(device);
device->Release();
d3d->Release();
DestroyWindow(g_dev_params.hDeviceWindow);
return 0;
#else
ExitProcess(0);
#endif
}
示例13: mySwapPresent
static HRESULT __stdcall mySwapPresent(IDirect3DSwapChain9 *ids, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) {
// Present is called for each frame. Thus, we do not want to always log here.
#ifdef EXTENDED_OVERLAY_DEBUGOUTPUT
ods("D3D9: SwapChain Present");
#endif
IDirect3DDevice9 *idd = NULL;
ids->GetDevice(&idd);
if (idd) {
doPresent(idd);
idd->Release();
}
//TODO: Move logic to HardHook.
// Call base without active hook in case of no trampoline.
SwapPresentType oSwapPresent = (SwapPresentType) hhSwapPresent.call;
hhSwapPresent.restore();
HRESULT hr = oSwapPresent(ids, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
hhSwapPresent.inject();
return hr;
}
示例14: pSwapChainPresent
// Detour function that replaces the IDirect3dSwapChain9::Present() API
DllExport HRESULT __stdcall hook_D3D9SwapChainPresent(
IDirect3DSwapChain9 * This,
CONST RECT* pSourceRect,
CONST RECT* pDestRect,
HWND hDestWindowOverride,
CONST RGNDATA* pDirtyRegion,
DWORD dwFlags
)
{
static int present_hooked = 0;
IDirect3DDevice9 *pDevice;
if (present_hooked == 0) {
OutputDebugString("[IDirect3dSwapChain9::Present()]");
present_hooked = 1;
}
HRESULT hr = pSwapChainPresent(This, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
This->GetDevice(&pDevice);
if(resolution_retrieved == 0) {
if(D3D9_get_resolution(pDevice) >= 0) {
resolution_retrieved = 1;
}
return hr;
}
if (enable_server_rate_control) {
if(ga_hook_video_rate_control() > 0)
D3D9_screen_capture(pDevice);
} else {
D3D9_screen_capture(pDevice);
}
pDevice->Release();
return hr;
}
示例15: mySwapPresent
static HRESULT __stdcall mySwapPresent(IDirect3DSwapChain9 * ids, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) {
ods("D3D9: SwapChain Present");
if (bPresenting) {
ods("D3D9: Not doublepresenting in chain!");
} else {
IDirect3DDevice9 *idd = NULL;
ids->GetDevice(&idd);
if (idd) {
myAdditions(idd);
doPresent(idd);
idd->Release();
}
}
SwapPresentType oSwapPresent;
oSwapPresent = (SwapPresentType) hhSwapPresent.call;
hhSwapPresent.restore();
HRESULT hr = oSwapPresent(ids, pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion,dwFlags);
hhSwapPresent.inject();
return hr;
}