wined3d: Introduce WINED3DFMT_FLAG_BLIT.
To indicate whether a particular format can be used for "off-screen plain" surfaces. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
723e62ab99
commit
3ad933d5e6
|
@ -1474,41 +1474,9 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL wined3d_check_surface_capability(const struct wined3d_format *format, BOOL no3d)
|
||||
static BOOL wined3d_check_surface_capability(const struct wined3d_format *format)
|
||||
{
|
||||
if (no3d)
|
||||
{
|
||||
switch (format->id)
|
||||
{
|
||||
case WINED3DFMT_B8G8R8_UNORM:
|
||||
TRACE("[FAILED] - Not enumerated on Windows.\n");
|
||||
return FALSE;
|
||||
case WINED3DFMT_B8G8R8A8_UNORM:
|
||||
case WINED3DFMT_B8G8R8X8_UNORM:
|
||||
case WINED3DFMT_B5G6R5_UNORM:
|
||||
case WINED3DFMT_B5G5R5X1_UNORM:
|
||||
case WINED3DFMT_B5G5R5A1_UNORM:
|
||||
case WINED3DFMT_B4G4R4A4_UNORM:
|
||||
case WINED3DFMT_B2G3R3_UNORM:
|
||||
case WINED3DFMT_A8_UNORM:
|
||||
case WINED3DFMT_B2G3R3A8_UNORM:
|
||||
case WINED3DFMT_B4G4R4X4_UNORM:
|
||||
case WINED3DFMT_R10G10B10A2_UNORM:
|
||||
case WINED3DFMT_R8G8B8A8_UNORM:
|
||||
case WINED3DFMT_R8G8B8X8_UNORM:
|
||||
case WINED3DFMT_R16G16_UNORM:
|
||||
case WINED3DFMT_B10G10R10A2_UNORM:
|
||||
case WINED3DFMT_R16G16B16A16_UNORM:
|
||||
case WINED3DFMT_P8_UINT:
|
||||
TRACE("[OK]\n");
|
||||
return TRUE;
|
||||
default:
|
||||
TRACE("[FAILED] - Not available on GDI surfaces.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (format->glInternal)
|
||||
if ((format->flags[WINED3D_GL_RES_TYPE_TEX_2D] | format->flags[WINED3D_GL_RES_TYPE_RB]) & WINED3DFMT_FLAG_BLIT)
|
||||
{
|
||||
TRACE("[OK]\n");
|
||||
return TRUE;
|
||||
|
@ -1589,7 +1557,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
allowed_usage |= WINED3DUSAGE_QUERY_SRGBWRITE;
|
||||
if (!(usage & WINED3DUSAGE_TEXTURE))
|
||||
{
|
||||
if (!wined3d_check_surface_capability(format, wined3d->flags & WINED3D_NO3D))
|
||||
if (!wined3d_check_surface_capability(format))
|
||||
{
|
||||
TRACE("[FAILED] - Not supported for plain surfaces.\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
@ -2490,7 +2458,7 @@ static BOOL wined3d_adapter_no3d_init(struct wined3d_adapter *adapter)
|
|||
adapter->vram_bytes_used = 0;
|
||||
TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes));
|
||||
|
||||
if (!wined3d_adapter_init_format_info(adapter, sizeof(struct wined3d_format)))
|
||||
if (!wined3d_adapter_no3d_init_format_info(adapter))
|
||||
return FALSE;
|
||||
|
||||
adapter->vertex_pipe = &none_vertex_pipe;
|
||||
|
|
|
@ -3158,23 +3158,23 @@ static BOOL init_format_texture_info(struct wined3d_adapter *adapter, struct win
|
|||
format->height_scale.numerator = 1;
|
||||
format->height_scale.denominator = 1;
|
||||
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_1D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
format->flags[WINED3D_GL_RES_TYPE_BUFFER] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
|
||||
/* 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)))
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_3D] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
|
||||
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_CUBE] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
|
||||
if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_RECT] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
|
||||
format->flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags;
|
||||
format->flags[WINED3D_GL_RES_TYPE_RB] |= format_texture_info[i].flags | WINED3DFMT_FLAG_BLIT;
|
||||
format->flags[WINED3D_GL_RES_TYPE_RB] &= ~WINED3DFMT_FLAG_TEXTURE;
|
||||
|
||||
if (format->glGammaInternal != format->glInternal
|
||||
|
@ -3544,9 +3544,11 @@ 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_internal(adapter, WINED3DFMT_YUY2);
|
||||
format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
|
||||
format->glInternal = 0;
|
||||
|
||||
format = get_format_internal(adapter, WINED3DFMT_UYVY);
|
||||
format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
|
||||
format->glInternal = 0;
|
||||
}
|
||||
|
||||
|
@ -3568,9 +3570,11 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
|
|||
else
|
||||
{
|
||||
format = get_format_internal(adapter, WINED3DFMT_YV12);
|
||||
format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
|
||||
format->glInternal = 0;
|
||||
|
||||
format = get_format_internal(adapter, WINED3DFMT_NV12);
|
||||
format_clear_flag(format, WINED3DFMT_FLAG_BLIT);
|
||||
format->glInternal = 0;
|
||||
}
|
||||
|
||||
|
@ -3979,6 +3983,47 @@ fail:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter)
|
||||
{
|
||||
struct wined3d_format *format;
|
||||
unsigned int i;
|
||||
|
||||
static const enum wined3d_format_id blit_formats[] =
|
||||
{
|
||||
WINED3DFMT_B8G8R8A8_UNORM,
|
||||
WINED3DFMT_B8G8R8X8_UNORM,
|
||||
WINED3DFMT_B5G6R5_UNORM,
|
||||
WINED3DFMT_B5G5R5X1_UNORM,
|
||||
WINED3DFMT_B5G5R5A1_UNORM,
|
||||
WINED3DFMT_B4G4R4A4_UNORM,
|
||||
WINED3DFMT_B2G3R3_UNORM,
|
||||
WINED3DFMT_A8_UNORM,
|
||||
WINED3DFMT_B2G3R3A8_UNORM,
|
||||
WINED3DFMT_B4G4R4X4_UNORM,
|
||||
WINED3DFMT_R10G10B10A2_UNORM,
|
||||
WINED3DFMT_R8G8B8A8_UNORM,
|
||||
WINED3DFMT_R8G8B8X8_UNORM,
|
||||
WINED3DFMT_R16G16_UNORM,
|
||||
WINED3DFMT_B10G10R10A2_UNORM,
|
||||
WINED3DFMT_R16G16B16A16_UNORM,
|
||||
WINED3DFMT_P8_UINT,
|
||||
};
|
||||
|
||||
if (!wined3d_adapter_init_format_info(adapter, sizeof(struct wined3d_format)))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(blit_formats); ++i)
|
||||
{
|
||||
if (!(format = get_format_internal(adapter, blit_formats[i])))
|
||||
return FALSE;
|
||||
|
||||
format->flags[WINED3D_GL_RES_TYPE_TEX_2D] |= WINED3DFMT_FLAG_BLIT;
|
||||
format->flags[WINED3D_GL_RES_TYPE_RB] |= WINED3DFMT_FLAG_BLIT;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter, struct wined3d_caps_gl_ctx *ctx)
|
||||
{
|
||||
|
|
|
@ -2695,6 +2695,7 @@ struct wined3d_caps_gl_ctx
|
|||
BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter, size_t format_size) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_adapter_gl_init_format_info(struct wined3d_adapter *adapter,
|
||||
struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
BOOL wined3d_adapter_no3d_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN;
|
||||
UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN;
|
||||
|
||||
BOOL wined3d_caps_gl_ctx_test_viewport_subpixel_bits(struct wined3d_caps_gl_ctx *ctx) DECLSPEC_HIDDEN;
|
||||
|
@ -4299,6 +4300,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
|
|||
#define WINED3DFMT_FLAG_GEN_MIPMAP 0x00400000
|
||||
#define WINED3DFMT_FLAG_NORMALISED 0x00800000
|
||||
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
|
||||
#define WINED3DFMT_FLAG_BLIT 0x02000000
|
||||
|
||||
struct wined3d_rational
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue