Commit 996cfb84 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Use wined3d_bit_scan() in compute_sphere_visibility().

Rémi Bernon reports an unspecified issue with gcc 11 related to compute_sphere_visibility() expecting 12 input planes, but d3d_device3_ComputeSphereVisibility() only providing 6. The actual number of planes required depends on the "enabled_planes" mask. This patch should make the code better reflect that, but I do not have a gcc 11 setup to verify it resolves the issue there. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f43b3125
......@@ -4638,17 +4638,20 @@ static void prepare_clip_space_planes(struct d3d_device *device, struct wined3d_
plane[5].w = m._44 - m._43;
}
static void compute_sphere_visibility(struct wined3d_vec4 plane[12], DWORD enabled_planes, BOOL equality,
D3DVECTOR *centers, D3DVALUE *radii, DWORD sphere_count, DWORD *return_values)
static void compute_sphere_visibility(const struct wined3d_vec4 *planes, DWORD enabled_planes, BOOL equality,
const D3DVECTOR *centres, const D3DVALUE *radii, unsigned int sphere_count, DWORD *return_values)
{
UINT i, j;
unsigned int mask, i, j;
memset(return_values, 0, sphere_count * sizeof(*return_values));
for (i = 0; i < sphere_count; ++i)
{
return_values[i] = 0;
for (j = 0; j < 12; ++j)
if (enabled_planes & 1u << j)
return_values[i] |= in_plane(j, plane[j], centers[i], radii[i], equality);
mask = enabled_planes;
while (mask)
{
j = wined3d_bit_scan(&mask);
return_values[i] |= in_plane(j, planes[j], centres[i], radii[i], equality);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment