aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2016-12-28 18:32:39 +0100
committerAxel Davy <[email protected]>2017-01-12 20:33:11 +0100
commit6b87a2a77a459d5c69f296b732d66daa9ff8e223 (patch)
tree4feb2c30ac5a064faeec85b25a5abec56786648d /src/gallium
parentf895ab8e22dc520304141ba56c1b81d8d6657ccd (diff)
st/nine: Flush pending commands if needed for surface9 changes
nine_context uses NineSurface9 fields, thus we need to flush pending commands using the surface before changing the fields. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/surface9.c28
-rw-r--r--src/gallium/state_trackers/nine/surface9.h17
2 files changed, 32 insertions, 13 deletions
diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
index 4b8e2132abc..836369cafdb 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -755,6 +755,33 @@ NineSurface9_UploadSelf( struct NineSurface9 *This,
return D3D_OK;
}
+/* Currently nine_context uses the NineSurface9
+ * fields when it is render target. Any modification requires
+ * pending commands with the surface to be executed. If the bind
+ * count is 0, there is no pending commands. */
+#define PROCESS_IF_BOUND(surf) \
+ if (surf->base.base.bind) \
+ nine_csmt_process(surf->base.base.device);
+
+void
+NineSurface9_SetResource( struct NineSurface9 *This,
+ struct pipe_resource *resource, unsigned level )
+{
+ /* No need to call PROCESS_IF_BOUND, because SetResource is used only
+ * for MANAGED textures, and they are not render targets. */
+ assert(This->base.pool == D3DPOOL_MANAGED);
+ This->level = level;
+ pipe_resource_reference(&This->base.resource, resource);
+}
+
+void
+NineSurface9_SetMultiSampleType( struct NineSurface9 *This,
+ D3DMULTISAMPLE_TYPE mst )
+{
+ PROCESS_IF_BOUND(This);
+ This->desc.MultiSampleType = mst;
+}
+
void
NineSurface9_SetResourceResize( struct NineSurface9 *This,
struct pipe_resource *resource )
@@ -764,6 +791,7 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This,
assert(This->desc.Pool == D3DPOOL_DEFAULT);
assert(!This->texture);
+ PROCESS_IF_BOUND(This);
pipe_resource_reference(&This->base.resource, resource);
This->desc.Width = This->base.info.width0 = resource->width0;
diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h
index 6f416f2de6a..7badde4e172 100644
--- a/src/gallium/state_trackers/nine/surface9.h
+++ b/src/gallium/state_trackers/nine/surface9.h
@@ -103,22 +103,13 @@ NineSurface9_GetResource( struct NineSurface9 *This )
return This->base.resource;
}
-static inline void
+void
NineSurface9_SetResource( struct NineSurface9 *This,
- struct pipe_resource *resource, unsigned level )
-{
- This->level = level;
- pipe_resource_reference(&This->base.resource, resource);
- pipe_surface_reference(&This->surface[0], NULL);
- pipe_surface_reference(&This->surface[1], NULL);
-}
+ struct pipe_resource *resource, unsigned level );
-static inline void
+void
NineSurface9_SetMultiSampleType( struct NineSurface9 *This,
- D3DMULTISAMPLE_TYPE mst )
-{
- This->desc.MultiSampleType = mst;
-}
+ D3DMULTISAMPLE_TYPE mst );
void
NineSurface9_SetResourceResize( struct NineSurface9 *This,