wined3d: Introduce WINED3DFMT_FLAG_DEPTH_STENCIL.
To indicate whether WINED3D_BIND_DEPTH_STENCIL is valid for the format. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
acc96fadd1
commit
9b8847ed7b
|
@ -1437,7 +1437,7 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d_adapter *ad
|
|||
WARN("Format %s is not render target format.\n", debug_d3dformat(rt_format->id));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
if (!(ds_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
if (!(ds_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
{
|
||||
WARN("Format %s is not depth/stencil format.\n", debug_d3dformat(ds_format->id));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -1505,8 +1505,6 @@ static BOOL wined3d_check_depth_stencil_format(const struct wined3d_adapter *ada
|
|||
{
|
||||
if (!ds_format->depth_size && !ds_format->stencil_size)
|
||||
return FALSE;
|
||||
if (!(ds_format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
return FALSE;
|
||||
|
||||
/* Blacklist formats not supported on Windows */
|
||||
if (ds_format->id == WINED3DFMT_S1_UINT_D15_UNORM /* Breaks the shadowvol2 dx7 sdk sample */
|
||||
|
@ -1658,6 +1656,8 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
|
|||
format_flags |= WINED3DFMT_FLAG_TEXTURE;
|
||||
if (bind_flags & WINED3D_BIND_RENDER_TARGET)
|
||||
format_flags |= WINED3DFMT_FLAG_RENDERTARGET;
|
||||
if (bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
format_flags |= WINED3DFMT_FLAG_DEPTH_STENCIL;
|
||||
if (usage & WINED3DUSAGE_QUERY_FILTER)
|
||||
format_flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING)
|
||||
|
|
|
@ -130,7 +130,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
continue;
|
||||
}
|
||||
if ((bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
&& !(format->flags[gl_type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
&& !(format->flags[gl_type] & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
{
|
||||
WARN("Format %s cannot be used for depth/stencil buffers.\n", debug_d3dformat(format->id));
|
||||
continue;
|
||||
|
|
|
@ -297,9 +297,9 @@ static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win
|
|||
break;
|
||||
|
||||
case WINED3D_BLIT_OP_DEPTH_BLIT:
|
||||
if (!(src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
if (!(src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
return false;
|
||||
if (!(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
if (!(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
return false;
|
||||
/* Accept pure swizzle fixups for depth formats. In general we
|
||||
* ignore the stencil component (if present) at the moment and the
|
||||
|
|
|
@ -1785,67 +1785,67 @@ static const struct wined3d_format_texture_info format_texture_info[] =
|
|||
/* Depth stencil formats */
|
||||
{WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL,
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S1_UINT_D15_UNORM, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
EXT_PACKED_DEPTH_STENCIL, convert_s1_uint_d15_unorm},
|
||||
{WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
|
||||
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
| WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
|
||||
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
| WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
EXT_PACKED_DEPTH_STENCIL, NULL},
|
||||
{WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL,
|
||||
WINED3D_GL_EXT_NONE, x8_d24_unorm_upload, x8_d24_unorm_download},
|
||||
{WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
|
||||
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
| WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, x8_d24_unorm_upload, x8_d24_unorm_download},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_S4X4_UINT_D24_UNORM, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4,
|
||||
WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
EXT_PACKED_DEPTH_STENCIL, convert_s4x4_uint_d24_unorm},
|
||||
{WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_DEPTH,
|
||||
WINED3DFMT_FLAG_DEPTH_STENCIL,
|
||||
WINED3D_GL_EXT_NONE, NULL},
|
||||
{WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, 0,
|
||||
GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
|
||||
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
| WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_TEXTURE, NULL},
|
||||
{WINED3DFMT_D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, 0,
|
||||
GL_DEPTH_COMPONENT, GL_FLOAT, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_BUFFER_FLOAT, NULL},
|
||||
{WINED3DFMT_D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_BUFFER_FLOAT, NULL},
|
||||
{WINED3DFMT_S8_UINT_D24_FLOAT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 8,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH_STENCIL | WINED3DFMT_FLAG_SHADOW,
|
||||
ARB_DEPTH_BUFFER_FLOAT, convert_s8_uint_d24_float},
|
||||
{WINED3DFMT_R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, 0,
|
||||
GL_RGBA_INTEGER, GL_UNSIGNED_INT, 0,
|
||||
|
@ -1875,7 +1875,7 @@ static const struct wined3d_format_texture_info format_texture_info[] =
|
|||
{WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0,
|
||||
GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0,
|
||||
WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
|
||||
| WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL,
|
||||
| WINED3DFMT_FLAG_DEPTH_STENCIL,
|
||||
EXT_PACKED_DEPTH_STENCIL, NULL},
|
||||
{WINED3DFMT_NULL, 0, 0, 0,
|
||||
GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0,
|
||||
|
@ -2485,7 +2485,7 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
|
|||
|
||||
create_and_bind_fbo_attachment(gl_info, format, type, &object, format->internal);
|
||||
|
||||
if (format->f.flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
if (format->f.flags[type] & WINED3DFMT_FLAG_DEPTH_STENCIL)
|
||||
{
|
||||
gl_info->fbo_ops.glGenRenderbuffers(1, &color_rb);
|
||||
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, color_rb);
|
||||
|
@ -2711,7 +2711,7 @@ static void check_fbo_compat(struct wined3d_caps_gl_ctx *ctx, struct wined3d_for
|
|||
else if (status == GL_FRAMEBUFFER_COMPLETE)
|
||||
format->f.flags[type] |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB;
|
||||
|
||||
if (format->f.flags[type] & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
if (format->f.flags[type] & WINED3DFMT_FLAG_DEPTH_STENCIL)
|
||||
{
|
||||
gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 0);
|
||||
gl_info->fbo_ops.glDeleteRenderbuffers(1, &color_rb);
|
||||
|
@ -3109,7 +3109,7 @@ static void query_internal_format(struct wined3d_adapter *adapter,
|
|||
query_view_class(format);
|
||||
|
||||
if (format->internal && format->f.flags[WINED3D_GL_RES_TYPE_RB]
|
||||
& (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
|
||||
& (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
{
|
||||
if (gl_info->supported[ARB_INTERNALFORMAT_QUERY])
|
||||
{
|
||||
|
@ -3187,8 +3187,7 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
|
|||
|
||||
/* GL_ARB_depth_texture does not support 3D textures. It also says "cube textures are
|
||||
* problematic", but doesn't explicitly mandate that an error is generated. */
|
||||
if (gl_info->supported[EXT_TEXTURE3D]
|
||||
&& !(format_texture_info[i].flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
|
||||
if (gl_info->supported[EXT_TEXTURE3D] && !(format_texture_info[i].flags & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
format->f.flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
|
||||
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
|
@ -3792,7 +3791,7 @@ static BOOL init_typeless_formats(const struct wined3d_adapter *adapter)
|
|||
for (j = 0; j < ARRAY_SIZE(typeless_ds_format->flags); ++j)
|
||||
{
|
||||
typeless_ds_format->flags[j] = typeless_format->flags[j];
|
||||
typeless_format->flags[j] &= ~(WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
|
||||
typeless_format->flags[j] &= ~WINED3DFMT_FLAG_DEPTH_STENCIL;
|
||||
}
|
||||
|
||||
if ((format_id = typeless_depth_stencil_formats[i].depth_view_id)
|
||||
|
@ -3988,7 +3987,7 @@ static void init_format_depth_bias_scale(struct wined3d_adapter *adapter,
|
|||
{
|
||||
struct wined3d_format_gl *format = get_format_gl_by_idx(adapter, i);
|
||||
|
||||
if (format->f.flags[WINED3D_GL_RES_TYPE_RB] & WINED3DFMT_FLAG_DEPTH)
|
||||
if (format->f.depth_size && (format->f.flags[WINED3D_GL_RES_TYPE_RB] & WINED3DFMT_FLAG_DEPTH_STENCIL))
|
||||
{
|
||||
TRACE("Testing depth bias scale for format %s.\n", debug_d3dformat(format->f.id));
|
||||
format->f.depth_bias_scale = wined3d_adapter_find_polyoffset_scale(ctx, format->internal);
|
||||
|
@ -4235,6 +4234,10 @@ static void init_vulkan_format_info(struct wined3d_format_vk *format,
|
|||
{
|
||||
flags |= WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
|
||||
}
|
||||
if (texture_flags & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
{
|
||||
flags |= WINED3DFMT_FLAG_DEPTH_STENCIL;
|
||||
}
|
||||
if (texture_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT)
|
||||
{
|
||||
flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
|
|
|
@ -5506,8 +5506,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
|
|||
/* WineD3D pixel format flags */
|
||||
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x00000001
|
||||
#define WINED3DFMT_FLAG_FILTERING 0x00000002
|
||||
#define WINED3DFMT_FLAG_DEPTH 0x00000004
|
||||
#define WINED3DFMT_FLAG_STENCIL 0x00000008
|
||||
#define WINED3DFMT_FLAG_DEPTH_STENCIL 0x00000008
|
||||
#define WINED3DFMT_FLAG_RENDERTARGET 0x00000010
|
||||
#define WINED3DFMT_FLAG_EXTENSION 0x00000020
|
||||
#define WINED3DFMT_FLAG_FBO_ATTACHABLE 0x00000040
|
||||
|
|
Loading…
Reference in New Issue