[vlc-commits] direct3d9: refactor, use a struct to hold d3d ctx
Thomas Guillem
git at videolan.org
Mon Nov 13 13:12:11 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 8 17:26:10 2017 +0100| [49db448c7ead4bdcb75feacebaad36896928875b] | committer: Thomas Guillem
direct3d9: refactor, use a struct to hold d3d ctx
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=49db448c7ead4bdcb75feacebaad36896928875b
---
modules/video_output/win32/direct3d9.c | 187 +++++++++++++++++----------------
1 file changed, 94 insertions(+), 93 deletions(-)
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index bf51a5d78d..cdc2049197 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -120,6 +120,25 @@ typedef struct
uint32_t bmask;
} d3d_format_t;
+struct d3dctx
+{
+ HINSTANCE hdll; /* handle of the opened d3d9 dll */
+ HINSTANCE hxdll; /* handle of the opened d3d9x dll */
+ union
+ {
+ LPDIRECT3D9 obj;
+ LPDIRECT3D9EX objex;
+ };
+ union
+ {
+ LPDIRECT3DDEVICE9 dev;
+ LPDIRECT3DDEVICE9EX devex;
+ };
+ D3DPRESENT_PARAMETERS pp;
+ D3DCAPS9 caps;
+ bool use_ex;
+};
+
struct vout_display_sys_t
{
vout_display_sys_win32_t sys;
@@ -133,14 +152,8 @@ struct vout_display_sys_t
vout_display_cfg_t cfg_saved; /* configuration used before going into desktop mode */
// core objects
- HINSTANCE hd3d9_dll; /* handle of the opened d3d9 dll */
- HINSTANCE hd3d9x_dll; /* handle of the opened d3d9x dll */
+ struct d3dctx d3dctx;
IDirect3DPixelShader9* d3dx_shader;
- LPDIRECT3D9 d3dobj;
- D3DCAPS9 d3dcaps;
- LPDIRECT3DDEVICE9 d3ddev;
- D3DPRESENT_PARAMETERS d3dpp;
- bool use_d3d9ex;
// scene objects
LPDIRECT3DTEXTURE9 d3dtex;
@@ -277,11 +290,11 @@ static int Open(vlc_object_t *object)
info.has_pictures_invalid = !is_d3d9_opaque(fmt.i_chroma);
if (var_InheritBool(vd, "direct3d9-hw-blending") &&
sys->d3dregion_format != D3DFMT_UNKNOWN &&
- (sys->d3dcaps.SrcBlendCaps & D3DPBLENDCAPS_SRCALPHA) &&
- (sys->d3dcaps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) &&
- (sys->d3dcaps.TextureCaps & D3DPTEXTURECAPS_ALPHA) &&
- (sys->d3dcaps.TextureOpCaps & D3DTEXOPCAPS_SELECTARG1) &&
- (sys->d3dcaps.TextureOpCaps & D3DTEXOPCAPS_MODULATE))
+ (sys->d3dctx.caps.SrcBlendCaps & D3DPBLENDCAPS_SRCALPHA) &&
+ (sys->d3dctx.caps.DestBlendCaps & D3DPBLENDCAPS_INVSRCALPHA) &&
+ (sys->d3dctx.caps.TextureCaps & D3DPTEXTURECAPS_ALPHA) &&
+ (sys->d3dctx.caps.TextureOpCaps & D3DTEXOPCAPS_SELECTARG1) &&
+ (sys->d3dctx.caps.TextureOpCaps & D3DTEXOPCAPS_MODULATE))
info.subpicture_chromas = d3d_subpicture_chromas;
else
info.subpicture_chromas = NULL;
@@ -409,7 +422,7 @@ static picture_pool_t *Direct3D9CreatePicturePool(vout_display_t *vd, unsigned c
if (unlikely(picsys == NULL))
goto error;
- HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(vd->sys->d3ddev,
+ HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(vd->sys->d3dctx.dev,
vd->fmt.i_width,
vd->fmt.i_height,
format,
@@ -480,7 +493,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
visibleSource.top = 0;
visibleSource.right = picture->format.i_visible_width;
visibleSource.bottom = picture->format.i_visible_height;
- hr = IDirect3DDevice9_StretchRect( sys->d3ddev, pic_ctx->picsys.surface, &visibleSource, surface, &visibleSource, D3DTEXF_NONE);
+ hr = IDirect3DDevice9_StretchRect( sys->d3dctx.dev, pic_ctx->picsys.surface, &visibleSource, surface, &visibleSource, D3DTEXF_NONE);
if (FAILED(hr)) {
msg_Err(vd, "Failed to copy the hw surface to the decoder surface (hr=0x%0lx)", hr );
}
@@ -488,7 +501,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
}
/* check if device is still available */
- HRESULT hr = IDirect3DDevice9_TestCooperativeLevel(sys->d3ddev);
+ HRESULT hr = IDirect3DDevice9_TestCooperativeLevel(sys->d3dctx.dev);
if (FAILED(hr)) {
if (hr == D3DERR_DEVICENOTRESET && !sys->reset_device) {
vout_display_SendEventPicturesInvalid(vd);
@@ -538,12 +551,10 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
const RECT dst = sys->sys.rect_dest_clipped;
HRESULT hr;
- if (sys->use_d3d9ex) {
- LPDIRECT3DDEVICE9EX d3ddev = (LPDIRECT3DDEVICE9EX)sys->d3ddev;
- hr = IDirect3DDevice9Ex_PresentEx(d3ddev, &src, &dst, NULL, NULL, 0);
+ if (sys->d3dctx.use_ex) {
+ hr = IDirect3DDevice9Ex_PresentEx(sys->d3dctx.devex, &src, &dst, NULL, NULL, 0);
} else {
- LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
- hr = IDirect3DDevice9_Present(d3ddev, &src, &dst, NULL, NULL);
+ hr = IDirect3DDevice9_Present(sys->d3dctx.dev, &src, &dst, NULL, NULL);
}
if (FAILED(hr)) {
msg_Dbg(vd, "Failed IDirect3DDevice9_Present: 0x%0lx", hr);
@@ -684,7 +695,7 @@ static void Manage (vout_display_t *vd)
width = rect.right-rect.left;
height = rect.bottom-rect.top;
- if (width != p_sys->d3dpp.BackBufferWidth || height != p_sys->d3dpp.BackBufferHeight)
+ if (width != p_sys->d3dctx.pp.BackBufferWidth || height != p_sys->d3dctx.pp.BackBufferHeight)
{
msg_Dbg(vd, "resizing device back buffers to (%lux%lu)", width, height);
// need to reset D3D device to resize back buffer
@@ -717,15 +728,15 @@ static int Direct3D9Create(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- sys->hd3d9_dll = LoadLibrary(TEXT("D3D9.DLL"));
- if (!sys->hd3d9_dll) {
+ sys->d3dctx.hdll = LoadLibrary(TEXT("D3D9.DLL"));
+ if (!sys->d3dctx.hdll) {
msg_Warn(vd, "cannot load d3d9.dll, aborting");
return VLC_EGENERIC;
}
LPDIRECT3D9 (WINAPI *OurDirect3DCreate9)(UINT SDKVersion);
OurDirect3DCreate9 =
- (void *)GetProcAddress(sys->hd3d9_dll, "Direct3DCreate9");
+ (void *)GetProcAddress(sys->d3dctx.hdll, "Direct3DCreate9");
if (!OurDirect3DCreate9) {
msg_Err(vd, "Cannot locate reference to Direct3DCreate9 ABI in DLL");
return VLC_EGENERIC;
@@ -733,56 +744,53 @@ static int Direct3D9Create(vout_display_t *vd)
HRESULT (WINAPI *OurDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
OurDirect3DCreate9Ex =
- (void *)GetProcAddress(sys->hd3d9_dll, "Direct3DCreate9Ex");
+ (void *)GetProcAddress(sys->d3dctx.hdll, "Direct3DCreate9Ex");
/* Create the D3D object. */
if (OurDirect3DCreate9Ex) {
- LPDIRECT3D9EX d3d9exobj;
- HRESULT hr = OurDirect3DCreate9Ex(D3D_SDK_VERSION, &d3d9exobj);
+ HRESULT hr = OurDirect3DCreate9Ex(D3D_SDK_VERSION, &sys->d3dctx.objex);
if(!FAILED(hr)) {
msg_Dbg(vd, "Using Direct3D9 Extended API!");
- sys->d3dobj = (LPDIRECT3D9)d3d9exobj;
- sys->use_d3d9ex = true;
+ sys->d3dctx.use_ex = true;
}
}
- if (!sys->d3dobj)
+ if (!sys->d3dctx.obj)
{
- LPDIRECT3D9 d3dobj = OurDirect3DCreate9(D3D_SDK_VERSION);
- if (!d3dobj) {
+ sys->d3dctx.obj = OurDirect3DCreate9(D3D_SDK_VERSION);
+ if (!sys->d3dctx.obj) {
msg_Err(vd, "Could not create Direct3D9 instance.");
return VLC_EGENERIC;
}
- sys->d3dobj = d3dobj;
}
- sys->hd3d9x_dll = Direct3D9LoadShaderLibrary();
- if (!sys->hd3d9x_dll)
+ sys->d3dctx.hxdll = Direct3D9LoadShaderLibrary();
+ if (!sys->d3dctx.hxdll)
msg_Warn(vd, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
/*
** Get device capabilities
*/
- ZeroMemory(&sys->d3dcaps, sizeof(sys->d3dcaps));
- HRESULT hr = IDirect3D9_GetDeviceCaps(sys->d3dobj, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &sys->d3dcaps);
+ ZeroMemory(&sys->d3dctx.caps, sizeof(sys->d3dctx.caps));
+ HRESULT hr = IDirect3D9_GetDeviceCaps(sys->d3dctx.obj, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &sys->d3dctx.caps);
if (FAILED(hr)) {
msg_Err(vd, "Could not read adapter capabilities. (hr=0x%0lx)", hr);
return VLC_EGENERIC;
}
/* TODO: need to test device capabilities and select the right render function */
- if (!(sys->d3dcaps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) {
+ if (!(sys->d3dctx.caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) {
msg_Err(vd, "Device does not support stretching from textures.");
return VLC_EGENERIC;
}
- if ( vd->fmt.i_width > sys->d3dcaps.MaxTextureWidth ||
- vd->fmt.i_height > sys->d3dcaps.MaxTextureHeight )
+ if ( vd->fmt.i_width > sys->d3dctx.caps.MaxTextureWidth ||
+ vd->fmt.i_height > sys->d3dctx.caps.MaxTextureHeight )
{
msg_Err(vd, "Textures too large %ux%u max possible: %ux%u",
vd->fmt.i_width, vd->fmt.i_height,
- (unsigned) sys->d3dcaps.MaxTextureWidth,
- (unsigned) sys->d3dcaps.MaxTextureHeight);
+ (unsigned) sys->d3dctx.caps.MaxTextureWidth,
+ (unsigned) sys->d3dctx.caps.MaxTextureHeight);
return VLC_EGENERIC;
}
@@ -796,16 +804,16 @@ static void Direct3D9Destroy(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);
- if (sys->hd3d9x_dll)
- FreeLibrary(sys->hd3d9x_dll);
+ if (sys->d3dctx.obj)
+ IDirect3D9_Release(sys->d3dctx.obj);
+ if (sys->d3dctx.hdll)
+ FreeLibrary(sys->d3dctx.hdll);
+ if (sys->d3dctx.hxdll)
+ FreeLibrary(sys->d3dctx.hxdll);
- sys->d3dobj = NULL;
- sys->hd3d9_dll = NULL;
- sys->hd3d9x_dll = NULL;
+ sys->d3dctx.obj = NULL;
+ sys->d3dctx.hdll = NULL;
+ sys->d3dctx.hxdll = NULL;
}
@@ -822,7 +830,7 @@ static int Direct3D9FillPresentationParameters(vout_display_t *vd)
** buffer of the same format
*/
D3DDISPLAYMODE d3ddm;
- HRESULT hr = IDirect3D9_GetAdapterDisplayMode(sys->d3dobj,
+ HRESULT hr = IDirect3D9_GetAdapterDisplayMode(sys->d3dctx.obj,
D3DADAPTER_DEFAULT, &d3ddm);
if (FAILED(hr)) {
msg_Err(vd, "Could not read adapter display mode. (hr=0x%0lx)", hr);
@@ -830,7 +838,7 @@ static int Direct3D9FillPresentationParameters(vout_display_t *vd)
}
/* Set up the structure used to create the D3DDevice. */
- D3DPRESENT_PARAMETERS *d3dpp = &vd->sys->d3dpp;
+ D3DPRESENT_PARAMETERS *d3dpp = &vd->sys->d3dctx.pp;
ZeroMemory(d3dpp, sizeof(D3DPRESENT_PARAMETERS));
d3dpp->Flags = D3DPRESENTFLAG_VIDEO;
d3dpp->Windowed = TRUE;
@@ -866,7 +874,6 @@ static void Direct3D9DestroyResources(vout_display_t *);
static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
{
vout_display_sys_t *sys = vd->sys;
- LPDIRECT3D9 d3dobj = sys->d3dobj;
if (Direct3D9FillPresentationParameters(vd))
return VLC_EGENERIC;
@@ -878,9 +885,9 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
#ifndef NDEBUG
// Look for 'NVIDIA PerfHUD' adapter
// If it is present, override default settings
- for (UINT Adapter=0; Adapter< IDirect3D9_GetAdapterCount(d3dobj); ++Adapter) {
+ for (UINT Adapter=0; Adapter< IDirect3D9_GetAdapterCount(sys->d3dctx.obj); ++Adapter) {
D3DADAPTER_IDENTIFIER9 Identifier;
- HRESULT Res = IDirect3D9_GetAdapterIdentifier(d3dobj,Adapter,0,&Identifier);
+ HRESULT Res = IDirect3D9_GetAdapterIdentifier(sys->d3dctx.obj,Adapter,0,&Identifier);
if (SUCCEEDED(Res) && strstr(Identifier.Description,"PerfHUD") != 0) {
AdapterToUse = Adapter;
DeviceType = D3DDEVTYPE_REF;
@@ -891,7 +898,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
/* */
D3DADAPTER_IDENTIFIER9 d3dai;
- if (FAILED(IDirect3D9_GetAdapterIdentifier(d3dobj,AdapterToUse,0, &d3dai))) {
+ if (FAILED(IDirect3D9_GetAdapterIdentifier(sys->d3dctx.obj, AdapterToUse,0, &d3dai))) {
msg_Warn(vd, "IDirect3D9_GetAdapterIdentifier failed");
} else {
msg_Dbg(vd, "Direct3d9 Device: %s %lu %lu %lu", d3dai.Description,
@@ -899,10 +906,10 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
}
DWORD creationFlags = D3DCREATE_MULTITHREADED;
- if ( (sys->d3dcaps.DevCaps & D3DDEVCAPS_DRAWPRIMTLVERTEX) &&
- (sys->d3dcaps.DevCaps & D3DDEVCAPS_HWRASTERIZATION) ) {
+ if ( (sys->d3dctx.caps.DevCaps & D3DDEVCAPS_DRAWPRIMTLVERTEX) &&
+ (sys->d3dctx.caps.DevCaps & D3DDEVCAPS_HWRASTERIZATION) ) {
creationFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;
- } else if (sys->d3dcaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
+ } else if (sys->d3dctx.caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) {
creationFlags |= D3DCREATE_MIXED_VERTEXPROCESSING;
} else {
creationFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
@@ -910,20 +917,16 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
// Create the D3DDevice
HRESULT hr;
- if (sys->use_d3d9ex) {
- LPDIRECT3DDEVICE9EX d3ddevex;
- hr = IDirect3D9Ex_CreateDeviceEx((LPDIRECT3D9EX)d3dobj, AdapterToUse,
+ if (sys->d3dctx.use_ex) {
+ hr = IDirect3D9Ex_CreateDeviceEx(sys->d3dctx.objex, AdapterToUse,
DeviceType, sys->sys.hvideownd,
creationFlags,
- &sys->d3dpp, NULL, &d3ddevex);
- sys->d3ddev = (LPDIRECT3DDEVICE9)d3ddevex;
+ &sys->d3dctx.pp, NULL, &sys->d3dctx.devex);
} else {
- LPDIRECT3DDEVICE9 d3ddev;
- hr = IDirect3D9_CreateDevice(d3dobj, AdapterToUse,
+ hr = IDirect3D9_CreateDevice(sys->d3dctx.obj, AdapterToUse,
DeviceType, sys->sys.hvideownd,
creationFlags,
- &sys->d3dpp, &d3ddev);
- sys->d3ddev = d3ddev;
+ &sys->d3dctx.pp, &sys->d3dctx.dev);
}
/* */
@@ -932,7 +935,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
/* Find the appropriate D3DFORMAT for the render chroma, the format will be the closest to
* the requested chroma which is usable by the hardware in an offscreen surface, as they
* typically support more formats than textures */
- const d3d_format_t *d3dfmt = Direct3DFindFormat(vd, fmt->i_chroma, sys->d3dpp.BackBufferFormat);
+ const d3d_format_t *d3dfmt = Direct3DFindFormat(vd, fmt->i_chroma, sys->d3dctx.pp.BackBufferFormat);
if (!d3dfmt) {
msg_Err(vd, "surface pixel format is not supported.");
return VLC_EGENERIC;
@@ -971,10 +974,10 @@ static void Direct3D9Close(vout_display_t *vd)
Direct3D9DestroyResources(vd);
- if (sys->d3ddev)
- IDirect3DDevice9_Release(sys->d3ddev);
+ if (sys->d3dctx.dev)
+ IDirect3DDevice9_Release(sys->d3dctx.dev);
- sys->d3ddev = NULL;
+ sys->d3dctx.dev = NULL;
}
/**
@@ -992,12 +995,10 @@ static int Direct3D9Reset(vout_display_t *vd)
/* */
HRESULT hr;
- if (sys->use_d3d9ex){
- LPDIRECT3DDEVICE9EX d3ddev = (LPDIRECT3DDEVICE9EX)sys->d3ddev;
- hr = IDirect3DDevice9Ex_ResetEx(d3ddev, &sys->d3dpp, NULL);
+ if (sys->d3dctx.use_ex){
+ hr = IDirect3DDevice9Ex_ResetEx(sys->d3dctx.devex, &sys->d3dctx.pp, NULL);
} else {
- LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
- hr = IDirect3DDevice9_Reset(d3ddev, &sys->d3dpp);
+ hr = IDirect3DDevice9_Reset(sys->d3dctx.dev, &sys->d3dctx.pp);
}
if (FAILED(hr)) {
msg_Err(vd, "IDirect3DDevice9_Reset failed! (hr=0x%0lx)", hr);
@@ -1040,10 +1041,10 @@ static int Direct3D9CreateResources(vout_display_t *vd, video_format_t *fmt)
sys->d3dregion_format = D3DFMT_UNKNOWN;
for (int i = 0; i < 2; i++) {
D3DFORMAT fmt = i == 0 ? D3DFMT_A8B8G8R8 : D3DFMT_A8R8G8B8;
- if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(sys->d3dobj,
+ if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(sys->d3dctx.obj,
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
- sys->d3dpp.BackBufferFormat,
+ sys->d3dctx.pp.BackBufferFormat,
D3DUSAGE_DYNAMIC,
D3DRTYPE_TEXTURE,
fmt))) {
@@ -1074,7 +1075,7 @@ static int Direct3D9CheckConversion(vout_display_t *vd,
D3DFORMAT src, D3DFORMAT dst)
{
vout_display_sys_t *sys = vd->sys;
- LPDIRECT3D9 d3dobj = sys->d3dobj;
+ LPDIRECT3D9 d3dobj = sys->d3dctx.obj;
HRESULT hr;
/* test whether device can create a surface of that format */
@@ -1165,7 +1166,7 @@ static const d3d_format_t *Direct3DFindFormat(vout_display_t *vd, vlc_fourcc_t c
static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
{
vout_display_sys_t *sys = vd->sys;
- LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
+ LPDIRECT3DDEVICE9 d3ddev = sys->d3dctx.dev;
HRESULT hr;
/*
@@ -1179,7 +1180,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
fmt->i_height,
1,
D3DUSAGE_RENDERTARGET,
- sys->d3dpp.BackBufferFormat,
+ sys->d3dctx.pp.BackBufferFormat,
D3DPOOL_DEFAULT,
&d3dtex,
NULL);
@@ -1225,14 +1226,14 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
// Set linear filtering quality
- if (sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
+ if (sys->d3dctx.caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFLINEAR) {
//msg_Dbg(vd, "Using D3DTEXF_LINEAR for minification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
} else {
//msg_Dbg(vd, "Using D3DTEXF_POINT for minification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
}
- if (sys->d3dcaps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) {
+ if (sys->d3dctx.caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFLINEAR) {
//msg_Dbg(vd, "Using D3DTEXF_LINEAR for magnification");
IDirect3DDevice9_SetSamplerState(d3ddev, 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
} else {
@@ -1263,7 +1264,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
- if (sys->d3dcaps.AlphaCmpCaps & D3DPCMPCAPS_GREATER) {
+ if (sys->d3dctx.caps.AlphaCmpCaps & D3DPCMPCAPS_GREATER) {
IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHATESTENABLE,TRUE);
IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHAREF, 0x00);
IDirect3DDevice9_SetRenderState(d3ddev, D3DRS_ALPHAFUNC,D3DCMP_GREATER);
@@ -1325,7 +1326,7 @@ static int Direct3D9CompileShader(vout_display_t *vd, const char *shader_source,
LPD3DXBUFFER *ppErrorMsgs,
LPD3DXCONSTANTTABLE *ppConstantTable);
- OurD3DXCompileShader = (void*)GetProcAddress(sys->hd3d9x_dll, "D3DXCompileShader");
+ OurD3DXCompileShader = (void*)GetProcAddress(sys->d3dctx.hxdll, "D3DXCompileShader");
if (!OurD3DXCompileShader) {
msg_Warn(vd, "Cannot locate reference to D3DXCompileShader; pixel shading will be disabled");
return VLC_EGENERIC;
@@ -1347,7 +1348,7 @@ static int Direct3D9CompileShader(vout_display_t *vd, const char *shader_source,
return VLC_EGENERIC;
}
- hr = IDirect3DDevice9_CreatePixelShader(sys->d3ddev,
+ hr = IDirect3DDevice9_CreatePixelShader(sys->d3dctx.dev,
ID3DXBuffer_GetBufferPointer(compiled_shader),
&sys->d3dx_shader);
@@ -1372,7 +1373,7 @@ static int Direct3D9CreateShaders(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
- if (!sys->hd3d9x_dll)
+ if (!sys->d3dctx.hxdll)
return VLC_EGENERIC;
/* Find which shader was selected in the list. */
@@ -1607,7 +1608,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
if ( copy_rect.left & 1 ) copy_rect.left--;
if ( copy_rect.bottom & 1 ) copy_rect.bottom++;
if ( copy_rect.top & 1 ) copy_rect.top--;
- hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, ©_rect, destination,
+ hr = IDirect3DDevice9_StretchRect(sys->d3dctx.dev, source, ©_rect, destination,
©_rect, D3DTEXF_NONE);
IDirect3DSurface9_Release(destination);
if (FAILED(hr)) {
@@ -1670,7 +1671,7 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
d3dr->format = sys->d3dregion_format;
d3dr->width = r->fmt.i_width;
d3dr->height = r->fmt.i_height;
- hr = IDirect3DDevice9_CreateTexture(sys->d3ddev,
+ hr = IDirect3DDevice9_CreateTexture(sys->d3dctx.dev,
d3dr->width, d3dr->height,
1,
D3DUSAGE_DYNAMIC,
@@ -1759,7 +1760,7 @@ static int Direct3D9RenderRegion(vout_display_t *vd,
{
vout_display_sys_t *sys = vd->sys;
- LPDIRECT3DDEVICE9 d3ddev = vd->sys->d3ddev;
+ LPDIRECT3DDEVICE9 d3ddev = vd->sys->d3dctx.dev;
LPDIRECT3DVERTEXBUFFER9 d3dvtc = sys->d3dvtc;
LPDIRECT3DTEXTURE9 d3dtex = region->texture;
@@ -1844,7 +1845,7 @@ static void Direct3D9RenderScene(vout_display_t *vd,
d3d_region_t *subpicture)
{
vout_display_sys_t *sys = vd->sys;
- LPDIRECT3DDEVICE9 d3ddev = sys->d3ddev;
+ LPDIRECT3DDEVICE9 d3ddev = sys->d3dctx.dev;
HRESULT hr;
if (sys->clear_scene) {
More information about the vlc-commits
mailing list