HRESULT
NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
struct NineUnknownParams *pParams,
+ struct pipe_resource *initResource,
D3DRESOURCETYPE Type,
- D3DPOOL Pool )
+ D3DFORMAT format,
+ D3DPOOL Pool,
+ DWORD Usage)
{
- BOOL alloc = (Pool == D3DPOOL_DEFAULT) && !This->base.resource &&
- (This->format != D3DFMT_NULL);
+ BOOL alloc = (Pool == D3DPOOL_DEFAULT) && !initResource &&
+ (format != D3DFMT_NULL);
HRESULT hr;
- DWORD usage = This->base.usage;
- user_assert(!(usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
+ user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
- user_assert(!(usage & D3DUSAGE_DYNAMIC) ||
+ user_assert(!(Usage & D3DUSAGE_DYNAMIC) ||
Pool != D3DPOOL_MANAGED, D3DERR_INVALIDCALL);
- hr = NineResource9_ctor(&This->base, pParams, alloc, Type, Pool);
+ hr = NineResource9_ctor(&This->base, pParams, initResource, alloc, Type, Pool, Usage);
if (FAILED(hr))
return hr;
+ This->format = format;
This->pipe = pParams->device->pipe;
- This->mipfilter = (This->base.usage & D3DUSAGE_AUTOGENMIPMAP) ?
+ This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ?
D3DTEXF_LINEAR : D3DTEXF_NONE;
This->lod = 0;
This->lod_resident = -1;
HRESULT
NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
struct NineUnknownParams *pParams,
+ struct pipe_resource *initResource,
D3DRESOURCETYPE Type,
- D3DPOOL Pool );
+ D3DFORMAT format,
+ D3DPOOL Pool,
+ DWORD Usage);
void
NineBaseTexture9_dtor( struct NineBaseTexture9 *This );
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
- This->base.format = Format;
- This->base.base.usage = Usage;
-
info->screen = pParams->device->screen;
info->target = PIPE_TEXTURE_CUBE;
info->format = d3d9_to_pipe_format(Format);
if (!This->surfaces)
return E_OUTOFMEMORY;
- hr = NineBaseTexture9_ctor(&This->base, pParams, D3DRTYPE_CUBETEXTURE,
- Pool);
+ hr = NineBaseTexture9_ctor(&This->base, pParams, NULL, D3DRTYPE_CUBETEXTURE,
+ Format, Pool, Usage);
if (FAILED(hr))
return hr;
This->base.pstype = 2;
info->last_level = 0;
info->nr_samples = 0;
- hr = NineResource9_ctor(&This->base, pParams, TRUE, D3DRTYPE_INDEXBUFFER,
- pDesc->Pool);
+ hr = NineResource9_ctor(&This->base, pParams, NULL, TRUE, D3DRTYPE_INDEXBUFFER,
+ pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;
HRESULT
NineResource9_ctor( struct NineResource9 *This,
struct NineUnknownParams *pParams,
+ struct pipe_resource *initResource,
BOOL Allocate,
D3DRESOURCETYPE Type,
- D3DPOOL Pool )
+ D3DPOOL Pool,
+ DWORD Usage)
{
struct pipe_screen *screen;
HRESULT hr;
return hr;
This->info.screen = screen = This->base.device->screen;
+ if (initResource)
+ pipe_resource_reference(&This->resource, initResource);
if (Allocate) {
+ assert(!initResource);
DBG("(%p) Creating pipe_resource.\n", This);
This->resource = screen->resource_create(screen, &This->info);
if (!This->resource)
This->data = NULL; /* FIXME remove, rather set it to null in surface9.c*/
This->type = Type;
This->pool = Pool;
+ This->usage = Usage;
This->priority = 0;
This->pdata = util_hash_table_create(ht_guid_hash, ht_guid_compare);
HRESULT
NineResource9_ctor( struct NineResource9 *This,
struct NineUnknownParams *pParams,
+ struct pipe_resource *initResource,
BOOL Allocate,
D3DRESOURCETYPE Type,
- D3DPOOL Pool );
+ D3DPOOL Pool,
+ DWORD Usage);
void
NineResource9_dtor( struct NineResource9 *This );
} else {
if (pResource && (pDesc->Usage & D3DUSAGE_DYNAMIC))
pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
- pipe_resource_reference(&This->base.resource, pResource);
}
- hr = NineResource9_ctor(&This->base, pParams, FALSE, D3DRTYPE_SURFACE,
- pDesc->Pool);
+ hr = NineResource9_ctor(&This->base, pParams, pResource, FALSE, D3DRTYPE_SURFACE,
+ pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;
- This->base.usage = pDesc->Usage;
This->pipe = This->base.base.device->pipe;
This->transfer = NULL;
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
- This->base.format = Format;
- This->base.base.usage = Usage;
-
info->screen = screen;
info->target = PIPE_TEXTURE_2D;
info->format = d3d9_to_pipe_format(Format);
if (!This->surfaces)
return E_OUTOFMEMORY;
- hr = NineBaseTexture9_ctor(&This->base, pParams, D3DRTYPE_TEXTURE, Pool);
+ hr = NineBaseTexture9_ctor(&This->base, pParams, NULL, D3DRTYPE_TEXTURE, Format, Pool, Usage);
if (FAILED(hr))
return hr;
This->base.pstype = (Height == 1) ? 1 : 0;
info->last_level = 0;
info->nr_samples = 0;
- hr = NineResource9_ctor(&This->base, pParams, TRUE, D3DRTYPE_VERTEXBUFFER,
- pDesc->Pool);
+ hr = NineResource9_ctor(&This->base, pParams, NULL, TRUE,
+ D3DRTYPE_VERTEXBUFFER, pDesc->Pool, pDesc->Usage);
if (FAILED(hr))
return hr;
if (Usage & D3DUSAGE_AUTOGENMIPMAP)
Levels = 0;
- This->base.format = Format;
- This->base.base.usage = Usage;
-
info->screen = pParams->device->screen;
info->target = PIPE_TEXTURE_3D;
info->format = d3d9_to_pipe_format(Format);
return E_OUTOFMEMORY;
This->base.pstype = 3;
- hr = NineBaseTexture9_ctor(&This->base, pParams,
- D3DRTYPE_VOLUMETEXTURE, Pool);
+ hr = NineBaseTexture9_ctor(&This->base, pParams, NULL,
+ D3DRTYPE_VOLUMETEXTURE, Format, Pool, Usage);
if (FAILED(hr))
return hr;