Copy the parser and cross compiler from d3d8 and update everything to
vertex shaders 3.0. The Parser will now display the input shader in DirectX style, and the cross compiler now generates valid ARB_VERTEX_PROGRAM programs and outputs the result in ARB_VERTEX_PROGRAM style. Support for a number of extended attributes has been added, but this may not be complete, and dereferencing from loop counters isn't properly parsed yet.
This commit is contained in:
parent
f58e9f9e4b
commit
2c0e97e641
|
@ -1451,14 +1451,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice* iface,
|
|||
}
|
||||
|
||||
/* http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/programmingguide/programmable/vertexshaders/vscreate.asp */
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DVertexShader** ppVertexShader, IUnknown *parent) {
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, CONST DWORD *pFunction, IWineD3DVertexShader** ppVertexShader, IUnknown *parent) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */
|
||||
D3DCREATEOBJECTINSTANCE(object, VertexShader)
|
||||
object->function = pFunction;
|
||||
FIXME("(%p) : STUB: Created Vertex shader %p\n", This, ppVertexShader);
|
||||
return D3D_OK;
|
||||
|
||||
TRACE("(%p) : Created Vertex shader %p\n", This, ppVertexShader);
|
||||
IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DPixelShader** ppPixelShader, IUnknown *parent) {
|
||||
|
@ -1473,7 +1474,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice* iface, IWineD3D**
|
|||
TRACE("(%p) : wineD3D returning %p\n", This, *ppD3D);
|
||||
IWineD3D_AddRef(*ppD3D);
|
||||
return D3D_OK;
|
||||
|
||||
}
|
||||
|
||||
UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
|
||||
|
@ -3417,41 +3417,30 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice* iface, IW
|
|||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader* pShader) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
static BOOL showFixmes = TRUE;
|
||||
IWineD3DVertexShader *oldShader = This->updateStateBlock->vertexShader;
|
||||
|
||||
This->updateStateBlock->vertexShader = pShader;
|
||||
This->updateStateBlock->changed.vertexShader = TRUE;
|
||||
This->updateStateBlock->set.vertexShader = TRUE;
|
||||
|
||||
if(pShader == NULL) {
|
||||
/* clear down the shader */
|
||||
TRACE("Clear down the shader\n");
|
||||
}else{
|
||||
if(showFixmes) {
|
||||
FIXME("(%p) : stub pShader(%p)\n", This, pShader);
|
||||
showFixmes = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return D3D_OK;
|
||||
|
||||
/** FIXME: refernece counting? **/
|
||||
if (pShader == NULL) { /* only valid with non FVF shaders */
|
||||
TRACE_(d3d_shader)("(%p) : FVF Shader, pShader=%p\n", This, pShader);
|
||||
This->updateStateBlock->vertexShader = NULL;
|
||||
} else {
|
||||
TRACE_(d3d_shader)("(%p) : Created shader, pShader=%p\n", This, pShader);
|
||||
This->updateStateBlock->vertexShader = pShader;
|
||||
}
|
||||
|
||||
This->updateStateBlock->changed.vertexShader = TRUE;
|
||||
This->updateStateBlock->set.vertexShader = TRUE;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
if (This->isRecordingState) {
|
||||
TRACE("Recording... not performing anything\n");
|
||||
return D3D_OK;
|
||||
TRACE("Recording... not performing anything\n");
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
if (pShader != NULL) {
|
||||
IUnknown *newVertexShaderParent;
|
||||
/* GetParent will add a ref, so leave it hanging until the vertex buffer is cleared */
|
||||
TRACE("(%p) : setting pShader(%p)\n", This, pShader);
|
||||
IWineD3DVertexShader_GetParent(pShader, &newVertexShaderParent);
|
||||
} else {
|
||||
TRACE("Clear down the shader\n");
|
||||
}
|
||||
if (oldShader != NULL) {
|
||||
IUnknown *oldVertexShaderParent;
|
||||
IWineD3DVertexShader_GetParent(oldShader, &oldVertexShaderParent);
|
||||
IUnknown_Release(oldVertexShaderParent);
|
||||
IUnknown_Release(oldVertexShaderParent);
|
||||
}
|
||||
/**
|
||||
* TODO: merge HAL shaders context switching from prototype
|
||||
|
@ -3461,7 +3450,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3
|
|||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader** ppShader) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
*ppShader = This->stateBlock->vertexShader;
|
||||
*ppShader = This->updateStateBlock->vertexShader;
|
||||
if(*ppShader != NULL)
|
||||
IWineD3DVertexShader_AddRef(*ppShader);
|
||||
TRACE("(%p) : returning %p\n", This, *ppShader);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -155,6 +155,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 GL_VEND(_VendName) (GLINFO_LOCATION.gl_vendor == VENDOR_##_VendName ? TRUE : FALSE)
|
||||
|
||||
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
|
||||
#define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
|
||||
|
@ -888,9 +889,9 @@ struct IWineD3DStateBlockImpl
|
|||
/* Drawing - Vertex Shader or FVF related */
|
||||
DWORD fvf;
|
||||
/* Vertex Shader Declaration */
|
||||
IWineD3DVertexDeclaration* vertexDecl;
|
||||
IWineD3DVertexDeclaration *vertexDecl;
|
||||
|
||||
void *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
|
||||
IWineD3DVertexShader *vertexShader; /* @TODO: Replace void * with IWineD3DVertexShader * */
|
||||
|
||||
/* Vertex Shader Constants */
|
||||
BOOL vertexShaderConstantB[MAX_VSHADER_CONSTANTS];
|
||||
|
@ -1094,6 +1095,15 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
|
|||
/*** class static members ***/
|
||||
void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface);
|
||||
|
||||
/* an emul for the type of constants that are used... adressing causes problems with being able to work out what's used and what's not.. so maybe we'll have to rely on the server vertex shader const functions? */
|
||||
enum vsConstantsEnum {
|
||||
VS_CONSTANT_NOT_USED = 0,
|
||||
VS_CONSTANT_CONSTANT,
|
||||
VS_CONSTANT_INTEGER,
|
||||
VS_CONSTANT_BOOLEAN,
|
||||
VS_CONSTANT_FLOAT
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DVertexShader implementation structure
|
||||
*/
|
||||
|
@ -1105,19 +1115,25 @@ typedef struct IWineD3DVertexShaderImpl {
|
|||
IUnknown *parent;
|
||||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
|
||||
/* IWineD3DVertexShaderImpl*/
|
||||
/* IWineD3DVertexShaderImpl */
|
||||
CONST DWORD *function;
|
||||
UINT functionLength;
|
||||
|
||||
DWORD usage;
|
||||
DWORD version;
|
||||
|
||||
/* vertex declaration array mapping */
|
||||
BOOL namedArrays; /* don't map use named functions */
|
||||
BOOL declaredArrays; /* mapping requires */
|
||||
INT arrayUsageMap[WINED3DSHADERDECLUSAGE_MAX_USAGE]; /* lookup table for the maps */
|
||||
INT highestConstant;
|
||||
CHAR constantsUsedBitmap[256];
|
||||
/* FIXME: This needs to be populated with some flags of VS_CONSTANT_NOT_USED, VS_CONSTANT_CONSTANT, VS_CONSTANT_INTEGER, VS_CONSTANT_BOOLEAN, VS_CONSTANT_FLOAT, a half byte bitmap will be the best option, but I'll keep it as chards for siplicity */
|
||||
/* run time datas... */
|
||||
VSHADERDATA* data;
|
||||
GLint prgId;
|
||||
#if 0 /* needs reworking */
|
||||
DWORD usage;
|
||||
DWORD version;
|
||||
/* run time datas */
|
||||
VSHADERDATA* data;
|
||||
VSHADERINPUTDATA input;
|
||||
VSHADEROUTPUTDATA output;
|
||||
#endif
|
||||
|
|
|
@ -1250,8 +1250,9 @@ DECLARE_INTERFACE_(IWineD3DVertexShader,IUnknown)
|
|||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IWineD3DVertexShader methods ***/
|
||||
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice** ppDevice) PURE;
|
||||
STDMETHOD(GetFunction)(THIS_ VOID* pData, UINT* pSizeOfData) PURE;
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice** ppDevice) PURE;
|
||||
STDMETHOD(GetFunction)(THIS_ VOID *pData, UINT *pSizeOfData) PURE;
|
||||
STDMETHOD(SetFunction)(THIS_ CONST DWORD *pFunction) PURE;
|
||||
STDMETHOD(SetConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
||||
STDMETHOD(SetConstantI)(THIS_ UINT StartRegister, CONST INT* pConstantData, UINT Vector4iCount) PURE;
|
||||
STDMETHOD(SetConstantF)(THIS_ UINT StartRegister, CONST FLOAT* pConstantData, UINT Vector4fCount) PURE;
|
||||
|
@ -1272,6 +1273,7 @@ DECLARE_INTERFACE_(IWineD3DVertexShader,IUnknown)
|
|||
#define IWineD3DVertexShader_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
|
||||
#define IWineD3DVertexShader_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||
#define IWineD3DVertexShader_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b)
|
||||
#define IWineD3DVertexShader_SetFunction(p,a) (p)->lpVtbl->SetFunction(p,a)
|
||||
#define IWineD3DVertexShader_SetConstantB(p,a,b,c) (p)->lpVtbl->SetConstantB(p,a,b,c)
|
||||
#define IWineD3DVertexShader_SetConstantI(p,a,b,c) (p)->lpVtbl->SetConstantI(p,a,b,c)
|
||||
#define IWineD3DVertexShader_SetConstantF(p,a,b,c) (p)->lpVtbl->SetConstantF(p,a,b,c)
|
||||
|
|
Loading…
Reference in New Issue