st/nine: Access pipe_context via NineDevice9_GetPipe
authorAxel Davy <axel.davy@ens.fr>
Thu, 27 Oct 2016 22:43:56 +0000 (00:43 +0200)
committerAxel Davy <axel.davy@ens.fr>
Tue, 20 Dec 2016 22:44:22 +0000 (23:44 +0100)
Except for nine_ff and nine_state.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
15 files changed:
src/gallium/state_trackers/nine/basetexture9.c
src/gallium/state_trackers/nine/basetexture9.h
src/gallium/state_trackers/nine/buffer9.c
src/gallium/state_trackers/nine/buffer9.h
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/nine_pipe.c
src/gallium/state_trackers/nine/nine_shader.c
src/gallium/state_trackers/nine/pixelshader9.c
src/gallium/state_trackers/nine/surface9.c
src/gallium/state_trackers/nine/surface9.h
src/gallium/state_trackers/nine/swapchain9.c
src/gallium/state_trackers/nine/swapchain9.h
src/gallium/state_trackers/nine/vertexshader9.c
src/gallium/state_trackers/nine/volume9.c
src/gallium/state_trackers/nine/volume9.h

index ddbc5623e738da66ffb7a39dce8543ead9ba8b80..6bcd0c9f2dff45637241f394c50e592d158f9dfb 100644 (file)
@@ -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);
index 980c4a556b2c21e40de9d2744d529d37750e429c..0f604f0e37f0e5892ffbb556f26ed9b29ca78b1c 100644 (file)
@@ -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;
index cbf410ba717f8812eb8d82518b16f9830f9d2b79..64c79359139ae878dd23c237fbd46aecb04a63eb 100644 (file)
@@ -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 */
index c109cf66140b894964830e743d0fb7200ece67c0..df368b67070b8e792d20d761b470d36882ff8a57 100644 (file)
@@ -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,
index 92df215288026a04235e1a38b300b1bc4d3384c4..a0b2de230fc926227c39ab5af4707609bd865bb4 100644 (file)
@@ -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;
index 7e33c0a9c390bcaa5ac0ed0b3f4bc08c22defd5e..46ac801ec865aee5732540e90d519476187c163c 100644 (file)
@@ -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);
index b9597786b90de3142a4ec863bee0bae2f0ef5267..1208f125d44bdc2c9167357e1f499a88af71f879 100644 (file)
@@ -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);
 
index 133f0dadbfae410d04b19f316e7118675dd7844d..387ecc387f3e24fe16ee35312bf5029a3ba946ac 100644 (file)
@@ -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 {
index 54d07dca40ac5998e2dfd33990356c7f1395c826..8fa70a79ac624f4eafcf285ff427ca8d9b9216ac 100644 (file)
@@ -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);
 
index 476bc81557a4b061292ed1264beb75010c342caa..856c03b3844322b915546de4b3b017ec78713d27 100644 (file)
@@ -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;
index ea822768e7030209e9b1f1e9e01e056511113f8b..502736c2216b4f52ef0a30109ecca185f7e661ab 100644 (file)
@@ -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);
index a784a48290dac536fbf4e855e6826d6adb1aadc9..0cd3824ea9eea9b59b113eadad7089e8aca1fc4a 100644 (file)
@@ -44,7 +44,6 @@ struct NineSwapChain9
 
     /* G3D stuff */
     struct pipe_screen *screen;
-    struct pipe_context *pipe;
 
     /* presentation backend */
     ID3DPresent *present;
index b8c9ec047dbe9e4880c65bf9af4f8a53044d9f9a..28c40f40d30ed79dd8dc313e3ff6d50852887d76 100644 (file)
@@ -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;
 
index 33f7cf370c44a99e574ce93f15f6d399cb22cbd4..ac935516baafbfef0cfebe66ca34fc403d137644 100644 (file)
@@ -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);
 
index 79cea3a2c068a9300a4ef7851a95158c8f477fe1..5bddf8f4c1987a8e40496af600e6c6cd004d1f74 100644 (file)
@@ -53,8 +53,6 @@ struct NineVolume9
 
     struct pipe_transfer *transfer;
     unsigned lock_count;
-
-    struct pipe_context *pipe;
 };
 static inline struct NineVolume9 *
 NineVolume9( void *data )