[PATCH 1/5] wined3d: Set default texture units mapping for vertex shader samplers when possible.

Matteo Bruni mbruni at codeweavers.com
Sun Nov 8 13:25:08 CST 2015


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
This should fix the low water bug in World of Warships (bug 39347) for
drivers that support at least 20 combined texture units (e.g. D3D10+ GPUs
on Linux).

 dlls/wined3d/context.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 1692d0d..2b4bc1e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1507,19 +1507,31 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     }
 
     /* Initialize the texture unit mapping to a 1:1 mapping */
-    for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
+    for (s = 0; s < min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers); ++s)
     {
+        unsigned int v_s = s - gl_info->limits.fragment_samplers;
+
         if (s < gl_info->limits.fragment_samplers)
         {
             ret->tex_unit_map[s] = s;
             ret->rev_tex_unit_map[s] = s;
         }
+        else if (v_s < min(MAX_VERTEX_SAMPLERS, gl_info->limits.vertex_samplers))
+        {
+            ret->tex_unit_map[s] = s;
+            ret->rev_tex_unit_map[s] = s;
+        }
         else
         {
             ret->tex_unit_map[s] = WINED3D_UNMAPPED_STAGE;
             ret->rev_tex_unit_map[s] = WINED3D_UNMAPPED_STAGE;
         }
     }
+    for (; s < MAX_COMBINED_SAMPLERS; ++s)
+    {
+        ret->tex_unit_map[s] = WINED3D_UNMAPPED_STAGE;
+        ret->rev_tex_unit_map[s] = WINED3D_UNMAPPED_STAGE;
+    }
 
     if (!(hdc = GetDC(swapchain->win_handle)))
     {
-- 
2.4.10




More information about the wine-patches mailing list