wined3d: Call resource_init() from basetexture_init().
This commit is contained in:
parent
812ee5208c
commit
451a416fcf
|
@ -27,15 +27,28 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
||||
|
||||
void basetexture_init(struct IWineD3DBaseTextureClass *texture, UINT levels, DWORD usage)
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc,
|
||||
WINED3DPOOL pool, IUnknown *parent)
|
||||
{
|
||||
texture->levels = levels;
|
||||
texture->filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
|
||||
texture->LOD = 0;
|
||||
texture->dirty = TRUE;
|
||||
texture->srgbDirty = TRUE;
|
||||
texture->is_srgb = FALSE;
|
||||
texture->pow2Matrix_identity = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
hr = resource_init((IWineD3DResource *)texture, resource_type, device, size, usage, format_desc, pool, parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
texture->baseTexture.levels = levels;
|
||||
texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
|
||||
texture->baseTexture.LOD = 0;
|
||||
texture->baseTexture.dirty = TRUE;
|
||||
texture->baseTexture.srgbDirty = TRUE;
|
||||
texture->baseTexture.is_srgb = FALSE;
|
||||
texture->baseTexture.pow2Matrix_identity = TRUE;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
void basetexture_cleanup(IWineD3DBaseTexture *iface)
|
||||
|
|
|
@ -1159,21 +1159,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
|
|||
}
|
||||
|
||||
object->lpVtbl = &IWineD3DTexture_Vtbl;
|
||||
hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_TEXTURE, This, 0, Usage, format_desc, Pool, parent);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)object, Levels,
|
||||
WINED3DRTYPE_TEXTURE, This, 0, Usage, format_desc, Pool, parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x\n", hr);
|
||||
WARN("Failed to initialize basetexture, returning %#x\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppTexture = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("(%p) : Created resource %p\n", This, object);
|
||||
TRACE("(%p) : Created basetexture %p\n", This, object);
|
||||
|
||||
*ppTexture = (IWineD3DTexture *)object;
|
||||
|
||||
basetexture_init(&object->baseTexture, Levels, Usage);
|
||||
|
||||
if (object->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING)
|
||||
{
|
||||
object->baseTexture.minMipLookup = minMipLookup;
|
||||
|
@ -1316,19 +1315,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
|
|||
}
|
||||
|
||||
object->lpVtbl = &IWineD3DVolumeTexture_Vtbl;
|
||||
hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_VOLUMETEXTURE,
|
||||
This, 0, Usage, format_desc, Pool, parent);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)object, Levels,
|
||||
WINED3DRTYPE_VOLUMETEXTURE, This, 0, Usage, format_desc, Pool, parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x\n", hr);
|
||||
WARN("Failed to initialize basetexture, returning %#x\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppVolumeTexture = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("(%p) : Created resource %p\n", This, object);
|
||||
|
||||
basetexture_init(&object->baseTexture, Levels, Usage);
|
||||
TRACE("(%p) : Created basetexture %p\n", This, object);
|
||||
|
||||
TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height,
|
||||
Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool));
|
||||
|
@ -1492,18 +1489,17 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
|
|||
}
|
||||
|
||||
object->lpVtbl = &IWineD3DCubeTexture_Vtbl;
|
||||
hr = resource_init((IWineD3DResource *)object, WINED3DRTYPE_CUBETEXTURE, This, 0, Usage, format_desc, Pool, parent);
|
||||
hr = basetexture_init((IWineD3DBaseTextureImpl *)object, Levels,
|
||||
WINED3DRTYPE_CUBETEXTURE, This, 0, Usage, format_desc, Pool, parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize resource, returning %#x\n", hr);
|
||||
WARN("Failed to initialize basetexture, returning %#x\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppCubeTexture = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
TRACE("(%p) : Created resource %p\n", This, object);
|
||||
|
||||
basetexture_init(&object->baseTexture, Levels, Usage);
|
||||
TRACE("(%p) : Created basetexture %p\n", This, object);
|
||||
|
||||
TRACE("(%p) Create Cube Texture\n", This);
|
||||
|
||||
|
|
|
@ -1736,7 +1736,9 @@ WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture
|
|||
BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface);
|
||||
DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface);
|
||||
DWORD basetexture_get_lod(IWineD3DBaseTexture *iface);
|
||||
void basetexture_init(struct IWineD3DBaseTextureClass *texture, UINT levels, DWORD usage);
|
||||
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
|
||||
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc,
|
||||
WINED3DPOOL pool, IUnknown *parent);
|
||||
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE filter_type);
|
||||
BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty);
|
||||
DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD new_lod);
|
||||
|
|
Loading…
Reference in New Issue