wined3d: Forbid creating typeless render target views.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-06-16 11:59:37 +02:00 committed by Alexandre Julliard
parent 3c090180bd
commit b511775b1b
2 changed files with 13 additions and 1 deletions

View File

@ -98,6 +98,13 @@ static HRESULT wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *
view->format = wined3d_get_format(gl_info, desc->format_id);
view->format_flags = view->format->flags[resource->gl_type];
if (wined3d_format_is_typeless(view->format))
{
WARN("Trying to create view for typeless format %s.\n", debug_d3dformat(view->format->id));
return E_INVALIDARG;
}
if (resource->type == WINED3D_RTYPE_BUFFER)
{
view->sub_resource_idx = 0;
@ -277,7 +284,7 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
const struct wined3d_format *view_format;
view_format = wined3d_get_format(gl_info, desc->format_id);
if (view_format->id == view_format->typeless_id)
if (wined3d_format_is_typeless(view_format))
{
WARN("Trying to create view for typeless format %s.\n", debug_d3dformat(view_format->id));
return E_INVALIDARG;

View File

@ -3574,6 +3574,11 @@ void wined3d_format_get_float_color_key(const struct wined3d_format *format,
const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion(
const struct wined3d_texture *texture, BOOL need_alpha_ck) DECLSPEC_HIDDEN;
static inline BOOL wined3d_format_is_typeless(const struct wined3d_format *format)
{
return format->id == format->typeless_id && format->id != WINED3DFMT_UNKNOWN;
}
static inline void *wined3d_calloc(SIZE_T count, SIZE_T size)
{
if (count > ~(SIZE_T)0 / size)