[Mesa-dev] [RFC PATCH 20/56] vbo: Add patch size to primitive structure.

Chris Forbes chrisf at ijw.co.nz
Sat Sep 20 18:41:00 PDT 2014


From: Fabian Bieler <fabianbieler at fastmail.fm>

---
 src/mesa/vbo/vbo.h            | 3 ++-
 src/mesa/vbo/vbo_exec_api.c   | 2 ++
 src/mesa/vbo/vbo_exec_array.c | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 6e1a4aa..4fe4427 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -47,7 +47,8 @@ struct _mesa_prim {
    GLuint weak:1;
    GLuint no_current_update:1;
    GLuint is_indirect:1;
-   GLuint pad:18;
+   GLuint patch_vertices:7; /** Only valid for GL_PATCHES */
+   GLuint pad:11;
 
    GLuint start;
    GLuint count;
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 74aec12..1101634 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -704,6 +704,8 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
    exec->vtx.prim[i].base_instance = 0;
    exec->vtx.prim[i].is_indirect = 0;
 
+   assert(mode != GL_PATCHES);
+
    ctx->Driver.CurrentExecPrimitive = mode;
 
    ctx->Exec = ctx->BeginEnd;
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 111321b..30b9281 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -619,6 +619,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
    prim[0].base_instance = baseInstance;
    prim[0].is_indirect = 0;
 
+   assert(ctx->TessCtrlProgram.patch_vertices >= 1);
+   assert(ctx->TessCtrlProgram.patch_vertices <= 32);
+   prim[0].patch_vertices = ctx->TessCtrlProgram.patch_vertices;
+
    /* Implement the primitive restart index */
    if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
       GLuint primCount = 0;
-- 
2.1.0



More information about the mesa-dev mailing list