From e068d3afe17cb7e26d8229ee279c71a09e9a20af Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Fri, 4 Nov 2016 22:39:14 +0100 Subject: [PATCH] st/nine: Create pipe_surfaces on resource creation. Create the pipe_surfaces on renderable resources creation. This enables to avoid creating them on the fly. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/surface9.c | 9 +++++++++ src/gallium/state_trackers/nine/surface9.h | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index 8fa70a7..0ce4122 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -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); + } } diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index 856c03b..d43739b 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -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 * -- 2.7.4