Esempio n. 1
0
static void test_setting_constants(void)
{
    HWND wnd;
    IDirect3D9 *d3d;
    IDirect3DDevice9 *device;
    D3DPRESENT_PARAMETERS d3dpp;
    HRESULT hr;
    ULONG refcnt;

    /* Create the device to use for our tests */
    wnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
    d3d = Direct3DCreate9(D3D_SDK_VERSION);
    if (!wnd)
    {
        skip("Couldn't create application window\n");
        return;
    }
    if (!d3d)
    {
        skip("Couldn't create IDirect3D9 object\n");
        DestroyWindow(wnd);
        return;
    }

    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed   = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
    if (FAILED(hr))
    {
        skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
        IDirect3D9_Release(d3d);
        DestroyWindow(wnd);
        return;
    }

    test_setting_basic_table(device);
    test_setting_arrays_table(device);

    /* Release resources */
    refcnt = IDirect3DDevice9_Release(device);
    ok(refcnt == 0, "The Direct3D device reference count was %u, should be 0\n", refcnt);

    refcnt = IDirect3D9_Release(d3d);
    ok(refcnt == 0, "The Direct3D object referenct count was %u, should be 0\n", refcnt);

    if (wnd) DestroyWindow(wnd);
}
Esempio n. 2
0
void shutdownD3D9()
{
#ifdef __WIN32__
    /* Free all resources */
    if (gTexturePtr)
        IDirect3DTexture9_Release(gTexturePtr);
    gTexturePtr = NULL;
    if (gVShaderPtr)
        IDirect3DVertexShader9_Release(gVShaderPtr);
    gVShaderPtr = NULL;
    if (gPShaderPtr)
        IDirect3DPixelShader9_Release(gPShaderPtr);
    gPShaderPtr = NULL;
    if (gVertexBufferPtr)
        IDirect3DVertexBuffer9_Release(gVertexBufferPtr);
    gVertexBufferPtr = NULL;
    if (gIndexBufferPtr)
        IDirect3DIndexBuffer9_Release(gIndexBufferPtr);
    gIndexBufferPtr = NULL;
    if (gVertexDeclPtr)
        IDirect3DVertexDeclaration9_Release(gVertexDeclPtr);
    gVertexDeclPtr = NULL;
    if (gDevicePtr)
        IDirect3DDevice9_Release(gDevicePtr);
    gDevicePtr = NULL;
    if (gD3D9Ptr)
        IDirect3D9_Release(gD3D9Ptr);
    gD3D9Ptr = NULL;

    gDeviceBackBufferPtr = NULL;
#endif
}
Esempio n. 3
0
static void
D3D_DestroyRenderer(SDL_Renderer * renderer)
{
    D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;

    if (data) {
        /* Release the render target */
        if (data->defaultRenderTarget) {
            IDirect3DSurface9_Release(data->defaultRenderTarget);
            data->defaultRenderTarget = NULL;
        }
        if (data->currentRenderTarget != NULL) {
            IDirect3DSurface9_Release(data->currentRenderTarget);
            data->currentRenderTarget = NULL;
        }

        if (data->device) {
            IDirect3DDevice9_Release(data->device);
        }
        if (data->d3d) {
            IDirect3D9_Release(data->d3d);
            ID3DXMatrixStack_Release(data->matrixStack);
            SDL_UnloadObject(data->d3dDLL);
        }
        SDL_free(data);
    }
    SDL_free(renderer);
}
Esempio n. 4
0
static void dxva2_uninit(struct lavc_ctx *s)
{
    DXVA2Context *ctx = s->hwdec_priv;
    if (!ctx)
        return;

    if (ctx->decoder)
        dxva2_destroy_decoder(s);

    if (ctx->decoder_service)
        IDirectXVideoDecoderService_Release(ctx->decoder_service);

    if (ctx->d3d9devmgr && ctx->deviceHandle != INVALID_HANDLE_VALUE)
        IDirect3DDeviceManager9_CloseDeviceHandle(ctx->d3d9devmgr, ctx->deviceHandle);

    if (ctx->d3d9devmgr)
        IDirect3DDeviceManager9_Release(ctx->d3d9devmgr);

    if (ctx->d3d9device)
        IDirect3DDevice9_Release(ctx->d3d9device);

    if (ctx->d3d9)
        IDirect3D9_Release(ctx->d3d9);

    if (ctx->d3dlib)
        FreeLibrary(ctx->d3dlib);

    if (ctx->dxva2lib)
        FreeLibrary(ctx->dxva2lib);

    av_freep(&s->avctx->hwaccel_context);
    talloc_free(ctx);
    s->hwdec_priv = NULL;
}
Esempio n. 5
0
/**
 * It releases a Direct3D device and its resources.
 */
static void hb_d3d_destroy_device( hb_va_dxva2_t *dxva2 )
{
    if( dxva2->d3ddev )
        IDirect3DDevice9_Release( dxva2->d3ddev );
    if( dxva2->d3dobj )
        IDirect3D9_Release( dxva2->d3dobj );
}
Esempio n. 6
0
static void dxva2_device_free(AVHWDeviceContext *ctx)
{
    AVDXVA2DeviceContext *hwctx = ctx->hwctx;
    DXVA2DevicePriv       *priv = ctx->user_opaque;

    if (hwctx->devmgr && priv->device_handle != INVALID_HANDLE_VALUE)
        IDirect3DDeviceManager9_CloseDeviceHandle(hwctx->devmgr, priv->device_handle);

    if (hwctx->devmgr)
        IDirect3DDeviceManager9_Release(hwctx->devmgr);

    if (priv->d3d9device)
        IDirect3DDevice9_Release(priv->d3d9device);

    if (priv->d3d9)
        IDirect3D9_Release(priv->d3d9);

    if (priv->d3dlib)
        FreeLibrary(priv->d3dlib);

    if (priv->dxva2lib)
        FreeLibrary(priv->dxva2lib);

    av_freep(&ctx->user_opaque);
}
Esempio n. 7
0
/**
 * It releases a Direct3D device and its resources.
 */
static void D3dDestroyDevice(vlc_va_dxva2_t *va)
{
    if (va->d3ddev)
        IDirect3DDevice9_Release(va->d3ddev);
    if (va->d3dobj)
        IDirect3D9_Release(va->d3dobj);
}
static void
WIN_DeleteDevice(SDL_VideoDevice * device)
{
    SDL_VideoData *data = (SDL_VideoData *) device->driverdata;

    SDL_UnregisterApp();
#if SDL_VIDEO_RENDER_D3D
    if (data->d3d) {
        IDirect3D9_Release(data->d3d);
        FreeLibrary(data->d3dDLL);
    }
#endif
#if SDL_VIDEO_RENDER_DDRAW
    if (data->ddraw) {
        data->ddraw->lpVtbl->Release(data->ddraw);
        FreeLibrary(data->ddrawDLL);
    }
#endif
#ifdef _WIN32_WCE
    if(data->hAygShell) {
       FreeLibrary(data->hAygShell);
    }
#endif
	if (data->userDLL) {
		FreeLibrary(data->userDLL);
	}

    SDL_free(device->driverdata);
    SDL_free(device);
}
Esempio n. 9
0
/** @brief Reconfigure the whole Direct3D. Called only
 *  when the video adapter becomes uncooperative.
 *  @return 1 on success, 0 on failure
 */
static int reconfigure_d3d(void)
{
    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>reconfigure_d3d called.\n");

    /* Destroy the offscreen, OSD and backbuffer surfaces */
    destroy_d3d_surfaces();

    /* Destroy the D3D Device */
    if (priv->d3d_device)
        IDirect3DDevice9_Release(priv->d3d_device);
    priv->d3d_device = NULL;

    /* Stop the whole Direct3D */
    IDirect3D9_Release(priv->d3d_handle);

    /* Initialize Direct3D from the beginning */
    priv->d3d_handle = priv->pDirect3DCreate9(D3D_SDK_VERSION);
    if (!priv->d3d_handle) {
        mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Initializing Direct3D failed.\n");
        return 0;
    }

    /* Configure Direct3D */
    if (!configure_d3d())
        return 0;

    return 1;
}
Esempio n. 10
0
static void get_display_device_id(WCHAR *szIdentifierBuffer)
{
    static const WCHAR szNA[] = {'n','/','a',0};

    HRESULT hr = E_FAIL;

    HMODULE                 d3d9_handle;
    IDirect3D9             *(WINAPI *pDirect3DCreate9)(UINT) = NULL;
    IDirect3D9             *pD3d = NULL;
    D3DADAPTER_IDENTIFIER9  adapter_ident;

    /* Retrieves the display device identifier from the d3d9 implementation. */
    d3d9_handle = LoadLibraryA("d3d9.dll");
    if(d3d9_handle)
        pDirect3DCreate9 = (void *)GetProcAddress(d3d9_handle, "Direct3DCreate9");
    if(pDirect3DCreate9)
        pD3d = pDirect3DCreate9(D3D_SDK_VERSION);
    if(pD3d)
        hr = IDirect3D9_GetAdapterIdentifier(pD3d, D3DADAPTER_DEFAULT, 0, &adapter_ident);
    if(SUCCEEDED(hr)) {
        StringFromGUID2(&adapter_ident.DeviceIdentifier, szIdentifierBuffer, 39);
    } else {
        memcpy(szIdentifierBuffer, szNA, sizeof(szNA));
    }

    if (pD3d)
        IDirect3D9_Release(pD3d);
    if (d3d9_handle)
        FreeLibrary(d3d9_handle);
}
Esempio n. 11
0
void video_shutdown_dx9(void)
{
    if (d3d != NULL) {
        IDirect3D9_Release(d3d);
        d3d = NULL;
    }
}
Esempio n. 12
0
File: dxva2.c Progetto: tguillem/vlc
/**
 * It releases a Direct3D device and its resources.
 */
static void D3dDestroyDevice(vlc_va_t *va)
{
    directx_sys_t *dx_sys = &va->sys->dx_sys;
    if (va->sys->d3dobj)
        IDirect3D9_Release(va->sys->d3dobj);
    if (dx_sys->d3ddev)
        IDirect3DDevice9_Release(dx_sys->d3ddev);
}
Esempio n. 13
0
static ULONG release(base *d3dptr)
{
	IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj;
	ULONG result = IDirect3D9_Release(d3d9);
	FreeLibrary(d3dptr->dllhandle);
	global_free(d3dptr);
	return result;
}
Esempio n. 14
0
ULONG STDMETHODCALLTYPE IDirect3D9_Release_Hook(IDirect3D9* This) {
	auto count = IDirect3D9_Release_Orig(This);
	if (count == 1 && --IDirect3D9_HookCount == 0) {
		UNHOOK(IDirect3D9, This, CreateDevice);
		UNHOOK(IDirect3D9, This, Release);
		count = IDirect3D9_Release(This);
	}
	return count;
}
Esempio n. 15
0
/**
 * It releases an instance of Direct3D9
 */
static void Direct3DDestroy(vout_display_t *vd)
{
    vout_display_sys_t *sys = vd->sys;

    if (sys->d3dobj)
       IDirect3D9_Release(sys->d3dobj);
    if (sys->hd3d9_dll)
        FreeLibrary(sys->hd3d9_dll);

    sys->d3dobj = NULL;
    sys->hd3d9_dll = NULL;
}
Esempio n. 16
0
void D3D9_Destroy(d3d9_handle_t *hd3d)
{
    if (hd3d->obj)
    {
       IDirect3D9_Release(hd3d->obj);
       hd3d->obj = NULL;
    }
    if (hd3d->hdll)
    {
        FreeLibrary(hd3d->hdll);
        hd3d->hdll = NULL;
    }
}
Esempio n. 17
0
static void test_qi_base_to_ex(void)
{
    IDirect3D9 *d3d9 = pDirect3DCreate9(D3D_SDK_VERSION);
    IDirect3D9Ex *d3d9ex = (void *) 0xdeadbeef;
    IDirect3DDevice9 *device;
    IDirect3DDevice9Ex *deviceEx = (void *) 0xdeadbeef;
    HRESULT hr;
    HWND window = create_window();
    D3DPRESENT_PARAMETERS present_parameters;

    if (!d3d9)
    {
        skip("Direct3D9 is not available\n");
        return;
    }

    hr = IDirect3D9_QueryInterface(d3d9, &IID_IDirect3D9Ex, (void **) &d3d9ex);
    ok(hr == E_NOINTERFACE,
       "IDirect3D9::QueryInterface for IID_IDirect3D9Ex returned %08x, expected E_NOINTERFACE\n",
       hr);
    ok(d3d9ex == NULL, "QueryInterface returned interface %p, expected NULL\n", d3d9ex);
    if(d3d9ex) IDirect3D9Ex_Release(d3d9ex);

    memset(&present_parameters, 0, sizeof(present_parameters));
    present_parameters.Windowed = TRUE;
    present_parameters.hDeviceWindow = window;
    present_parameters.SwapEffect = D3DSWAPEFFECT_COPY;
    present_parameters.BackBufferWidth = 640;
    present_parameters.BackBufferHeight = 480;
    present_parameters.EnableAutoDepthStencil = FALSE;
    present_parameters.AutoDepthStencilFormat = D3DFMT_D16;
    hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device);
    if(FAILED(hr)) {
        skip("Failed to create a regular Direct3DDevice9, skipping QI tests\n");
        goto out;
    }

    hr = IDirect3DDevice9_QueryInterface(device, &IID_IDirect3DDevice9Ex, (void **) &deviceEx);
    ok(hr == E_NOINTERFACE,
       "IDirect3D9Device::QueryInterface for IID_IDirect3DDevice9Ex returned %08x, expected E_NOINTERFACE\n",
       hr);
    ok(deviceEx == NULL, "QueryInterface returned interface %p, expected NULL\n", deviceEx);
    if(deviceEx) IDirect3DDevice9Ex_Release(deviceEx);

    IDirect3DDevice9_Release(device);

out:
    IDirect3D9_Release(d3d9);
    DestroyWindow(window);
}
Esempio n. 18
0
static void
D3D_DestroyRenderer(SDL_Renderer * renderer)
{
    D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;

    if (data) {
        if (data->device) {
            IDirect3DDevice9_Release(data->device);
        }
        if (data->d3d) {
            IDirect3D9_Release(data->d3d);
            SDL_UnloadObject(data->d3dDLL);
        }
        SDL_free(data);
    }
    SDL_free(renderer);
}
Esempio n. 19
0
void d3dwin_close(){
	if(fullscreen) ShowCursor(TRUE);
	if(device){
		IDirect3DDevice9_EvictManagedResources(device);
		IDirect3DDevice9_Release(device);
		device = NULL;
	}
	if(direct3d){
		IDirect3D9_Release(direct3d);
		direct3d = NULL;
	}
	if(win){
		DestroyWindow(win);
		win = NULL;
	}
	UnregisterClass("d3d9", inst);
}
Esempio n. 20
0
static void
WIN_DeleteDevice(SDL_VideoDevice * device)
{
    SDL_VideoData *data = (SDL_VideoData *) device->driverdata;

    SDL_UnregisterApp();
#if SDL_VIDEO_RENDER_D3D
    if (data->d3d) {
        IDirect3D9_Release(data->d3d);
        FreeLibrary(data->d3dDLL);
    }
#endif
    if (data->wintabDLL) {
        FreeLibrary(data->wintabDLL);
    }
    SDL_free(device->driverdata);
    SDL_free(device);
}
Esempio n. 21
0
/** @brief Uninitialize Direct3D and close the window.
 */
static void uninit_d3d(void)
{
    mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>uninit_d3d called.\n");

    destroy_d3d_surfaces();

    /* Destroy the D3D Device */
    if (priv->d3d_device)
        IDirect3DDevice9_Release(priv->d3d_device);
    priv->d3d_device = NULL;

    /* Stop the whole D3D. */
    if (priv->d3d_handle) {
        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Stopping Direct3D.\n");
        IDirect3D9_Release(priv->d3d_handle);
    }
    priv->d3d_handle = NULL;
}
Esempio n. 22
0
void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d)
{
   if (dev)
   {
#if defined(HAVE_D3D9) && !defined(__cplusplus)
      IDirect3DDevice9_Release(dev);
#else
      dev->Release();
#endif
   }
   if (pd3d)
   {
#if defined(HAVE_D3D9) && !defined(__cplusplus)
      IDirect3D9_Release(pd3d);
#else
      pd3d->Release();
#endif
   }
}
static BOOL create_video_service(HWND focus_window, REFIID riid, void **service)
{
    IDirect3DDevice9 *device;
    IDirect3D9 *d3d9;
    HRESULT hr;

    d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
    if (!d3d9) return FALSE;

    device = create_device(d3d9, focus_window);
    IDirect3D9_Release(d3d9);
    if(!device)
        return FALSE;

    hr = pDXVA2CreateVideoService(device, riid, service);
    IDirect3DDevice9_Release(device);
    if (hr) return FALSE;

    return TRUE;
}
Esempio n. 24
0
ILvoid CheckFormatsDX9(IDirect3DDevice9 *Device)
{
	D3DDISPLAYMODE	DispMode;
	HRESULT			hr;
	IDirect3D9		*TestD3D9;
	ILuint			i;

	IDirect3DDevice9_GetDirect3D(Device, (IDirect3D9**)&TestD3D9);
	IDirect3DDevice9_GetDisplayMode(Device, 0, &DispMode);

	for (i = 0; i < 6; i++) {
		hr = IDirect3D9_CheckDeviceFormat(TestD3D9, D3DADAPTER_DEFAULT,
			D3DDEVTYPE_HAL, DispMode.Format, 0, D3DRTYPE_TEXTURE, FormatsDX9[i]);
		FormatsDX9supported[i] = SUCCEEDED(hr);
	}

	IDirect3D9_Release(TestD3D9);
	FormatsDX9Checked = IL_TRUE;

	return;
}
Esempio n. 25
0
//get the VMT and the hooking functions offsets
void GetDevice9Methods()
{
	IDirect3D9 *d3d9_ptr;
	IDirect3DDevice9* d3dDevice;
	DWORD* vtablePtr;
	D3DPRESENT_PARAMETERS d3dpp;
	static HMODULE d3d9_handle = 0;
	HWND hWnd = CreateWindowExA(0, "STATIC","dummy", 0, 0, 0, 0, 0, 0, 0, 0, 0);
    d3d9_handle = LoadLibraryA("d3d9.dll");
    d3d9_ptr = Direct3DCreate9(D3D_SDK_VERSION);
	ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = 1;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;	
	IDirect3D9_CreateDevice(d3d9_ptr, 0, D3DDEVTYPE_HAL, hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &d3dDevice);
	vtablePtr = (DWORD*)(*((DWORD*)d3dDevice));
	present9 = vtablePtr[17] - (DWORD)d3d9_handle;
	IDirect3DDevice9_Release(d3dDevice);
	IDirect3D9_Release(d3d9_ptr);
	FreeLibrary(d3d9_handle);
	CloseHandle(hWnd);
}
Esempio n. 26
0
static void
gst_dx9screencapsrc_dispose (GObject * object)
{
  GstDX9ScreenCapSrc *src = GST_DX9SCREENCAPSRC (object);

  if (src->surface) {
    GST_ERROR_OBJECT (object,
        "DX9 surface was not freed in _stop, freeing in _dispose!");
    IDirect3DSurface9_Release (src->surface);
    src->surface = NULL;
  }

  if (src->d3d9_device) {
    IDirect3DDevice9_Release (src->d3d9_device);
    src->d3d9_device = NULL;
  }

  if (!IDirect3D9_Release (g_d3d9))
    g_d3d9 = NULL;

  G_OBJECT_CLASS (parent_class)->dispose (object);
}
Esempio n. 27
0
int
SDL_Direct3D9GetAdapterIndex( int displayIndex )
{
	void *pD3DDLL;
	IDirect3D9 *pD3D;
	if (!D3D_LoadDLL(&pD3DDLL, &pD3D)) {
		SDL_SetError("Unable to create Direct3D interface");
		return D3DADAPTER_DEFAULT;
	} else {
		SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex);
		int adapterIndex = D3DADAPTER_DEFAULT;

		if (!pData) {
			SDL_SetError("Invalid display index");
			adapterIndex = -1; /* make sure we return something invalid */
		} else {
			char *displayName = WIN_StringToUTF8(pData->DeviceName);
			unsigned int count = IDirect3D9_GetAdapterCount(pD3D);
			unsigned int i;
			for (i=0; i<count; i++) {
				D3DADAPTER_IDENTIFIER9 id;
				IDirect3D9_GetAdapterIdentifier(pD3D, i, 0, &id);

				if (SDL_strcmp(id.DeviceName, displayName) == 0) {
					adapterIndex = i;
					break;
				}
			}
			SDL_free(displayName);
		}

		/* free up the D3D stuff we inited */
		IDirect3D9_Release(pD3D);
		SDL_UnloadObject(pD3DDLL);

		return adapterIndex;
	}
}
Esempio n. 28
0
static void dxva2_uninit(AVCodecContext *s)
{
    HwAccelContext  *hac = s->opaque;
    DXVA2Context *ctx = hac->hwaccel_ctx;

    hac->hwaccel_uninit        = NULL;
    hac->hwaccel_get_buffer    = NULL;
    hac->hwaccel_retrieve_data = NULL;

    if (ctx->decoder)
        dxva2_destroy_decoder(s);

    if (ctx->decoder_service)
        IDirectXVideoDecoderService_Release(ctx->decoder_service);

    if (ctx->d3d9devmgr && ctx->deviceHandle != INVALID_HANDLE_VALUE)
        IDirect3DDeviceManager9_CloseDeviceHandle(ctx->d3d9devmgr, ctx->deviceHandle);

    if (ctx->d3d9devmgr)
        IDirect3DDeviceManager9_Release(ctx->d3d9devmgr);

    if (ctx->d3d9device)
        IDirect3DDevice9_Release(ctx->d3d9device);

    if (ctx->d3d9)
        IDirect3D9_Release(ctx->d3d9);

    if (ctx->d3dlib)
        FreeLibrary(ctx->d3dlib);

    //if (ctx->dxva2lib)
    //    FreeLibrary(ctx->dxva2lib);

    av_frame_free(&ctx->tmp_frame);

    av_freep(&hac->hwaccel_ctx);
    av_freep(&s->hwaccel_context);
}
Esempio n. 29
0
static
BOOL
InitializeDialog(HWND hwndDlg, PDISPLAY_DEVICEW pDispDevice)
{
    WCHAR szText[100];
    WCHAR szFormat[30];
    HKEY hKey;
    HWND hDlgCtrls[5];
    DWORD dwMemory;
    DEVMODEW DevMode;
    IDirect3D9 * ppObj = NULL;
    D3DADAPTER_IDENTIFIER9 Identifier;
    HRESULT hResult;

    szText[0] = L'\0';

    /* fix wine */
    //ppObj = Direct3DCreate9(D3D_SDK_VERSION);
    if (ppObj)
    {
        hResult = IDirect3D9_GetAdapterIdentifier(ppObj, D3DADAPTER_DEFAULT , 2/*D3DENUM_WHQL_LEVEL*/, &Identifier);
        if (hResult == D3D_OK)
        {

            if (Identifier.WHQLLevel)
            {
                /* adapter is WHQL certified */
                LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR));
            }
            else
            {
                LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR));
            }
        }
        IDirect3D9_Release(ppObj);
    }
    else
    {
        LoadStringW(hInst, IDS_DEVICE_STATUS_UNKNOWN, szText, sizeof(szText)/sizeof(WCHAR));
    }
    szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
    SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_LOGO, WM_SETTEXT, 0, (LPARAM)szText);

    if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, &pDispDevice->DeviceKey[18], 0, KEY_READ, &hKey) != ERROR_SUCCESS)
        return FALSE;

    if (GetRegValue(hKey, NULL, L"HardwareInformation.ChipType", REG_BINARY, szText, sizeof(szText)))
    {
        /* set chip type */
        SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_CHIP, WM_SETTEXT, 0, (LPARAM)szText);
    }

    if (GetRegValue(hKey, NULL, L"HardwareInformation.DacType", REG_BINARY, szText, sizeof(szText)))
    {
        /* set DAC type */
        SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_DAC, WM_SETTEXT, 0, (LPARAM)szText);
    }

    if (GetRegValue(hKey, NULL, L"HardwareInformation.MemorySize", REG_BINARY, (LPWSTR)&dwMemory, sizeof(dwMemory)))
    {
        /* set chip memory size */
        if (dwMemory > (1048576))
        {
            /* buggy ATI driver requires that */
            dwMemory /= 1048576;
        }
        szFormat[0] = L'\0';
        if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MEM, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
            szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
        wsprintfW(szText, szFormat, dwMemory);
        SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MEM, WM_SETTEXT, 0, (LPARAM)szText);
    }

    /* retrieve current display mode */
    DevMode.dmSize = sizeof(DEVMODEW);
    if (EnumDisplaySettingsW(pDispDevice->DeviceName, ENUM_CURRENT_SETTINGS, &DevMode))
    {
        szFormat[0] = L'\0';
        if (LoadStringW(hInst, IDS_FORMAT_ADAPTER_MODE, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
            szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
        wsprintfW(szText, szFormat, DevMode.dmPelsWidth, DevMode.dmPelsHeight, DevMode.dmBitsPerPel, DevMode.dmDisplayFrequency);
        SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MODE, WM_SETTEXT, 0, (LPARAM)szText);
    }

    /* query attached monitor */
    wcscpy(szText, pDispDevice->DeviceName);
    ZeroMemory(pDispDevice, sizeof(DISPLAY_DEVICEW));
    pDispDevice->cb = sizeof(DISPLAY_DEVICEW);
    if (EnumDisplayDevicesW(szText, 0, pDispDevice, 0))
    {
         /* set monitor name */
        SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_MONITOR, WM_SETTEXT, 0, (LPARAM)pDispDevice->DeviceString);
    }

    hDlgCtrls[0] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_ID);
    hDlgCtrls[1] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VENDOR);
    hDlgCtrls[2] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DRIVER);
    hDlgCtrls[3] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_VERSION);
    hDlgCtrls[4] = GetDlgItem(hwndDlg, IDC_STATIC_ADAPTER_DATE);

    SetDeviceDetails(hDlgCtrls, &GUID_DEVCLASS_DISPLAY, NULL);
    return TRUE;
}
Esempio n. 30
0
File: dxva2.c Progetto: joshkosh/vlc
/**
 * It releases a Direct3D device and its resources.
 */
static void D3dDestroyDevice(vlc_va_t *va)
{
    if (va->sys->d3dobj)
        IDirect3D9_Release(va->sys->d3dobj);
}