Re: [Mesa-dev] [PATCH 2/2] swr: Fix polygonmode for front==back

2017-04-25 Thread Kyriazis, George
I am perfectly fine not submitting into stable.  And can remove the assert, 
since it’s causing trouble.

FWIW, piglit llvmpipe.py fixes 3 tests with no regressions.

George

On Apr 25, 2017, at 9:23 PM, Rowley, Timothy O 
> wrote:

Additionally I don’t think this should go into stable - without the 
corresponding rasterizer commit (which feels like a risky change post -rc1) it 
is of limited use.

On Apr 25, 2017, at 6:58 PM, Ilia Mirkin 
> wrote:

This will cause asserts on piglit and dEQP runs instead of failures. This is 
incredibly inconvenient, as e.g. dEQP runs everything in a single process.

On Apr 25, 2017 7:29 PM, "George Kyriazis" 
> wrote:
Add logic for converting enums and also making sure stipple works.

CC: 
>

---
 src/gallium/drivers/swr/swr_state.cpp | 14 +-
 src/gallium/drivers/swr/swr_state.h   | 20 
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp 
b/src/gallium/drivers/swr/swr_state.cpp
index 56b1374..24a6759 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -201,6 +201,12 @@ swr_create_rasterizer_state(struct pipe_context *pipe,
struct pipe_rasterizer_state *state;
state = (pipe_rasterizer_state *)mem_dup(rast, sizeof *rast);

+   if (state) {
+  if (state->fill_front != state->fill_back) {
+ assert(0 && "front != back polygon mode not supported");
+  }
+   }
+
return state;
 }

@@ -1153,6 +1159,10 @@ swr_update_derived(struct pipe_context *pipe,
  rastState->slopeScaledDepthBias = 0;
  rastState->depthBiasClamp = 0;
   }
+
+  /* translate polygon mode, at least for the front==back case */
+  rastState->fillMode = swr_convert_fill_mode(rasterizer->fill_front);
+
   struct pipe_surface *zb = fb->zsbuf;
   if (zb && swr_resource(zb->texture)->has_depth)
  rastState->depthFormat = swr_resource(zb->texture)->swr.format;
@@ -1423,7 +1433,9 @@ swr_update_derived(struct pipe_context *pipe,
/* and points, since we rasterize them as triangles, too */
/* Has to be before fragment shader, since it sets SWR_NEW_FS */
if (p_draw_info) {
-  bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) == 
PIPE_PRIM_TRIANGLES);
+  bool new_prim_is_poly =
+ (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES) &&
+ (ctx->derived.rastState.fillMode == SWR_FILLMODE_SOLID);
   if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) {
  ctx->dirty |= SWR_NEW_FS;
  ctx->poly_stipple.prim_is_poly = new_prim_is_poly;
diff --git a/src/gallium/drivers/swr/swr_state.h 
b/src/gallium/drivers/swr/swr_state.h
index 9a8c4e1..7940a96 100644
--- a/src/gallium/drivers/swr/swr_state.h
+++ b/src/gallium/drivers/swr/swr_state.h
@@ -376,4 +376,24 @@ swr_convert_prim_topology(const unsigned mode)
   return TOP_UNKNOWN;
}
 };
+
+/*
+ * convert mesa PIPE_POLYGON_MODE_X to SWR enum SWR_FILLMODE
+ */
+static INLINE enum SWR_FILLMODE
+swr_convert_fill_mode(const unsigned mode)
+{
+   switch(mode) {
+   case PIPE_POLYGON_MODE_FILL:
+  return SWR_FILLMODE_SOLID;
+   case PIPE_POLYGON_MODE_LINE:
+  return SWR_FILLMODE_WIREFRAME;
+   case PIPE_POLYGON_MODE_POINT:
+  return SWR_FILLMODE_POINT;
+   default:
+  assert(0 && "Unknown fillmode");
+  return SWR_FILLMODE_SOLID; // at least do something sensible
+   }
+}
+
 #endif
--
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] swr: Fix polygonmode for front==back

2017-04-25 Thread Rowley, Timothy O
Additionally I don’t think this should go into stable - without the 
corresponding rasterizer commit (which feels like a risky change post -rc1) it 
is of limited use.

On Apr 25, 2017, at 6:58 PM, Ilia Mirkin 
> wrote:

This will cause asserts on piglit and dEQP runs instead of failures. This is 
incredibly inconvenient, as e.g. dEQP runs everything in a single process.

On Apr 25, 2017 7:29 PM, "George Kyriazis" 
> wrote:
Add logic for converting enums and also making sure stipple works.

CC: 
>

---
 src/gallium/drivers/swr/swr_state.cpp | 14 +-
 src/gallium/drivers/swr/swr_state.h   | 20 
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp 
b/src/gallium/drivers/swr/swr_state.cpp
index 56b1374..24a6759 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -201,6 +201,12 @@ swr_create_rasterizer_state(struct pipe_context *pipe,
struct pipe_rasterizer_state *state;
state = (pipe_rasterizer_state *)mem_dup(rast, sizeof *rast);

+   if (state) {
+  if (state->fill_front != state->fill_back) {
+ assert(0 && "front != back polygon mode not supported");
+  }
+   }
+
return state;
 }

@@ -1153,6 +1159,10 @@ swr_update_derived(struct pipe_context *pipe,
  rastState->slopeScaledDepthBias = 0;
  rastState->depthBiasClamp = 0;
   }
+
+  /* translate polygon mode, at least for the front==back case */
+  rastState->fillMode = swr_convert_fill_mode(rasterizer->fill_front);
+
   struct pipe_surface *zb = fb->zsbuf;
   if (zb && swr_resource(zb->texture)->has_depth)
  rastState->depthFormat = swr_resource(zb->texture)->swr.format;
@@ -1423,7 +1433,9 @@ swr_update_derived(struct pipe_context *pipe,
/* and points, since we rasterize them as triangles, too */
/* Has to be before fragment shader, since it sets SWR_NEW_FS */
if (p_draw_info) {
-  bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) == 
PIPE_PRIM_TRIANGLES);
+  bool new_prim_is_poly =
+ (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES) &&
+ (ctx->derived.rastState.fillMode == SWR_FILLMODE_SOLID);
   if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) {
  ctx->dirty |= SWR_NEW_FS;
  ctx->poly_stipple.prim_is_poly = new_prim_is_poly;
diff --git a/src/gallium/drivers/swr/swr_state.h 
b/src/gallium/drivers/swr/swr_state.h
index 9a8c4e1..7940a96 100644
--- a/src/gallium/drivers/swr/swr_state.h
+++ b/src/gallium/drivers/swr/swr_state.h
@@ -376,4 +376,24 @@ swr_convert_prim_topology(const unsigned mode)
   return TOP_UNKNOWN;
}
 };
+
+/*
+ * convert mesa PIPE_POLYGON_MODE_X to SWR enum SWR_FILLMODE
+ */
+static INLINE enum SWR_FILLMODE
+swr_convert_fill_mode(const unsigned mode)
+{
+   switch(mode) {
+   case PIPE_POLYGON_MODE_FILL:
+  return SWR_FILLMODE_SOLID;
+   case PIPE_POLYGON_MODE_LINE:
+  return SWR_FILLMODE_WIREFRAME;
+   case PIPE_POLYGON_MODE_POINT:
+  return SWR_FILLMODE_POINT;
+   default:
+  assert(0 && "Unknown fillmode");
+  return SWR_FILLMODE_SOLID; // at least do something sensible
+   }
+}
+
 #endif
--
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] swr: Fix polygonmode for front==back

2017-04-25 Thread Ilia Mirkin
This will cause asserts on piglit and dEQP runs instead of failures. This
is incredibly inconvenient, as e.g. dEQP runs everything in a single
process.

On Apr 25, 2017 7:29 PM, "George Kyriazis" 
wrote:

> Add logic for converting enums and also making sure stipple works.
>
> CC: 
>
> ---
>  src/gallium/drivers/swr/swr_state.cpp | 14 +-
>  src/gallium/drivers/swr/swr_state.h   | 20 
>  2 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/swr/swr_state.cpp
> b/src/gallium/drivers/swr/swr_state.cpp
> index 56b1374..24a6759 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -201,6 +201,12 @@ swr_create_rasterizer_state(struct pipe_context
> *pipe,
> struct pipe_rasterizer_state *state;
> state = (pipe_rasterizer_state *)mem_dup(rast, sizeof *rast);
>
> +   if (state) {
> +  if (state->fill_front != state->fill_back) {
> + assert(0 && "front != back polygon mode not supported");
> +  }
> +   }
> +
> return state;
>  }
>
> @@ -1153,6 +1159,10 @@ swr_update_derived(struct pipe_context *pipe,
>   rastState->slopeScaledDepthBias = 0;
>   rastState->depthBiasClamp = 0;
>}
> +
> +  /* translate polygon mode, at least for the front==back case */
> +  rastState->fillMode = swr_convert_fill_mode(
> rasterizer->fill_front);
> +
>struct pipe_surface *zb = fb->zsbuf;
>if (zb && swr_resource(zb->texture)->has_depth)
>   rastState->depthFormat = swr_resource(zb->texture)->swr.format;
> @@ -1423,7 +1433,9 @@ swr_update_derived(struct pipe_context *pipe,
> /* and points, since we rasterize them as triangles, too */
> /* Has to be before fragment shader, since it sets SWR_NEW_FS */
> if (p_draw_info) {
> -  bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) ==
> PIPE_PRIM_TRIANGLES);
> +  bool new_prim_is_poly =
> + (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES) &&
> + (ctx->derived.rastState.fillMode == SWR_FILLMODE_SOLID);
>if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) {
>   ctx->dirty |= SWR_NEW_FS;
>   ctx->poly_stipple.prim_is_poly = new_prim_is_poly;
> diff --git a/src/gallium/drivers/swr/swr_state.h
> b/src/gallium/drivers/swr/swr_state.h
> index 9a8c4e1..7940a96 100644
> --- a/src/gallium/drivers/swr/swr_state.h
> +++ b/src/gallium/drivers/swr/swr_state.h
> @@ -376,4 +376,24 @@ swr_convert_prim_topology(const unsigned mode)
>return TOP_UNKNOWN;
> }
>  };
> +
> +/*
> + * convert mesa PIPE_POLYGON_MODE_X to SWR enum SWR_FILLMODE
> + */
> +static INLINE enum SWR_FILLMODE
> +swr_convert_fill_mode(const unsigned mode)
> +{
> +   switch(mode) {
> +   case PIPE_POLYGON_MODE_FILL:
> +  return SWR_FILLMODE_SOLID;
> +   case PIPE_POLYGON_MODE_LINE:
> +  return SWR_FILLMODE_WIREFRAME;
> +   case PIPE_POLYGON_MODE_POINT:
> +  return SWR_FILLMODE_POINT;
> +   default:
> +  assert(0 && "Unknown fillmode");
> +  return SWR_FILLMODE_SOLID; // at least do something sensible
> +   }
> +}
> +
>  #endif
> --
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] swr: Fix polygonmode for front==back

2017-04-25 Thread George Kyriazis
Add logic for converting enums and also making sure stipple works.

CC: 

---
 src/gallium/drivers/swr/swr_state.cpp | 14 +-
 src/gallium/drivers/swr/swr_state.h   | 20 
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/swr_state.cpp 
b/src/gallium/drivers/swr/swr_state.cpp
index 56b1374..24a6759 100644
--- a/src/gallium/drivers/swr/swr_state.cpp
+++ b/src/gallium/drivers/swr/swr_state.cpp
@@ -201,6 +201,12 @@ swr_create_rasterizer_state(struct pipe_context *pipe,
struct pipe_rasterizer_state *state;
state = (pipe_rasterizer_state *)mem_dup(rast, sizeof *rast);
 
+   if (state) {
+  if (state->fill_front != state->fill_back) {
+ assert(0 && "front != back polygon mode not supported");
+  }
+   }
+
return state;
 }
 
@@ -1153,6 +1159,10 @@ swr_update_derived(struct pipe_context *pipe,
  rastState->slopeScaledDepthBias = 0;
  rastState->depthBiasClamp = 0;
   }
+
+  /* translate polygon mode, at least for the front==back case */
+  rastState->fillMode = swr_convert_fill_mode(rasterizer->fill_front);
+
   struct pipe_surface *zb = fb->zsbuf;
   if (zb && swr_resource(zb->texture)->has_depth)
  rastState->depthFormat = swr_resource(zb->texture)->swr.format;
@@ -1423,7 +1433,9 @@ swr_update_derived(struct pipe_context *pipe,
/* and points, since we rasterize them as triangles, too */
/* Has to be before fragment shader, since it sets SWR_NEW_FS */
if (p_draw_info) {
-  bool new_prim_is_poly = (u_reduced_prim(p_draw_info->mode) == 
PIPE_PRIM_TRIANGLES);
+  bool new_prim_is_poly =
+ (u_reduced_prim(p_draw_info->mode) == PIPE_PRIM_TRIANGLES) &&
+ (ctx->derived.rastState.fillMode == SWR_FILLMODE_SOLID);
   if (new_prim_is_poly != ctx->poly_stipple.prim_is_poly) {
  ctx->dirty |= SWR_NEW_FS;
  ctx->poly_stipple.prim_is_poly = new_prim_is_poly;
diff --git a/src/gallium/drivers/swr/swr_state.h 
b/src/gallium/drivers/swr/swr_state.h
index 9a8c4e1..7940a96 100644
--- a/src/gallium/drivers/swr/swr_state.h
+++ b/src/gallium/drivers/swr/swr_state.h
@@ -376,4 +376,24 @@ swr_convert_prim_topology(const unsigned mode)
   return TOP_UNKNOWN;
}
 };
+
+/*
+ * convert mesa PIPE_POLYGON_MODE_X to SWR enum SWR_FILLMODE
+ */
+static INLINE enum SWR_FILLMODE
+swr_convert_fill_mode(const unsigned mode)
+{
+   switch(mode) {
+   case PIPE_POLYGON_MODE_FILL:
+  return SWR_FILLMODE_SOLID;
+   case PIPE_POLYGON_MODE_LINE:
+  return SWR_FILLMODE_WIREFRAME;
+   case PIPE_POLYGON_MODE_POINT:
+  return SWR_FILLMODE_POINT;
+   default:
+  assert(0 && "Unknown fillmode");
+  return SWR_FILLMODE_SOLID; // at least do something sensible
+   }
+}
+
 #endif
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev