Commit abb11f30 authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Implemented stateblocks in wined3d.

parent d30f1fd7
......@@ -371,26 +371,26 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
/* Work through stream by stream */
for (nStream=0; nStream<LoopThroughTo; nStream++) {
DWORD stride = This->stateBlock->stream_stride[nStream];
DWORD stride = This->stateBlock->streamStride[nStream];
BYTE *data = NULL;
DWORD thisFVF = 0;
/* Skip empty streams */
if (This->stateBlock->stream_source[nStream] == NULL) continue;
if (This->stateBlock->streamSource[nStream] == NULL) continue;
/* Retrieve appropriate FVF */
if (LoopThroughTo == 1) { /* Use FVF, not vertex shader */
thisFVF = This->updateStateBlock->fvf;
/* Handle memory passed directly as well as vertex buffers */
if (This->stateBlock->streamIsUP) {
data = (BYTE *)This->stateBlock->stream_source[nStream];
data = (BYTE *)This->stateBlock->streamSource[nStream];
} else {
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->stream_source[nStream])->resource.allocatedMemory;
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->streamSource[nStream])->resource.allocatedMemory;
}
} else {
#if 0 /* TODO: Vertex shader support */
thisFVF = This->stateBlock->vertexShaderDecl->fvf[nStream];
data = ((IDirect3DVertexBuffer8Impl *)This->stateBlock->stream_source[nStream])->allocatedMemory;
data = ((IDirect3DVertexBuffer8Impl *)This->stateBlock->streamSource[nStream])->allocatedMemory;
#endif
}
VTRACE(("FVF for stream %d is %lx\n", nStream, thisFVF));
......@@ -706,9 +706,9 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
}
} else {
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
FIXME("TODO\n");
TRACE("TODO ARB_VERTEX_BLEND\n");
} else if (GL_SUPPORT(EXT_VERTEX_WEIGHTING)) {
FIXME("TODO\n");
TRACE("TODO EXT_VERTEX_WEIGHTING\n");
/*
glDisableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT);
checkGLcall("glDisableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT)");
......
......@@ -43,11 +43,33 @@
#include "wine/wined3d_gl.h"
/* Device caps */
#define MAX_PALETTES 256
#define MAX_STREAMS 16
#define MAX_TEXTURES 8
#define MAX_SAMPLERS 16
#define MAX_ACTIVE_LIGHTS 8
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
#define MAX_LEVELS 256
/* Swap chains */
#define MAX_SWAPCHAINS 256
/* Used for CreateStateBlock */
#define NUM_SAVEDPIXELSTATES_R 35
#define NUM_SAVEDPIXELSTATES_T 18
#define NUM_SAVEDPIXELSTATES_S 12
#define NUM_SAVEDVERTEXSTATES_R 31
#define NUM_SAVEDVERTEXSTATES_T 2
#define NUM_SAVEDVERTEXSTATES_S 1
extern const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R];
extern const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T];
extern const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S];
extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
/* vertex and pixel shader modes */
extern int vs_mode;
#define VS_NONE 0
#define VS_HW 1
......@@ -284,7 +306,7 @@ typedef struct Direct3DVertexStridedData {
Direct3DStridedData pSize;
Direct3DStridedData diffuse;
Direct3DStridedData specular;
Direct3DStridedData texCoords[8];
Direct3DStridedData texCoords[MAX_TEXTURES];
} s;
Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
} u;
......@@ -403,7 +425,7 @@ typedef struct IWineD3DDeviceImpl
UINT yScreenSpace;
/* Textures for when no other textures are mapped */
UINT dummyTextureName[8];
UINT dummyTextureName[MAX_TEXTURES];
/* Debug stream management */
BOOL debug;
......@@ -654,17 +676,18 @@ typedef struct SAVEDSTATES {
BOOL indices;
BOOL material;
BOOL fvf;
BOOL stream_source[MAX_STREAMS];
BOOL textures[8];
BOOL transform[HIGHEST_TRANSFORMSTATE];
BOOL streamSource[MAX_STREAMS];
BOOL streamFreq[MAX_STREAMS];
BOOL textures[MAX_TEXTURES];
BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
BOOL viewport;
BOOL renderState[WINEHIGHEST_RENDER_STATE];
BOOL textureState[8][HIGHEST_TEXTURE_STATE];
BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
BOOL textureState[MAX_TEXTURES][HIGHEST_TEXTURE_STATE + 1];
BOOL clipplane[MAX_CLIPPLANES];
BOOL samplerState[MAX_SAMPLERS][HIGHEST_SAMPLER_STATE + 1];
BOOL vertexDecl;
BOOL pixelShader;
BOOL vertexShader;
BOOL vertexShader;
} SAVEDSTATES;
struct IWineD3DStateBlockImpl
......@@ -672,7 +695,7 @@ struct IWineD3DStateBlockImpl
/* IUnknown fields */
const IWineD3DStateBlockVtbl *lpVtbl;
DWORD ref; /* Note: Ref counting not required */
/* IWineD3DStateBlock information */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
......@@ -681,7 +704,7 @@ struct IWineD3DStateBlockImpl
/* Array indicating whether things have been set or changed */
SAVEDSTATES changed;
SAVEDSTATES set;
/* Drawing - Vertex Shader or FVF related */
DWORD fvf;
/* Vertex Shader Declaration */
......@@ -691,20 +714,22 @@ struct IWineD3DStateBlockImpl
/* Stream Source */
BOOL streamIsUP;
UINT stream_stride[MAX_STREAMS];
UINT stream_offset[MAX_STREAMS];
IWineD3DVertexBuffer *stream_source[MAX_STREAMS];
UINT streamStride[MAX_STREAMS];
UINT streamOffset[MAX_STREAMS];
IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
UINT streamFreq[MAX_STREAMS];
UINT streamFlags[MAX_STREAMS]; /*0 | D3DSTREAMSOURCE_INSTANCEDATA | D3DSTREAMSOURCE_INDEXEDDATA */
/* Indices */
IWineD3DIndexBuffer* pIndexData;
UINT baseVertexIndex; /* Note: only used for d3d8 */
/* Transform */
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
/* Lights */
PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
/* Clipping */
double clipplane[MAX_CLIPPLANES][4];
WINED3DCLIPSTATUS clip_status;
......@@ -715,20 +740,22 @@ struct IWineD3DStateBlockImpl
/* Material */
WINED3DMATERIAL material;
/* Pixel Shader */
void *pixelShader; /* TODO: Replace void * with IWineD3DPixelShader * */
/* Indexed Vertex Blending */
D3DVERTEXBLENDFLAGS vertex_blend;
FLOAT tween_factor;
/* RenderState */
DWORD renderState[WINEHIGHEST_RENDER_STATE];
DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
/* Texture */
IWineD3DBaseTexture *textures[8];
int textureDimensions[8];
IWineD3DBaseTexture *textures[MAX_TEXTURES];
int textureDimensions[MAX_SAMPLERS];
/* Texture State Stage */
DWORD textureState[8][HIGHEST_TEXTURE_STATE];
DWORD textureState[MAX_TEXTURES][HIGHEST_TEXTURE_STATE + 1];
/* Sampler States */
DWORD samplerState[MAX_SAMPLERS][HIGHEST_SAMPLER_STATE + 1];
......
......@@ -1114,6 +1114,9 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IWineD3DStateBlock methods ***/
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice **pDevice) PURE;
STDMETHOD(Capture)(THIS) PURE;
STDMETHOD(Apply)(THIS) PURE;
STDMETHOD(InitStartupStateBlock)(THIS) PURE;
};
#undef INTERFACE
......@@ -1125,6 +1128,9 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
#define IWineD3DStateBlock_Release(p) (p)->lpVtbl->Release(p)
/*** IWineD3DStateBlock methods ***/
#define IWineD3DStateBlock_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
#define IWineD3DStateBlock_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
#define IWineD3DStateBlock_Capture(p) (p)->lpVtbl->Capture(p)
#define IWineD3DStateBlock_Apply(p) (p)->lpVtbl->Apply(p)
#define IWineD3DStateBlock_InitStartupStateBlock(p) (p)->lpVtbl->InitStartupStateBlock(p)
#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