Commit f738c146 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

Add {G,S}etIndices, {G,S}Viewport and enable the basic drawing

functionality into wined3d and call from d3d9.
parent 58693097
......@@ -324,15 +324,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9 iface,
HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DDevice_SetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
}
HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface, D3DVIEWPORT9* pViewport) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p)\n", This);
memcpy(pViewport, &This->StateBlock->viewport, sizeof(D3DVIEWPORT9));
return D3D_OK;
return IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport);
}
HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) {
......@@ -508,29 +505,26 @@ float WINAPI IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9 iface) {
HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, PrimitiveCount);
}
HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType,
INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
}
HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
}
HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex,
UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData,
D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
return IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount,
pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
}
HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) {
......@@ -562,7 +556,10 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, U
HRESULT rc = D3D_OK;
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, (IWineD3DVertexBuffer **)&retStream, OffsetInBytes, pStride);
if (rc == D3D_OK && NULL != *pStream) IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
if (rc == D3D_OK && NULL != *pStream) {
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
IWineD3DVertexBuffer_Release(retStream);
}
return rc;
}
......@@ -580,35 +577,23 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9 ifac
HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9* pIndexData) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DIndexBuffer9 *oldIdxs;
TRACE("(%p) : Setting to %p\n", This, pIndexData);
oldIdxs = This->StateBlock->pIndexData;
This->UpdateStateBlock->Changed.Indices = TRUE;
This->UpdateStateBlock->Set.Indices = TRUE;
This->UpdateStateBlock->pIndexData = pIndexData;
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
return D3D_OK;
}
if (oldIdxs) IDirect3DIndexBuffer9Impl_Release(oldIdxs);
if (pIndexData) IDirect3DIndexBuffer9Impl_AddRef(This->StateBlock->pIndexData);
return D3D_OK;
return IWineD3DDevice_SetIndices(This->WineD3DDevice,
pIndexData==NULL ? NULL:((IDirect3DIndexBuffer9Impl *)pIndexData)->wineD3DIndexBuffer,
0);
}
HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9** ppIndexData) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
*ppIndexData = This->StateBlock->pIndexData;
/* up ref count on ppindexdata */
if (*ppIndexData) IDirect3DIndexBuffer9Impl_AddRef(*ppIndexData);
IWineD3DIndexBuffer *retIndexData = NULL;
HRESULT rc = D3D_OK;
UINT tmp;
return D3D_OK;
rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData, &tmp);
if (rc == D3D_OK && NULL != *ppIndexData) {
IWineD3DVertexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
IWineD3DVertexBuffer_Release(retIndexData);
}
return rc;
}
HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
......
......@@ -11,6 +11,7 @@ C_SRCS = \
basetexture.c \
device.c \
directx.c \
drawprim.c \
indexbuffer.c \
resource.c \
stateblock.c \
......
......@@ -993,7 +993,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED
/* Only change material color if specular is enabled, otherwise it is set to black */
#if 0 /* TODO */
if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
if (This->stateBlock->renderstate[D3DRS_SPECULARENABLE]) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular);
checkGLcall("glMaterialfv");
} else {
......@@ -1024,6 +1024,90 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINED3DMATE
}
/*****
* Get / Set Indices
*****/
HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer* pIndexData,
UINT BaseVertexIndex) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DIndexBuffer *oldIdxs;
TRACE("(%p) : Setting to %p, base %d\n", This, pIndexData, BaseVertexIndex);
oldIdxs = This->updateStateBlock->pIndexData;
This->updateStateBlock->changed.indices = TRUE;
This->updateStateBlock->set.indices = TRUE;
This->updateStateBlock->pIndexData = pIndexData;
This->updateStateBlock->baseVertexIndex = BaseVertexIndex;
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
return D3D_OK;
}
if (oldIdxs) IWineD3DIndexBuffer_Release(oldIdxs);
if (pIndexData) IWineD3DIndexBuffer_AddRef(This->stateBlock->pIndexData);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer** ppIndexData, UINT* pBaseVertexIndex) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppIndexData = This->stateBlock->pIndexData;
/* up ref count on ppindexdata */
if (*ppIndexData) IWineD3DIndexBuffer_AddRef(*ppIndexData);
*pBaseVertexIndex = This->stateBlock->baseVertexIndex;
return D3D_OK;
}
/*****
* Get / Set Viewports
*****/
HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED3DVIEWPORT* pViewport) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p)\n", This);
This->updateStateBlock->changed.viewport = TRUE;
This->updateStateBlock->set.viewport = TRUE;
memcpy(&This->updateStateBlock->viewport, pViewport, sizeof(WINED3DVIEWPORT));
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
return D3D_OK;
}
ENTER_GL();
TRACE("(%p) : x=%ld, y=%ld, wid=%ld, hei=%ld, minz=%f, maxz=%f\n", This,
pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ);
glDepthRange(pViewport->MinZ, pViewport->MaxZ);
checkGLcall("glDepthRange");
#if 0 /* TODO */
/* Note: GL requires lower left, DirectX supplies upper left */
glViewport(pViewport->X, (This->renderTarget->myDesc.Height - (pViewport->Y + pViewport->Height)),
pViewport->Width, pViewport->Height);
checkGLcall("glViewport");
#endif
LEAVE_GL();
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetViewport(IWineD3DDevice *iface, WINED3DVIEWPORT* pViewport) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p)\n", This);
memcpy(pViewport, &This->stateBlock->viewport, sizeof(WINED3DVIEWPORT));
return D3D_OK;
}
/*****
* Scene related functions
*****/
HRESULT WINAPI IWineD3DDeviceImpl_BeginScene(IWineD3DDevice *iface) {
......@@ -1034,6 +1118,115 @@ HRESULT WINAPI IWineD3DDeviceImpl_BeginScene(IWineD3DDevice *iface) {
return D3D_OK;
}
/*****
* Drawing functions
*****/
HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
UINT PrimitiveCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
This->stateBlock->streamIsUP = FALSE;
TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
StartVertex, PrimitiveCount);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, StartVertex, -1, 0, NULL, 0);
return D3D_OK;
}
/* TODO: baseVIndex needs to be provided from This->stateBlock->baseVertexIndex when called from d3d8 */
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
D3DPRIMITIVETYPE PrimitiveType,
INT baseVIndex, UINT minIndex,
UINT NumVertices,UINT startIndex,UINT primCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
UINT idxStride = 2;
IWineD3DIndexBuffer *pIB;
D3DINDEXBUFFER_DESC IdxBufDsc;
pIB = This->stateBlock->pIndexData;
This->stateBlock->streamIsUP = FALSE;
TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, baseVidx=%d, countP=%d \n", This,
PrimitiveType, debug_d3dprimitivetype(PrimitiveType),
minIndex, NumVertices, startIndex, baseVIndex, primCount);
IWineD3DIndexBuffer_GetDesc(pIB, &IdxBufDsc);
if (IdxBufDsc.Format == D3DFMT_INDEX16) {
idxStride = 2;
} else {
idxStride = 4;
}
drawPrimitive(iface, PrimitiveType, primCount, baseVIndex,
startIndex, idxStride,
((IWineD3DIndexBufferImpl *) pIB)->allocatedMemory,
minIndex);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,
UINT PrimitiveCount, CONST void* pVertexStreamZeroData,
UINT VertexStreamZeroStride) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Type=(%d,%s), pCount=%d, pVtxData=%p, Stride=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
if (This->stateBlock->stream_source[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->stream_source[0]);
/* Note in the following, its not this type, but thats the purpose of streamIsUP */
This->stateBlock->stream_source[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
This->stateBlock->stream_stride[0] = VertexStreamZeroStride;
This->stateBlock->streamIsUP = TRUE;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, NULL, 0);
This->stateBlock->stream_stride[0] = 0;
This->stateBlock->stream_source[0] = NULL;
/*stream zero settings set to null at end, as per the msdn */
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType,
UINT MinVertexIndex,
UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,
D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,
UINT VertexStreamZeroStride) {
int idxStride;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Type=(%d,%s), MinVtxIdx=%d, NumVIdx=%d, PCount=%d, pidxdata=%p, IdxFmt=%d, pVtxdata=%p, stride=%d\n",
This, PrimitiveType, debug_d3dprimitivetype(PrimitiveType),
MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData,
IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
if (This->stateBlock->stream_source[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->stream_source[0]);
if (IndexDataFormat == D3DFMT_INDEX16) {
idxStride = 2;
} else {
idxStride = 4;
}
/* Note in the following, its not this type, but thats the purpose of streamIsUP */
This->stateBlock->stream_source[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
This->stateBlock->streamIsUP = TRUE;
This->stateBlock->stream_stride[0] = VertexStreamZeroStride;
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, idxStride, pIndexData, MinVertexIndex);
/* stream zero settings set to null at end as per the msdn */
This->stateBlock->stream_source[0] = NULL;
This->stateBlock->stream_stride[0] = 0;
IWineD3DDevice_SetIndices(iface, NULL, 0);
return D3D_OK;
}
/**********************************************************
* IUnknown parts follows
**********************************************************/
......@@ -1075,6 +1268,7 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_CreateVertexBuffer,
IWineD3DDeviceImpl_CreateIndexBuffer,
IWineD3DDeviceImpl_CreateStateBlock,
IWineD3DDeviceImpl_SetFVF,
IWineD3DDeviceImpl_GetFVF,
IWineD3DDeviceImpl_SetStreamSource,
......@@ -1092,5 +1286,15 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_GetClipStatus,
IWineD3DDeviceImpl_SetMaterial,
IWineD3DDeviceImpl_GetMaterial,
IWineD3DDeviceImpl_BeginScene
IWineD3DDeviceImpl_SetIndices,
IWineD3DDeviceImpl_GetIndices,
IWineD3DDeviceImpl_SetViewport,
IWineD3DDeviceImpl_GetViewport,
IWineD3DDeviceImpl_BeginScene,
IWineD3DDeviceImpl_DrawPrimitive,
IWineD3DDeviceImpl_DrawIndexedPrimitive,
IWineD3DDeviceImpl_DrawPrimitiveUP,
IWineD3DDeviceImpl_DrawIndexedPrimitiveUP
};
......@@ -124,3 +124,19 @@ const char* debug_d3dresourcetype(D3DRESOURCETYPE res) {
return "unrecognized";
}
}
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType) {
switch (PrimitiveType) {
#define PRIM_TO_STR(prim) case prim: return #prim;
PRIM_TO_STR(D3DPT_POINTLIST);
PRIM_TO_STR(D3DPT_LINELIST);
PRIM_TO_STR(D3DPT_LINESTRIP);
PRIM_TO_STR(D3DPT_TRIANGLELIST);
PRIM_TO_STR(D3DPT_TRIANGLESTRIP);
PRIM_TO_STR(D3DPT_TRIANGLEFAN);
#undef PRIM_TO_STR
default:
FIXME("Unrecognized %u D3DPRIMITIVETYPE!\n", PrimitiveType);
return "unrecognized";
}
}
......@@ -71,6 +71,7 @@ extern int num_lock;
*/
#define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
#define GL_LIMITS(ExtName) (GLINFO_LOCATION.max_##ExtName)
#define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
#define MAX_STREAMS 16 /* Maximum possible streams - used for fixed size arrays
See MaxStreams in MSDN under GetDeviceCaps */
......@@ -120,11 +121,78 @@ do {
} \
}
#define TRACE_VECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w);
#define TRACE_STRIDED(sd,name) TRACE( #name "=(data:%p, stride:%ld, type:%ld)\n", sd->u.s.name.lpData, sd->u.s.name.dwStride, sd->u.s.name.dwType);
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
extern const float identity[16];
/*****************************************************************************
* Compilable extra diagnostics
*/
/* Trace information per-vertex: (extremely high amount of trace) */
#if 0 /* NOTE: Must be 0 in cvs */
# define VTRACE(A) TRACE A
#else
# define VTRACE(A)
#endif
/* Checking of per-vertex related GL calls */
#define vcheckGLcall(A) \
{ \
GLint err = glGetError(); \
if (err != GL_NO_ERROR) { \
FIXME(">>>>>>>>>>>>>>>>> %x from %s @ %s / %d\n", err, A, __FILE__, __LINE__); \
} else { \
VTRACE(("%s call ok %s / %d\n", A, __FILE__, __LINE__)); \
} \
}
/*****************************************************************************
* Prototypes
*/
/* Routine common to the draw primitive and draw indexed primitive routines */
void drawPrimitive(IWineD3DDevice *iface,
int PrimitiveType,
long NumPrimitives,
/* for Indexed: */
long StartVertexIndex,
long StartIdx,
short idxBytes,
const void *idxData,
int minIndex);
/*****************************************************************************
* Structures required to draw primitives
*/
typedef struct Direct3DStridedData {
BYTE *lpData; /* Pointer to start of data */
DWORD dwStride; /* Stride between occurances of this data */
DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
} Direct3DStridedData;
typedef struct Direct3DVertexStridedData {
union {
struct {
Direct3DStridedData position;
Direct3DStridedData blendWeights;
Direct3DStridedData blendMatrixIndices;
Direct3DStridedData normal;
Direct3DStridedData pSize;
Direct3DStridedData diffuse;
Direct3DStridedData specular;
Direct3DStridedData texCoords[8];
} s;
Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
} u;
} Direct3DVertexStridedData;
/*****************************************************************************
* Internal representation of a light
*/
typedef struct PLIGHTINFOEL PLIGHTINFOEL;
......@@ -194,6 +262,12 @@ typedef struct IWineD3DDeviceImpl
BOOL proj_valid;
BOOL view_ident; /* true iff view matrix is identity */
BOOL last_was_rhw; /* true iff last draw_primitive was in xyzrhw mode */
GLenum tracking_parm; /* Which source is tracking current colour */
LONG tracking_color; /* used iff GL_COLOR_MATERIAL was enabled */
#define DISABLED_TRACKING 0 /* Disabled */
#define IS_TRACKING 1 /* tracking_parm is tracking diffuse color */
#define NEEDS_TRACKING 2 /* Tracking needs to be enabled when needed */
#define NEEDS_DISABLE 3 /* Tracking needs to be disabled when needed*/
/* State block related */
BOOL isRecordingState;
......@@ -206,6 +280,9 @@ typedef struct IWineD3DDeviceImpl
UINT adapterNo;
D3DDEVTYPE devType;
/* For rendering to a texture using glCopyTexImage */
BOOL renderUpsideDown;
} IWineD3DDeviceImpl;
extern IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
......@@ -296,10 +373,13 @@ extern IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl;
/* Note: Very long winded but gl Lists are not flexible enough */
/* to resolve everything we need, so doing it manually for now */
typedef struct SAVEDSTATES {
BOOL indices;
BOOL material;
BOOL fvf;
BOOL stream_source[MAX_STREAMS];
BOOL textures[8];
BOOL transform[HIGHEST_TRANSFORMSTATE];
BOOL viewport;
BOOL clipplane[MAX_CLIPPLANES];
} SAVEDSTATES;
......@@ -320,12 +400,18 @@ struct IWineD3DStateBlockImpl
/* Drawing - Vertex Shader or FVF related */
DWORD fvf;
void *vertexShader; /* TODO: Replace void * with IWineD3DVertexShader * */
BOOL streamIsUP;
/* Stream Source */
UINT stream_stride[MAX_STREAMS];
UINT stream_offset[MAX_STREAMS];
IWineD3DVertexBuffer *stream_source[MAX_STREAMS];
/* Indices */
IWineD3DIndexBuffer* pIndexData;
UINT baseVertexIndex; /* Note: only used for d3d8 */
/* Transform */
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
......@@ -336,9 +422,15 @@ struct IWineD3DStateBlockImpl
double clipplane[MAX_CLIPPLANES][4];
WINED3DCLIPSTATUS clip_status;
/* ViewPort */
WINED3DVIEWPORT viewport;
/* Material */
WINED3DMATERIAL material;
/* Texture */
IWineD3DBaseTexture *textures[8];
int textureDimensions[8];
};
extern IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
......@@ -350,6 +442,7 @@ const char* debug_d3dformat(D3DFORMAT fmt);
const char* debug_d3ddevicetype(D3DDEVTYPE devtype);
const char* debug_d3dresourcetype(D3DRESOURCETYPE res);
const char* debug_d3dusage(DWORD usage);
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
#if 0 /* Needs fixing during rework */
/*****************************************************************************
......
......@@ -74,10 +74,12 @@ typedef struct _WINED3DPRESENT_PARAMETERS {
#define WINED3DLIGHT D3DLIGHT8
#define WINED3DCLIPSTATUS D3DCLIPSTATUS8
#define WINED3DMATERIAL D3DMATERIAL8
#define WINED3DVIEWPORT D3DVIEWPORT8
#else
#define WINED3DLIGHT D3DLIGHT9
#define WINED3DCLIPSTATUS D3DCLIPSTATUS9
#define WINED3DMATERIAL D3DMATERIAL9
#define WINED3DVIEWPORT D3DVIEWPORT9
#endif
typedef struct IWineD3D IWineD3D;
......@@ -176,7 +178,15 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD(GetClipStatus)(THIS_ WINED3DCLIPSTATUS * pClipStatus) PURE;
STDMETHOD(SetMaterial)(THIS_ CONST WINED3DMATERIAL * pMaterial) PURE;
STDMETHOD(GetMaterial)(THIS_ WINED3DMATERIAL *pMaterial) PURE;
STDMETHOD(SetIndices)(THIS_ IWineD3DIndexBuffer * pIndexData,UINT BaseVertexIndex) PURE;
STDMETHOD(GetIndices)(THIS_ IWineD3DIndexBuffer ** ppIndexData,UINT * pBaseVertexIndex) PURE;
STDMETHOD(SetViewport)(THIS_ CONST WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(GetViewport)(THIS_ WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(BeginScene)(THIS) PURE;
STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;
STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,INT baseVIdx, UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;
STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void * pIndexData,D3DFORMAT IndexDataFormat,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
};
#undef INTERFACE
......@@ -207,7 +217,15 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a)
#define IWineD3DDevice_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a)
#define IWineD3DDevice_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a)
#define IWineD3DDevice_SetIndices(p,a,b) (p)->lpVtbl->SetIndices(p,a,b)
#define IWineD3DDevice_GetIndices(p,a,b) (p)->lpVtbl->GetIndices(p,a,b)
#define IWineD3DDevice_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a)
#define IWineD3DDevice_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a)
#define IWineD3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p)
#define IWineD3DDevice_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c)
#define IWineD3DDevice_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f)
#define IWineD3DDevice_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
#define IWineD3DDevice_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h)
#endif
/*****************************************************************************
......
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