From: Henri Verbeet Subject: [PATCH 5/5] wined3d: Use wined3d_bit_scan() in set_glsl_shader_program(). Message-Id: <20220127145802.1549901-5-hverbeet@codeweavers.com> Date: Thu, 27 Jan 2022 15:58:02 +0100 Signed-off-by: Henri Verbeet --- dlls/wined3d/glsl_shader.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e33cd5d5fe0..c812b2d8b08 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -10231,6 +10231,7 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, struct wined3d_shader *pshader = NULL; GLuint reorder_shader_id = 0; struct glsl_program_key key; + uint32_t attribs_map; GLuint program_id; unsigned int i; GLuint vs_id = 0; @@ -10239,7 +10240,6 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, GLuint gs_id = 0; GLuint ps_id = 0; struct list *ps_list, *vs_list; - WORD attribs_map; struct wined3d_string_buffer *tmp_name; if (!(context_gl->c.shader_update_mask & (1u << WINED3D_SHADER_TYPE_VERTEX)) && ctx_data->glsl_program) @@ -10417,11 +10417,9 @@ static void set_glsl_shader_program(const struct wined3d_context_gl *context_gl, * in order to make the bindings work, and it has to be done prior * to linking the GLSL program. */ tmp_name = string_buffer_get(&priv->string_buffers); - for (i = 0; attribs_map; attribs_map >>= 1, ++i) + while (attribs_map) { - if (!(attribs_map & 1)) - continue; - + i = wined3d_bit_scan(&attribs_map); string_buffer_sprintf(tmp_name, "vs_in%u", i); GL_EXTCALL(glBindAttribLocation(program_id, i, tmp_name->buffer)); if (vshader && vshader->reg_maps.shader_version.major >= 4) -- 2.30.2