=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Record texture accesses for SM4 ld instruction.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 6 14:50:57 CST 2016


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Jan  5 21:52:31 2016 +0100

wined3d: Record texture accesses for SM4 ld instruction.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context.c         | 14 ++++++++++++--
 dlls/wined3d/shader.c          |  5 +++++
 dlls/wined3d/wined3d_private.h |  2 ++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 1e357e7..dabb5fd 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3112,6 +3112,7 @@ static void context_load_shader_resources(struct wined3d_context *context, const
 
 static void context_bind_shader_resources(struct wined3d_context *context, const struct wined3d_state *state)
 {
+    const struct wined3d_device *device = context->swapchain->device;
     const struct wined3d_gl_info *gl_info = context->gl_info;
     struct wined3d_shader_sampler_map_entry *entry;
     struct wined3d_shader_resource_view *view;
@@ -3119,6 +3120,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
     struct wined3d_texture *texture;
     struct wined3d_shader *shader;
     unsigned int i, j, count;
+    GLuint sampler_name;
 
     static const struct
     {
@@ -3161,7 +3163,15 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
                 continue;
             }
 
-            if (!(sampler = state->sampler[shader_types[i].type][entry->sampler_idx]))
+            if (entry->sampler_idx == WINED3D_SAMPLER_DEFAULT)
+            {
+                sampler_name = device->default_sampler;
+            }
+            else if ((sampler = state->sampler[shader_types[i].type][entry->sampler_idx]))
+            {
+                sampler_name = sampler->name;
+            }
+            else
             {
                 WARN("No sampler object bound at index %u, %u.\n", shader_types[i].type, entry->sampler_idx);
                 continue;
@@ -3171,7 +3181,7 @@ static void context_bind_shader_resources(struct wined3d_context *context, const
             context_active_texture(context, gl_info, shader_types[i].base_idx + entry->bind_idx);
             wined3d_texture_bind(texture, context, FALSE);
 
-            GL_EXTCALL(glBindSampler(shader_types[i].base_idx + entry->bind_idx, sampler->name));
+            GL_EXTCALL(glBindSampler(shader_types[i].base_idx + entry->bind_idx, sampler_name));
             checkGLcall("glBindSampler");
         }
     }
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 2837229..6aa5bd5 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1068,6 +1068,11 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
                 shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
                         ins.src[2].reg.idx[0].offset, reg_maps->sampler_map.count);
             }
+            else if (ins.handler_idx == WINED3DSIH_LD)
+            {
+                shader_record_sample(reg_maps, ins.src[1].reg.idx[0].offset,
+                        WINED3D_SAMPLER_DEFAULT, reg_maps->sampler_map.count);
+            }
 
             if (ins.predicate)
                 if (!shader_record_register_usage(shader, reg_maps, &ins.predicate->reg,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c591f7d..805e32e 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -597,6 +597,8 @@ struct wined3d_shader_resource_info
     enum wined3d_data_type data_type;
 };
 
+#define WINED3D_SAMPLER_DEFAULT ~0x0u
+
 struct wined3d_shader_sampler_map_entry
 {
     unsigned int resource_idx;




More information about the wine-cvs mailing list