[dx8 patch 13]: vshader + nvidia compil fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Changelog
  - defer of IDirect3DVertexShader_SetConstant, waiting for DrawPrimitive
call. It's the beginning of fixes for vertex shader samples at
http://www.shaderx.com/direct3d.net/tutorials/shader/shader2.html who calls
SetConstants before SetVertexShader ;(
  - Beginning of VertexShader constants support into stateblock (only stored,
not captured yet)
  - fix compiation with nivdia GL/gl.h and mesa Gl/glext headers as reported
by Andrew John Hughes
  - one glActiveTexture/glActiveTextureARB missing

Raphael
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+NxgVp7NA3AmQTU4RAs+NAJsH7idQ0Z046+kDbraTgAZnZUZIsACeOcFQ
qyIZlWZ4J9i33ceRmESU9vA=
=psEs
- -----END PGP SIGNATURE-----


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+NxuYp7NA3AmQTU4RAitjAKCE6TmKEgk4ZIynCz+o2a5MvkPODwCfYTbE
+Su/njy41O8ATvQfhKUppj4=
=oZOy
-----END PGP SIGNATURE-----
? dx8-13.patch
Index: d3d8_private.h
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/d3d8_private.h,v
retrieving revision 1.14
diff -u -r1.14 d3d8_private.h
--- d3d8_private.h	28 Jan 2003 01:12:23 -0000	1.14
+++ d3d8_private.h	28 Jan 2003 23:45:01 -0000
@@ -876,6 +876,7 @@
         BOOL                      transform[HIGHEST_TRANSFORMSTATE];
         BOOL                      viewport;
         BOOL                      vertexShader;
+        BOOL                      vertexShaderConstant;
         BOOL                      vertexShaderDecl;
         BOOL                      pixelShader;
         BOOL                      renderstate[HIGHEST_RENDER_STATE];
@@ -946,7 +947,6 @@
   
   /* Vertex Shader */
   DWORD                     VertexShader;
-  /* TODO: Vertex Shader Constant */
 
   /* Vertex Shader Declaration */
   IDirect3DVertexShaderDeclarationImpl* vertexShaderDecl;
@@ -958,6 +958,9 @@
   /* Indexed Vertex Blending */
   D3DVERTEXBLENDFLAGS       vertex_blend;
   FLOAT                     tween_factor;
+
+  /* Vertex Shader Constant */
+  D3DSHADERVECTOR           vertexShaderConstant[D3D8_VSHADER_MAX_CONSTANTS];
 };
 
 /* exported Interfaces */
Index: device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.35
diff -u -r1.35 device.c
--- device.c	28 Jan 2003 01:12:23 -0000	1.35
+++ device.c	28 Jan 2003 23:45:13 -0000
@@ -31,7 +31,7 @@
 #include "wine/debug.h"
 
 /** define  GL_GLEXT_PROTOTYPES for having extensions prototypes defined */
-#define GL_GLEXT_PROTOTYPES
+/*#define GL_GLEXT_PROTOTYPES*/
 #include "d3d8_private.h"
 
 /** currently desactiving 1_4 support as mesa doesn't implement all 1_4 support while defining it */
@@ -119,6 +119,13 @@
       fvf = (D3DFORMAT) This->UpdateStateBlock->vertexShaderDecl->fvf;
       TRACE("vertex shader declared FVF: %lx\n", This->UpdateStateBlock->vertexShaderDecl->fvf);
       memset(&vertex_shader->input, 0, sizeof(VSHADERINPUTDATA8));
+
+      /** init Constants */
+      if (TRUE == This->UpdateStateBlock->Changed.vertexShaderConstant) {
+	TRACE("vertex shader init Constant\n");
+	IDirect3DVertexShaderImpl_SetConstantF(vertex_shader, 0, (CONST FLOAT*) &This->UpdateStateBlock->vertexShaderConstant[0], 96);
+      }
+
     }
 
     {
@@ -451,7 +458,7 @@
 
 		    memset(&vertex_shader->output, 0, sizeof(VSHADEROUTPUTDATA8));
                     IDirect3DVertexShaderImpl_ExecuteSW(vertex_shader, &vertex_shader->input, &vertex_shader->output);
-                    
+                    /*
                     TRACE_VECTOR(vertex_shader->output.oPos);
                     TRACE_VECTOR(vertex_shader->output.oD[0]);
 		    TRACE_VECTOR(vertex_shader->output.oD[1]);
@@ -462,7 +469,11 @@
 		    TRACE_VECTOR(vertex_shader->data->C[1]);
 		    TRACE_VECTOR(vertex_shader->data->C[2]);
 		    TRACE_VECTOR(vertex_shader->data->C[3]);
-                    /**/
+		    TRACE_VECTOR(vertex_shader->data->C[4]);
+		    TRACE_VECTOR(vertex_shader->data->C[5]);
+		    TRACE_VECTOR(vertex_shader->data->C[6]);
+		    TRACE_VECTOR(vertex_shader->data->C[7]);
+                    */
 		    x = vertex_shader->output.oPos.x;
                     y = vertex_shader->output.oPos.y;
                     z = vertex_shader->output.oPos.z;
@@ -3141,8 +3152,14 @@
     /* Make appropriate texture active */
     TRACE("Activating appropriate texture state %ld\n", Stage);
     if (This->isMultiTexture) {
+#if defined(GL_VERSION_1_3)
+        glActiveTexture(GL_TEXTURE0 + Stage);
+        checkGLcall("glActiveTexture");
+#else
         glActiveTextureARB(GL_TEXTURE0_ARB + Stage);
         checkGLcall("glActiveTextureARB");
+#endif
+
     } else if (Stage>0) {
         FIXME("Program using multiple concurrent textures which this opengl implementation doesnt support\n");
     }
@@ -3700,43 +3717,41 @@
 
 HRESULT  WINAPI  IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, CONST void* pConstantData, DWORD ConstantCount) {
   ICOM_THIS(IDirect3DDevice8Impl,iface);
-  IDirect3DVertexShaderImpl* object;
-  DWORD Handle = This->UpdateStateBlock->VertexShader;
 
   if (Register + ConstantCount > D3D8_VSHADER_MAX_CONSTANTS) {
+    /*ERR("(%p) : SetVertexShaderConstant C[%lu] invalid\n", This, Register);*/
     return D3DERR_INVALIDCALL;
   }
-  object = VERTEX_SHADER(Handle);
-  if (NULL == object || NULL == pConstantData) {
+  if (NULL == pConstantData) {
     return D3DERR_INVALIDCALL;
   }
   if (ConstantCount > 1) {
     FLOAT* f = (FLOAT*)pConstantData;
     UINT i;
-    FIXME("(%p) : SetVertexShaderConstant %p, C[%lu..%lu]=\n", This, object, Register, Register + ConstantCount - 1);
+    FIXME("(%p) : SetVertexShaderConstant C[%lu..%lu]=\n", This, Register, Register + ConstantCount - 1);
     for (i = 0; i < ConstantCount; ++i) {
       DPRINTF("{%f, %f, %f, %f}\n", f[0], f[1], f[2], f[3]);
       f += 4;
     }
   } else { 
     FLOAT* f = (FLOAT*)pConstantData;
-    FIXME("(%p) : SetVertexShaderConstant %p, C[%lu]={%f, %f, %f, %f}\n", This, object, Register, f[0], f[1], f[2], f[3]);
+    FIXME("(%p) : SetVertexShaderConstant, C[%lu]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]);
   }
-  return IDirect3DVertexShaderImpl_SetConstantF(object, Register, pConstantData, ConstantCount);
+  This->UpdateStateBlock->Changed.vertexShaderConstant = TRUE;
+  memcpy(&This->UpdateStateBlock->vertexShaderConstant[Register], pConstantData, ConstantCount * 4 * sizeof(FLOAT));
+  return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, void* pConstantData, DWORD ConstantCount) {
   ICOM_THIS(IDirect3DDevice8Impl,iface);
-  IDirect3DVertexShaderImpl* object;
-  DWORD Handle = This->UpdateStateBlock->VertexShader;
 
   if (Register + ConstantCount > D3D8_VSHADER_MAX_CONSTANTS) {
     return D3DERR_INVALIDCALL;
   }
-  object = VERTEX_SHADER(Handle);
-  if (NULL == object || NULL == pConstantData) {
+  if (NULL == pConstantData) {
     return D3DERR_INVALIDCALL;
   }
-  return IDirect3DVertexShaderImpl_GetConstantF(object, Register, pConstantData, ConstantCount);
+  memcpy(pConstantData, &This->UpdateStateBlock->vertexShaderConstant[Register], ConstantCount * 4 * sizeof(FLOAT));
+  return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_GetVertexShaderDeclaration(LPDIRECT3DDEVICE8 iface, DWORD Handle, void* pData, DWORD* pSizeOfData) {
   /*ICOM_THIS(IDirect3DDevice8Impl,iface);*/
Index: directx.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/directx.c,v
retrieving revision 1.16
diff -u -r1.16 directx.c
--- directx.c	28 Jan 2003 01:12:23 -0000	1.16
+++ directx.c	28 Jan 2003 23:45:15 -0000
@@ -574,7 +574,7 @@
 
     glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
     object->maxLights = min(MAX_ACTIVE_LIGHTS, gl_max);
-    TRACE("Lights support - max lights =%d\n", gl_max);
+    TRACE("Lights support - max lights=%d\n", gl_max);
 
     /* Parse the gl supported features, in theory enabling parts of our code appropriately */
     GL_Extensions = glGetString(GL_EXTENSIONS);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux