[Mesa-dev] [PATCH] mesa/main: TexImage2DMultisample needs to pass OpenGL3.3 conformance test.

2015-11-25 Thread Marius Predut
Open GL 3.3 reference document says:
samples must be in the range zero to GL_MAX_TEXTURE_SIZE - 1.
Open GL.4 clearly states:
An INVALID_VALUE error is generated if samples is zero.

Fixing the piglit test case gl-3.2-layered-rendering-framebuffertexture.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93100

Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/main/teximage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index d9453e3..69634ff 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5211,7 +5211,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint 
dims,
   return;
}
 
-   if (samples < 1) {
+   if (samples < 1 && ctx->API == API_OPENGL_CORE && ctx->Version >= 40) {
   _mesa_error(ctx, GL_INVALID_VALUE, "%s(samples < 1)", func);
   return;
}
-- 
1.9.1

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


[Mesa-dev] [PATCH] i915/aa: fixing anti-aliasing bug for thinnest width lines

2015-10-05 Thread Marius Predut
On PNV platform, for 1 pixel line thickness or less,
the general anti-aliasing algorithm gives up, and a garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the "thinnest" (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
2.8.4.1 Zero-Width (Cosmetic) Line Rasterization from volume 1f of the GEN3
docs.
The patch was tested on Intel Atom CPU N455.

This patch follow the same rules as patches fixing the
https://bugs.freedesktop.org/show_bug.cgi?id=28832
bug.

v1: Eduardo Lima Mitev:  Wrong indentation inside the if clause.
v2: Ian Romanick: comments fix.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90367

Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/drivers/dri/i915/i915_state.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 4c83073..897eb59 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -599,6 +599,21 @@ i915LineWidth(struct gl_context * ctx, GLfloat widthf)

width = (int) (widthf * 2);
width = CLAMP(width, 1, 0xf);
+
+   if (ctx->Line.Width < 1.5 || widthf < 1.5) {
+ /* For 1 pixel line thickness or less, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the "thinnest" (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * volume 1f of the GEN3 docs,
+  * 2.8.4.1 Zero-Width (Cosmetic) Line Rasterization. 
+  */
+  width = 0;
+   }
lis4 |= width << S4_LINE_WIDTH_SHIFT;
 
if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
-- 
1.9.1

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


[Mesa-dev] [PATCH v3] i915: fixing driver crashes if too few vertices are submitted

2015-09-11 Thread Marius Predut
Comparison with a signed expression and unsigned value
is converted to unsigned value, reason for minus value is interpreted
as a big unsigned value. For this case the "for" loop
is going into unexpected behavior.

v1: Brian Paul: code style fix.
v2: Ian Romanick: glDrawArrays(GL_QUADS, 0, (n * 4) + k) fail , k < 4.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 7be3954..f99d977 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -627,6 +627,13 @@ static void TAG(render_quads_verts)( struct gl_context 
*ctx,
   LOCAL_VARS;
   GLuint j;
 
+  /* Page 18 (page 32 of the PDF) of the OpenGL 2.1 spec says:
+   * The total number of vertices between Begin and End is 4n + k,
+   * where 0 ??? k ??? 3; if k is not zero, the final k vertices are  
ignored.
+   */
+  count = (count / 4) * 4;
+  if(count == 0) return;
+
   INIT(GL_TRIANGLES);
 
   for (j = start; j < count-3; j += 4) {
-- 
1.9.1

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


[Mesa-dev] [PATCH] i915: fixing driver crashes if too few vertices are submitted

2015-09-09 Thread Marius Predut
Comparison with a signed expression and unsigned value
is converted to unsigned value, reason for minus value is interpreted
as a big unsigned value. For this case the "for" loop
is going into unexpected behavior.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 7be3954..2ae33c0 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -627,6 +627,8 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
   LOCAL_VARS;
   GLuint j;
 
+  if(count%4 != 0) return;
+
   INIT(GL_TRIANGLES);
 
   for (j = start; j < count-3; j += 4) {
@@ -1248,7 +1250,7 @@ static GLboolean TAG(validate_render)( struct gl_context 
*ctx,
ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS();
 }
 else {
-   ok = HAVE_TRIANGLES; /* flatshading is ok. */
+   ok = HAVE_TRIANGLES && (count%4 == 0); /* flatshading is ok. */
 }
 break;
   default:
-- 
1.9.1

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


[Mesa-dev] [PATCH v1] i915: fixing driver crashes if too few vertices are submitted

2015-09-09 Thread Marius Predut
Comparison with a signed expression and unsigned value
is converted to unsigned value, reason for minus value is interpreted
as a big unsigned value. For this case the "for" loop
is going into unexpected behavior.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 7be3954..88ecc78 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -627,6 +627,8 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
   LOCAL_VARS;
   GLuint j;
 
+  if(count%4 != 0) return;
+
   INIT(GL_TRIANGLES);
 
   for (j = start; j < count-3; j += 4) {
@@ -1248,7 +1250,7 @@ static GLboolean TAG(validate_render)( struct gl_context 
*ctx,
ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS();
 }
 else {
-   ok = HAVE_TRIANGLES; /* flatshading is ok. */
+   ok = HAVE_TRIANGLES && (count%4 == 0); /* flatshading is ok. */
 }
 break;
   default:
-- 
1.9.1

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


[Mesa-dev] [PATCH v2] i915/aa: fixing anti-aliasing bug for thinnest width lines

2015-09-09 Thread Marius Predut
On PNV platform, for 1 pixel line thickness or less,
the general anti-aliasing algorithm gives up, and a garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the "thinnest" (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by bspec G45: Volume 2: 
3D/Media,
7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section.

This patch follow the same rules as patches fixing the
https://bugs.freedesktop.org/show_bug.cgi?id=28832
bug.

v1: Eduardo Lima Mitev:  Wrong indentation inside the if clause.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90367

Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/drivers/dri/i915/i915_state.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 4c83073..ebb4e9a 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -599,6 +599,21 @@ i915LineWidth(struct gl_context * ctx, GLfloat widthf)

width = (int) (widthf * 2);
width = CLAMP(width, 1, 0xf);
+
+   if (ctx->Line.Width < 1.5 || widthf < 1.5) {
+ /* For 1 pixel line thickness or less, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the "thinnest" (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * bspec G45: Volume 2: 3D/Media,
+  * 7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section
+  */
+  width = 0;
+   }
lis4 |= width << S4_LINE_WIDTH_SHIFT;
 
if (lis4 != i915->state.Ctx[I915_CTXREG_LIS4]) {
-- 
1.9.1

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


[Mesa-dev] [PATCH v2] i915: fixing driver crashes if too few vertices are submitted

2015-09-09 Thread Marius Predut
Comparison with a signed expression and unsigned value
is converted to unsigned value, reason for minus value is interpreted
as a big unsigned value. For this case the "for" loop
is going into unexpected behavior.

v1:Brian Paul: code style fix.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Signed-off-by: Marius Predut <marius.pre...@intel.com>
---
 src/mesa/tnl_dd/t_dd_dmatmp.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 7be3954..79de224 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -627,6 +627,9 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
   LOCAL_VARS;
   GLuint j;
 
+  if(count % 4 != 0)
+  return;
+
   INIT(GL_TRIANGLES);
 
   for (j = start; j < count-3; j += 4) {
@@ -1248,7 +1251,7 @@ static GLboolean TAG(validate_render)( struct gl_context 
*ctx,
ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS();
 }
 else {
-   ok = HAVE_TRIANGLES; /* flatshading is ok. */
+   ok = HAVE_TRIANGLES && (count % 4 == 0); /* flatshading is ok. */
 }
 break;
   default:
-- 
1.9.1

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


[Mesa-dev] [PATCH] i915/aa: fixing anti-aliasing bug for thinnest width lines

2015-07-30 Thread Marius Predut
On PNV platform, for 1 pixel line thickness or less,
the general anti-aliasing algorithm gives up, and a garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the thinnest (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
bspec G45: Volume 2: 3D/Media,
7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section.

This patch follow the same rules as patches fixing the
https://bugs.freedesktop.org/show_bug.cgi?id=28832
bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90367

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i915/i915_state.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 5f10b84..6cd342c 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -599,6 +599,21 @@ i915LineWidth(struct gl_context * ctx, GLfloat widthf)

width = (int) (widthf * 2);
width = CLAMP(width, 1, 0xf);
+
+   if (ctx-Line.Width  1.5 || widthf  1.5) {
+/* For 1 pixel line thickness or less, the general
+ * anti-aliasing algorithm gives up, and a garbage line is
+ * generated.  Setting a Line Width of 0.0 specifies the
+ * rasterization of the thinnest (one-pixel-wide),
+ * non-antialiased lines.
+ *
+ * Lines rendered with zero Line Width are rasterized using
+ * Grid Intersection Quantization rules as specified by
+ * bspec G45: Volume 2: 3D/Media,
+ * 7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section
+ */
+width = 0;
+   }
lis4 |= width  S4_LINE_WIDTH_SHIFT;
 
if (lis4 != i915-state.Ctx[I915_CTXREG_LIS4]) {
-- 
1.9.1

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


[Mesa-dev] [PATCH v5] i915/aa: fixing anti-aliasing bug for thinnest width lines

2015-05-29 Thread Marius Predut
On PNV platform, for 1 pixel line thickness or less,
the general anti-aliasing algorithm gives up, and a garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the thinnest (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
bspec G45: Volume 2: 3D/Media,
7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section.

This patch follow the same rules as patches fixing the
https://bugs.freedesktop.org/show_bug.cgi?id=28832
bug.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90367

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i915/i915_state.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
b/src/mesa/drivers/dri/i915/i915_state.c
index 5f10b84..6cd342c 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -599,6 +599,21 @@ i915LineWidth(struct gl_context * ctx, GLfloat widthf)

width = (int) (widthf * 2);
width = CLAMP(width, 1, 0xf);
+
+   if (ctx-Line.Width  1.5 || widthf  1.5) {
+/* For 1 pixel line thickness or less, the general
+ * anti-aliasing algorithm gives up, and a garbage line is
+ * generated.  Setting a Line Width of 0.0 specifies the
+ * rasterization of the thinnest (one-pixel-wide),
+ * non-antialiased lines.
+ *
+ * Lines rendered with zero Line Width are rasterized using
+ * Grid Intersection Quantization rules as specified by
+ * bspec G45: Volume 2: 3D/Media,
+ * 7.3.13.1 Zero-Width (Cosmetic) Line Rasterization section
+ */
+width = 0;
+   }
lis4 |= width  S4_LINE_WIDTH_SHIFT;
 
if (lis4 != i915-state.Ctx[I915_CTXREG_LIS4]) {
-- 
1.9.1

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


[Mesa-dev] [PATCH v5] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN6

2015-04-23 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization of
the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified
by bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

v2: Daniel Stone: Fix = used instead of == in an if-statement.
v3: Ian Romanick: Use ._Enabled flag insteed .Enabled.
Add code comments. re-word wrap the commit message.
Add a complete bugzillia list.
Improve the hardcoded values to produce better results.
v4: Matt Turner: typo fixes and adjust = 1.49 to become  1.5

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=9951
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27007
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60797
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15006

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen6_sf_state.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index ea5c47a..e445ce2 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -367,9 +367,25 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  /* Line width of 0 is not allowed when MSAA enabled */
+  if (ctx-Multisample._Enabled) {
+ if (line_width_u3_7 == 0)
+ line_width_u3_7 = 1;
+  } else if (ctx-Line.SmoothFlag  ctx-Line.Width  1.5) {
+ /* For 1 pixel line thickness or less, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the thinnest (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * bspec section 6.3.12.1 Zero-Width (Cosmetic) Line
+  * Rasterization.
+  */
+ line_width_u3_7 = 0;
+  }
   dw3 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.9.1

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


[Mesa-dev] [PATCH v5] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN7

2015-04-23 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization of
the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified
by bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

v2: Daniel Stone: Fix = used instead of == in an if-statement.
v3: Ian Romanick: Use ._Enabled flag insteed .Enabled.
Add code comments. re-word wrap the commit message.
Add a complete bugzillia list.
Improve the hardcoded values to produce better results.
v4: Matt Turner: typo fixes and adjust = 1.49 to become  1.5

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=9951
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27007
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60797
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15006

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen7_sf_state.c | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index 69853e6..58e3337 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -198,9 +198,24 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+  /* Line width of 0 is not allowed when MSAA enabled */
+  if (ctx-Multisample._Enabled) {
+ if (line_width_u3_7 == 0)
+ line_width_u3_7 = 1;
+  } else if (ctx-Line.SmoothFlag  ctx-Line.Width  1.5) {
+ /* For 1 pixel line thickness or less, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the thinnest (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * bspec section 6.3.12.1 Zero-Width (Cosmetic) Line
+  * Rasterization.
+  */
+ line_width_u3_7 = 0;
+  }
   dw2 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.9.1

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


[Mesa-dev] [PATCH] radeon: replace __FUNCTION__ with __func__

2015-04-16 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/r200/r200_blit.c  |2 +-
 src/mesa/drivers/dri/r200/r200_cmdbuf.c|   10 +++
 src/mesa/drivers/dri/r200/r200_ioctl.c |2 +-
 src/mesa/drivers/dri/r200/r200_sanity.c|2 +-
 src/mesa/drivers/dri/r200/r200_state.c |   22 +++
 src/mesa/drivers/dri/r200/r200_state.h |2 +-
 src/mesa/drivers/dri/r200/r200_swtcl.c |2 +-
 src/mesa/drivers/dri/r200/r200_tcl.c   |4 +--
 src/mesa/drivers/dri/r200/r200_tex.c   |   14 +-
 src/mesa/drivers/dri/r200/r200_texstate.c  |6 ++---
 src/mesa/drivers/dri/r200/r200_vertprog.c  |   16 +--
 src/mesa/drivers/dri/radeon/radeon_blit.c  |2 +-
 src/mesa/drivers/dri/radeon/radeon_cmdbuf.h|6 ++---
 src/mesa/drivers/dri/radeon/radeon_common.c|   12 -
 .../drivers/dri/radeon/radeon_common_context.c |   10 +++
 src/mesa/drivers/dri/radeon/radeon_debug.h |2 +-
 src/mesa/drivers/dri/radeon/radeon_dma.c   |   28 ++--
 src/mesa/drivers/dri/radeon/radeon_fbo.c   |2 +-
 src/mesa/drivers/dri/radeon/radeon_ioctl.c |   14 +-
 src/mesa/drivers/dri/radeon/radeon_maos_arrays.c   |8 +++---
 src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h|2 +-
 src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c   |6 ++---
 src/mesa/drivers/dri/radeon/radeon_queryobj.c  |   16 +--
 src/mesa/drivers/dri/radeon/radeon_screen.c|2 +-
 src/mesa/drivers/dri/radeon/radeon_state.c |   12 -
 src/mesa/drivers/dri/radeon/radeon_state.h |2 +-
 src/mesa/drivers/dri/radeon/radeon_swtcl.c |4 +--
 src/mesa/drivers/dri/radeon/radeon_tcl.c   |4 +--
 src/mesa/drivers/dri/radeon/radeon_tex.c   |   10 +++
 src/mesa/drivers/dri/radeon/radeon_tex_copy.c  |2 +-
 src/mesa/drivers/dri/radeon/radeon_texstate.c  |4 +--
 src/mesa/drivers/dri/radeon/radeon_texture.c   |2 +-
 32 files changed, 116 insertions(+), 116 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_blit.c 
b/src/mesa/drivers/dri/r200/r200_blit.c
index a33f338..3adc694 100644
--- a/src/mesa/drivers/dri/r200/r200_blit.c
+++ b/src/mesa/drivers/dri/r200/r200_blit.c
@@ -527,7 +527,7 @@ unsigned r200_blit(struct gl_context *ctx,
 /* Flush is needed to make sure that source buffer has correct data */
 radeonFlush(r200-radeon.glCtx);
 
-rcommonEnsureCmdBufSpace(r200-radeon, 102, __FUNCTION__);
+rcommonEnsureCmdBufSpace(r200-radeon, 102, __func__);
 
 if (!validate_buffers(r200, src_bo, dst_bo))
 return GL_FALSE;
diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c 
b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
index 13ac5af..83846d6 100644
--- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c
+++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c
@@ -124,7 +124,7 @@ void r200EmitVbufPrim( r200ContextPtr rmesa,
radeonEmitState(rmesa-radeon);

radeon_print(RADEON_RENDER|RADEON_SWRENDER,RADEON_VERBOSE,
-   %s cmd_used/4: %d prim %x nr %d\n, __FUNCTION__,
+   %s cmd_used/4: %d prim %x nr %d\n, __func__,
rmesa-store.cmd_used/4, primitive, vertex_nr);
  
BEGIN_BATCH(3);
@@ -162,7 +162,7 @@ void r200FlushElts(struct gl_context *ctx)
r200ContextPtr rmesa = R200_CONTEXT(ctx);
int nr, elt_used = rmesa-tcl.elt_used;
 
-   radeon_print(RADEON_RENDER, RADEON_VERBOSE, %s %x %d\n, __FUNCTION__, 
rmesa-tcl.hw_primitive, elt_used);
+   radeon_print(RADEON_RENDER, RADEON_VERBOSE, %s %x %d\n, __func__, 
rmesa-tcl.hw_primitive, elt_used);
 
assert( rmesa-radeon.dma.flush == r200FlushElts );
rmesa-radeon.dma.flush = NULL;
@@ -187,7 +187,7 @@ GLushort *r200AllocEltsOpenEnded( r200ContextPtr rmesa,
 {
GLushort *retval;
 
-   radeon_print(RADEON_RENDER, RADEON_VERBOSE, %s %d prim %x\n, 
__FUNCTION__, min_nr, primitive);
+   radeon_print(RADEON_RENDER, RADEON_VERBOSE, %s %d prim %x\n, __func__, 
min_nr, primitive);
 
assert((primitive  R200_VF_PRIM_WALK_IND));

@@ -225,7 +225,7 @@ void r200EmitVertexAOS( r200ContextPtr rmesa,
BATCH_LOCALS(rmesa-radeon);
 
radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, %s:  vertex_size 0x%x offset 
0x%x \n,
- __FUNCTION__, vertex_size, offset);
+ __func__, vertex_size, offset);
 
 
BEGIN_BATCH(7);
@@ -245,7 +245,7 @@ void r200EmitAOS(r200ContextPtr rmesa, GLuint nr, GLuint 
offset)

radeon_print(RADEON_RENDER, RADEON_VERBOSE,
%s: nr=%d, ofs=0x%08x\n,
-   __FUNCTION__, nr, offset);
+   __func__, nr, offset);
 
BEGIN_BATCH(sz+2+ (nr*2));
OUT_BATCH_PACKET3(R200_CP_CMD_3D_LOAD_VBPNTR, sz - 1);
diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c 
b/src/mesa/drivers/dri

[Mesa-dev] [PATCH] main: remove __FUNCTION__ defined because it is obsolete

2015-04-16 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
No functional changes.
Apply this patch after radeon: replace __FUNCTION__ with __func__ patch.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/compiler.h |5 -
 1 file changed, 5 deletions(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 55152fd..93b4e6f 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -60,11 +60,6 @@ extern C {
 #endif
 
 
-/* XXX: Use standard `__func__` instead */
-#ifndef __FUNCTION__
-#  define __FUNCTION__ __func__
-#endif
-
 /**
  * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
  * Do not use these unless absolutely necessary!
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] swrast: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/swrast/s_linetemp.h |4 ++--
 src/mesa/swrast/s_span.c |2 +-
 src/mesa/swrast/s_tritemp.h  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 352c884..035a1e6 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -106,7 +106,7 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const 
SWvertex *vert1 )
}
 
/*
-   printf(%s():\n, __FUNCTION__);
+   printf(%s():\n, __func__);
printf( (%f, %f, %f) - (%f, %f, %f)\n,
   vert0-attrib[VARYING_SLOT_POS][0],
   vert0-attrib[VARYING_SLOT_POS][1],
@@ -154,7 +154,7 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const 
SWvertex *vert1 )
   return;
 
/*
-   printf(%s %d,%d  %g %g %g %g  %g %g %g %g\n, __FUNCTION__, dx, dy,
+   printf(%s %d,%d  %g %g %g %g  %g %g %g %g\n, __func__, dx, dy,
   vert0-attrib[VARYING_SLOT_COL1][0],
   vert0-attrib[VARYING_SLOT_COL1][1],
   vert0-attrib[VARYING_SLOT_COL1][2],
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index e304b6b..7bb5712 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1144,7 +1144,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan 
*span)
struct gl_framebuffer *fb = ctx-DrawBuffer;
 
/*
-   printf(%s()  interp 0x%x  array 0x%x\n, __FUNCTION__,
+   printf(%s()  interp 0x%x  array 0x%x\n, __func__,
   span-interpMask, span-arrayMask);
*/
 
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index fb73b2d..4b6d34c 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -156,7 +156,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0,
 #endif
 
/*
-   printf(%s()\n, __FUNCTION__);
+   printf(%s()\n, __func__);
printf(  %g, %g, %g\n,
   v0-attrib[VARYING_SLOT_POS][0],
   v0-attrib[VARYING_SLOT_POS][1],
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] i915: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i915/i830_state.c |   44 
 src/mesa/drivers/dri/i915/i830_texblend.c  |4 +--
 src/mesa/drivers/dri/i915/i830_texstate.c  |2 +-
 src/mesa/drivers/dri/i915/i915_program.c   |8 ++---
 src/mesa/drivers/dri/i915/i915_state.c |   26 +++---
 src/mesa/drivers/dri/i915/i915_tex_layout.c|4 +--
 src/mesa/drivers/dri/i915/i915_texstate.c  |2 +-
 src/mesa/drivers/dri/i915/i915_vtbl.c  |2 +-
 src/mesa/drivers/dri/i915/intel_blit.c |   10 +++---
 src/mesa/drivers/dri/i915/intel_clear.c|2 +-
 src/mesa/drivers/dri/i915/intel_context.c  |2 +-
 src/mesa/drivers/dri/i915/intel_fbo.c  |8 ++---
 src/mesa/drivers/dri/i915/intel_mipmap_tree.c  |   18 +-
 src/mesa/drivers/dri/i915/intel_pixel_bitmap.c |2 +-
 src/mesa/drivers/dri/i915/intel_pixel_copy.c   |6 ++--
 src/mesa/drivers/dri/i915/intel_pixel_read.c   |   12 +++
 src/mesa/drivers/dri/i915/intel_regions.c  |8 ++---
 src/mesa/drivers/dri/i915/intel_render.c   |2 +-
 src/mesa/drivers/dri/i915/intel_state.c|6 ++--
 src/mesa/drivers/dri/i915/intel_tex.c  |   10 +++---
 src/mesa/drivers/dri/i915/intel_tex_copy.c |4 +--
 src/mesa/drivers/dri/i915/intel_tex_image.c|   18 +-
 src/mesa/drivers/dri/i915/intel_tex_subimage.c |2 +-
 src/mesa/drivers/dri/i915/intel_tris.c |   12 +++
 24 files changed, 107 insertions(+), 107 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i830_state.c 
b/src/mesa/drivers/dri/i915/i830_state.c
index 3e379f3..13adf56 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -56,7 +56,7 @@ i830StencilFuncSeparate(struct gl_context * ctx, GLenum face, 
GLenum func, GLint
 
mask = mask  0xff;
 
-   DBG(%s : func: %s, ref : 0x%x, mask: 0x%x\n, __FUNCTION__,
+   DBG(%s : func: %s, ref : 0x%x, mask: 0x%x\n, __func__,
_mesa_lookup_enum_by_nr(func), ref, mask);
 
 
@@ -77,7 +77,7 @@ i830StencilMaskSeparate(struct gl_context * ctx, GLenum face, 
GLuint mask)
 {
struct i830_context *i830 = i830_context(ctx);
 
-   DBG(%s : mask 0x%x\n, __FUNCTION__, mask);
+   DBG(%s : mask 0x%x\n, __func__, mask);

mask = mask  0xff;
 
@@ -94,7 +94,7 @@ i830StencilOpSeparate(struct gl_context * ctx, GLenum face, 
GLenum fail, GLenum
struct i830_context *i830 = i830_context(ctx);
int fop, dfop, dpop;
 
-   DBG(%s: fail : %s, zfail: %s, zpass : %s\n, __FUNCTION__,
+   DBG(%s: fail : %s, zfail: %s, zpass : %s\n, __func__,
_mesa_lookup_enum_by_nr(fail),
_mesa_lookup_enum_by_nr(zfail), 
_mesa_lookup_enum_by_nr(zpass));
@@ -261,7 +261,7 @@ i830BlendColor(struct gl_context * ctx, const GLfloat 
color[4])
struct i830_context *i830 = i830_context(ctx);
GLubyte r, g, b, a;
 
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);

UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]);
UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]);
@@ -315,7 +315,7 @@ i830_set_blend_state(struct gl_context * ctx)
   break;
default:
   fprintf(stderr, [%s:%u] Invalid RGB blend equation (0x%04x).\n,
-  __FUNCTION__, __LINE__, ctx-Color.Blend[0].EquationRGB);
+  __func__, __LINE__, ctx-Color.Blend[0].EquationRGB);
   return;
}
 
@@ -343,7 +343,7 @@ i830_set_blend_state(struct gl_context * ctx)
   break;
default:
   fprintf(stderr, [%s:%u] Invalid alpha blend equation (0x%04x).\n,
-  __FUNCTION__, __LINE__, ctx-Color.Blend[0].EquationA);
+  __func__, __LINE__, ctx-Color.Blend[0].EquationA);
   return;
}
 
@@ -378,7 +378,7 @@ i830_set_blend_state(struct gl_context * ctx)
if (0) {
   fprintf(stderr,
   [%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n,
-  __FUNCTION__, __LINE__, i830-state.Ctx[I830_CTXREG_STATE1],
+  __func__, __LINE__, i830-state.Ctx[I830_CTXREG_STATE1],
   i830-state.Ctx[I830_CTXREG_IALPHAB],
   (ctx-Color.BlendEnabled) ? en : dis);
}
@@ -388,7 +388,7 @@ i830_set_blend_state(struct gl_context * ctx)
 static void
 i830BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum 
modeA)
 {
-   DBG(%s - %s, %s\n, __FUNCTION__,
+   DBG(%s - %s, %s\n, __func__,
_mesa_lookup_enum_by_nr(modeRGB),
_mesa_lookup_enum_by_nr(modeA));
 
@@ -402,7 +402,7 @@ static void
 i830BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB,
   GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA)
 {
-   DBG(%s - RGB(%s, %s) A(%s, %s)\n, __FUNCTION__,
+   DBG(%s - RGB

[Mesa-dev] [PATCH] glx: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/glx/apple/apple_glx_log.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/glx/apple/apple_glx_log.h b/src/glx/apple/apple_glx_log.h
index 4b1c531..b1a5538 100644
--- a/src/glx/apple/apple_glx_log.h
+++ b/src/glx/apple/apple_glx_log.h
@@ -39,14 +39,14 @@ __printflike(5, 6)
 void _apple_glx_log(int level, const char *file, const char *function,
 int line, const char *fmt, ...);
 #define apple_glx_log(l, f, args ...) \
-_apple_glx_log(l, __FILE__, __FUNCTION__, __LINE__, f, ## args)
+_apple_glx_log(l, __FILE__, __func__, __LINE__, f, ## args)
 
 
 __printflike(5, 0)
 void _apple_glx_vlog(int level, const char *file, const char *function,
  int line, const char *fmt, va_list v);
 #define apple_glx_vlog(l, f, v) \
-_apple_glx_vlog(l, __FILE__, __FUNCTION__, __LINE__, f, v)
+_apple_glx_vlog(l, __FILE__, __func__, __LINE__, f, v)
 
 /* This is just here to help the transition.
  * TODO: Replace calls to apple_glx_diagnostic
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] i965: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/common/utils.c|2 +-
 src/mesa/drivers/dri/i965/brw_blorp.cpp|2 +-
 src/mesa/drivers/dri/i965/brw_blorp_blit.cpp   |2 +-
 src/mesa/drivers/dri/i965/brw_context.c|4 +--
 src/mesa/drivers/dri/i965/brw_draw_upload.c|2 +-
 src/mesa/drivers/dri/i965/brw_state_cache.c|4 +--
 src/mesa/drivers/dri/i965/brw_tex_layout.c |2 +-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c   |2 +-
 src/mesa/drivers/dri/i965/gen6_surface_state.c |2 +-
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c  |2 +-
 src/mesa/drivers/dri/i965/gen8_surface_state.c |2 +-
 src/mesa/drivers/dri/i965/intel_blit.c |8 +++---
 src/mesa/drivers/dri/i965/intel_fbo.c  |8 +++---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c  |   30 ++--
 src/mesa/drivers/dri/i965/intel_pixel_bitmap.c |2 +-
 src/mesa/drivers/dri/i965/intel_pixel_copy.c   |6 ++--
 src/mesa/drivers/dri/i965/intel_pixel_draw.c   |   14 -
 src/mesa/drivers/dri/i965/intel_pixel_read.c   |8 +++---
 src/mesa/drivers/dri/i965/intel_screen.c   |4 +--
 src/mesa/drivers/dri/i965/intel_tex.c  |   10 +++
 src/mesa/drivers/dri/i965/intel_tex_copy.c |4 +--
 src/mesa/drivers/dri/i965/intel_tex_image.c|   16 +--
 src/mesa/drivers/dri/i965/intel_tex_subimage.c |6 ++--
 .../dri/i965/test_vec4_register_coalesce.cpp   |2 +-
 24 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index bb22107..70d34e8 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -227,7 +227,7 @@ driCreateConfigs(mesa_format format,
   break;
default:
   fprintf(stderr, [%s:%u] Unknown framebuffer type %s (%d).\n,
-  __FUNCTION__, __LINE__,
+  __func__, __LINE__,
   _mesa_get_format_name(format), format);
   return NULL;
}
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index df00b77..3b03f75 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -194,7 +194,7 @@ intel_hiz_exec(struct brw_context *brw, struct 
intel_mipmap_tree *mt,
}
 
DBG(%s %s to mt %p level %d layer %d\n,
-   __FUNCTION__, opname, mt, level, layer);
+   __func__, opname, mt, level, layer);
 
if (brw-gen = 8) {
   gen8_hiz_exec(brw, mt, level, layer, op);
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 644cb41..d25e201 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -78,7 +78,7 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
 
DBG(%s from %dx %s mt %p %d %d (%f,%f) (%f,%f)
to %dx %s mt %p %d %d (%f,%f) (%f,%f) (flip %d,%d)\n,
-   __FUNCTION__,
+   __func__,
src_mt-num_samples, _mesa_get_format_name(src_mt-format), src_mt,
src_level, src_layer, src_x0, src_y0, src_x1, src_y1,
dst_mt-num_samples, _mesa_get_format_name(dst_mt-format), dst_mt,
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index ed6fdff..a63d00b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -722,7 +722,7 @@ brwCreateContext(gl_api api,
 
struct brw_context *brw = rzalloc(NULL, struct brw_context);
if (!brw) {
-  fprintf(stderr, %s: failed to alloc context\n, __FUNCTION__);
+  fprintf(stderr, %s: failed to alloc context\n, __func__);
   *dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
   return false;
}
@@ -778,7 +778,7 @@ brwCreateContext(gl_api api,
 
if (!_mesa_initialize_context(ctx, api, mesaVis, shareCtx, functions)) {
   *dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
-  fprintf(stderr, %s: failed to init mesa context\n, __FUNCTION__);
+  fprintf(stderr, %s: failed to init mesa context\n, __func__);
   intelDestroyContext(driContextPriv);
   return false;
}
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 52dcb6f..623465f 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -413,7 +413,7 @@ brw_prepare_vertices(struct brw_context *brw)
}
 
if (0)
-  fprintf(stderr, %s %d..%d\n, __FUNCTION__, min_index, max_index);
+  fprintf(stderr, %s %d..%d\n, __func__

[Mesa-dev] [PATCH] main: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/atifragshader.c  |4 ++--
 src/mesa/main/ffvertex_prog.c  |6 +++---
 src/mesa/main/format_unpack.py |4 ++--
 src/mesa/main/glformats.c  |2 +-
 src/mesa/main/mtypes.h |2 +-
 src/mesa/main/state.c  |2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c
index 9d967b9..9fc3552 100644
--- a/src/mesa/main/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -476,7 +476,7 @@ _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum 
swizzle)
curI-swizzle = swizzle;
 
 #if MESA_DEBUG_ATI_FS
-   _mesa_debug(ctx, %s(%s, %s, %s)\n, __FUNCTION__,
+   _mesa_debug(ctx, %s(%s, %s, %s)\n, __func__,
   _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(coord),
   _mesa_lookup_enum_by_nr(swizzle));
 #endif
@@ -549,7 +549,7 @@ _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum 
swizzle)
curI-swizzle = swizzle;
 
 #if MESA_DEBUG_ATI_FS
-   _mesa_debug(ctx, %s(%s, %s, %s)\n, __FUNCTION__,
+   _mesa_debug(ctx, %s(%s, %s, %s)\n, __func__,
   _mesa_lookup_enum_by_nr(dst), _mesa_lookup_enum_by_nr(interp),
   _mesa_lookup_enum_by_nr(swizzle));
 #endif
diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
index 395b00e..edf7e33 100644
--- a/src/mesa/main/ffvertex_prog.c
+++ b/src/mesa/main/ffvertex_prog.c
@@ -619,13 +619,13 @@ static void emit_op3fn(struct tnl_program *p,
 
 
 #define emit_op3(p, op, dst, mask, src0, src1, src2) \
-   emit_op3fn(p, op, dst, mask, src0, src1, src2, __FUNCTION__, __LINE__)
+   emit_op3fn(p, op, dst, mask, src0, src1, src2, __func__, __LINE__)
 
 #define emit_op2(p, op, dst, mask, src0, src1) \
-emit_op3fn(p, op, dst, mask, src0, src1, undef, __FUNCTION__, __LINE__)
+emit_op3fn(p, op, dst, mask, src0, src1, undef, __func__, __LINE__)
 
 #define emit_op1(p, op, dst, mask, src0) \
-emit_op3fn(p, op, dst, mask, src0, undef, undef, __FUNCTION__, __LINE__)
+emit_op3fn(p, op, dst, mask, src0, undef, undef, __func__, __LINE__)
 
 
 static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py
index 53bdf64..9917548 100644
--- a/src/mesa/main/format_unpack.py
+++ b/src/mesa/main/format_unpack.py
@@ -333,7 +333,7 @@ _mesa_unpack_rgba_row(mesa_format format, GLuint n,
   unpack_float_ycbcr_rev(src, dst, n);
   break;
default:
-  _mesa_problem(NULL, %s: bad format %s, __FUNCTION__,
+  _mesa_problem(NULL, %s: bad format %s, __func__,
 _mesa_get_format_name(format));
   return;
}
@@ -402,7 +402,7 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n,
   break;
 %endfor
default:
-  _mesa_problem(NULL, %s: bad format %s, __FUNCTION__,
+  _mesa_problem(NULL, %s: bad format %s, __func__,
 _mesa_get_format_name(format));
   return;
}
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 4e05229..8ced579 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1393,7 +1393,7 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum 
pname)
   return GL_FALSE;
default:
   _mesa_warning(NULL, %s: Unexpected channel token 0x%x\n,
-   __FUNCTION__, pname);
+   __func__, pname);
   return GL_FALSE;
}
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 8e1dba6..ab74489 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4523,7 +4523,7 @@ struct gl_context
 #ifdef DEBUG
 extern int MESA_VERBOSE;
 extern int MESA_DEBUG_FLAGS;
-# define MESA_FUNCTION __FUNCTION__
+# define MESA_FUNCTION __func__
 #else
 # define MESA_VERBOSE 0
 # define MESA_DEBUG_FLAGS 0
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index dadfb3c..ccf83d7 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -507,7 +507,7 @@ _mesa_set_varying_vp_inputs( struct gl_context *ctx,
   ctx-FragmentProgram._TexEnvProgram) {
  ctx-NewState |= _NEW_VARYING_VP_INPUTS;
   }
-  /*printf(%s %x\n, __FUNCTION__, varying_inputs);*/
+  /*printf(%s %x\n, __func__, varying_inputs);*/
}
 }
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] state_tracker: replace __FUNCTION__ with __func__

2015-04-07 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/state_tracker/st_atom.c   |2 +-
 src/mesa/state_tracker/st_atom_constbuf.c  |2 +-
 src/mesa/state_tracker/st_cb_clear.c   |2 +-
 src/mesa/state_tracker/st_cb_texture.c |   18 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |2 +-
 src/mesa/state_tracker/st_mesa_to_tgsi.c   |2 +-
 src/mesa/state_tracker/st_program.c|2 +-
 src/mesa/state_tracker/st_texture.c|6 +++---
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index f0fe11f..428f2d9 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -183,7 +183,7 @@ void st_validate_state( struct st_context *st )
if (state-st == 0)
   return;
 
-   /*printf(%s %x/%x\n, __FUNCTION__, state-mesa, state-st);*/
+   /*printf(%s %x/%x\n, __func__, state-mesa, state-st);*/
 
 #ifdef DEBUG
if (1) {
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c 
b/src/mesa/state_tracker/st_atom_constbuf.c
index 7984bf7..a54e0d9 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -92,7 +92,7 @@ void st_upload_constants( struct st_context *st,
 
   if (ST_DEBUG  DEBUG_CONSTANTS) {
  debug_printf(%s(shader=%d, numParams=%d, stateFlags=0x%x)\n,
-  __FUNCTION__, shader_type, params-NumParameters,
+  __func__, shader_type, params-NumParameters,
   params-StateFlags);
  _mesa_print_parameter_list(params);
   }
diff --git a/src/mesa/state_tracker/st_cb_clear.c 
b/src/mesa/state_tracker/st_cb_clear.c
index dd81a62..f10e906 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -247,7 +247,7 @@ clear_with_quad(struct gl_context *ctx, unsigned 
clear_buffers)
   util_framebuffer_get_num_layers(st-state.framebuffer);
 
/*
-   printf(%s %s%s%s %f,%f %f,%f\n, __FUNCTION__, 
+   printf(%s %s%s%s %f,%f %f,%f\n, __func__,
  color ? color,  : ,
  depth ? depth,  : ,
  stencil ? stencil : ,
diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 5c520b4..6b35d61 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -123,7 +123,7 @@ gl_target_to_pipe(GLenum target)
 static struct gl_texture_image *
 st_NewTextureImage(struct gl_context * ctx)
 {
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);
(void) ctx;
return (struct gl_texture_image *) ST_CALLOC_STRUCT(st_texture_image);
 }
@@ -144,7 +144,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, 
GLenum target)
 {
struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object);
 
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);
_mesa_initialize_texture_object(ctx, obj-base, name, target);
 
return obj-base;
@@ -172,7 +172,7 @@ st_FreeTextureImageBuffer(struct gl_context *ctx,
 {
struct st_texture_image *stImage = st_texture_image(texImage);
 
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);
 
if (stImage-pt) {
   pipe_resource_reference(stImage-pt, NULL);
@@ -405,7 +405,7 @@ guess_and_alloc_texture(struct st_context *st,
GLuint ptWidth, ptHeight, ptDepth, ptLayers;
enum pipe_format fmt;
 
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);
 
assert(!stObj-pt);
 
@@ -473,7 +473,7 @@ guess_and_alloc_texture(struct st_context *st,
 
stObj-lastLevel = lastLevel;
 
-   DBG(%s returning %d\n, __FUNCTION__, (stObj-pt != NULL));
+   DBG(%s returning %d\n, __func__, (stObj-pt != NULL));
 
return stObj-pt != NULL;
 }
@@ -496,7 +496,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
GLuint height = texImage-Height;
GLuint depth = texImage-Depth;
 
-   DBG(%s\n, __FUNCTION__);
+   DBG(%s\n, __func__);
 
assert(!stImage-pt); /* xxx this might be wrong */
 
@@ -1148,7 +1148,7 @@ st_GetTexImage(struct gl_context * ctx,
   }
 
   if (ST_DEBUG  DEBUG_FALLBACK)
- debug_printf(%s: fallback format translation\n, __FUNCTION__);
+ debug_printf(%s: fallback format translation\n, __func__);
 
   dstMesaFormat = _mesa_format_from_format_and_type(format, type);
   dstStride = _mesa_image_row_stride(ctx-Pack, width, format, type);
@@ -1234,7 +1234,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
struct pipe_transfer *transfer;
 
if (ST_DEBUG  DEBUG_FALLBACK)
-  debug_printf(%s: fallback processing\n, __FUNCTION__);
+  debug_printf(%s: fallback processing\n, __func__);
 
if (st_fb_orientation(ctx-ReadBuffer) == Y_0_TOP

[Mesa-dev] [PATCH] tnl: replace __FUNCTION__ with __func__

2015-04-03 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/tnl_dd/t_dd_dmatmp.h   |   34 +-
 src/mesa/tnl_dd/t_dd_dmatmp2.h  |   22 +++---
 src/mesa/tnl_dd/t_dd_triemit.h  |8 
 src/mesa/tnl_dd/t_dd_tritmp.h   |2 +-
 src/mesa/tnl_dd/t_dd_unfilled.h |2 +-
 5 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index 52ea2bf..667e2a6 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -128,7 +128,7 @@ static void TAG(render_points_verts)( struct gl_context 
*ctx,
   }
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -163,7 +163,7 @@ static void TAG(render_lines_verts)( struct gl_context *ctx,
   }
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -195,7 +195,7 @@ static void TAG(render_line_strip_verts)( struct gl_context 
*ctx,
   FLUSH();
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -261,7 +261,7 @@ static void TAG(render_line_loop_verts)( struct gl_context 
*ctx,
   FLUSH();
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -331,7 +331,7 @@ static void TAG(render_tri_strip_verts)( struct gl_context 
*ctx,
   FLUSH();
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -370,7 +370,7 @@ static void TAG(render_tri_fan_verts)( struct gl_context 
*ctx,
   /* Could write code to emit these as indexed vertices (for the
* g400, for instance).
*/
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -409,7 +409,7 @@ static void TAG(render_poly_verts)( struct gl_context *ctx,
else if (HAVE_TRI_FANS  ctx-Light.ShadeModel == GL_SMOOTH) {
   TAG(render_tri_fan_verts)( ctx, start, count, flags );
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -500,7 +500,7 @@ static void TAG(render_quad_strip_verts)( struct gl_context 
*ctx,
 /* Vertices won't fit in a single buffer or elts not
  * available - should never happen.
  */
-fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+fprintf(stderr, %s - cannot draw primitive\n, __func__);
 return;
   }
}
@@ -534,7 +534,7 @@ static void TAG(render_quad_strip_verts)( struct gl_context 
*ctx,
   FLUSH();
 
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -644,7 +644,7 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
else {
   /* Vertices won't fit in a single buffer, should never happen.
*/
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -705,7 +705,7 @@ static void TAG(render_points_elts)( struct gl_context *ctx,
 currentsz = dmasz;
   }
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -743,7 +743,7 @@ static void TAG(render_lines_elts)( struct gl_context *ctx,
 currentsz = dmasz;
   }
} else {
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -777,7 +777,7 @@ static void TAG(render_line_strip_elts)( struct gl_context 
*ctx,
} else {
   /* TODO: Try to emit as indexed lines.
*/
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot draw primitive\n, __func__);
   return;
}
 }
@@ -845,7 +845,7 @@ static void TAG(render_line_loop_elts)( struct gl_context 
*ctx,
   FLUSH();
} else {
   /* TODO: Try to emit as indexed lines */
-  fprintf(stderr, %s - cannot draw primitive\n, __FUNCTION__);
+  fprintf(stderr, %s - cannot

[Mesa-dev] [PATCH] vbo: replace __FUNCTION__ with __func__

2015-04-03 Thread Marius Predut
Consistently just use C99's __func__ everywhere.
The patch was verified with Microsoft Visual studio 2013
redistributable package(RTM version number: 18.0.21005.1)
Next MSVC versions intends to support __func__.
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/vbo/vbo_exec_api.c  |2 +-
 src/mesa/vbo/vbo_exec_draw.c |4 ++--
 src/mesa/vbo/vbo_rebase.c|2 +-
 src/mesa/vbo/vbo_save_api.c  |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 02741c2..859078f 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -439,7 +439,7 @@ do {
\
 } while (0)
 
 
-#define ERROR(err) _mesa_error( ctx, err, __FUNCTION__ )
+#define ERROR(err) _mesa_error( ctx, err, __func__ )
 #define TAG(x) vbo_##x
 
 #include vbo_attrib_tmp.h
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 91f2ca4..37b53a8 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -45,7 +45,7 @@ vbo_exec_debug_verts( struct vbo_exec_context *exec )
GLuint i;
 
printf(%s: %u vertices %d primitives, %d vertsize\n,
- __FUNCTION__,
+ __func__,
  count,
  exec-vtx.prim_count,
  exec-vtx.vertex_size);
@@ -402,7 +402,7 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean 
keepUnmapped)
  }
 
  if (0)
-printf(%s %d %d\n, __FUNCTION__, exec-vtx.prim_count,
+printf(%s %d %d\n, __func__, exec-vtx.prim_count,
   exec-vtx.vert_count);
 
 vbo_context(ctx)-draw_prims( ctx, 
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index b06df4a..c3c4b64 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -142,7 +142,7 @@ void vbo_rebase_prims( struct gl_context *ctx,
assert(min_index != 0);
 
if (0)
-  printf(%s %d..%d\n, __FUNCTION__, min_index, max_index);
+  printf(%s %d..%d\n, __func__, min_index, max_index);
 
 
/* XXX this path is disabled for now.
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index fd9a5de..5927bee 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -763,7 +763,7 @@ _save_reset_vertex(struct gl_context *ctx)
 
 
 
-#define ERROR(err)   _mesa_compile_error(ctx, err, __FUNCTION__);
+#define ERROR(err)   _mesa_compile_error(ctx, err, __func__);
 
 
 /* Only one size for each attribute may be active at once.  Eg. if
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v4] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN7

2015-03-19 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization of
the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified
by bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

v2: Daniel Stone: Fix = used instead of == in an if-statement.
v3: Ian Romanick: Use ._Enabled flag insteed .Enabled.
Add code comments. re-word wrap the commit message.
Add a complete bugzillia list.
Improve the hardcoded values to produce better results.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=9951
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27007
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60797
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15006

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen7_sf_state.c |   21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index c9815b0..e33cb79 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -198,9 +198,24 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+  /* Line width of 0 is not allowed when MSAA enabled */
+  if (ctx-Multisample._Enabled) {
+ if (line_width_u3_7 == 0)
+ line_width_u3_7 = 1;
+  } else if (ctx-Line.SmoothFlag  ctx-Line.Width = 1.49) {
+ /* For lines less than 1 pixel thick, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the thinnest (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * bspec section 6.3.12.1 Zero-Width (Cosmetic) Line
+  * Rasterization.
+  */
+ line_width_u3_7 = 0;
+  }
   dw2 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v4] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN6

2015-03-19 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization of
the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified
by bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

v2: Daniel Stone: Fix = used instead of == in an if-statement.
v3: Ian Romanick: Use ._Enabled flag insteed .Enabled.
Add code comments. re-word wrap the commit message.
Add a complete bugzillia list.
Improve the hardcoded values to produce better results.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=9951
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27007
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60797
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15006

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen6_sf_state.c |   22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index f9d8d27..91b46d9 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -367,9 +367,25 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  /* Line width of 0 is not allowed when MSAA enabled */
+  if (ctx-Multisample._Enabled) {
+ if (line_width_u3_7 == 0)
+ line_width_u3_7 = 1;
+  } else if (ctx-Line.SmoothFlag  ctx-Line.Width = 1.49) {
+ /* For lines less than 1 pixel thick, the general
+  * anti-aliasing algorithm gives up, and a garbage line is
+  * generated.  Setting a Line Width of 0.0 specifies the
+  * rasterization of the thinnest (one-pixel-wide),
+  * non-antialiased lines.
+  *
+  * Lines rendered with zero Line Width are rasterized using
+  * Grid Intersection Quantization rules as specified by
+  * bspec section 6.3.12.1 Zero-Width (Cosmetic) Line
+  * Rasterization.
+  */
+ line_width_u3_7 = 0;
+  }
   dw3 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN7

2015-03-17 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Signed-off-by: Marius Predut marius.pre...@intel.com
Signed-off-by: Marius Predut Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen7_sf_state.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index c9815b0..38b4f2f 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -198,9 +198,15 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  if (!(multisampled_fbo  ctx-Multisample.Enabled)) {
+ if (ctx-Line.SmoothFlag  ctx-Line.Width = 1)
+line_width_u3_7 = 0;
+  } else {
+  if (line_width_u3_7 == 0)
+ line_width_u3_7 = 1;
+  }
+
   dw2 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN6

2015-03-17 Thread Marius Predut
On SNB and IVB hw, for 1 pixel line thickness or less, the general 
anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization of the “thinnest” 
(one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using Grid Intersection 
Quantization rules as specified by bspec section 6.3.12.1 Zero-Width (Cosmetic) 
Line Rasterization.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen6_sf_state.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index f9d8d27..1bed444 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -367,9 +367,15 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  if (!(multisampled_fbo  ctx-Multisample.Enabled)) {
+if (ctx-Line.SmoothFlag  ctx-Line.Width =1)
+  line_width_u3_7 = 0;
+  } else {
+if (line_width_u3_7 == 0)
+line_width_u3_7 = 1;
+  }
+
   dw3 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH ] i965/aa: fixing anti-aliasing bug for thinnest width lines - GEN7

2015-03-17 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28832
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen7_sf_state.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c 
b/src/mesa/drivers/dri/i965/gen7_sf_state.c
index c9815b0..fbad889 100644
--- a/src/mesa/drivers/dri/i965/gen7_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c
@@ -198,9 +198,15 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  if (!(multisampled_fbo  ctx-Multisample.Enabled)) {
+ if (ctx-Line.SmoothFlag  ctx-Line.Width = 1 )
+line_width_u3_7 = 0;
+  } else {
+  if (line_width_u3_7 = 0)
+ line_width_u3_7 = 1;
+  }
+
   dw2 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v1] vbo: improve the code style by adjust the preprocessing c code directives

2015-03-11 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

Brian Paul review suggestion: there's more macro use here than necessary.
Removed and redefine some #define preprocessing directives.
Removed the directive input parameter 'T' .
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
Reviewed-by: Brian Paul bri...@vmware.com
---
 src/mesa/vbo/vbo_attrib_tmp.h |   74 ++---
 src/mesa/vbo/vbo_exec_api.c   |2 +-
 2 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index b1c3d98..17e0578 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -30,35 +30,30 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 /* ATTR */
-#define ATTR( A, N, T, V0, V1, V2, V3 ) \
-ATTR_##T((A), (N), (T), (V0), (V1), (V2), (V3))
-
-#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
-UINT_AS_UNION(V2), UINT_AS_UNION(V3))
-#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, INT_AS_UNION(V0), INT_AS_UNION(V1), \
+#define ATTRI( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_INT, INT_AS_UNION(V0), INT_AS_UNION(V1), \
 INT_AS_UNION(V2), INT_AS_UNION(V3))
-#define ATTR_GL_FLOAT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1),\
+#define ATTRUI( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_UNSIGNED_INT, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
+UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTRF( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_FLOAT, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1),\
 FLOAT_AS_UNION(V2), FLOAT_AS_UNION(V3))
 
 
 /* float */
-#define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
-#define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
-#define ATTR3FV( A, V ) ATTR( A, 3, GL_FLOAT, (V)[0], (V)[1], (V)[2], 1 )
-#define ATTR4FV( A, V ) ATTR( A, 4, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
+#define ATTR1FV( A, V ) ATTRF( A, 1, (V)[0], 0, 0, 1 )
+#define ATTR2FV( A, V ) ATTRF( A, 2, (V)[0], (V)[1], 0, 1 )
+#define ATTR3FV( A, V ) ATTRF( A, 3, (V)[0], (V)[1], (V)[2], 1 )
+#define ATTR4FV( A, V ) ATTRF( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
 
-#define ATTR1F( A, X )  ATTR( A, 1, GL_FLOAT, X, 0, 0, 1 )
-#define ATTR2F( A, X, Y )   ATTR( A, 2, GL_FLOAT, X, Y, 0, 1 )
-#define ATTR3F( A, X, Y, Z )ATTR( A, 3, GL_FLOAT, X, Y, Z, 1 )
-#define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, GL_FLOAT, X, Y, Z, W )
+#define ATTR1F( A, X )  ATTRF( A, 1, X, 0, 0, 1 )
+#define ATTR2F( A, X, Y )   ATTRF( A, 2, X, Y, 0, 1 )
+#define ATTR3F( A, X, Y, Z )ATTRF( A, 3, X, Y, Z, 1 )
+#define ATTR4F( A, X, Y, Z, W ) ATTRF( A, 4, X, Y, Z, W )
 
-/* int */
-#define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
-   X, Y, Z, W )
 
+/* int */
 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
 #define ATTR4IV( A, V ) ATTRI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
@@ -70,9 +65,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 /* uint */
-#define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
-X, Y, Z, W )
-
 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
 #define ATTR4UIV( A, V ) ATTRUI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
@@ -82,7 +74,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define ATTR3UI( A, X, Y, Z )ATTRUI( A, 3, X, Y, Z, 1 )
 #define ATTR4UI( A, X, Y, Z, W ) ATTRUI( A, 4, X, Y, Z, W )
 
-#define MAT_ATTR( A, N, V ) ATTR( A, N, GL_FLOAT, (V)[0], (V)[1], (V)[2], 
(V)[3] )
+#define MAT_ATTR( A, N, V ) ATTRF( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
 
 static inline float conv_ui10_to_norm_float(unsigned ui10)
 {
@@ -94,20 +86,20 @@ static inline float conv_ui2_to_norm_float(unsigned ui2)
return ui2 / 3.0f;
 }
 
-#define ATTRUI10_1( A, UI ) ATTR( A, 1, GL_FLOAT, (UI)  0x3ff, 0, 0, 1 )
-#define ATTRUI10_2( A, UI ) ATTR( A, 2, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, 0, 1 )
-#define ATTRUI10_3( A, UI ) ATTR( A, 3, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, ((UI)  20)  0x3ff, 1 )
-#define ATTRUI10_4( A, UI ) ATTR( A, 4, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, ((UI)  20)  0x3ff, ((UI)  30)  0x3 )
+#define ATTRUI10_1( A, UI ) ATTRF( A, 1, (UI)  0x3ff, 0, 0, 1 )
+#define ATTRUI10_2( A, UI ) ATTRF( A, 2, (UI)  0x3ff, ((UI)  10)  0x3ff, 
0, 1 )
+#define ATTRUI10_3( A, UI ) ATTRF( A, 3, (UI)  0x3ff, ((UI)  10)  0x3ff, 
((UI)  20)  0x3ff, 1 )
+#define ATTRUI10_4( A, UI ) ATTRF( A, 4, (UI)  0x3ff, ((UI)  10)  0x3ff, 
((UI)  20)  0x3ff, ((UI)  30)  0x3 )
 
-#define ATTRUI10N_1( A, UI ) ATTR( A, 1, GL_FLOAT, 
conv_ui10_to_norm_float((UI)  0x3ff), 0, 0, 1 )
-#define ATTRUI10N_2( A, UI ) ATTR( A, 2, GL_FLOAT, \
+#define

[Mesa-dev] [PATCH ] i965/aa: fixing anti-aliasing bug for thinnest width lines.

2015-03-11 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On SNB and IVB hw, for 1 pixel line thickness or less,
the general anti-aliasing algorithm give up - garbage line is generated.
Setting a Line Width of 0.0 specifies the rasterization
of the “thinnest” (one-pixel-wide), non-antialiased lines.
Lines rendered with zero Line Width are rasterized using
Grid Intersection Quantization rules as specified by
bspec section 6.3.12.1 Zero-Width (Cosmetic) Line Rasterization.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/drivers/dri/i965/gen6_sf_state.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index f9d8d27..1bed444 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -367,9 +367,15 @@ upload_sf_state(struct brw_context *brw)
   float line_width =
  roundf(CLAMP(ctx-Line.Width, 0.0, ctx-Const.MaxLineWidth));
   uint32_t line_width_u3_7 = U_FIXED(line_width, 7);
-  /* TODO: line width of 0 is not allowed when MSAA enabled */
-  if (line_width_u3_7 == 0)
- line_width_u3_7 = 1;
+
+  if (!(multisampled_fbo  ctx-Multisample.Enabled)) {
+if (ctx-Line.SmoothFlag  ctx-Line.Width =1)
+  line_width_u3_7 = 0;
+  } else {
+if (line_width_u3_7 == 0)
+line_width_u3_7 = 1;
+  }
+
   dw3 |= line_width_u3_7  GEN6_SF_LINE_WIDTH_SHIFT;
}
if (ctx-Line.SmoothFlag) {
-- 
1.7.9.5

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


[Mesa-dev] [PATCH ] vbo: improve the code style by adjust the preprocessing c code directives.

2015-03-09 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

Brain Paul review suggestion: there's more macro use here than necessary.
Removed and redefine some #define preprocessing directives.
Removed the directive input parameter 'T' .
No functional changes.

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/vbo/vbo_attrib_tmp.h |   74 ++---
 src/mesa/vbo/vbo_exec_api.c   |2 +-
 2 files changed, 34 insertions(+), 42 deletions(-)

diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index 80e8aaf..348dd77 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -30,35 +30,30 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 /* ATTR */
-#define ATTR( A, N, T, V0, V1, V2, V3 ) \
-ATTR_##T((A), (N), (T), (V0), (V1), (V2), (V3))
-
-#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
-UINT_AS_UNION(V2), UINT_AS_UNION(V3))
-#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, INT_AS_UNION(V0), INT_AS_UNION(V1), \
+#define ATTRI( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_INT, INT_AS_UNION(V0), INT_AS_UNION(V1), \
 INT_AS_UNION(V2), INT_AS_UNION(V3))
-#define ATTR_GL_FLOAT( A, N, T, V0, V1, V2, V3 ) \
-ATTR_UNION(A, N, T, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1),\
+#define ATTRUI( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_UNSIGNED_INT, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
+UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTRF( A, N, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, GL_FLOAT, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1),\
 FLOAT_AS_UNION(V2), FLOAT_AS_UNION(V3))
 
 
 /* float */
-#define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
-#define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
-#define ATTR3FV( A, V ) ATTR( A, 3, GL_FLOAT, (V)[0], (V)[1], (V)[2], 1 )
-#define ATTR4FV( A, V ) ATTR( A, 4, GL_FLOAT, (V)[0], (V)[1], (V)[2], (V)[3] )
+#define ATTR1FV( A, V ) ATTRF( A, 1, (V)[0], 0, 0, 1 )
+#define ATTR2FV( A, V ) ATTRF( A, 2, (V)[0], (V)[1], 0, 1 )
+#define ATTR3FV( A, V ) ATTRF( A, 3, (V)[0], (V)[1], (V)[2], 1 )
+#define ATTR4FV( A, V ) ATTRF( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
 
-#define ATTR1F( A, X )  ATTR( A, 1, GL_FLOAT, X, 0, 0, 1 )
-#define ATTR2F( A, X, Y )   ATTR( A, 2, GL_FLOAT, X, Y, 0, 1 )
-#define ATTR3F( A, X, Y, Z )ATTR( A, 3, GL_FLOAT, X, Y, Z, 1 )
-#define ATTR4F( A, X, Y, Z, W ) ATTR( A, 4, GL_FLOAT, X, Y, Z, W )
+#define ATTR1F( A, X )  ATTRF( A, 1, X, 0, 0, 1 )
+#define ATTR2F( A, X, Y )   ATTRF( A, 2, X, Y, 0, 1 )
+#define ATTR3F( A, X, Y, Z )ATTRF( A, 3, X, Y, Z, 1 )
+#define ATTR4F( A, X, Y, Z, W ) ATTRF( A, 4, X, Y, Z, W )
 
-/* int */
-#define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
-   X, Y, Z, W )
 
+/* int */
 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
 #define ATTR4IV( A, V ) ATTRI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
@@ -70,9 +65,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
 /* uint */
-#define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
-X, Y, Z, W )
-
 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3UIV( A, V ) ATTRUI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
 #define ATTR4UIV( A, V ) ATTRUI( A, 4, (V)[0], (V)[1], (V)[2], (V)[3] )
@@ -82,7 +74,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define ATTR3UI( A, X, Y, Z )ATTRUI( A, 3, X, Y, Z, 1 )
 #define ATTR4UI( A, X, Y, Z, W ) ATTRUI( A, 4, X, Y, Z, W )
 
-#define MAT_ATTR( A, N, V ) ATTR( A, N, GL_FLOAT, (V)[0], (V)[1], (V)[2], 
(V)[3] )
+#define MAT_ATTR( A, N, V ) ATTRF( A, N, (V)[0], (V)[1], (V)[2], (V)[3] )
 
 static inline float conv_ui10_to_norm_float(unsigned ui10)
 {
@@ -94,20 +86,20 @@ static inline float conv_ui2_to_norm_float(unsigned ui2)
return ui2 / 3.0f;
 }
 
-#define ATTRUI10_1( A, UI ) ATTR( A, 1, GL_FLOAT, (UI)  0x3ff, 0, 0, 1 )
-#define ATTRUI10_2( A, UI ) ATTR( A, 2, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, 0, 1 )
-#define ATTRUI10_3( A, UI ) ATTR( A, 3, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, ((UI)  20)  0x3ff, 1 )
-#define ATTRUI10_4( A, UI ) ATTR( A, 4, GL_FLOAT, (UI)  0x3ff, ((UI)  10)  
0x3ff, ((UI)  20)  0x3ff, ((UI)  30)  0x3 )
+#define ATTRUI10_1( A, UI ) ATTRF( A, 1, (UI)  0x3ff, 0, 0, 1 )
+#define ATTRUI10_2( A, UI ) ATTRF( A, 2, (UI)  0x3ff, ((UI)  10)  0x3ff, 
0, 1 )
+#define ATTRUI10_3( A, UI ) ATTRF( A, 3, (UI)  0x3ff, ((UI)  10)  0x3ff, 
((UI)  20)  0x3ff, 1 )
+#define ATTRUI10_4( A, UI ) ATTRF( A, 4, (UI)  0x3ff, ((UI)  10)  0x3ff, 
((UI)  20)  0x3ff, ((UI)  30)  0x3 )
 
-#define ATTRUI10N_1( A, UI ) ATTR( A, 1, GL_FLOAT, 
conv_ui10_to_norm_float((UI)  0x3ff), 0, 0, 1 )
-#define ATTRUI10N_2( A, UI ) ATTR( A, 2, GL_FLOAT, \
+#define ATTRUI10N_1( A, UI ) ATTRF( A, 1

[Mesa-dev] [PATCH v6] mesa: use fi_type in vertex attribute code

2015-02-24 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

For 32-bit builds, floating point operations use x86 FPU registers,
not SSE registers.  If we're actually storing an integer in a float
variable, the value might get modified when written to memory.  This
patch changes the VBO code to use the fi_type (float/int union) to
store/copy vertex attributes.

Also, this can improve performance on x86 because moving floats with
integer registers instead of FP registers is faster.

Neil Roberts review:
- include changes on all places that are storing attribute values.
- check with and without -O3 compiler flag.
Brian Paul review:
- use fi_type type instead gl_constant_value type
- fix a bunch of nit-picks.
- fix compiler warnings

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   34 ++
 src/mesa/vbo/vbo_attrib_tmp.h |   22 ++
 src/mesa/vbo/vbo_context.h|   14 +++---
 src/mesa/vbo/vbo_exec.h   |   11 ++-
 src/mesa/vbo/vbo_exec_api.c   |   36 ++--
 src/mesa/vbo/vbo_exec_draw.c  |8 
 src/mesa/vbo/vbo_exec_eval.c  |   24 +---
 src/mesa/vbo/vbo_save.h   |   18 +-
 src/mesa/vbo/vbo_save_api.c   |   34 +-
 src/mesa/vbo/vbo_save_draw.c  |   10 +-
 11 files changed, 117 insertions(+), 97 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 63d30a2..f0597e2 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 2d59c6f..70d0556 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -170,25 +170,25 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static fi_type UINT_AS_UNION(GLuint u)
 {
fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline fi_type INT_AS_UNION(GLint i)
 {
fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline fi_type FLOAT_AS_UNION(GLfloat f)
 {
fi_type tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
 
 /**
@@ -620,24 +620,26 @@ do {  \
  * The default values are chosen based on \p type.
  */
 static inline void
-COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+COPY_CLEAN_4V_TYPE_AS_UNION(fi_type dst[4], int sz, const fi_type src[4],
 GLenum type)
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+FLOAT_AS_UNION(0), FLOAT_AS_UNION(1));
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V(dst, INT_AS_UNION(0), INT_AS_UNION(0),
+INT_AS_UNION(0), INT_AS_UNION(1));
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, UINT_AS_UNION(0), UINT_AS_UNION(0),
+UINT_AS_UNION(0), UINT_AS_UNION(1));
   break;
default:
-  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
-  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+FLOAT_AS_UNION(0), FLOAT_AS_UNION(1)); /* silence warnings */
+  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_UNION macro);
}
COPY_SZ_4V(dst, sz, src);
 }
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..80e8aaf 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 ) \
+ATTR_##T((A), (N), (T), (V0), (V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION(V0

[Mesa-dev] [PATCH v5] mesa: use fi_type in vertex attribute code

2015-02-19 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

For 32-bit builds, floating point operations use x86 FPU registers,
not SSE registers.  If we're actually storing an integer in a float
variable, the value might get modified when written to memory.  This
patch changes the VBO code to use the fi_type (float/int union) to
store/copy vertex attributes.

Also, this can improve performance on x86 because moving floats with
integer registers instead of FP registers is faster.

Neil Roberts review:
- include changes on all places that are storing attribute values.
- check with and without -O3 compiler flag.
Brian Paul review:
- use fi_type type instead gl_constant_value type
- fix a bunch of nit-picks.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   34 ++
 src/mesa/vbo/vbo_attrib_tmp.h |   22 ++
 src/mesa/vbo/vbo_context.h|   14 +++---
 src/mesa/vbo/vbo_exec.h   |   11 ++-
 src/mesa/vbo/vbo_exec_api.c   |   34 +-
 src/mesa/vbo/vbo_exec_draw.c  |6 +++---
 src/mesa/vbo/vbo_exec_eval.c  |   24 +---
 src/mesa/vbo/vbo_save.h   |   16 
 src/mesa/vbo/vbo_save_api.c   |   34 +-
 src/mesa/vbo/vbo_save_draw.c  |4 ++--
 11 files changed, 111 insertions(+), 91 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 63d30a2..f0597e2 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 2d59c6f..70d0556 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -170,25 +170,25 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static fi_type UINT_AS_UNION(GLuint u)
 {
fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline fi_type INT_AS_UNION(GLint i)
 {
fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline fi_type FLOAT_AS_UNION(GLfloat f)
 {
fi_type tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
 
 /**
@@ -620,24 +620,26 @@ do {  \
  * The default values are chosen based on \p type.
  */
 static inline void
-COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+COPY_CLEAN_4V_TYPE_AS_UNION(fi_type dst[4], int sz, const fi_type src[4],
 GLenum type)
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+FLOAT_AS_UNION(0), FLOAT_AS_UNION(1));
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V(dst, INT_AS_UNION(0), INT_AS_UNION(0),
+INT_AS_UNION(0), INT_AS_UNION(1));
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, UINT_AS_UNION(0), UINT_AS_UNION(0),
+UINT_AS_UNION(0), UINT_AS_UNION(1));
   break;
default:
-  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
-  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0),
+FLOAT_AS_UNION(0), FLOAT_AS_UNION(1)); /* silence warnings */
+  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_UNION macro);
}
COPY_SZ_4V(dst, sz, src);
 }
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..80e8aaf 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 ) \
+ATTR_##T((A), (N), (T), (V0), (V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), \
+UINT_AS_UNION(V2

[Mesa-dev] [PATCH v4] Fixing an x86 FPU bug.

2015-02-18 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On 32-bit, for floating point operations is used x86 FPU registers
instead SSE, reason for  when reinterprets an integer as a float
result is unexpected (modify floats when they are written to memory).
The patch was checked with and without -O3 compiler flag.

Also, it add performace improvement because treat GLfloats as GLint.
On x86 systems, moving a float as a int (thereby using integer registers 
instead of FP registers) is a performance win.

Neil Roberts review:
-include changes on all places that are storing attribute values.
Brian Paul review:
- use fi_type type instead gl_constant_value

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   32 
 src/mesa/vbo/vbo_attrib_tmp.h |   20 
 src/mesa/vbo/vbo_context.h|   14 +++---
 src/mesa/vbo/vbo_exec.h   |   11 ++-
 src/mesa/vbo/vbo_exec_api.c   |   35 +--
 src/mesa/vbo/vbo_exec_draw.c  |6 +++---
 src/mesa/vbo/vbo_exec_eval.c  |   22 +++---
 src/mesa/vbo/vbo_save.h   |   16 
 src/mesa/vbo/vbo_save_api.c   |   34 +-
 src/mesa/vbo/vbo_save_draw.c  |4 ++--
 11 files changed, 105 insertions(+), 92 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 63d30a2..f0597e2 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 2d59c6f..9ca3460 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -170,25 +170,25 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static fi_type UINT_AS_UNION(GLuint u)
 {
fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline fi_type INT_AS_UNION(GLint i)
 {
fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline fi_type FLOAT_AS_UNION(GLfloat f)
 {
fi_type tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
 
 /**
@@ -620,24 +620,24 @@ do {  \
  * The default values are chosen based on \p type.
  */
 static inline void
-COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+COPY_CLEAN_4V_TYPE_AS_UNION(fi_type dst[4], int sz, const fi_type src[4],
 GLenum type)
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), 
FLOAT_AS_UNION(1));
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V(dst, INT_AS_UNION(0), INT_AS_UNION(0),
+INT_AS_UNION(0), INT_AS_UNION(1));
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, UINT_AS_UNION(0), UINT_AS_UNION(0),
+UINT_AS_UNION(0), UINT_AS_UNION(1));
   break;
default:
-  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
-  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), 
FLOAT_AS_UNION(1)); /* silence warnings */
+  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_UNION macro);
}
COPY_SZ_4V(dst, sz, src);
 }
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..17a0a10 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 )  ATTR_##T((A), (N), (T), (V0), 
(V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), 
UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T

[Mesa-dev] [PATCH v3] Fixing an x86 FPU bug.

2015-02-12 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On 32-bit, for floating point operations is used x86 FPU registers
instead SSE, reason for  when reinterprets an integer as a float
result is unexpected (modify floats when they are written to memory).
The defect was checked with and without -O3 compiler flag

This patch is based Neil Roberts review.
This patch is more complete - it include changes on all places that are storing 
attribute values to use gl_constant_value.
This patch fix 2 piglit tests.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   41 +
 src/mesa/vbo/vbo_attrib_tmp.h |   20 
 src/mesa/vbo/vbo_context.h|   16 
 src/mesa/vbo/vbo_exec.h   |   11 ++-
 src/mesa/vbo/vbo_exec_api.c   |   39 +++
 src/mesa/vbo/vbo_exec_draw.c  |6 +++---
 src/mesa/vbo/vbo_exec_eval.c  |   22 +++---
 src/mesa/vbo/vbo_save.h   |   16 
 src/mesa/vbo/vbo_save_api.c   |   34 +-
 src/mesa/vbo/vbo_save_draw.c  |6 +++---
 11 files changed, 114 insertions(+), 100 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 63d30a2..f0597e2 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index cd5f2d6..2af15de 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -32,6 +32,7 @@
 #define MACROS_H
 
 #include imports.h
+#include program/prog_parameter.h
 
 
 /**
@@ -170,27 +171,26 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static union gl_constant_value UINT_AS_UNION(GLuint u)
 {
-   fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline union gl_constant_value INT_AS_UNION(GLint i)
 {
-   fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline union gl_constant_value FLOAT_AS_UNION(GLfloat f)
 {
-   fi_type tmp;
+   union gl_constant_value tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
-
 /**
  * Convert a floating point value to an unsigned fixed point value.
  *
@@ -382,6 +382,7 @@ do {\
 V[3] = V3;  \
 } while(0)
 
+
 /*@}*/
 
 
@@ -620,24 +621,24 @@ do {  \
  * The default values are chosen based on \p type.
  */
 static inline void
-COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+COPY_CLEAN_4V_TYPE_AS_UNION(gl_constant_value dst[4], int sz, const 
gl_constant_value src[4],
 GLenum type)
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), 
FLOAT_AS_UNION(1));
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V(dst, INT_AS_UNION(0), INT_AS_UNION(0),
+INT_AS_UNION(0), INT_AS_UNION(1));
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, UINT_AS_UNION(0), UINT_AS_UNION(0),
+UINT_AS_UNION(0), UINT_AS_UNION(1));
   break;
default:
-  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
-  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro);
+  ASSIGN_4V(dst, FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), FLOAT_AS_UNION(0), 
FLOAT_AS_UNION(1)); /* silence warnings */
+  ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_UNION macro);
}
COPY_SZ_4V(dst, sz, src);
 }
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..17a0a10 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h

[Mesa-dev] [PATCH v2] Fixing an x86 FPU bug.

2015-01-25 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On 32-bit, for floating point operations is used x86 FPU registers instead SSE,
reason for  when reinterprets an integer as a float result is unexpected
(modify floats when they are written to memory).
The defect was checked with and without -O3 compiler flag.

CC: mesa-sta...@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668
Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   47 -
 src/mesa/vbo/vbo_attrib_tmp.h |   20 ++
 src/mesa/vbo/vbo_exec.h   |3 ++-
 src/mesa/vbo/vbo_exec_api.c   |   31 +--
 src/mesa/vbo/vbo_exec_eval.c  |   22 ++-
 src/mesa/vbo/vbo_save_api.c   |   16 +++---
 src/mesa/vbo/vbo_save_draw.c  |4 ++--
 8 files changed, 90 insertions(+), 56 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 400c158..11ab8a9 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index cd5f2d6..2651ffc 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -32,6 +32,7 @@
 #define MACROS_H
 
 #include imports.h
+#include program/prog_parameter.h
 
 
 /**
@@ -170,27 +171,26 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static union gl_constant_value UINT_AS_UNION(GLuint u)
 {
-   fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline union gl_constant_value INT_AS_UNION(GLint i)
 {
-   fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline union gl_constant_value FLOAT_AS_UNION(GLfloat f)
 {
-   fi_type tmp;
+   union gl_constant_value tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
-
 /**
  * Convert a floating point value to an unsigned fixed point value.
  *
@@ -382,6 +382,15 @@ do {\
 V[3] = V3;  \
 } while(0)
 
+/** Assignment union*/
+#define ASSIGN_4V_UNION( V, V0, V1, V2, V3 )  \
+do {\
+V[0].f = V0;  \
+V[1].f = V1;  \
+V[2].f = V2;  \
+V[3].f = V3;  \
+} while(0)
+
 /*@}*/
 
 
@@ -620,23 +629,23 @@ do {  \
  * The default values are chosen based on \p type.
  */
 static inline void
-COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const GLfloat src[4],
+COPY_CLEAN_4V_TYPE_AS_FLOAT(gl_constant_value dst[4], int sz, const 
gl_constant_value src[4],
 GLenum type)
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V_UNION(dst, 0, 0, 0, 1);
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V_UNION(dst, INT_AS_UNION(0).f, INT_AS_UNION(0).f,
+INT_AS_UNION(0).f, INT_AS_UNION(1).f);
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V_UNION(dst, UINT_AS_UNION(0).f, UINT_AS_UNION(0).f,
+UINT_AS_UNION(0).f, UINT_AS_UNION(1).f);
   break;
default:
-  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
+  ASSIGN_4V_UNION(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
   ASSERT(!Unexpected type in COPY_CLEAN_4V_TYPE_AS_FLOAT macro);
}
COPY_SZ_4V(dst, sz, src);
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..17a0a10 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 )  ATTR_##T((A), (N), (T), (V0), 
(V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION

[Mesa-dev] [PATCH v1] Remove UINT_AS_FLT, INT_AS_FLT, FLOAT_AS_FLT macros.No functional changes, only bug fixed.

2015-01-21 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On 32-bit, for floating point operations is used x86 FPU registers instead SSE,
reason for  when reinterprets an integer as a float result is unexpected
(modify floats when they are written to memory).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668

Signed-off-by: Marius Predut marius.pre...@intel.com
---
 src/mesa/main/context.c   |3 ++-
 src/mesa/main/macros.h|   32 
 src/mesa/vbo/vbo_attrib_tmp.h |   20 
 src/mesa/vbo/vbo_exec.h   |3 ++-
 src/mesa/vbo/vbo_exec_api.c   |   25 -
 src/mesa/vbo/vbo_exec_eval.c  |   22 +-
 src/mesa/vbo/vbo_save_api.c   |   10 +-
 7 files changed, 70 insertions(+), 45 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 400c158..11ab8a9 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -134,6 +134,7 @@
 #include math/m_matrix.h
 #include main/dispatch.h /* for _gloffset_COUNT */
 #include uniforms.h
+#include macros.h
 
 #ifdef USE_SPARC_ASM
 #include sparc/sparc.h
@@ -656,7 +657,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = FLOAT_AS_UNION(1.0f).u;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index cd5f2d6..12c9997 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -32,6 +32,7 @@
 #define MACROS_H
 
 #include imports.h
+#include program/prog_parameter.h
 
 
 /**
@@ -170,27 +171,26 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
+static union gl_constant_value UINT_AS_UNION(GLuint u)
 {
-   fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.u = u;
+   return tmp;
 }
 
-static inline GLfloat UINT_AS_FLT(GLuint u)
+static inline union gl_constant_value INT_AS_UNION(GLint i)
 {
-   fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
+   union gl_constant_value tmp;
+   tmp.i = i;
+   return tmp;
 }
 
-static inline unsigned FLT_AS_UINT(float f)
+static inline union gl_constant_value FLOAT_AS_UNION(GLfloat f)
 {
-   fi_type tmp;
+   union gl_constant_value tmp;
tmp.f = f;
-   return tmp.u;
+   return tmp;
 }
-
 /**
  * Convert a floating point value to an unsigned fixed point value.
  *
@@ -628,12 +628,12 @@ COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const 
GLfloat src[4],
   ASSIGN_4V(dst, 0, 0, 0, 1);
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
+  ASSIGN_4V(dst, INT_AS_UNION(0).f, INT_AS_UNION(0).f,
+INT_AS_UNION(0).f, INT_AS_UNION(1).f);
   break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, UINT_AS_UNION(0).f, UINT_AS_UNION(0).f,
+UINT_AS_UNION(0).f, UINT_AS_UNION(1).f);
   break;
default:
   ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..17a0a10 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 )  ATTR_##T((A), (N), (T), (V0), 
(V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), 
UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, INT_AS_UNION(V0), INT_AS_UNION(V1), INT_AS_UNION(V2), 
INT_AS_UNION(V3))
+#define ATTR_GL_FLOAT( A, N, T, V0, V1, V2, V3 )   \
+ATTR_UNION(A, N, T, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1), 
FLOAT_AS_UNION(V2), FLOAT_AS_UNION(V3))
+
+
 /* float */
 #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
 #define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
@@ -41,8 +53,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* int */
 #define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
-   INT_AS_FLT(X), INT_AS_FLT(Y), \
-   INT_AS_FLT(Z), INT_AS_FLT(W) )
+   X, Y, \
+   Z, W )
 
 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
@@ -56,8 +68,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* uint */
 #define ATTRUI( A, N, X, Y

[Mesa-dev] [mesa-dev][PATCH] Remove UINT_AS_FLT, INT_AS_FLT, FLOAT_AS_FLT macros.No functional changes, only bug fixed.

2015-01-20 Thread marius . predut
From: Marius Predut marius.pre...@intel.com

On 32-bit, for floating point operations is used x86 FPU registers instead SSE,
reason for  when reinterprets an integer as a float result is unexpected
(modify floats when they are written to memory).
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=82668

Reviewed-by: Roberts, Neil Sneil.s.robe...@intel.com
---
 src/mesa/main/context.c   |2 +-
 src/mesa/main/macros.h|   29 ++-
 src/mesa/vbo/vbo_attrib_tmp.h |   43 +
 src/mesa/vbo/vbo_exec.h   |3 ++-
 src/mesa/vbo/vbo_exec_api.c   |   25 
 src/mesa/vbo/vbo_exec_eval.c  |   22 -
 src/mesa/vbo/vbo_save_api.c   |   10 +-
 7 files changed, 78 insertions(+), 56 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 400c158..3007491 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -656,7 +656,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
consts-MaxSamples = 0;
 
/* GLSL default if NativeIntegers == FALSE */
-   consts-UniformBooleanTrue = FLT_AS_UINT(1.0f);
+   consts-UniformBooleanTrue = 1;
 
/* GL_ARB_sync */
consts-MaxServerWaitTimeout = 0x1fff7fffULL;
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index cd5f2d6..4d245e1 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -170,27 +170,6 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
ub = ((GLubyte) F_TO_I((f) * 255.0F))
 #endif
 
-static inline GLfloat INT_AS_FLT(GLint i)
-{
-   fi_type tmp;
-   tmp.i = i;
-   return tmp.f;
-}
-
-static inline GLfloat UINT_AS_FLT(GLuint u)
-{
-   fi_type tmp;
-   tmp.u = u;
-   return tmp.f;
-}
-
-static inline unsigned FLT_AS_UINT(float f)
-{
-   fi_type tmp;
-   tmp.f = f;
-   return tmp.u;
-}
-
 /**
  * Convert a floating point value to an unsigned fixed point value.
  *
@@ -625,15 +604,11 @@ COPY_CLEAN_4V_TYPE_AS_FLOAT(GLfloat dst[4], int sz, const 
GLfloat src[4],
 {
switch (type) {
case GL_FLOAT:
-  ASSIGN_4V(dst, 0, 0, 0, 1);
+  ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f);
   break;
case GL_INT:
-  ASSIGN_4V(dst, INT_AS_FLT(0), INT_AS_FLT(0),
- INT_AS_FLT(0), INT_AS_FLT(1));
-  break;
case GL_UNSIGNED_INT:
-  ASSIGN_4V(dst, UINT_AS_FLT(0), UINT_AS_FLT(0),
- UINT_AS_FLT(0), UINT_AS_FLT(1));
+  ASSIGN_4V(dst, 0, 0, 0, 1);
   break;
default:
   ASSIGN_4V(dst, 0.0f, 0.0f, 0.0f, 1.0f); /* silence warnings */
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index ec66934..a853cb1 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -28,6 +28,41 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include util/u_format_r11g11b10f.h
 #include main/varray.h
 
+#include program/prog_parameter.h
+
+
+static union gl_constant_value UINT_AS_UNION(GLuint u)
+{
+   union gl_constant_value tmp;
+   tmp.u = u;
+   return tmp;
+}
+
+static inline union gl_constant_value INT_AS_UNION(GLint i)
+{
+   union gl_constant_value tmp;
+   tmp.i = i;
+   return tmp;
+}
+
+static inline union gl_constant_value FLOAT_AS_UNION(GLfloat f)
+{
+   union gl_constant_value tmp;
+   tmp.f = f;
+   return tmp;
+}
+
+/* ATTR */
+#define ATTR( A, N, T, V0, V1, V2, V3 )  ATTR_##T((A), (N), (T), (V0), 
(V1), (V2), (V3))
+
+#define ATTR_GL_UNSIGNED_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, UINT_AS_UNION(V0), UINT_AS_UNION(V1), 
UINT_AS_UNION(V2), UINT_AS_UNION(V3))
+#define ATTR_GL_INT( A, N, T, V0, V1, V2, V3 ) \
+ATTR_UNION(A, N, T, INT_AS_UNION(V0), INT_AS_UNION(V1), INT_AS_UNION(V2), 
INT_AS_UNION(V3))
+#define ATTR_GL_FLOAT( A, N, T, V0, V1, V2, V3 )   \
+ATTR_UNION(A, N, T, FLOAT_AS_UNION(V0), FLOAT_AS_UNION(V1), 
FLOAT_AS_UNION(V2), FLOAT_AS_UNION(V3))
+
+
 /* float */
 #define ATTR1FV( A, V ) ATTR( A, 1, GL_FLOAT, (V)[0], 0, 0, 1 )
 #define ATTR2FV( A, V ) ATTR( A, 2, GL_FLOAT, (V)[0], (V)[1], 0, 1 )
@@ -41,8 +76,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* int */
 #define ATTRI( A, N, X, Y, Z, W) ATTR( A, N, GL_INT, \
-   INT_AS_FLT(X), INT_AS_FLT(Y), \
-   INT_AS_FLT(Z), INT_AS_FLT(W) )
+   X, Y, \
+   Z, W )
 
 #define ATTR2IV( A, V ) ATTRI( A, 2, (V)[0], (V)[1], 0, 1 )
 #define ATTR3IV( A, V ) ATTRI( A, 3, (V)[0], (V)[1], (V)[2], 1 )
@@ -56,8 +91,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 /* uint */
 #define ATTRUI( A, N, X, Y, Z, W) ATTR( A, N, GL_UNSIGNED_INT, \
-UINT_AS_FLT(X), UINT_AS_FLT(Y), \
-UINT_AS_FLT(Z), UINT_AS_FLT(W) )
+X, Y, \
+Z, W )
 
 #define ATTR2UIV( A, V ) ATTRUI( A, 2, (V)[0