wined3d: Use slightly nicer loops in device_map_fixed_function_samplers().

Henri Verbeet hverbeet at codeweavers.com
Wed Dec 31 09:57:10 CST 2008


---
 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);
-- 
1.6.0.6



--------------090007060800030204060504--



More information about the wine-patches mailing list