[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-patches
Subject:    [1/5] wined3d: Add double to float conversion casts in device.c
From:       Stefan_Dösinger <stefan () codeweavers ! com>
Date:       2010-07-31 6:45:14
Message-ID: 0936B897-C92D-4E3B-B384-0608D8C97E0C () codeweavers ! com
[Download RAW message or body]

["0002-WineD3D-Add-double-to-float-conversion-casts-in-devi.patch" (0002-WineD3D-Add-double-to-float-conversion-casts-in-devi.patch)]

From 2c04627ae1ac86704aca621636ab3ef86eaad803 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 30 Jul 2010 06:44:49 +0200
Subject: [PATCH 02/13] WineD3D: Add double to float conversion casts in device.c

These are again situations where the APIs force us to convert doubles to floats.
OpenGL uses doubles for the clipplanes, so we're storing them as doubles for
easier GL uploading. D3D uses floats.

M_PI is apparently a double, causing another data loss warning. I'm casting
the final result to keep the extra precision in the calculation.
---
 dlls/wined3d/device.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index f18b477..2f73c0b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2611,7 +2611,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
         {
             object->exponent = 128.0f;
         }
-        object->cutoff = pLight->Phi*90/M_PI;
+        object->cutoff = (float) (pLight->Phi*90/M_PI);
 
         /* FIXME: Range */
         break;
@@ -2814,10 +2814,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO
         return WINED3DERR_INVALIDCALL;
     }
 
-    pPlane[0] = This->stateBlock->clipplane[Index][0];
-    pPlane[1] = This->stateBlock->clipplane[Index][1];
-    pPlane[2] = This->stateBlock->clipplane[Index][2];
-    pPlane[3] = This->stateBlock->clipplane[Index][3];
+    pPlane[0] = (float) This->stateBlock->clipplane[Index][0];
+    pPlane[1] = (float) This->stateBlock->clipplane[Index][1];
+    pPlane[2] = (float) This->stateBlock->clipplane[Index][2];
+    pPlane[3] = (float) This->stateBlock->clipplane[Index][3];
     return WINED3D_OK;
 }
 
-- 
1.6.4.4





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic