[Mesa-dev] [PATCH 12/32] i965/state: Move is_drawing_lines/points to gen6_clip_state.c

Jason Ekstrand jason at jlekstrand.net
Thu Aug 11 21:15:09 UTC 2016


---
 src/mesa/drivers/dri/i965/brw_state.h       | 55 ++---------------------------
 src/mesa/drivers/dri/i965/gen6_clip_state.c | 54 +++++++++++++++++++++++++++-
 src/mesa/drivers/dri/i965/gen6_sf_state.c   |  4 +--
 src/mesa/drivers/dri/i965/gen7_sf_state.c   |  2 +-
 4 files changed, 59 insertions(+), 56 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index fc66593..8990485 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -406,63 +406,14 @@ void brw_upload_clip_prog(struct brw_context *brw);
 /* brw_sf.c */
 void brw_upload_sf_prog(struct brw_context *brw);
 
+bool brw_is_drawing_points(const struct brw_context *brw);
+bool brw_is_drawing_lines(const struct brw_context *brw);
+
 /* gen7_l3_state.c */
 void
 gen7_restore_default_l3_config(struct brw_context *brw);
 
 static inline bool
-is_drawing_points(const struct brw_context *brw)
-{
-   /* Determine if the primitives *reaching the SF* are points */
-   /* _NEW_POLYGON */
-   if (brw->ctx.Polygon.FrontMode == GL_POINT ||
-       brw->ctx.Polygon.BackMode == GL_POINT) {
-      return true;
-   }
-
-   if (brw->geometry_program) {
-      /* BRW_NEW_GEOMETRY_PROGRAM */
-      return brw->geometry_program->OutputType == GL_POINTS;
-   } else if (brw->tes.prog_data) {
-      /* BRW_NEW_TES_PROG_DATA */
-      return brw->tes.prog_data->output_topology ==
-             BRW_TESS_OUTPUT_TOPOLOGY_POINT;
-   } else {
-      /* BRW_NEW_PRIMITIVE */
-      return brw->primitive == _3DPRIM_POINTLIST;
-   }
-}
-
-static inline bool
-is_drawing_lines(const struct brw_context *brw)
-{
-   /* Determine if the primitives *reaching the SF* are points */
-   /* _NEW_POLYGON */
-   if (brw->ctx.Polygon.FrontMode == GL_LINE ||
-       brw->ctx.Polygon.BackMode == GL_LINE) {
-      return true;
-   }
-
-   if (brw->geometry_program) {
-      /* BRW_NEW_GEOMETRY_PROGRAM */
-      return brw->geometry_program->OutputType == GL_LINE_STRIP;
-   } else if (brw->tes.prog_data) {
-      /* BRW_NEW_TES_PROG_DATA */
-      return brw->tes.prog_data->output_topology ==
-             BRW_TESS_OUTPUT_TOPOLOGY_LINE;
-   } else {
-      /* BRW_NEW_PRIMITIVE */
-      switch (brw->primitive) {
-      case _3DPRIM_LINELIST:
-      case _3DPRIM_LINESTRIP:
-      case _3DPRIM_LINELOOP:
-         return true;
-      }
-   }
-   return false;
-}
-
-static inline bool
 use_state_point_size(const struct brw_context *brw)
 {
    const struct gl_context *ctx = &brw->ctx;
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 8fa3e04..4a3f7f9 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -33,6 +33,58 @@
 #include "main/fbobject.h"
 #include "main/framebuffer.h"
 
+bool
+brw_is_drawing_points(const struct brw_context *brw)
+{
+   /* Determine if the primitives *reaching the SF* are points */
+   /* _NEW_POLYGON */
+   if (brw->ctx.Polygon.FrontMode == GL_POINT ||
+       brw->ctx.Polygon.BackMode == GL_POINT) {
+      return true;
+   }
+
+   if (brw->geometry_program) {
+      /* BRW_NEW_GEOMETRY_PROGRAM */
+      return brw->geometry_program->OutputType == GL_POINTS;
+   } else if (brw->tes.prog_data) {
+      /* BRW_NEW_TES_PROG_DATA */
+      return brw->tes.prog_data->output_topology ==
+             BRW_TESS_OUTPUT_TOPOLOGY_POINT;
+   } else {
+      /* BRW_NEW_PRIMITIVE */
+      return brw->primitive == _3DPRIM_POINTLIST;
+   }
+}
+
+bool
+brw_is_drawing_lines(const struct brw_context *brw)
+{
+   /* Determine if the primitives *reaching the SF* are points */
+   /* _NEW_POLYGON */
+   if (brw->ctx.Polygon.FrontMode == GL_LINE ||
+       brw->ctx.Polygon.BackMode == GL_LINE) {
+      return true;
+   }
+
+   if (brw->geometry_program) {
+      /* BRW_NEW_GEOMETRY_PROGRAM */
+      return brw->geometry_program->OutputType == GL_LINE_STRIP;
+   } else if (brw->tes.prog_data) {
+      /* BRW_NEW_TES_PROG_DATA */
+      return brw->tes.prog_data->output_topology ==
+             BRW_TESS_OUTPUT_TOPOLOGY_LINE;
+   } else {
+      /* BRW_NEW_PRIMITIVE */
+      switch (brw->primitive) {
+      case _3DPRIM_LINELIST:
+      case _3DPRIM_LINESTRIP:
+      case _3DPRIM_LINELOOP:
+         return true;
+      }
+   }
+   return false;
+}
+
 static void
 upload_clip_state(struct brw_context *brw)
 {
@@ -178,7 +230,7 @@ upload_clip_state(struct brw_context *brw)
    else
       enable = GEN6_CLIP_ENABLE;
 
-   if (!is_drawing_points(brw) && !is_drawing_lines(brw))
+   if (!brw_is_drawing_points(brw) && !brw_is_drawing_lines(brw))
       dw2 |= GEN6_CLIP_XY_TEST;
 
    /* BRW_NEW_VUE_MAP_GEOM_OUT */
diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index f70305c..7cef17a 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -195,7 +195,7 @@ calculate_attr_overrides(const struct brw_context *brw,
     * _NEW_POLYGON
     * BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM | BRW_NEW_TES_PROG_DATA
     */
-   bool drawing_points = is_drawing_points(brw);
+   bool drawing_points = brw_is_drawing_points(brw);
 
    /* Initialize all the attr_overrides to 0.  In the loop below we'll modify
     * just the ones that correspond to inputs used by the fs.
@@ -337,7 +337,7 @@ upload_sf_state(struct brw_context *brw)
 
    /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
    if (ctx->Scissor.EnableFlags ||
-       is_drawing_points(brw) || is_drawing_lines(brw))
+       brw_is_drawing_points(brw) || brw_is_drawing_lines(brw))
       dw3 |= GEN6_SF_SCISSOR_ENABLE;
 
    /* _NEW_POLYGON */
diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 8d49e24..ba0592a 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -189,7 +189,7 @@ upload_sf_state(struct brw_context *brw)
 
    /* _NEW_SCISSOR _NEW_POLYGON BRW_NEW_GEOMETRY_PROGRAM BRW_NEW_PRIMITIVE */
    if (ctx->Scissor.EnableFlags ||
-       is_drawing_points(brw) || is_drawing_lines(brw))
+       brw_is_drawing_points(brw) || brw_is_drawing_lines(brw))
       dw2 |= GEN6_SF_SCISSOR_ENABLE;
 
    /* _NEW_LINE */
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list