=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Move device_preload_textures into context.c.

Alexandre Julliard julliard at winehq.org
Mon Sep 16 16:57:22 CDT 2013


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Sep 16 12:43:19 2013 +0200

wined3d: Move device_preload_textures into context.c.

---

 dlls/wined3d/context.c         |   50 +++++++++++++++++++++++++++++++++++++++-
 dlls/wined3d/device.c          |   47 -------------------------------------
 dlls/wined3d/wined3d_private.h |    1 -
 3 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index a6f27dc..4f8021c 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2787,6 +2787,54 @@ static void context_update_stream_info(struct wined3d_context *context, const st
 }
 
 /* Context activation is done by the caller. */
+static void context_preload_texture(struct wined3d_context *context,
+        const struct wined3d_state *state, unsigned int idx)
+{
+    struct wined3d_texture *texture;
+    enum WINED3DSRGB srgb;
+
+    if (!(texture = state->textures[idx]))
+        return;
+
+    srgb = state->sampler_states[idx][WINED3D_SAMP_SRGB_TEXTURE] ? SRGB_SRGB : SRGB_RGB;
+    texture->texture_ops->texture_preload(texture, context, srgb);
+}
+
+/* Context activation is done by the caller. */
+static void context_preload_textures(struct wined3d_context *context, const struct wined3d_state *state)
+{
+    unsigned int i;
+
+    if (use_vs(state))
+    {
+        for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
+        {
+            if (state->vertex_shader->reg_maps.sampler_type[i])
+                context_preload_texture(context, state, MAX_FRAGMENT_SAMPLERS + i);
+        }
+    }
+
+    if (use_ps(state))
+    {
+        for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
+        {
+            if (state->pixel_shader->reg_maps.sampler_type[i])
+                context_preload_texture(context, state, i);
+        }
+    }
+    else
+    {
+        WORD ffu_map = context->fixed_function_usage_map;
+
+        for (i = 0; ffu_map; ffu_map >>= 1, ++i)
+        {
+            if (ffu_map & 1)
+                context_preload_texture(context, state, i);
+        }
+    }
+}
+
+/* Context activation is done by the caller. */
 BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device)
 {
     const struct wined3d_state *state = &device->state;
@@ -2807,7 +2855,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
      * result in changes to the current FBO, due to using e.g. FBO blits for
      * updating a resource location. */
     context_update_tex_unit_map(context, state);
-    device_preload_textures(device, context);
+    context_preload_textures(context, state);
     if (isStateDirty(context, STATE_VDECL) || isStateDirty(context, STATE_STREAMSRC))
         context_update_stream_info(context, state);
     if (state->index_buffer)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6e122f9..30dcc06 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -134,53 +134,6 @@ static enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_t
     }
 }
 
-/* Context activation is done by the caller. */
-static void device_preload_texture(const struct wined3d_state *state,
-        struct wined3d_context *context, unsigned int idx)
-{
-    struct wined3d_texture *texture;
-    enum WINED3DSRGB srgb;
-
-    if (!(texture = state->textures[idx])) return;
-    srgb = state->sampler_states[idx][WINED3D_SAMP_SRGB_TEXTURE] ? SRGB_SRGB : SRGB_RGB;
-    texture->texture_ops->texture_preload(texture, context, srgb);
-}
-
-/* Context activation is done by the caller. */
-void device_preload_textures(const struct wined3d_device *device, struct wined3d_context *context)
-{
-    const struct wined3d_state *state = &device->state;
-    unsigned int i;
-
-    if (use_vs(state))
-    {
-        for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
-        {
-            if (state->vertex_shader->reg_maps.sampler_type[i])
-                device_preload_texture(state, context, MAX_FRAGMENT_SAMPLERS + i);
-        }
-    }
-
-    if (use_ps(state))
-    {
-        for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
-        {
-            if (state->pixel_shader->reg_maps.sampler_type[i])
-                device_preload_texture(state, context, i);
-        }
-    }
-    else
-    {
-        WORD ffu_map = context->fixed_function_usage_map;
-
-        for (i = 0; ffu_map; ffu_map >>= 1, ++i)
-        {
-            if (ffu_map & 1)
-                device_preload_texture(state, context, i);
-        }
-    }
-}
-
 BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context)
 {
     struct wined3d_context **new_array;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 065183a..9b1ba42 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1952,7 +1952,6 @@ void device_context_remove(struct wined3d_device *device, struct wined3d_context
 HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
         UINT adapter_idx, enum wined3d_device_type device_type, HWND focus_window, DWORD flags,
         BYTE surface_alignment, struct wined3d_device_parent *device_parent) DECLSPEC_HIDDEN;
-void device_preload_textures(const struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
         UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
 void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list