summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.c19
-rw-r--r--src/gallium/state_trackers/nine/basetexture9.h5
-rw-r--r--src/gallium/state_trackers/nine/cubetexture9.c7
-rw-r--r--src/gallium/state_trackers/nine/indexbuffer9.c4
-rw-r--r--src/gallium/state_trackers/nine/resource9.c8
-rw-r--r--src/gallium/state_trackers/nine/resource9.h4
-rw-r--r--src/gallium/state_trackers/nine/surface9.c6
-rw-r--r--src/gallium/state_trackers/nine/texture9.c5
-rw-r--r--src/gallium/state_trackers/nine/vertexbuffer9.c4
-rw-r--r--src/gallium/state_trackers/nine/volumetexture9.c7
10 files changed, 36 insertions, 33 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 89f6269a742..6d415921799 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -41,25 +41,28 @@
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;
diff --git a/src/gallium/state_trackers/nine/basetexture9.h b/src/gallium/state_trackers/nine/basetexture9.h
index d615376f09b..006277104a0 100644
--- a/src/gallium/state_trackers/nine/basetexture9.h
+++ b/src/gallium/state_trackers/nine/basetexture9.h
@@ -59,8 +59,11 @@ NineBaseTexture9( void *data )
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 );
diff --git a/src/gallium/state_trackers/nine/cubetexture9.c b/src/gallium/state_trackers/nine/cubetexture9.c
index 77802e70220..4f631620b9f 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -50,9 +50,6 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *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);
@@ -85,8 +82,8 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
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;
diff --git a/src/gallium/state_trackers/nine/indexbuffer9.c b/src/gallium/state_trackers/nine/indexbuffer9.c
index c5606f1c757..48553fd7451 100644
--- a/src/gallium/state_trackers/nine/indexbuffer9.c
+++ b/src/gallium/state_trackers/nine/indexbuffer9.c
@@ -76,8 +76,8 @@ NineIndexBuffer9_ctor( struct NineIndexBuffer9 *This,
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;
diff --git a/src/gallium/state_trackers/nine/resource9.c b/src/gallium/state_trackers/nine/resource9.c
index 8f535580bbf..c82180be37c 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -38,9 +38,11 @@
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;
@@ -50,8 +52,11 @@ NineResource9_ctor( struct NineResource9 *This,
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)
@@ -61,6 +66,7 @@ NineResource9_ctor( struct NineResource9 *This,
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);
diff --git a/src/gallium/state_trackers/nine/resource9.h b/src/gallium/state_trackers/nine/resource9.h
index 0451498a4bf..d18f0cf2287 100644
--- a/src/gallium/state_trackers/nine/resource9.h
+++ b/src/gallium/state_trackers/nine/resource9.h
@@ -57,9 +57,11 @@ NineResource9( void *data )
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 );
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index 42a9e05dabd..94b4d07a900 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -88,14 +88,12 @@ NineSurface9_ctor( struct NineSurface9 *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;
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index c13268db9fd..e30f955aa0f 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -94,9 +94,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
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);
@@ -148,7 +145,7 @@ NineTexture9_ctor( struct NineTexture9 *This,
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;
diff --git a/src/gallium/state_trackers/nine/vertexbuffer9.c b/src/gallium/state_trackers/nine/vertexbuffer9.c
index 6a57349e0dd..11cc60f5a51 100644
--- a/src/gallium/state_trackers/nine/vertexbuffer9.c
+++ b/src/gallium/state_trackers/nine/vertexbuffer9.c
@@ -85,8 +85,8 @@ NineVertexBuffer9_ctor( struct NineVertexBuffer9 *This,
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;
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
index 65d320c6645..a35d3f7917a 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -52,9 +52,6 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *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_3D;
info->format = d3d9_to_pipe_format(Format);
@@ -83,8 +80,8 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
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;