summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/texture9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2014-11-25 00:38:03 +0100
committerEmil Velikov <[email protected]>2014-11-26 20:09:10 +0000
commit6aeae7442d1d5a8b1ff77b6f50f4ac7333cd22b0 (patch)
treed39b6e4e69407b1b93d25a0b3aa79bd30ad0e7e1 /src/gallium/state_trackers/nine/texture9.c
parent133b2087c5ba9942527bc1b218a32205fb7a10a6 (diff)
st/nine: rework the way D3DPOOL_SYSTEMMEM is handled
This patch moves the data field from Resource9 to Surface9 and cleans D3DPOOL_SYSTEMMEM handling in Texture9. This fixes HL2 lost coast. It also removes in Texture9 some code written to support importing and exporting non D3DPOOL_SYSTEMMEM shared buffers. This code hadn't the design required to support the feature and wasn't used. Cc: "10.4" <[email protected]> Tested-by: David Heidelberg <[email protected]> Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/texture9.c')
-rw-r--r--src/gallium/state_trackers/nine/texture9.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index e30f955aa0f..9537b25038d 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -46,10 +46,11 @@ NineTexture9_ctor( struct NineTexture9 *This,
{
struct pipe_screen *screen = pParams->device->screen;
struct pipe_resource *info = &This->base.base.info;
+ struct pipe_resource *resource;
unsigned l;
D3DSURFACE_DESC sfdesc;
HRESULT hr;
- const boolean shared_create = pSharedHandle && !*pSharedHandle;
+ void *user_buffer = NULL;
DBG("(%p) Width=%u Height=%u Levels=%u Usage=%s Format=%s Pool=%s "
"pSharedHandle=%p\n", This, Width, Height, Levels,
@@ -77,10 +78,7 @@ NineTexture9_ctor( struct NineTexture9 *This,
Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
if (pSharedHandle && Pool == D3DPOOL_DEFAULT) {
- /* Note: Below there is some implementation to support buffer sharing in
- * this case, but it won't work for cross-process. Thus just ignore
- * that code. */
- if (shared_create) {
+ if (!*pSharedHandle) {
DBG("Creating Texture with invalid handle. Importing will fail\n.");
*pSharedHandle = (HANDLE)1; /* Wine would keep it NULL */
pSharedHandle = NULL;
@@ -127,18 +125,8 @@ NineTexture9_ctor( struct NineTexture9 *This,
if (Pool == D3DPOOL_SYSTEMMEM)
info->usage = PIPE_USAGE_STAGING;
- if (pSharedHandle && !shared_create) {
- if (Pool == D3DPOOL_SYSTEMMEM) {
- /* Hack for surface creation. */
- This->base.base.resource = (struct pipe_resource *)*pSharedHandle;
- } else {
- struct pipe_resource *res;
- res = screen->resource_from_handle(screen, info,
- (struct winsys_handle *)pSharedHandle);
- if (!res)
- return D3DERR_NOTFOUND;
- This->base.base.resource = res;
- }
+ if (pSharedHandle && *pSharedHandle) { /* Pool == D3DPOOL_SYSTEMMEM */
+ user_buffer = (void *)*pSharedHandle;
}
This->surfaces = CALLOC(info->last_level + 1, sizeof(*This->surfaces));
@@ -160,12 +148,19 @@ NineTexture9_ctor( struct NineTexture9 *This,
sfdesc.Pool = Pool;
sfdesc.MultiSampleType = D3DMULTISAMPLE_NONE;
sfdesc.MultiSampleQuality = 0;
+
+ if (Pool == D3DPOOL_SYSTEMMEM)
+ resource = NULL;
+ else
+ resource = This->base.base.resource;
+
for (l = 0; l <= info->last_level; ++l) {
sfdesc.Width = u_minify(Width, l);
sfdesc.Height = u_minify(Height, l);
hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This),
- This->base.base.resource, D3DRTYPE_TEXTURE, l, 0,
+ resource, user_buffer,
+ D3DRTYPE_TEXTURE, l, 0,
&sfdesc, &This->surfaces[l]);
if (FAILED(hr))
return hr;
@@ -173,19 +168,8 @@ NineTexture9_ctor( struct NineTexture9 *This,
This->dirty_rect.depth = 1; /* widht == 0 means empty, depth stays 1 */
- if (pSharedHandle) {
- if (Pool == D3DPOOL_SYSTEMMEM) {
- This->base.base.resource = NULL;
- if (shared_create)
- *pSharedHandle = This->surfaces[0]->base.data;
- } else
- if (shared_create) {
- boolean ok;
- ok = screen->resource_get_handle(screen, This->base.base.resource,
- (struct winsys_handle *)pSharedHandle);
- if (!ok)
- return D3DERR_DRIVERINTERNALERROR;
- }
+ if (pSharedHandle && !*pSharedHandle) {/* Pool == D3DPOOL_SYSTEMMEM */
+ *pSharedHandle = This->surfaces[0]->data;
}
return D3D_OK;