From: Chip Davis cdavis5x@gmail.com
--- dlls/wined3d/context_gl.c | 3 +-- dlls/wined3d/device.c | 3 +-- dlls/wined3d/utils.c | 27 +++++++++++++-------------- dlls/wined3d/wined3d_private.h | 2 +- 4 files changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 95817b74b14..628b3ffe145 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -5733,7 +5733,6 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
if (element->stride) { - DWORD format_flags = format_gl->f.flags[WINED3D_GL_RES_TYPE_BUFFER]; unsigned int format_attrs = format_gl->f.attrs;
bo = wined3d_bo_gl_id(element->data.buffer_object); @@ -5755,7 +5754,7 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c else { GL_EXTCALL(glVertexAttribPointer(i, format_gl->vtx_format, format_gl->vtx_type, - !!(format_flags & WINED3DFMT_FLAG_NORMALISED), element->stride, offset)); + !!(format_attrs & WINED3D_FORMAT_ATTR_NORMALISED), element->stride, offset)); }
if (!(context->numbered_array_mask & (1u << i))) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index a7227f4f444..baf30fa86ba 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5120,8 +5120,7 @@ void CDECL wined3d_device_context_clear_uav_float(struct wined3d_device_context { TRACE("context %p, view %p, clear_value %s.\n", context, view, debug_vec4(clear_value));
- if (!((view->format->attrs & WINED3D_FORMAT_ATTR_FLOAT) || - (view->format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_NORMALISED))) + if (!(view->format->attrs & (WINED3D_FORMAT_ATTR_FLOAT | WINED3D_FORMAT_ATTR_NORMALISED))) { WARN("Not supported for view format %s.\n", debug_d3dformat(view->format->id)); return; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index c7ff807d366..39010ab5269 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -347,16 +347,16 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_R32_UINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK | WINED3DFMT_FLAG_INDEX_BUFFER}, {WINED3DFMT_R32_SINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK}, {WINED3DFMT_R16_UINT, 0, WINED3DFMT_FLAG_INDEX_BUFFER}, - {WINED3DFMT_A8_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B10G10R10A2_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B2G3R3_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B4G4R4A4_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B4G4R4X4_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B5G5R5A1_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B5G5R5X1_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B5G6R5_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_B8G8R8_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, - {WINED3DFMT_R10G10B10A2_UNORM, 0, WINED3DFMT_FLAG_NORMALISED}, + {WINED3DFMT_A8_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B10G10R10A2_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B2G3R3_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B4G4R4A4_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B4G4R4X4_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B5G5R5A1_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B5G5R5X1_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B5G6R5_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_B8G8R8_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, + {WINED3DFMT_R10G10B10A2_UNORM, WINED3D_FORMAT_ATTR_NORMALISED}, };
static void rgb888_from_rgb565(WORD rgb565, BYTE *r, BYTE *g, BYTE *b) @@ -2082,8 +2082,8 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter) for (i = 0; i < ARRAY_SIZE(typed_formats); ++i) { struct wined3d_format *typeless_format; - unsigned int flags = 0, attrs = 0; unsigned int component_count = 0; + unsigned int attrs = 0;
if (!(format = get_format_internal(adapter, typed_formats[i].id))) return FALSE; @@ -2115,7 +2115,7 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter) enum wined3d_channel_type channel_type = map_channel_type(typed_formats[i].channels[j]);
if (channel_type == WINED3D_CHANNEL_TYPE_UNORM || channel_type == WINED3D_CHANNEL_TYPE_SNORM) - flags |= WINED3DFMT_FLAG_NORMALISED; + attrs |= WINED3D_FORMAT_ATTR_NORMALISED; if (channel_type == WINED3D_CHANNEL_TYPE_UINT || channel_type == WINED3D_CHANNEL_TYPE_SINT) attrs |= WINED3D_FORMAT_ATTR_INTEGER; if (channel_type == WINED3D_CHANNEL_TYPE_FLOAT) @@ -2138,7 +2138,6 @@ static BOOL init_format_base_info(struct wined3d_adapter *adapter)
format->component_count = component_count; format->attrs |= attrs; - format_set_flag(format, flags); }
for (i = 0; i < ARRAY_SIZE(ddi_formats); ++i) @@ -6117,7 +6116,7 @@ void wined3d_format_convert_from_float(const struct wined3d_format *format, return; }
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_NORMALISED) + if (format->attrs & WINED3D_FORMAT_ATTR_NORMALISED) { uint32_t *ret_i = ret;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5b693140f6e..9f8191dd416 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -6108,6 +6108,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN /* Pixel format attributes */ #define WINED3D_FORMAT_ATTR_FLOAT 0x00000001 #define WINED3D_FORMAT_ATTR_INTEGER 0x00000002 +#define WINED3D_FORMAT_ATTR_NORMALISED 0x00000004
/* WineD3D pixel format flags */ #define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001 @@ -6131,7 +6132,6 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN #define WINED3DFMT_FLAG_TEXTURE 0x00080000 #define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY 0x00100000 #define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000 -#define WINED3DFMT_FLAG_NORMALISED 0x00800000 #define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000 #define WINED3DFMT_FLAG_BLIT 0x02000000 #define WINED3DFMT_FLAG_MAPPABLE 0x04000000