From de3b0dfffb6d346a5b869ad503cd9af76d3cc831 Mon Sep 17 00:00:00 2001 From: Jason Edmeades Date: Thu, 25 Sep 2003 20:22:21 +0000 Subject: [PATCH] The 'w' component is used more than just for the vertex, so we cannot do the projection mapping ourselves. Also tidy up a tracepoint, and preinitialize the shaders output as windows seems to. --- dlls/d3d8/directx.c | 2 +- dlls/d3d8/drawprim.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index 47667f35a25..d6d4fc6a3e7 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -1152,7 +1152,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, object->view_ident = 1; object->last_was_rhw = 0; - TRACE("(%p,%d) All defaults now set up, leaving CreateDevice\n", This, Adapter); + TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object); return D3D_OK; } diff --git a/dlls/d3d8/drawprim.c b/dlls/d3d8/drawprim.c index 342f52c8444..974353c7e17 100644 --- a/dlls/d3d8/drawprim.c +++ b/dlls/d3d8/drawprim.c @@ -623,9 +623,10 @@ void draw_vertex(LPDIRECT3DDEVICE8 iface, /* interf VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f\n", x,y,z)); glVertex3f(x, y, z); } else { - GLfloat w = 1.0f / rhw; + /* Cannot optimize by dividing through by rhw as rhw is required + later for perspective in the GL pipeline for vertex shaders */ VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f / rhw=%f\n", x,y,z,rhw)); - glVertex4f(x * w, y * w, z * w, 1.0f); + glVertex4f(x,y,z,rhw); } } } @@ -1189,7 +1190,7 @@ void drawStridedSlow(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd, glVertex3f(x, y, z); } else { VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f / rhw=%f\n", x,y,z,rhw)); - glVertex4f(x / rhw, y / rhw, z / rhw, 1.0f / rhw); + glVertex4f(x,y,z,rhw); } } @@ -1265,8 +1266,14 @@ void drawStridedSoftwareVS(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *s /* Fill the vertex shader input */ IDirect3DDeviceImpl_FillVertexShaderInput(This, vertex_shader, SkipnStrides); - /* Now execute the vertex shader */ + /* Initialize the output fields to the same defaults as it would normally have */ memset(&vertex_shader->output, 0, sizeof(VSHADEROUTPUTDATA8)); + vertex_shader->output.oD[0].x = 1.0; + vertex_shader->output.oD[0].y = 1.0; + vertex_shader->output.oD[0].z = 1.0; + vertex_shader->output.oD[0].w = 1.0; + + /* Now execute the vertex shader */ IDirect3DVertexShaderImpl_ExecuteSW(vertex_shader, &vertex_shader->input, &vertex_shader->output); /*