st/nine: Create pipe_surfaces on resource creation.
authorAxel Davy <axel.davy@ens.fr>
Fri, 4 Nov 2016 21:39:14 +0000 (22:39 +0100)
committerAxel Davy <axel.davy@ens.fr>
Tue, 20 Dec 2016 22:44:22 +0000 (23:44 +0100)
Create the pipe_surfaces on renderable resources creation.

This enables to avoid creating them on the fly.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/surface9.c
src/gallium/state_trackers/nine/surface9.h

index 8fa70a79ac624f4eafcf285ff427ca8d9b9216ac..0ce412235118bb2b9ce7559fc33527634eda5ef4 100644 (file)
@@ -185,6 +185,11 @@ NineSurface9_ctor( struct NineSurface9 *This,
     if (This->base.resource && (pDesc->Usage & D3DUSAGE_DYNAMIC))
         This->base.resource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
 
+    if (This->base.resource && (pDesc->Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL))) {
+        (void) NineSurface9_CreatePipeSurface(This, 0);
+        (void) NineSurface9_CreatePipeSurface(This, 1);
+    }
+
     /* TODO: investigate what else exactly needs to be cleared */
     if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
         surf = NineSurface9_GetSurface(This, 0);
@@ -748,6 +753,10 @@ NineSurface9_SetResourceResize( struct NineSurface9 *This,
 
     pipe_surface_reference(&This->surface[0], NULL);
     pipe_surface_reference(&This->surface[1], NULL);
+    if (resource) {
+        (void) NineSurface9_CreatePipeSurface(This, 0);
+        (void) NineSurface9_CreatePipeSurface(This, 1);
+    }
 }
 
 
index 856c03b3844322b915546de4b3b017ec78713d27..d43739bb2ada00ee0430f7e6a601b0f3eeea7097 100644 (file)
@@ -94,9 +94,8 @@ NineSurface9_CreatePipeSurface( struct NineSurface9 *This, const int sRGB );
 static inline struct pipe_surface *
 NineSurface9_GetSurface( struct NineSurface9 *This, int sRGB )
 {
-    if (This->surface[sRGB])
-        return This->surface[sRGB];
-    return NineSurface9_CreatePipeSurface(This, sRGB);
+    assert(This->surface[sRGB]);
+    return This->surface[sRGB];
 }
 
 static inline struct pipe_resource *