[PATCH v5 06/10] wined3d: Move WINED3DFMT_FLAG_BLOCKS, BROKEN_PITCH, and BLOCKS_NO_VERIFY to the attributes group.
Chip Davis
wine at gitlab.winehq.org
Mon May 23 18:07:49 CDT 2022
From: Chip Davis <cdavis5x at gmail.com>
---
dlls/wined3d/device.c | 7 +-
dlls/wined3d/resource.c | 9 +--
dlls/wined3d/surface.c | 11 ++--
dlls/wined3d/texture.c | 8 +--
dlls/wined3d/utils.c | 115 ++++++++++++++++++++-------------
dlls/wined3d/wined3d_private.h | 6 +-
6 files changed, 93 insertions(+), 63 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index baf30fa86ba..72c5167131a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4722,11 +4722,11 @@ static bool resources_format_compatible(const struct wined3d_resource *src_resou
return true;
if (src_resource->device->cs->c.state->feature_level < WINED3D_FEATURE_LEVEL_10_1)
return false;
- if ((src_resource->format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if ((src_resource->format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
&& (dst_resource->format_flags & WINED3DFMT_FLAG_CAST_TO_BLOCK))
return src_resource->format->block_byte_count == dst_resource->format->byte_count;
if ((src_resource->format_flags & WINED3DFMT_FLAG_CAST_TO_BLOCK)
- && (dst_resource->format_flags & WINED3DFMT_FLAG_BLOCKS))
+ && (dst_resource->format_attrs & WINED3D_FORMAT_ATTR_BLOCKS))
return src_resource->format->byte_count == dst_resource->format->block_byte_count;
return false;
}
@@ -5222,7 +5222,8 @@ HRESULT CDECL wined3d_device_context_map(struct wined3d_device_context *context,
if (resource->type != WINED3D_RTYPE_BUFFER && resource->type != WINED3D_RTYPE_TEXTURE_2D)
return WINED3DERR_INVALIDCALL;
- if ((resource->format_flags & WINED3DFMT_FLAG_BLOCKS) && !(resource->access & WINED3D_RESOURCE_ACCESS_CPU))
+ if ((resource->format_attrs & WINED3D_FORMAT_ATTR_BLOCKS) &&
+ !(resource->access & WINED3D_RESOURCE_ACCESS_CPU))
return WINED3DERR_INVALIDCALL;
}
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 7feaec04676..4ad8745f109 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -174,8 +174,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
}
if (base_type != WINED3D_GL_RES_TYPE_COUNT
- && (format->flags[base_type] & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY))
- == WINED3DFMT_FLAG_BLOCKS)
+ && (format->attrs & (WINED3D_FORMAT_ATTR_BLOCKS | WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY))
+ == WINED3D_FORMAT_ATTR_BLOCKS)
{
UINT width_mask = format->block_width - 1;
UINT height_mask = format->block_height - 1;
@@ -520,7 +520,7 @@ HRESULT wined3d_resource_check_box_dimensions(struct wined3d_resource *resource,
return WINEDDERR_INVALIDRECT;
}
- if (resource->format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (resource->format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
{
/* This assumes power of two block sizes, but NPOT block sizes would
* be silly anyway.
@@ -597,7 +597,8 @@ void *resource_offset_map_pointer(struct wined3d_resource *resource, unsigned in
wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, &row_pitch, &slice_pitch);
- if ((resource->format_flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_BLOCKS)
+ if ((resource->format_attrs & (WINED3D_FORMAT_ATTR_BLOCKS | WINED3D_FORMAT_ATTR_BROKEN_PITCH))
+ == WINED3D_FORMAT_ATTR_BLOCKS)
{
/* Compressed textures are block based, so calculate the offset of
* the block that contains the top-left pixel of the mapped box. */
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 29bdef9844f..747a25d5fe5 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -652,6 +652,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
const struct wined3d_format *src_format, *dst_format;
struct wined3d_texture *converted_texture = NULL;
struct wined3d_bo_address src_data, dst_data;
+ unsigned int src_fmt_attrs, dst_fmt_attrs;
unsigned int src_fmt_flags, dst_fmt_flags;
struct wined3d_map_desc dst_map, src_map;
unsigned int x, sx, xinc, y, sy, yinc;
@@ -707,12 +708,12 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
else
{
same_sub_resource = FALSE;
- upload = dst_format->flags[dst_texture->resource.gl_type] & WINED3DFMT_FLAG_BLOCKS
+ upload = dst_format->attrs & WINED3D_FORMAT_ATTR_BLOCKS
&& (dst_width != src_width || dst_height != src_height);
if (upload)
{
- dst_format = src_format->flags[dst_texture->resource.gl_type] & WINED3DFMT_FLAG_BLOCKS
+ dst_format = src_format->attrs & WINED3D_FORMAT_ATTR_BLOCKS
? wined3d_get_format(device->adapter, WINED3DFMT_B8G8R8A8_UNORM, 0) : src_format;
}
@@ -759,7 +760,9 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
dst_texture->sub_resources[dst_sub_resource_idx].size, WINED3D_MAP_WRITE);
}
}
+ src_fmt_attrs = src_format->attrs;
src_fmt_flags = src_format->flags[src_texture->resource.gl_type];
+ dst_fmt_attrs = dst_format->attrs;
dst_fmt_flags = dst_format->flags[dst_texture->resource.gl_type];
flags &= ~WINED3D_BLT_RAW;
@@ -773,7 +776,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
+ ((dst_box->top / dst_format->block_height) * dst_map.row_pitch)
+ ((dst_box->left / dst_format->block_width) * dst_format->block_byte_count);
- if (src_fmt_flags & dst_fmt_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (src_fmt_attrs & dst_fmt_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
{
TRACE("%s -> %s copy.\n", debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
@@ -1188,7 +1191,7 @@ static void surface_cpu_blt_colour_fill(struct wined3d_rendertarget_view *view,
TRACE("view %p, box %s, colour %s.\n", view, debug_box(box), debug_color(colour));
- if (view->format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (view->format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
{
FIXME("Not implemented for format %s.\n", debug_d3dformat(view->format->id));
return;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 1e9fe49f887..6b867b1e476 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2537,7 +2537,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
bo.buffer_object = src_bo_addr->buffer_object;
bo.addr = (BYTE *)src_bo_addr->addr + src_box->front * src_slice_pitch;
- if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (dst_texture->resource.format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
{
bo.addr += (src_box->top / src_format->block_height) * src_row_pitch;
bo.addr += (src_box->left / src_format->block_width) * src_format->block_byte_count;
@@ -2573,7 +2573,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
}
else
{
- if (dst_texture->resource.format_flags & WINED3DFMT_FLAG_BLOCKS)
+ if (dst_texture->resource.format_attrs & WINED3D_FORMAT_ATTR_BLOCKS)
ERR("Converting a block-based format.\n");
f = *wined3d_format_gl(src_format);
@@ -3635,7 +3635,7 @@ static void texture_resource_sub_resource_get_map_pitch(struct wined3d_resource
const struct wined3d_texture *texture = texture_from_resource(resource);
unsigned int level = sub_resource_idx % texture->level_count;
- if (resource->format_flags & WINED3DFMT_FLAG_BROKEN_PITCH)
+ if (resource->format_attrs & WINED3D_FORMAT_ATTR_BROKEN_PITCH)
{
*row_pitch = wined3d_texture_get_level_width(texture, level) * resource->format->byte_count;
*slice_pitch = wined3d_texture_get_level_height(texture, level) * (*row_pitch);
@@ -3927,7 +3927,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
* compressed block. It is questionable how useful these mip-levels are to
* the application with "broken pitch" formats, but we want to avoid
* memory corruption when loading textures into WINED3D_LOCATION_SYSMEM. */
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BROKEN_PITCH)
+ if (format->attrs & WINED3D_FORMAT_ATTR_BROKEN_PITCH)
{
unsigned int min_size;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 085e4947f22..50ccde057f0 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -315,10 +315,14 @@ struct wined3d_format_base_flags
* resource size. */
static const struct wined3d_format_base_flags format_base_flags[] =
{
- {WINED3DFMT_ATI1N, 0, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH},
- {WINED3DFMT_ATI2N, 0, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH},
- {WINED3DFMT_D16_LOCKABLE, 0, WINED3DFMT_FLAG_MAPPABLE},
- {WINED3DFMT_INTZ, 0, WINED3DFMT_FLAG_MAPPABLE},
+ {WINED3DFMT_ATI1N, WINED3D_FORMAT_ATTR_BROKEN_PITCH,
+ WINED3DFMT_FLAG_MAPPABLE},
+ {WINED3DFMT_ATI2N, WINED3D_FORMAT_ATTR_BROKEN_PITCH,
+ WINED3DFMT_FLAG_MAPPABLE},
+ {WINED3DFMT_D16_LOCKABLE, 0,
+ WINED3DFMT_FLAG_MAPPABLE},
+ {WINED3DFMT_INTZ, 0,
+ WINED3DFMT_FLAG_MAPPABLE},
{WINED3DFMT_R11G11B10_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
{WINED3DFMT_D32_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
{WINED3DFMT_S8_UINT_D24_FLOAT, WINED3D_FORMAT_ATTR_FLOAT},
@@ -328,25 +332,44 @@ static const struct wined3d_format_base_flags format_base_flags[] =
{WINED3DFMT_NVDB, WINED3D_FORMAT_ATTR_EXTENSION},
{WINED3DFMT_ATOC, WINED3D_FORMAT_ATTR_EXTENSION},
{WINED3DFMT_RESZ, WINED3D_FORMAT_ATTR_EXTENSION},
- {WINED3DFMT_R32G32B32A32_TYPELESS, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32B32A32_FLOAT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32B32A32_UINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32B32A32_SINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_TYPELESS, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_FLOAT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_UNORM, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_UINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_SNORM, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R16G16B16A16_SINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32_TYPELESS, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32_FLOAT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32_UINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32G32_SINT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32_TYPELESS, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {WINED3DFMT_R32_FLOAT, 0, WINED3DFMT_FLAG_CAST_TO_BLOCK},
- {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_R32G32B32A32_TYPELESS, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32B32A32_FLOAT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32B32A32_UINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32B32A32_SINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_TYPELESS, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_FLOAT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_UNORM, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_UINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_SNORM, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R16G16B16A16_SINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32_TYPELESS, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32_FLOAT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32_UINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32G32_SINT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32_TYPELESS, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {WINED3DFMT_R32_FLOAT, 0,
+ WINED3DFMT_FLAG_CAST_TO_BLOCK},
+ {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, WINED3D_FORMAT_ATTR_NORMALISED},
{WINED3DFMT_B10G10R10A2_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
{WINED3DFMT_B2G3R3_UNORM, WINED3D_FORMAT_ATTR_NORMALISED},
@@ -673,30 +696,31 @@ struct wined3d_format_block_info
UINT block_width;
UINT block_height;
UINT block_byte_count;
+ unsigned int attrs;
unsigned int flags;
};
static const struct wined3d_format_block_info format_block_info[] =
{
- {WINED3DFMT_DXT1, 4, 4, 8, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_DXT2, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_DXT3, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_DXT4, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_DXT5, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC1_UNORM, 4, 4, 8, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC2_UNORM, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC3_UNORM, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC4_UNORM, 4, 4, 8, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC4_SNORM, 4, 4, 8, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC5_UNORM, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC5_SNORM, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC6H_UF16, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC6H_SF16, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_BC7_UNORM, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED},
- {WINED3DFMT_ATI1N, 4, 4, 8, WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
- {WINED3DFMT_ATI2N, 4, 4, 16, WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
- {WINED3DFMT_YUY2, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
- {WINED3DFMT_UYVY, 2, 1, 4, WINED3DFMT_FLAG_BLOCKS_NO_VERIFY},
+ {WINED3DFMT_DXT1, 4, 4, 8, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_DXT2, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_DXT3, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_DXT4, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_DXT5, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC1_UNORM, 4, 4, 8, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC2_UNORM, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC3_UNORM, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC4_UNORM, 4, 4, 8, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC4_SNORM, 4, 4, 8, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC5_UNORM, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC5_SNORM, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC6H_UF16, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC6H_SF16, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_BC7_UNORM, 4, 4, 16, 0, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_ATI1N, 4, 4, 8, WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_ATI2N, 4, 4, 16, WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY, WINED3DFMT_FLAG_COMPRESSED},
+ {WINED3DFMT_YUY2, 2, 1, 4, WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY},
+ {WINED3DFMT_UYVY, 2, 1, 4, WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY},
{WINED3DFMT_R9G9B9E5_SHAREDEXP, 1, 1, 4},
};
@@ -2167,7 +2191,8 @@ static BOOL init_format_block_info(struct wined3d_adapter *adapter)
format->block_width = format_block_info[i].block_width;
format->block_height = format_block_info[i].block_height;
format->block_byte_count = format_block_info[i].block_byte_count;
- format_set_flag(format, WINED3DFMT_FLAG_BLOCKS | format_block_info[i].flags);
+ format->attrs |= WINED3D_FORMAT_ATTR_BLOCKS | format_block_info[i].attrs;
+ format_set_flag(format, format_block_info[i].flags);
}
return TRUE;
@@ -4521,7 +4546,7 @@ void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigne
{
/* For block based formats, pitch means the amount of bytes to the next
* row of blocks rather than the next row of pixels. */
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BLOCKS)
+ if (format->attrs & WINED3D_FORMAT_ATTR_BLOCKS)
{
unsigned int row_block_count = (width + format->block_width - 1) / format->block_width;
unsigned int slice_block_count = (height + format->block_height - 1) / format->block_height;
@@ -4554,7 +4579,7 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali
if (format->id == WINED3DFMT_UNKNOWN)
return 0;
- if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_BROKEN_PITCH)
+ if (format->attrs & WINED3D_FORMAT_ATTR_BROKEN_PITCH)
return width * height * depth * format->byte_count;
wined3d_format_calculate_pitch(format, alignment, width, height, &row_pitch, &slice_pitch);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 60f93d5b927..3f2c6d2c86c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -6111,6 +6111,9 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3D_FORMAT_ATTR_NORMALISED 0x00000004
#define WINED3D_FORMAT_ATTR_BUMPMAP 0x00000008
#define WINED3D_FORMAT_ATTR_EXTENSION 0x00000010
+#define WINED3D_FORMAT_ATTR_BLOCKS 0x00000020
+#define WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY 0x00000040
+#define WINED3D_FORMAT_ATTR_BROKEN_PITCH 0x00000080
/* WineD3D pixel format flags */
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
@@ -6126,11 +6129,8 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_VTF 0x00002000
#define WINED3DFMT_FLAG_SHADOW 0x00004000
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
-#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
-#define WINED3DFMT_FLAG_BLOCKS 0x00020000
#define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
#define WINED3DFMT_FLAG_TEXTURE 0x00080000
-#define WINED3DFMT_FLAG_BLOCKS_NO_VERIFY 0x00100000
#define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
#define WINED3DFMT_FLAG_BLIT 0x02000000
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/79
More information about the wine-devel
mailing list