Added support for vertex and pixel shader constants that have no type

i.e. they haven't been set yet or are clear.
This commit is contained in:
Oliver Stieber 2005-11-29 17:05:54 +01:00 committed by Alexandre Julliard
parent 45f0e0625e
commit aa9ce3577a
5 changed files with 49 additions and 7 deletions

View File

@ -3899,10 +3899,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(IWineD3DDevice *iface
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
int i;
/* populate the bitmap that says which constant type we should load */
for (i = StartRegister; i < StartRegister + VectorNCount; ++i) {
This->updateStateBlock->changed.vertexShaderConstants[i] = TRUE;
This->updateStateBlock->set.vertexShaderConstants[i] = TRUE;
This->updateStateBlock->vertexShaderConstantT[i] = WINESHADERCNST_NONE;
TRACE("(%p) : Setting vsf %d\n", This, i);
}
return D3D_OK;
}
#undef SET_SHADER_CONSTANT
#undef GET_SHADER_CONSTANT
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) {
IUnknown *parent;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
@ -4082,6 +4094,21 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(IWineD3DDevice *iface,
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantN(IWineD3DDevice *iface, UINT StartRegister, UINT VectorNCount){
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
int i;
/* populate the bitmap that says which constant type we should load */
for (i = StartRegister; i < StartRegister + VectorNCount; ++i) {
This->updateStateBlock->changed.pixelShaderConstants[i] = TRUE;
This->updateStateBlock->set.pixelShaderConstants[i] = TRUE;
This->updateStateBlock->pixelShaderConstantT[i] = WINESHADERCNST_NONE;
TRACE("(%p) : Setting vsf %d\n", This, i);
}
return D3D_OK;
}
#undef SET_SHADER_CONSTANT
#undef GET_SHADER_CONSTANT
@ -6443,6 +6470,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_GetPixelShaderConstantI,
IWineD3DDeviceImpl_SetPixelShaderConstantF,
IWineD3DDeviceImpl_GetPixelShaderConstantF,
IWineD3DDeviceImpl_SetPixelShaderConstantN,
IWineD3DDeviceImpl_SetRenderState,
IWineD3DDeviceImpl_GetRenderState,
IWineD3DDeviceImpl_SetRenderTarget,
@ -6473,6 +6501,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_GetVertexShaderConstantI,
IWineD3DDeviceImpl_SetVertexShaderConstantF,
IWineD3DDeviceImpl_GetVertexShaderConstantF,
IWineD3DDeviceImpl_SetVertexShaderConstantN,
IWineD3DDeviceImpl_SetViewport,
IWineD3DDeviceImpl_GetViewport,
IWineD3DDeviceImpl_MultiplyTransform,

View File

@ -1743,9 +1743,11 @@ UINT numberOfvertices, UINT numberOfIndicies, GLenum glPrimType, const void *idx
/* Update the constants */
for (i = 0; i < WINED3D_VSHADER_MAX_CONSTANTS; i++) {
/* TODO: add support for Integer and Boolean constants */
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, &This->stateBlock->vertexShaderConstantF[i * 4]));
TRACE_(d3d_shader)("Loading constants %u = %f %f %f %f\n",i, This->stateBlock->vertexShaderConstantF[i *4 ], This->stateBlock->vertexShaderConstantF[i * 4 + 1], This->stateBlock->vertexShaderConstantF[i *4 + 2], This->stateBlock->vertexShaderConstantF[i * 4 + 3]);
checkGLcall("glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB");
if (WINESHADERCNST_FLOAT == This->stateBlock->vertexShaderConstantT[i]) {
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, &This->stateBlock->vertexShaderConstantF[i * 4]));
TRACE_(d3d_shader)("Loading constants %u = %f %f %f %f\n",i, This->stateBlock->vertexShaderConstantF[i *4 ], This->stateBlock->vertexShaderConstantF[i * 4 + 1], This->stateBlock->vertexShaderConstantF[i *4 + 2], This->stateBlock->vertexShaderConstantF[i * 4 + 3]);
checkGLcall("glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB");
}
}
/* TODO: Vertex Shader 8 constants*/

View File

@ -393,6 +393,9 @@ should really perform a delta so that only the changes get updated*/
case WINESHADERCNST_INTEGER:
IWineD3DDevice_SetVertexShaderConstantI(pDevice, i, This->vertexShaderConstantI + i * 4, 1);
break;
case WINESHADERCNST_NONE:
IWineD3DDevice_SetVertexShaderConstantN(pDevice, i, 1);
break;
}
}
}
@ -419,6 +422,9 @@ should really perform a delta so that only the changes get updated*/
case WINESHADERCNST_INTEGER:
IWineD3DDevice_SetPixelShaderConstantI(pDevice, i, This->pixelShaderConstantI + i * 4, 1);
break;
case WINESHADERCNST_NONE:
IWineD3DDevice_SetPixelShaderConstantN(pDevice, i, 1);
break;
}
}
}

View File

@ -888,9 +888,10 @@ typedef struct SAVEDSTATES {
} SAVEDSTATES;
typedef enum {
WINESHADERCNST_FLOAT = 0,
WINESHADERCNST_INTEGER = 1,
WINESHADERCNST_BOOL = 2
WINESHADERCNST_NONE = 0,
WINESHADERCNST_FLOAT = 1,
WINESHADERCNST_INTEGER = 2,
WINESHADERCNST_BOOL = 3
} WINESHADERCNST;
struct IWineD3DStateBlockImpl

View File

@ -332,6 +332,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister, int* pConstantData, UINT Vector4iCount) PURE;
STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) PURE;
STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister, float* pConstantData, UINT Vector4fCount) PURE;
STDMETHOD(SetPixelShaderConstantN)(THIS_ UINT StartRegister, UINT VectorNCount) PURE;
STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE;
STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD * pValue) PURE;
STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex, struct IWineD3DSurface* pRenderTarget) PURE;
@ -362,6 +363,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister, int* pConstantData, UINT Vector4iCount) PURE;
STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) PURE;
STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister, float* pConstantData, UINT Vector4fCount) PURE;
STDMETHOD(SetVertexShaderConstantN)(THIS_ UINT StartRegister, UINT VectorNCount) PURE;
STDMETHOD(SetViewport)(THIS_ CONST WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(GetViewport)(THIS_ WINED3DVIEWPORT * pViewport) PURE;
STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX * pMatrix) PURE;
@ -460,6 +462,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c)
#define IWineD3DDevice_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c)
#define IWineD3DDevice_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c)
#define IWineD3DDevice_SetPixelShaderConstantN(p,a,b) (p)->lpVtbl->SetPixelShaderConstantN(p,a,b)
#define IWineD3DDevice_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b)
#define IWineD3DDevice_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b)
#define IWineD3DDevice_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b)
@ -492,6 +495,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
#define IWineD3DDevice_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c)
#define IWineD3DDevice_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c)
#define IWineD3DDevice_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c)
#define IWineD3DDevice_SetVertexShaderConstantN(p,a,b) (p)->lpVtbl->SetVertexShaderConstantN(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_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b)