draw: Save original driver functions earlier.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 20 Jun 2012 13:25:46 +0000 (14:25 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 23 Jan 2014 15:49:32 +0000 (15:49 +0000)
Otherwise they will be NULL when stage destroy is invoked prematurely,
(i.e, on out of memory).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/draw/draw_pipe_aaline.c
src/gallium/auxiliary/draw/draw_pipe_pstipple.c

index f2895ddc3575880c317519a2b01708b891959ed0..8955762ce27e450eba372617f08b7786b2e172f2 100644 (file)
@@ -996,13 +996,6 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
    if (!aaline)
       goto fail;
 
-   /* create special texture, sampler state */
-   if (!aaline_create_texture(aaline))
-      goto fail;
-
-   if (!aaline_create_sampler(aaline))
-      goto fail;
-
    /* save original driver functions */
    aaline->driver_create_fs_state = pipe->create_fs_state;
    aaline->driver_bind_fs_state = pipe->bind_fs_state;
@@ -1011,6 +1004,13 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe)
    aaline->driver_bind_sampler_states = pipe->bind_sampler_states;
    aaline->driver_set_sampler_views = pipe->set_sampler_views;
 
+   /* create special texture, sampler state */
+   if (!aaline_create_texture(aaline))
+      goto fail;
+
+   if (!aaline_create_sampler(aaline))
+      goto fail;
+
    /* override the driver's functions */
    pipe->create_fs_state = aaline_create_fs_state;
    pipe->bind_fs_state = aaline_bind_fs_state;
index 73da96677f60f230621ed6bb9f717cb3af9c7fe7..d7dcfdb596ff9e7aa3b1f1197dc64ffbe6c6a066 100644 (file)
@@ -794,13 +794,6 @@ draw_install_pstipple_stage(struct draw_context *draw,
 
    draw->pipeline.pstipple = &pstip->stage;
 
-   /* create special texture, sampler state */
-   if (!pstip_create_texture(pstip))
-      goto fail;
-
-   if (!pstip_create_sampler(pstip))
-      goto fail;
-
    /* save original driver functions */
    pstip->driver_create_fs_state = pipe->create_fs_state;
    pstip->driver_bind_fs_state = pipe->bind_fs_state;
@@ -810,6 +803,13 @@ draw_install_pstipple_stage(struct draw_context *draw,
    pstip->driver_set_sampler_views = pipe->set_sampler_views;
    pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple;
 
+   /* create special texture, sampler state */
+   if (!pstip_create_texture(pstip))
+      goto fail;
+
+   if (!pstip_create_sampler(pstip))
+      goto fail;
+
    /* override the driver's functions */
    pipe->create_fs_state = pstip_create_fs_state;
    pipe->bind_fs_state = pstip_bind_fs_state;