1#define _WIN32_WINNT 0x500
10#include "libmythbase/mythconfig.h"
14#ifndef DXVA2_E_NEW_VIDEO_DEVICE
15#define DXVA2_E_NEW_VIDEO_DEVICE MAKE_HRESULT(1, 4, 4097)
41 : m_size(size), m_render(render)
129#define mD3DFMT_YV12 (D3DFORMAT)MAKEFOURCC('Y','V','1','2')
130#define mD3DFMT_IYUV (D3DFORMAT)MAKEFOURCC('I','Y','U','V')
131#define mD3DFMT_I420 (D3DFORMAT)MAKEFOURCC('I','4','2','0')
132#define mD3DFMT_YV16 (D3DFORMAT)MAKEFOURCC('Y','V','1','6')
133#define D3DFVF_TEXTUREVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1|D3DFVF_TEX2)
134#define D3DFVF_VERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
135#define D3DLOC QString("MythRenderD3D9: ")
145 IDirect3DDevice9* result =
nullptr;
149 LOG(VB_GENERAL, LOG_ERR,
"D3D9Locker: Failed to acquire device.");
155 return (
void *)QLibrary::resolve(lib, proc);
160 QMutexLocker locker(&
m_lock);
162 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +
"Deleting D3D9 resources.");
179 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +
"Deleting D3D9 device.");
185 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +
"Deleting D3D9.");
196 case D3DFMT_A8R8G8B8:
198 case D3DFMT_X8R8G8B8:
200 case D3DFMT_A8B8G8R8:
202 case D3DFMT_X8B8G8R8:
219 return QString().setNum((ulong)fmt,16);
224 QMutexLocker locker(&
m_lock);
226 using LPFND3DC = LPDIRECT3D9 (WINAPI *)(UINT SDKVersion);
227 static LPFND3DC OurDirect3DCreate9 =
nullptr;
229 OurDirect3DCreate9 = (LPFND3DC)
ResolveAddress(
"D3D9",
"Direct3DCreate9");
230 if (!OurDirect3DCreate9)
233 "FATAL: Failed to find Direct3DCreate9.");
237 m_d3d = OurDirect3DCreate9(D3D_SDK_VERSION);
241 "Could not create Direct3D9 instance.");
246 ZeroMemory(&d3dCaps,
sizeof(d3dCaps));
247 if (D3D_OK !=
m_d3d->GetDeviceCaps(
248 D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))
251 "Could not read adapter capabilities.");
254 D3DDISPLAYMODE d3ddm;
255 if (D3D_OK !=
m_d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm))
258 "Could not read adapter display mode.");
263 static const D3DFORMAT bfmt[] =
273 bool is_reasonable =
false;
274 for (
uint i = 0; i <
sizeof(bfmt) /
sizeof(bfmt[0]); i++)
276 is_reasonable =
true;
277 LOG(VB_GENERAL, LOG_INFO,
D3DLOC + QString(
"Default adaptor format %1.")
282 "Warning: Default adaptor format may not work.");
286 for (
unsigned i = 0; i <
sizeof bfmt /
sizeof bfmt[0]; ++i)
288 if (SUCCEEDED(
m_d3d->CheckDeviceType(D3DADAPTER_DEFAULT,
298 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to choose surface format - "
299 "using default back buffer format.");
305 QString(
"Chosen surface and texture format: %1")
310 if (
FAILED(
m_d3d->CheckDeviceFormatConversion(D3DADAPTER_DEFAULT,
312 SUCCEEDED(
m_d3d->CheckDeviceFormatConversion(D3DADAPTER_DEFAULT,
323 QString(
"Chosen video surface format %1.")
326 QString(
"Hardware YV12 to RGB conversion %1.")
328 "unavailable" :
"available"));
330 D3DPRESENT_PARAMETERS d3dpp;
331 ZeroMemory(&d3dpp,
sizeof(D3DPRESENT_PARAMETERS));
333 d3dpp.hDeviceWindow = window;
334 d3dpp.Windowed =
true;
335 d3dpp.BackBufferWidth = size.width();
336 d3dpp.BackBufferHeight = size.height();
337 d3dpp.BackBufferCount = 1;
338 d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
339 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
340 d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
341 d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
343 if (D3D_OK !=
m_d3d->CreateDevice(D3DADAPTER_DEFAULT,
344 D3DDEVTYPE_HAL, d3dpp.hDeviceWindow,
345 D3DCREATE_SOFTWARE_VERTEXPROCESSING |
346 D3DCREATE_MULTITHREADED,
349 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Could not create the D3D device.");
353 static bool debugged =
false;
357 D3DADAPTER_IDENTIFIER9 ident;
358 if (D3D_OK ==
m_d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &ident))
360 LOG(VB_GENERAL, LOG_INFO,
D3DLOC + QString(
"Device: %1")
361 .arg(ident.Description));
362 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +QString(
"Driver: %1.%2.%3.%4")
363 .arg(HIWORD(ident.DriverVersion.HighPart))
364 .arg(LOWORD(ident.DriverVersion.HighPart))
365 .arg(HIWORD(ident.DriverVersion.LowPart))
366 .arg(LOWORD(ident.DriverVersion.LowPart)));
383 IDirect3DDevice9* dev = locker.
Acquire();
388 HRESULT hr = dev->TestCooperativeLevel();
393 case D3DERR_DEVICENOTRESET:
395 "The device was lost and needs to be reset.");
400 case D3DERR_DEVICELOST:
402 "The device has been lost and cannot be reset "
407 case D3DERR_DRIVERINTERNALERROR:
409 "Internal driver error. "
410 "Please shut down the application.");
416 "TestCooperativeLevel() failed.");
426 IDirect3DDevice9* dev = locker.
Acquire();
430 HRESULT hr = dev->Clear(0,
nullptr, D3DCLEAR_TARGET,
431 D3DCOLOR_ARGB(0, 0, 0, 0), 1.0F, 0);
434 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Clear() failed.");
443 IDirect3DDevice9* dev = locker.
Acquire();
447 HRESULT hr = dev->BeginScene();
450 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"BeginScene() failed.");
459 IDirect3DDevice9* dev = locker.
Acquire();
463 HRESULT hr = dev->EndScene();
466 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"EndScene() failed.");
479 IDirect3DSurface9 *surface,
483 (known_surface && !
m_surfaces.contains(surface)))
487 IDirect3DDevice9* dev = locker.
Acquire();
491 LPDIRECT3DSURFACE9 d3ddest;
492 HRESULT hr = texture->GetSurfaceLevel(0, &d3ddest);
495 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"GetSurfaceLevel() failed");
499 hr = dev->StretchRect(surface,
nullptr, d3ddest,
500 nullptr, D3DTEXF_POINT);
504 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"StretchRect() failed");
516 IDirect3DDevice9* dev = locker.
Acquire();
529 HRESULT hr = dev->SetStreamSource(0, vertexbuffer,
533 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"SetStreamSource() failed");
537 hr = dev->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
540 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"DrawPrimitive() failed");
550 IDirect3DDevice9* dev = locker.
Acquire();
556 HRESULT hr = dev->CreateVertexBuffer(
557 sizeof(
VERTEX)*4, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
563 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to create vertex buffer");
573 int alphamod = (int)(color.alpha() * (alpha / 255.0));
574 D3DCOLOR clr = D3DCOLOR_ARGB(alphamod, color.red(),
575 color.green(), color.blue());
581 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to lock vertex buffer.");
585 p_vertices[0].
x = (float)rect.left();
586 p_vertices[0].
y = (float)rect.top();
587 p_vertices[0].
z = 0.0F;
589 p_vertices[0].
rhw = 1.0F;
590 p_vertices[1].
x = (float)(rect.left() + rect.width());
591 p_vertices[1].
y = (float)rect.top();
592 p_vertices[1].
z = 0.0F;
594 p_vertices[1].
rhw = 1.0F;
595 p_vertices[2].
x = (float)(rect.left() + rect.width());
596 p_vertices[2].
y = (float)(rect.top() + rect.height());
597 p_vertices[2].
z = 0.0F;
599 p_vertices[2].
rhw = 1.0F;
600 p_vertices[3].
x = (float)rect.left();
601 p_vertices[3].
y = (float)(rect.top() + rect.height());
602 p_vertices[3].
z = 0.0F;
604 p_vertices[3].
rhw = 1.0F;
609 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to unlock vertex buffer");
617 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"SetStreamSource() failed");
621 hr = dev->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
624 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"DrawPrimitive() failed");
630 IDirect3DTexture9 *texture)
641 dev->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG2);
642 dev->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
643 dev->SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
644 dev->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
645 dev->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
646 dev->SetTextureStageState(1, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
647 dev->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE);
648 dev->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
652 dev->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
653 dev->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
654 dev->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
655 dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
656 dev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
657 dev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
658 dev->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
659 dev->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
668 IDirect3DDevice9* dev = locker.
Acquire();
672 HRESULT hr = dev->Present(
nullptr,
nullptr, win,
nullptr);
675 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Present() failed)");
678 SetThreadExecutionState(ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED);
692 IDirect3DDevice9* dev = locker.
Acquire();
706 "Failed to get default surface.");
711 IDirect3DSurface9 *new_surface =
nullptr;
712 hr = texture->GetSurfaceLevel(0, &new_surface);
714 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to get surface level.");
723 "Failed to set render target.");
733 "Failed to set render target.");
737 "No default surface for render target.");
745 IDirect3DTexture9 *texture,
int num)
750 HRESULT hr = dev->SetTexture(num, (LPDIRECT3DBASETEXTURE9)texture);
753 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"SetTexture() failed");
762 IDirect3DDevice9* dev = locker.
Acquire();
766 IDirect3DTexture9* temp_texture =
nullptr;
768 HRESULT hr = dev->CreateTexture(
769 size.width(), size.height(), 1, D3DUSAGE_RENDERTARGET,
772 if (
FAILED(hr) || !temp_texture)
774 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to create texture.");
784 QMap<IDirect3DTexture9*,QSize>::iterator it;
792 QMutexLocker locker(&
m_lock);
803 IDirect3DDevice9* dev = locker.
Acquire();
807 IDirect3DSurface9* temp_surface =
nullptr;
811 HRESULT hr = dev->CreateOffscreenPlainSurface(
812 size.width(), size.height(), format,
813 D3DPOOL_DEFAULT, &temp_surface,
nullptr);
815 if (
FAILED(hr)|| !temp_surface)
817 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to create surface.");
822 dev->ColorFill(temp_surface,
nullptr, D3DCOLOR_ARGB(0xFF, 0, 0, 0) );
830 if (!surface || !image || !
m_surfaces.contains(surface))
834 m_surfaces[surface].m_size.height() != image->height())
837 "Frame size does not equal surface size.");
842 uint8_t *buf =
GetBuffer(surface, d3dpitch);
844 if (!(buf && d3dpitch))
850 case D3DFMT_A8R8G8B8:
851 case D3DFMT_X8R8G8B8:
853 uint pitch = image->width() << 2;
855 uint8_t *src = (uint8_t*)image->bits();
856 for (
int i = 0; i < image->height(); i++)
858 memcpy(dst, src, pitch);
865 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Surface format not supported.");
875 QMap<IDirect3DSurface9*, MythD3DSurface>::iterator it;
883 QMutexLocker locker(&
m_lock);
897 D3DLOCKED_RECT d3drect;
898 HRESULT hr = surface->LockRect(&d3drect,
nullptr, 0);
902 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to lock picture surface.");
907 pitch = d3drect.Pitch;
908 return (uint8_t*)d3drect.pBits;
916 HRESULT hr = surface->UnlockRect();
918 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to unlock picture surface.");
925 IDirect3DDevice9* dev = locker.
Acquire();
932 IDirect3DVertexBuffer9* temp_vbuf =
nullptr;
933 HRESULT hr = dev->CreateVertexBuffer(
934 sizeof(
TEXTUREVERTEX)*4, D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
936 &temp_vbuf,
nullptr);
940 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to create vertex buffer");
950 QMap<IDirect3DVertexBuffer9*,MythD3DVertexBuffer>::iterator it;
961 QMutexLocker locker(&
m_lock);
964 vertexbuffer->Release();
970 const QRect &dst,
const QRect &src,
971 int alpha,
bool video)
977 uint32_t clr = (alpha << 24) + (255 << 16) + (255 << 8) + 255;
979 int width = dst.width();
980 int height = dst.height();
983 width = std::min(src.width(), width);
984 height = std::min(src.height(), height);
986 QRect
dest(dst.left(), dst.top(), width, height);
990 src == mythvb.
m_src &&
994 QSize norm = src.size();
998 QMutexLocker locker(&
m_lock);
1000 HRESULT hr = vertexbuffer->Lock(0, 0, (VOID **)(&p_vertices),
1002 D3DCOLOR color = D3DCOLOR_ARGB(alpha, 255, 255, 255);
1005 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to lock vertex buffer.");
1009 p_vertices[0].
x = (float)
dest.left();
1010 p_vertices[0].
y = (float)
dest.top();
1011 p_vertices[0].
z = 0.0F;
1012 p_vertices[0].
diffuse = color;
1013 p_vertices[0].
rhw = 1.0F;
1014 p_vertices[0].
t1u = ((float)src.left() - 0.5F) / (
float)norm.width();
1015 p_vertices[0].
t1v = ((float)src.top() - 0.5F) / (
float)norm.height();
1017 p_vertices[1].
x = (float)(
dest.left() +
dest.width());
1018 p_vertices[1].
y = (float)
dest.top();
1019 p_vertices[1].
z = 0.0F;
1020 p_vertices[1].
diffuse = color;
1021 p_vertices[1].
rhw = 1.0F;
1022 p_vertices[1].
t1u = ((float)(src.left() + src.width()) - 0.5F) /
1023 (float)norm.width();
1024 p_vertices[1].
t1v = ((float)src.top() - 0.5F) / (
float)norm.height();
1026 p_vertices[2].
x = (float)(
dest.left() +
dest.width());
1027 p_vertices[2].
y = (float)(
dest.top() +
dest.height());
1028 p_vertices[2].
z = 0.0F;
1029 p_vertices[2].
diffuse = color;
1030 p_vertices[2].
rhw = 1.0F;
1031 p_vertices[2].
t1u = ((float)(src.left() + src.width()) - 0.5F) /
1032 (float)norm.width();
1033 p_vertices[2].
t1v = ((float)(src.top() + src.height()) - 0.5F) /
1034 (float)norm.height();
1036 p_vertices[3].
x = (float)
dest.left();
1037 p_vertices[3].
y = (float)(
dest.top() +
dest.height());
1038 p_vertices[3].
z = 0.0F;
1039 p_vertices[3].
diffuse = color;
1040 p_vertices[3].
rhw = 1.0F;
1041 p_vertices[3].
t1u = ((float)src.left() - 0.5F) / (
float)norm.width();
1042 p_vertices[3].
t1v = ((float)(src.top() + src.height()) - 0.5F) /
1043 (float)norm.height();
1045 p_vertices[0].
t2u = p_vertices[0].
t1u;
1046 p_vertices[0].
t2v = p_vertices[0].
t1v;
1047 p_vertices[1].
t2u = p_vertices[1].
t1u;
1048 p_vertices[1].
t2v = p_vertices[1].
t1v;
1049 p_vertices[2].
t2u = p_vertices[2].
t1u;
1050 p_vertices[2].
t2v = p_vertices[2].
t1v;
1051 p_vertices[3].
t2u = p_vertices[3].
t1u;
1052 p_vertices[3].
t2v = p_vertices[3].
t1v;
1054 hr = vertexbuffer->Unlock();
1057 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to unlock vertex buffer");
1073 dev->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
1074 dev->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
1075 dev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
1076 dev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
1077 dev->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
1078 dev->SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
1079 dev->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
1080 dev->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
1081 dev->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(255,255,255));
1082 dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
1083 dev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
1084 dev->SetRenderState(D3DRS_LIGHTING, FALSE);
1085 dev->SetRenderState(D3DRS_DITHERENABLE, TRUE);
1086 dev->SetRenderState(D3DRS_STENCILENABLE, FALSE);
1087 dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
1088 dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
1089 dev->SetVertexShader(
nullptr);
1104 dev->SetRenderState(D3DRS_ALPHABLENDENABLE, enable);
1123 IDirect3DDevice9* result =
nullptr;
1141 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to acquire D3D9 device.");
1156 LOG(VB_GENERAL, LOG_ERR,
D3DLOC +
"Failed to release D3D9 device.");
1163using CreateDeviceManager9Ptr = HRESULT (WINAPI *)(UINT *pResetToken,
1170 CreateDeviceManager9Ptr CreateDeviceManager9 =
1172 "DXVA2CreateDirect3DDeviceManager9");
1173 if (CreateDeviceManager9)
1175 UINT resetToken = 0;
1182 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +
"Created DXVA2 device manager.");
1186 LOG(VB_GENERAL, LOG_INFO,
D3DLOC +
"Retrieved device handle.");
1190 "Failed to retrieve device handle.");
1195 "Failed to create DXVA2 device manager.");
1201 "Failed to get DXVA2CreateDirect3DDeviceManager9 proc address.");
1207 "DXVA2 support not available - not using device manager");
uint8_t * GetBuffer(bool &hardware_conv, uint &pitch)
IDirect3DSurface9 * m_surface
bool UpdateImage(IDirect3DSurface9 *surface)
bool UpdateVertices(const QRect &dvr, const QRect &vr, int alpha=255, bool video=false)
IDirect3DTexture9 * m_texture
MythRenderD3D9 * m_render
bool SetAsRenderTarget(void)
D3D9Image(MythRenderD3D9 *render, QSize size, bool video=false)
IDirect3DVertexBuffer9 * m_vertexbuffer
MythRenderD3D9 * m_render
IDirect3DDevice9 * Acquire(void)
IDirect3DTexture9 * m_texture
IDirect3DSurface9 * m_current_surface
D3DFORMAT m_videosurface_fmt
void DrawRect(const QRect &rect, const QColor &color, int alpha)
bool SetRenderTarget(IDirect3DTexture9 *texture)
QMap< IDirect3DSurface9 *, MythD3DSurface > m_surfaces
QMap< IDirect3DTexture9 *, QSize > m_textures
void MultiTexturing(IDirect3DDevice9 *dev, bool enable, IDirect3DTexture9 *texture=nullptr)
virtual ~MythRenderD3D9()
void CreateDeviceManager(void)
QMap< IDirect3DVertexBuffer9 *, MythD3DVertexBuffer > m_vertexbuffers
void DeleteTextures(void)
bool HardwareYUVConversion(void)
bool SetTexture(IDirect3DDevice9 *dev, IDirect3DTexture9 *texture, int num=0)
IDirect3DTexture9 * CreateTexture(const QSize &size)
bool DrawTexturedQuad(IDirect3DVertexBuffer9 *vertexbuffer)
IDirect3DDevice9 * m_rootD3DDevice
void DeleteSurface(IDirect3DSurface9 *surface)
void CopyFrame(void *surface, D3D9Image *img)
static void * ResolveAddress(const char *lib, const char *proc)
uint m_deviceManagerToken
void DeleteVertexBuffers(void)
void DeleteTexture(IDirect3DTexture9 *texture)
bool UpdateVertexBuffer(IDirect3DVertexBuffer9 *vertexbuffer, const QRect &dvr, const QRect &vr, int alpha=255, bool video=false)
bool StretchRect(IDirect3DTexture9 *texture, IDirect3DSurface9 *surface, bool known_surface=true)
void DeleteVertexBuffer(IDirect3DVertexBuffer9 *vertexbuffer)
IDirect3DDeviceManager9 * m_deviceManager
IDirect3DVertexBuffer9 * m_rect_vertexbuffer
QRect GetRect(IDirect3DVertexBuffer9 *vertexbuffer)
void ReleaseBuffer(IDirect3DSurface9 *surface)
void DeleteSurfaces(void)
void DestroyDeviceManager(void)
IDirect3DSurface9 * m_default_surface
bool Create(QSize size, HWND window)
IDirect3DDevice9 * AcquireDevice(void)
IDirect3DSurface9 * CreateSurface(const QSize &size, bool video=false)
void SetTextureVertices(IDirect3DDevice9 *dev, bool enable)
IDirect3DVertexBuffer9 * CreateVertexBuffer(IDirect3DTexture9 *texture=nullptr)
uint8_t * GetBuffer(IDirect3DSurface9 *surface, uint &pitch)
bool UpdateSurface(IDirect3DSurface9 *surface, const MythImage *image)
void EnableBlending(IDirect3DDevice9 *dev, bool enable)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
#define D3DFVF_TEXTUREVERTEX
#define DXVA2_E_NEW_VIDEO_DEVICE
static const QString toString(D3DFORMAT fmt)
void * IDirect3DDeviceManager9