wined3d: Use wined3d_bit_scan() in shader_generate_glsl_declarations().

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:21 +01:00 committed by Alexandre Julliard
parent bbb7d41eae
commit 1a7dbab1c4
1 changed files with 13 additions and 8 deletions

View File

@ -2168,7 +2168,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
const struct wined3d_shader_lconst *lconst;
const char *prefix;
unsigned int i;
DWORD map;
uint32_t map;
if (wined3d_settings.strict_shader_math)
shader_addline(buffer, "#pragma optionNV(fastmath off)\n");
@ -2176,9 +2176,11 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
prefix = shader_glsl_get_prefix(version->type);
/* Prototype the subroutines */
for (i = 0, map = reg_maps->labels; map; map >>= 1, ++i)
map = reg_maps->labels;
while (map)
{
if (map & 1) shader_addline(buffer, "void subroutine%u();\n", i);
i = wined3d_bit_scan(&map);
shader_addline(buffer, "void subroutine%u();\n", i);
}
if (version->type != WINED3D_SHADER_TYPE_PIXEL && version->type != WINED3D_SHADER_TYPE_COMPUTE)
@ -2500,9 +2502,11 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
}
/* Declare address variables */
for (i = 0, map = reg_maps->address; map; map >>= 1, ++i)
map = reg_maps->address;
while (map)
{
if (map & 1) shader_addline(buffer, "ivec4 A%u;\n", i);
i = wined3d_bit_scan(&map);
shader_addline(buffer, "ivec4 A%u;\n", i);
}
/* Declare output register temporaries */
@ -2517,10 +2521,11 @@ static void shader_generate_glsl_declarations(const struct wined3d_context_gl *c
}
else if (version->major < 4)
{
for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i)
map = reg_maps->temporary;
while (map)
{
if (map & 1)
shader_addline(buffer, "vec4 R%u;\n", i);
i = wined3d_bit_scan(&map);
shader_addline(buffer, "vec4 R%u;\n", i);
}
}