wined3d: Introduce wined3d_mask_from_size().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
736c4803d7
commit
cc31ca8885
|
@ -36,11 +36,11 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
|
|||
static const DWORD surface_simple_locations = WINED3D_LOCATION_SYSMEM | WINED3D_LOCATION_BUFFER;
|
||||
|
||||
/* Works correctly only for <= 4 bpp formats. */
|
||||
static void get_color_masks(const struct wined3d_format *format, DWORD *masks)
|
||||
static void get_color_masks(const struct wined3d_format *format, uint32_t *masks)
|
||||
{
|
||||
masks[0] = ((1u << format->red_size) - 1) << format->red_offset;
|
||||
masks[1] = ((1u << format->green_size) - 1) << format->green_offset;
|
||||
masks[2] = ((1u << format->blue_size) - 1) << format->blue_offset;
|
||||
masks[0] = wined3d_mask_from_size(format->red_size) << format->red_offset;
|
||||
masks[1] = wined3d_mask_from_size(format->green_size) << format->green_offset;
|
||||
masks[2] = wined3d_mask_from_size(format->blue_size) << format->blue_offset;
|
||||
}
|
||||
|
||||
/* See also float_16_to_32() in wined3d_private.h */
|
||||
|
|
|
@ -5902,7 +5902,7 @@ DWORD wined3d_format_convert_from_float(const struct wined3d_format *format, con
|
|||
|
||||
static float color_to_float(DWORD color, DWORD size, DWORD offset)
|
||||
{
|
||||
DWORD mask = size < 32 ? (1u << size) - 1 : ~0u;
|
||||
uint32_t mask = wined3d_mask_from_size(size);
|
||||
|
||||
if (!size)
|
||||
return 1.0f;
|
||||
|
@ -5938,10 +5938,10 @@ void wined3d_format_get_float_color_key(const struct wined3d_format *format,
|
|||
case WINED3DFMT_R8G8B8X8_UNORM:
|
||||
case WINED3DFMT_R16G16_UNORM:
|
||||
case WINED3DFMT_B10G10R10A2_UNORM:
|
||||
slop.r = 0.5f / ((1u << format->red_size) - 1);
|
||||
slop.g = 0.5f / ((1u << format->green_size) - 1);
|
||||
slop.b = 0.5f / ((1u << format->blue_size) - 1);
|
||||
slop.a = 0.5f / ((1u << format->alpha_size) - 1);
|
||||
slop.r = 0.5f / wined3d_mask_from_size(format->red_size);
|
||||
slop.g = 0.5f / wined3d_mask_from_size(format->green_size);
|
||||
slop.b = 0.5f / wined3d_mask_from_size(format->blue_size);
|
||||
slop.a = 0.5f / wined3d_mask_from_size(format->alpha_size);
|
||||
|
||||
float_colors[0].r = color_to_float(key->color_space_low_value, format->red_size, format->red_offset)
|
||||
- slop.r;
|
||||
|
|
|
@ -5959,6 +5959,11 @@ static inline BOOL is_rasterization_disabled(const struct wined3d_shader *geomet
|
|||
&& geometry_shader->u.gs.so_desc->rasterizer_stream_idx == WINED3D_NO_RASTERIZER_STREAM;
|
||||
}
|
||||
|
||||
static inline uint32_t wined3d_mask_from_size(unsigned int size)
|
||||
{
|
||||
return size < 32 ? (1u << size) - 1 : ~0u;
|
||||
}
|
||||
|
||||
static inline DWORD wined3d_extract_bits(const DWORD *bitstream,
|
||||
unsigned int offset, unsigned int count)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue