Commit 93add6f3 authored by Chip Davis's avatar Chip Davis Committed by Alexandre Julliard

wined3d: Move WINED3DFMT_FLAG_FLOAT to a separate group.

There are only three unused format flags left. I will soon submit changes which add four more format flags. I've noticed that format flags generally fall into two groups: * The first group consists of flags describing the content of a pixel format, e.g. whether or not this is a depth format, or whether this is a blocked format. These flags are the same for all resource types. * The second group consists of flags describing capabilities of the implementation with this format. These can and do vary by resource type. Only the second group needs to be stored per-resource-type. Signed-off-by: 's avatarChip Davis <cdavis5x@gmail.com>
parent efe39dc5
......@@ -4474,7 +4474,7 @@ static BOOL wined3d_check_pixel_format_color(const struct wined3d_pixel_format *
const struct wined3d_format *format)
{
/* Float formats need FBOs. If FBOs are used this function isn't called */
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT)
if (format->attrs & WINED3D_FORMAT_ATTR_FLOAT)
return FALSE;
/* Probably a RGBA_float or color index mode. */
......@@ -4496,7 +4496,7 @@ static BOOL wined3d_check_pixel_format_depth(const struct wined3d_pixel_format *
BOOL lockable = FALSE;
/* Float formats need FBOs. If FBOs are used this function isn't called */
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FLOAT)
if (format->attrs & WINED3D_FORMAT_ATTR_FLOAT)
return FALSE;
if ((format->id == WINED3DFMT_D16_LOCKABLE) || (format->id == WINED3DFMT_D32_FLOAT))
......
......@@ -5120,7 +5120,8 @@ 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->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_FLOAT | WINED3DFMT_FLAG_NORMALISED)))
if (!((view->format->attrs & WINED3D_FORMAT_ATTR_FLOAT) ||
(view->format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_NORMALISED)))
{
WARN("Not supported for view format %s.\n", debug_d3dformat(view->format->id));
return;
......
......@@ -188,6 +188,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource->type = type;
resource->gl_type = gl_type;
resource->format = format;
resource->format_attrs = format->attrs;
if (gl_type < WINED3D_GL_RES_TYPE_COUNT)
resource->format_flags = format->flags[gl_type];
resource->multisample_type = multisample_type;
......
......@@ -622,6 +622,7 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
}
if (!(view->format = validate_resource_view(desc, resource, TRUE, allow_srgb_toggle)))
return E_INVALIDARG;
view->format_attrs = view->format->attrs;
view->format_flags = view->format->flags[resource->gl_type];
view->desc = *desc;
......
......@@ -4353,6 +4353,7 @@ struct wined3d_resource
enum wined3d_resource_type type;
enum wined3d_gl_resource_type gl_type;
const struct wined3d_format *format;
unsigned int format_attrs;
unsigned int format_flags;
enum wined3d_multisample_type multisample_type;
UINT multisample_quality;
......@@ -5339,6 +5340,7 @@ struct wined3d_rendertarget_view
const struct wined3d_parent_ops *parent_ops;
const struct wined3d_format *format;
unsigned int format_attrs;
unsigned int format_flags;
unsigned int sub_resource_idx;
unsigned int layer_count;
......@@ -6105,6 +6107,9 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
* Pixel format management
*/
/* Pixel format attributes */
#define WINED3D_FORMAT_ATTR_FLOAT 0x00000001
/* WineD3D pixel format flags */
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
#define WINED3DFMT_FLAG_FILTERING 0x00000002
......@@ -6115,7 +6120,6 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x00000040
#define WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB 0x00000080
#define WINED3DFMT_FLAG_DECOMPRESS 0x00000100
#define WINED3DFMT_FLAG_FLOAT 0x00000200
#define WINED3DFMT_FLAG_BUMPMAP 0x00000400
#define WINED3DFMT_FLAG_SRGB_READ 0x00000800
#define WINED3DFMT_FLAG_SRGB_WRITE 0x00001000
......@@ -6188,6 +6192,7 @@ struct wined3d_format
UINT conv_byte_count;
DWORD multisample_types;
unsigned int attrs;
unsigned int flags[WINED3D_GL_RES_TYPE_COUNT];
float depth_bias_scale;
struct wined3d_rational height_scale;
......
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