Commit c24ca340 authored by Chip Davis's avatar Chip Davis Committed by Alexandre Julliard

wined3d: Move WINED3DFMT_FLAG_COMPRESSED and HEIGHT_SCALE to the attributes group.

parent 16bfa3b6
......@@ -7744,8 +7744,8 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine
return FALSE;
}
decompress = (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
&& !(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED);
decompress = (src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
&& !(dst_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED);
if (!decompress && !(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
return FALSE;
......
......@@ -13060,8 +13060,8 @@ static BOOL glsl_blitter_supported(enum wined3d_blit_op blit_op, const struct wi
/* We don't necessarily want to blit from resources without
* WINED3D_RESOURCE_ACCESS_GPU, but that may be the only way to decompress
* compressed textures. */
decompress = (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
&& !(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED);
decompress = (src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
&& !(dst_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED);
if (!decompress && !(src_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
{
TRACE("Source resource does not have GPU access.\n");
......
......@@ -255,7 +255,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
if (!(conv = find_converter(src_format->id, dst_format->id)) && ((device->wined3d->flags & WINED3D_NO3D)
|| !is_identity_fixup(src_format->color_fixup) || src_format->conv_byte_count
|| !is_identity_fixup(dst_format->color_fixup) || dst_format->conv_byte_count
|| ((src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
|| ((src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
&& !src_format->decompress)))
{
FIXME("Cannot find a conversion function from format %s to %s.\n",
......@@ -653,7 +653,6 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
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;
struct wined3d_context *context;
......@@ -761,9 +760,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
}
}
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;
bpp = dst_format->byte_count;
......@@ -793,7 +790,7 @@ static HRESULT surface_cpu_blt(struct wined3d_texture *dst_texture, unsigned int
goto release;
}
if ((src_fmt_flags | dst_fmt_flags) & WINED3DFMT_FLAG_HEIGHT_SCALE)
if ((src_fmt_attrs | dst_fmt_attrs) & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
{
FIXME("Unsupported blit between height-scaled formats (src %s, dst %s).\n",
debug_d3dformat(src_format->id), debug_d3dformat(dst_format->id));
......
......@@ -71,7 +71,7 @@ static BOOL wined3d_texture_use_immutable_storage(const struct wined3d_texture *
/* We don't expect to create texture views for textures with height-scaled formats.
* Besides, ARB_texture_storage doesn't allow specifying exact sizes for all levels. */
return gl_info->supported[ARB_TEXTURE_STORAGE]
&& !(texture->resource.format_flags & WINED3DFMT_FLAG_HEIGHT_SCALE);
&& !(texture->resource.format_attrs & WINED3D_FORMAT_ATTR_HEIGHT_SCALE);
}
/* Front buffer coordinates are always full screen coordinates, but our GL
......@@ -279,7 +279,7 @@ static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win
if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
return false;
if ((src_resource->format_flags | dst_resource->format_flags) & WINED3DFMT_FLAG_HEIGHT_SCALE)
if ((src_resource->format_attrs | dst_resource->format_attrs) & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
return false;
/* Source and/or destination need to be on the GL side. */
......@@ -978,7 +978,7 @@ static void wined3d_texture_gl_allocate_mutable_storage(struct wined3d_texture_g
{
width = wined3d_texture_get_level_pow2_width(&texture_gl->t, level);
height = wined3d_texture_get_level_pow2_height(&texture_gl->t, level);
if (texture_gl->t.resource.format_flags & WINED3DFMT_FLAG_HEIGHT_SCALE)
if (texture_gl->t.resource.format_attrs & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
{
height *= format->f.height_scale.numerator;
height /= format->f.height_scale.denominator;
......@@ -2268,7 +2268,7 @@ static void wined3d_texture_gl_upload_bo(const struct wined3d_format *src_format
{
const struct wined3d_format_gl *format_gl = wined3d_format_gl(src_format);
if (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
if (src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
{
GLenum internal = wined3d_gl_get_internal_format(&dst_texture->resource, format_gl, srgb);
unsigned int dst_row_pitch, dst_slice_pitch;
......@@ -2411,8 +2411,7 @@ static enum wined3d_format_id wined3d_get_alpha_fixup_format(enum wined3d_format
{
unsigned int i;
if (!(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
&& !dst_format->alpha_size)
if (!(dst_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED) && !dst_format->alpha_size)
return WINED3DFMT_UNKNOWN;
for (i = 0; i < ARRAY_SIZE(formats_src_alpha_fixup); ++i)
......@@ -2510,7 +2509,7 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context,
dst_texture->resource.pin_sysmem = 1;
}
if (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_HEIGHT_SCALE)
if (src_format->attrs & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
{
update_h *= src_format->height_scale.numerator;
update_h /= src_format->height_scale.denominator;
......@@ -2723,7 +2722,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
if (bo)
ERR("NP2 emulated texture uses PBO unexpectedly.\n");
if (texture_gl->t.resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
if (texture_gl->t.resource.format_attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
ERR("Unexpected compressed format for NP2 emulated texture.\n");
}
......@@ -2771,7 +2770,7 @@ static void wined3d_texture_gl_download_data_slow_path(struct wined3d_texture_gl
mem = data->addr;
}
if (texture_gl->t.resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
if (texture_gl->t.resource.format_attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
{
TRACE("Downloading compressed texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
texture_gl, sub_resource_idx, level, format_gl->format, format_gl->type, mem);
......@@ -2987,7 +2986,7 @@ static void wined3d_texture_gl_download_data(struct wined3d_context *context,
checkGLcall("glBindBuffer");
}
if (src_texture->resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
if (src_texture->resource.format_attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
{
TRACE("Downloading compressed texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
src_texture, src_sub_resource_idx, src_level, format_gl->format, format_gl->type, offset);
......@@ -3862,8 +3861,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
if (desc->resource_type != WINED3D_RTYPE_TEXTURE_3D && !d3d_info->texture_npot_conditional)
{
/* TODO: Add support for non-power-of-two compressed textures. */
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D]
& (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_HEIGHT_SCALE))
if (format->attrs & (WINED3D_FORMAT_ATTR_COMPRESSED | WINED3D_FORMAT_ATTR_HEIGHT_SCALE))
{
FIXME("Compressed or height scaled non-power-of-two (%ux%u) textures are not supported.\n",
desc->width, desc->height);
......@@ -5280,7 +5278,7 @@ static bool wined3d_texture_vk_clear(struct wined3d_texture_vk *texture_vk,
VkImageAspectFlags aspect_mask;
VkImage vk_image;
if (texture_vk->t.resource.format_flags & WINED3DFMT_FLAG_COMPRESSED)
if (texture_vk->t.resource.format_attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
{
struct wined3d_bo_address addr;
......@@ -5714,8 +5712,8 @@ static bool ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3
if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
return false;
decompress = (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
&& !(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED);
decompress = (src_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
&& !(dst_format->attrs & WINED3D_FORMAT_ATTR_COMPRESSED);
if (!decompress && !(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU))
{
TRACE("Source or destination resource is not GPU accessible.\n");
......@@ -6489,7 +6487,8 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
* We also can't copy between depth/stencil and colour resources, since
* the formats are considered incompatible in OpenGL. */
if (op != WINED3D_BLIT_OP_RAW_BLIT || !gl_formats_compatible(src_texture, src_location, dst_texture, dst_location)
|| ((src_texture->resource.format_flags | dst_texture->resource.format_flags) & WINED3DFMT_FLAG_HEIGHT_SCALE)
|| ((src_texture->resource.format_attrs | dst_texture->resource.format_attrs)
& WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
|| (src_texture->resource.format->id == dst_texture->resource.format->id
&& (!(src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|| !(dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)))))
......
......@@ -697,28 +697,27 @@ struct wined3d_format_block_info
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, 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_DXT1, 4, 4, 8, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_DXT2, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_DXT3, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_DXT4, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_DXT5, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC1_UNORM, 4, 4, 8, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC2_UNORM, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC3_UNORM, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC4_UNORM, 4, 4, 8, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC4_SNORM, 4, 4, 8, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC5_UNORM, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC5_SNORM, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC6H_UF16, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC6H_SF16, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_BC7_UNORM, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED},
{WINED3DFMT_ATI1N, 4, 4, 8, WINED3D_FORMAT_ATTR_COMPRESSED | WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY},
{WINED3DFMT_ATI2N, 4, 4, 16, WINED3D_FORMAT_ATTR_COMPRESSED | WINED3D_FORMAT_ATTR_BLOCKS_NO_VERIFY},
{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},
......@@ -2192,7 +2191,6 @@ static BOOL init_format_block_info(struct wined3d_adapter *adapter)
format->block_height = format_block_info[i].block_height;
format->block_byte_count = format_block_info[i].block_byte_count;
format->attrs |= WINED3D_FORMAT_ATTR_BLOCKS | format_block_info[i].attrs;
format_set_flag(format, format_block_info[i].flags);
}
return TRUE;
......@@ -2940,7 +2938,7 @@ static void init_format_fbo_compat_info(const struct wined3d_adapter *adapter,
if (!format->internal)
continue;
if (format->f.flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
if (format->f.attrs & WINED3D_FORMAT_ATTR_COMPRESSED)
{
TRACE("Skipping format %s because it's a compressed format.\n",
debug_d3dformat(format->f.id));
......@@ -3659,13 +3657,13 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
|| (gl_info->supported[ARB_FRAGMENT_SHADER] && gl_info->supported[ARB_VERTEX_SHADER]))
{
format = get_format_gl_internal(adapter, WINED3DFMT_YV12);
format_set_flag(&format->f, WINED3DFMT_FLAG_HEIGHT_SCALE);
format->f.attrs |= WINED3D_FORMAT_ATTR_HEIGHT_SCALE;
format->f.height_scale.numerator = 3;
format->f.height_scale.denominator = 2;
format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
format = get_format_gl_internal(adapter, WINED3DFMT_NV12);
format_set_flag(&format->f, WINED3DFMT_FLAG_HEIGHT_SCALE);
format->f.attrs |= WINED3D_FORMAT_ATTR_HEIGHT_SCALE;
format->f.height_scale.numerator = 3;
format->f.height_scale.denominator = 2;
format->f.color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_NV12);
......@@ -4561,7 +4559,7 @@ void wined3d_format_calculate_pitch(const struct wined3d_format *format, unsigne
*slice_pitch = *row_pitch * height;
}
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_HEIGHT_SCALE)
if (format->attrs & WINED3D_FORMAT_ATTR_HEIGHT_SCALE)
{
/* The D3D format requirements make sure that the resulting format is an integer again */
*slice_pitch *= format->height_scale.numerator;
......
......@@ -6115,7 +6115,9 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#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
#define WINED3D_FORMAT_ATTR_COMPRESSED 0x00000080
#define WINED3D_FORMAT_ATTR_BROKEN_PITCH 0x00000100
#define WINED3D_FORMAT_ATTR_HEIGHT_SCALE 0x00000200
/* WineD3D pixel format flags */
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
......@@ -6130,8 +6132,6 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_SRGB_WRITE 0x00001000
#define WINED3DFMT_FLAG_VTF 0x00002000
#define WINED3DFMT_FLAG_SHADOW 0x00004000
#define WINED3DFMT_FLAG_COMPRESSED 0x00008000
#define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
#define WINED3DFMT_FLAG_TEXTURE 0x00080000
#define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
......
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