[PATCH 4/5] wined3d: Move device_preload_textures into context.c
Stefan Dösinger
stefan at codeweavers.com
Fri Sep 13 05:40:35 CDT 2013
---
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 97e499c..215e05d 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 686b97f..2b3e5dd 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;
--
1.8.1.5
More information about the wine-patches
mailing list