[Mesa-dev] [RFC PATCH 03/56] mesa/main: Add tessellation shader structs

Chris Forbes chrisf at ijw.co.nz
Sat Sep 20 18:40:43 PDT 2014


From: Fabian Bieler <fabianbieler at fastmail.fm>

---
 src/mesa/main/mtypes.h | 121 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 59e6eeb..7a8f5f3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2274,6 +2274,30 @@ struct gl_vertex_program
 };
 
 
+/** Tessellation control program object */
+struct gl_tess_ctrl_program
+{
+   struct gl_program Base;   /**< base class */
+
+   /* output layout */
+   GLint VerticesOut;
+};
+
+
+/** Tessellation evaluation program object */
+struct gl_tess_eval_program
+{
+   struct gl_program Base;   /**< base class */
+
+   /* input layout */
+   GLenum PrimitiveMode; /* GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
+   GLenum Spacing;       /* GL_EQUAL, GL_FRACTIONAL_EVEN or
+                            GL_FRACTIONAL_ODD */
+   GLenum VertexOrder;   /* GL_CW or GL_CCW */
+   GLboolean PointMode;
+};
+
+
 /** Geometry program object */
 struct gl_geometry_program
 {
@@ -2376,6 +2400,39 @@ struct gl_vertex_program_state
    GLboolean _Overriden;
 };
 
+/**
+ * Context state for tessellation control programs.
+ */
+struct gl_tess_ctrl_program_state
+{
+   GLboolean Enabled;               /**< GL_ARB_TESSELLATION_SHADER */
+   GLboolean _Enabled;              /**< Enabled and valid program? */
+   struct gl_tess_ctrl_program *Current;  /**< user-bound tessellation control program */
+
+   /** Currently enabled and valid program (including internal programs
+    * and compiled shader programs).
+    */
+   struct gl_tess_ctrl_program *_Current;
+
+   GLint patch_vertices;
+   GLfloat patch_default_outer_level[4];
+   GLfloat patch_default_inner_level[2];
+};
+
+/**
+ * Context state for tessellation evaluation programs.
+ */
+struct gl_tess_eval_program_state
+{
+   GLboolean Enabled;               /**< GL_ARB_TESSELLATION_SHADER */
+   GLboolean _Enabled;              /**< Enabled and valid program? */
+   struct gl_tess_eval_program *Current;  /**< user-bound tessellation control program */
+
+   /** Currently enabled and valid program (including internal programs
+    * and compiled shader programs).
+    */
+   struct gl_tess_eval_program *_Current;
+};
 
 /**
  * Context state for geometry programs.
@@ -2573,6 +2630,41 @@ struct gl_shader
    bool pixel_center_integer;
 
    /**
+    * Tessellation Control shader state from layout qualifiers.
+    */
+   struct {
+      /**
+       * 0 - vertices not declared in shader, or
+       * 1 .. GL_MAX_PATCH_VERTICES
+       */
+      GLint VerticesOut;
+   } TessCtrl;
+
+   /**
+    * Tessellation Evaluation shader state from layout qualifiers.
+    */
+   struct {
+      /**
+       * GL_TRIANGLES, GL_QUADS, GL_ISOLINES or PRIM_UNKNOWN if it's not set
+       * in this shader.
+       */
+      GLenum PrimitiveMode;
+      /**
+       * GL_EQUAL, GL_FRACTIONAL_ODD, GL_FRACTIONAL_EVEN, or 0 if it's not set
+       * in this shader.
+       */
+      GLenum Spacing;
+      /**
+       * GL_CW, GL_CCW, or 0 if it's not set in this shader.
+       */
+      GLenum VertexOrder;
+      /**
+       * 1, 0, or -1 if it's not set in this shader.
+       */
+      int PointMode;
+   } TessEval;
+
+   /**
     * Geometry shader state from GLSL 1.50 layout qualifiers.
     */
    struct {
@@ -2780,6 +2872,31 @@ struct gl_shader_program
    enum gl_frag_depth_layout FragDepthLayout;
 
    /**
+    * Tessellation Control shader state from layout qualifiers.
+    */
+   struct {
+      /**
+       * 0 - vertices not declared in shader, or
+       * 1 .. GL_MAX_PATCH_VERTICES
+       */
+      GLint VerticesOut;
+   } TessCtrl;
+
+   /**
+    * Tessellation Evaluation shader state from layout qualifiers.
+    */
+   struct {
+      /** GL_TRIANGLES, GL_QUADS or GL_ISOLINES */
+      GLenum PrimitiveMode;
+      /** GL_EQUAL, GL_FRACTIONAL_ODD or GL_FRACTIONAL_EVEN */
+      GLenum Spacing;
+      /** GL_CW or GL_CCW */
+      GLenum VertexOrder;
+      /** 1 or 0 */
+      int PointMode;
+   } TessEval;
+
+   /**
     * Geometry shader state - copied into gl_geometry_program by
     * _mesa_copy_linked_program_data().
     */
@@ -3095,6 +3212,8 @@ struct gl_shared_state
    struct gl_vertex_program *DefaultVertexProgram;
    struct gl_fragment_program *DefaultFragmentProgram;
    struct gl_geometry_program *DefaultGeometryProgram;
+   struct gl_tess_ctrl_program *DefaultTessCtrlProgram;
+   struct gl_tess_eval_program *DefaultTessEvalProgram;
    /*@}*/
 
    /* GL_ATI_fragment_shader */
@@ -4250,6 +4369,8 @@ struct gl_context
    struct gl_fragment_program_state FragmentProgram;
    struct gl_geometry_program_state GeometryProgram;
    struct gl_compute_program_state ComputeProgram;
+   struct gl_tess_ctrl_program_state TessCtrlProgram;
+   struct gl_tess_eval_program_state TessEvalProgram;
    struct gl_ati_fragment_shader_state ATIFragmentShader;
 
    struct gl_pipeline_shader_state Pipeline; /**< GLSL pipeline shader object state */
-- 
2.1.0



More information about the mesa-dev mailing list