python: Simplify st_winsys.
authorJosé Fonseca <jrfonseca@tungstengraphics.com>
Wed, 13 Aug 2008 11:41:19 +0000 (12:41 +0100)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Thu, 14 Aug 2008 10:01:42 +0000 (11:01 +0100)
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_hardpipe_winsys.c
src/gallium/state_trackers/python/st_softpipe_winsys.c
src/gallium/state_trackers/python/st_winsys.h

index fbd56712e01bc25423118809a5f1018629f248cc..c82261e4e7532c099d2937641b1888d82462ae9a 100644 (file)
@@ -41,7 +41,7 @@ static void
 st_device_really_destroy(struct st_device *st_dev) 
 {
    if(st_dev->screen)
-      st_dev->st_ws->screen_destroy(st_dev->screen);
+      st_dev->screen->destroy(st_dev->screen);
    
    FREE(st_dev);
 }
@@ -61,9 +61,7 @@ st_device_create_from_st_winsys(const struct st_winsys *st_ws)
    struct st_device *st_dev;
    
    if(!st_ws->screen_create ||
-      !st_ws->screen_destroy ||
-      !st_ws->context_create ||
-      !st_ws->context_destroy)
+      !st_ws->context_create)
       return NULL;
    
    st_dev = CALLOC_STRUCT(st_device);
@@ -106,7 +104,7 @@ st_context_destroy(struct st_context *st_ctx)
       }
       
       if(st_ctx->pipe)
-         st_ctx->st_dev->st_ws->context_destroy(st_ctx->pipe);
+         st_ctx->pipe->destroy(st_ctx->pipe);
       
       for(i = 0; i < PIPE_MAX_SAMPLERS; ++i)
          pipe_texture_reference(&st_ctx->sampler_textures[i], NULL);
index 1e04998232923efa4b8d7d29f7ad739c9b3c73cb..8b33c70fd7111e44ae39531c8691c7aeb7f08c9a 100644 (file)
@@ -42,13 +42,6 @@ extern void init_gallium(void);
 void (*force_init_gallium_linkage)(void) = &init_gallium;
 
 
-static void 
-st_hardpipe_screen_destroy(struct pipe_screen *screen)
-{
-   st_softpipe_winsys.screen_destroy(screen);
-}
-
-
 static struct pipe_screen *
 st_hardpipe_screen_create(void)
 {
@@ -56,13 +49,6 @@ st_hardpipe_screen_create(void)
 }
 
 
-static void
-st_hardpipe_context_destroy(struct pipe_context *pipe)
-{
-   st_softpipe_winsys.context_destroy(pipe);
-}
-
-
 static struct pipe_context *
 st_hardpipe_context_create(struct pipe_screen *screen)
 {
@@ -72,7 +58,5 @@ st_hardpipe_context_create(struct pipe_screen *screen)
 
 const struct st_winsys st_hardpipe_winsys = {
    &st_hardpipe_screen_create,
-   &st_hardpipe_screen_destroy,
-   &st_hardpipe_context_create,
-   &st_hardpipe_context_destroy
+   &st_hardpipe_context_create
 };
index 1fda70ca00fa5fc996a1b6f9c3a14661c2d8c2a2..6ea3c9a5cf0403fd7b8dba589fd17df59d584650 100644 (file)
@@ -253,13 +253,9 @@ st_softpipe_fence_finish(struct pipe_winsys *winsys,
 }
 
 
-static void 
-st_softpipe_screen_destroy(struct pipe_screen *screen)
+static void
+st_softpipe_destroy(struct pipe_winsys *winsys)
 {
-   struct pipe_winsys *winsys = screen->winsys;
-
-   screen->destroy(screen);
-
    FREE(winsys);
 }
 
@@ -274,6 +270,8 @@ st_softpipe_screen_create(void)
    if(!winsys)
       return NULL;
 
+   winsys->destroy = st_softpipe_destroy;
+   
    winsys->buffer_create = st_softpipe_buffer_create;
    winsys->user_buffer_create = st_softpipe_user_buffer_create;
    winsys->buffer_map = st_softpipe_buffer_map;
@@ -293,19 +291,12 @@ st_softpipe_screen_create(void)
 
    screen = softpipe_create_screen(winsys);
    if(!screen)
-      FREE(winsys);
+      st_softpipe_destroy(winsys);
 
    return screen;
 }
 
 
-static void
-st_softpipe_context_destroy(struct pipe_context *pipe)
-{
-   pipe->destroy(pipe);
-}
-
-
 static struct pipe_context *
 st_softpipe_context_create(struct pipe_screen *screen)
 {
@@ -315,7 +306,5 @@ st_softpipe_context_create(struct pipe_screen *screen)
 
 const struct st_winsys st_softpipe_winsys = {
    &st_softpipe_screen_create,
-   &st_softpipe_screen_destroy,
    &st_softpipe_context_create,
-   &st_softpipe_context_destroy
 };
index 43db8b6bff127ab437767a3bb097f194012c7331..b8cb612d863fedbce2d853d2499ea1962d0a2d96 100644 (file)
@@ -39,14 +39,8 @@ struct st_winsys
    struct pipe_screen *
    (*screen_create)(void);
 
-   void
-   (*screen_destroy)(struct pipe_screen *screen);
-
    struct pipe_context *
    (*context_create)(struct pipe_screen *screen);
-
-   void
-   (*context_destroy)(struct pipe_context *pipe);
 };