Re: [Mesa-dev] [PATCH 1/6] r300g/compiler: Add missing license headers

2013-02-10 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák 

Marek

On Sun, Feb 10, 2013 at 6:15 AM, Tom Stellard  wrote:
> From: Tom Stellard 
>
> These are all files that I authored, but forgot to add the license
> headers.
>
> NOTE: This is a candidate for the stable branches.
>
> Signed-off-by: Tom Stellard 
> ---
>  .../drivers/r300/compiler/radeon_compiler_util.h   |   27 
> 
>  .../drivers/r300/compiler/radeon_emulate_loops.h   |   27 
> +++-
>  .../drivers/r300/compiler/radeon_inline_literals.c |   24 +
>  .../r300/compiler/radeon_pair_dead_sources.c   |   26 +++
>  .../drivers/r300/compiler/radeon_rename_regs.h |   26 +++
>  src/gallium/drivers/r300/compiler/radeon_vert_fc.c |   24 +
>  .../r300/compiler/tests/r300_compiler_tests.c  |   27 
> 
>  .../r300/compiler/tests/r300_compiler_tests.h  |   26 +++
>  .../compiler/tests/radeon_compiler_util_tests.c|   27 
> 
>  .../drivers/r300/compiler/tests/rc_test_helpers.c  |   27 
> 
>  .../drivers/r300/compiler/tests/rc_test_helpers.h  |   26 +++
>  .../drivers/r300/compiler/tests/unit_test.c|   27 
> 
>  .../drivers/r300/compiler/tests/unit_test.h|   26 +++
>  13 files changed, 339 insertions(+), 1 deletions(-)
>
> diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler_util.h 
> b/src/gallium/drivers/r300/compiler/radeon_compiler_util.h
> index ae5288e..462f920 100644
> --- a/src/gallium/drivers/r300/compiler/radeon_compiler_util.h
> +++ b/src/gallium/drivers/r300/compiler/radeon_compiler_util.h
> @@ -1,3 +1,30 @@
> +/*
> + * Copyright 2010 Tom Stellard 
> + *
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> + * a copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sublicense, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial
> + * portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
> + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + */
> +
>  #include "radeon_program_constants.h"
>
>  #ifndef RADEON_PROGRAM_UTIL_H
> diff --git a/src/gallium/drivers/r300/compiler/radeon_emulate_loops.h 
> b/src/gallium/drivers/r300/compiler/radeon_emulate_loops.h
> index cd800c0..01f02a6 100644
> --- a/src/gallium/drivers/r300/compiler/radeon_emulate_loops.h
> +++ b/src/gallium/drivers/r300/compiler/radeon_emulate_loops.h
> @@ -1,4 +1,29 @@
> -
> +/*
> + * Copyright 2010 Tom Stellard 
> + *
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> + * a copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sublicense, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial
> + * portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
> + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + */
>
>  #ifndef RADEON_EMULATE_LOOPS_H
>  #define RADEON_EMULATE_LOOPS_H
> diff --git a/src/gallium/drivers/r300/compiler/radeon_inline_literals.c 
> b/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
> index 54f6d67..492f00e 100644
> --- a/src/gallium/drivers/r300/compiler/radeon_inline_literals.c
> +++

[Mesa-dev] [Bug 59187] [Steam] Black screen but audio song On TF2 (Intel HM 55/ Ironlake Mobile)

2013-02-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59187

Christoph Brill  changed:

   What|Removed |Added

 CC||eg...@gmx.de

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/9] copyteximage: check that sRGB usage is valid for GLES3 / GL

2013-02-10 Thread Török Edwin
On 01/19/2013 01:55 AM, Matt Turner wrote:
> From: Jordan Justen 
> 
> Cc: Eric Anholt 
> Signed-off-by: Jordan Justen 

FYI this broke lots of games under wine 1.5.20, with errors like:

err:d3d:check_fbo_compat > GL_INVALID_OPERATION (0x502) from 
Post-pixelshader blending check @ utils.c / 1133
err:d3d:check_fbo_compat > GL_INVALID_OPERATION (0x502) from 
Post-pixelshader blending check @ utils.c / 1133
err:d3d:check_fbo_compat > GL_INVALID_OPERATION (0x502) from 
Post-pixelshader blending check @ utils.c / 1133

The failing line (in wine) is:
gl_info->gl_ops.gl.p_glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 
0, 0, 16, 16, 0);
gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, 
GL_UNSIGNED_INT_8_8_8_8_REV, readback);
checkGLcall("Post-pixelshader blending check");

Apparently its trying to copy from a sRGB internal format:
9623 glTexImage2D(target = GL_TEXTURE_2D, level = 0, internalformat = 
GL_SRGB8_ALPHA8, width = 16, height = 16, border = 0, format = GL_BGRA, type = 
GL_UNSIGNED_INT_8_8_8_8_REV, pixels = NULL)

They seem to have fixed this in wine 1.5.23 (released Feb 1 2013) by removing 
the CopyTexImage2D, but probably all wine version between
1.3.32 and 1.5.22 are broken.
Perhaps in the next release notes for Mesa (that would include this commit) 
something should be said about having to upgrade wine?

Although this seems to be a new requirement in OpenGL core 4.3: OpenGL spec 4.2 
and the "manpages" for glCopyTexImage2D
 don't say anything about INVALID_OPERATION and sRGB:
https://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml

Should the check done by your patch be restricted to OpenGL 4.3 contexts?

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


[Mesa-dev] [Bug 59187] [Steam] Black screen but audio song On TF2 (Intel HM 55/ Ironlake Mobile)

2013-02-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59187

Chris Forbes  changed:

   What|Removed |Added

 CC||chr...@ijw.co.nz

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] R600/SI: Use MULADD_IEEE/V_MAD_F32 instruction for mad pattern

2013-02-10 Thread Vincent Lejeune
---
 lib/Target/R600/AMDGPUISelLowering.cpp | 10 +++---
 lib/Target/R600/AMDGPUISelLowering.h   |  1 -
 lib/Target/R600/AMDILISelLowering.cpp  |  3 ++-
 lib/Target/R600/AMDILInstrInfo.td  |  1 -
 lib/Target/R600/AMDILIntrinsics.td | 10 --
 lib/Target/R600/R600Instructions.td|  9 -
 lib/Target/R600/SIInstructions.td  |  4 ++--
 test/CodeGen/R600/fmad.ll  | 19 +++
 8 files changed, 34 insertions(+), 23 deletions(-)
 create mode 100644 test/CodeGen/R600/fmad.ll

diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp 
b/lib/Target/R600/AMDGPUISelLowering.cpp
index d0d23d6..0a33264 100644
--- a/lib/Target/R600/AMDGPUISelLowering.cpp
+++ b/lib/Target/R600/AMDGPUISelLowering.cpp
@@ -127,9 +127,6 @@ SDValue 
AMDGPUTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
   return LowerIntrinsicLRP(Op, DAG);
 case AMDGPUIntrinsic::AMDIL_fraction:
   return DAG.getNode(AMDGPUISD::FRACT, DL, VT, Op.getOperand(1));
-case AMDGPUIntrinsic::AMDIL_mad:
-  return DAG.getNode(AMDGPUISD::MAD, DL, VT, Op.getOperand(1),
-  Op.getOperand(2), Op.getOperand(3));
 case AMDGPUIntrinsic::AMDIL_max:
   return DAG.getNode(AMDGPUISD::FMAX, DL, VT, Op.getOperand(1),
   Op.getOperand(2));
@@ -176,9 +173,9 @@ SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op,
 Op.getOperand(1));
   SDValue OneSubAC = DAG.getNode(ISD::FMUL, DL, VT, OneSubA,
 Op.getOperand(3));
-  return DAG.getNode(AMDGPUISD::MAD, DL, VT, Op.getOperand(1),
-   Op.getOperand(2),
-   OneSubAC);
+  return DAG.getNode(ISD::FADD, DL, VT,
+  DAG.getNode(ISD::FMUL, DL, VT, Op.getOperand(1), Op.getOperand(2)),
+  OneSubAC);
 }
 
 /// \brief Generate Min/Max node
@@ -393,7 +390,6 @@ const char* 
AMDGPUTargetLowering::getTargetNodeName(unsigned Opcode) const {
   switch (Opcode) {
   default: return 0;
   // AMDIL DAG nodes
-  NODE_NAME_CASE(MAD);
   NODE_NAME_CASE(CALL);
   NODE_NAME_CASE(UMUL);
   NODE_NAME_CASE(DIV_INF);
diff --git a/lib/Target/R600/AMDGPUISelLowering.h 
b/lib/Target/R600/AMDGPUISelLowering.h
index 4b844a3..f27b5db 100644
--- a/lib/Target/R600/AMDGPUISelLowering.h
+++ b/lib/Target/R600/AMDGPUISelLowering.h
@@ -108,7 +108,6 @@ namespace AMDGPUISD {
 enum {
   // AMDIL ISD Opcodes
   FIRST_NUMBER = ISD::BUILTIN_OP_END,
-  MAD, // 32bit Fused Multiply Add instruction
   CALL,// Function call based on a single integer
   UMUL,// 32bit unsigned multiplication
   DIV_INF,  // Divide with infinity returned on zero divisor
diff --git a/lib/Target/R600/AMDILISelLowering.cpp 
b/lib/Target/R600/AMDILISelLowering.cpp
index 2e60adc..3480ac8 100644
--- a/lib/Target/R600/AMDILISelLowering.cpp
+++ b/lib/Target/R600/AMDILISelLowering.cpp
@@ -451,7 +451,8 @@ AMDGPUTargetLowering::LowerSDIV24(SDValue Op, SelectionDAG 
&DAG) const {
   SDValue fqneg = DAG.getNode(ISD::FNEG, DL, FLTTY, fq);
 
   // float fr = mad(fqneg, fb, fa);
-  SDValue fr = DAG.getNode(AMDGPUISD::MAD, DL, FLTTY, fqneg, fb, fa);
+  SDValue fr = DAG.getNode(ISD::FADD, DL, FLTTY,
+  DAG.getNode(ISD::MUL, DL, FLTTY, fqneg, fb), fa);
 
   // int iq = (int)fq;
   SDValue iq = DAG.getNode(ISD::FP_TO_SINT, DL, INTTY, fq);
diff --git a/lib/Target/R600/AMDILInstrInfo.td 
b/lib/Target/R600/AMDILInstrInfo.td
index e969bbf..110f147 100644
--- a/lib/Target/R600/AMDILInstrInfo.td
+++ b/lib/Target/R600/AMDILInstrInfo.td
@@ -116,7 +116,6 @@ def IL_retflag   : SDNode<"AMDGPUISD::RET_FLAG", 
SDTNone,
 //======//
 // Floating point math functions
 def IL_div_inf  : SDNode<"AMDGPUISD::DIV_INF", SDTIL_GenBinaryOp>;
-def IL_mad  : SDNode<"AMDGPUISD::MAD", SDTIL_GenTernaryOp>;
 
 
//===--===//
 // Integer functions
diff --git a/lib/Target/R600/AMDILIntrinsics.td 
b/lib/Target/R600/AMDILIntrinsics.td
index 3f9e20f..6ec3559 100644
--- a/lib/Target/R600/AMDILIntrinsics.td
+++ b/lib/Target/R600/AMDILIntrinsics.td
@@ -92,12 +92,6 @@ let TargetPrefix = "AMDIL", isTarget = 1 in {
   TernaryIntInt;
   def int_AMDIL_bfm : GCCBuiltin<"__amdil_bfm">,
   BinaryIntInt;
-  def int_AMDIL_mad_i32 : GCCBuiltin<"__amdil_imad">,
-  TernaryIntInt;
-  def int_AMDIL_mad_u32 : GCCBuiltin<"__amdil_umad">,
-  TernaryIntInt;
-  def int_AMDIL_mad : GCCBuiltin<"__amdil_mad">,
-  TernaryIntFloat;
   def int_AMDIL_mulhi_i32 : GCCBuiltin<"__amdil_imul_high">,
   BinaryIntInt;
   def int_AMDIL_mulhi_u32 : GCCBuiltin<"__amdil_umul_high">,
@@ -110,10 +104,6 @@ let TargetPrefix = "AMDIL", isTarget = 1 in {
   BinaryIntInt;
   def int_AMDIL_mulhi24_u32 : GCCBuiltin<"__amdil_umul24_high">,
 

[Mesa-dev] [PATCH 1/2] gallium: add red-alpha texture formats and a couple of util functions

2013-02-10 Thread Marek Olšák
This is for glGetTexImage and it will be used for samplers only (which some
drivers already implement by reading util_format_description).

v2: incorporate Brian's suggestion

---
 src/gallium/auxiliary/util/u_format.csv |   12 
 src/gallium/auxiliary/util/u_format.h   |  117 +++
 src/gallium/include/pipe/p_format.h |   12 
 3 files changed, 141 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_format.csv 
b/src/gallium/auxiliary/util/u_format.csv
index 1d27407..f3925bb 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -360,3 +360,15 @@ PIPE_FORMAT_R16G16B16X16_SINT   , plain, 1, 1, sp16, 
sp16, sp16, x16, xyz1,
 PIPE_FORMAT_R32G32B32X32_FLOAT  , plain, 1, 1, f32,  f32,  f32,  x32, 
xyz1, rgb
 PIPE_FORMAT_R32G32B32X32_UINT   , plain, 1, 1, up32, up32, up32, x32, 
xyz1, rgb
 PIPE_FORMAT_R32G32B32X32_SINT   , plain, 1, 1, sp32, sp32, sp32, x32, 
xyz1, rgb
+
+PIPE_FORMAT_R8A8_SNORM  , plain, 1, 1, sn8  ,  sn8 , , , 
x00y, rgb
+PIPE_FORMAT_R16A16_UNORM, plain, 1, 1, un16 , un16 , , , 
x00y, rgb
+PIPE_FORMAT_R16A16_SNORM, plain, 1, 1, sn16 , sn16 , , , 
x00y, rgb
+PIPE_FORMAT_R16A16_FLOAT, plain, 1, 1, f16  , f16  , , , 
x00y, rgb
+PIPE_FORMAT_R32A32_FLOAT, plain, 1, 1, f32  , f32  , , , 
x00y, rgb
+PIPE_FORMAT_R8A8_UINT   , plain, 1, 1, up8  , up8  , , , 
x00y, rgb
+PIPE_FORMAT_R8A8_SINT   , plain, 1, 1, sp8  , sp8  , , , 
x00y, rgb
+PIPE_FORMAT_R16A16_UINT , plain, 1, 1, up16 , up16 , , , 
x00y, rgb
+PIPE_FORMAT_R16A16_SINT , plain, 1, 1, sp16 , sp16 , , , 
x00y, rgb
+PIPE_FORMAT_R32A32_UINT , plain, 1, 1, up32 , up32 , , , 
x00y, rgb
+PIPE_FORMAT_R32A32_SINT , plain, 1, 1, sp32 , sp32 , , , 
x00y, rgb
diff --git a/src/gallium/auxiliary/util/u_format.h 
b/src/gallium/auxiliary/util/u_format.h
index 63015dd..0030126 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -888,6 +888,123 @@ util_format_stencil_only(enum pipe_format format)
 }
 
 /**
+ * Converts PIPE_FORMAT_*I* to PIPE_FORMAT_*R*.
+ * This is identity for non-intensity formats.
+ */
+static INLINE enum pipe_format
+util_format_intensity_to_red(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_I8_UNORM:
+  return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_I8_SNORM:
+  return PIPE_FORMAT_R8_SNORM;
+   case PIPE_FORMAT_I16_UNORM:
+  return PIPE_FORMAT_R16_UNORM;
+   case PIPE_FORMAT_I16_SNORM:
+  return PIPE_FORMAT_R16_SNORM;
+   case PIPE_FORMAT_I16_FLOAT:
+  return PIPE_FORMAT_R16_FLOAT;
+   case PIPE_FORMAT_I32_FLOAT:
+  return PIPE_FORMAT_R32_FLOAT;
+   case PIPE_FORMAT_I8_UINT:
+  return PIPE_FORMAT_R8_UINT;
+   case PIPE_FORMAT_I8_SINT:
+  return PIPE_FORMAT_R8_SINT;
+   case PIPE_FORMAT_I16_UINT:
+  return PIPE_FORMAT_R16_UINT;
+   case PIPE_FORMAT_I16_SINT:
+  return PIPE_FORMAT_R16_SINT;
+   case PIPE_FORMAT_I32_UINT:
+  return PIPE_FORMAT_R32_UINT;
+   case PIPE_FORMAT_I32_SINT:
+  return PIPE_FORMAT_R32_SINT;
+   default:
+  assert(!util_format_is_intensity(format));
+  return format;
+   }
+}
+
+/**
+ * Converts PIPE_FORMAT_*L* to PIPE_FORMAT_*R*.
+ * This is identity for non-luminance formats.
+ */
+static INLINE enum pipe_format
+util_format_luminance_to_red(enum pipe_format format)
+{
+   switch (format) {
+   case PIPE_FORMAT_L8_UNORM:
+  return PIPE_FORMAT_R8_UNORM;
+   case PIPE_FORMAT_L8_SNORM:
+  return PIPE_FORMAT_R8_SNORM;
+   case PIPE_FORMAT_L16_UNORM:
+  return PIPE_FORMAT_R16_UNORM;
+   case PIPE_FORMAT_L16_SNORM:
+  return PIPE_FORMAT_R16_SNORM;
+   case PIPE_FORMAT_L16_FLOAT:
+  return PIPE_FORMAT_R16_FLOAT;
+   case PIPE_FORMAT_L32_FLOAT:
+  return PIPE_FORMAT_R32_FLOAT;
+   case PIPE_FORMAT_L8_UINT:
+  return PIPE_FORMAT_R8_UINT;
+   case PIPE_FORMAT_L8_SINT:
+  return PIPE_FORMAT_R8_SINT;
+   case PIPE_FORMAT_L16_UINT:
+  return PIPE_FORMAT_R16_UINT;
+   case PIPE_FORMAT_L16_SINT:
+  return PIPE_FORMAT_R16_SINT;
+   case PIPE_FORMAT_L32_UINT:
+  return PIPE_FORMAT_R32_UINT;
+   case PIPE_FORMAT_L32_SINT:
+  return PIPE_FORMAT_R32_SINT;
+
+   case PIPE_FORMAT_LATC1_UNORM:
+  return PIPE_FORMAT_RGTC1_UNORM;
+   case PIPE_FORMAT_LATC1_SNORM:
+  return PIPE_FORMAT_RGTC1_SNORM;
+
+   case PIPE_FORMAT_L4A4_UNORM:
+  /* XXX A4R4 is defined as x00y in u_format.csv */
+  return PIPE_FORMAT_A4R4_UNORM;
+
+   case PIPE_FORMAT_L8A8_UNORM:
+  return PIPE_FORMAT_R8A8_UNORM;
+   case PIPE_FORMAT_L8A8_SNORM:
+  return PIPE_FORMAT_R8A8_SNORM;
+   case PIPE_FORMAT_L16A16_UNORM:
+  return PIPE_FORMAT_R16A16_UNORM;
+   case PIPE_FORMAT_L16A16_SNORM:
+  return PIPE_FORMAT_R16A16_SNORM;
+   case PIPE_FORMAT_L16A16_

[Mesa-dev] [PATCH] i965: Use derived state for Haswell's 3DSTATE_VF packet.

2013-02-10 Thread Kenneth Graunke
Otherwise, we fail to correctly handle GL_PRIMITIVE_RESTART_FIXED_INDEX.

Fixes gles3conform's primitive_restart_mode test.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_primitive_restart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c 
b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
index 8c7219d..e6902b4 100644
--- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
+++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
@@ -196,11 +196,11 @@ haswell_upload_cut_index(struct brw_context *brw)
   return;
 
const unsigned cut_index_setting =
-  ctx->Array.PrimitiveRestart ? HSW_CUT_INDEX_ENABLE : 0;
+  ctx->Array._PrimitiveRestart ? HSW_CUT_INDEX_ENABLE : 0;
 
BEGIN_BATCH(2);
OUT_BATCH(_3DSTATE_VF << 16 | cut_index_setting | (2 - 2));
-   OUT_BATCH(ctx->Array.RestartIndex);
+   OUT_BATCH(ctx->Array._RestartIndex);
ADVANCE_BATCH();
 }
 
-- 
1.8.1.1

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


Re: [Mesa-dev] [PATCH] glsl: Fix handling of array dereferences of vectors in opt_dead_code_local

2013-02-10 Thread Ian Romanick

On 02/08/2013 10:41 PM, Eric Anholt wrote:

Ian Romanick  writes:


On 02/08/2013 04:24 PM, Eric Anholt wrote:

Ian Romanick  writes:


From: Ian Romanick 
+ * modes.  In the first mode, when \c want_availability_mask is \c true, it is
+ * assumed that any field of the vector may be written.  This is used when
+ * adding an assignment to the assignment list.  In the second mode, when
+ * \c want_availability_mask is \c false, it is assumed that no fields of the
+ * vector are written.  This is used when trying to remove earlier assignments
+ * from the list.
+ */
+static int
+may_set_mask(ir_assignment *ir, bool want_availability_mask)
+{
+   int mask = ir->write_mask;
+
+   /* If the LHS is an array derefernce of a vector, try to figure out what
+* the real write mask is.  If the index is not a constant, assume that any
+* element may be written.
+*/
+   if (is_array_deref_of_vector(ir->lhs)) {
+  ir_dereference_array *const d = ir->lhs->as_dereference_array();
+  ir_constant *const c = d->array_index->as_constant();
+
+  if (c != NULL) {
+ const int idx = (c != NULL) ? c->get_uint_component(0) : -1;
+
+ if (idx >= 0 && idx <= 3)
+mask = 1U << idx;
+ else
+mask = 0;
+  } else {
+ /* Set the write-mask depending on the size of the vector.
+  */
+ if (want_availability_mask)
+mask = (1U << d->array->type->vector_components()) - 1;
+ else
+mask = 0;
+  }
+   }
+
+   return mask;
+}




+
   class assignment_entry : public exec_node
   {
   public:
@@ -51,7 +114,7 @@ public:
 assert(ir);
 this->lhs = lhs;
 this->ir = ir;
-  this->available = ir->write_mask;
+  this->available = may_set_mask(ir, true);


I don't think the want_availability_mask makes sense. If you're noting
an array deref of a vector for later dead code elimination, a later
instruction that sets the vector's .x shouldn't go turn off .x of this
instruction.


I did it like this so that we could still optimize things like:

  vec4 v = ...;

  v[i] =  ...;   // i is a uniform or similar
  ...
  v.x = ...;
  ...
  v.y = ...;
  ...
  v.z = ...;
  ...
  v.w = ...;

Even though the initial assignment(s) set "any field", the later
assignments wipe them all out.


But for code that's just:


  v[i] =  ...;   // i is a uniform or similar
  ...
  v.x = ...;


you'll turn off the write_mask of the v[i] write, right?  And now the
read of v.yzw is broken.


I sent out a test case for this this very case.  See "[PATCH v2] Test 
bad interaction with optimizer and "array" accesses to vector elements" 
on the piglit list.  The glsl-vs-channel-overwrite-03.shader_test case 
is the one that checks this:


#version 120
attribute vec3 vertex;
uniform mat4 mvp = mat4(1.);
uniform int i = 3;

void main()
{
vec4 tmp;

/* These two blocks of code should produce the same result, but or some
 * reason the tmp[3] assignment in the first version gets eliminated by
 * one of Mesa's optimization passes.
 */
#if 1
tmp[i] = 1.0;
tmp.xyz = vertex;
#else
tmp.w = 1.0;
tmp.xyz = vertex;
#endif
gl_Position = mvp * tmp;
}

For instructions with variable indexing, I change the available mask, 
but I only modify the instruction when the available mask becomes zero. 
 This is handled by the last hunk in the patch (with the "give up" 
comment).


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


[Mesa-dev] Mesa 9.1-rc1

2013-02-10 Thread Ian Romanick

Mesa 9.1 release candidate 1 is now ready.

The tag in the GIT repository for Mesa 9.1-RC1 is 'mesa-9.1-rc1'.

Mesa 9.1-RC1 is available for download at
ftp://freedesktop.org/pub/mesa/9.1/

md5sums:

629a1058f1415c2b0318a912e765c6bb  MesaLib-9.1-devel.tar.gz
d08190d4e0cb87c911cd10ff2d939ac1  MesaLib-9.1-devel.tar.bz2
ab3956ff9d411789b07791c6b0607853  MesaLib-9.1-devel.zip

I have verified building from the .tar.bz2 file by doing:

tar -xjf MesaLib-9.1-devel.tar.bz2
cd Mesa-9.1-devel
./configure
make -j6

I have also verified that I pushed the tag.

RC2 is scheduled for Friday, February 15th.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] st/mesa: accelerate glGetTexImage for all formats using a blit

2013-02-10 Thread Marek Olšák
FYI, I am squashing the following diff with the patch, because I
realized desc->channel[i].type wasn't correct, because it's always
UTIL_FORMAT_TYPE_VOID. (please ignore any line wrapping caused by my
email client, thanks)

diff --git a/src/mesa/state_tracker/st_cb_texture.c
b/src/mesa/state_tracker/st_cb_texture.c
index 3b6a9bb..ac70e92 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -687,9 +687,7 @@ st_GetTexImage(struct gl_context * ctx,
ctx->Pack.SwapBytes);

if (dst_format == PIPE_FORMAT_NONE) {
-  const struct util_format_description *desc;
   GLenum dst_glformat;
-  int i;

   /* Fall back to _mesa_get_teximage except for compressed formats,
* where decompression with a blit is always preferred. */
@@ -697,31 +695,32 @@ st_GetTexImage(struct gl_context * ctx,
  goto fallback;
   }

-  /* Set the appropriate format for the decompressed texture. */
-  desc = util_format_description(src->format);
-  i = util_format_get_first_non_void_channel(src->format);
-
-  switch (desc->channel[i].type) {
-  case UTIL_FORMAT_TYPE_UNSIGNED: /* DXTC or RGTC or BPTC */
+  /* Set the appropriate format for the decompressed texture.
+   * Luminance and sRGB formats shouldn't appear here.*/
+  switch (src_format) {
+  case PIPE_FORMAT_DXT1_RGB:
+  case PIPE_FORMAT_DXT1_RGBA:
+  case PIPE_FORMAT_DXT3_RGBA:
+  case PIPE_FORMAT_DXT5_RGBA:
+  case PIPE_FORMAT_RGTC1_UNORM:
+  case PIPE_FORMAT_RGTC2_UNORM:
+  case PIPE_FORMAT_ETC1_RGB8:
  dst_glformat = GL_RGBA8;
  break;
-  case UTIL_FORMAT_TYPE_SIGNED: /* RGTC */
+  case PIPE_FORMAT_RGTC1_SNORM:
+  case PIPE_FORMAT_RGTC2_SNORM:
  if (!ctx->Extensions.EXT_texture_snorm)
 goto fallback;
  dst_glformat = GL_RGBA8_SNORM;
  break;
-  case UTIL_FORMAT_TYPE_FLOAT: /* BPTC */
- if (!ctx->Extensions.ARB_texture_float)
-goto fallback;
- dst_glformat = GL_RGBA32F;
- break;
+  /* TODO: for BPTC_*FLOAT, set RGBA32F and check for ARB_texture_float */
   default:
  assert(0);
  goto fallback;
   }

   dst_format = st_choose_format(st, dst_glformat, format, type,
- pipe_target, 0, bind, FALSE);
+pipe_target, 0, bind, FALSE);

   if (dst_format == PIPE_FORMAT_NONE) {
  /* unable to get an rgba format!?! */

Marek

On Fri, Feb 8, 2013 at 1:57 AM, Brian Paul  wrote:
> On 02/07/2013 01:13 PM, Marek Olšák wrote:
>>
>> This commit allows using glGetTexImage during rendering and still
>> maintain interactive framerates.
>>
>> This improves performance of WarCraft 3 under Wine. The framerate is
>> improved
>> from 25 fps to 39 fps in the main menu, and from 0.5 fps to 32 fps in the
>> game.
>> ---
>>   src/mesa/state_tracker/st_cb_texture.c |  201
>> 
>>   src/mesa/state_tracker/st_format.c |1 -
>>   2 files changed, 153 insertions(+), 49 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_texture.c
>> b/src/mesa/state_tracker/st_cb_texture.c
>> index ab5ff27..3b6a9bb 100644
>> --- a/src/mesa/state_tracker/st_cb_texture.c
>> +++ b/src/mesa/state_tracker/st_cb_texture.c
>> @@ -560,15 +560,52 @@ st_CompressedTexImage(struct gl_context *ctx, GLuint
>> dims,
>>   }
>>
>>
>> +static enum pipe_format
>> +choose_matching_format(struct pipe_screen *screen, unsigned bind,
>> +   GLenum format, GLenum type, GLboolean swapBytes)
>> +{
>> +   gl_format mesa_format;
>> +
>> +   for (mesa_format = 1; mesa_format<  MESA_FORMAT_COUNT; mesa_format++)
>> {
>> +  if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
>> + continue;
>> +  }
>> +
>> +  if (_mesa_format_matches_format_and_type(mesa_format, format, type,
>> +   swapBytes)) {
>> + enum pipe_format format =
>> st_mesa_format_to_pipe_format(mesa_format);
>> +
>> + if (format&&
>> + screen->is_format_supported(screen, format, PIPE_TEXTURE_2D,
>> 0,
>> + bind)) {
>> +return format;
>> + }
>> + /* It's unlikely to find 2 matching Mesa formats. */
>> + break;
>> +  }
>> +   }
>> +   return PIPE_FORMAT_NONE;
>> +}
>
>
> This seems like kind of an inefficient function.  If we find that the app is
> calling glGetTexImage() over and over with the same format/type, perhaps we
> could cache the result of this function to avoid calling it the next time.
> Maybe that's not a big deal though.
>
> The st_cb_drawpixels.c file has some similar code that tries to find a
> pipe_format that matches a GL format/type combo.  Your new code is more
> sophisticated.  Maybe it could be used for glDrawPixels too.
>
> [...]
>
> Otherwi