wined3d: Add "layer_count" parameter to wined3d_texture_create().
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:
parent
860f5562c7
commit
64014ae3ed
|
@ -577,7 +577,7 @@ static void test_create_texture2d(void)
|
|||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D10_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D10_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D10_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D10_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D10_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
|
@ -595,7 +595,7 @@ static void test_create_texture2d(void)
|
|||
FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 12, D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_TEXTURECUBE,
|
||||
FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D10_BIND_RENDER_TARGET, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D10_BIND_RENDER_TARGET, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 9, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
|
@ -607,7 +607,7 @@ static void test_create_texture2d(void)
|
|||
{DXGI_FORMAT_R32G8X24_TYPELESS, 1, D3D10_BIND_DEPTH_STENCIL, 0, TRUE, TRUE},
|
||||
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D10_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 0, D3D10_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 0, D3D10_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 1, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 9, D3D10_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 9, D3D10_BIND_SHADER_RESOURCE, D3D10_RESOURCE_MISC_TEXTURECUBE,
|
||||
|
|
|
@ -865,7 +865,7 @@ static void test_create_texture2d(void)
|
|||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_VERTEX_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_INDEX_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_CONSTANT_BUFFER, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 3, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
|
@ -883,7 +883,7 @@ static void test_create_texture2d(void)
|
|||
TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 12, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
|
||||
TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_RENDER_TARGET, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 0, D3D11_BIND_RENDER_TARGET, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 2, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, 9, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
|
@ -895,7 +895,7 @@ static void test_create_texture2d(void)
|
|||
{DXGI_FORMAT_R32G8X24_TYPELESS, 1, D3D11_BIND_DEPTH_STENCIL, 0, TRUE, TRUE},
|
||||
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R10G10B10A2_TYPELESS, 1, D3D11_BIND_RENDER_TARGET, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, TRUE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 0, D3D11_BIND_SHADER_RESOURCE, 0, FALSE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 1, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, 0, TRUE, FALSE},
|
||||
{DXGI_FORMAT_R32_TYPELESS, 9, D3D11_BIND_SHADER_RESOURCE, D3D11_RESOURCE_MISC_TEXTURECUBE,
|
||||
|
|
|
@ -457,8 +457,6 @@ static HRESULT d3d_texture2d_init(struct d3d_texture2d *texture, struct d3d_devi
|
|||
wined3d_private_store_init(&texture->private_store);
|
||||
texture->desc = *desc;
|
||||
|
||||
if (desc->ArraySize != 1)
|
||||
FIXME("Array textures not implemented.\n");
|
||||
if (desc->SampleDesc.Count > 1)
|
||||
FIXME("Multisampled textures not implemented.\n");
|
||||
|
||||
|
@ -476,8 +474,8 @@ static HRESULT d3d_texture2d_init(struct d3d_texture2d *texture, struct d3d_devi
|
|||
levels = desc->MipLevels ? desc->MipLevels : wined3d_log2i(max(desc->Width, desc->Height)) + 1;
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &wined3d_desc,
|
||||
levels, 0, (struct wined3d_sub_resource_data *)data, texture,
|
||||
&d3d_texture2d_wined3d_parent_ops, &texture->wined3d_texture)))
|
||||
desc->ArraySize, levels, 0, (struct wined3d_sub_resource_data *)data,
|
||||
texture, &d3d_texture2d_wined3d_parent_ops, &texture->wined3d_texture)))
|
||||
{
|
||||
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
|
||||
wined3d_private_store_cleanup(&texture->private_store);
|
||||
|
@ -930,7 +928,7 @@ static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_devi
|
|||
levels = desc->MipLevels ? desc->MipLevels : wined3d_log2i(max(max(desc->Width, desc->Height), desc->Depth)) + 1;
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &wined3d_desc,
|
||||
levels, 0, (struct wined3d_sub_resource_data *)data, texture,
|
||||
1, levels, 0, (struct wined3d_sub_resource_data *)data, texture,
|
||||
&d3d_texture3d_wined3d_parent_ops, &texture->wined3d_texture)))
|
||||
{
|
||||
WARN("Failed to create wined3d texture, hr %#x.\n", hr);
|
||||
|
|
|
@ -951,7 +951,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
|
|||
wined3d_mutex_lock();
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
|
||||
1, flags, NULL, NULL, &d3d8_null_wined3d_parent_ops, &texture)))
|
||||
1, 1, flags, NULL, NULL, &d3d8_null_wined3d_parent_ops, &texture)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||
|
@ -3027,7 +3027,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
|
|||
TRACE("device_parent %p, container_parent %p, desc %p, texture %p.\n",
|
||||
device_parent, container_parent, desc, texture);
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
NULL, &device->IDirect3DDevice8_iface, &d3d8_null_wined3d_parent_ops, texture)))
|
||||
{
|
||||
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||
|
|
|
@ -1131,7 +1131,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
|
|||
levels = wined3d_log2i(max(width, height)) + 1;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
|
||||
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
@ -1176,7 +1176,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
|
|||
levels = wined3d_log2i(edge_length) + 1;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
|
||||
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
@ -1217,7 +1217,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
|
|||
levels = wined3d_log2i(max(max(width, height), depth)) + 1;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, 0,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
|
||||
NULL, texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -1124,7 +1124,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width
|
|||
wined3d_mutex_lock();
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, &desc,
|
||||
1, flags, NULL, NULL, &d3d9_null_wined3d_parent_ops, &texture)))
|
||||
1, 1, flags, NULL, NULL, &d3d9_null_wined3d_parent_ops, &texture)))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||
|
@ -3677,7 +3677,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
|
|||
if (container_parent == device_parent)
|
||||
container_parent = &device->IDirect3DDevice9Ex_iface;
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1,
|
||||
if (FAILED(hr = wined3d_texture_create(device->wined3d_device, desc, 1, 1,
|
||||
WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, container_parent, &d3d9_null_wined3d_parent_ops, texture)))
|
||||
{
|
||||
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||
|
|
|
@ -1266,7 +1266,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
|
|||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, flags,
|
||||
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
@ -1316,7 +1316,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
|
|||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, flags,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 6, levels, flags,
|
||||
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
@ -1362,7 +1362,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
|
|||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, levels, 0,
|
||||
hr = wined3d_texture_create(device->wined3d_device, &desc, 1, levels, 0,
|
||||
NULL, texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -4818,7 +4818,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1,
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, desc, 1, 1,
|
||||
WINED3D_TEXTURE_CREATE_MAPPABLE, NULL, ddraw, &ddraw_frontbuffer_parent_ops, texture)))
|
||||
{
|
||||
WARN("Failed to create texture, hr %#x.\n", hr);
|
||||
|
|
|
@ -6121,7 +6121,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
* visible on the screen. The game Nox is such an application,
|
||||
* Commandos: Behind Enemy Lines is another. Setting
|
||||
* WINED3D_TEXTURE_CREATE_GET_DC_LENIENT will ensure this. */
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, levels,
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, layers, levels,
|
||||
WINED3D_TEXTURE_CREATE_GET_DC_LENIENT, NULL, texture,
|
||||
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
||||
{
|
||||
|
@ -6240,7 +6240,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER;
|
||||
desc->u5.dwBackBufferCount = 0;
|
||||
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, 1,
|
||||
if (FAILED(hr = wined3d_texture_create(ddraw->wined3d_device, &wined3d_desc, 1, 1,
|
||||
WINED3D_TEXTURE_CREATE_GET_DC_LENIENT, NULL, texture,
|
||||
&ddraw_texture_wined3d_parent_ops, &wined3d_texture)))
|
||||
{
|
||||
|
|
|
@ -645,7 +645,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
|
|||
desc.height = bm.bmHeight;
|
||||
desc.depth = 1;
|
||||
desc.size = 0;
|
||||
if (FAILED(hr = wined3d_texture_create(device, &desc, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
if (FAILED(hr = wined3d_texture_create(device, &desc, 1, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
NULL, NULL, &wined3d_null_parent_ops, &device->logo_texture)))
|
||||
{
|
||||
ERR("Wine logo requested, but failed to create texture, hr %#x.\n", hr);
|
||||
|
@ -4340,7 +4340,7 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
|
|||
desc.depth = 1;
|
||||
desc.size = 0;
|
||||
|
||||
hr = wined3d_texture_create(device, &desc, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
hr = wined3d_texture_create(device, &desc, 1, 1, WINED3D_TEXTURE_CREATE_MAPPABLE,
|
||||
&data, NULL, &wined3d_null_parent_ops, &texture);
|
||||
wined3d_resource_unmap(&cursor_image->resource, sub_resource_idx);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -1540,7 +1540,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
|
||||
desc.depth = 1;
|
||||
desc.size = 0;
|
||||
if (FAILED(wined3d_texture_create(device, &desc, 1,
|
||||
if (FAILED(wined3d_texture_create(device, &desc, 1, 1,
|
||||
WINED3D_TEXTURE_CREATE_MAPPABLE | WINED3D_TEXTURE_CREATE_DISCARD,
|
||||
NULL, NULL, &wined3d_null_parent_ops, &dst_texture)))
|
||||
{
|
||||
|
|
|
@ -1778,6 +1778,9 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
|
|||
unsigned int i, j;
|
||||
HRESULT hr;
|
||||
|
||||
if (!(desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count != 1)
|
||||
FIXME("Array textures not implemented.\n");
|
||||
|
||||
/* TODO: It should only be possible to create textures for formats
|
||||
* that are reported as supported. */
|
||||
if (WINED3DFMT_UNKNOWN >= desc->format)
|
||||
|
@ -1800,15 +1803,15 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
|
|||
&& !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
{
|
||||
/* level_count == 0 returns an error as well. */
|
||||
if (level_count != 1 || desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP)
|
||||
if (level_count != 1 || layer_count != 1)
|
||||
{
|
||||
if (desc->pool != WINED3D_POOL_SCRATCH)
|
||||
{
|
||||
WARN("Attempted to create a mipmapped/cube NPOT texture without unconditional NPOT support.\n");
|
||||
WARN("Attempted to create a mipmapped/cube/array NPOT texture without unconditional NPOT support.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
WARN("Creating a scratch mipmapped/cube NPOT texture despite lack of HW support.\n");
|
||||
WARN("Creating a scratch mipmapped/cube/array NPOT texture despite lack of HW support.\n");
|
||||
}
|
||||
texture->flags |= WINED3D_TEXTURE_COND_NP2;
|
||||
|
||||
|
@ -2084,7 +2087,8 @@ BOOL wined3d_texture_check_block_align(const struct wined3d_texture *texture,
|
|||
}
|
||||
|
||||
static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct wined3d_resource_desc *desc,
|
||||
UINT levels, struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops)
|
||||
UINT layer_count, UINT level_count, struct wined3d_device *device, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops)
|
||||
{
|
||||
struct wined3d_device_parent *device_parent = device->device_parent;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
|
@ -2092,6 +2096,12 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|
|||
unsigned int i;
|
||||
HRESULT hr;
|
||||
|
||||
if (layer_count != 1)
|
||||
{
|
||||
ERR("Invalid layer count for volume texture.\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
/* TODO: It should only be possible to create textures for formats
|
||||
* that are reported as supported. */
|
||||
if (WINED3DFMT_UNKNOWN >= desc->format)
|
||||
|
@ -2115,7 +2125,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (levels != 1)
|
||||
if (level_count != 1)
|
||||
{
|
||||
WARN("WINED3DUSAGE_AUTOGENMIPMAP is set, and level count != 1, returning D3DERR_INVALIDCALL.\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -2157,7 +2167,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|
|||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_texture_init(texture, &texture3d_ops, 1, levels, desc,
|
||||
if (FAILED(hr = wined3d_texture_init(texture, &texture3d_ops, 1, level_count, desc,
|
||||
0, device, parent, parent_ops, &texture_resource_ops)))
|
||||
{
|
||||
WARN("Failed to initialize texture, returning %#x.\n", hr);
|
||||
|
@ -2176,7 +2186,7 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
|
|||
texture->resource.map_binding = WINED3D_LOCATION_BUFFER;
|
||||
}
|
||||
|
||||
if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * levels)))
|
||||
if (!(volumes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*volumes) * level_count)))
|
||||
{
|
||||
wined3d_texture_cleanup(texture);
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -2426,15 +2436,26 @@ HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture
|
|||
}
|
||||
|
||||
HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
|
||||
UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
|
||||
UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture)
|
||||
{
|
||||
unsigned int layer_count = desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP ? 6 : 1;
|
||||
struct wined3d_texture *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("device %p, desc %p, level_count %u, flags %#x, data %p, parent %p, parent_ops %p, texture %p.\n",
|
||||
device, desc, level_count, flags, data, parent, parent_ops, texture);
|
||||
TRACE("device %p, desc %p, layer_count %u, level_count %u, flags %#x, data %p, "
|
||||
"parent %p, parent_ops %p, texture %p.\n",
|
||||
device, desc, layer_count, level_count, flags, data, parent, parent_ops, texture);
|
||||
|
||||
if (!layer_count)
|
||||
{
|
||||
WARN("Invalid layer count.\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if ((desc->usage & WINED3DUSAGE_LEGACY_CUBEMAP) && layer_count != 6)
|
||||
{
|
||||
ERR("Invalid layer count %u for legacy cubemap.\n", layer_count);
|
||||
layer_count = 6;
|
||||
}
|
||||
|
||||
if (!level_count)
|
||||
{
|
||||
|
@ -2474,7 +2495,7 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
|
|||
break;
|
||||
|
||||
case WINED3D_RTYPE_TEXTURE_3D:
|
||||
hr = volumetexture_init(object, desc, level_count, device, parent, parent_ops);
|
||||
hr = volumetexture_init(object, desc, layer_count, level_count, device, parent, parent_ops);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
|
||||
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
|
||||
@ cdecl wined3d_texture_blt(ptr long ptr ptr long ptr long ptr long)
|
||||
@ cdecl wined3d_texture_create(ptr ptr long long ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_texture_create(ptr ptr long long long ptr ptr ptr ptr)
|
||||
@ cdecl wined3d_texture_decref(ptr)
|
||||
@ cdecl wined3d_texture_from_resource(ptr)
|
||||
@ cdecl wined3d_texture_generate_mipmaps(ptr)
|
||||
|
|
|
@ -2446,8 +2446,8 @@ HRESULT __cdecl wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigne
|
|||
struct wined3d_texture *src_texture, unsigned int src_idx, const RECT *src_rect_in, DWORD flags,
|
||||
const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter);
|
||||
HRESULT __cdecl wined3d_texture_create(struct wined3d_device *device, const struct wined3d_resource_desc *desc,
|
||||
UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);
|
||||
UINT layer_count, UINT level_count, DWORD flags, const struct wined3d_sub_resource_data *data,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture);
|
||||
struct wined3d_texture * __cdecl wined3d_texture_from_resource(struct wined3d_resource *resource);
|
||||
ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture);
|
||||
void __cdecl wined3d_texture_generate_mipmaps(struct wined3d_texture *texture);
|
||||
|
|
Loading…
Reference in New Issue