[Mesa-dev] [PATCH 2/2] st/mesa: tell u_vbuf that GL core doesn't have user VBOs

Marek Olšák maraeo at gmail.com
Sat Feb 11 16:31:28 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

I think this only affects radeonsi - VI, because all other drivers using
u_vbuf probably don't support GL_DOUBLE, so they won't be affected by this.
---
 src/mesa/state_tracker/st_context.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 1229340..e0d4312 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -69,20 +69,21 @@
 #include "st_extensions.h"
 #include "st_gen_mipmap.h"
 #include "st_pbo.h"
 #include "st_program.h"
 #include "st_sampler_view.h"
 #include "st_vdpau.h"
 #include "st_texture.h"
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
 #include "util/u_upload_mgr.h"
+#include "util/u_vbuf.h"
 #include "cso_cache/cso_context.h"
 
 
 DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
 
 
 /**
  * Called via ctx->Driver.Enable()
  */
 static void st_Enable(struct gl_context * ctx, GLenum cap, GLboolean state)
@@ -355,21 +356,27 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
       st->indexbuf_uploader = u_upload_create(pipe, 128 * 1024,
                                               PIPE_BIND_INDEX_BUFFER,
                                               PIPE_USAGE_STREAM);
    }
 
    if (!screen->get_param(screen, PIPE_CAP_USER_CONSTANT_BUFFERS))
       st->constbuf_uploader = u_upload_create(pipe, 128 * 1024,
                                               PIPE_BIND_CONSTANT_BUFFER,
                                               PIPE_USAGE_STREAM);
 
-   st->cso_context = cso_create_context(pipe, 0);
+   /* Drivers still have to upload zero-stride vertex attribs manually
+    * with the GL core profile, but they don't have to deal with any complex
+    * user vertex buffer uploads.
+    */
+   unsigned vbuf_flags =
+      ctx->API == API_OPENGL_CORE ? U_VBUF_FLAG_NO_USER_VBOS : 0;
+   st->cso_context = cso_create_context(pipe, vbuf_flags);
 
    st_init_atoms( st );
    st_init_clear(st);
    st_init_draw( st );
    st_init_pbo_helpers(st);
 
    /* Choose texture target for glDrawPixels, glBitmap, renderbuffers */
    if (pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES))
       st->internal_target = PIPE_TEXTURE_2D;
    else
-- 
2.7.4



More information about the mesa-dev mailing list