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

Strip out stateblocks from d3d9 and relay all stateblock calls to

wined3d.
parent 723ee0a3
......@@ -186,9 +186,7 @@ typedef struct IDirect3DIndexBuffer9Impl IDirect3DIndexBuffer9Impl;
typedef struct IDirect3DSurface9Impl IDirect3DSurface9Impl;
typedef struct IDirect3DResource9Impl IDirect3DResource9Impl;
typedef struct IDirect3DVolume9Impl IDirect3DVolume9Impl;
typedef struct IDirect3DStateBlock9Impl IDirect3DStateBlock9Impl;
typedef struct IDirect3DVertexShader9Impl IDirect3DVertexShader9Impl;
typedef struct IDirect3DPixelShader9Impl IDirect3DPixelShader9Impl;
typedef struct IDirect3DVertexDeclaration9Impl IDirect3DVertexDeclaration9Impl;
......@@ -215,30 +213,6 @@ typedef struct IDirect3DVertexDeclaration9Impl IDirect3DVertexDeclaration9Impl;
(vec)[2] = D3DCOLOR_B(dw); \
(vec)[3] = D3DCOLOR_A(dw);
/**
* State Block for Begin/End/Capture/Create/Apply State Block
* Note: Very long winded but I do not believe gl Lists will
* resolve everything we need, so doing it manually for now
*/
typedef struct SAVEDSTATES {
BOOL lightEnable[MAX_ACTIVE_LIGHTS];
BOOL Indices;
BOOL lights[MAX_ACTIVE_LIGHTS];
BOOL material;
BOOL stream_source[MAX_STREAMS];
BOOL textures[8];
BOOL transform[HIGHEST_TRANSFORMSTATE];
BOOL viewport;
BOOL vertexShader;
BOOL vertexShaderConstant;
BOOL vertexShaderDecl;
BOOL pixelShader;
BOOL pixelShaderConstant;
BOOL renderstate[HIGHEST_RENDER_STATE];
BOOL texture_state[8][HIGHEST_TEXTURE_STATE];
BOOL clipplane[MAX_CLIPPLANES];
} SAVEDSTATES;
typedef struct D3DSHADERVECTORF {
float x;
float y;
......@@ -321,7 +295,6 @@ struct IDirect3DDevice9Impl
DWORD ref;
/* IDirect3DDevice9 fields */
IDirect3D9Impl *direct3d;
IWineD3DDevice *WineD3DDevice;
/* FIXME: To be sorted out during move */
......@@ -331,58 +304,6 @@ struct IDirect3DDevice9Impl
IDirect3DSurface9Impl *renderTarget;
IDirect3DSurface9Impl *stencilBufferTarget;
D3DPRESENT_PARAMETERS PresentParms;
D3DDEVICE_CREATION_PARAMETERS CreateParms;
UINT adapterNo;
D3DDEVTYPE devType;
UINT srcBlend;
UINT dstBlend;
UINT alphafunc;
UINT stencilfunc;
/* State block related */
BOOL isRecordingState;
IDirect3DStateBlock9Impl *StateBlock;
IDirect3DStateBlock9Impl *UpdateStateBlock;
/* Other required values */
float lightPosn[MAX_ACTIVE_LIGHTS][4];
float lightDirn[MAX_ACTIVE_LIGHTS][4];
/* palettes texture management */
PALETTEENTRY palettes[MAX_PALETTES][256];
UINT currentPalette;
/* Optimization */
D3DMATRIX lastProj;
D3DMATRIX lastView;
D3DMATRIX lastWorld0;
D3DMATRIX lastTexTrans[8];
/* OpenGL related */
/*
GLXContext glCtx;
XVisualInfo *visInfo;
Display *display;
GLXContext render_ctx;
Drawable drawable;
Window win;
*/
HWND win_handle;
/* OpenGL Extension related */
/* Cursor management */
BOOL bCursorVisible;
UINT xHotSpot;
UINT yHotSpot;
UINT xScreenSpace;
UINT yScreenSpace;
UINT dummyTextureName[8];
};
/* IUnknown: */
......@@ -958,90 +879,14 @@ extern const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl;
/*****************************************************************************
* IDirect3DStateBlock9 implementation structure
*/
struct IDirect3DStateBlock9Impl {
typedef struct IDirect3DStateBlock9Impl {
/* IUnknown fields */
const IDirect3DStateBlock9Vtbl *lpVtbl;
DWORD ref;
/* IDirect3DStateBlock9 fields */
IDirect3DDevice9Impl* Device;
D3DSTATEBLOCKTYPE blockType;
SAVEDSTATES Changed;
SAVEDSTATES Set;
/* Light Enable */
BOOL lightEnable[MAX_ACTIVE_LIGHTS];
/* ClipPlane */
double clipplane[MAX_CLIPPLANES][4];
/* Stream Source */
UINT stream_stride[MAX_STREAMS];
IDirect3DVertexBuffer9* stream_source[MAX_STREAMS];
BOOL streamIsUP;
/* Indices */
IDirect3DIndexBuffer9* pIndexData;
UINT baseVertexIndex;
/* Texture */
IDirect3DBaseTexture9* textures[8];
int textureDimensions[8];
/* Texture State Stage */
DWORD texture_state[8][HIGHEST_TEXTURE_STATE];
/* RenderState */
DWORD renderstate[HIGHEST_RENDER_STATE];
/* Transform */
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
/* ViewPort */
D3DVIEWPORT9 viewport;
/* Lights */
D3DLIGHT9 lights[MAX_ACTIVE_LIGHTS];
/* Material */
D3DMATERIAL9 material;
DWORD FVF;
/* Vertex Shader */
IDirect3DVertexShader9* VertexShader;
/* Vertex Shader Declaration */
IDirect3DVertexDeclaration9Impl* vertexDecl;
/* Pixel Shader */
IDirect3DPixelShader9* PixelShader;
/* Indexed Vertex Blending */
D3DVERTEXBLENDFLAGS vertex_blend;
FLOAT tween_factor;
/* Vertex Shader Constant */
D3DSHADERVECTORF vertexShaderConstantF[D3D_VSHADER_MAX_CONSTANTS];
D3DSHADERVECTORI vertexShaderConstantI[D3D_VSHADER_MAX_CONSTANTS];
BOOL vertexShaderConstantB[D3D_VSHADER_MAX_CONSTANTS];
/* Pixel Shader Constant */
D3DSHADERVECTORF pixelShaderConstantF[D3D_PSHADER_MAX_CONSTANTS];
D3DSHADERVECTORI pixelShaderConstantI[D3D_PSHADER_MAX_CONSTANTS];
BOOL pixelShaderConstantB[D3D_PSHADER_MAX_CONSTANTS];
};
/* IUnknown: */
extern HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLOCK9 iface, REFIID refiid, LPVOID* obj);
extern ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(LPDIRECT3DSTATEBLOCK9 iface);
extern ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface);
/* IDirect3DStateBlock9: */
extern HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(LPDIRECT3DSTATEBLOCK9 iface, IDirect3DDevice9** ppDevice);
extern HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 iface);
extern HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(LPDIRECT3DSTATEBLOCK9 iface);
IWineD3DStateBlock *wineD3DStateBlock;
} IDirect3DStateBlock9Impl;
/* --------------------------- */
......@@ -1129,24 +974,15 @@ extern const IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl;
/*****************************************************************************
* IDirect3DPixelShader implementation structure
*/
struct IDirect3DPixelShader9Impl {
typedef struct IDirect3DPixelShader9Impl {
/* IUnknown fields */
const IDirect3DPixelShader9Vtbl *lpVtbl;
DWORD ref;
/* IDirect3DPixelShader9 fields */
IDirect3DDevice9Impl* Device;
IWineD3DPixelShader *wineD3DPixelShader;
DWORD* function;
UINT functionLength;
DWORD version;
/* run time datas */
/*
PSHADERDATA* data;
PSHADERINPUTDATA input;
PSHADEROUTPUTDATA output;
*/
};
} IDirect3DPixelShader9Impl;
/* IUnknown: */
extern HRESULT WINAPI IDirect3DPixelShader9Impl_QueryInterface(LPDIRECT3DPIXELSHADER9 iface, REFIID refiid, LPVOID* obj);
......
......@@ -63,9 +63,7 @@ ULONG WINAPI IDirect3DPixelShader9Impl_Release(LPDIRECT3DPIXELSHADER9 iface) {
/* IDirect3DPixelShader9 Interface follow: */
HRESULT WINAPI IDirect3DPixelShader9Impl_GetDevice(LPDIRECT3DPIXELSHADER9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DPixelShader9Impl *This = (IDirect3DPixelShader9Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE9) This->Device;
IDirect3DDevice9Impl_AddRef(*ppDevice);
FIXME("(%p): stub\n", This);
return D3D_OK;
}
......@@ -95,137 +93,44 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, C
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9* pShader) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
This->UpdateStateBlock->PixelShader = pShader;
This->UpdateStateBlock->Changed.pixelShader = TRUE;
This->UpdateStateBlock->Set.pixelShader = TRUE;
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
return D3D_OK;
}
/**
* TODO: merge HAL shaders context switching from prototype
*/
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9** ppShader) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) : GetPixelShader returning %p\n", This, This->StateBlock->PixelShader);
*ppShader = This->StateBlock->PixelShader;
IDirect3DPixelShader9Impl_AddRef(*ppShader);
FIXME("(%p) : stub\n", This);
*ppShader = NULL;
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
if (Register + Vector4fCount > D3D_VSHADER_MAX_CONSTANTS) {
ERR("(%p) : SetPixelShaderConstant C[%u] invalid\n", This, Register);
return D3DERR_INVALIDCALL;
}
if (NULL == pConstantData) {
return D3DERR_INVALIDCALL;
}
if (Vector4fCount > 1) {
CONST FLOAT* f = pConstantData;
UINT i;
TRACE("(%p) : SetPixelShaderConstant C[%u..%u]=\n", This, Register, Register + Vector4fCount - 1);
for (i = 0; i < Vector4fCount; ++i) {
TRACE("{%f, %f, %f, %f}\n", f[0], f[1], f[2], f[3]);
f += 4;
}
} else {
const FLOAT* f = (const FLOAT*) pConstantData;
TRACE("(%p) : SetPixelShaderConstant, C[%u]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]);
}
This->UpdateStateBlock->Changed.pixelShaderConstant = TRUE;
memcpy(&This->UpdateStateBlock->pixelShaderConstantF[Register], pConstantData, Vector4fCount * 4 * sizeof(FLOAT));
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) : C[%u] count=%u\n", This, Register, Vector4fCount);
if (Register + Vector4fCount > D3D_VSHADER_MAX_CONSTANTS) {
return D3DERR_INVALIDCALL;
}
if (NULL == pConstantData) {
return D3DERR_INVALIDCALL;
}
memcpy(pConstantData, &This->UpdateStateBlock->pixelShaderConstantF[Register], Vector4fCount * 4 * sizeof(FLOAT));
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
if (Register + Vector4iCount > D3D_VSHADER_MAX_CONSTANTS) {
ERR("(%p) : SetPixelShaderConstantI C[%u] invalid\n", This, Register);
return D3DERR_INVALIDCALL;
}
if (NULL == pConstantData) {
return D3DERR_INVALIDCALL;
}
if (Vector4iCount > 1) {
CONST int* f = pConstantData;
UINT i;
TRACE("(%p) : SetPixelShaderConstantI C[%u..%u]=\n", This, Register, Register + Vector4iCount - 1);
for (i = 0; i < Vector4iCount; ++i) {
TRACE("{%d, %d, %d, %d}\n", f[0], f[1], f[2], f[3]);
f += 4;
}
} else {
CONST int* f = pConstantData;
TRACE("(%p) : SetPixelShaderConstantI, C[%u]={%i, %i, %i, %i}\n", This, Register, f[0], f[1], f[2], f[3]);
}
This->UpdateStateBlock->Changed.pixelShaderConstant = TRUE;
memcpy(&This->UpdateStateBlock->pixelShaderConstantI[Register], pConstantData, Vector4iCount * 4 * sizeof(int));
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) : C[%u] count=%u\n", This, Register, Vector4iCount);
if (Register + Vector4iCount > D3D_VSHADER_MAX_CONSTANTS) {
return D3DERR_INVALIDCALL;
}
if (NULL == pConstantData) {
return D3DERR_INVALIDCALL;
}
memcpy(pConstantData, &This->UpdateStateBlock->pixelShaderConstantI[Register], Vector4iCount * 4 * sizeof(FLOAT));
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
UINT i;
if (Register + BoolCount > D3D_VSHADER_MAX_CONSTANTS) {
ERR("(%p) : SetPixelShaderConstantB C[%u] invalid\n", This, Register);
return D3DERR_INVALIDCALL;
}
if (NULL == pConstantData) {
return D3DERR_INVALIDCALL;
}
if (BoolCount > 1) {
CONST BOOL* f = pConstantData;
TRACE("(%p) : SetPixelShaderConstantB C[%u..%u]=\n", This, Register, Register + BoolCount - 1);
for (i = 0; i < BoolCount; ++i) {
TRACE("{%u}\n", f[i]);
}
} else {
CONST BOOL* f = pConstantData;
TRACE("(%p) : SetPixelShaderConstantB, C[%u]={%u}\n", This, Register, f[0]);
}
This->UpdateStateBlock->Changed.pixelShaderConstant = TRUE;
for (i = 0; i < BoolCount; ++i) {
This->UpdateStateBlock->pixelShaderConstantB[Register] = pConstantData[i];
}
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
......@@ -2,7 +2,8 @@
* IDirect3DStateBlock9 implementation
*
* 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
* modify it under the terms of the GNU Lesser General Public
......@@ -30,7 +31,7 @@ HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLOCK9 ifa
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DStateBlock9)) {
IDirect3DStateBlock9Impl_AddRef(iface);
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
......@@ -55,6 +56,7 @@ ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
IWineD3DStateBlock_Release(This->wineD3DStateBlock);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
......@@ -63,30 +65,30 @@ ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) {
/* IDirect3DStateBlock9 Interface follow: */
HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(LPDIRECT3DSTATEBLOCK9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE9) This->Device;
IDirect3DDevice9Impl_AddRef(*ppDevice);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
}
HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
}
HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(LPDIRECT3DSTATEBLOCK9 iface) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
}
const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl =
{
/* IUnknown */
IDirect3DStateBlock9Impl_QueryInterface,
IDirect3DStateBlock9Impl_AddRef,
IDirect3DStateBlock9Impl_Release,
/* IDirect3DStateBlock9 */
IDirect3DStateBlock9Impl_GetDevice,
IDirect3DStateBlock9Impl_Capture,
IDirect3DStateBlock9Impl_Apply
......@@ -94,20 +96,62 @@ const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl =
/* IDirect3DDevice9 IDirect3DStateBlock9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) {
HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppStateBlock) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
IDirect3DStateBlock9Impl* object;
HRESULT hrc = D3D_OK;
TRACE("(%p) Relay\n", This);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DStateBlock9Impl));
if (NULL == object) {
FIXME("(%p) Failed to allocate %d bytes\n", This, sizeof(IDirect3DStateBlock9Impl));
*ppStateBlock = NULL;
return E_OUTOFMEMORY;
}
object->lpVtbl = &Direct3DStateBlock9_Vtbl;
object->ref = 1;
hrc=IWineD3DDevice_CreateStateBlock(This->WineD3DDevice,Type,&object->wineD3DStateBlock,(IUnknown*)object);
if(hrc != D3D_OK){
FIXME("(%p) Call to IWineD3DDevice_CreateStateBlock failed.\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppStateBlock = NULL;
} else {
*ppStateBlock = (IDirect3DStateBlock9*)object;
}
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
return hrc;
}
HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9 iface) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DDevice_BeginStateBlock(This->WineD3DDevice);
}
HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9 iface, IDirect3DStateBlock9** ppSB) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
FIXME("(%p) : stub\n", This);
HRESULT hr;
IWineD3DStateBlock* wineD3DStateBlock;
IDirect3DStateBlock9Impl* object;
TRACE("(%p) Relay\n", This);
/*Tell wineD3D to endstatablock before anything else (incase we run out of memory later and cause locking problems)*/
hr=IWineD3DDevice_EndStateBlock(This->WineD3DDevice,&wineD3DStateBlock);
if(hr!= D3D_OK){
FIXME("IWineD3DDevice_EndStateBlock returned an error\n");
return hr;
}
/*allocate a new IDirectD3DStateBlock*/
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY ,sizeof(IDirect3DStateBlock9Impl));
object->ref = 1;
object->lpVtbl = &Direct3DStateBlock9_Vtbl;
object->wineD3DStateBlock=wineD3DStateBlock;
*ppSB=(IDirect3DStateBlock9*)object;
TRACE("(%p)Returning %p %p\n", This, *ppSB, wineD3DStateBlock);
return D3D_OK;
}
......@@ -95,16 +95,10 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9* pShader) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
/* TODO: implement stateblocks */
This->UpdateStateBlock->VertexShader = pShader;
This->UpdateStateBlock->Changed.vertexShader = TRUE;
This->UpdateStateBlock->Set.vertexShader = TRUE;
FIXME("Disabled %p\n", This);
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
return D3D_OK;
}
/**
* TODO: merge HAL shaders context switching from prototype
*/
......@@ -113,15 +107,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9** ppShader) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
TRACE("(%p) : GetVertexShader returning %p\n", This, This->StateBlock->VertexShader);
*ppShader = This->StateBlock->VertexShader;
IDirect3DVertexShader9Impl_AddRef(*ppShader);
TRACE("(%p) : GetVertexShader returning\n", This);
*ppShader = NULL;
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#if 0
if (Register + Vector4fCount > D3D_VSHADER_MAX_CONSTANTS) {
ERR("(%p) : SetVertexShaderConstant C[%u] invalid\n", This, Register);
return D3DERR_INVALIDCALL;
......@@ -143,12 +136,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 i
}
This->UpdateStateBlock->Changed.vertexShaderConstant = TRUE;
memcpy(&This->UpdateStateBlock->vertexShaderConstantF[Register], pConstantData, Vector4fCount * 4 * sizeof(FLOAT));
#endif
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#if 0
TRACE("(%p) : C[%u] count=%u\n", This, Register, Vector4fCount);
if (Register + Vector4fCount > D3D_VSHADER_MAX_CONSTANTS) {
return D3DERR_INVALIDCALL;
......@@ -157,12 +152,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 i
return D3DERR_INVALIDCALL;
}
memcpy(pConstantData, &This->UpdateStateBlock->vertexShaderConstantF[Register], Vector4fCount * 4 * sizeof(FLOAT));
#endif
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#if 0
if (Register + Vector4iCount > D3D_VSHADER_MAX_CONSTANTS) {
ERR("(%p) : SetVertexShaderConstantI C[%u] invalid\n", This, Register);
return D3DERR_INVALIDCALL;
......@@ -184,12 +181,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 i
}
This->UpdateStateBlock->Changed.vertexShaderConstant = TRUE;
memcpy(&This->UpdateStateBlock->vertexShaderConstantI[Register], pConstantData, Vector4iCount * 4 * sizeof(int));
#endif
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#if 0
TRACE("(%p) : C[%u] count=%u\n", This, Register, Vector4iCount);
if (Register + Vector4iCount > D3D_VSHADER_MAX_CONSTANTS) {
return D3DERR_INVALIDCALL;
......@@ -198,11 +197,14 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 i
return D3DERR_INVALIDCALL;
}
memcpy(pConstantData, &This->UpdateStateBlock->vertexShaderConstantI[Register], Vector4iCount * 4 * sizeof(FLOAT));
#endif
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
#if 0
UINT i;
if (Register + BoolCount > D3D_VSHADER_MAX_CONSTANTS) {
......@@ -226,6 +228,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 i
for (i = 0; i < BoolCount; ++i) {
This->UpdateStateBlock->vertexShaderConstantB[Register] = pConstantData[i];
}
#endif
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......
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