Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/adapter_gl.c | 1 + dlls/wined3d/adapter_vk.c | 1 + dlls/wined3d/cs.c | 3 +-- dlls/wined3d/shader.c | 2 +- dlls/wined3d/texture.c | 2 +- dlls/wined3d/utils.c | 2 +- dlls/wined3d/view.c | 2 +- dlls/wined3d/wined3d_private.h | 6 +++--- 8 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 866cfecbe1f2..1555ba4aaa38 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3729,6 +3729,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
d3d_info->draw_base_vertex_offset = !!gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]; d3d_info->vertex_bgra = !!gl_info->supported[ARB_VERTEX_ARRAY_BGRA]; + d3d_info->texture_swizzle = !!gl_info->supported[ARB_TEXTURE_SWIZZLE];
if (gl_info->supported[ARB_TEXTURE_MULTISAMPLE]) d3d_info->multisample_draw_location = WINED3D_LOCATION_TEXTURE_RGB; diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 0d5e2f59348c..87a111274fe4 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -729,6 +729,7 @@ static BOOL wined3d_adapter_vk_init(struct wined3d_adapter_vk *adapter_vk, adapter->shader_backend = &none_shader_backend;
adapter->d3d_info.wined3d_creation_flags = wined3d_creation_flags; + adapter->d3d_info.texture_swizzle = TRUE;
return TRUE;
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 9960d06cea72..b2a2b1ad4ffd 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1348,7 +1348,6 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) { - const struct wined3d_gl_info *gl_info = &cs->device->adapter->gl_info; const struct wined3d_d3d_info *d3d_info = &cs->device->adapter->d3d_info; const struct wined3d_cs_set_texture *op = data; struct wined3d_texture *prev; @@ -1369,7 +1368,7 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (!prev || wined3d_texture_gl(op->texture)->target != wined3d_texture_gl(prev)->target || (!is_same_fixup(new_format->color_fixup, old_format->color_fixup) - && !(can_use_texture_swizzle(gl_info, new_format) && can_use_texture_swizzle(gl_info, old_format))) + && !(can_use_texture_swizzle(d3d_info, new_format) && can_use_texture_swizzle(d3d_info, old_format))) || (new_fmt_flags & WINED3DFMT_FLAG_SHADOW) != (old_fmt_flags & WINED3DFMT_FLAG_SHADOW)) device_invalidate_state(cs->device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL));
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 7ebfd4dee16b..609b574d461c 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -4025,7 +4025,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 args->color_fixup[i] = COLOR_FIXUP_IDENTITY; continue; } - if (can_use_texture_swizzle(gl_info, texture->resource.format)) + if (can_use_texture_swizzle(d3d_info, texture->resource.format)) args->color_fixup[i] = COLOR_FIXUP_IDENTITY; else args->color_fixup[i] = texture->resource.format->color_fixup; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 949492063d2c..664f8a902053 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -1037,7 +1037,7 @@ void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl, checkGLcall("glTexParameteri(GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY)"); }
- if (!is_identity_fixup(fixup) && can_use_texture_swizzle(gl_info, format)) + if (!is_identity_fixup(fixup) && can_use_texture_swizzle(context->d3d_info, format)) { GLint swizzle[4];
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index e54eec241ea4..2ec3546125bb 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5988,7 +5988,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
if ((texture = state->textures[i])) { - if (can_use_texture_swizzle(gl_info, texture->resource.format)) + if (can_use_texture_swizzle(d3d_info, texture->resource.format)) settings->op[i].color_fixup = COLOR_FIXUP_IDENTITY; else settings->op[i].color_fixup = texture->resource.format->color_fixup; diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index 0cfadf7329b9..ec9df71380cd 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -226,7 +226,7 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING); context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING); } - else if (!is_identity_fixup(view_format->color_fixup) && can_use_texture_swizzle(gl_info, view_format)) + else if (!is_identity_fixup(view_format->color_fixup) && can_use_texture_swizzle(context->d3d_info, view_format)) { GLint swizzle[4];
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 221ca6e04f46..875c33bd0b40 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -209,6 +209,7 @@ struct wined3d_d3d_info unsigned int texture_npot_conditional : 1; unsigned int draw_base_vertex_offset : 1; unsigned int vertex_bgra : 1; + unsigned int texture_swizzle : 1; enum wined3d_feature_level feature_level;
DWORD multisample_draw_location; @@ -4739,10 +4740,9 @@ static inline GLuint wined3d_texture_gl_get_texture_name(const struct wined3d_te ? texture_gl->texture_srgb.name : texture_gl->texture_rgb.name; }
-static inline BOOL can_use_texture_swizzle(const struct wined3d_gl_info *gl_info, const struct wined3d_format *format) +static inline BOOL can_use_texture_swizzle(const struct wined3d_d3d_info *d3d_info, const struct wined3d_format *format) { - return gl_info->supported[ARB_TEXTURE_SWIZZLE] && !is_complex_fixup(format->color_fixup) - && !is_scaling_fixup(format->color_fixup); + return d3d_info->texture_swizzle && !is_complex_fixup(format->color_fixup) && !is_scaling_fixup(format->color_fixup); }
static inline BOOL needs_interpolation_qualifiers_for_shader_outputs(const struct wined3d_gl_info *gl_info)