Henri Verbeet : wined3d: Simplify the transformed position fixup a bit.
Alexandre Julliard
julliard at winehq.org
Mon Jun 22 09:04:14 CDT 2009
Module: wine
Branch: master
Commit: 37491bb5d1f9bdb9b68929b6fe38114fe22674eb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=37491bb5d1f9bdb9b68929b6fe38114fe22674eb
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Jun 22 10:15:57 2009 +0200
wined3d: Simplify the transformed position fixup a bit.
---
dlls/wined3d/buffer.c | 26 +++++++-------------------
dlls/wined3d/directx.c | 9 ++++++---
2 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index e9f3ff6..8896db9 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -506,27 +506,15 @@ static inline void fixup_d3dcolor(DWORD *dst_color)
static inline void fixup_transformed_pos(float *p)
{
- float x, y, z, w;
-
- /* rhw conversion like in drawStridedSlow */
- if (p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps)))
- {
- x = p[0];
- y = p[1];
- z = p[2];
- w = 1.0;
- }
- else
+ /* rhw conversion like in position_float4(). */
+ if (p[3] != 1.0 && p[3] != 0.0)
{
- w = 1.0 / p[3];
- x = p[0] * w;
- y = p[1] * w;
- z = p[2] * w;
+ float w = 1.0 / p[3];
+ p[0] *= w;
+ p[1] *= w;
+ p[2] *= w;
+ p[3] = w;
}
- p[0] = x;
- p[1] = y;
- p[2] = z;
- p[3] = w;
}
const BYTE *buffer_get_memory(IWineD3DBuffer *iface, UINT offset, GLuint *buffer_object)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 28f07ef..df5d4cc 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4316,13 +4316,16 @@ static void WINE_GLAPI position_float4(const void *data)
{
const GLfloat *pos = data;
- if (pos[3] < eps && pos[3] > -eps)
- glVertex3fv(pos);
- else {
+ if (pos[3] != 0.0 && pos[3] != 1.0)
+ {
float w = 1.0 / pos[3];
glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
}
+ else
+ {
+ glVertex3fv(pos);
+ }
}
static void WINE_GLAPI diffuse_d3dcolor(const void *data)
More information about the wine-cvs
mailing list