On 05.02.2016 19:55, Brian Paul wrote:
Do this one-time init with the other on-time inits.

Since Bitmap is something that few programs use, wouldn't it be better to move in the other direction and do all the one-time inits on-demand rather than at context init?

Cheers,
Nicolai

---
  src/mesa/state_tracker/st_cb_bitmap.c | 26 +++++++++++++-------------
  1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bitmap.c 
b/src/mesa/state_tracker/st_cb_bitmap.c
index d8c3dbd..f39d956 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -631,19 +631,6 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
        st_validate_state(st);
     }

-   if (!st->bitmap.vs) {
-      /* create pass-through vertex shader now */
-      const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
-                                      TGSI_SEMANTIC_COLOR,
-        st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
-                                      TGSI_SEMANTIC_GENERIC };
-      const uint semantic_indexes[] = { 0, 0, 0 };
-      st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
-                                                          semantic_names,
-                                                          semantic_indexes,
-                                                          FALSE);
-   }
-
     if (UseBitmapCache && accum_bitmap(ctx, x, y, width, height, unpack, 
bitmap))
        return;

@@ -722,6 +709,19 @@ st_init_bitmap(struct st_context *st)
        assert(0);
     }

+   /* Create VS for rendering bitmaps */
+   {
+      const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
+                                      TGSI_SEMANTIC_COLOR,
+        st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD :
+                                      TGSI_SEMANTIC_GENERIC };
+      const uint semantic_indexes[] = { 0, 0, 0 };
+      st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3,
+                                                          semantic_names,
+                                                          semantic_indexes,
+                                                          FALSE);
+   }
+
     /* alloc bitmap cache object */
     st->bitmap.cache = ST_CALLOC_STRUCT(bitmap_cache);


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to