From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/state.c | 9 ++------- dlls/wined3d/texture.c | 9 +++++++-- 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 6eaec9acb55..a858120df7d 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3469,8 +3469,7 @@ static enum wined3d_texture_address wined3d_texture_gl_address_mode(const struct }
static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc, - const struct wined3d_context_gl *context_gl, const uint32_t *sampler_states, - const struct wined3d_texture_gl *texture_gl) + const uint32_t *sampler_states, const struct wined3d_texture_gl *texture_gl) { union { @@ -3518,11 +3517,7 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc }
if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2) - { desc->mip_filter = WINED3D_TEXF_NONE; - if (context_gl->gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) - desc->min_filter = WINED3D_TEXF_POINT; - } }
/* Enabling and disabling texture dimensions is done by texture stage state / @@ -3557,7 +3552,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state struct wined3d_sampler *sampler; struct wine_rb_entry *entry;
- wined3d_sampler_desc_from_sampler_states(&desc, context_gl, sampler_states, texture_gl); + wined3d_sampler_desc_from_sampler_states(&desc, sampler_states, texture_gl);
wined3d_texture_gl_bind(texture_gl, context_gl, srgb);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 08e95db10f5..56593a34432 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1466,9 +1466,14 @@ void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl if (sampler_desc->min_filter != gl_tex->sampler_desc.min_filter || sampler_desc->mip_filter != gl_tex->sampler_desc.mip_filter) { + enum wined3d_texture_filter_type min_filter = sampler_desc->min_filter; + + if (gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) + min_filter = WINED3D_TEXF_POINT; + gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_MIN_FILTER, - wined3d_gl_min_mip_filter(sampler_desc->min_filter, sampler_desc->mip_filter)); - gl_tex->sampler_desc.min_filter = sampler_desc->min_filter; + wined3d_gl_min_mip_filter(min_filter, sampler_desc->mip_filter)); + gl_tex->sampler_desc.min_filter = min_filter; gl_tex->sampler_desc.mip_filter = sampler_desc->mip_filter; }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/state.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index a858120df7d..3f9d09b504d 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3451,7 +3451,7 @@ static void sampler_texmatrix(struct wined3d_context *context, const struct wine } }
-static enum wined3d_texture_address wined3d_texture_gl_address_mode(const struct wined3d_texture_gl *texture_gl, +static enum wined3d_texture_address wined3d_texture_address_mode(const struct wined3d_texture *texture, enum wined3d_texture_address t) { if (t < WINED3D_TADDRESS_WRAP || t > WINED3D_TADDRESS_MIRROR_ONCE) @@ -3461,15 +3461,15 @@ static enum wined3d_texture_address wined3d_texture_gl_address_mode(const struct }
/* Cubemaps are always set to clamp, regardless of the sampler state. */ - if (texture_gl->target == GL_TEXTURE_CUBE_MAP_ARB || ((texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2) - && t == WINED3D_TADDRESS_WRAP)) + if ((texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP) + || ((texture->flags & WINED3D_TEXTURE_COND_NP2) && t == WINED3D_TADDRESS_WRAP)) return WINED3D_TADDRESS_CLAMP;
return t; }
static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc, - const uint32_t *sampler_states, const struct wined3d_texture_gl *texture_gl) + const uint32_t *sampler_states, const struct wined3d_texture *texture) { union { @@ -3477,9 +3477,9 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc DWORD d; } lod_bias;
- desc->address_u = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_U]); - desc->address_v = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_V]); - desc->address_w = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_W]); + desc->address_u = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_U]); + desc->address_v = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_V]); + desc->address_w = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_W]); wined3d_color_from_d3dcolor((struct wined3d_color *)desc->border_color, sampler_states[WINED3D_SAMP_BORDER_COLOR]); if (sampler_states[WINED3D_SAMP_MAG_FILTER] > WINED3D_TEXF_ANISOTROPIC) @@ -3503,20 +3503,20 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC && sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC && sampler_states[WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_ANISOTROPIC) - || (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2)) + || (texture->flags & WINED3D_TEXTURE_COND_NP2)) desc->max_anisotropy = 1; - desc->compare = texture_gl->t.resource.format_caps & WINED3D_FORMAT_CAP_SHADOW; + desc->compare = texture->resource.format_caps & WINED3D_FORMAT_CAP_SHADOW; desc->comparison_func = WINED3D_CMP_LESSEQUAL; desc->srgb_decode = is_srgb_enabled(sampler_states);
- if (!(texture_gl->t.resource.format_caps & WINED3D_FORMAT_CAP_FILTERING)) + if (!(texture->resource.format_caps & WINED3D_FORMAT_CAP_FILTERING)) { desc->mag_filter = WINED3D_TEXF_POINT; desc->min_filter = WINED3D_TEXF_POINT; desc->mip_filter = WINED3D_TEXF_NONE; }
- if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2) + if (texture->flags & WINED3D_TEXTURE_COND_NP2) desc->mip_filter = WINED3D_TEXF_NONE; }
@@ -3552,7 +3552,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state struct wined3d_sampler *sampler; struct wine_rb_entry *entry;
- wined3d_sampler_desc_from_sampler_states(&desc, sampler_states, texture_gl); + wined3d_sampler_desc_from_sampler_states(&desc, sampler_states, &texture_gl->t);
wined3d_texture_gl_bind(texture_gl, context_gl, srgb);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/context_gl.c | 2 +- dlls/wined3d/sampler.c | 14 +++----------- dlls/wined3d/state.c | 10 +++++++++- dlls/wined3d/texture.c | 6 +++--- dlls/wined3d/view.c | 2 +- dlls/wined3d/wined3d_gl.h | 1 - 6 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index a55365cdf12..566dea5b9a5 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -5914,7 +5914,7 @@ static void apply_texture_blit_state(const struct wined3d_gl_info *gl_info, stru texture->sampler_desc.address_u = WINED3D_TADDRESS_CLAMP; texture->sampler_desc.address_v = WINED3D_TADDRESS_CLAMP; texture->sampler_desc.srgb_decode = FALSE; - texture->base_level = level; + texture->sampler_desc.mip_base_level = level; }
/* Context activation is done by the caller. */ diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index e93ab18f436..cebb7400631 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -307,24 +307,16 @@ static void texture_gl_apply_base_level(struct wined3d_texture_gl *texture_gl, const struct wined3d_sampler_desc *desc, const struct wined3d_gl_info *gl_info) { struct gl_texture *gl_tex; - unsigned int base_level; - - if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2) - base_level = 0; - else if (desc->mip_filter == WINED3D_TEXF_NONE) - base_level = texture_gl->t.lod; - else - base_level = min(max(desc->mip_base_level, texture_gl->t.lod), texture_gl->t.level_count - 1);
gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB); - if (base_level != gl_tex->base_level) + if (desc->mip_base_level != gl_tex->sampler_desc.mip_base_level) { /* Note that WINED3D_SAMP_MAX_MIP_LEVEL specifies the largest mipmap * (default 0), while GL_TEXTURE_MAX_LEVEL specifies the smallest * mipmap used (default 1000). So WINED3D_SAMP_MAX_MIP_LEVEL * corresponds to GL_TEXTURE_BASE_LEVEL. */ - gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, base_level); - gl_tex->base_level = base_level; + gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, desc->mip_base_level); + gl_tex->sampler_desc.mip_base_level = desc->mip_base_level; } }
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 3f9d09b504d..8005e62b79b 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3498,7 +3498,15 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc desc->lod_bias = lod_bias.f; desc->min_lod = -1000.0f; desc->max_lod = 1000.0f; - desc->mip_base_level = sampler_states[WINED3D_SAMP_MAX_MIP_LEVEL]; + + /* The LOD is already clamped to texture->level_count in wined3d_texture_set_lod(). */ + if (texture->flags & WINED3D_TEXTURE_COND_NP2) + desc->mip_base_level = 0; + else if (desc->mip_filter == WINED3D_TEXF_NONE) + desc->mip_base_level = texture->lod; + else + desc->mip_base_level = min(max(sampler_states[WINED3D_SAMP_MAX_MIP_LEVEL], texture->lod), texture->level_count - 1); + desc->max_anisotropy = sampler_states[WINED3D_SAMP_MAX_ANISOTROPY]; if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC && sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 56593a34432..82d1fe3cda5 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1319,7 +1319,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, gl_tex->sampler_desc.srgb_decode = TRUE; else gl_tex->sampler_desc.srgb_decode = srgb; - gl_tex->base_level = 0; + gl_tex->sampler_desc.mip_base_level = 0; wined3d_texture_set_dirty(&texture_gl->t);
wined3d_context_gl_bind_texture(context_gl, target, gl_tex->name); @@ -1762,8 +1762,8 @@ unsigned int CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, unsi wined3d_resource_wait_idle(resource); texture->lod = lod;
- wined3d_texture_gl(texture)->texture_rgb.base_level = ~0u; - wined3d_texture_gl(texture)->texture_srgb.base_level = ~0u; + wined3d_texture_gl(texture)->texture_rgb.sampler_desc.mip_base_level = ~0u; + wined3d_texture_gl(texture)->texture_srgb.sampler_desc.mip_base_level = ~0u; if (resource->bind_count) wined3d_device_context_emit_set_sampler_state(&device->cs->c, texture->sampler, WINED3D_SAMP_MAX_MIP_LEVEL, device->cs->c.state->sampler_states[texture->sampler][WINED3D_SAMP_MAX_MIP_LEVEL]); diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index aa07625eb8a..5729d5909e6 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -1350,7 +1350,7 @@ void wined3d_shader_resource_view_gl_generate_mipmap(struct wined3d_shader_resou
if (!view_gl->gl_view.name) { - gl_tex->base_level = base_level; + gl_tex->sampler_desc.mip_base_level = base_level; gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1); } diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index ceb534a10a4..0acf1e4c5f0 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -942,7 +942,6 @@ static inline void wined3d_context_gl_reference_buffer(struct wined3d_context_gl struct gl_texture { struct wined3d_sampler_desc sampler_desc; - unsigned int base_level; GLuint name; };
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/context.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index f9af58936a6..cc583fc8d26 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -353,18 +353,22 @@ static bool is_resource_rtv_bound(const struct wined3d_state *state,
/* Context activation is done by the caller. */ static void context_preload_texture(struct wined3d_context *context, - const struct wined3d_state *state, unsigned int idx) + const struct wined3d_state *state, enum wined3d_shader_type shader_type, unsigned int idx) { struct wined3d_texture *texture; + unsigned int texture_idx = idx;
- if (!(texture = state->textures[idx])) + if (shader_type == WINED3D_SHADER_TYPE_VERTEX) + texture_idx += WINED3D_VERTEX_SAMPLER_OFFSET; + + if (!(texture = state->textures[texture_idx])) return;
if (is_resource_rtv_bound(state, &texture->resource) || (state->fb.depth_stencil && state->fb.depth_stencil->resource == &texture->resource)) context->uses_fbo_attached_resources = 1;
- wined3d_texture_load(texture, context, is_srgb_enabled(state->sampler_states[idx])); + wined3d_texture_load(texture, context, is_srgb_enabled(state->sampler_states[texture_idx])); }
/* Context activation is done by the caller. */ @@ -377,7 +381,7 @@ void context_preload_textures(struct wined3d_context *context, const struct wine for (i = 0; i < WINED3D_MAX_VERTEX_SAMPLERS; ++i) { if (state->shader[WINED3D_SHADER_TYPE_VERTEX]->reg_maps.resource_info[i].type) - context_preload_texture(context, state, WINED3D_MAX_FRAGMENT_SAMPLERS + i); + context_preload_texture(context, state, WINED3D_SHADER_TYPE_VERTEX, i); } }
@@ -386,7 +390,7 @@ void context_preload_textures(struct wined3d_context *context, const struct wine for (i = 0; i < WINED3D_MAX_FRAGMENT_SAMPLERS; ++i) { if (state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.resource_info[i].type) - context_preload_texture(context, state, i); + context_preload_texture(context, state, WINED3D_SHADER_TYPE_PIXEL, i); } } else @@ -396,7 +400,7 @@ void context_preload_textures(struct wined3d_context *context, const struct wine while (ffu_map) { i = wined3d_bit_scan(&ffu_map); - context_preload_texture(context, state, i); + context_preload_texture(context, state, WINED3D_SHADER_TYPE_PIXEL, i); } } }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/stateblock.c | 3 +++ dlls/wined3d/wined3d_private.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 6ce17311595..3972ba0abba 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2207,6 +2207,9 @@ HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, const str return hr; }
+ if (type == WINED3D_SBT_PRIMARY) + device->primary_stateblock = object; + TRACE("Created stateblock %p.\n", object); *stateblock = object;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0b72bf298e2..3d75660ad05 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3005,11 +3005,12 @@ struct wined3d_device struct wined3d_sampler *default_sampler; struct wined3d_sampler *null_sampler;
- /* Command stream */ struct wined3d_cs *cs;
struct wined3d_buffer *push_constants[WINED3D_PUSH_CONSTANTS_COUNT];
+ struct wined3d_stateblock *primary_stateblock; + /* Context management */ struct wined3d_context **contexts; UINT context_count;
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/wined3d/context.c | 2 +- dlls/wined3d/cs.c | 40 ++------- dlls/wined3d/sampler.c | 4 - dlls/wined3d/state.c | 110 ++--------------------- dlls/wined3d/stateblock.c | 155 ++++++++++++++++++++++++++++----- dlls/wined3d/texture.c | 10 +-- dlls/wined3d/wined3d_private.h | 18 +--- 7 files changed, 153 insertions(+), 186 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index cc583fc8d26..ce3c18be4f1 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -368,7 +368,7 @@ static void context_preload_texture(struct wined3d_context *context, || (state->fb.depth_stencil && state->fb.depth_stencil->resource == &texture->resource)) context->uses_fbo_attached_resources = 1;
- wined3d_texture_load(texture, context, is_srgb_enabled(state->sampler_states[texture_idx])); + wined3d_texture_load(texture, context, state->sampler[shader_type][idx]->desc.srgb_decode); }
/* Context activation is done by the caller. */ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index aa011ea7714..3004f308843 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -114,7 +114,6 @@ enum wined3d_cs_op WINED3D_CS_OP_SET_DEPTH_BOUNDS, WINED3D_CS_OP_SET_RENDER_STATE, WINED3D_CS_OP_SET_TEXTURE_STATE, - WINED3D_CS_OP_SET_SAMPLER_STATE, WINED3D_CS_OP_SET_TRANSFORM, WINED3D_CS_OP_SET_CLIP_PLANE, WINED3D_CS_OP_SET_COLOR_KEY, @@ -365,14 +364,6 @@ struct wined3d_cs_set_texture_state DWORD value; };
-struct wined3d_cs_set_sampler_state -{ - enum wined3d_cs_op opcode; - UINT sampler_idx; - enum wined3d_sampler_state state; - DWORD value; -}; - struct wined3d_cs_set_transform { enum wined3d_cs_op opcode; @@ -604,7 +595,6 @@ static const char *debug_cs_op(enum wined3d_cs_op op) WINED3D_TO_STR(WINED3D_CS_OP_SET_DEPTH_BOUNDS); WINED3D_TO_STR(WINED3D_CS_OP_SET_RENDER_STATE); WINED3D_TO_STR(WINED3D_CS_OP_SET_TEXTURE_STATE); - WINED3D_TO_STR(WINED3D_CS_OP_SET_SAMPLER_STATE); WINED3D_TO_STR(WINED3D_CS_OP_SET_TRANSFORM); WINED3D_TO_STR(WINED3D_CS_OP_SET_CLIP_PLANE); WINED3D_TO_STR(WINED3D_CS_OP_SET_COLOR_KEY); @@ -1649,8 +1639,15 @@ static void wined3d_cs_exec_set_samplers(struct wined3d_cs *cs, const void *data unsigned int i;
for (i = 0; i < op->count; ++i) + { cs->state.sampler[op->type][op->start_idx + i] = op->samplers[i];
+ if (op->type == WINED3D_SHADER_TYPE_PIXEL && i < WINED3D_MAX_FRAGMENT_SAMPLERS) + device_invalidate_state(cs->c.device, STATE_SAMPLER(i)); + else if (op->type == WINED3D_SHADER_TYPE_VERTEX && i < WINED3D_MAX_VERTEX_SAMPLERS) + device_invalidate_state(cs->c.device, STATE_SAMPLER(WINED3D_VERTEX_SAMPLER_OFFSET + i)); + } + if (op->type != WINED3D_SHADER_TYPE_COMPUTE) device_invalidate_state(cs->c.device, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); else @@ -1845,28 +1842,6 @@ void wined3d_device_context_emit_set_texture_state(struct wined3d_device_context wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); }
-static void wined3d_cs_exec_set_sampler_state(struct wined3d_cs *cs, const void *data) -{ - const struct wined3d_cs_set_sampler_state *op = data; - - cs->state.sampler_states[op->sampler_idx][op->state] = op->value; - device_invalidate_state(cs->c.device, STATE_SAMPLER(op->sampler_idx)); -} - -void wined3d_device_context_emit_set_sampler_state(struct wined3d_device_context *context, unsigned int sampler_idx, - enum wined3d_sampler_state state, unsigned int value) -{ - struct wined3d_cs_set_sampler_state *op; - - op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); - op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE; - op->sampler_idx = sampler_idx; - op->state = state; - op->value = value; - - wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); -} - static void wined3d_cs_exec_set_transform(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_set_transform *op = data; @@ -2918,7 +2893,6 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_SET_DEPTH_BOUNDS */ wined3d_cs_exec_set_depth_bounds, /* WINED3D_CS_OP_SET_RENDER_STATE */ wined3d_cs_exec_set_render_state, /* WINED3D_CS_OP_SET_TEXTURE_STATE */ wined3d_cs_exec_set_texture_state, - /* WINED3D_CS_OP_SET_SAMPLER_STATE */ wined3d_cs_exec_set_sampler_state, /* WINED3D_CS_OP_SET_TRANSFORM */ wined3d_cs_exec_set_transform, /* WINED3D_CS_OP_SET_CLIP_PLANE */ wined3d_cs_exec_set_clip_plane, /* WINED3D_CS_OP_SET_COLOR_KEY */ wined3d_cs_exec_set_color_key, diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index cebb7400631..afd26a527f9 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -311,10 +311,6 @@ static void texture_gl_apply_base_level(struct wined3d_texture_gl *texture_gl, gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB); if (desc->mip_base_level != gl_tex->sampler_desc.mip_base_level) { - /* Note that WINED3D_SAMP_MAX_MIP_LEVEL specifies the largest mipmap - * (default 0), while GL_TEXTURE_MAX_LEVEL specifies the smallest - * mipmap used (default 1000). So WINED3D_SAMP_MAX_MIP_LEVEL - * corresponds to GL_TEXTURE_BASE_LEVEL. */ gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, desc->mip_base_level); gl_tex->sampler_desc.mip_base_level = desc->mip_base_level; } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 8005e62b79b..cd352cba488 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3451,83 +3451,6 @@ static void sampler_texmatrix(struct wined3d_context *context, const struct wine } }
-static enum wined3d_texture_address wined3d_texture_address_mode(const struct wined3d_texture *texture, - enum wined3d_texture_address t) -{ - if (t < WINED3D_TADDRESS_WRAP || t > WINED3D_TADDRESS_MIRROR_ONCE) - { - FIXME("Unrecognized or unsupported texture address mode %#x.\n", t); - return WINED3D_TADDRESS_WRAP; - } - - /* Cubemaps are always set to clamp, regardless of the sampler state. */ - if ((texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP) - || ((texture->flags & WINED3D_TEXTURE_COND_NP2) && t == WINED3D_TADDRESS_WRAP)) - return WINED3D_TADDRESS_CLAMP; - - return t; -} - -static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc, - const uint32_t *sampler_states, const struct wined3d_texture *texture) -{ - union - { - float f; - DWORD d; - } lod_bias; - - desc->address_u = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_U]); - desc->address_v = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_V]); - desc->address_w = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_W]); - wined3d_color_from_d3dcolor((struct wined3d_color *)desc->border_color, - sampler_states[WINED3D_SAMP_BORDER_COLOR]); - if (sampler_states[WINED3D_SAMP_MAG_FILTER] > WINED3D_TEXF_ANISOTROPIC) - FIXME("Unrecognized or unsupported WINED3D_SAMP_MAG_FILTER %#x.\n", - sampler_states[WINED3D_SAMP_MAG_FILTER]); - desc->mag_filter = min(max(sampler_states[WINED3D_SAMP_MAG_FILTER], WINED3D_TEXF_POINT), WINED3D_TEXF_LINEAR); - if (sampler_states[WINED3D_SAMP_MIN_FILTER] > WINED3D_TEXF_ANISOTROPIC) - FIXME("Unrecognized or unsupported WINED3D_SAMP_MIN_FILTER %#x.\n", - sampler_states[WINED3D_SAMP_MIN_FILTER]); - desc->min_filter = min(max(sampler_states[WINED3D_SAMP_MIN_FILTER], WINED3D_TEXF_POINT), WINED3D_TEXF_LINEAR); - if (sampler_states[WINED3D_SAMP_MIP_FILTER] > WINED3D_TEXF_ANISOTROPIC) - FIXME("Unrecognized or unsupported WINED3D_SAMP_MIP_FILTER %#x.\n", - sampler_states[WINED3D_SAMP_MIP_FILTER]); - desc->mip_filter = min(max(sampler_states[WINED3D_SAMP_MIP_FILTER], WINED3D_TEXF_NONE), WINED3D_TEXF_LINEAR); - lod_bias.d = sampler_states[WINED3D_SAMP_MIPMAP_LOD_BIAS]; - desc->lod_bias = lod_bias.f; - desc->min_lod = -1000.0f; - desc->max_lod = 1000.0f; - - /* The LOD is already clamped to texture->level_count in wined3d_texture_set_lod(). */ - if (texture->flags & WINED3D_TEXTURE_COND_NP2) - desc->mip_base_level = 0; - else if (desc->mip_filter == WINED3D_TEXF_NONE) - desc->mip_base_level = texture->lod; - else - desc->mip_base_level = min(max(sampler_states[WINED3D_SAMP_MAX_MIP_LEVEL], texture->lod), texture->level_count - 1); - - desc->max_anisotropy = sampler_states[WINED3D_SAMP_MAX_ANISOTROPY]; - if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC - && sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC - && sampler_states[WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_ANISOTROPIC) - || (texture->flags & WINED3D_TEXTURE_COND_NP2)) - desc->max_anisotropy = 1; - desc->compare = texture->resource.format_caps & WINED3D_FORMAT_CAP_SHADOW; - desc->comparison_func = WINED3D_CMP_LESSEQUAL; - desc->srgb_decode = is_srgb_enabled(sampler_states); - - if (!(texture->resource.format_caps & WINED3D_FORMAT_CAP_FILTERING)) - { - desc->mag_filter = WINED3D_TEXF_POINT; - desc->min_filter = WINED3D_TEXF_POINT; - desc->mip_filter = WINED3D_TEXF_NONE; - } - - if (texture->flags & WINED3D_TEXTURE_COND_NP2) - desc->mip_filter = WINED3D_TEXF_NONE; -} - /* Enabling and disabling texture dimensions is done by texture stage state / * pixel shader setup, this function only has to bind textures and set the per * texture states. */ @@ -3553,36 +3476,19 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state if (state->textures[sampler_idx]) { struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(state->textures[sampler_idx]); - const uint32_t *sampler_states = state->sampler_states[sampler_idx]; - struct wined3d_device *device = context->device; - BOOL srgb = is_srgb_enabled(sampler_states); - struct wined3d_sampler_desc desc; + enum wined3d_shader_type shader_type = WINED3D_SHADER_TYPE_PIXEL; + unsigned int bind_idx = sampler_idx; struct wined3d_sampler *sampler; - struct wine_rb_entry *entry; - - wined3d_sampler_desc_from_sampler_states(&desc, sampler_states, &texture_gl->t);
- wined3d_texture_gl_bind(texture_gl, context_gl, srgb); - - if ((entry = wine_rb_get(&device->samplers, &desc))) + if (sampler_idx >= WINED3D_VERTEX_SAMPLER_OFFSET) { - sampler = WINE_RB_ENTRY_VALUE(entry, struct wined3d_sampler, entry); - } - else - { - if (FAILED(wined3d_sampler_create(device, &desc, NULL, &wined3d_null_parent_ops, &sampler))) - { - ERR("Failed to create sampler.\n"); - return; - } - if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1) - { - ERR("Failed to insert sampler.\n"); - wined3d_sampler_decref(sampler); - return; - } + bind_idx -= WINED3D_VERTEX_SAMPLER_OFFSET; + shader_type = WINED3D_SHADER_TYPE_VERTEX; }
+ sampler = state->sampler[shader_type][bind_idx]; + + wined3d_texture_gl_bind(texture_gl, context_gl, sampler->desc.srgb_decode); wined3d_sampler_gl_bind(wined3d_sampler_gl(sampler), mapped_stage, texture_gl, context_gl);
/* Trigger shader constant reloading (for NP2 texcoord fixup) */ diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 3972ba0abba..9cb9916d462 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1997,8 +1997,6 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d init_default_texture_state(i, state->texture_states[i]); }
- init_default_sampler_states(state->sampler_states); - state->blend_factor.r = 1.0f; state->blend_factor.g = 1.0f; state->blend_factor.b = 1.0f; @@ -2532,22 +2530,6 @@ static void wined3d_device_set_texture_stage_state(struct wined3d_device *device wined3d_device_context_emit_set_texture_state(&device->cs->c, stage, state, value); }
-static void wined3d_device_set_sampler_state(struct wined3d_device *device, - unsigned int sampler_idx, enum wined3d_sampler_state state, unsigned int value) -{ - TRACE("device %p, sampler_idx %u, state %s, value %#x.\n", - device, sampler_idx, debug_d3dsamplerstate(state), value); - - if (value == device->cs->c.state->sampler_states[sampler_idx][state]) - { - TRACE("Application is setting the old value over, nothing to do.\n"); - return; - } - - device->cs->c.state->sampler_states[sampler_idx][state] = value; - wined3d_device_context_emit_set_sampler_state(&device->cs->c, sampler_idx, state, value); -} - static void wined3d_device_set_texture(struct wined3d_device *device, unsigned int stage, struct wined3d_texture *texture) { @@ -2610,6 +2592,84 @@ static void wined3d_device_set_transform(struct wined3d_device *device, wined3d_device_context_emit_set_transform(&device->cs->c, state, matrix); }
+static enum wined3d_texture_address get_texture_address_mode(const struct wined3d_texture *texture, + enum wined3d_texture_address t) +{ + if (t < WINED3D_TADDRESS_WRAP || t > WINED3D_TADDRESS_MIRROR_ONCE) + { + FIXME("Unrecognized or unsupported texture address mode %#x.\n", t); + return WINED3D_TADDRESS_WRAP; + } + + /* Cubemaps are always set to clamp, regardless of the sampler state. */ + if ((texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP) + || ((texture->flags & WINED3D_TEXTURE_COND_NP2) && t == WINED3D_TADDRESS_WRAP)) + return WINED3D_TADDRESS_CLAMP; + + return t; +} + +static void sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc, + const uint32_t *sampler_states, const struct wined3d_texture *texture) +{ + desc->address_u = get_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_U]); + desc->address_v = get_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_V]); + desc->address_w = get_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_W]); + wined3d_color_from_d3dcolor((struct wined3d_color *)desc->border_color, + sampler_states[WINED3D_SAMP_BORDER_COLOR]); + if (sampler_states[WINED3D_SAMP_MAG_FILTER] > WINED3D_TEXF_ANISOTROPIC) + FIXME("Unrecognized or unsupported WINED3D_SAMP_MAG_FILTER %#x.\n", + sampler_states[WINED3D_SAMP_MAG_FILTER]); + desc->mag_filter = min(max(sampler_states[WINED3D_SAMP_MAG_FILTER], WINED3D_TEXF_POINT), WINED3D_TEXF_LINEAR); + if (sampler_states[WINED3D_SAMP_MIN_FILTER] > WINED3D_TEXF_ANISOTROPIC) + FIXME("Unrecognized or unsupported WINED3D_SAMP_MIN_FILTER %#x.\n", + sampler_states[WINED3D_SAMP_MIN_FILTER]); + desc->min_filter = min(max(sampler_states[WINED3D_SAMP_MIN_FILTER], WINED3D_TEXF_POINT), WINED3D_TEXF_LINEAR); + if (sampler_states[WINED3D_SAMP_MIP_FILTER] > WINED3D_TEXF_ANISOTROPIC) + FIXME("Unrecognized or unsupported WINED3D_SAMP_MIP_FILTER %#x.\n", + sampler_states[WINED3D_SAMP_MIP_FILTER]); + desc->mip_filter = min(max(sampler_states[WINED3D_SAMP_MIP_FILTER], WINED3D_TEXF_NONE), WINED3D_TEXF_LINEAR); + desc->lod_bias = int_to_float(sampler_states[WINED3D_SAMP_MIPMAP_LOD_BIAS]); + desc->min_lod = -1000.0f; + desc->max_lod = 1000.0f; + + /* The LOD is already clamped to texture->level_count in wined3d_texture_set_lod(). */ + if (texture->flags & WINED3D_TEXTURE_COND_NP2) + desc->mip_base_level = 0; + else if (desc->mip_filter == WINED3D_TEXF_NONE) + desc->mip_base_level = texture->lod; + else + desc->mip_base_level = min(max(sampler_states[WINED3D_SAMP_MAX_MIP_LEVEL], texture->lod), texture->level_count - 1); + + desc->max_anisotropy = sampler_states[WINED3D_SAMP_MAX_ANISOTROPY]; + if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC + && sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC + && sampler_states[WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_ANISOTROPIC) + || (texture->flags & WINED3D_TEXTURE_COND_NP2)) + desc->max_anisotropy = 1; + desc->compare = texture->resource.format_caps & WINED3D_FORMAT_CAP_SHADOW; + desc->comparison_func = WINED3D_CMP_LESSEQUAL; + + /* Only use the LSB of the WINED3D_SAMP_SRGB_TEXTURE value. This matches + * the behaviour of the AMD Windows driver. + * + * Might & Magic: Heroes VI - Shades of Darkness sets + * WINED3D_SAMP_SRGB_TEXTURE to a large value that looks like a + * pointer—presumably by accident—and expects sRGB decoding to be + * disabled. */ + desc->srgb_decode = sampler_states[WINED3D_SAMP_SRGB_TEXTURE] & 0x1; + + if (!(texture->resource.format_caps & WINED3D_FORMAT_CAP_FILTERING)) + { + desc->mag_filter = WINED3D_TEXF_POINT; + desc->min_filter = WINED3D_TEXF_POINT; + desc->mip_filter = WINED3D_TEXF_NONE; + } + + if (texture->flags & WINED3D_TEXTURE_COND_NP2) + desc->mip_filter = WINED3D_TEXF_NONE; +} + void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_stateblock *stateblock) { @@ -3162,11 +3222,43 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
for (i = 0; i < ARRAY_SIZE(changed->samplerState); ++i) { - map = changed->samplerState[i]; - while (map) + enum wined3d_shader_type shader_type = WINED3D_SHADER_TYPE_PIXEL; + struct wined3d_sampler_desc desc; + struct wined3d_texture *texture; + struct wined3d_sampler *sampler; + unsigned int bind_index = i; + struct wine_rb_entry *entry; + + if (!changed->samplerState[i] && !(changed->textures & (1u << i))) + continue; + + if (!(texture = state->textures[i])) + continue; + + memset(&desc, 0, sizeof(desc)); + sampler_desc_from_sampler_states(&desc, state->sampler_states[i], texture); + + if (i >= WINED3D_VERTEX_SAMPLER_OFFSET) { - j = wined3d_bit_scan(&map); - wined3d_device_set_sampler_state(device, i, j, state->sampler_states[i][j]); + shader_type = WINED3D_SHADER_TYPE_VERTEX; + bind_index -= WINED3D_VERTEX_SAMPLER_OFFSET; + } + + if ((entry = wine_rb_get(&device->samplers, &desc))) + { + sampler = WINE_RB_ENTRY_VALUE(entry, struct wined3d_sampler, entry); + + wined3d_device_context_set_samplers(context, shader_type, bind_index, 1, &sampler); + } + else if (SUCCEEDED(wined3d_sampler_create(device, &desc, NULL, &wined3d_null_parent_ops, &sampler))) + { + wined3d_device_context_set_samplers(context, shader_type, bind_index, 1, &sampler); + + if (wine_rb_put(&device->samplers, &desc, &sampler->entry) == -1) + { + ERR("Failed to insert sampler.\n"); + wined3d_sampler_decref(sampler); + } } }
@@ -3223,3 +3315,22 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
TRACE("Applied stateblock %p.\n", stateblock); } + +void wined3d_stateblock_invalidate_texture_lod(struct wined3d_stateblock *stateblock, struct wined3d_texture *texture) +{ + unsigned int i; + + for (i = 0; i < WINED3D_MAX_COMBINED_SAMPLERS; ++i) + { + /* Mark the texture as changed. The next time the appplication draws + * from this texture, wined3d_device_apply_stateblock() will recompute + * the texture LOD. + * + * We only need to do this for the primary stateblock. If a recording + * stateblock uses a texture whose LOD is changed, that texture will be + * invalidated on the primary stateblock anyway when the recording + * stateblock is applied. */ + if (stateblock->stateblock_state.textures[i] == texture) + stateblock->changed.textures |= (1u << i); + } +} diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 82d1fe3cda5..c32b458fe56 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1757,16 +1757,8 @@ unsigned int CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, unsi
if (texture->lod != lod) { - struct wined3d_device *device = resource->device; - - wined3d_resource_wait_idle(resource); texture->lod = lod; - - wined3d_texture_gl(texture)->texture_rgb.sampler_desc.mip_base_level = ~0u; - wined3d_texture_gl(texture)->texture_srgb.sampler_desc.mip_base_level = ~0u; - if (resource->bind_count) - wined3d_device_context_emit_set_sampler_state(&device->cs->c, texture->sampler, WINED3D_SAMP_MAX_MIP_LEVEL, - device->cs->c.state->sampler_states[texture->sampler][WINED3D_SAMP_MAX_MIP_LEVEL]); + wined3d_stateblock_invalidate_texture_lod(resource->device->primary_stateblock, texture); }
return old; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3d75660ad05..cdc33525307 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2884,7 +2884,6 @@ struct wined3d_state struct wined3d_unordered_access_view *unordered_access_view[WINED3D_PIPELINE_COUNT][MAX_UNORDERED_ACCESS_VIEWS];
struct wined3d_texture *textures[WINED3D_MAX_COMBINED_SAMPLERS]; - uint32_t sampler_states[WINED3D_MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; uint32_t texture_states[WINED3D_MAX_FFP_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
struct wined3d_matrix transforms[WINED3D_HIGHEST_TRANSFORM_STATE + 1]; @@ -3719,8 +3718,6 @@ void wined3d_device_context_emit_set_rendertarget_views(struct wined3d_device_co unsigned int count, struct wined3d_rendertarget_view *const *views) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_samplers(struct wined3d_device_context *context, enum wined3d_shader_type type, unsigned int start_idx, unsigned int count, struct wined3d_sampler *const *samplers) DECLSPEC_HIDDEN; -void wined3d_device_context_emit_set_sampler_state(struct wined3d_device_context *context, unsigned int sampler_idx, - enum wined3d_sampler_state state, unsigned int value) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_scissor_rects(struct wined3d_device_context *context, unsigned int rect_count, const RECT *rects) DECLSPEC_HIDDEN; void wined3d_device_context_emit_set_shader(struct wined3d_device_context *context, enum wined3d_shader_type type, @@ -4556,6 +4553,9 @@ uint32_t wined3d_format_pack(const struct wined3d_format *format, const struct w BOOL wined3d_formats_are_srgb_variants(enum wined3d_format_id format1, enum wined3d_format_id format2) DECLSPEC_HIDDEN;
+void wined3d_stateblock_invalidate_texture_lod(struct wined3d_stateblock *stateblock, + struct wined3d_texture *texture) DECLSPEC_HIDDEN; + BOOL wined3d_array_reserve(void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size) DECLSPEC_HIDDEN;
static inline BOOL wined3d_format_is_typeless(const struct wined3d_format *format) @@ -4593,18 +4593,6 @@ static inline void context_apply_state(struct wined3d_context *context, state_table[rep].apply(context, state, rep); }
-static inline BOOL is_srgb_enabled(const uint32_t *sampler_states) -{ - /* Only use the LSB of the WINED3D_SAMP_SRGB_TEXTURE value. This matches - * the behaviour of the AMD Windows driver. - * - * Might & Magic: Heroes VI - Shades of Darkness sets - * WINED3D_SAMP_SRGB_TEXTURE to a large value that looks like a - * pointer—presumably by accident—and expects sRGB decoding to be - * disabled. */ - return sampler_states[WINED3D_SAMP_SRGB_TEXTURE] & 0x1; -} - static inline BOOL needs_separate_srgb_gl_texture(const struct wined3d_context *context, const struct wined3d_texture *texture) {
Subject: [PATCH 1/6] wined3d: Move the min filter fixup from wined3d_sampler_desc_from_sampler_states() to wined3d_texture_gl_apply_sampler_desc().
That effectively removes it from the sampler objects path though. I suspect conditional NP2 and sampler objects are effectively mutually exclusive, but is that an intentional change? The commit message doesn't explicitly mention it, at least.
Subject: [PATCH 3/6] wined3d: Handle texture LOD in wined3d_sampler_desc_from_sampler_states().
It's probably fine, but note that this could potentially increase the number of unique sampler objects being created.
Subject: [PATCH 5/6] wined3d: Store the primary stateblock in the device.
Didn't we get rid of that not that long ago? It's probably not terrible, but it seems slightly nicer to me to call wined3d_stateblock_invalidate_texture_lod() (that's the main purpose of this, right?) from ddraw/d3d8/d3d9.
Subject: [PATCH 1/6] wined3d: Move the min filter fixup from wined3d_sampler_desc_from_sampler_states() to wined3d_texture_gl_apply_sampler_desc().
That effectively removes it from the sampler objects path though. I suspect conditional NP2 and sampler objects are effectively mutually exclusive, but is that an intentional change? The commit message doesn't explicitly mention it, at least.
Yes, I don't know why I thought that was correct. Perhaps I misread ARB_sampler_objects as implying GL 3.2, but it doesn't.
Subject: [PATCH 3/6] wined3d: Handle texture LOD in wined3d_sampler_desc_from_sampler_states().
It's probably fine, but note that this could potentially increase the number of unique sampler objects being created.
Yes, I suppose we could avoid that by passing it as a standalone state (à la sample mask). I don't know whether that's worthwhile at this point.
Didn't we get rid of that not that long ago? It's probably not terrible, but it seems slightly nicer to me to call wined3d_stateblock_invalidate_texture_lod() (that's the main purpose of this, right?) from ddraw/d3d8/d3d9.
I don't feel strongly about it, but this is easier and doesn't require adding a new export, and I feel like sharing common logic in wined3d is an improvement?
Didn't we get rid of that not that long ago? It's probably not terrible, but it seems slightly nicer to me to call wined3d_stateblock_invalidate_texture_lod() (that's the main purpose of this, right?) from ddraw/d3d8/d3d9.
I don't feel strongly about it, but this is easier and doesn't require adding a new export, and I feel like sharing common logic in wined3d is an improvement?
The main issue I have with it is that we decided a while ago to kick stateblocks out of core wined3d and effectively make them a helper module in order to simplify core wined3d. Indeed, this MR as a whole is itself a change along those lines, getting rid of separate sampler states. Putting a stateblock pointer in the device seems like a change in the opposite direction. I could certainly live with it, but it doesn't seem too hard to avoid either.