wined3d: Forbid creating SRVs with level or layer count equal to 0.

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:32 +02:00 committed by Alexandre Julliard
parent b44b0690d3
commit 5f4fc0a937
1 changed files with 3 additions and 1 deletions

View File

@ -298,8 +298,10 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
struct wined3d_texture *texture = texture_from_resource(resource); struct wined3d_texture *texture = texture_from_resource(resource);
unsigned int i; unsigned int i;
if (desc->u.texture.level_idx >= texture->level_count if (!desc->u.texture.level_count
|| desc->u.texture.level_idx >= texture->level_count
|| desc->u.texture.level_count > texture->level_count - desc->u.texture.level_idx || desc->u.texture.level_count > texture->level_count - desc->u.texture.level_idx
|| !desc->u.texture.layer_count
|| desc->u.texture.layer_idx >= texture->layer_count || desc->u.texture.layer_idx >= texture->layer_count
|| desc->u.texture.layer_count > texture->layer_count - desc->u.texture.layer_idx) || desc->u.texture.layer_count > texture->layer_count - desc->u.texture.layer_idx)
return E_INVALIDARG; return E_INVALIDARG;