H. Verbeet : wined3d: A shader isn't guaranteed to have a vertex declaration, so

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 20 13:20:16 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 4bd8b60bd315a8c13cc8ba4c00f9d323ffed862c
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4bd8b60bd315a8c13cc8ba4c00f9d323ffed862c

Author: H. Verbeet <hverbeet at gmail.com>
Date:   Fri Jan 20 16:13:03 2006 +0100

wined3d: A shader isn't guaranteed to have a vertex declaration, so
add a NULL check for that.

---

 dlls/wined3d/drawprim.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

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-cvs mailing list