Commit d353ab78 authored by Jason Green's avatar Jason Green Committed by Alexandre Julliard

wined3d: Start checking for D3DUSAGE_QUERY_* items, improve traces.

parent dc743d82
...@@ -616,7 +616,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) { ...@@ -616,7 +616,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) {
return; return;
} }
TRACE("Creating an OpenGL vertex buffer object for IWineD3DVertexBuffer %p\n", object); TRACE("Creating an OpenGL vertex buffer object for IWineD3DVertexBuffer %p Usage(%s)\n", object, debug_d3dusage(vboUsage));
ENTER_GL(); ENTER_GL();
/* Make sure that the gl error is cleared. Do not use checkGLcall /* Make sure that the gl error is cleared. Do not use checkGLcall
...@@ -667,7 +667,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) { ...@@ -667,7 +667,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) {
glUsage = GL_STREAM_DRAW_ARB; glUsage = GL_STREAM_DRAW_ARB;
break; break;
case D3DUSAGE_WRITEONLY: case D3DUSAGE_WRITEONLY:
TRACE("Gl usage = GL_STATIC_DRAW\n"); TRACE("Gl usage = GL_DYNAMIC_DRAW\n");
glUsage = GL_DYNAMIC_DRAW_ARB; glUsage = GL_DYNAMIC_DRAW_ARB;
break; break;
case D3DUSAGE_DYNAMIC: case D3DUSAGE_DYNAMIC:
...@@ -675,7 +675,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) { ...@@ -675,7 +675,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) {
glUsage = GL_STREAM_COPY_ARB; glUsage = GL_STREAM_COPY_ARB;
break; break;
default: default:
TRACE("Gl usage = GL_STATIC_COPY\n"); TRACE("Gl usage = GL_DYNAMIC_COPY\n");
glUsage = GL_DYNAMIC_COPY_ARB; glUsage = GL_DYNAMIC_COPY_ARB;
break; break;
} }
......
...@@ -1429,12 +1429,12 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter ...@@ -1429,12 +1429,12 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType,
WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) { WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface; IWineD3DImpl *This = (IWineD3DImpl *)iface;
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ", TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
This, This,
Adapter, Adapter,
DeviceType, debug_d3ddevicetype(DeviceType), DeviceType, debug_d3ddevicetype(DeviceType),
AdapterFormat, debug_d3dformat(AdapterFormat), AdapterFormat, debug_d3dformat(AdapterFormat),
Usage, debug_d3dusage(Usage), Usage, debug_d3dusage(Usage), debug_d3dusagequery(Usage),
RType, debug_d3dresourcetype(RType), RType, debug_d3dresourcetype(RType),
CheckFormat, debug_d3dformat(CheckFormat)); CheckFormat, debug_d3dformat(CheckFormat));
...@@ -1442,6 +1442,14 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -1442,6 +1442,14 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
/* TODO: Check support against more of the WINED3DUSAGE_QUERY_* constants
* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/IDirect3D9__CheckDeviceFormat.asp
* and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/D3DUSAGE_QUERY.asp */
if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) {
TRACE_(d3d_caps)("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE; /* Enable when fully supported */
}
if(Usage & WINED3DUSAGE_DEPTHSTENCIL) { if(Usage & WINED3DUSAGE_DEPTHSTENCIL) {
switch (CheckFormat) { switch (CheckFormat) {
case WINED3DFMT_D16_LOCKABLE: case WINED3DFMT_D16_LOCKABLE:
...@@ -1455,7 +1463,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -1455,7 +1463,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
case WINED3DFMT_D32F_LOCKABLE: case WINED3DFMT_D32F_LOCKABLE:
case WINED3DFMT_D24FS8: case WINED3DFMT_D24FS8:
TRACE_(d3d_caps)("[OK]\n"); TRACE_(d3d_caps)("[OK]\n");
return D3D_OK; return WINED3D_OK;
default: default:
TRACE_(d3d_caps)("[FAILED]\n"); TRACE_(d3d_caps)("[FAILED]\n");
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
...@@ -1579,7 +1587,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -1579,7 +1587,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
case WINED3DFMT_INDEX32: case WINED3DFMT_INDEX32:
case WINED3DFMT_Q16W16V16U16: case WINED3DFMT_Q16W16V16U16:
TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */ TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
return D3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
/***** /*****
* Float formats: Not supported right now * Float formats: Not supported right now
...@@ -1592,20 +1600,20 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt ...@@ -1592,20 +1600,20 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt
case WINED3DFMT_A32B32G32R32F: case WINED3DFMT_A32B32G32R32F:
case WINED3DFMT_CxV8U8: case WINED3DFMT_CxV8U8:
TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */ TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
return D3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
/* Not supported */ /* Not supported */
case WINED3DFMT_G16R16: case WINED3DFMT_G16R16:
case WINED3DFMT_A16B16G16R16: case WINED3DFMT_A16B16G16R16:
TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */ TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
return D3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
default: default:
break; break;
} }
TRACE_(d3d_caps)("[FAILED]\n"); TRACE_(d3d_caps)("[FAILED]\n");
return D3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType,
......
...@@ -762,7 +762,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED ...@@ -762,7 +762,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
} else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */ } else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
if (!messages & 1) { if (!messages & 1) {
FIXME("TODO stencil depth surface locking surf%p usage(%lu)\n", This, This->resource.usage); FIXME("TODO stencil depth surface locking surf%p usage(%s)\n", This, debug_d3dusage(This->resource.usage));
/* /*
glReadPixels(This->lockedRect.left, glReadPixels(This->lockedRect.left,
...@@ -776,7 +776,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED ...@@ -776,7 +776,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
messages |= 1; messages |= 1;
} }
} else { } else {
FIXME("unsupported locking to surface surf@%p usage(%lu)\n", This, This->resource.usage); FIXME("unsupported locking to surface surf@%p usage(%s)\n", This, debug_d3dusage(This->resource.usage));
} }
if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) { if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) {
...@@ -1197,9 +1197,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { ...@@ -1197,9 +1197,9 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
} else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */ } else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
if (iface == myDevice->depthStencilBuffer) { if (iface == myDevice->depthStencilBuffer) {
FIXME("TODO stencil depth surface unlocking surf@%p usage(%lu)\n", This, This->resource.usage); FIXME("TODO stencil depth surface unlocking surf@%p usage(%s)\n", This, debug_d3dusage(This->resource.usage));
} else { } else {
FIXME("unsupported unlocking to StencilDepth surface surf@%p usage(%lu)\n", This, This->resource.usage); FIXME("unsupported unlocking to StencilDepth surface surf@%p usage(%s)\n", This, debug_d3dusage(This->resource.usage));
} }
} else { } else {
...@@ -2766,7 +2766,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, RECT *Dest ...@@ -2766,7 +2766,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, RECT *Dest
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface; IWineD3DSurfaceImpl *Src = (IWineD3DSurfaceImpl *) SrcSurface;
TRACE("(%p)->(%p,%p,%p,%lx,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx); TRACE("(%p)->(%p,%p,%p,%lx,%p)\n", This, DestRect, SrcSurface, SrcRect, Flags, DDBltFx);
TRACE("(%p): Usage is %08lx\n", This, This->resource.usage); TRACE("(%p): Usage is %s\n", This, debug_d3dusage(This->resource.usage));
/* Special cases for RenderTargets */ /* Special cases for RenderTargets */
if( (This->resource.usage & WINED3DUSAGE_RENDERTARGET) || if( (This->resource.usage & WINED3DUSAGE_RENDERTARGET) ||
......
...@@ -230,7 +230,7 @@ const char* debug_d3ddevicetype(D3DDEVTYPE devtype) { ...@@ -230,7 +230,7 @@ const char* debug_d3ddevicetype(D3DDEVTYPE devtype) {
} }
const char* debug_d3dusage(DWORD usage) { const char* debug_d3dusage(DWORD usage) {
switch (usage) { switch (usage & WINED3DUSAGE_MASK) {
#define WINED3DUSAGE_TO_STR(u) case u: return #u #define WINED3DUSAGE_TO_STR(u) case u: return #u
WINED3DUSAGE_TO_STR(WINED3DUSAGE_RENDERTARGET); WINED3DUSAGE_TO_STR(WINED3DUSAGE_RENDERTARGET);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DEPTHSTENCIL); WINED3DUSAGE_TO_STR(WINED3DUSAGE_DEPTHSTENCIL);
...@@ -241,6 +241,8 @@ const char* debug_d3dusage(DWORD usage) { ...@@ -241,6 +241,8 @@ const char* debug_d3dusage(DWORD usage) {
WINED3DUSAGE_TO_STR(WINED3DUSAGE_RTPATCHES); WINED3DUSAGE_TO_STR(WINED3DUSAGE_RTPATCHES);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_NPATCHES); WINED3DUSAGE_TO_STR(WINED3DUSAGE_NPATCHES);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DYNAMIC); WINED3DUSAGE_TO_STR(WINED3DUSAGE_DYNAMIC);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_AUTOGENMIPMAP);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DMAP);
#undef WINED3DUSAGE_TO_STR #undef WINED3DUSAGE_TO_STR
case 0: return "none"; case 0: return "none";
default: default:
...@@ -249,6 +251,24 @@ const char* debug_d3dusage(DWORD usage) { ...@@ -249,6 +251,24 @@ const char* debug_d3dusage(DWORD usage) {
} }
} }
const char* debug_d3dusagequery(DWORD usagequery) {
switch (usagequery & WINED3DUSAGE_QUERY_MASK) {
#define WINED3DUSAGEQUERY_TO_STR(u) case u: return #u
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_FILTER);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_LEGACYBUMPMAP);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_SRGBREAD);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_SRGBWRITE);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_VERTEXTEXTURE);
WINED3DUSAGEQUERY_TO_STR(WINED3DUSAGE_QUERY_WRAPANDMIP);
#undef WINED3DUSAGEQUERY_TO_STR
case 0: return "none";
default:
FIXME("Unrecognized %lu Usage Query!\n", usagequery);
return "unrecognized";
}
}
const char* debug_d3ddeclusage(BYTE usage) { const char* debug_d3ddeclusage(BYTE usage) {
switch (usage) { switch (usage) {
#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u #define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
......
...@@ -1215,6 +1215,7 @@ const char* debug_d3dformat(WINED3DFORMAT fmt); ...@@ -1215,6 +1215,7 @@ const char* debug_d3dformat(WINED3DFORMAT fmt);
const char* debug_d3ddevicetype(D3DDEVTYPE devtype); const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
const char* debug_d3dresourcetype(WINED3DRESOURCETYPE res); const char* debug_d3dresourcetype(WINED3DRESOURCETYPE res);
const char* debug_d3dusage(DWORD usage); const char* debug_d3dusage(DWORD usage);
const char* debug_d3dusagequery(DWORD usagequery);
const char* debug_d3ddeclusage(BYTE usage); const char* debug_d3ddeclusage(BYTE usage);
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType); const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
const char* debug_d3drenderstate(DWORD state); const char* debug_d3drenderstate(DWORD state);
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
#define D3DUSAGE_QUERY_SRGBREAD 0x00010000L #define D3DUSAGE_QUERY_SRGBREAD 0x00010000L
#define D3DUSAGE_QUERY_SRGBWRITE 0x00040000L #define D3DUSAGE_QUERY_SRGBWRITE 0x00040000L
#define D3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000L #define D3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000L
#define D3DUSAGE_QUERY_WRAPANDMIP 0x00200000L
#define D3DWRAP_U 1 #define D3DWRAP_U 1
#define D3DWRAP_V 2 #define D3DWRAP_V 2
......
...@@ -1005,6 +1005,16 @@ typedef enum _WINED3DDECLUSAGE { ...@@ -1005,6 +1005,16 @@ typedef enum _WINED3DDECLUSAGE {
#define WINED3DUSAGE_DYNAMIC 0x00000200L #define WINED3DUSAGE_DYNAMIC 0x00000200L
#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400L #define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400L
#define WINED3DUSAGE_DMAP 0x00004000L #define WINED3DUSAGE_DMAP 0x00004000L
#define WINED3DUSAGE_MASK 0x00004FFFL
#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP 0x00008000L
#define WINED3DUSAGE_QUERY_FILTER 0x00020000L
#define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING 0x00080000L
#define WINED3DUSAGE_QUERY_SRGBREAD 0x00010000L
#define WINED3DUSAGE_QUERY_SRGBWRITE 0x00040000L
#define WINED3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000L
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000L
#define WINED3DUSAGE_QUERY_MASK 0x002F8000L
typedef enum _WINED3DSURFTYPE { typedef enum _WINED3DSURFTYPE {
SURFACE_UNKNOWN = 0, /* Default / Unknown surface type */ SURFACE_UNKNOWN = 0, /* Default / Unknown surface type */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment