Commit 59e0b841 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Move device_preload_textures into context.c.

parent 112617f0
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment