vkd3d-shader: Implement vkd3d_write_mask_component_count() on top of vkd3d_popcount().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-10-30 15:22:51 +01:00 committed by Alexandre Julliard
parent 78a09d37d2
commit 6b9c589795

View File

@ -866,16 +866,8 @@ static inline unsigned int vkd3d_write_mask_get_component_idx(DWORD write_mask)
static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask) static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask)
{ {
unsigned int i, count = 0;
assert(write_mask); assert(write_mask);
for (i = 0; i < VKD3D_VEC4_SIZE; ++i) return vkd3d_popcount(write_mask & VKD3DSP_WRITEMASK_ALL);
{
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
++count;
}
return count;
} }
static inline unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count) static inline unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count)