diff options
author | Axel Davy <[email protected]> | 2016-10-28 00:43:56 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-12-20 23:44:22 +0100 |
commit | c7237e2c5c9935d80f04f2793bde9489ca6bda9d (patch) | |
tree | 6c5ae590313264318d563284cea7db12d15cc50c /src/gallium/state_trackers | |
parent | 4a4eba8c059022b1bff7a389e72f66e513a3dc06 (diff) |
st/nine: Access pipe_context via NineDevice9_GetPipe
Except for nine_ff and nine_state.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/nine/basetexture9.c | 13 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/basetexture9.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/buffer9.c | 16 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/buffer9.h | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/device9.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_pipe.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/pixelshader9.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/surface9.c | 44 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/surface9.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 17 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/vertexshader9.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/volume9.c | 34 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/volume9.h | 2 |
15 files changed, 84 insertions, 63 deletions
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c index ddbc5623e73..6bcd0c9f2df 100644 --- a/src/gallium/state_trackers/nine/basetexture9.c +++ b/src/gallium/state_trackers/nine/basetexture9.c @@ -65,7 +65,6 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This, return hr; This->format = format; - This->pipe = pParams->device->pipe; This->mipfilter = (Usage & D3DUSAGE_AUTOGENMIPMAP) ? D3DTEXF_LINEAR : D3DTEXF_NONE; This->managed.lod = 0; @@ -386,6 +385,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This ) void NINE_WINAPI NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This ) { + struct pipe_context *pipe; struct pipe_resource *resource; unsigned base_level = 0; unsigned last_level = This->base.info.last_level - This->managed.lod; @@ -411,7 +411,8 @@ NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This ) resource = This->base.resource; - util_gen_mipmap(This->pipe, resource, + pipe = NineDevice9_GetPipe(This->base.base.device); + util_gen_mipmap(pipe, resource, resource->format, base_level, last_level, first_layer, last_layer, filter); @@ -422,7 +423,7 @@ HRESULT NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, BOOL CopyData ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_screen *screen = This->base.info.screen; struct pipe_resource templ; unsigned l, m; @@ -455,6 +456,7 @@ NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This, if (!res) return D3DERR_OUTOFVIDEOMEMORY; This->base.resource = res; + pipe = NineDevice9_GetPipe(This->base.base.device); if (old && CopyData) { /* Don't return without releasing old ! */ struct pipe_box box; @@ -492,8 +494,8 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, const int sRGB ) { const struct util_format_description *desc; - struct pipe_context *pipe = This->pipe; - struct pipe_screen *screen = pipe->screen; + struct pipe_context *pipe; + struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); struct pipe_resource *resource = This->base.resource; struct pipe_sampler_view templ; enum pipe_format srgb_format; @@ -573,6 +575,7 @@ NineBaseTexture9_UpdateSamplerView( struct NineBaseTexture9 *This, templ.swizzle_a = swizzle[3]; templ.target = resource->target; + pipe = NineDevice9_GetPipe(This->base.base.device); This->view[sRGB] = pipe->create_sampler_view(pipe, resource, &templ); DBG("sampler view = %p(resource = %p)\n", This->view[sRGB], resource); diff --git a/src/gallium/state_trackers/nine/basetexture9.h b/src/gallium/state_trackers/nine/basetexture9.h index 980c4a556b2..0f604f0e37f 100644 --- a/src/gallium/state_trackers/nine/basetexture9.h +++ b/src/gallium/state_trackers/nine/basetexture9.h @@ -34,7 +34,6 @@ struct NineBaseTexture9 struct list_head list2; /* for managed_textures */ /* g3d */ - struct pipe_context *pipe; struct pipe_sampler_view *view[2]; /* linear and sRGB */ D3DFORMAT format; diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index cbf410ba717..64c79359139 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -57,8 +57,6 @@ NineBuffer9_ctor( struct NineBuffer9 *This, This->maxmaps = 1; This->size = Size; - This->pipe = pParams->device->pipe; - info->screen = pParams->device->screen; info->target = PIPE_BUFFER; info->format = PIPE_FORMAT_R8_UNORM; @@ -180,6 +178,7 @@ NineBuffer9_Lock( struct NineBuffer9 *This, DWORD Flags ) { struct pipe_box box; + struct pipe_context *pipe; void *data; unsigned usage; @@ -253,8 +252,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This, This->maps = newmaps; } - data = This->pipe->transfer_map(This->pipe, This->base.resource, 0, - usage, &box, &This->maps[This->nmaps]); + pipe = NineDevice9_GetPipe(This->base.base.device); + data = pipe->transfer_map(pipe, This->base.resource, 0, + usage, &box, &This->maps[This->nmaps]); if (!data) { DBG("pipe::transfer_map failed\n" @@ -278,12 +278,14 @@ NineBuffer9_Lock( struct NineBuffer9 *This, HRESULT NINE_WINAPI NineBuffer9_Unlock( struct NineBuffer9 *This ) { + struct pipe_context *pipe; DBG("This=%p\n", This); user_assert(This->nmaps > 0, D3DERR_INVALIDCALL); - if (This->base.pool != D3DPOOL_MANAGED) - This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); - else { + if (This->base.pool != D3DPOOL_MANAGED) { + pipe = NineDevice9_GetPipe(This->base.base.device); + pipe->transfer_unmap(pipe, This->maps[--(This->nmaps)]); + } else { This->nmaps--; /* TODO: Fix this to upload at the first draw call needing the data, * instead of at the next draw call */ diff --git a/src/gallium/state_trackers/nine/buffer9.h b/src/gallium/state_trackers/nine/buffer9.h index c109cf66140..df368b67070 100644 --- a/src/gallium/state_trackers/nine/buffer9.h +++ b/src/gallium/state_trackers/nine/buffer9.h @@ -24,6 +24,7 @@ #ifndef _NINE_BUFFER9_H_ #define _NINE_BUFFER9_H_ +#include "device9.h" #include "resource9.h" #include "pipe/p_context.h" #include "pipe/p_state.h" @@ -38,7 +39,6 @@ struct NineBuffer9 struct NineResource9 base; /* G3D */ - struct pipe_context *pipe; struct pipe_transfer **maps; int nmaps, maxmaps; UINT size; @@ -85,7 +85,7 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ); static inline void NineBuffer9_Upload( struct NineBuffer9 *This ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device); assert(This->base.pool == D3DPOOL_MANAGED && This->managed.dirty); pipe->buffer_subdata(pipe, This->base.resource, 0, diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 92df2152880..a0b2de230fc 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -683,7 +683,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This, IDirect3DSurface9 *pCursorBitmap ) { struct NineSurface9 *surf = NineSurface9(pCursorBitmap); - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This); struct pipe_box box; struct pipe_transfer *transfer; BOOL hw_cursor; @@ -1524,7 +1524,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This, D3DTEXTUREFILTERTYPE Filter ) { struct pipe_screen *screen = This->screen; - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This); struct NineSurface9 *dst = NineSurface9(pDestSurface); struct NineSurface9 *src = NineSurface9(pSourceSurface); struct pipe_resource *dst_res = NineSurface9_GetResource(dst); @@ -1726,7 +1726,7 @@ NineDevice9_ColorFill( struct NineDevice9 *This, const RECT *pRect, D3DCOLOR color ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This); struct NineSurface9 *surf = NineSurface9(pSurface); struct pipe_surface *psurf; unsigned x, y, w, h; diff --git a/src/gallium/state_trackers/nine/nine_pipe.c b/src/gallium/state_trackers/nine/nine_pipe.c index 7e33c0a9c39..46ac801ec86 100644 --- a/src/gallium/state_trackers/nine/nine_pipe.c +++ b/src/gallium/state_trackers/nine/nine_pipe.c @@ -252,7 +252,7 @@ nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss) void nine_pipe_context_clear(struct NineDevice9 *This) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This); struct cso_context *cso = This->cso; pipe->bind_vs_state(pipe, NULL); pipe->bind_fs_state(pipe, NULL); diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index b9597786b90..1208f125d44 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -3470,7 +3470,7 @@ nine_translate_shader(struct NineDevice9 *device, struct nine_shader_info *info) HRESULT hr = D3D_OK; const unsigned processor = info->type; struct pipe_screen *screen = info->process_vertices ? device->screen_sw : device->screen; - struct pipe_context *pipe = info->process_vertices ? device->pipe_sw : device->pipe; + struct pipe_context *pipe = info->process_vertices ? device->pipe_sw : NineDevice9_GetPipe(device); user_assert(processor != ~0, D3DERR_INVALIDCALL); diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c index 133f0dadbfa..387ecc387f3 100644 --- a/src/gallium/state_trackers/nine/pixelshader9.c +++ b/src/gallium/state_trackers/nine/pixelshader9.c @@ -92,7 +92,7 @@ NinePixelShader9_dtor( struct NinePixelShader9 *This ) DBG("This=%p\n", This); if (This->base.device) { - struct pipe_context *pipe = This->base.device->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device); struct nine_shader_variant *var = &This->variant; do { diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 54d07dca40a..8fa70a79ac6 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -56,7 +56,7 @@ NineSurface9_ctor( struct NineSurface9 *This, HRESULT hr; union pipe_color_union rgba = {0}; struct pipe_surface *surf; - struct pipe_context *pipe = pParams->device->pipe; + struct pipe_context *pipe; bool allocate = !pContainer && pDesc->Format != D3DFMT_NULL; D3DMULTISAMPLE_TYPE multisample_type; @@ -172,7 +172,6 @@ NineSurface9_ctor( struct NineSurface9 *This, if (FAILED(hr)) return hr; - This->pipe = This->base.base.device->pipe; This->transfer = NULL; This->texture = TextureType; @@ -189,6 +188,7 @@ NineSurface9_ctor( struct NineSurface9 *This, /* TODO: investigate what else exactly needs to be cleared */ if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) { surf = NineSurface9_GetSurface(This, 0); + pipe = NineDevice9_GetPipe(pParams->device); pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false); } @@ -219,8 +219,8 @@ NineSurface9_dtor( struct NineSurface9 *This ) struct pipe_surface * NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB ) { - struct pipe_context *pipe = This->pipe; - struct pipe_screen *screen = pipe->screen; + struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device); + struct pipe_screen *screen = NineDevice9_GetScreen(This->base.base.device); struct pipe_resource *resource = This->base.resource; struct pipe_surface templ; enum pipe_format srgb_format; @@ -384,6 +384,7 @@ NineSurface9_LockRect( struct NineSurface9 *This, DWORD Flags ) { struct pipe_resource *resource = This->base.resource; + struct pipe_context *pipe; struct pipe_box box; unsigned usage; @@ -473,9 +474,10 @@ NineSurface9_LockRect( struct NineSurface9 *This, DBG("mapping pipe_resource %p (level=%u usage=%x)\n", resource, This->level, usage); - pLockedRect->pBits = This->pipe->transfer_map(This->pipe, resource, - This->level, usage, &box, - &This->transfer); + pipe = NineDevice9_GetPipe(This->base.base.device); + pLockedRect->pBits = pipe->transfer_map(pipe, resource, + This->level, usage, &box, + &This->transfer); if (!This->transfer) { DBG("transfer_map failed\n"); if (Flags & D3DLOCK_DONOTWAIT) @@ -497,10 +499,12 @@ NineSurface9_LockRect( struct NineSurface9 *This, HRESULT NINE_WINAPI NineSurface9_UnlockRect( struct NineSurface9 *This ) { + struct pipe_context *pipe; DBG("This=%p lock_count=%u\n", This, This->lock_count); user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { - This->pipe->transfer_unmap(This->pipe, This->transfer); + pipe = NineDevice9_GetPipe(This->base.base.device); + pipe->transfer_unmap(pipe, This->transfer); This->transfer = NULL; } --This->lock_count; @@ -512,13 +516,14 @@ NineSurface9_UnlockRect( struct NineSurface9 *This ) u_box_origin_2d(This->desc.Width, This->desc.Height, &box); + pipe = NineDevice9_GetPipe(This->base.base.device); if (!dst) { - dst = This->pipe->transfer_map(This->pipe, - This->base.resource, - This->level, - PIPE_TRANSFER_WRITE | - PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, - &box, &transfer); + dst = pipe->transfer_map(pipe, + This->base.resource, + This->level, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, + &box, &transfer); if (!dst) return D3D_OK; } @@ -533,7 +538,7 @@ NineSurface9_UnlockRect( struct NineSurface9 *This ) This->desc.Width, This->desc.Height); if (!This->data) - pipe_transfer_unmap(This->pipe, transfer); + pipe_transfer_unmap(pipe, transfer); } return D3D_OK; } @@ -580,7 +585,7 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This, const POINT *pDestPoint, const RECT *pSourceRect ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_transfer *transfer = NULL; struct pipe_resource *r_dst = This->base.resource; struct pipe_box dst_box; @@ -613,6 +618,7 @@ NineSurface9_CopyMemToDefault( struct NineSurface9 *This, u_box_2d_zslice(dst_x, dst_y, This->layer, copy_width, copy_height, &dst_box); + pipe = NineDevice9_GetPipe(This->base.base.device); map = pipe->transfer_map(pipe, r_dst, This->level, @@ -650,7 +656,7 @@ void NineSurface9_CopyDefaultToMem( struct NineSurface9 *This, struct NineSurface9 *From ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_resource *r_src = From->base.resource; struct pipe_transfer *transfer; struct pipe_box src_box; @@ -666,6 +672,7 @@ NineSurface9_CopyDefaultToMem( struct NineSurface9 *This, u_box_origin_2d(This->desc.Width, This->desc.Height, &src_box); src_box.z = From->layer; + pipe = NineDevice9_GetPipe(This->base.base.device); p_src = pipe->transfer_map(pipe, r_src, From->level, PIPE_TRANSFER_READ, &src_box, &transfer); @@ -690,7 +697,7 @@ HRESULT NineSurface9_UploadSelf( struct NineSurface9 *This, const struct pipe_box *damaged ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_resource *res = This->base.resource; uint8_t *ptr; struct pipe_box box; @@ -714,6 +721,7 @@ NineSurface9_UploadSelf( struct NineSurface9 *This, ptr = NineSurface9_GetSystemMemPointer(This, box.x, box.y); + pipe = NineDevice9_GetPipe(This->base.base.device); pipe->texture_subdata(pipe, res, This->level, 0, &box, ptr, This->stride, 0); diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index 476bc81557a..856c03b3844 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -35,7 +35,6 @@ struct NineSurface9 struct NineResource9 base; /* G3D state */ - struct pipe_context *pipe; struct pipe_transfer *transfer; struct pipe_surface *surface[2]; /* created on-demand (linear, sRGB) */ int lock_count; diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index ea822768e70..502736c2216 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -59,7 +59,6 @@ NineSwapChain9_ctor( struct NineSwapChain9 *This, return hr; This->screen = NineDevice9_GetScreen(This->base.device); - This->pipe = NineDevice9_GetPipe(This->base.device); This->implicit = implicit; This->actx = pCTX; This->present = pPresent; @@ -91,13 +90,14 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This, int for_frontbuffer_reading) { D3DWindowBuffer *ret; + struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device); struct winsys_handle whandle; int stride, dmaBufFd; HRESULT hr; memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_FD; - This->screen->resource_get_handle(This->screen, This->pipe, resource, + This->screen->resource_get_handle(This->screen, pipe, resource, &whandle, for_frontbuffer_reading ? PIPE_HANDLE_USAGE_WRITE : @@ -560,6 +560,7 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, struct pipe_resource *r { struct NineDevice9 *device = This->base.device; struct pipe_blit_info blit; + struct pipe_context *pipe; if (device->cursor.software && device->cursor.visible && device->cursor.w) { memset(&blit, 0, sizeof(blit)); @@ -597,7 +598,8 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, struct pipe_resource *r blit.dst.box.x, blit.dst.box.y); blit.alpha_blend = TRUE; - This->pipe->blit(This->pipe, &blit); + pipe = NineDevice9_GetPipe(This->base.device); + pipe->blit(pipe, &blit); } if (device->hud && resource) { @@ -649,6 +651,7 @@ present( struct NineSwapChain9 *This, const RGNDATA *pDirtyRegion, DWORD dwFlags ) { + struct pipe_context *pipe; struct pipe_resource *resource; struct pipe_fence_handle *fence; HRESULT hr; @@ -687,6 +690,8 @@ present( struct NineSwapChain9 *This, if (This->params.SwapEffect == D3DSWAPEFFECT_DISCARD) handle_draw_cursor_and_hud(This, resource); + pipe = NineDevice9_GetPipe(This->base.device); + if (This->present_buffers[0]) { memset(&blit, 0, sizeof(blit)); blit.src.resource = resource; @@ -716,18 +721,18 @@ present( struct NineSwapChain9 *This, blit.scissor_enable = FALSE; blit.alpha_blend = FALSE; - This->pipe->blit(This->pipe, &blit); + pipe->blit(pipe, &blit); } /* The resource we present has to resolve fast clears * if needed (and other things) */ - This->pipe->flush_resource(This->pipe, resource); + pipe->flush_resource(pipe, resource); if (This->params.SwapEffect != D3DSWAPEFFECT_DISCARD) handle_draw_cursor_and_hud(This, resource); fence = NULL; - This->pipe->flush(This->pipe, &fence, PIPE_FLUSH_END_OF_FRAME); + pipe->flush(pipe, &fence, PIPE_FLUSH_END_OF_FRAME); if (fence) { swap_fences_push_back(This, fence); This->screen->fence_reference(This->screen, &fence, NULL); diff --git a/src/gallium/state_trackers/nine/swapchain9.h b/src/gallium/state_trackers/nine/swapchain9.h index a784a48290d..0cd3824ea9e 100644 --- a/src/gallium/state_trackers/nine/swapchain9.h +++ b/src/gallium/state_trackers/nine/swapchain9.h @@ -44,7 +44,6 @@ struct NineSwapChain9 /* G3D stuff */ struct pipe_screen *screen; - struct pipe_context *pipe; /* presentation backend */ ID3DPresent *present; diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c index b8c9ec047db..28c40f40d30 100644 --- a/src/gallium/state_trackers/nine/vertexshader9.c +++ b/src/gallium/state_trackers/nine/vertexshader9.c @@ -110,7 +110,7 @@ NineVertexShader9_dtor( struct NineVertexShader9 *This ) DBG("This=%p\n", This); if (This->base.device) { - struct pipe_context *pipe = This->base.device->pipe; + struct pipe_context *pipe = NineDevice9_GetPipe(This->base.device); struct nine_shader_variant *var = &This->variant; struct nine_shader_variant_so *var_so = &This->variant_so; diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 33f7cf370c4..ac935516baa 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -77,7 +77,6 @@ NineVolume9_ctor( struct NineVolume9 *This, pipe_resource_reference(&This->resource, pResource); - This->pipe = pParams->device->pipe; This->transfer = NULL; This->lock_count = 0; @@ -240,6 +239,7 @@ NineVolume9_LockBox( struct NineVolume9 *This, const D3DBOX *pBox, DWORD Flags ) { + struct pipe_context *pipe; struct pipe_resource *resource = This->resource; struct pipe_box box; unsigned usage; @@ -314,9 +314,10 @@ NineVolume9_LockBox( struct NineVolume9 *This, pLockedVolume->pBits = NineVolume9_GetSystemMemPointer(This, box.x, box.y, box.z); } else { + pipe = NineDevice9_GetPipe(This->base.device); pLockedVolume->pBits = - This->pipe->transfer_map(This->pipe, resource, This->level, usage, - &box, &This->transfer); + pipe->transfer_map(pipe, resource, This->level, usage, + &box, &This->transfer); if (!This->transfer) { if (Flags & D3DLOCK_DONOTWAIT) return D3DERR_WASSTILLDRAWING; @@ -338,10 +339,13 @@ NineVolume9_LockBox( struct NineVolume9 *This, HRESULT NINE_WINAPI NineVolume9_UnlockBox( struct NineVolume9 *This ) { + struct pipe_context *pipe; + DBG("This=%p lock_count=%u\n", This, This->lock_count); user_assert(This->lock_count, D3DERR_INVALIDCALL); if (This->transfer) { - This->pipe->transfer_unmap(This->pipe, This->transfer); + pipe = NineDevice9_GetPipe(This->base.device); + pipe->transfer_unmap(pipe, This->transfer); This->transfer = NULL; } --This->lock_count; @@ -354,13 +358,14 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) u_box_3d(0, 0, 0, This->desc.Width, This->desc.Height, This->desc.Depth, &box); + pipe = NineDevice9_GetPipe(This->base.device); if (!dst) { - dst = This->pipe->transfer_map(This->pipe, - This->resource, - This->level, - PIPE_TRANSFER_WRITE | - PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, - &box, &transfer); + dst = pipe->transfer_map(pipe, + This->resource, + This->level, + PIPE_TRANSFER_WRITE | + PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, + &box, &transfer); if (!dst) return D3D_OK; } @@ -378,7 +383,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This ) This->desc.Depth); if (!This->data) - pipe_transfer_unmap(This->pipe, transfer); + pipe_transfer_unmap(pipe, transfer); } return D3D_OK; @@ -392,7 +397,7 @@ NineVolume9_CopyMemToDefault( struct NineVolume9 *This, unsigned dstx, unsigned dsty, unsigned dstz, struct pipe_box *pSrcBox ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_transfer *transfer = NULL; struct pipe_resource *r_dst = This->resource; struct pipe_box src_box; @@ -424,6 +429,8 @@ NineVolume9_CopyMemToDefault( struct NineVolume9 *This, dst_box.height = src_box.height; dst_box.depth = src_box.depth; + pipe = NineDevice9_GetPipe(This->base.device); + map = pipe->transfer_map(pipe, r_dst, This->level, @@ -473,7 +480,7 @@ HRESULT NineVolume9_UploadSelf( struct NineVolume9 *This, const struct pipe_box *damaged ) { - struct pipe_context *pipe = This->pipe; + struct pipe_context *pipe; struct pipe_resource *res = This->resource; struct pipe_box box; uint8_t *ptr; @@ -497,6 +504,7 @@ NineVolume9_UploadSelf( struct NineVolume9 *This, ptr = NineVolume9_GetSystemMemPointer(This, box.x, box.y, box.z); + pipe = NineDevice9_GetPipe(This->base.device); pipe->texture_subdata(pipe, res, This->level, 0, &box, ptr, This->stride, This->layer_stride); diff --git a/src/gallium/state_trackers/nine/volume9.h b/src/gallium/state_trackers/nine/volume9.h index 79cea3a2c06..5bddf8f4c19 100644 --- a/src/gallium/state_trackers/nine/volume9.h +++ b/src/gallium/state_trackers/nine/volume9.h @@ -53,8 +53,6 @@ struct NineVolume9 struct pipe_transfer *transfer; unsigned lock_count; - - struct pipe_context *pipe; }; static inline struct NineVolume9 * NineVolume9( void *data ) |