Commit 7b261656 authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Added a stubbed out version of query to d3d9 and wined3d.

Update the d3d9 headers and creates wined3d types where d3d9 and d3d8 are incompatible.
parent 5be005b0
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
* Direct3D 9 private include file * Direct3D 9 private include file
* *
* Copyright 2002-2003 Jason Edmeades * Copyright 2002-2003 Jason Edmeades
* Raphael Junqueira * Copyright 2002-2003 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -83,7 +84,7 @@ extern void (*wine_tsx11_unlock_ptr)(void); ...@@ -83,7 +84,7 @@ extern void (*wine_tsx11_unlock_ptr)(void);
#define MAX_LEVELS 256 #define MAX_LEVELS 256
/* Other useful values */ /* Other useful values */
#define HIGHEST_RENDER_STATE 174 #define HIGHEST_RENDER_STATE D3DRS_BLENDOPALPHA
#define HIGHEST_TEXTURE_STATE 29 #define HIGHEST_TEXTURE_STATE 29
#define HIGHEST_TRANSFORMSTATE 512 #define HIGHEST_TRANSFORMSTATE 512
#define D3DSBT_RECORDED 0xfffffffe #define D3DSBT_RECORDED 0xfffffffe
...@@ -108,7 +109,6 @@ typedef struct IDirect3DStateBlock9Impl IDirect3DStateBlock9Impl; ...@@ -108,7 +109,6 @@ typedef struct IDirect3DStateBlock9Impl IDirect3DStateBlock9Impl;
typedef struct IDirect3DVertexShader9Impl IDirect3DVertexShader9Impl; typedef struct IDirect3DVertexShader9Impl IDirect3DVertexShader9Impl;
typedef struct IDirect3DPixelShader9Impl IDirect3DPixelShader9Impl; typedef struct IDirect3DPixelShader9Impl IDirect3DPixelShader9Impl;
typedef struct IDirect3DVertexDeclaration9Impl IDirect3DVertexDeclaration9Impl; typedef struct IDirect3DVertexDeclaration9Impl IDirect3DVertexDeclaration9Impl;
typedef struct IDirect3DQuery9Impl IDirect3DQuery9Impl;
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f) #define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
...@@ -1108,26 +1108,15 @@ extern IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl; ...@@ -1108,26 +1108,15 @@ extern IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl;
/***************************************************************************** /*****************************************************************************
* IDirect3DPixelShader implementation structure * IDirect3DPixelShader implementation structure
*/ */
struct IDirect3DQuery9Impl { typedef struct IDirect3DQuery9Impl {
/* IUnknown fields */ /* IUnknown fields */
IDirect3DQuery9Vtbl *lpVtbl; IDirect3DQuery9Vtbl *lpVtbl;
DWORD ref; DWORD ref;
/* IDirect3DQuery9 fields */ /* IDirect3DQuery9 fields */
IDirect3DDevice9Impl* Device; IWineD3DQuery *wineD3DQuery;
}; } IDirect3DQuery9Impl;
/* IUnknown: */
extern HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj);
extern ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface);
extern ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface);
/* IDirect3DQuery9: */
extern HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(LPDIRECT3DQUERY9 iface, IDirect3DDevice9** ppDevice);
extern D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface);
extern DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface);
extern HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags);
extern HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags);
/* Callbacks */ /* Callbacks */
extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height, extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height,
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
* IDirect3DQuery9 implementation * IDirect3DQuery9 implementation
* *
* Copyright 2002-2003 Raphael Junqueira * Copyright 2002-2003 Raphael Junqueira
* Jason Edmeades * Copyright 2002-2003 Jason Edmeades
* Copyright 2005 Oliver Stieber
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -22,15 +23,16 @@ ...@@ -22,15 +23,16 @@
#include "config.h" #include "config.h"
#include "d3d9_private.h" #include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
/* IDirect3DQuery9 IUnknown parts follow: */ /* IDirect3DQuery9 IUnknown parts follow: */
HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj) { HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
TRACE("(%p) Relay\n", This);
if (IsEqualGUID(riid, &IID_IUnknown) if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DQuery9)) { || IsEqualGUID(riid, &IID_IDirect3DQuery9)) {
IDirect3DQuery9Impl_AddRef(iface); IUnknown_AddRef(iface);
*ppobj = This; *ppobj = This;
return D3D_OK; return D3D_OK;
} }
...@@ -44,7 +46,6 @@ ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) { ...@@ -44,7 +46,6 @@ ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) {
ULONG ref = InterlockedIncrement(&This->ref); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %ld\n", This, ref - 1); TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
return ref; return ref;
} }
...@@ -63,34 +64,43 @@ ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) { ...@@ -63,34 +64,43 @@ ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) {
/* IDirect3DQuery9 Interface follow: */ /* IDirect3DQuery9 Interface follow: */
HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(LPDIRECT3DQUERY9 iface, IDirect3DDevice9** ppDevice) { HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(LPDIRECT3DQUERY9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device); IWineD3DDevice* pDevice;
*ppDevice = (LPDIRECT3DDEVICE9) This->Device; HRESULT hr;
IDirect3DDevice9Impl_AddRef(*ppDevice);
return D3D_OK; TRACE("(%p) Relay\n", This);
hr = IWineD3DQuery_GetDevice(This->wineD3DQuery, &pDevice);
if(hr != D3D_OK){
*ppDevice = NULL;
}else{
hr = IWineD3DDevice_GetParent(pDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(pDevice);
}
return hr;
} }
D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) { D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
FIXME("(%p) : stub\n", This); TRACE("(%p) Relay\n", This);
return 0; return IWineD3DQuery_GetType(This->wineD3DQuery);
} }
DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) { DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
FIXME("(%p) : stub\n", This); TRACE("(%p) Relay\n", This);
return 0; return IWineD3DQuery_GetDataSize(This->wineD3DQuery);
} }
HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags) { HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
FIXME("(%p) : stub\n", This); TRACE("(%p) Relay\n", This);
return D3D_OK; return IWineD3DQuery_Issue(This->wineD3DQuery, dwIssueFlags);
} }
HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
FIXME("(%p) : stub\n", This); TRACE("(%p) Relay\n", This);
return D3D_OK; return IWineD3DQuery_GetData(This->wineD3DQuery, pData, dwSize, dwGetDataFlags);
} }
...@@ -109,12 +119,11 @@ IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl = ...@@ -109,12 +119,11 @@ IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl =
/* IDirect3DDevice9 IDirect3DQuery9 Methods follow: */ /* IDirect3DDevice9 IDirect3DQuery9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) { HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
#if 0
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#endif
IDirect3DQuery9Impl *object = NULL; IDirect3DQuery9Impl *object = NULL;
HRESULT hr = D3D_OK; HRESULT hr = D3D_OK;
TRACE("(%p) Relay\n", This);
if (NULL == ppQuery) { if (NULL == ppQuery) {
return D3DERR_INVALIDCALL; return D3DERR_INVALIDCALL;
} }
...@@ -128,8 +137,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER ...@@ -128,8 +137,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER
object->lpVtbl = &Direct3DQuery9_Vtbl; object->lpVtbl = &Direct3DQuery9_Vtbl;
object->ref = 1; object->ref = 1;
#if 0 hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &(object->wineD3DQuery), (IUnknown*)object);
hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, 9, pVertexElements, &(object->wineD3DQuery));
if (FAILED(hr)) { if (FAILED(hr)) {
/* free up object */ /* free up object */
...@@ -139,6 +147,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER ...@@ -139,6 +147,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUER
} else { } else {
*ppQuery = (LPDIRECT3DQUERY9) object; *ppQuery = (LPDIRECT3DQUERY9) object;
} }
#endif TRACE("(%p) : returning %p \n", This, *ppQuery);
return hr; return hr;
} }
...@@ -14,6 +14,7 @@ C_SRCS = \ ...@@ -14,6 +14,7 @@ C_SRCS = \
directx.c \ directx.c \
drawprim.c \ drawprim.c \
indexbuffer.c \ indexbuffer.c \
query.c \
resource.c \ resource.c \
stateblock.c \ stateblock.c \
surface.c \ surface.c \
......
...@@ -35,15 +35,6 @@ extern IDirect3DPixelShaderImpl* PixelShaders[64]; ...@@ -35,15 +35,6 @@ extern IDirect3DPixelShaderImpl* PixelShaders[64];
#undef GL_VERSION_1_4 /* To be fixed, caused by mesa headers */ #undef GL_VERSION_1_4 /* To be fixed, caused by mesa headers */
#endif #endif
/* Useful internal structure, holding place for 4 floats */
typedef struct _D3DVECTOR_4 {
float x;
float y;
float z;
float w;
} D3DVECTOR_4;
/* Returns bits for what is expected from the fixed function pipeline, and whether /* Returns bits for what is expected from the fixed function pipeline, and whether
a vertex shader will be in use. Note the fvf bits returned may be split over a vertex shader will be in use. Note the fvf bits returned may be split over
multiple streams only if the vertex shader was created, otherwise it all relates multiple streams only if the vertex shader was created, otherwise it all relates
...@@ -519,7 +510,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac ...@@ -519,7 +510,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
BOOL isDiffuse, float *dRGBA, /* 1st colors */ BOOL isDiffuse, float *dRGBA, /* 1st colors */
BOOL isSpecular, float *sRGB, /* 2ndry colors */ BOOL isSpecular, float *sRGB, /* 2ndry colors */
BOOL isPtSize, float ptSize, /* pointSize */ BOOL isPtSize, float ptSize, /* pointSize */
D3DVECTOR_4 *texcoords, int *numcoords) /* texture info */ WINED3DVECTOR_4 *texcoords, int *numcoords) /* texture info */
{ {
unsigned int textureNo; unsigned int textureNo;
float s, t, r, q; float s, t, r, q;
......
...@@ -167,9 +167,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE ...@@ -167,9 +167,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
/* DXTn formats don't have exact pitches as they are to the new row of blocks, /* DXTn formats don't have exact pitches as they are to the new row of blocks,
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5) where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)
ie pitch = (width/4) * bytes per block */ ie pitch = (width/4) * bytes per block */
if (This->currentDesc.Format == D3DFMT_DXT1) /* DXT1 is 8 bytes per block */ if (This->currentDesc.Format == WINED3DFMT_DXT1) /* DXT1 is 8 bytes per block */
pLockedRect->Pitch = (This->currentDesc.Width/4) * 8; pLockedRect->Pitch = (This->currentDesc.Width/4) * 8;
else if (This->currentDesc.Format == D3DFMT_DXT3 || This->currentDesc.Format == D3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */ else if (This->currentDesc.Format == WINED3DFMT_DXT3 || This->currentDesc.Format == WINED3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */
pLockedRect->Pitch = (This->currentDesc.Width/4) * 16; pLockedRect->Pitch = (This->currentDesc.Width/4) * 16;
else else
pLockedRect->Pitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */ pLockedRect->Pitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */
...@@ -184,7 +184,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE ...@@ -184,7 +184,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
} else { } else {
TRACE("Lock Rect (%p) = l %ld, t %ld, r %ld, b %ld\n", pRect, pRect->left, pRect->top, pRect->right, pRect->bottom); TRACE("Lock Rect (%p) = l %ld, t %ld, r %ld, b %ld\n", pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
if (This->currentDesc.Format == D3DFMT_DXT1) { /* DXT1 is half byte per pixel */ if (This->currentDesc.Format == WINED3DFMT_DXT1) { /* DXT1 is half byte per pixel */
pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + ((pRect->left * This->bytesPerPixel/2)); pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + ((pRect->left * This->bytesPerPixel/2));
} else { } else {
pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + (pRect->left * This->bytesPerPixel); pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + (pRect->left * This->bytesPerPixel);
...@@ -392,21 +392,21 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { ...@@ -392,21 +392,21 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1); glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1);
vcheckGLcall("glRasterPos2f"); vcheckGLcall("glRasterPos2f");
switch (This->currentDesc.Format) { switch (This->currentDesc.Format) {
case D3DFMT_R5G6B5: case WINED3DFMT_R5G6B5:
{ {
glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1, glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, This->allocatedMemory); GL_RGB, GL_UNSIGNED_SHORT_5_6_5, This->allocatedMemory);
vcheckGLcall("glDrawPixels"); vcheckGLcall("glDrawPixels");
} }
break; break;
case D3DFMT_R8G8B8: case WINED3DFMT_R8G8B8:
{ {
glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1, glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,
GL_RGB, GL_UNSIGNED_BYTE, This->allocatedMemory); GL_RGB, GL_UNSIGNED_BYTE, This->allocatedMemory);
vcheckGLcall("glDrawPixels"); vcheckGLcall("glDrawPixels");
} }
break; break;
case D3DFMT_A8R8G8B8: case WINED3DFMT_A8R8G8B8:
{ {
glPixelStorei(GL_PACK_SWAP_BYTES, TRUE); glPixelStorei(GL_PACK_SWAP_BYTES, TRUE);
vcheckGLcall("glPixelStorei"); vcheckGLcall("glPixelStorei");
...@@ -485,9 +485,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -485,9 +485,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
if (gl_level != 0) if (gl_level != 0)
FIXME("Surface in texture is only supported for level 0\n"); FIXME("Surface in texture is only supported for level 0\n");
else if (This->currentDesc.Format == D3DFMT_P8 || This->currentDesc.Format == D3DFMT_A8P8 || else if (This->currentDesc.Format == WINED3DFMT_P8 || This->currentDesc.Format == WINED3DFMT_A8P8 ||
This->currentDesc.Format == D3DFMT_DXT1 || This->currentDesc.Format == D3DFMT_DXT3 || This->currentDesc.Format == WINED3DFMT_DXT1 || This->currentDesc.Format == WINED3DFMT_DXT3 ||
This->currentDesc.Format == D3DFMT_DXT5) This->currentDesc.Format == WINED3DFMT_DXT5)
FIXME("Format %d not supported\n", This->currentDesc.Format); FIXME("Format %d not supported\n", This->currentDesc.Format);
else { else {
glCopyTexImage2D(gl_target, glCopyTexImage2D(gl_target,
...@@ -506,7 +506,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -506,7 +506,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
return D3D_OK; return D3D_OK;
} }
if ((This->currentDesc.Format == D3DFMT_P8 || This->currentDesc.Format == D3DFMT_A8P8) && if ((This->currentDesc.Format == WINED3DFMT_P8 || This->currentDesc.Format == WINED3DFMT_A8P8) &&
!GL_SUPPORT(EXT_PALETTED_TEXTURE)) { !GL_SUPPORT(EXT_PALETTED_TEXTURE)) {
/** /**
* wanted a paletted texture and not really support it in HW * wanted a paletted texture and not really support it in HW
...@@ -523,7 +523,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -523,7 +523,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
*dst++ = pal[color].peRed; *dst++ = pal[color].peRed;
*dst++ = pal[color].peGreen; *dst++ = pal[color].peGreen;
*dst++ = pal[color].peBlue; *dst++ = pal[color].peBlue;
if (This->currentDesc.Format == D3DFMT_A8P8) if (This->currentDesc.Format == WINED3DFMT_A8P8)
*dst++ = pal[color].peFlags; *dst++ = pal[color].peFlags;
else else
*dst++ = 0xFF; *dst++ = 0xFF;
...@@ -558,9 +558,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl ...@@ -558,9 +558,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl
return D3D_OK; return D3D_OK;
} }
if (This->currentDesc.Format == D3DFMT_DXT1 || if (This->currentDesc.Format == WINED3DFMT_DXT1 ||
This->currentDesc.Format == D3DFMT_DXT3 || This->currentDesc.Format == WINED3DFMT_DXT3 ||
This->currentDesc.Format == D3DFMT_DXT5) { This->currentDesc.Format == WINED3DFMT_DXT5) {
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) { if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
TRACE("Calling glCompressedTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, sz=%d, Mem=%p\n", TRACE("Calling glCompressedTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, sz=%d, Mem=%p\n",
gl_target, gl_target,
...@@ -657,8 +657,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch ...@@ -657,8 +657,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
fprintf(f, "P6\n%u %u\n255\n", This->currentDesc.Width, This->currentDesc.Height); fprintf(f, "P6\n%u %u\n255\n", This->currentDesc.Width, This->currentDesc.Height);
switch (This->currentDesc.Format) { switch (This->currentDesc.Format) {
case D3DFMT_X8R8G8B8: case WINED3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8: case WINED3DFMT_A8R8G8B8:
{ {
DWORD color; DWORD color;
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) { for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
...@@ -669,7 +669,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch ...@@ -669,7 +669,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
} }
} }
break; break;
case D3DFMT_R8G8B8: case WINED3DFMT_R8G8B8:
{ {
BYTE* color; BYTE* color;
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) { for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
...@@ -680,7 +680,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch ...@@ -680,7 +680,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
} }
} }
break; break;
case D3DFMT_A1R5G5B5: case WINED3DFMT_A1R5G5B5:
{ {
WORD color; WORD color;
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) { for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
...@@ -691,7 +691,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch ...@@ -691,7 +691,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
} }
} }
break; break;
case D3DFMT_A4R4G4B4: case WINED3DFMT_A4R4G4B4:
{ {
WORD color; WORD color;
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) { for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
...@@ -703,7 +703,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch ...@@ -703,7 +703,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
} }
break; break;
case D3DFMT_R5G6B5: case WINED3DFMT_R5G6B5:
{ {
WORD color; WORD color;
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) { for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
......
...@@ -126,13 +126,12 @@ extern int num_lock; ...@@ -126,13 +126,12 @@ extern int num_lock;
#define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays #define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
See MaxStreams in MSDN under GetDeviceCaps */ See MaxStreams in MSDN under GetDeviceCaps */
/* Maximum number of constants provided to the shaders */
#define HIGHEST_TRANSFORMSTATE 512 #define HIGHEST_TRANSFORMSTATE 512
/* Highest value in D3DTRANSFORMSTATETYPE */ /* Highest value in D3DTRANSFORMSTATETYPE */
#define HIGHEST_RENDER_STATE 209 #define HIGHEST_TEXTURE_STATE D3DTSS_CONSTANT
/* Highest D3DRS_ value */
#define HIGHEST_TEXTURE_STATE 32
/* Highest D3DTSS_ value */ /* Highest D3DTSS_ value */
#define WINED3D_VSHADER_MAX_CONSTANTS 96 #define HIGHEST_SAMPLER_STATE D3DSAMP_DMAPOFFSET
/* Maximum number of constants provided to the shaders */ /* Maximum number of constants provided to the shaders */
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES #define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
...@@ -666,7 +665,7 @@ typedef struct SAVEDSTATES { ...@@ -666,7 +665,7 @@ typedef struct SAVEDSTATES {
BOOL textures[8]; BOOL textures[8];
BOOL transform[HIGHEST_TRANSFORMSTATE]; BOOL transform[HIGHEST_TRANSFORMSTATE];
BOOL viewport; BOOL viewport;
BOOL renderState[HIGHEST_RENDER_STATE]; BOOL renderState[WINEHIGHEST_RENDER_STATE];
BOOL textureState[8][HIGHEST_TEXTURE_STATE]; BOOL textureState[8][HIGHEST_TEXTURE_STATE];
BOOL clipplane[MAX_CLIPPLANES]; BOOL clipplane[MAX_CLIPPLANES];
BOOL vertexDecl; BOOL vertexDecl;
...@@ -727,7 +726,7 @@ struct IWineD3DStateBlockImpl ...@@ -727,7 +726,7 @@ struct IWineD3DStateBlockImpl
FLOAT tween_factor; FLOAT tween_factor;
/* RenderState */ /* RenderState */
DWORD renderState[HIGHEST_RENDER_STATE]; DWORD renderState[WINEHIGHEST_RENDER_STATE];
/* Texture */ /* Texture */
IWineD3DBaseTexture *textures[8]; IWineD3DBaseTexture *textures[8];
...@@ -741,6 +740,31 @@ struct IWineD3DStateBlockImpl ...@@ -741,6 +740,31 @@ struct IWineD3DStateBlockImpl
extern IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl; extern IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
/***************************************************************************** /*****************************************************************************
* IWineD3DQueryImpl implementation structure (extends IUnknown)
*/
typedef struct IWineD3DQueryImpl
{
IWineD3DQueryVtbl *lpVtbl;
DWORD ref; /* Note: Ref counting not required */
IUnknown *parent;
/*TODO: replace with iface usage */
#if 0
IWineD3DDevice *wineD3DDevice;
#else
IWineD3DDeviceImpl *wineD3DDevice;
#endif
/* IWineD3DQuery fields */
D3DQUERYTYPE type;
void *extendedData;
} IWineD3DQueryImpl;
extern IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
/*****************************************************************************
* Utility function prototypes * Utility function prototypes
*/ */
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
# error You must include d3d8.h or d3d9.h header to use this header # error You must include d3d8.h or d3d9.h header to use this header
#endif #endif
#include "wined3d_types.h"
/***************************************************************** /*****************************************************************
* THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES * THIS FILE MUST NOT CONTAIN X11 or MESA DEFINES
* PLEASE USE wine/wined3d_gl.h INSTEAD * PLEASE USE wine/wined3d_gl.h INSTEAD
...@@ -114,113 +115,6 @@ DEFINE_GUID(IID_IWineD3DQuery, ...@@ -114,113 +115,6 @@ DEFINE_GUID(IID_IWineD3DQuery,
0x905ddbac, 0x6f30, 0x11d9, 0xc6, 0x87, 0x0, 0x4, 0x61, 0x42, 0xc1, 0x4f); 0x905ddbac, 0x6f30, 0x11d9, 0xc6, 0x87, 0x0, 0x4, 0x61, 0x42, 0xc1, 0x4f);
/*****************************************************************************
* WineD3D Structures to be used when d3d8 and d3d9 are incompatible
*/
typedef enum _WINED3DSAMPLERSTATETYPE {
WINED3DSAMP_ADDRESSU = 1,
WINED3DSAMP_ADDRESSV = 2,
WINED3DSAMP_ADDRESSW = 3,
WINED3DSAMP_BORDERCOLOR = 4,
WINED3DSAMP_MAGFILTER = 5,
WINED3DSAMP_MINFILTER = 6,
WINED3DSAMP_MIPFILTER = 7,
WINED3DSAMP_MIPMAPLODBIAS = 8,
WINED3DSAMP_MAXMIPLEVEL = 9,
WINED3DSAMP_MAXANISOTROPY = 10,
WINED3DSAMP_SRGBTEXTURE = 11,
WINED3DSAMP_ELEMENTINDEX = 12,
WINED3DSAMP_DMAPOFFSET = 13,
WINED3DSAMP_FORCE_DWORD = 0x7fffffff,
} WINED3DSAMPLERSTATETYPE;
typedef struct _WINED3DADAPTER_IDENTIFIER {
char *Driver;
char *Description;
char *DeviceName;
LARGE_INTEGER *DriverVersion;
DWORD *VendorId;
DWORD *DeviceId;
DWORD *SubSysId;
DWORD *Revision;
GUID *DeviceIdentifier;
DWORD *WHQLLevel;
} WINED3DADAPTER_IDENTIFIER;
typedef struct _WINED3DPRESENT_PARAMETERS {
UINT *BackBufferWidth;
UINT *BackBufferHeight;
D3DFORMAT *BackBufferFormat;
UINT *BackBufferCount;
D3DMULTISAMPLE_TYPE *MultiSampleType;
DWORD *MultiSampleQuality;
D3DSWAPEFFECT *SwapEffect;
HWND *hDeviceWindow;
BOOL *Windowed;
BOOL *EnableAutoDepthStencil;
D3DFORMAT *AutoDepthStencilFormat;
DWORD *Flags;
UINT *FullScreen_RefreshRateInHz;
UINT *PresentationInterval;
} WINED3DPRESENT_PARAMETERS;
typedef struct _WINED3DSURFACE_DESC
{
D3DFORMAT *Format;
D3DRESOURCETYPE *Type;
DWORD *Usage;
D3DPOOL *Pool;
UINT *Size;
D3DMULTISAMPLE_TYPE *MultiSampleType;
DWORD *MultiSampleQuality;
UINT *Width;
UINT *Height;
} WINED3DSURFACE_DESC;
typedef struct _WINED3DVOLUME_DESC
{
D3DFORMAT *Format;
D3DRESOURCETYPE *Type;
DWORD *Usage;
D3DPOOL *Pool;
UINT *Size;
UINT *Width;
UINT *Height;
UINT *Depth;
} WINED3DVOLUME_DESC;
typedef struct _WINED3DVERTEXELEMENT {
WORD Stream;
WORD Offset;
BYTE Type;
BYTE Method;
BYTE Usage;
BYTE UsageIndex;
} WINED3DVERTEXELEMENT, *LPWINED3DVERTEXELEMENT;
typedef enum _WINED3DQUERYTYPE {
WINED3DQUERYTYPE_VCACHE = 4,
WINED3DQUERYTYPE_RESOURCEMANAGER = 5,
WINED3DQUERYTYPE_VERTEXSTATS = 6,
WINED3DQUERYTYPE_EVENT = 8,
WINED3DQUERYTYPE_OCCLUSION = 9,
WINED3DQUERYTYPE_TIMESTAMP = 10,
WINED3DQUERYTYPE_TIMESTAMPDISJOINT = 11,
WINED3DQUERYTYPE_TIMESTAMPFREQ = 12,
WINED3DQUERYTYPE_PIPELINETIMINGS = 13,
WINED3DQUERYTYPE_INTERFACETIMINGS = 14,
WINED3DQUERYTYPE_VERTEXTIMINGS = 15,
WINED3DQUERYTYPE_PIXELTIMINGS = 16,
WINED3DQUERYTYPE_BANDWIDTHTIMINGS = 17,
WINED3DQUERYTYPE_CACHEUTILIZATION = 18
} WINED3DQUERYTYPE;
/* The following have differing names, but actually are the same layout. */ /* The following have differing names, but actually are the same layout. */
/* Also, D3DCAPS8 is a subset of D3DCAPS9 so can be typecase as long as /* Also, D3DCAPS8 is a subset of D3DCAPS9 so can be typecase as long as
none of the 9 fields are accessed when the device is d3d8 */ none of the 9 fields are accessed when the device is d3d8 */
...@@ -260,6 +154,7 @@ typedef struct IWineD3DVolume IWineD3DVolume; ...@@ -260,6 +154,7 @@ typedef struct IWineD3DVolume IWineD3DVolume;
typedef struct IWineD3DVertexDeclaration IWineD3DVertexDeclaration; typedef struct IWineD3DVertexDeclaration IWineD3DVertexDeclaration;
typedef struct IWineD3DVertexShader IWineD3DVertexShader; typedef struct IWineD3DVertexShader IWineD3DVertexShader;
typedef struct IWineD3DPixelShader IWineD3DPixelShader; typedef struct IWineD3DPixelShader IWineD3DPixelShader;
typedef struct IWineD3DQuery IWineD3DQuery;
/***************************************************************************** /*****************************************************************************
* Callback functions required for predefining surfaces / stencils * Callback functions required for predefining surfaces / stencils
...@@ -386,7 +281,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown) ...@@ -386,7 +281,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolumeTexture** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATEVOLUMEFN pFn) PURE; STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolumeTexture** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATEVOLUMEFN pFn) PURE;
STDMETHOD(CreateVolume)(THIS_ UINT Width, UINT Height, UINT Depth, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolume** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent) PURE; STDMETHOD(CreateVolume)(THIS_ UINT Width, UINT Height, UINT Depth, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DVolume** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent) PURE;
STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DCubeTexture** ppCubeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn) PURE; STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DCubeTexture** ppCubeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn) PURE;
STDMETHOD(CreateQuery)(THIS_ WINED3DQUERYTYPE Type, void **ppQuery, IUnknown *pParent); STDMETHOD(CreateQuery)(THIS_ WINED3DQUERYTYPE Type, IWineD3DQuery **ppQuery, IUnknown *pParent);
STDMETHOD(CreateAdditionalSwapChain)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, void** pSwapChain, IUnknown* pParent, D3DCB_CREATERENDERTARGETFN pFn, D3DCB_CREATEDEPTHSTENCILSURFACEFN pFn2); STDMETHOD(CreateAdditionalSwapChain)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, void** pSwapChain, IUnknown* pParent, D3DCB_CREATERENDERTARGETFN pFn, D3DCB_CREATEDEPTHSTENCILSURFACEFN pFn2);
STDMETHOD(CreateVertexDeclaration)(THIS_ CONST VOID* pDeclaration, IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent) PURE; STDMETHOD(CreateVertexDeclaration)(THIS_ CONST VOID* pDeclaration, IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent) PURE;
STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction, IWineD3DVertexShader** ppShader, IUnknown *pParent) PURE; STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction, IWineD3DVertexShader** ppShader, IUnknown *pParent) PURE;
...@@ -1193,6 +1088,41 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown) ...@@ -1193,6 +1088,41 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
#define IWineD3DStateBlock_InitStartupStateBlock(p) (p)->lpVtbl->InitStartupStateBlock(p) #define IWineD3DStateBlock_InitStartupStateBlock(p) (p)->lpVtbl->InitStartupStateBlock(p)
#endif #endif
/*****************************************************************************
* WineD3DQuery interface
*/
#define INTERFACE IWineD3DQuery
DECLARE_INTERFACE_(IWineD3DQuery,IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void **ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3DQuery methods ***/
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice **ppDevice) PURE;
STDMETHOD(GetData)(THIS_ void *pData, DWORD dwSize, DWORD dwGetDataFlags) PURE;
STDMETHOD_(DWORD,GetDataSize)(THIS) PURE;
STDMETHOD_(WINED3DQUERYTYPE, GetType)(THIS) PURE;
STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IWineD3DQuery_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IWineD3DQuery_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IWineD3DQuery_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DQuery methods ***/
#define IWineD3DQuery_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DQuery_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DQuery_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c)
#define IWineD3DQuery_GetDataSize(p) (p)->lpVtbl->GetDataSize(p)
#define IWineD3DQuery_GetType(p) (p)->lpVtbl->GetType(p)
#define IWineD3DQuery_Issue(p,a) (p)->lpVtbl->Issue(p,a)
#endif
/***************************************************************************** /*****************************************************************************
* IWineD3DVertexShader interface * IWineD3DVertexShader interface
......
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