wined3d: Use wined3d_bit_scan() in shader_glsl_load_constantsB().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2022-01-28 15:47:20 +01:00 committed by Alexandre Julliard
parent 6f150854e7
commit bbb7d41eae
1 changed files with 8 additions and 9 deletions

View File

@ -1239,16 +1239,15 @@ static void shader_glsl_load_constants_i(const struct wined3d_shader *shader, co
}
/* Context activation is done by the caller. */
static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
const GLint locations[WINED3D_MAX_CONSTS_B], const BOOL *constants, WORD constants_set)
static void shader_glsl_load_constants_b(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info,
const BOOL *constants, const GLint locations[WINED3D_MAX_CONSTS_B], uint32_t constants_set)
{
unsigned int i;
struct list* ptr;
for (i = 0; constants_set; constants_set >>= 1, ++i)
while (constants_set)
{
if (!(constants_set & 1)) continue;
i = wined3d_bit_scan(&constants_set);
GL_EXTCALL(glUniform1iv(locations[i], 1, &constants[i]));
}
@ -1546,8 +1545,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
prog->vs.uniform_i_locations, vshader->reg_maps.integer_constants);
if (update_mask & WINED3D_SHADER_CONST_VS_B)
shader_glsl_load_constantsB(vshader, gl_info, prog->vs.uniform_b_locations, state->vs_consts_b,
vshader->reg_maps.boolean_constants);
shader_glsl_load_constants_b(vshader, gl_info, state->vs_consts_b,
prog->vs.uniform_b_locations, vshader->reg_maps.boolean_constants);
if (update_mask & WINED3D_SHADER_CONST_VS_CLIP_PLANES)
{
@ -1699,8 +1698,8 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
prog->ps.uniform_i_locations, pshader->reg_maps.integer_constants);
if (update_mask & WINED3D_SHADER_CONST_PS_B)
shader_glsl_load_constantsB(pshader, gl_info, prog->ps.uniform_b_locations, state->ps_consts_b,
pshader->reg_maps.boolean_constants);
shader_glsl_load_constants_b(pshader, gl_info, state->ps_consts_b,
prog->ps.uniform_b_locations, pshader->reg_maps.boolean_constants);
if (update_mask & WINED3D_SHADER_CONST_PS_BUMP_ENV)
{