Commit f8ba91ac authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Validate required OpenGL extensions in wined3d_texture_gl_init()…

wined3d: Validate required OpenGL extensions in wined3d_texture_gl_init() instead of wined3d_texture_init(). Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 961a94ac
...@@ -2881,28 +2881,12 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc ...@@ -2881,28 +2881,12 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
if (!desc->width || !desc->height || !desc->depth) if (!desc->width || !desc->height || !desc->depth)
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
if (desc->resource_type == WINED3D_RTYPE_TEXTURE_3D) if (desc->resource_type == WINED3D_RTYPE_TEXTURE_3D && layer_count != 1)
{
if (layer_count != 1)
{ {
ERR("Invalid layer count for volume texture.\n"); ERR("Invalid layer count for volume texture.\n");
return E_INVALIDARG; return E_INVALIDARG;
} }
if (!gl_info->supported[EXT_TEXTURE3D])
{
WARN("OpenGL implementation does not support 3D textures.\n");
return WINED3DERR_INVALIDCALL;
}
}
if (!(desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count > 1
&& !gl_info->supported[EXT_TEXTURE_ARRAY])
{
WARN("OpenGL implementation does not support array textures.\n");
return WINED3DERR_INVALIDCALL;
}
texture->sub_resources = sub_resources; texture->sub_resources = sub_resources;
/* TODO: It should only be possible to create textures for formats /* TODO: It should only be possible to create textures for formats
...@@ -3562,6 +3546,13 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st ...@@ -3562,6 +3546,13 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st
texture_gl, device, desc, layer_count, level_count, texture_gl, device, desc, layer_count, level_count,
flags, parent, parent_ops, sub_resources); flags, parent, parent_ops, sub_resources);
if (!(desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count > 1
&& !gl_info->supported[EXT_TEXTURE_ARRAY])
{
WARN("OpenGL implementation does not support array textures.\n");
return WINED3DERR_INVALIDCALL;
}
switch (desc->resource_type) switch (desc->resource_type)
{ {
case WINED3D_RTYPE_TEXTURE_1D: case WINED3D_RTYPE_TEXTURE_1D:
...@@ -3595,6 +3586,11 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st ...@@ -3595,6 +3586,11 @@ static HRESULT wined3d_texture_gl_init(struct wined3d_texture_gl *texture_gl, st
break; break;
case WINED3D_RTYPE_TEXTURE_3D: case WINED3D_RTYPE_TEXTURE_3D:
if (!gl_info->supported[EXT_TEXTURE3D])
{
WARN("OpenGL implementation does not support 3D textures.\n");
return WINED3DERR_INVALIDCALL;
}
texture_ops = &texture3d_ops; texture_ops = &texture3d_ops;
texture_gl->target = GL_TEXTURE_3D; texture_gl->target = GL_TEXTURE_3D;
break; break;
......
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