Commit 270afeb5 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Define D3D usage flags in wined3d_types.h.

parent 2f0c7819
......@@ -187,7 +187,7 @@ DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface) {
HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, D3DTEXTUREFILTERTYPE FilterType) {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
if (!(This->baseTexture.usage & D3DUSAGE_AUTOGENMIPMAP)) {
if (!(This->baseTexture.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
TRACE("(%p) : returning invalid call\n", This);
return D3DERR_INVALIDCALL;
}
......@@ -199,7 +199,7 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture
D3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface) {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
FIXME("(%p) : stub\n", This);
if (!(This->baseTexture.usage & D3DUSAGE_AUTOGENMIPMAP)) {
if (!(This->baseTexture.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
return D3DTEXF_NONE;
}
return This->baseTexture.filterType;
......
......@@ -113,7 +113,7 @@ static void WINAPI IWineD3DDeviceImpl_ApplyTextureUnitState(IWineD3DDevice *ifac
#define D3DINITIALIZEBASETEXTURE(_basetexture) { \
_basetexture.levels = Levels; \
_basetexture.filterType = (Usage & D3DUSAGE_AUTOGENMIPMAP) ? D3DTEXF_LINEAR : D3DTEXF_NONE; \
_basetexture.filterType = (Usage & WINED3DUSAGE_AUTOGENMIPMAP) ? D3DTEXF_LINEAR : D3DTEXF_NONE; \
_basetexture.LOD = 0; \
_basetexture.dirty = TRUE; \
}
......@@ -785,13 +785,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
if(Lockable == FALSE) FIXME("Create surface called with a pool of SYSTEMMEM and a Lockable of FALSE, \
this is acceptable but unexpected (I can't know how the surface can be usable!)\n");
case D3DPOOL_MANAGED:
if(Usage == D3DUSAGE_DYNAMIC) FIXME("Create surface called with a pool of MANAGED and a \
Usage of DYNAMIC which are mutually exclusive, not doing \
anything just telling you.\n");
if(Usage == WINED3DUSAGE_DYNAMIC) FIXME("Create surface called with a pool of MANAGED and a \
Usage of DYNAMIC which are mutually exclusive, not doing \
anything just telling you.\n");
break;
case D3DPOOL_DEFAULT: /*TODO: Create offscreen plain can cause this check to fail..., find out if it should */
if(!(Usage & D3DUSAGE_DYNAMIC) && !(Usage & D3DUSAGE_RENDERTARGET)
&& !(Usage && D3DUSAGE_DEPTHSTENCIL ) && Lockable == TRUE)
if(!(Usage & WINED3DUSAGE_DYNAMIC) && !(Usage & WINED3DUSAGE_RENDERTARGET)
&& !(Usage && WINED3DUSAGE_DEPTHSTENCIL ) && Lockable == TRUE)
FIXME("Creating a surface with a POOL of DEFAULT with Locable true, that doesn't specify DYNAMIC usage.\n");
break;
default:
......@@ -799,7 +799,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
break;
};
if (Usage & D3DUSAGE_RENDERTARGET && Pool != D3DPOOL_DEFAULT) {
if (Usage & WINED3DUSAGE_RENDERTARGET && Pool != D3DPOOL_DEFAULT) {
FIXME("Trying to create a render target that isn't in the default pool\n");
}
......@@ -5836,7 +5836,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD3DSurfa
/* TODO: get rid of IWineD3DSwapChainImpl reference, a 'context' manager may help with this */
if (D3D_OK == IWineD3DSurface_GetContainer(pSurface, &IID_IWineD3DSwapChain, (void **)&container) || pSurface == This->renderTarget) {
if (D3DUSAGE_RENDERTARGET & surface->resource.usage) {
if (WINED3DUSAGE_RENDERTARGET & surface->resource.usage) {
/* TODO: make sure we set everything back to the way it was, and context management!
glGetIntegerv(GL_READ_BUFFER, &prev_read);
vcheckGLcall("glIntegerv");
......@@ -5850,7 +5850,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD3DSurfa
glDrawBuffer(GL_BACK);
}
} else {
if (D3DUSAGE_DEPTHSTENCIL & surface->resource.usage) {
if (WINED3DUSAGE_DEPTHSTENCIL & surface->resource.usage) {
FIXME("colouring of depth_stencil? %p buffers is not yet supported? %ld\n", surface, surface->resource.usage);
} else {
FIXME("(%p) : Regression %ld %p %p\n", This, surface->resource.usage, pSurface, This->renderTarget);
......@@ -5977,8 +5977,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD R
return D3DERR_INVALIDCALL;
}
/* TODO: replace Impl* usage with interface usage */
if (!((IWineD3DSurfaceImpl *)pRenderTarget)->resource.usage & D3DUSAGE_RENDERTARGET) {
FIXME("(%p)Trying to set the render target to a surface(%p) that wasn't created with a usage of D3DUSAGE_RENDERTARGET\n",This ,pRenderTarget);
if (!((IWineD3DSurfaceImpl *)pRenderTarget)->resource.usage & WINED3DUSAGE_RENDERTARGET) {
FIXME("(%p)Trying to set the render target to a surface(%p) that wasn't created with a usage of WINED3DUSAGE_RENDERTARGET\n",This ,pRenderTarget);
return D3DERR_INVALIDCALL;
}
/** TODO: check that the depth stencil format matches the render target, this is only done in debug
......
......@@ -285,7 +285,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
/*return D3DERR_INVALIDCALL; */
}
if (This->resource.usage & D3DUSAGE_RENDERTARGET) {
if (This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if (swapchain != NULL || iface == myDevice->renderTarget || iface == myDevice->depthStencilBuffer) {
......@@ -317,7 +317,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
This->resource.format == WINED3DFMT_DXT4 || This->resource.format == WINED3DFMT_DXT5) /* DXT2/3/4/5 is 16 bytes per block */
pLockedRect->Pitch = (This->currentDesc.Width >> 2) << 4;
else {
if (NP2_REPACK == wined3d_settings.nonpower2_mode || This->resource.usage & D3DUSAGE_RENDERTARGET) {
if (NP2_REPACK == wined3d_settings.nonpower2_mode || This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
/* Front and back buffers are always lockes/unlocked on currentDesc.Width */
pLockedRect->Pitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */
} else {
......@@ -350,7 +350,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
TRACE("Locking non-power 2 texture\n");
}
if (0 == This->resource.usage || This->resource.usage & D3DUSAGE_DYNAMIC) {
if (0 == This->resource.usage || This->resource.usage & WINED3DUSAGE_DYNAMIC) {
/* classic surface TODO: non 2d surfaces?
These resources may be POOL_SYSTEMMEM, so they must not access the device */
TRACE("locking an ordinarary surface\n");
......@@ -469,7 +469,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
}
}
} else if (D3DUSAGE_RENDERTARGET & This->resource.usage && !(Flags&D3DLOCK_DISCARD)) { /* render surfaces */
} else if (WINED3DUSAGE_RENDERTARGET & This->resource.usage && !(Flags&D3DLOCK_DISCARD)) { /* render surfaces */
GLint prev_store;
GLint prev_read;
......@@ -611,7 +611,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
}
LEAVE_GL();
} else if (D3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
} else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
if (!messages & 1) {
FIXME("TODO stencil depth surface locking surf%p usage(%lu)\n", This, This->resource.usage);
......@@ -669,7 +669,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
return D3DERR_INVALIDCALL;
}
if (D3DUSAGE_RENDERTARGET & This->resource.usage) {
if (WINED3DUSAGE_RENDERTARGET & This->resource.usage) {
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if ((swapchain != NULL) && iface == swapchain->backBuffer) {
......@@ -699,7 +699,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
* nothing to do
* waiting to reload the surface via IDirect3DDevice8::UpdateTexture
*/
} else if (D3DUSAGE_RENDERTARGET & This->resource.usage) { /* render surfaces */
} else if (WINED3DUSAGE_RENDERTARGET & This->resource.usage) { /* render surfaces */
/****************************
* TODO: Render targets are 'special' and
......@@ -897,7 +897,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
}
IWineD3DSwapChain_Release((IWineD3DSwapChain *)implSwapChain);
} else if (D3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
} else if (WINED3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
if (iface == myDevice->depthStencilBuffer) {
FIXME("TODO stencil depth surface unlocking surf@%p usage(%lu)\n", This, This->resource.usage);
......
......@@ -112,17 +112,17 @@ const char* debug_d3ddevicetype(D3DDEVTYPE devtype) {
const char* debug_d3dusage(DWORD usage) {
switch (usage) {
#define D3DUSAGE_TO_STR(u) case u: return #u
D3DUSAGE_TO_STR(D3DUSAGE_RENDERTARGET);
D3DUSAGE_TO_STR(D3DUSAGE_DEPTHSTENCIL);
D3DUSAGE_TO_STR(D3DUSAGE_WRITEONLY);
D3DUSAGE_TO_STR(D3DUSAGE_SOFTWAREPROCESSING);
D3DUSAGE_TO_STR(D3DUSAGE_DONOTCLIP);
D3DUSAGE_TO_STR(D3DUSAGE_POINTS);
D3DUSAGE_TO_STR(D3DUSAGE_RTPATCHES);
D3DUSAGE_TO_STR(D3DUSAGE_NPATCHES);
D3DUSAGE_TO_STR(D3DUSAGE_DYNAMIC);
#undef D3DUSAGE_TO_STR
#define WINED3DUSAGE_TO_STR(u) case u: return #u
WINED3DUSAGE_TO_STR(WINED3DUSAGE_RENDERTARGET);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DEPTHSTENCIL);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_WRITEONLY);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_SOFTWAREPROCESSING);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DONOTCLIP);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_POINTS);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_RTPATCHES);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_NPATCHES);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DYNAMIC);
#undef WINED3DUSAGE_TO_STR
case 0: return "none";
default:
FIXME("Unrecognized %lu Usage!\n", usage);
......
......@@ -772,6 +772,18 @@ typedef enum _WINED3DDECLUSAGE {
WINED3DSHADERDECLUSAGE_MAX_USAGE
} WINED3DSHADERDECLUSAGE;
#define WINED3DUSAGE_RENDERTARGET 0x00000001L
#define WINED3DUSAGE_DEPTHSTENCIL 0x00000002L
#define WINED3DUSAGE_WRITEONLY 0x00000008L
#define WINED3DUSAGE_SOFTWAREPROCESSING 0x00000010L
#define WINED3DUSAGE_DONOTCLIP 0x00000020L
#define WINED3DUSAGE_POINTS 0x00000040L
#define WINED3DUSAGE_RTPATCHES 0x00000080L
#define WINED3DUSAGE_NPATCHES 0x00000100L
#define WINED3DUSAGE_DYNAMIC 0x00000200L
#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400L
#define WINED3DUSAGE_DMAP 0x00004000L
#define WINED3DPRASTERCAPS_DITHER 0x00000001L
#define WINED3DPRASTERCAPS_ROP2 0x00000002L
#define WINED3DPRASTERCAPS_XOR 0x00000004L
......
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