gallium: add PIPE_SHADER_CAP_GLSL_16BIT_TEMPS for LowerPrecisionTemporaries
[mesa.git] / src / gallium / drivers / svga / svga_draw_private.h
index 2a60038e9b5ae9935d0cdf24969e1f726536451d..475ccc5aae0460e40fd26aeb52971c628aa42b62 100644 (file)
@@ -52,7 +52,8 @@ static const unsigned svga_hw_prims =
     (1 << PIPE_PRIM_LINES_ADJACENCY) |
     (1 << PIPE_PRIM_LINE_STRIP_ADJACENCY) |
     (1 << PIPE_PRIM_TRIANGLES_ADJACENCY) |
-    (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY));
+    (1 << PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY) |
+    (1 << PIPE_PRIM_PATCHES));
 
 
 /**
@@ -64,7 +65,8 @@ static const unsigned svga_hw_prims =
  * those to other types of primitives with index/translation code.
  */
 static inline SVGA3dPrimitiveType
-svga_translate_prim(unsigned mode, unsigned vcount, unsigned *prim_count)
+svga_translate_prim(unsigned mode, unsigned vcount, unsigned *prim_count,
+                    ubyte vertices_per_patch)
 {
    switch (mode) {
    case PIPE_PRIM_POINTS:
@@ -107,6 +109,13 @@ svga_translate_prim(unsigned mode, unsigned vcount, unsigned *prim_count)
       *prim_count = vcount / 2 - 2 ;
       return SVGA3D_PRIMITIVE_TRIANGLESTRIP_ADJ;
 
+   case PIPE_PRIM_PATCHES:
+      *prim_count = vcount / vertices_per_patch ;
+      assert(vertices_per_patch >= 1);
+      assert(vertices_per_patch <= 32);
+      return (SVGA3D_PRIMITIVE_1_CONTROL_POINT_PATCH - 1)
+             + vertices_per_patch;
+
    default:
       assert(0);
       *prim_count = 0;
@@ -191,31 +200,23 @@ static inline boolean
 svga_need_unfilled_fallback(const struct svga_hwtnl *hwtnl,
                             enum pipe_prim_type prim)
 {
-   const struct svga_context *svga = hwtnl->svga;
-
    if (u_reduced_prim(prim) != PIPE_PRIM_TRIANGLES) {
       /* if we're drawing points or lines, no fallback needed */
       return FALSE;
    }
 
-   if (svga_have_vgpu10(svga)) {
-      /* vgpu10 supports polygon fill and line modes */
-      if ((prim == PIPE_PRIM_QUADS ||
-           prim == PIPE_PRIM_QUAD_STRIP ||
-           prim == PIPE_PRIM_POLYGON) &&
-          hwtnl->api_fillmode == PIPE_POLYGON_MODE_LINE) {
-         /* VGPU10 doesn't directly render quads or polygons.  They're
-          * converted to triangles.  If we let the device draw the triangle
-          * outlines we'll get an extra, stray lines in the interiors.
-          * So, to draw unfilled quads correctly, we need the fallback.
-          */
-         return true;
-      }
-      return hwtnl->api_fillmode == PIPE_POLYGON_MODE_POINT;
-   } else {
-      /* vgpu9 doesn't support line or point fill modes */
-      return hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL;
+   if ((prim == PIPE_PRIM_QUADS ||
+        prim == PIPE_PRIM_QUAD_STRIP ||
+        prim == PIPE_PRIM_POLYGON) &&
+       hwtnl->api_fillmode == PIPE_POLYGON_MODE_LINE) {
+      /* We can't directly render quads or polygons.  They're
+       * converted to triangles.  If we let the device draw the triangle
+       * outlines we'll get an extra, stray lines in the interiors.
+       * So, to draw unfilled quads correctly, we need the fallback.
+       */
+      return true;
    }
+   return false;
 }
 
 
@@ -226,7 +227,9 @@ svga_hwtnl_prim(struct svga_hwtnl *hwtnl,
                 unsigned min_index,
                 unsigned max_index,
                 struct pipe_resource *ib,
-                unsigned start_instance, unsigned instance_count);
+                unsigned start_instance, unsigned instance_count,
+                const struct pipe_draw_indirect_info *indirect,
+                const struct pipe_stream_output_target *so_vertex_count);
 
 enum pipe_error
 svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl,
@@ -239,6 +242,7 @@ svga_hwtnl_simple_draw_range_elements(struct svga_hwtnl *hwtnl,
                                       unsigned start,
                                       unsigned count,
                                       unsigned start_instance,
-                                      unsigned instance_count);
+                                      unsigned instance_count,
+                                      ubyte vertices_per_patch);
 
 #endif