Module: wine Branch: master Commit: 60e4722bcfeb7c528f466a925acdc05b200e0994 URL: https://gitlab.winehq.org/wine/wine/-/commit/60e4722bcfeb7c528f466a925acdc05...
Author: Zebediah Figura zfigura@codeweavers.com Date: Fri Jul 14 16:40:10 2023 -0500
wined3d: Trigger constant update when an SRV requiring NPOT fixup is bound.
Ported from state_sampler().
This is currently relevant to the case where a d3d11 device is created with a 9.x feature level—this will have resources bound via SRVs [and will therefore go through wined3d_context_gl_bind_shader_resources() rather than state_sampler()] but need not support ARB_texture_non_power_of_two.
The NPOT non-requirement is explicitly called out in the d3d11 documentation, and because we need some degree of emulation for conditional NPOT textures, we need to hook that up for feature level 9.x d3d11 devices as well.
Looking forward, d3d 1-9 will be normalized to creating internal SRVs and binding those through the d3d10+ path, so this will also be necessary for that reason.
---
dlls/wined3d/context_gl.c | 12 ++++++------ dlls/wined3d/view.c | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 57fd182d926..bdea2879a51 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -4290,12 +4290,6 @@ static BOOL context_apply_draw_state(struct wined3d_context *context, context->shader_update_mask &= 1u << WINED3D_SHADER_TYPE_COMPUTE; }
- if (context->constant_update_mask) - { - device->shader_backend->shader_load_constants(device->shader_priv, context, state); - context->constant_update_mask = 0; - } - if (context->update_shader_resource_bindings) { for (i = 0; i < WINED3D_SHADER_TYPE_GRAPHICS_COUNT; ++i) @@ -4317,6 +4311,12 @@ static BOOL context_apply_draw_state(struct wined3d_context *context, if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) wined3d_context_gl_check_fbo_status(context_gl, GL_FRAMEBUFFER);
+ if (context->constant_update_mask) + { + device->shader_backend->shader_load_constants(device->shader_priv, context, state); + context->constant_update_mask = 0; + } + context->last_was_blit = FALSE; context->last_was_ffp_blit = FALSE;
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 5729d5909e6..4b0ccea7bb2 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -1266,6 +1266,10 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl texture_gl = wined3d_texture_gl(wined3d_texture_from_resource(view_gl->v.resource)); wined3d_texture_gl_bind(texture_gl, context_gl, FALSE); wined3d_sampler_gl_bind(sampler_gl, unit, texture_gl, context_gl); + + /* Trigger shader constant reloading (for NP2 texcoord fixup) */ + if (!(texture_gl->t.flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) + context_gl->c.constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP; }
/* Context activation is done by the caller. */