wine/ dlls/wined3d/device.c dlls/wined3d/drawp ...

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 29 10:41:26 CST 2005


ChangeSet ID:	21550
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/29 10:41:26

Modified files:
	dlls/wined3d   : device.c drawprim.c stateblock.c 
	                 wined3d_private.h 
	include/wine   : wined3d_interface.h 

Log message:
	Oliver Stieber <oliver_stieber at yahoo.co.uk>
	Added support for vertex and pixel shader constants that have no type
	i.e. they haven't been set yet or are clear.

Patch: http://cvs.winehq.org/patch.py?id=21550

Old revision  New revision  Changes     Path
 1.101         1.102         +30 -1      wine/dlls/wined3d/device.c
 1.34          1.35          +5 -3       wine/dlls/wined3d/drawprim.c
 1.27          1.28          +6 -0       wine/dlls/wined3d/stateblock.c
 1.70          1.71          +4 -3       wine/dlls/wined3d/wined3d_private.h
 1.46          1.47          +4 -0       wine/include/wine/wined3d_interface.h

Index: wine/dlls/wined3d/device.c
diff -u -p wine/dlls/wined3d/device.c:1.101 wine/dlls/wined3d/device.c:1.102
--- wine/dlls/wined3d/device.c:1.101	29 Nov 2005 16:41:26 -0000
+++ wine/dlls/wined3d/device.c	29 Nov 2005 16:41:26 -0000
@@ -3899,10 +3899,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVer
     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_GetPix
     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_
     IWineD3DDeviceImpl_GetPixelShaderConstantI,
     IWineD3DDeviceImpl_SetPixelShaderConstantF,
     IWineD3DDeviceImpl_GetPixelShaderConstantF,
+    IWineD3DDeviceImpl_SetPixelShaderConstantN,
     IWineD3DDeviceImpl_SetRenderState,
     IWineD3DDeviceImpl_GetRenderState,
     IWineD3DDeviceImpl_SetRenderTarget,
@@ -6473,6 +6501,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_
     IWineD3DDeviceImpl_GetVertexShaderConstantI,
     IWineD3DDeviceImpl_SetVertexShaderConstantF,
     IWineD3DDeviceImpl_GetVertexShaderConstantF,
+    IWineD3DDeviceImpl_SetVertexShaderConstantN,
     IWineD3DDeviceImpl_SetViewport,
     IWineD3DDeviceImpl_GetViewport,
     IWineD3DDeviceImpl_MultiplyTransform,
Index: wine/dlls/wined3d/drawprim.c
diff -u -p wine/dlls/wined3d/drawprim.c:1.34 wine/dlls/wined3d/drawprim.c:1.35
--- wine/dlls/wined3d/drawprim.c:1.34	29 Nov 2005 16:41:26 -0000
+++ wine/dlls/wined3d/drawprim.c	29 Nov 2005 16:41:26 -0000
@@ -1743,9 +1743,11 @@ UINT numberOfvertices, UINT numberOfIndi
             /* 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*/
 
Index: wine/dlls/wined3d/stateblock.c
diff -u -p wine/dlls/wined3d/stateblock.c:1.27 wine/dlls/wined3d/stateblock.c:1.28
--- wine/dlls/wined3d/stateblock.c:1.27	29 Nov 2005 16:41:26 -0000
+++ wine/dlls/wined3d/stateblock.c	29 Nov 2005 16:41:26 -0000
@@ -393,6 +393,9 @@ should really perform a delta so that on
                 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 on
                 case WINESHADERCNST_INTEGER:
                     IWineD3DDevice_SetPixelShaderConstantI(pDevice, i, This->pixelShaderConstantI + i * 4, 1);
                 break;
+                case WINESHADERCNST_NONE:
+                    IWineD3DDevice_SetPixelShaderConstantN(pDevice, i, 1);
+                break;
                 }
             }
         }
Index: wine/dlls/wined3d/wined3d_private.h
diff -u -p wine/dlls/wined3d/wined3d_private.h:1.70 wine/dlls/wined3d/wined3d_private.h:1.71
--- wine/dlls/wined3d/wined3d_private.h:1.70	29 Nov 2005 16:41:26 -0000
+++ wine/dlls/wined3d/wined3d_private.h	29 Nov 2005 16:41:26 -0000
@@ -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
Index: wine/include/wine/wined3d_interface.h
diff -u -p wine/include/wine/wined3d_interface.h:1.46 wine/include/wine/wined3d_interface.h:1.47
--- wine/include/wine/wined3d_interface.h:1.46	29 Nov 2005 16:41:26 -0000
+++ wine/include/wine/wined3d_interface.h	29 Nov 2005 16:41:26 -0000
@@ -332,6 +332,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnkno
     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,IUnkno
     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,IUnkno
 #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,IUnkno
 #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)



More information about the wine-cvs mailing list