Henri Verbeet : wined3d: Use slightly nicer loops in device_map_fixed_function_samplers().

Alexandre Julliard julliard at winehq.org
Fri Jan 2 08:25:34 CST 2009


Module: wine
Branch: master
Commit: 0657e8d87a6e5efb4b036a6daa2d79084c9e0d12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0657e8d87a6e5efb4b036a6daa2d79084c9e0d12

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Dec 31 16:57:10 2008 +0100

wined3d: Use slightly nicer loops in device_map_fixed_function_samplers().

---

 dlls/wined3d/device.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 06698f5..64dd866 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3671,13 +3671,16 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) {
 
 static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
     int i, tex;
+    WORD ffu_map;
 
     device_update_fixed_function_usage_map(This);
+    ffu_map = This->fixed_function_usage_map;
 
     if (This->max_ffp_textures == This->max_ffp_texture_stages ||
-        This->stateBlock->lowest_disabled_stage <= This->max_ffp_textures) {
-        for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) {
-            if (!(This->fixed_function_usage_map & (1 << i))) continue;
+            This->stateBlock->lowest_disabled_stage <= This->max_ffp_textures) {
+        for (i = 0; ffu_map; ffu_map >>= 1, ++i)
+        {
+            if (!(ffu_map & 1)) continue;
 
             if (This->texUnitMap[i] != i) {
                 device_map_stage(This, i, i);
@@ -3690,8 +3693,9 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
 
     /* Now work out the mapping */
     tex = 0;
-    for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) {
-        if (!(This->fixed_function_usage_map & (1 << i))) continue;
+    for (i = 0; ffu_map; ffu_map >>= 1, ++i)
+    {
+        if (!(ffu_map & 1)) continue;
 
         if (This->texUnitMap[i] != tex) {
             device_map_stage(This, i, tex);




More information about the wine-cvs mailing list