WINED3D: A wined3d shader isn' t guaranteed to have a vertex
declaration
H. Verbeet
hverbeet at gmail.com
Thu Jan 19 15:53:52 CST 2006
http://source.winehq.org/git/?p=wine.git;a=commit;h=7c482cb9a1a3d7b694700dd00095f2434ed682d1
added some d3d8 vertex shader support to wined3d. However, a wined3d
shader isn't guaranteed to have a vertex declaration, so in
drawPrimitiveDrawStrided we should check if
This->stateBlock->vertexShader has a non-NULL vertexDeclaration in the
first place before checking if that vertex declaration has a non-NULL
constants member.
Changelog:
- A wined3d shader isn' t guaranteed to have a vertex declaration.
so add a NULL check for that.
-------------- next part --------------
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index b856d55..eded7f9 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -1777,6 +1777,7 @@ UINT numberOfvertices, UINT numberOfIndi
if (useVertexShaderFunction) {
int i;
GLint errPos;
+ IWineD3DVertexDeclarationImpl *vertexDeclaration;
FIXME("Using vertex shader\n");
@@ -1790,11 +1791,14 @@ UINT numberOfvertices, UINT numberOfIndi
TRACE_(d3d_shader)("(%p) bound program %u and enabled vertex program ARB\n", This, ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->prgId);
/* Vertex Shader 8 constants */
- if (((IWineD3DVertexDeclarationImpl *)((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration)->constants != NULL) {
- float *constants = ((IWineD3DVertexDeclarationImpl *)((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration)->constants;
- for (i = 0; i <= WINED3D_VSHADER_MAX_CONSTANTS; i++) {
- TRACE_(d3d_shader)("Not Loading constants %u = %f %f %f %f\n", i, constants[i * 4], constants[i * 4 + 1], constants[i * 4 + 2], constants[i * 4 + 3]);
- GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, &constants[i * 4]));
+ vertexDeclaration = (IWineD3DVertexDeclarationImpl *)((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->vertexDeclaration;
+ if (vertexDeclaration != NULL) {
+ float *constants = vertexDeclaration->constants;
+ if (constants != NULL) {
+ for (i = 0; i <= WINED3D_VSHADER_MAX_CONSTANTS; i++) {
+ TRACE_(d3d_shader)("Not Loading constants %u = %f %f %f %f\n", i, constants[i * 4], constants[i * 4 + 1], constants[i * 4 + 2], constants[i * 4 + 3]);
+ GL_EXTCALL(glProgramEnvParameter4fvARB(GL_VERTEX_PROGRAM_ARB, i, &constants[i * 4]));
+ }
}
}
More information about the wine-patches
mailing list