Module: wine Branch: master Commit: 89a71df48ee6943d390c515e2408a25ac3fcceb0 URL: https://gitlab.winehq.org/wine/wine/-/commit/89a71df48ee6943d390c515e2408a25...
Author: Elizabeth Figura zfigura@codeweavers.com Date: Fri May 3 17:14:34 2024 -0500
wined3d: Just check the vertex declaration for normal usage.
Do not check the stream info.
This would make a difference if the usage was included in the vertex declaration but the corresponding stream is not bound. However, in that case we supply a default stream containing zero, which provides the same behaviour as if the normal usage is not included in the vertex declaration.
---
dlls/wined3d/glsl_shader.c | 2 +- dlls/wined3d/utils.c | 2 +- dlls/wined3d/vertexdeclaration.c | 2 ++ dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0fbff8e4597..4e7655186bf 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11759,13 +11759,13 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration; struct wined3d_context_gl *context_gl = wined3d_context_gl(context); const struct wined3d_gl_info *gl_info = context_gl->gl_info; - BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL)); const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info); BOOL transformed = context->stream_info.position_transformed; BOOL wasrhw = context->last_was_rhw; bool point_size = vdecl->point_size; bool specular = vdecl->specular; bool diffuse = vdecl->diffuse; + bool normal = vdecl->normal; unsigned int i;
context->last_was_rhw = transformed; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index df502af247f..7d2bef8b7cc 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6620,7 +6620,7 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context,
settings->clipping = state->render_states[WINED3D_RS_CLIPPING] && state->render_states[WINED3D_RS_CLIPPLANEENABLE]; - settings->normal = !!(si->use_map & (1u << WINED3D_FFP_NORMAL)); + settings->normal = vdecl->normal; settings->normalize = settings->normal && state->render_states[WINED3D_RS_NORMALIZENORMALS]; settings->lighting = !!state->render_states[WINED3D_RS_LIGHTING]; settings->localviewer = !!state->render_states[WINED3D_RS_LOCALVIEWER]; diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 9affc604f13..f2df8979089 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -226,6 +226,8 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara declaration->diffuse = true; else if (e->usage == WINED3D_DECL_USAGE_COLOR && e->usage_idx == 1) declaration->specular = true; + else if (e->usage == WINED3D_DECL_USAGE_NORMAL) + declaration->normal = true;
/* Find the streams used in the declaration. The vertex buffers have * to be loaded when drawing, but filter tessellation pseudo streams. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a1a981d5a4c..14a91875014 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3495,6 +3495,7 @@ struct wined3d_vertex_declaration bool point_size; bool diffuse; bool specular; + bool normal; };
bool wined3d_light_state_enable_light(struct wined3d_light_state *state, const struct wined3d_d3d_info *d3d_info,