summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_feedback.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2016-08-02 12:28:27 -0700
committerEric Anholt <[email protected]>2016-08-04 08:48:27 -0700
commit2a808219b3f9a50bc5bf3c5290db6a55cd707de7 (patch)
tree031d59393725abe6c51ae74e458dfa859ce4548d /src/mesa/state_tracker/st_cb_feedback.c
parentc976e164d262d2d2bfd8087dcbb7bd91995ae887 (diff)
state_tracker: Initialize the draw context only when needed.
It's only used for rarely-used deprecated GL features (feedback/rasterpos), so we can skip the memory allocation and initialization for it most of the time. Saves about 659k (out of 1605k) of maximum memory size according to massif on simulated vc4 glsl-algebraic-add-add-1 Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_feedback.c')
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 735e268be87..a18f4f76bcf 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -274,7 +274,10 @@ static void
st_RenderMode(struct gl_context *ctx, GLenum newMode )
{
struct st_context *st = st_context(ctx);
- struct draw_context *draw = st->draw;
+ struct draw_context *draw = st_get_draw_context(st);
+
+ if (!st->draw)
+ return;
if (newMode == GL_RENDER) {
/* restore normal VBO draw function */