Re: [Mesa-dev] [PATCH 2/3] translate: implement translation of (pure) integer formats

2012-01-04 Thread Dave Airlie
On Mon, Jan 2, 2012 at 1:07 PM, Marek Olšák mar...@gmail.com wrote:
 The conversion is limited to only a few cases, because converting to any other
 type shouldn't happen in any driver.

Reviewed-by: Dave Airlie airl...@redhat.com

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


Re: [Mesa-dev] [PATCH 3/3] translate: implement translation of 10_10_10_2 types

2012-01-04 Thread Dave Airlie
On Mon, Jan 2, 2012 at 1:07 PM, Marek Olšák mar...@gmail.com wrote:
 This is for GL_ARB_vertex_type_2_10_10_10_rev.
 I just took the code from u_format_table.c. It's based on pack_rgba_float.
 I had no other choice. The u_format hooks are not exactly compatible
 with translate. The cleanup of it is left for future work.

Reviewed-by: Dave Airlie airl...@redhat.com

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


[Mesa-dev] [Bug 44438] New: Configure fails on missing tests/Makefile.in

2012-01-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44438

 Bug #: 44438
   Summary: Configure fails on missing tests/Makefile.in
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: x86-64 (AMD64)
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Other
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: rei4...@gmail.com


Created attachment 55104
  -- https://bugs.freedesktop.org/attachment.cgi?id=55104
Config log

config.status: error: cannot find input file: `tests/Makefile.in'

Introduced in 3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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/2] mesa: Fix glGetTransformFeedbackVarying().

2012-01-04 Thread Eric Anholt
On Tue, 03 Jan 2012 19:19:16 -0800, Ian Romanick i...@freedesktop.org wrote:
 On 01/03/2012 06:52 PM, Eric Anholt wrote:
  The current implementation was totally broken -- it was looking in an
  unpopulated structure for varyings, and trying to do so using the
  current list of varying names, not the list used at link time.
  ---
src/glsl/linker.cpp   |   37 
  +++--
src/mesa/main/mtypes.h|   21 -
src/mesa/main/transformfeedback.c |   37 
  +++--
3 files changed, 62 insertions(+), 33 deletions(-)
 
  diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
  index 6587008..bf72a55 100644
  --- a/src/glsl/linker.cpp
  +++ b/src/glsl/linker.cpp
  @@ -1580,7 +1587,7 @@ tfeedback_decl::assign_location(struct gl_context 
  *ctx,
bool
tfeedback_decl::store(struct gl_shader_program *prog,
  struct gl_transform_feedback_info *info,
  -  unsigned buffer) const
  +  unsigned buffer, unsigned varying) const
{
   if (!this-is_assigned()) {
  /* From GL_EXT_transform_feedback:
  @@ -1602,6 +1609,16 @@ tfeedback_decl::store(struct gl_shader_program *prog,
  ++info-NumOutputs;
  info-BufferStride[buffer] += this-vector_elements;
   }
  +
  +   info-Varyings[varying].Name = ralloc_strdup(prog, this-orig_name);
 
 Judging from the ralloc_free in the next hunk, is prog the right 
 context?  It seems like info-Varyings is better.

Good catch.  At one point I had info-Varyings was embedded in the info,
which made this make sense.


pgpe7DRmNPJVa.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC PATCH] mesa/gl3: introduce a new option to the gl3 version enable.

2012-01-04 Thread Eric Anholt
On Mon,  2 Jan 2012 16:34:23 +, Dave Airlie airl...@gmail.com wrote:
 From: Dave Airlie airl...@redhat.com
 
 EXT_texture_integer isn't strictly equivalent to GL3, the L/I/A integer
 formats are not required in GL3, and some drivers may not require them.
 
 I've no idea if we have any hw that requires it, just sending the patch along
 after discussion on irc.

Given that Mesa just promotes L/I/A up to RGBA, I don't see a reason to
have a distinction.

Re: gpu_shader4 requirement in the text, I'd guess that that was because
it was written pre-130, and the intent was requires the bits of GLSL
required to be able to actually use these shaders, which 130 has.


pgpZBzT1NgK2Z.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel: Re-enable GL_OES_standard_derivatives on GEN4+

2012-01-04 Thread Eric Anholt
On Tue,  3 Jan 2012 19:26:57 -0800, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 This extension only needs to be enabled on GEN3.

disabled.  Other than that,

Reviewed-by: Eric Anholt e...@anholt.net


pgp9ZUAH5fyxL.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx/dri2: print FPS when env var MESA_SHOW_FPS is 1

2012-01-04 Thread Michel Dänzer
On Mit, 2012-01-04 at 06:05 +0100, Marek Olšák wrote: 
 This is useful for apps which don't print FPS.
 Only enabled in SwapBuffers.
 ---
  src/glx/dri2_glx.c |   36 +++-
  1 files changed, 35 insertions(+), 1 deletions(-)
 
 diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
 index a9bcebf..394823a 100644
 --- a/src/glx/dri2_glx.c
 +++ b/src/glx/dri2_glx.c
 @@ -1002,6 +1033,9 @@ dri2CreateScreen(int screen, struct glx_display * priv)
 Xfree(driverName);
 Xfree(deviceName);
  
 +   tmp = getenv(MESA_SHOW_FPS);

BTW, this would be the first environment variable recognized by libGL
that starts with MESA_, so far all of them have started with LIBGL_. Not
sure it's a problem, just pointing it out.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel: Re-enable GL_OES_standard_derivatives on GEN4+

2012-01-04 Thread Kenneth Graunke
On 01/04/2012 12:37 AM, Eric Anholt wrote:
 On Tue,  3 Jan 2012 19:26:57 -0800, Ian Romanick i...@freedesktop.org 
 wrote:
 From: Ian Romanick ian.d.roman...@intel.com

 This extension only needs to be enabled on GEN3.
 
 disabled.  Other than that,
 
 Reviewed-by: Eric Anholt e...@anholt.net

Indeed...disabled on GEN3.  But otherwise,

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] RFC [PATCH 0/7] Fix transform feedback of builtin varyings.

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 06:42 PM, Paul Berry wrote:
[snip]
 Ok, sounds good.  I'm going to consider this an acked-by if that's all
 right with you.  I haven't heard many comments on this patch series, but
 given that it fixes the tests and there hasn't been any negative
 feedback, I think I'm going to consider it good.  I'll plan on pushing
 the patches at the end of the day tomorrow unless I hear other comments.

For the series:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] vl: replace decode_buffers with auxiliary data field

2012-01-04 Thread Christian König

On 03.01.2012 17:03, Maarten Lankhorst wrote:

Hi Christian,

2012/1/2 Christian Königdeathsim...@vodafone.de:

Hi Maarten,

first of all: Happy new Year and sorry for the late reply, have been on
vacation for the last week.


On 29.12.2011 16:41, Maarten Lankhorst wrote:

Hey Christian,

Op 26-12-11 14:00, Christian König schreef:

Based on patches from Maarten Lankhorstm.b.lankho...@gmail.com

Signed-off-by: Christian Königdeathsim...@vodafone.de

diff --git a/src/gallium/include/pipe/p_context.h
b/src/gallium/include/pipe/p_context.h
index de79a9b..f7ee522 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -410,7 +410,8 @@ struct pipe_context {
 enum
pipe_video_profile profile,
 enum
pipe_video_entrypoint entrypoint,
 enum
pipe_video_chroma_format chroma_format,
-   unsigned width,
unsigned height, unsigned max_references );
+   unsigned width,
unsigned height, unsigned max_references,
+   bool
expect_chunked_decode);


I really don't like this part, isn't it implied from entrypoint=
PIPE_VIDEO_ENTRYPOINT_IDCT?

Not necessarily, I'm still trying to give this interface a more general look
and feel.

So for the current use case it can be deduced from the fact that XvMC only
supports entry-points IDCT and MC, while VDPAU only supports bitstream, but
that doesn't necessary have to be always the case.

Even if this is true, it seems like this is a limitation that only
applies to the shader based decoder. The nouveau pmpeg xvmc
implementation in mesa doesn't need it at all.
Not really, for UVD I have pretty much the same problem (but for 
different reasons). Also I don't really see a problem in having driver 
specific bits in the interface as long as it doesn't cause problems for 
other drivers.


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


Re: [Mesa-dev] [PATCH] mesa: Avoid segfault when getting an unbound transform feedback buffer name.

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 02:11 PM, Paul Berry wrote:
 Previously we were using
 gl_transform_feedback_object::Buffers[i]-Name to service an indexed
 get request for GL_TRANSFORM_FEEDBACK_BUFFER_BINDING.  However, if no
 buffer has been bound, gl_transform_feedback_object::Buffers[i] is
 NULL, so this was causing a segfault.
 
 This patch switches to using
 gl_transform_feedback_object::BufferNames[i], which is equal to
 gl_transform_feedback_object::Buffers[i]-Name if
 gl_transform_feedback_object::Buffers[i] is not NULL, and 0 if it is
 NULL.
 
 Fixes piglit test EXT_transform_feedback/get-buffer-state
 indexed_binding.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [PATCH] mesa: Fix transform feedback of unsubscripted arrays.

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 10:35 PM, Paul Berry wrote:
 It is not explicitly stated in the GL 3.0 spec that transform feedback
 can be performed on a whole varying array (without supplying a
 subscript).  However, it seems clear from context that this was the
 intent.  Section 2.15 (TransformFeedback) says this:
 
 When writing varying variables that are arrays, individual array
 elements are written in order.
 
 And section 2.20.3 (Shader Variables), says this, in the description
 of GetTransformFeedbackVarying:
 
 For the selected varying variable, its type is returned into
 type. The size of the varying is returned into size. The value in
 size is in units of the type returned in type.
 
 If it were not possible to perform transform feedback on an
 unsubscripted array, the returned size would always be 1.
 
 This patch fixes the linker so that transform feedback on an
 unsubscripted array is supported.
 
 Fixes piglit tests EXT_transform_feedback/builtin-varyings
 gl_ClipDistance[{4,8}]-no-subscript and
 EXT_transform_feedback/output_type *[2]-no-subscript.
 
 Note: on back-ends that set
 gl_shader_compiler_options::LowerClipDistance (for example i965),
 tests EXT_transform_feedback/builtin-varyings
 gl_ClipDistance[{1,2,3,5,6,7}] still fail.  I hope to address this in
 a later patch.
 ---
  src/glsl/linker.cpp |   99 
 ---
  1 files changed, 54 insertions(+), 45 deletions(-)

Looks good to me.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [PATCH] glx: More hacking around versions of XCB that lack GLX_ARB_create_context support

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 12:32 PM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Detect whether a new enough version of XCB is installed at configure
 time.  If it is not, don't enable the extension and don't build the
 unit tests.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
 Using this patch, I was able to successfully build and run both with
 and without updated XCB bits installed.  I think the lesson learned
 here is that it's nonsense for the GLX part of XCB to live in the XCB
 library.  There's only one user, so it should live there.  Seriously.
 
  configure.ac |   19 +++
  src/glx/clientinfo.c |5 -
  src/glx/create_context.c |2 +-
  src/glx/glxextensions.c  |4 ++--
  tests/glx/Makefile.am|4 +++-
  5 files changed, 29 insertions(+), 5 deletions(-)

Looks okay to me.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 01:03 PM, Paul Berry wrote:
 With the addition of unit tests in commit
 3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4, several additional build
 artifacts are created:
 
   bin/depcomp
   bin/missing
   tests/Makefile
   tests/Makefile.in
   tests/glx/Makefile
   tests/glx/Makefile.in
   tests/glx/.deps/
   tests/glx/.gitignore
 
 This patch adds all of these files to .gitignore.
 ---
  bin/.gitignore   |2 ++
  tests/.gitignore |3 +++
  tests/glx/.gitignore |1 +
  3 files changed, 6 insertions(+), 0 deletions(-)
  create mode 100644 bin/.gitignore
  create mode 100644 tests/.gitignore
  create mode 100644 tests/glx/.gitignore

Acked-by: Kenneth Graunke kenn...@whitecape.org

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


[Mesa-dev] [PATCH] i965: Add missing _NEW_TEXTURE dirty bit to brw_vs_prog state atom.

2012-01-04 Thread Kenneth Graunke
Commit d45814c925dd6c479cfd383b9b59458fc4359cf7 totally added a data
dependency on _NEW_TEXTURE, even including the comment, but didn't
actually add the dirty bit.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_vs.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 6eec973..be1ed00 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -349,6 +349,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
 const struct brw_tracked_state brw_vs_prog = {
.dirty = {
   .mesa  = (_NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT | _NEW_LIGHT |
+   _NEW_TEXTURE |
_NEW_BUFFERS),
   .brw   = (BRW_NEW_VERTEX_PROGRAM |
BRW_NEW_VERTICES),
-- 
1.7.8.1

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


Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-04 Thread Kenneth Graunke
On 01/03/2012 09:43 PM, Marek Olšák wrote:
 On Fri, Oct 28, 2011 at 7:42 PM, Ian Romanick i...@freedesktop.org wrote:
 diff --git a/src/mesa/main/uniform_query.cpp 
 b/src/mesa/main/uniform_query.cpp
 index db2f200..50a724b 100644
 --- a/src/mesa/main/uniform_query.cpp
 +++ b/src/mesa/main/uniform_query.cpp
 @@ -22,15 +22,16 @@
  * 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 stdlib.h
  #include main/core.h
  #include main/context.h
  #include ir.h
  #include ir_uniform.h
 +#include program/hash_table.h
  #include ../glsl/program.h
  #include ../glsl/ir_uniform.h

  extern C {
 -#include main/image.h
  #include main/shaderapi.h
  #include main/shaderobj.h
  #include uniforms.h
 @@ -44,42 +45,30 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint 
 index,
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg =
   _mesa_lookup_shader_program_err(ctx, program, glGetActiveUniform);
 -   const struct gl_program_parameter *param;

if (!shProg)
   return;

 -   if (!shProg-Uniforms || index = shProg-Uniforms-NumUniforms) {
 +   if (index = shProg-NumUserUniformStorage) {
   _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniform(index));
   return;
}

 -   param = get_uniform_parameter(shProg, index);
 -   if (!param)
 -  return;
 -
 -   const struct gl_uniform *const uni = shProg-Uniforms-Uniforms[index];
 +   const struct gl_uniform_storage *const uni = 
 shProg-UniformStorage[index];

if (nameOut) {
 -  _mesa_copy_string(nameOut, maxLength, length, param-Name);
 +  _mesa_copy_string(nameOut, maxLength, length, uni-name);
}

if (size) {
 -  GLint typeSize = _mesa_sizeof_glsl_type(uni-Type-gl_type);
 -  if ((GLint) param-Size  typeSize) {
 - /* This is an array.
 -  * Array elements are placed on vector[4] boundaries so they're
 -  * a multiple of four floats.  We round typeSize up to next 
 multiple
 -  * of four to get the right size below.
 -  */
 - typeSize = (typeSize + 3)  ~3;
 -  }
 -  /* Note that the returned size is in units of the type, not bytes */
 -  *size = param-Size / typeSize;
 +  /* array_elements is zero for non-arrays, but the API requires that 1 
 be
 +   * returned.
 +   */
 +  *size = MAX2(1, uni-array_elements);
}

if (type) {
 -  *type = uni-Type-gl_type;
 +  *type = uni-type-gl_type;
}
  }

 @@ -409,12 +398,21 @@ validate_uniform_parameters(struct gl_context *ctx,

_mesa_uniform_split_location_offset(location, loc, array_index);

 -   if (*loc = shProg-Uniforms-NumUniforms) {
 +   if (*loc = shProg-NumUserUniformStorage) {
   _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
  caller, location);
   return false;
}

 +   /* This case should be impossible.  The implication is that a call like
 +* glGetUniformLocation(prog, foo[8]) was successful but foo is not 
 an
 +* array.
 +*/
 +   if (*array_index != 0  shProg-UniformStorage[*loc].array_elements == 
 0) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
 + caller, location);
 +  return false;
 +   }
return true;
  }

 @@ -423,72 +421,81 @@ validate_uniform_parameters(struct gl_context *ctx,
  */
  extern C void
  _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
 - GLsizei bufSize, GLenum returnType, GLvoid *paramsOut)
 + GLsizei bufSize, enum glsl_base_type returnType,
 + GLvoid *paramsOut)
  {
struct gl_shader_program *shProg =
   _mesa_lookup_shader_program_err(ctx, program, glGetUniformfv);
 -   struct gl_program *prog;
 -   GLint paramPos;
 +   struct gl_uniform_storage *uni;
unsigned loc, offset;

if (!validate_uniform_parameters(ctx, shProg, location, 1,
loc, offset, glGetUniform, true))
   return;

 -   if (!find_uniform_parameter_pos(shProg, loc, prog, paramPos)) {
 -  _mesa_error(ctx, GL_INVALID_OPERATION,  glGetUniformfv(location));
 -   }
 -   else {
 -  const struct gl_program_parameter *p =
 - prog-Parameters-Parameters[paramPos];
 -  gl_constant_value (*values)[4];
 -  GLint rows, cols, i, j, k;
 -  GLsizei numBytes;
 -  GLenum storage_type;
 -
 -  values = prog-Parameters-ParameterValues + paramPos + offset;
 -
 -  get_uniform_rows_cols(p, rows, cols);
 -
 -  numBytes = rows * cols * _mesa_sizeof_type(returnType);
 -  if (bufSize  numBytes) {
 - _mesa_error( ctx, GL_INVALID_OPERATION,
 - glGetnUniformfvARB(out of bounds: bufSize is %d,
 -  but %d bytes are required), bufSize, numBytes );
 - return;
 -  }
 +   uni = shProg-UniformStorage[loc];

 -  if (ctx-Const.NativeIntegers) {
 -storage_type = 

[Mesa-dev] [PATCH] i965/vs: Use the proper dimensionality for the sampler result register.

2012-01-04 Thread Kenneth Graunke
textureSize() returns an int, ivec2, or ivec3, but never an ivec4.
Creating the destination register as an ivec4 triggered later failures,
even though the register did hold the proper values.

For example, piglit test vs-textureSize-compare calls textureSize on a
2D texture and compares the result to an expected value.  Unfortunately,
our generated code also tried to compare the third and fourth components
which were undefined, and failed.

Fixes piglit test vs-textureSize-compare as well as 19 subcases of
oglconform's glsl-bif-tex-size test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44339
Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I was originally seeing a few oglconform regressions from this patch, but
it appears that those tests give completely random results.  At any rate,
this patch does reliably fix a lot of tests, so I'm inclined to apply it.

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 52e63f8..20da487 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1786,7 +1786,7 @@ vec4_visitor::visit(ir_texture *ir)
inst-base_mrf = 2;
inst-mlen = inst-header_present + 1; /* always at least one */
inst-sampler = sampler;
-   inst-dst = dst_reg(this, glsl_type::get_instance(ir-type-base_type,4,1));
+   inst-dst = dst_reg(this, ir-type);
inst-shadow_compare = ir-shadow_comparitor != NULL;
 
if (ir-offset != NULL)
-- 
1.7.8.1

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


[Mesa-dev] [PATCH 2/3] st/mesa: add support for clip vertex.

2012-01-04 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

We need to pass the pre-projection matrix clip planes into the driver,
instead of the post for the case we have a vertex shader that writes clip
vertex.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/mesa/state_tracker/st_atom_clip.c |   20 ++--
 src/mesa/state_tracker/st_program.c   |4 
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_clip.c 
b/src/mesa/state_tracker/st_atom_clip.c
index 1330db8..f1a8979 100644
--- a/src/mesa/state_tracker/st_atom_clip.c
+++ b/src/mesa/state_tracker/st_atom_clip.c
@@ -34,7 +34,7 @@
 #include st_context.h
 #include pipe/p_context.h
 #include st_atom.h
-
+#include st_program.h
 #include cso_cache/cso_context.h
 
 
@@ -45,15 +45,23 @@ static void update_clip( struct st_context *st )
struct pipe_clip_state clip;
const struct gl_context *ctx = st-ctx;
GLuint i;
+   bool use_eye = FALSE;
 
memset(clip, 0, sizeof(clip));
 
+   /* if we have a vertex shader that writes clip vertex we need to pass
+  the pre-projection transformed coordinates into the driver. */
+   if (st-vp) {
+  if (st-vp-Base.Base.OutputsWritten  (1  VERT_RESULT_CLIP_VERTEX))
+ use_eye = TRUE;
+   }
+
for (i = 0; i  PIPE_MAX_CLIP_PLANES; i++) {
   if (ctx-Transform.ClipPlanesEnabled  (1  i)) {
-memcpy(clip.ucp[clip.nr], 
-   ctx-Transform._ClipUserPlane[i], 
-   sizeof(clip.ucp[0]));
-clip.nr++;
+ memcpy(clip.ucp[clip.nr],
+use_eye ? ctx-Transform.EyeUserPlane[i] : 
ctx-Transform._ClipUserPlane[i],
+sizeof(clip.ucp[0]));
+ clip.nr++;
   }
}
 
@@ -69,7 +77,7 @@ static void update_clip( struct st_context *st )
 const struct st_tracked_state st_update_clip = {
st_update_clip,   /* name */
{   /* dirty */
-  (_NEW_TRANSFORM),/* mesa */
+  (_NEW_TRANSFORM|_NEW_PROGRAM),   /* mesa 
*/
   0,   /* st */
},
update_clip /* update */
diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index d62bfcd..3d9d45b 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -260,6 +260,10 @@ st_prepare_vertex_program(struct gl_context *ctx,
 stvp-output_semantic_index[slot] = attr - VERT_RESULT_TEX0;
 break;
 
+ case VERT_RESULT_CLIP_VERTEX:
+stvp-output_semantic_name[slot] = TGSI_SEMANTIC_CLIPVERTEX;
+stvp-output_semantic_index[slot] = 0;
+break;
  case VERT_RESULT_VAR0:
  default:
 assert(attr  VERT_RESULT_MAX);
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 1/3] gallium: add new semantic for clip vertex.

2012-01-04 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This is to match the gl_ClipVertex output from GLSL 1.20.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/gallium/auxiliary/tgsi/tgsi_dump.c |3 ++-
 src/gallium/include/pipe/p_shader_tokens.h |3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index e830aa5..6c5fc68 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -129,7 +129,8 @@ static const char *semantic_names[] =
PRIM_ID,
INSTANCEID,
VERTEXID,
-   STENCIL
+   STENCIL,
+   VERTEXCLIP
 };
 
 static const char *immediate_type_names[] =
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 10cfaf6..35835bb 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -146,7 +146,8 @@ struct tgsi_declaration_dimension
 #define TGSI_SEMANTIC_INSTANCEID 10
 #define TGSI_SEMANTIC_VERTEXID   11
 #define TGSI_SEMANTIC_STENCIL12
-#define TGSI_SEMANTIC_COUNT  13 /** number of semantic values */
+#define TGSI_SEMANTIC_CLIPVERTEX 13
+#define TGSI_SEMANTIC_COUNT  14 /** number of semantic values */
 
 struct tgsi_declaration_semantic
 {
-- 
1.7.7.3

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


[Mesa-dev] gallium clip vertex support + softpipe

2012-01-04 Thread Dave Airlie
Hi,

This is a GLSL 1.20 feature we don't have support for in softpipe, and we
fail the tests, this is just my first attempt to add support, it could
probably be done another way, this just seemed the simplest first cut.

It passes the tests in piglit now, just waiting a full run to see if it does
any damage.

Dave.
p.s. i hate clipping.

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


Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-04 Thread Marek Olšák
On Wed, Jan 4, 2012 at 12:28 PM, Kenneth Graunke kenn...@whitecape.org wrote:
 On 01/03/2012 09:43 PM, Marek Olšák wrote:
 On Fri, Oct 28, 2011 at 7:42 PM, Ian Romanick i...@freedesktop.org wrote:
 diff --git a/src/mesa/main/uniform_query.cpp 
 b/src/mesa/main/uniform_query.cpp
 index db2f200..50a724b 100644
 --- a/src/mesa/main/uniform_query.cpp
 +++ b/src/mesa/main/uniform_query.cpp
 @@ -22,15 +22,16 @@
  * 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 stdlib.h
  #include main/core.h
  #include main/context.h
  #include ir.h
  #include ir_uniform.h
 +#include program/hash_table.h
  #include ../glsl/program.h
  #include ../glsl/ir_uniform.h

  extern C {
 -#include main/image.h
  #include main/shaderapi.h
  #include main/shaderobj.h
  #include uniforms.h
 @@ -44,42 +45,30 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint 
 index,
    GET_CURRENT_CONTEXT(ctx);
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program, glGetActiveUniform);
 -   const struct gl_program_parameter *param;

    if (!shProg)
       return;

 -   if (!shProg-Uniforms || index = shProg-Uniforms-NumUniforms) {
 +   if (index = shProg-NumUserUniformStorage) {
       _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniform(index));
       return;
    }

 -   param = get_uniform_parameter(shProg, index);
 -   if (!param)
 -      return;
 -
 -   const struct gl_uniform *const uni = shProg-Uniforms-Uniforms[index];
 +   const struct gl_uniform_storage *const uni = 
 shProg-UniformStorage[index];

    if (nameOut) {
 -      _mesa_copy_string(nameOut, maxLength, length, param-Name);
 +      _mesa_copy_string(nameOut, maxLength, length, uni-name);
    }

    if (size) {
 -      GLint typeSize = _mesa_sizeof_glsl_type(uni-Type-gl_type);
 -      if ((GLint) param-Size  typeSize) {
 -         /* This is an array.
 -          * Array elements are placed on vector[4] boundaries so they're
 -          * a multiple of four floats.  We round typeSize up to next 
 multiple
 -          * of four to get the right size below.
 -          */
 -         typeSize = (typeSize + 3)  ~3;
 -      }
 -      /* Note that the returned size is in units of the type, not bytes 
 */
 -      *size = param-Size / typeSize;
 +      /* array_elements is zero for non-arrays, but the API requires that 
 1 be
 +       * returned.
 +       */
 +      *size = MAX2(1, uni-array_elements);
    }

    if (type) {
 -      *type = uni-Type-gl_type;
 +      *type = uni-type-gl_type;
    }
  }

 @@ -409,12 +398,21 @@ validate_uniform_parameters(struct gl_context *ctx,

    _mesa_uniform_split_location_offset(location, loc, array_index);

 -   if (*loc = shProg-Uniforms-NumUniforms) {
 +   if (*loc = shProg-NumUserUniformStorage) {
       _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
                  caller, location);
       return false;
    }

 +   /* This case should be impossible.  The implication is that a call like
 +    * glGetUniformLocation(prog, foo[8]) was successful but foo is not 
 an
 +    * array.
 +    */
 +   if (*array_index != 0  shProg-UniformStorage[*loc].array_elements == 
 0) {
 +      _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
 +                 caller, location);
 +      return false;
 +   }
    return true;
  }

 @@ -423,72 +421,81 @@ validate_uniform_parameters(struct gl_context *ctx,
  */
  extern C void
  _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
 -                 GLsizei bufSize, GLenum returnType, GLvoid *paramsOut)
 +                 GLsizei bufSize, enum glsl_base_type returnType,
 +                 GLvoid *paramsOut)
  {
    struct gl_shader_program *shProg =
       _mesa_lookup_shader_program_err(ctx, program, glGetUniformfv);
 -   struct gl_program *prog;
 -   GLint paramPos;
 +   struct gl_uniform_storage *uni;
    unsigned loc, offset;

    if (!validate_uniform_parameters(ctx, shProg, location, 1,
                                    loc, offset, glGetUniform, true))
       return;

 -   if (!find_uniform_parameter_pos(shProg, loc, prog, paramPos)) {
 -      _mesa_error(ctx, GL_INVALID_OPERATION,  glGetUniformfv(location));
 -   }
 -   else {
 -      const struct gl_program_parameter *p =
 -         prog-Parameters-Parameters[paramPos];
 -      gl_constant_value (*values)[4];
 -      GLint rows, cols, i, j, k;
 -      GLsizei numBytes;
 -      GLenum storage_type;
 -
 -      values = prog-Parameters-ParameterValues + paramPos + offset;
 -
 -      get_uniform_rows_cols(p, rows, cols);
 -
 -      numBytes = rows * cols * _mesa_sizeof_type(returnType);
 -      if (bufSize  numBytes) {
 -         _mesa_error( ctx, GL_INVALID_OPERATION,
 -                     glGetnUniformfvARB(out of bounds: bufSize is %d,
 -                      but %d bytes are required), bufSize, numBytes );
 -         return;
 -      }
 +   uni = 

Re: [Mesa-dev] [PATCH] glx/dri2: print FPS when env var MESA_SHOW_FPS is 1

2012-01-04 Thread Marek Olšák
2012/1/4 Michel Dänzer mic...@daenzer.net:
 On Mit, 2012-01-04 at 06:05 +0100, Marek Olšák wrote:
 This is useful for apps which don't print FPS.
 Only enabled in SwapBuffers.
 ---
  src/glx/dri2_glx.c |   36 +++-
  1 files changed, 35 insertions(+), 1 deletions(-)

 diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
 index a9bcebf..394823a 100644
 --- a/src/glx/dri2_glx.c
 +++ b/src/glx/dri2_glx.c
 @@ -576,6 +582,26 @@ unsigned dri2GetSwapEventType(Display* dpy, XID 
 drawable)
        return glx_dpy-codes-first_event + GLX_BufferSwapComplete;
  }

 +static void show_fps()
 +{
 +   struct glx_context *gc = __glXGetCurrentContext();
 +   struct dri2_context *ctx = (struct dri2_context *)gc;

 glXSwapBuffers doesn't require a current context (or that the drawable
 being swapped is bound to the current context). The information should
 probably be tracked per drawable instead.

Okay, I'll make the state per drawable, but dri2Throttle calls
__glXGetCurrentContext() too.



 @@ -611,9 +637,14 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t 
 target_msc, int64_t divisor,

         DRI2SwapBuffers(psc-base.dpy, pdraw-xDrawable,
                      target_msc, divisor, remainder, ret);
 +

 Spurious whitespace-only change.


 #endif
      }

 +    if (psc-show_fps) {
 +       show_fps();
 +    }
 +
      /* Old servers don't send invalidate events */
      if (!pdp-invalidateAvailable)
         dri2InvalidateBuffers(dpyPriv-dpy, pdraw-xDrawable);

 This really measures how quickly requests are sent to the X server. When
 possible, it might be more accurate to use the information from the
 completion events instead. Not a blocker though.

Sorry, I am adding something to glx/dri2 for the first time. What
completion events? It doesn't matter if the measuring is done before
or after SwapBuffers. The only requirement is that it must be done
once per frame.

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


Re: [Mesa-dev] [PATCH] glx/dri2: print FPS when env var MESA_SHOW_FPS is 1

2012-01-04 Thread Michel Dänzer
On Mit, 2012-01-04 at 15:04 +0100, Marek Olšák wrote: 
 2012/1/4 Michel Dänzer mic...@daenzer.net:
  On Mit, 2012-01-04 at 06:05 +0100, Marek Olšák wrote:
  This is useful for apps which don't print FPS.
  Only enabled in SwapBuffers.
  ---
   src/glx/dri2_glx.c |   36 +++-
   1 files changed, 35 insertions(+), 1 deletions(-)
 
  diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
  index a9bcebf..394823a 100644
  --- a/src/glx/dri2_glx.c
  +++ b/src/glx/dri2_glx.c
  @@ -576,6 +582,26 @@ unsigned dri2GetSwapEventType(Display* dpy, XID 
  drawable)
 return glx_dpy-codes-first_event + GLX_BufferSwapComplete;
   }
 
  +static void show_fps()
  +{
  +   struct glx_context *gc = __glXGetCurrentContext();
  +   struct dri2_context *ctx = (struct dri2_context *)gc;
 
  glXSwapBuffers doesn't require a current context (or that the drawable
  being swapped is bound to the current context). The information should
  probably be tracked per drawable instead.
 
 Okay, I'll make the state per drawable,

Thanks.

 but dri2Throttle calls __glXGetCurrentContext() too.

However, it handles the return value being NULL. Your code would have
crashed in that case.

While we've had a number of such artifical dependencies on a current
context in the SwapBuffers paths, I'm trying to prevent more from
getting added.


  #endif
   }
 
  +if (psc-show_fps) {
  +   show_fps();
  +}
  +
   /* Old servers don't send invalidate events */
   if (!pdp-invalidateAvailable)
  dri2InvalidateBuffers(dpyPriv-dpy, pdraw-xDrawable);
 
  This really measures how quickly requests are sent to the X server. When
  possible, it might be more accurate to use the information from the
  completion events instead. Not a blocker though.
 
 Sorry, I am adding something to glx/dri2 for the first time. What
 completion events? It doesn't matter if the measuring is done before
 or after SwapBuffers. The only requirement is that it must be done
 once per frame.

See the hits for

grep -i swap.*complete src/glx/*.[ch]

Basically, the X server sends an event to the client with information
about when the swap actually occurred. That might allow for more
accurate measurements at least in some cases, but as I said it's not a
blocker but could always be done as a followup change later on if
anyone's so inclined.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium: add STATIC_ASSERT macro

2012-01-04 Thread Brian Paul
---
 src/gallium/include/pipe/p_compiler.h |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_compiler.h 
b/src/gallium/include/pipe/p_compiler.h
index 6ac3644..1daa5ab 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -308,6 +308,17 @@ void _ReadWriteBarrier(void);
 #endif
 
 
+/**
+ * Static (compile-time) assertion.
+ * Basically, use COND to dimension an array.  If COND is false/zero the
+ * array size will be -1 and we'll get a compilation error.
+ */
+#define STATIC_ASSERT(COND) \
+   do { \
+  typedef int static_assertion_failed[(!!(COND))*2-1]; \
+   } while (0)
+
+
 #if defined(__cplusplus)
 }
 #endif
-- 
1.7.3.4

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


[Mesa-dev] [PATCH 2/2] tgsi: consolidate TGSI string arrays in new tgsi_strings.h

2012-01-04 Thread Brian Paul
There was some duplication between the tgsi_dump.c and tgsi_text.c
files.  Also use some static assertions to help catch errors when
adding new TGSI values.
---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c |1 +
 src/gallium/auxiliary/tgsi/tgsi_dump.c   |  139 +
 src/gallium/auxiliary/tgsi/tgsi_dump.h   |   21 ---
 src/gallium/auxiliary/tgsi/tgsi_strings.h|  186 ++
 src/gallium/auxiliary/tgsi/tgsi_text.c   |   84 +-
 5 files changed, 199 insertions(+), 232 deletions(-)
 create mode 100644 src/gallium/auxiliary/tgsi/tgsi_strings.h

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index b9a5c5c..3373ed4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -31,6 +31,7 @@
 #include tgsi/tgsi_parse.h
 #include tgsi/tgsi_util.h
 #include tgsi/tgsi_dump.h
+#include tgsi/tgsi_strings.h
 #include lp_bld_debug.h
 #include lp_bld_tgsi.h
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index e830aa5..9963445 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -32,6 +32,7 @@
 #include tgsi_dump.h
 #include tgsi_info.h
 #include tgsi_iterate.h
+#include tgsi_strings.h
 
 
 /** Number of spaces to indent for IF/LOOP/etc */
@@ -83,62 +84,6 @@ dump_enum(
 #define FLT(F)  ctx-printf( ctx, %10.4f, F )
 #define ENM(E,ENUMS)dump_enum( ctx, E, ENUMS, sizeof( ENUMS ) / sizeof( 
*ENUMS ) )
 
-static const char *processor_type_names[] =
-{
-   FRAG,
-   VERT,
-   GEOM
-};
-
-const char *
-tgsi_file_names[TGSI_FILE_COUNT] =
-{
-   NULL,
-   CONST,
-   IN,
-   OUT,
-   TEMP,
-   SAMP,
-   ADDR,
-   IMM,
-   PRED,
-   SV,
-   IMMX,
-   TEMPX,
-   RES
-};
-
-static const char *interpolate_names[] =
-{
-   CONSTANT,
-   LINEAR,
-   PERSPECTIVE
-};
-
-static const char *semantic_names[] =
-{
-   POSITION,
-   COLOR,
-   BCOLOR,
-   FOG,
-   PSIZE,
-   GENERIC,
-   NORMAL,
-   FACE,
-   EDGEFLAG,
-   PRIM_ID,
-   INSTANCEID,
-   VERTEXID,
-   STENCIL
-};
-
-static const char *immediate_type_names[] =
-{
-   FLT32,
-   UINT32,
-   INT32
-};
-
 const char *
 tgsi_swizzle_names[4] =
 {
@@ -148,75 +93,6 @@ tgsi_swizzle_names[4] =
w
 };
 
-const char *
-tgsi_texture_names[TGSI_TEXTURE_COUNT] =
-{
-   UNKNOWN,
-   1D,
-   2D,
-   3D,
-   CUBE,
-   RECT,
-   SHADOW1D,
-   SHADOW2D,
-   SHADOWRECT,
-   1DARRAY,
-   2DARRAY,
-   SHADOW1DARRAY,
-   SHADOW2DARRAY,
-};
-
-const char *tgsi_property_names[TGSI_PROPERTY_COUNT] =
-{
-   GS_INPUT_PRIMITIVE,
-   GS_OUTPUT_PRIMITIVE,
-   GS_MAX_OUTPUT_VERTICES,
-   FS_COORD_ORIGIN,
-   FS_COORD_PIXEL_CENTER,
-   FS_COLOR0_WRITES_ALL_CBUFS,
-   FS_DEPTH_LAYOUT
-};
-
-static const char *tgsi_type_names[] =
-{
-   UNORM,
-   SNORM,
-   SINT,
-   UINT,
-   FLOAT
-};
-
-const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
-{
-   POINTS,
-   LINES,
-   LINE_LOOP,
-   LINE_STRIP,
-   TRIANGLES,
-   TRIANGLE_STRIP,
-   TRIANGLE_FAN,
-   QUADS,
-   QUAD_STRIP,
-   POLYGON,
-   LINES_ADJACENCY,
-   LINE_STRIP_ADJACENCY,
-   TRIANGLES_ADJACENCY,
-   TRIANGLE_STRIP_ADJACENCY
-};
-
-const char *tgsi_fs_coord_origin_names[2] =
-{
-   UPPER_LEFT,
-   LOWER_LEFT
-};
-
-const char *tgsi_fs_coord_pixel_center_names[2] =
-{
-   HALF_INTEGER,
-   INTEGER
-};
-
-
 static void
 _dump_register_src(
struct dump_ctx *ctx,
@@ -367,9 +243,6 @@ iter_declaration(
 {
struct dump_ctx *ctx = (struct dump_ctx *)iter;
 
-   assert(Elements(semantic_names) == TGSI_SEMANTIC_COUNT);
-   assert(Elements(interpolate_names) == TGSI_INTERPOLATE_COUNT);
-
TXT( DCL  );
 
ENM(decl-Declaration.File, tgsi_file_names);
@@ -400,7 +273,7 @@ iter_declaration(
 
if (decl-Declaration.Semantic) {
   TXT( ,  );
-  ENM( decl-Semantic.Name, semantic_names );
+  ENM( decl-Semantic.Name, tgsi_semantic_names );
   if (decl-Semantic.Index != 0 ||
   decl-Semantic.Name == TGSI_SEMANTIC_GENERIC) {
  CHR( '[' );
@@ -433,7 +306,7 @@ iter_declaration(
decl-Declaration.File == TGSI_FILE_INPUT)
{
   TXT( ,  );
-  ENM( decl-Declaration.Interpolate, interpolate_names );
+  ENM( decl-Declaration.Interpolate, tgsi_interpolate_names );
}
 
if (decl-Declaration.Centroid) {
@@ -521,8 +394,6 @@ iter_property(
int i;
struct dump_ctx *ctx = (struct dump_ctx *)iter;
 
-   assert(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT);
-
TXT( PROPERTY  );
ENM(prop-Property.PropertyName, tgsi_property_names);
 
@@ -571,7 +442,7 @@ iter_immediate(
struct dump_ctx *ctx = (struct dump_ctx *) iter;
 
TXT( IMM  );
-   ENM( imm-Immediate.DataType, immediate_type_names );
+   ENM( imm-Immediate.DataType, tgsi_immediate_type_names );
 
dump_imm_data(iter, imm-u, imm-Immediate.NrTokens - 1,
  imm-Immediate.DataType);
@@ -753,7 +624,7 @@ prolog(

Re: [Mesa-dev] [PATCH] drisw: Fix drawable creation against non-default screens

2012-01-04 Thread Adam Jackson
On Tue, 2012-01-03 at 19:14 -0800, Ian Romanick wrote:

 Okay.  If some of that gets captured in the commit message, the change is
 
 Reviewed-by: Ian Romanick ian.d.roman...@intel.com

Pushed with better commit message, thanks.

- ajax


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] gallium clip vertex support + softpipe

2012-01-04 Thread Brian Paul

On 01/04/2012 05:12 AM, Dave Airlie wrote:

Hi,

This is a GLSL 1.20 feature we don't have support for in softpipe, and we
fail the tests, this is just my first attempt to add support, it could
probably be done another way, this just seemed the simplest first cut.

It passes the tests in piglit now, just waiting a full run to see if it does
any damage.

Dave.
p.s. i hate clipping.



This looks pretty good, Dave.  I just have a few minor comments but 
otherwise:  Reviewed-by: Brian Paul bri...@vmware.com

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


Re: [Mesa-dev] [PATCH 1/3] gallium: add new semantic for clip vertex.

2012-01-04 Thread Brian Paul

On 01/04/2012 05:12 AM, Dave Airlie wrote:

From: Dave Airlieairl...@redhat.com

This is to match the gl_ClipVertex output from GLSL 1.20.

Signed-off-by: Dave Airlieairl...@redhat.com
---
  src/gallium/auxiliary/tgsi/tgsi_dump.c |3 ++-
  src/gallium/include/pipe/p_shader_tokens.h |3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index e830aa5..6c5fc68 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -129,7 +129,8 @@ static const char *semantic_names[] =
 PRIM_ID,
 INSTANCEID,
 VERTEXID,
-   STENCIL
+   STENCIL,
+   VERTEXCLIP
  };


There's also an array of semantic strings in tgsi_text.c.  But I just 
posted a patch to consolidate these string arrays and add static 
assertions to void missing things like that in the future.





  static const char *immediate_type_names[] =
diff --git a/src/gallium/include/pipe/p_shader_tokens.h 
b/src/gallium/include/pipe/p_shader_tokens.h
index 10cfaf6..35835bb 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -146,7 +146,8 @@ struct tgsi_declaration_dimension
  #define TGSI_SEMANTIC_INSTANCEID 10
  #define TGSI_SEMANTIC_VERTEXID   11
  #define TGSI_SEMANTIC_STENCIL12
-#define TGSI_SEMANTIC_COUNT  13 /**  number of semantic values */
+#define TGSI_SEMANTIC_CLIPVERTEX 13
+#define TGSI_SEMANTIC_COUNT  14 /**  number of semantic values */

  struct tgsi_declaration_semantic
  {


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


Re: [Mesa-dev] [PATCH 3/3] draw/softpipe: add clip vertex support.

2012-01-04 Thread Brian Paul

On 01/04/2012 05:13 AM, Dave Airlie wrote:

From: Dave Airlieairl...@redhat.com

softpipe always clipped using the position vector, however for unclipped
vertices it stored the position in window coordinates, however when position
and clipping are separated, we need to store the clip-space position and
the clip-space vertex clip, so we can interpolate both separately.

This means we have to take the clip space position and store it to use later.

This allows softpipe to pass all the clip-vertex piglit tests.

Signed-off-by: Dave Airlieairl...@redhat.com
---
  src/gallium/auxiliary/draw/draw_cliptest_tmp.h |   18 --
  src/gallium/auxiliary/draw/draw_context.c  |   10 ++
  src/gallium/auxiliary/draw/draw_pipe_clip.c|9 ++---
  src/gallium/auxiliary/draw/draw_private.h  |5 +++--
  src/gallium/auxiliary/draw/draw_pt_fetch.c |4 ++--
  src/gallium/auxiliary/draw/draw_vs.c   |9 +
  src/gallium/auxiliary/draw/draw_vs.h   |1 +
  7 files changed, 43 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h 
b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
index 1ca1529..7ae95a6 100644
--- a/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_cliptest_tmp.h
@@ -35,11 +35,13 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
 const float *trans = pvs-draw-viewport.translate;
 /* const */ float (*plane)[4] = pvs-draw-plane;
 const unsigned pos = draw_current_shader_position_output(pvs-draw);
+   const unsigned cv = draw_current_shader_clipvertex_output(pvs-draw);
 const unsigned ef = pvs-draw-vs.edgeflag_output;
 const unsigned nr = pvs-draw-nr_planes;
 const unsigned flags = (FLAGS);
 unsigned need_pipeline = 0;
 unsigned j;
+   unsigned i;

 for (j = 0; j  info-count; j++) {
float *position = out-data[pos];
@@ -49,10 +51,15 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,

if (flags  (DO_CLIP_XY | DO_CLIP_XY_GUARD_BAND |
 DO_CLIP_FULL_Z | DO_CLIP_HALF_Z | DO_CLIP_USER)) {
- out-clip[0] = position[0];
- out-clip[1] = position[1];
- out-clip[2] = position[2];
- out-clip[3] = position[3];
+ float *clipvertex = position;
+
+ if ((flags  DO_CLIP_USER)  cv != pos)
+clipvertex = out-data[cv];
+
+ for (i = 0; i  4; i++) {
+out-clip[i] = clipvertex[i];
+out-pre_clip_pos[i] = position[i];
+ }

   /* Do the hardwired planes first:
*/
@@ -81,9 +88,8 @@ static boolean TAG(do_cliptest)( struct pt_post_vs *pvs,
   }

   if (flags  DO_CLIP_USER) {
-unsigned i;
  for (i = 6; i  nr; i++) {
-   if (dot4(position, plane[i])  0)
+   if (dot4(clipvertex, plane[i])  0)
mask |= (1i);
  }
   }
diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 9c00687..6b58073 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -675,6 +675,16 @@ draw_current_shader_position_output(const struct 
draw_context *draw)


  /**
+ * Return the index of the shader output which will contain the
+ * vertex position.
+ */
+uint
+draw_current_shader_clipvertex_output(const struct draw_context *draw)
+{
+   return draw-vs.clipvertex_output;
+}
+
+/**
   * Return a pointer/handle for a driver/CSO rasterizer object which
   * disabled culling, stippling, unfilled tris, etc.
   * This is used by some pipeline stages (such as wide_point, aa_line
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c 
b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index e1eabe2..fbc8f67 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -118,6 +118,7 @@ static void interp( const struct clip_stage *clip,
  {
 const unsigned nr_attrs = draw_current_shader_outputs(clip-stage.draw);
 const unsigned pos_attr = 
draw_current_shader_position_output(clip-stage.draw);
+   const unsigned clip_attr = 
draw_current_shader_clipvertex_output(clip-stage.draw);
 unsigned j;

 /* Vertex header.
@@ -130,12 +131,14 @@ static void interp( const struct clip_stage *clip,
 /* Interpolate the clip-space coords.
  */
 interp_attr(dst-clip, t, in-clip, out-clip);
+   /* interpolate the clip-space position */
+   interp_attr(dst-pre_clip_pos, t, in-pre_clip_pos, out-pre_clip_pos);

 /* Do the projective divide and viewport transformation to get
  * new window coordinates:
  */
 {
-  const float *pos = dst-clip;
+  const float *pos = dst-pre_clip_pos;
const float *scale = clip-stage.draw-viewport.scale;
const float *trans = clip-stage.draw-viewport.translate;
const float oow = 1.0f / pos[3];
@@ -149,8 +152,8 @@ 

Re: [Mesa-dev] [PATCH] glx: More hacking around versions of XCB that lack GLX_ARB_create_context support

2012-01-04 Thread Robert Hooker
dri builds are fine with this, but

./configure --prefix=/usr --mandir=\${prefix}/share/man \
             --infodir=\${prefix}/share/info --sysconfdir=/etc \
             --libdir=\${prefix}/lib/x86_64-linux-gnu \
             --localstatedir=/var --build=x86_64-linux-gnu
--disable-egl --with-gallium-drivers= --with-driver=xlib CFLAGS=-Wall
-g -O2 CXXFLAGS=-Wall -g -O2

fails with

configure: error: conditional HAVE_XCB_GLX_CREATE_CONTEXT was never defined.
Usually this means the macro was only invoked conditionally.


osmesa builds with these configure options also fail the same way

./configure --prefix=/usr --mandir=\${prefix}/share/man \
 --infodir=\${prefix}/share/info --sysconfdir=/etc \
 --libdir=\${prefix}/lib/x86_64-linux-gnu \
 --localstatedir=/var --build=x86_64-linux-gnu
--disable-egl --with-gallium-drivers= --with-driver=osmesa
--disable-glu  CFLAGS=-Wall -g -O2 CXXFLAGS=-Wall -g -O2
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa/main: fix incorrect use of _mesa_ffsll. _mesa_ffsll may or may not be defined on GNUC

2012-01-04 Thread Alexander von Gluck

On 03.01.2012 16:54, Brian Paul wrote:

On Tue, Jan 3, 2012 at 1:49 PM, Alexander von Gluck
kallis...@unixzen.com wrote:

---
 src/mesa/main/arrayobj.c |    2 +-
 src/mesa/main/imports.h  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4b3e07b..29bfed8 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -303,7 +303,7 @@ _mesa_update_array_object_max_element(struct 
gl_context

*ctx,
   GLuint min = ~0u;

   while (enabled) {
-      GLint attrib = _mesa_ffsll(enabled) - 1;
+      GLint attrib = ffsll(enabled) - 1;


Why are you changing this line?  On a non-gnu platform we may not have 
ffsll().


You're right, I have a much better patch that simplifies this logic in 
flight.


The reasoning was that I kept running into undefined ffsll in my final 
binaries.
_mesa_ffs makes some strange assumptions on the existence of ffs without 
ensuring it exists first.


A new patch should be on the ML soon, please closely look at it to make sure 
i'm not missing any logic anywhere.


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


[Mesa-dev] [PATCH] mesa: fix situations where ffs or ffsl may not be defined

2012-01-04 Thread Alexander von Gluck


---
 src/mesa/main/imports.h |   16 
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index b7e8743..522ffeb 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -568,13 +568,19 @@ _mesa_init_sqrt_table(void);

 #ifdef __GNUC__

-#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID) || 
defined(__APPLE__)

+#if ((__GNUC__ * 100 + __GNUC_MINOR__) = 304) /* gcc 3.4 or later */
 #define ffs __builtin_ffs
 #define ffsll __builtin_ffsll
+#define _mesa_ffs __builtin_ffs
+#define _mesa_ffsll __builtin_ffsll
+#else /* older GCC, no builtin */
+#include string.h
+extern int
+_mesa_ffs(int32_t i);
+extern int
+_mesa_ffsll(int64_t i);
 #endif

-#define _mesa_ffs(i)  ffs(i)
-#define _mesa_ffsll(i)  ffsll(i)

 #if ((__GNUC__ * 100 + __GNUC_MINOR__) = 304) /* gcc 3.4 or later */
 #define _mesa_bitcount(i) __builtin_popcount(i)
@@ -586,7 +592,9 @@ extern unsigned int
 _mesa_bitcount_64(uint64_t n);
 #endif

-#else
+#else /* non-GNUC */
+#include strings.h
+
 extern int
 _mesa_ffs(int32_t i);

--
1.7.7.2

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


Re: [Mesa-dev] [PATCH] Bug 44205 - read from pointer after free

2012-01-04 Thread Anuj Phogat
On Tue 03 Jan 2012 07:14:09 PM PST, Ian Romanick wrote:
 On 01/03/2012 06:36 PM, Anuj Phogat wrote:
 Coverity reported a read from pointer after free defect in
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c
 In intel_miptree_all_slices_resolve() function, i = i-next was
 executing after freeing i. I have defined a temporary variable
 (next) to store the value of i-next before freeing i

 Reported-by: Vinson Leev...@vmware.com
 Signed-off-by: Anuj Phogatanuj.pho...@gmail.com

 I suggest changing the short commit message to Don't read node next
 pointer after freeing node and adding

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

 to the commit message.  Then it's

 Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Ian, I pushed the changes before seeing you e-mail with a modified 
commit message:

Fix read from pointer after free

Coverity reported a read from pointer after free defect in
src/mesa/drivers/dri/intel/intel_mipmap_tree.c. Bug# 44205
In intel_miptree_all_slices_resolve() function, i = i-next was
executing after freeing i. I have defined a temporary variable
(next) to store the value of i-next before freeing i

Thanks
Anuj

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


Re: [Mesa-dev] [PATCH] vbo: introduce vbo_get_minmax_indices function

2012-01-04 Thread Roland Scheidegger
Am 04.01.2012 04:20, schrieb Yuanhan Liu:
 On Tue, Jan 03, 2012 at 08:25:31PM +0100, Roland Scheidegger wrote:
 Ah index scanning...
 I don't like that this will map/unmap the ib once for each prim,
 Me either :)
 
 though
 I don't really see a nice way to avoid that (I think if you have to
 
 Well, I thought a while, we may do some combine to reduce some
 map/unmap.
Yes, as long as the ranges are sequential it's not that bad.
You could get really fancy and merge all ranges (which would also avoid
having to scan some indices multiple times when the ranges overlap) but
that's not what I would qualify as nice.
So I'm just not sure it's worth bothering for this (hopefully) corner case.

Roland

 
 
 actually map the ib, you lose anyway). Hopefully won't hit that
 performance hog often...
 A comment inline.


 Am 31.12.2011 07:32, schrieb Yuanhan Liu:
 [snip]...
 
 +   for (i = 0; i  nr_prims; i++) {
 +  tmp_ib.ptr = ib-ptr + prims[i].start * vbo_sizeof_ib_type(ib-type);
 I think you should not use a temporary ib. Figuring out the correct
 start offset clearly looks like it should be handled by
 vbo_get_minmax_index() itself (it should have done this previously
 probably, as there might never have been a guarantee that it is always 0
 even if there's only a single primitive).
 
 Nice suggestion, thanks! Will fix it in the next patch.
 
 --
 Yuanhan Liu

 +  vbo_get_minmax_index(ctx, prims[i], tmp_ib, tmp_min, tmp_max);
 +  *min_index = MIN2(*min_index, tmp_min);
 +  *max_index = MAX2(*max_index, tmp_max);
 +   }
 +}
 +
  
  /**
   * Check that element 'j' of the array has reasonable data.

 Otherwise looks ok to me.

 Roland

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


Re: [Mesa-dev] [PATCH] vbo: introduce vbo_get_minmax_indices function

2012-01-04 Thread Roland Scheidegger
Am 04.01.2012 04:59, schrieb Yuanhan Liu:
 On Wed, Jan 04, 2012 at 11:20:07AM +0800, Yuanhan Liu wrote:
 On Tue, Jan 03, 2012 at 08:25:31PM +0100, Roland Scheidegger wrote:
 Ah index scanning...
 I don't like that this will map/unmap the ib once for each prim,
 Me either :)

 though
 I don't really see a nice way to avoid that (I think if you have to

 Well, I thought a while, we may do some combine to reduce some
 map/unmap.
 
 Ok, here is the new patch, please help to review it.
 
 And Brian, since it touches the mesa core, it would be nice if you'd
 review it.
Looks good to me.
Reviewed-by: Roland Scheidegger srol...@vmware.com

 --
 
 From 7956b5c93bdfd0e94b6d3e25336c99cd7457f550 Mon Sep 17 00:00:00 2001
 From: Yuanhan Liu yuanhan@linux.intel.com
 Date: Sat, 31 Dec 2011 14:22:46 +0800
 Subject: [PATCH] vbo: introduce vbo_get_minmax_indices function
 
 Introduce vbo_get_minmax_indices() function to handle the min/max index
 computation for nr_prims(= 1). The old code just compute the first
 prim's min/max index; this would results an error rendering if user
 called functions like glMultiDrawElements(). This patch servers as
 fixing this issue.
 
 As when nr_prims = 1, we can pass 1 to paramter nr_prims, thus I made
 vbo_get_minmax_index() static.
 
 v2: per Roland's suggestion, put the indices address compuation into
 vbo_get_minmax_index() instead.
 
 Also do comination if possible to reduce map/unmap count
 
 Signed-off-by: Yuanhan Liu yuanhan@linux.intel.com
 ---
  src/mesa/drivers/dri/i965/brw_draw.c |2 +-
  src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |3 +-
  src/mesa/main/api_validate.c |2 +-
  src/mesa/state_tracker/st_draw.c |3 +-
  src/mesa/state_tracker/st_draw_feedback.c|2 +-
  src/mesa/tnl/t_draw.c|2 +-
  src/mesa/vbo/vbo.h   |6 ++--
  src/mesa/vbo/vbo_exec_array.c|   49 +
  8 files changed, 52 insertions(+), 17 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
 b/src/mesa/drivers/dri/i965/brw_draw.c
 index 621195d..f50fffd 100644
 --- a/src/mesa/drivers/dri/i965/brw_draw.c
 +++ b/src/mesa/drivers/dri/i965/brw_draw.c
 @@ -586,7 +586,7 @@ void brw_draw_prims( struct gl_context *ctx,
  
 if (!vbo_all_varyings_in_vbos(arrays)) {
if (!index_bounds_valid)
 -  vbo_get_minmax_index(ctx, prim, ib, min_index, max_index);
 +  vbo_get_minmax_indices(ctx, prim, ib, min_index, max_index, 
 nr_prims);
  
/* Decide if we want to rebase.  If so we end up recursing once
 * only into this function.
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
 index de04d18..59f1542 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
 @@ -437,7 +437,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
   struct nouveau_render_state *render = to_render_state(ctx);
  
   if (!index_bounds_valid)
 - vbo_get_minmax_index(ctx, prims, ib, min_index, max_index);
 + vbo_get_minmax_indices(ctx, prims, ib, min_index, max_index,
 +nr_prims);
  
   vbo_choose_render_mode(ctx, arrays);
   vbo_choose_attrs(ctx, arrays);
 diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
 index 945f127..b6871d0 100644
 --- a/src/mesa/main/api_validate.c
 +++ b/src/mesa/main/api_validate.c
 @@ -184,7 +184,7 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, 
 GLenum type,
 ib.ptr = indices;
 ib.obj = ctx-Array.ArrayObj-ElementArrayBufferObj;
  
 -   vbo_get_minmax_index(ctx, prim, ib, min, max);
 +   vbo_get_minmax_indices(ctx, prim, ib, min, max, 1);
  
 if ((int)(min + basevertex)  0 ||
 max + basevertex  ctx-Array.ArrayObj-_MaxElement) {
 diff --git a/src/mesa/state_tracker/st_draw.c 
 b/src/mesa/state_tracker/st_draw.c
 index 954f15a..6327a4c 100644
 --- a/src/mesa/state_tracker/st_draw.c
 +++ b/src/mesa/state_tracker/st_draw.c
 @@ -933,7 +933,8 @@ st_draw_vbo(struct gl_context *ctx,
/* Gallium probably doesn't want this in some cases. */
if (!index_bounds_valid)
   if (!all_varyings_in_vbos(arrays))
 -vbo_get_minmax_index(ctx, prims, ib, min_index, max_index);
 +vbo_get_minmax_indices(ctx, prims, ib, min_index, max_index,
 +   nr_prims);
  
for (i = 0; i  nr_prims; i++) {
   num_instances = MAX2(num_instances, prims[i].num_instances);
 diff --git a/src/mesa/state_tracker/st_draw_feedback.c 
 b/src/mesa/state_tracker/st_draw_feedback.c
 index a99eb2b..f38f44c 100644
 --- a/src/mesa/state_tracker/st_draw_feedback.c
 +++ b/src/mesa/state_tracker/st_draw_feedback.c
 @@ -119,7 +119,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
 st_validate_state(st);
  
 if (!index_bounds_valid)
 -  

[Mesa-dev] [PATCH] glx: More hacking around versions of XCB that lack GLX_ARB_create_context support

2012-01-04 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Detect whether a new enough version of XCB is installed at configure
time.  If it is not, don't enable the extension and don't build the
unit tests.

v2: Move the AM_CONDIATION outside the case-statement so that it is
invoked even for non-GLX builds.  This prevents build failures with
osmesa, for example.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 configure.ac |   22 ++
 src/glx/clientinfo.c |5 -
 src/glx/create_context.c |2 +-
 src/glx/glxextensions.c  |4 ++--
 tests/glx/Makefile.am|4 +++-
 5 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2d31273..dfffdf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1030,12 +1030,34 @@ xyesno)
 GL_LIB_DEPS=$GL_LIB_DEPS $XCB_LIBS
 fi
 
+# Check to see if the xcb-glx library is new enough to support
+# GLX_ARB_create_context.  This bit of hackery is necessary until XCB 1.8
+# is released.
+save_CPPFLAGS=$CPPFLAGS
+save_LDFLAGS=$LDFLAGS
+CPPFLAGS=$CPPFLAGS $X11_INCLUDES
+LDFLAGS=$LDFLAGS $GL_LIB_DEPS
+AC_CHECK_LIB(xcb-glx, xcb_glx_create_context_attribs_arb_checked,
+[HAVE_XCB_GLX_CREATE_CONTEXT=yes],
+[HAVE_XCB_GLX_CREATE_CONTEXT=no])
+CPPFLAGS=$save_CPPFLAGS
+LDFLAGS=$save_LDFLAGS
+
+if test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes; then
+X11_INCLUDES=$X11_INCLUDES -DHAVE_XCB_GLX_CREATE_CONTEXT
+fi
+
 # need DRM libs, -lpthread, etc.
 GL_LIB_DEPS=$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS
 GL_PC_LIB_PRIV=-lm -lpthread $DLOPEN_LIBS
 ;;
 esac
 
+# This is outside the case (above) so that it is invoked even for non-GLX
+# builds.
+AM_CONDITIONAL(HAVE_XCB_GLX_CREATE_CONTEXT,
+test x$HAVE_XCB_GLX_CREATE_CONTEXT = xyes)
+
 GLESv1_CM_LIB_DEPS=$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS
 GLESv1_CM_PC_LIB_PRIV=-lm -lpthread $DLOPEN_LIBS
 GLESv2_LIB_DEPS=$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS
diff --git a/src/glx/clientinfo.c b/src/glx/clientinfo.c
index 429e9a3..461030f 100644
--- a/src/glx/clientinfo.c
+++ b/src/glx/clientinfo.c
@@ -123,6 +123,7 @@ __glX_send_client_info(struct glx_display *glx_dpy)
 * THE ORDER IS IMPORTANT.  We want to send the most recent version of the
 * protocol that the server can support.
 */
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
if (glx_dpy-majorVersion == 1  glx_dpy-minorVersion == 4
 any_screen_has_ARB_create_context_profile) {
   xcb_glx_set_client_info_2arb(c,
@@ -145,7 +146,9 @@ __glX_send_client_info(struct glx_display *glx_dpy)
  gl_versions,
  gl_extension_string,
  glx_extensions);
-   } else {
+   } else
+#endif
+   {
   xcb_glx_client_info(c,
  GLX_MAJOR_VERSION, GLX_MINOR_VERSION,
  gl_extension_length,
diff --git a/src/glx/create_context.c b/src/glx/create_context.c
index 11f9340..714f0e5 100644
--- a/src/glx/create_context.c
+++ b/src/glx/create_context.c
@@ -94,7 +94,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config,
 * the protocol error and handle it.  Part of handling the error is freeing
 * the possibly non-NULL value returned by this function.
 */
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
cookie =
   xcb_glx_create_context_attribs_arb_checked(c,
 gc-xid,
diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
index 0fcd8a9..86dc7d0 100644
--- a/src/glx/glxextensions.c
+++ b/src/glx/glxextensions.c
@@ -71,7 +71,7 @@ struct extension_info
 
 /* *INDENT-OFF* */
 static const struct extension_info known_glx_extensions[] = {
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
{ GLX(ARB_create_context),  VER(0,0), Y, N, N, N },
{ GLX(ARB_create_context_profile),  VER(0,0), Y, N, N, N },
 #else
@@ -85,7 +85,7 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(EXT_visual_info), VER(0,0), Y, Y, N, N },
{ GLX(EXT_visual_rating),   VER(0,0), Y, Y, N, N },
{ GLX(EXT_framebuffer_sRGB),VER(0,0), Y, Y, N, N },
-#ifdef XCB_GLX_CREATE_CONTEXT_ATTRIBS_ARB
+#ifdef HAVE_XCB_GLX_CREATE_CONTEXT
{ GLX(EXT_create_context_es2_profile), VER(0,0), Y, N, N, Y },
 #else
{ GLX(EXT_create_context_es2_profile), VER(0,0), N, N, N, N },
diff --git a/tests/glx/Makefile.am b/tests/glx/Makefile.am
index 0b06117..cdebf5d 100644
--- a/tests/glx/Makefile.am
+++ b/tests/glx/Makefile.am
@@ -4,6 +4,7 @@ AM_CXXFLAGS = -I$(top_builddir)/src/glx 
-I$(top_builddir)/src/mapi \
$(X11_CFLAGS) $(GTEST_CFLAGS)
 
 if HAVE_GTEST
+if HAVE_XCB_GLX_CREATE_CONTEXT
 TESTS = glx_unittest
 check_PROGRAMS = glx_unittest
 
@@ -13,4 +14,5 @@ glx_unittest_SOURCES =\
 

Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-04 Thread Ian Romanick

On 01/04/2012 12:54 AM, Mike Lothian wrote:

On 4 January 2012 03:50, Ian Romanicki...@freedesktop.org  wrote:

On 01/03/2012 06:06 PM, Mike Lothian wrote:


On 3 January 2012 20:27, Ian Romanicki...@freedesktop.orgwrote:


On 01/03/2012 11:13 AM, Mike Lothian wrote:



Hi

Ever since these tests went in I get failures during configure:


configure: creating ./config.status
config.status: creating configs/autoconf
config.status: error: cannot find input file: `tests/Makefile.in'

Before I raise a bug am I doing something stupid?




It's possible that I didn't get the automake magic right when gtest isn't
installed.  Is the program gtest-config in your path?



I still get the issue even if I uninstall gtest

I notice the log also contains:

/bin/sh: /var/tmp/portage/media-libs/mesa-/work/Mesa-/bin/missing:
No such file or directory
configure: WARNING: `missing' script is too old or missing

and I'm attaching the full build log too if that helps



You should build from GIT, not from some tarball.  I think Gaetan was
correct.  Some files aren't getting into the tarball.  I'll have to fix that
later, but I have much bigger fish to try in the mean time.


I am building from git - I'm using the gentoo live ebuild. It pulls
from git then builds the sources


Okay, I looked back at your build output, and I think I see the problem:

 * econf: updating Mesa-/bin/config.sub with 
/usr/share/gnuconfig/config.sub
 * econf: updating Mesa-/bin/config.guess with 
/usr/share/gnuconfig/config.guess
./configure --prefix=/usr --build=x86_64-pc-linux-gnu 
--host=x86_64-pc-linux-gnu --mandir=/usr/share/man 
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc 
--localstatedir=/var/lib --libdir=/usr/lib64 
--disable-dependency-tracking --disable-option-checking --enable-dri 
--enable-glx --enable-xcb --enable-texture-float --disable-debug 
--enable-egl --enable-gbm --disable-gles1 --enable-gles2 
--enable-glx-tls --disable-osmesa --enable-asm --enable-shared-dricore 
--enable-shared-glapi --with-dri-drivers=,swrast,i965 
--with-gallium-drivers=,swrast,r600 --with-egl-platforms=x11,drm 
--enable-gallium-egl --disable-d3d1x --enable-gallium-g3dvl 
--enable-gallium-llvm --enable-openvg --disable-vdpau --enable-xvmc


Since it's a raw GIT tree, this should be 'autogen.sh' instead of 
'configure'.  The Makefile.in files are generated by autoreconf (run by 
autogen.sh) and consumed by configure.  Since they haven't been 
generated, configure can't find them and gets angry.  The ebuild scripts 
need to either run ./autogen.sh or run 'autoreconf -v --install' before 
running configure.


I bet that will fix it, and I bet that's why only Gentoo users are still 
having problems.  Can you give that a try?

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


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-04 Thread Daniel Stone
Hi,

On 4 January 2012 18:45, Ian Romanick i...@freedesktop.org wrote:
 Okay, I looked back at your build output, and I think I see the problem:

  * econf: updating Mesa-/bin/config.sub with
 /usr/share/gnuconfig/config.sub
  * econf: updating Mesa-/bin/config.guess with
 /usr/share/gnuconfig/config.guess
 ./configure --prefix=/usr --build=x86_64-pc-linux-gnu
 [...]

 Since it's a raw GIT tree, this should be 'autogen.sh' instead of
 'configure'.  The Makefile.in files are generated by autoreconf (run by
 autogen.sh) and consumed by configure.  Since they haven't been generated,
 configure can't find them and gets angry.  The ebuild scripts need to either
 run ./autogen.sh or run 'autoreconf -v --install' before running configure.

 I bet that will fix it, and I bet that's why only Gentoo users are still
 having problems.  Can you give that a try?

See immediately before that:
 Preparing source in /var/tmp/portage/media-libs/mesa-/work/Mesa- ...
Running eautoreconf in
'/var/tmp/portage/media-libs/mesa-/work/Mesa-' ...
Running aclocal ... [ok]
Running autoconf ... [ok]
 Source prepared.

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


Re: [Mesa-dev] [PATCH] Add .gitignore files to exclude unit test build artifacts from git

2012-01-04 Thread Ian Romanick

On 01/03/2012 01:03 PM, Paul Berry wrote:

With the addition of unit tests in commit
3ef3ba4d2eee36f64062a21ce030c3f4d8c4cac4, several additional build
artifacts are created:

   bin/depcomp
   bin/missing
   tests/Makefile
   tests/Makefile.in
   tests/glx/Makefile
   tests/glx/Makefile.in
   tests/glx/.deps/
   tests/glx/.gitignore

 tests/glx/glx_unittest

:)

Reviewed-by: Ian Romanick ian.d.roman...@intel.com


This patch adds all of these files to .gitignore.
---
  bin/.gitignore   |2 ++
  tests/.gitignore |3 +++
  tests/glx/.gitignore |1 +
  3 files changed, 6 insertions(+), 0 deletions(-)
  create mode 100644 bin/.gitignore
  create mode 100644 tests/.gitignore
  create mode 100644 tests/glx/.gitignore

diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 000..3b3f168
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/depcomp
+/missing
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000..a963aad
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+.deps/
diff --git a/tests/glx/.gitignore b/tests/glx/.gitignore
new file mode 100644
index 000..dab7e97
--- /dev/null
+++ b/tests/glx/.gitignore
@@ -0,0 +1 @@
+/glx_unittest


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


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-04 Thread Ian Romanick

On 01/04/2012 10:55 AM, Daniel Stone wrote:

Hi,

On 4 January 2012 18:45, Ian Romanicki...@freedesktop.org  wrote:

Okay, I looked back at your build output, and I think I see the problem:

  * econf: updating Mesa-/bin/config.sub with
/usr/share/gnuconfig/config.sub
  * econf: updating Mesa-/bin/config.guess with
/usr/share/gnuconfig/config.guess
./configure --prefix=/usr --build=x86_64-pc-linux-gnu
[...]

Since it's a raw GIT tree, this should be 'autogen.sh' instead of
'configure'.  The Makefile.in files are generated by autoreconf (run by
autogen.sh) and consumed by configure.  Since they haven't been generated,
configure can't find them and gets angry.  The ebuild scripts need to either
run ./autogen.sh or run 'autoreconf -v --install' before running configure.

I bet that will fix it, and I bet that's why only Gentoo users are still
having problems.  Can you give that a try?


See immediately before that:

Preparing source in /var/tmp/portage/media-libs/mesa-/work/Mesa- ...

Running eautoreconf in
'/var/tmp/portage/media-libs/mesa-/work/Mesa-' ...
Running aclocal ... [ok]
Running autoconf ... [ok]

Source prepared.


Okay.  I give up.  I have no clue why it's not working.  Patches welcome. :(


Cheers,
Daniel



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


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-04 Thread Michel Dänzer
On Mit, 2012-01-04 at 10:56 -0800, Ian Romanick wrote: 
 On 01/04/2012 10:55 AM, Daniel Stone wrote:
  Hi,
 
  On 4 January 2012 18:45, Ian Romanicki...@freedesktop.org  wrote:
  Okay, I looked back at your build output, and I think I see the problem:
 
* econf: updating Mesa-/bin/config.sub with
  /usr/share/gnuconfig/config.sub
* econf: updating Mesa-/bin/config.guess with
  /usr/share/gnuconfig/config.guess
  ./configure --prefix=/usr --build=x86_64-pc-linux-gnu
  [...]
 
  Since it's a raw GIT tree, this should be 'autogen.sh' instead of
  'configure'.  The Makefile.in files are generated by autoreconf (run by
  autogen.sh) and consumed by configure.  Since they haven't been generated,
  configure can't find them and gets angry.  The ebuild scripts need to 
  either
  run ./autogen.sh or run 'autoreconf -v --install' before running configure.
 
  I bet that will fix it, and I bet that's why only Gentoo users are still
  having problems.  Can you give that a try?
 
  See immediately before that:
  Preparing source in /var/tmp/portage/media-libs/mesa-/work/Mesa- 
  ...
  Running eautoreconf in
  '/var/tmp/portage/media-libs/mesa-/work/Mesa-' ...
  Running aclocal ... [ok]
  Running autoconf ... [ok]
  Source prepared.
 
 Okay.  I give up.  I have no clue why it's not working.  Patches welcome. :(

It's not running automake (just like the Mesa toplevel Makefile
isn't...).


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/vs: Use the proper dimensionality for the sampler result register.

2012-01-04 Thread Ian Romanick

On 01/04/2012 04:07 AM, Kenneth Graunke wrote:

textureSize() returns an int, ivec2, or ivec3, but never an ivec4.
Creating the destination register as an ivec4 triggered later failures,
even though the register did hold the proper values.

For example, piglit test vs-textureSize-compare calls textureSize on a
2D texture and compares the result to an expected value.  Unfortunately,
our generated code also tried to compare the third and fourth components
which were undefined, and failed.


Heh... I figured it was probably something silly like that.


Fixes piglit test vs-textureSize-compare as well as 19 subcases of
oglconform's glsl-bif-tex-size test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44339
Signed-off-by: Kenneth Graunkekenn...@whitecape.org


Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

I was originally seeing a few oglconform regressions from this patch, but
it appears that those tests give completely random results.  At any rate,
this patch does reliably fix a lot of tests, so I'm inclined to apply it.

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 52e63f8..20da487 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1786,7 +1786,7 @@ vec4_visitor::visit(ir_texture *ir)
 inst-base_mrf = 2;
 inst-mlen = inst-header_present + 1; /* always at least one */
 inst-sampler = sampler;
-   inst-dst = dst_reg(this, glsl_type::get_instance(ir-type-base_type,4,1));
+   inst-dst = dst_reg(this, ir-type);
 inst-shadow_compare = ir-shadow_comparitor != NULL;

 if (ir-offset != NULL)


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


Re: [Mesa-dev] [PATCH] i965: Add missing _NEW_TEXTURE dirty bit to brw_vs_prog state atom.

2012-01-04 Thread Eric Anholt
On Wed,  4 Jan 2012 03:15:56 -0800, Kenneth Graunke kenn...@whitecape.org 
wrote:
 Commit d45814c925dd6c479cfd383b9b59458fc4359cf7 totally added a data
 dependency on _NEW_TEXTURE, even including the comment, but didn't
 actually add the dirty bit.

Reviewed-by: Eric Anholt e...@anholt.net


pgpf5KrzZb3AW.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/vs: Use the proper dimensionality for the sampler result register.

2012-01-04 Thread Eric Anholt
On Wed,  4 Jan 2012 04:07:24 -0800, Kenneth Graunke kenn...@whitecape.org 
wrote:
 textureSize() returns an int, ivec2, or ivec3, but never an ivec4.
 Creating the destination register as an ivec4 triggered later failures,
 even though the register did hold the proper values.
 
 For example, piglit test vs-textureSize-compare calls textureSize on a
 2D texture and compares the result to an expected value.  Unfortunately,
 our generated code also tried to compare the third and fourth components
 which were undefined, and failed.
 
 Fixes piglit test vs-textureSize-compare as well as 19 subcases of
 oglconform's glsl-bif-tex-size test.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44339
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org

Makes sense to me.

Reviewed-by: Eric Anholt e...@anholt.net


pgpUsCpzxDmtj.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 20/20] tests/glx: Add unit tests for GLX_ARB_create_context GLX protocol

2012-01-04 Thread Ian Romanick

On 01/04/2012 11:05 AM, Michel Dänzer wrote:

On Mit, 2012-01-04 at 10:56 -0800, Ian Romanick wrote:

On 01/04/2012 10:55 AM, Daniel Stone wrote:

Hi,

On 4 January 2012 18:45, Ian Romanicki...@freedesktop.org   wrote:

Okay, I looked back at your build output, and I think I see the problem:

   * econf: updating Mesa-/bin/config.sub with
/usr/share/gnuconfig/config.sub
   * econf: updating Mesa-/bin/config.guess with
/usr/share/gnuconfig/config.guess
./configure --prefix=/usr --build=x86_64-pc-linux-gnu
[...]

Since it's a raw GIT tree, this should be 'autogen.sh' instead of
'configure'.  The Makefile.in files are generated by autoreconf (run by
autogen.sh) and consumed by configure.  Since they haven't been generated,
configure can't find them and gets angry.  The ebuild scripts need to either
run ./autogen.sh or run 'autoreconf -v --install' before running configure.

I bet that will fix it, and I bet that's why only Gentoo users are still
having problems.  Can you give that a try?


See immediately before that:

Preparing source in /var/tmp/portage/media-libs/mesa-/work/Mesa- ...

Running eautoreconf in
'/var/tmp/portage/media-libs/mesa-/work/Mesa-' ...
Running aclocal ... [ok]
Running autoconf ... [ok]

Source prepared.


Okay.  I give up.  I have no clue why it's not working.  Patches welcome. :(


It's not running automake (just like the Mesa toplevel Makefile
isn't...).


Right... autoreconf does aclocal, autoconf, and automake all in one 
shot.  That makes sense.


About adding automake to the toplevel Makefile, where should that go? 
It seems like adding it to 'default' or similar will break the 
non-autotool builds.  Doing that so close before a release seems mean. 
Since the automake business is only necessary for 'make check', would 
putting it in the 'check' target be sufficient?


(I think my autotool ignorance is showing.)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Fix transform feedback of unsubscripted arrays.

2012-01-04 Thread Ian Romanick

On 01/03/2012 10:35 PM, Paul Berry wrote:

It is not explicitly stated in the GL 3.0 spec that transform feedback
can be performed on a whole varying array (without supplying a
subscript).  However, it seems clear from context that this was the
intent.  Section 2.15 (TransformFeedback) says this:

 When writing varying variables that are arrays, individual array
 elements are written in order.

And section 2.20.3 (Shader Variables), says this, in the description
of GetTransformFeedbackVarying:

 For the selected varying variable, its type is returned into
 type. The size of the varying is returned into size. The value in
 size is in units of the type returned in type.

If it were not possible to perform transform feedback on an
unsubscripted array, the returned size would always be 1.

This patch fixes the linker so that transform feedback on an
unsubscripted array is supported.

Fixes piglit tests EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{4,8}]-no-subscript and
EXT_transform_feedback/output_type *[2]-no-subscript.

Note: on back-ends that set
gl_shader_compiler_options::LowerClipDistance (for example i965),
tests EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{1,2,3,5,6,7}] still fail.  I hope to address this in
a later patch.


Other than the one comment below, which can be addressed later, this 
patch is


Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/glsl/linker.cpp |   99 ---
  1 files changed, 54 insertions(+), 45 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 45edafb..883a635 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1426,12 +1426,12 @@ private:
 /**
  * True if the declaration in orig_name represents an array.
  */
-   bool is_array;
+   bool is_subscripted;

 /**
-* If is_array is true, the array index that was specified in orig_name.
+* If is_subscripted is true, the subscript that was specified in orig_name.
  */
-   unsigned array_index;
+   unsigned array_subscript;

 /**
  * Which component to extract from the vertex shader output location that
@@ -1460,6 +1460,12 @@ private:

 /** Type of the varying returned by glGetTransformFeedbackVarying() */
 GLenum type;
+
+   /**
+* If location != -1, the size that should be returned by
+* glGetTransformFeedbackVarying().
+*/
+   unsigned size;
  };


@@ -1484,14 +1490,14 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,

 if (bracket) {
this-var_name = ralloc_strndup(mem_ctx, input, bracket - input);
-  if (sscanf(bracket, [%u],this-array_index) != 1) {
+  if (sscanf(bracket, [%u],this-array_subscript) != 1) {
   linker_error(prog, Cannot parse transform feedback varying %s, 
input);
   return false;
}
-  this-is_array = true;
+  this-is_subscripted = true;
 } else {
this-var_name = ralloc_strdup(mem_ctx, input);
-  this-is_array = false;
+  this-is_subscripted = false;
 }

 /* For drivers that lower gl_ClipDistance to gl_ClipDistanceMESA, we need
@@ -1501,8 +1507,10 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,
 if (ctx-ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance
 strcmp(this-var_name, gl_ClipDistance) == 0) {
this-var_name = gl_ClipDistanceMESA;
-  this-single_component = this-array_index % 4;
-  this-array_index /= 4;
+  if (this-is_subscripted) {
+ this-single_component = this-array_subscript % 4;
+ this-array_subscript /= 4;
+  }
 }

 return true;
@@ -1518,9 +1526,9 @@ tfeedback_decl::is_same(const tfeedback_declx, const 
tfeedback_decly)
  {
 if (strcmp(x.var_name, y.var_name) != 0)
return false;
-   if (x.is_array != y.is_array)
+   if (x.is_subscripted != y.is_subscripted)
return false;
-   if (x.is_array  x.array_index != y.array_index)
+   if (x.is_subscripted  x.array_subscript != y.array_subscript)
return false;
 if (x.single_component != y.single_component)
return false;
@@ -1542,37 +1550,39 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
  {
 if (output_var-type-is_array()) {
/* Array variable */
-  if (!this-is_array) {
- linker_error(prog, Transform feedback varying %s found, 
-  but array dereference required for varying %s[%d]).,
-  this-orig_name,
- output_var-name, output_var-type-length);
- return false;
-  }
-  /* Check array bounds. */
-  if (this-array_index=
-  (unsigned) output_var-type-array_size()) {
- linker_error(prog, Transform feedback varying %s has index 
-  %i, but the array size is %i.,
-  this-orig_name, this-array_index,
-  output_var-type-array_size());
-  

[Mesa-dev] [Bug 44405] Spring RTS crashes using r600g (5670, Redwood), kernel rejects relocations

2012-01-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44405

--- Comment #3 from Marcin Baczyński marb...@gmail.com 2012-01-04 11:43:21 
PST ---
Glad you know what's wrong in there.
Is there anything I can do to help fixing this bug? Like some traces or debug
dumps?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] [Bug 44438] Configure fails on missing tests/Makefile.in

2012-01-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44438

--- Comment #1 from Ian Romanick i...@freedesktop.org 2012-01-04 11:44:52 PST 
---
There has been some discussion about this on the mesa-dev mailing list (see
link below).  The current thinking is that the Gentoo build is not running
automake before running configure, and that is the problem.  The most likely
fix is for Gentoo to update their Mesa build setup.

http://lists.freedesktop.org/archives/mesa-dev/2012-January/016788.html

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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] [Bug 44438] Configure fails on missing tests/Makefile.in

2012-01-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44438

Ian Romanick i...@freedesktop.org changed:

   What|Removed |Added

 AssignedTo|mesa-dev@lists.freedesktop. |i...@freedesktop.org
   |org |

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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 3/5] glsl: rename VERSION to VERSION_TOK for automake

2012-01-04 Thread Ian Romanick

On 12/23/2011 04:21 PM, Matt Turner wrote:

Signed-off-by: Matt Turnermatts...@gmail.com


Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/glsl/glsl_lexer.ll  |2 +-
  src/glsl/glsl_parser.yy |4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index c7cfedd..936a907 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -148,7 +148,7 @@ HASH^{SPC}#{SPC}

  /* Preprocessor tokens. */
  ^[ \t]*#[ \t]*$   ;
-^[ \t]*#[ \t]*version  { BEGIN PP; return VERSION; }
+^[ \t]*#[ \t]*version  { BEGIN PP; return VERSION_TOK; }
  ^[ \t]*#[ \t]*extension   { BEGIN PP; return EXTENSION; }
  {HASH}line{SPCP}{INT}{SPCP}{INT}{SPC}$ {
   /* Eat characters until the first digit is
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 8a0377f..e774b46 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -118,7 +118,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state 
*st, const char *msg)
  %token INVARIANT
  %token LOWP MEDIUMP HIGHP SUPERP PRECISION

-%token VERSION EXTENSION LINE COLON EOL INTERFACE OUTPUT
+%token VERSION_TOK EXTENSION LINE COLON EOL INTERFACE OUTPUT
  %token PRAGMA_DEBUG_ON PRAGMA_DEBUG_OFF
  %token PRAGMA_OPTIMIZE_ON PRAGMA_OPTIMIZE_OFF
  %token PRAGMA_INVARIANT_ALL
@@ -246,7 +246,7 @@ translation_unit:

  version_statement:
/* blank - no #version specified: defaults are already set */
-   | VERSION INTCONSTANT EOL
+   | VERSION_TOK INTCONSTANT EOL
{
   bool supported = false;



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


Re: [Mesa-dev] [PATCH 1/5] configure.ac: remove deprecated --with-driver=

2012-01-04 Thread Ian Romanick

On 12/23/2011 04:21 PM, Matt Turner wrote:

See 9e7a4147.


Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  configure.ac |   77 --
  1 files changed, 0 insertions(+), 77 deletions(-)

diff --git a/configure.ac b/configure.ac
index a4943e1..c0d6882 100644
--- a/configure.ac
+++ b/configure.ac
@@ -709,83 +709,6 @@ if test x$enable_shared_glapi = xyes; then
  fi
  AC_SUBST([SHARED_GLAPI])

-dnl
-dnl Driver configuration. Options are xlib, dri and osmesa right now.
-dnl More later: fbdev, ...
-dnl
-default_driver=xlib
-
-case $host_os in
-linux*)
-case $host_cpu in
-i*86|x86_64|powerpc*|sparc*) default_driver=dri;;
-esac
-;;
-*freebsd* | dragonfly* | *netbsd*)
-case $host_cpu in
-i*86|x86_64|powerpc*|sparc*) default_driver=dri;;
-esac
-;;
-esac
-
-if test x$enable_opengl = xno; then
-default_driver=no
-fi
-
-AC_ARG_WITH([driver],
-[AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
-[mesa_driver=$withval],
-[mesa_driver=auto])
-dnl Check for valid option
-case x$mesa_driver in
-xxlib|xdri|xosmesa|xno)
-if test x$enable_dri != xauto -o \
-x$enable_glx != xauto -o \
-x$enable_osmesa != xauto -o \
-x$enable_xlib_glx != xauto; then
-AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
-fi
-;;
-xauto)
-mesa_driver=$default_driver
-;;
-*)
-AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
-;;
-esac
-
-# map $mesa_driver to APIs
-if test x$enable_dri = xauto; then
-case x$mesa_driver in
-xdri) enable_dri=yes ;;
-*)enable_dri=no ;;
-esac
-fi
-
-if test x$enable_glx = xauto; then
-case x$mesa_driver in
-xdri|xxlib) enable_glx=yes ;;
-*)  enable_glx=no ;;
-esac
-fi
-
-if test x$enable_osmesa = xauto; then
-case x$mesa_driver in
-xxlib|xosmesa) enable_osmesa=yes ;;
-*) enable_osmesa=no ;;
-esac
-fi
-
-if test x$enable_xlib_glx = xauto; then
-case x$mesa_driver in
-xxlib) enable_xlib_glx=yes ;;
-*) enable_xlib_glx=no ;;
-esac
-fi
-
-if test x$enable_glx = xno; then
-enable_xlib_glx=no
-fi

  dnl
  dnl Driver specific build directories


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


Re: [Mesa-dev] [PATCH 2/5] configure.ac: bump AC_PREREQ to 2.60

2012-01-04 Thread Ian Romanick

On 12/23/2011 05:38 PM, Gaetan Nadon wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11-12-23 08:09 PM, Matt Turner wrote:

On Fri, Dec 23, 2011 at 8:06 PM, Kenneth Graunke

kenn...@whitecape.org  wrote:

On 12/23/2011 04:21 PM, Matt Turner wrote:

---
configure.ac | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index c0d6882..0d75353 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to create configure.

-AC_PREREQ([2.59])
+AC_PREREQ([2.60])

dnl Versioning - scrape the version from configs/default
m4_define([mesa_version],


I'm not opposed to this, but presumably you had some reason for doing
it. Care to explain in the commit message?


Truthfully, I do not know. Gaetan said it should be so when I sent the
my first iteration of the automake patch back in September:

All xorg modules require minimum 2.60 (2006). Given mesa is usually
compiled from source, it makes sense to align this version with xorg. If
mesa is compiled by itself or with projects other than xorg which
require an older version of autoconf, then it can remain at 2.59 (2003),
provided that someone can test that it really does configure at that
level. I doubt very much as there were big changes during this three
year gap.

Note than autoconf and automake come as a range of pairs. Some later
versions of automake will not install if autoconf is too old. If the
code uses features from a later version of automake, the code won't
build with older version of automake. So the version of automake also
influences the level of autoconf needed.

All  builds are done with much more recent versions of autoconf. When
the older version ceases to work because the code uses new autoconf
features, no one notices. That's my assumption.

I try to document these things here:
http://www.x.org/wiki/NewModuleGuidelines#configure.ac


As long as some of this gets captured in the commit message, this patch is

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

Of course, the argument that 2.60 is five years old is already 
compelling. :)



http://lists.freedesktop.org/archives/mesa-dev/2011-September/012656.html

Matt



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk71LRoACgkQubv1WfueyfxRjACdHIEutRQ1kfNljFwx93xq91Qp
O6AAn0tlyKy4nqtY35zHs6SND9XHSLkh
=3UJ6
-END PGP SIGNATURE-

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

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


Re: [Mesa-dev] R600g LLVM shader backend

2012-01-04 Thread Tom Stellard
Hi Jose,


On Thu, 2011-12-15 at 10:41 -0800, Jose Fonseca wrote:
 - Original Message -
  On Mon, 2011-12-12 at 07:05 -0800, Jose Fonseca wrote:
   - Original Message -
Hi,

I have just pushed a branch containing an LLVM shader backend for
r600g to my
personal git repo:

http://cgit.freedesktop.org/~tstellar/mesa/ r600g-llvm-shader
   
   Hi Tom,
   
   This is pretty cool stuff.  The fact that you have a similar
   passing rate to the existing compiler makes it quite remarkable.
I was aware of several closed/open-source projects to develop GPU
   backends for LLVM, and LunarG made a middle end, but this is the
   first working OpenGL stack based on a LLVM GPU backend that I'm
   aware.
   
There are three main components to this branch:

1. A TGSI-LLVM converter (commit
ec9bb644cf7dde055c6c3ee5b8890a2d367337e5)
   
The goal of this converter is to give all gallium drivers a
convenient
way to convert from TGSI to LLVM.  The interface is still
evolving,
and I'm interested in getting some feedback for it.
   
   The interface looks a good start, but I'd like it to be even more
   overridable.  I don't even think there's anything GPU specific
   there -- I also had some plans to do TGSI translation in llvmpipe
   in two stages: first TGSI - high-level LLVM IR w/ custom
   gallivm/tgsi intrinsics - low-level LLVM IR w/ x86 SIMD
   instrinsincs, to allow optimizations and other decisions to happen
   at a higher level, before starting to emit lower-level code.
   
  What else would you like to see overridable?
 
 I'd like that all LLVM - TGSI translators (your new one, llvmpipe's TGSI - 
 aos, llvmpipe's TGSI - SOA) shared a common hierarchy, so all the things 
 they do different needs to be pluggable / overridable. But I'd need to look 
 in more detail to give a precise list.
 
  I think it might be nice to map TGSI opcodes to C functions rather
  than
  intrinsic strings.
 
 What do you mean by C functions?
  
   So I'd like us to have a flexible hierarchy of TGSI translators
   that can be shared for GPU/CPUs alike.
   
   BTW, I'd prefer that all reusable Gallium+LLVM code (be it meant
   for GPU or CPU) lives in src/gallium/auxiliary/gallivm , as it
   make code maintenance and build integration simpler.  So
   tgsi_llvm.c should be moved into gallivm.  Also, beware that the
   ability to build core gallium/mesa without LLVM must be preserved.
   (Having particular drivers to have hard dependencies on LLVM is of
   course at discretion of drivers developers though.)
   
2. Changes to gallivm so that code can be shared between it and
the TGSI-LLVM converter.  These changes are attached, please
review.
   
   I'll review them separately.
  
 
 Been busy days. Still no time to go through them in detail...
  

I'm in the process of reworking the TGSI-LLVM interface right now to
make it a little more flexible, so there is no need for you to review
the old version.  I'll mail the list when the updated interface is ready
for review.

-Tom




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


[Mesa-dev] [PATCH] mesa: fix _mesa_get_fallback_texture() to handle all texture targets

2012-01-04 Thread Brian Paul
Previously, this function only handled 2D textures.

The fallback texture is used when we try to sample from an incomplete
texture object.  GLSL says sampling an incomplete texture should return
(0,0,0,1).
---
 src/mesa/main/mtypes.h   |2 +-
 src/mesa/main/shared.c   |8 ++-
 src/mesa/main/texobj.c   |  115 --
 src/mesa/main/texobj.h   |4 +-
 src/mesa/main/texstate.c |   10 +++-
 5 files changed, 107 insertions(+), 32 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 107371e..5158100 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2419,7 +2419,7 @@ struct gl_shared_state
struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS];
 
/** Fallback texture used when a bound texture is incomplete */
-   struct gl_texture_object *FallbackTex;
+   struct gl_texture_object *FallbackTex[NUM_TEXTURE_TARGETS];
 
/**
 * \name Thread safety and statechange notification for texture
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 276fac1..f889abe 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -307,9 +307,11 @@ free_shared_state(struct gl_context *ctx, struct 
gl_shared_state *shared)
 {
GLuint i;
 
-   /* Free the dummy/fallback texture object */
-   if (shared-FallbackTex)
-  ctx-Driver.DeleteTexture(ctx, shared-FallbackTex);
+   /* Free the dummy/fallback texture objects */
+   for (i = 0; i  NUM_TEXTURE_TARGETS; i++) {
+  if (shared-FallbackTex[i])
+ ctx-Driver.DeleteTexture(ctx, shared-FallbackTex[i]);
+   }
 
/*
 * Free display lists
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 7ee2005..112d58a 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -757,59 +757,126 @@ _mesa_dirty_texobj(struct gl_context *ctx, struct 
gl_texture_object *texObj,
 
 
 /**
- * Return pointer to a default/fallback texture.
- * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1).
- * That's the value a sampler should get when sampling from an
+ * Return pointer to a default/fallback texture of the given type/target.
+ * The texture is an RGBA texture with all texels = (0,0,0,1).
+ * That's the value a GLSL sampler should get when sampling from an
  * incomplete texture.
  */
 struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx)
+_mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
 {
-   if (!ctx-Shared-FallbackTex) {
+   if (!ctx-Shared-FallbackTex[tex]) {
   /* create fallback texture now */
-  static GLubyte texels[8 * 8][4];
+  const GLsizei width = 4, height = 4, depth = 4;
+  GLubyte texels[width * height * depth][4];
   struct gl_texture_object *texObj;
   struct gl_texture_image *texImage;
   gl_format texFormat;
-  GLuint i;
+  GLuint i, dims, face, numFaces = 1;
+  GLenum target;
 
-  for (i = 0; i  8 * 8; i++) {
+  for (i = 0; i  width * height * depth; i++) {
  texels[i][0] =
  texels[i][1] =
  texels[i][2] = 0x0;
  texels[i][3] = 0xff;
   }
 
+  switch (tex) {
+  case TEXTURE_2D_ARRAY_INDEX:
+ dims = 3;
+ target = GL_TEXTURE_2D_ARRAY;
+ break;
+  case TEXTURE_1D_ARRAY_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_1D_ARRAY;
+ break;
+  case TEXTURE_CUBE_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_CUBE_MAP;
+ numFaces = 6;
+ break;
+  case TEXTURE_3D_INDEX:
+ dims = 3;
+ target = GL_TEXTURE_3D;
+ break;
+  case TEXTURE_RECT_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_RECTANGLE;
+ break;
+  case TEXTURE_2D_INDEX:
+ dims = 2;
+ target = GL_TEXTURE_2D;
+ break;
+  case TEXTURE_1D_INDEX:
+ dims = 1;
+ target = GL_TEXTURE_1D;
+ break;
+  case TEXTURE_BUFFER_INDEX:
+  case TEXTURE_EXTERNAL_INDEX:
+  default:
+ /* no-op */
+ return NULL;
+  }
+
   /* create texture object */
-  texObj = ctx-Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D);
+  texObj = ctx-Driver.NewTextureObject(ctx, 0, target);
   assert(texObj-RefCount == 1);
   texObj-Sampler.MinFilter = GL_NEAREST;
   texObj-Sampler.MagFilter = GL_NEAREST;
 
-  /* create level[0] texture image */
-  texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0);
-
   texFormat = ctx-Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
   GL_UNSIGNED_BYTE);
 
-  /* init the image fields */
-  _mesa_init_teximage_fields(ctx, texImage,
- 8, 8, 1, 0, GL_RGBA, texFormat); 
+  /* need a loop here just for cube maps */
+  for (face = 0; face  numFaces; face++) {
+ GLenum faceTarget;
 
-  ASSERT(texImage-TexFormat != MESA_FORMAT_NONE);
-
-  /* set image data */

[Mesa-dev] [PATCH] mesa: only map src/dest regions in _mesa_copy_buffer_subdata()

2012-01-04 Thread Brian Paul
We were wastefully mapping the whole source/dest buffers before.
---
 src/mesa/main/bufferobj.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 66957e4..c4a7b8d 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -502,19 +502,19 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
   GLintptr readOffset, GLintptr writeOffset,
   GLsizeiptr size)
 {
-   GLubyte *srcPtr, *dstPtr;
+   void *srcPtr, *dstPtr;
 
/* buffer should not already be mapped */
assert(!_mesa_bufferobj_mapped(src));
assert(!_mesa_bufferobj_mapped(dst));
 
-   srcPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, src-Size,
-  GL_MAP_READ_BIT, src);
-   dstPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, dst-Size,
-  GL_MAP_WRITE_BIT, dst);
+   srcPtr = ctx-Driver.MapBufferRange(ctx, readOffset, size,
+   GL_MAP_READ_BIT, src);
+   dstPtr = ctx-Driver.MapBufferRange(ctx, writeOffset, size,
+   GL_MAP_WRITE_BIT, dst);
 
if (srcPtr  dstPtr)
-  memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
+  memcpy(dstPtr, srcPtr, size);
 
ctx-Driver.UnmapBuffer(ctx, src);
ctx-Driver.UnmapBuffer(ctx, dst);
-- 
1.7.3.4

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


Re: [Mesa-dev] [PATCH] mesa: Fix transform feedback of unsubscripted arrays.

2012-01-04 Thread Paul Berry
On 4 January 2012 11:38, Ian Romanick i...@freedesktop.org wrote:

 On 01/03/2012 10:35 PM, Paul Berry wrote:

 It is not explicitly stated in the GL 3.0 spec that transform feedback
 can be performed on a whole varying array (without supplying a
 subscript).  However, it seems clear from context that this was the
 intent.  Section 2.15 (TransformFeedback) says this:

 When writing varying variables that are arrays, individual array
 elements are written in order.

 And section 2.20.3 (Shader Variables), says this, in the description
 of GetTransformFeedbackVarying:

 For the selected varying variable, its type is returned into
 type. The size of the varying is returned into size. The value in
 size is in units of the type returned in type.

 If it were not possible to perform transform feedback on an
 unsubscripted array, the returned size would always be 1.

 This patch fixes the linker so that transform feedback on an
 unsubscripted array is supported.

 Fixes piglit tests EXT_transform_feedback/**builtin-varyings
 gl_ClipDistance[{4,8}]-no-**subscript and
 EXT_transform_feedback/**output_type *[2]-no-subscript.

 Note: on back-ends that set
 gl_shader_compiler_options::**LowerClipDistance (for example i965),
 tests EXT_transform_feedback/**builtin-varyings
 gl_ClipDistance[{1,2,3,5,6,7}]** still fail.  I hope to address this in
 a later patch.


 Other than the one comment below, which can be addressed later, this patch
 is

 Reviewed-by: Ian Romanick ian.d.roman...@intel.com

  ---
  src/glsl/linker.cpp |   99 --**
 -
  1 files changed, 54 insertions(+), 45 deletions(-)

 diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
 index 45edafb..883a635 100644
 --- a/src/glsl/linker.cpp
 +++ b/src/glsl/linker.cpp
 @@ -1426,12 +1426,12 @@ private:
 /**
  * True if the declaration in orig_name represents an array.
  */
 -   bool is_array;
 +   bool is_subscripted;

 /**
 -* If is_array is true, the array index that was specified in
 orig_name.
 +* If is_subscripted is true, the subscript that was specified in
 orig_name.
  */
 -   unsigned array_index;
 +   unsigned array_subscript;

 /**
  * Which component to extract from the vertex shader output location
 that
 @@ -1460,6 +1460,12 @@ private:

 /** Type of the varying returned by glGetTransformFeedbackVarying(**)
 */
 GLenum type;
 +
 +   /**
 +* If location != -1, the size that should be returned by
 +* glGetTransformFeedbackVarying(**).
 +*/
 +   unsigned size;
  };


 @@ -1484,14 +1490,14 @@ tfeedback_decl::init(struct gl_context *ctx,
 struct gl_shader_program *prog,

 if (bracket) {
this-var_name = ralloc_strndup(mem_ctx, input, bracket - input);
 -  if (sscanf(bracket, [%u],this-array_index) != 1) {
 +  if (sscanf(bracket, [%u],this-array_subscript) != 1) {

   linker_error(prog, Cannot parse transform feedback varying
 %s, input);
   return false;
}
 -  this-is_array = true;
 +  this-is_subscripted = true;
 } else {
this-var_name = ralloc_strdup(mem_ctx, input);
 -  this-is_array = false;
 +  this-is_subscripted = false;
 }

 /* For drivers that lower gl_ClipDistance to gl_ClipDistanceMESA, we
 need
 @@ -1501,8 +1507,10 @@ tfeedback_decl::init(struct gl_context *ctx,
 struct gl_shader_program *prog,
 if (ctx-ShaderCompilerOptions[**MESA_SHADER_VERTEX].**
 LowerClipDistance
 strcmp(this-var_name, gl_ClipDistance) == 0) {
this-var_name = gl_ClipDistanceMESA;
 -  this-single_component = this-array_index % 4;
 -  this-array_index /= 4;
 +  if (this-is_subscripted) {
 + this-single_component = this-array_subscript % 4;
 + this-array_subscript /= 4;
 +  }
 }

 return true;
 @@ -1518,9 +1526,9 @@ tfeedback_decl::is_same(const tfeedback_declx,
 const tfeedback_decly)
  {
 if (strcmp(x.var_name, y.var_name) != 0)
return false;
 -   if (x.is_array != y.is_array)
 +   if (x.is_subscripted != y.is_subscripted)
return false;
 -   if (x.is_array  x.array_index != y.array_index)
 +   if (x.is_subscripted  x.array_subscript != y.array_subscript)

return false;
 if (x.single_component != y.single_component)
return false;
 @@ -1542,37 +1550,39 @@ tfeedback_decl::assign_**location(struct
 gl_context *ctx,
  {
 if (output_var-type-is_array()) {
/* Array variable */
 -  if (!this-is_array) {
 - linker_error(prog, Transform feedback varying %s found, 
 -  but array dereference required for varying
 %s[%d]).,
 -  this-orig_name,
 - output_var-name, output_var-type-length);
 - return false;
 -  }
 -  /* Check array bounds. */
 -  if (this-array_index=
 -  (unsigned) output_var-type-array_size()**) {
 - linker_error(prog, Transform feedback varying %s has 

[Mesa-dev] [PATCH 1/2] mesa: Fix computation of transform feedback num_components.

2012-01-04 Thread Paul Berry
The function tfeedback_decl::num_components() was not correctly
accounting for transform feedback of whole arrays and gl_ClipDistance.
The bug was hard to notice in tests, because it only affected the
checks for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS and
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS.

This patch fixes the computation, and adds an assertion to verify
num_components() even when MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS
and MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS are not exceeded.

The assertion requires keeping track of components_so_far in
tfeedback_decl::store(); this will be useful in a future patch to fix
non-multiple-of-4-sized gl_ClipDistance.
---
 src/glsl/linker.cpp |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 883a635..828e4ea 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1408,7 +1408,10 @@ public:
 */
unsigned num_components() const
{
-  return this-vector_elements * this-matrix_columns;
+  if (this-single_component == -1)
+ return this-vector_elements * this-matrix_columns * this-size;
+  else
+ return 1;
}
 
 private:
@@ -1631,6 +1634,7 @@ tfeedback_decl::store(struct gl_shader_program *prog,
this-orig_name);
   return false;
}
+   unsigned components_so_far = 0;
for (unsigned index = 0; index  this-size; ++index) {
   for (unsigned v = 0; v  this-matrix_columns; ++v) {
  unsigned num_components =
@@ -1644,8 +1648,10 @@ tfeedback_decl::store(struct gl_shader_program *prog,
 this-single_component = 0 ? this-single_component : 0;
  ++info-NumOutputs;
  info-BufferStride[buffer] += num_components;
+ components_so_far += num_components;
   }
}
+   assert(components_so_far == this-num_components());
 
info-Varyings[varying].Name = ralloc_strdup(prog, this-orig_name);
info-Varyings[varying].Type = this-type;
-- 
1.7.6.5

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


[Mesa-dev] [PATCH 2/2] mesa: Fix transform feedback of unsubscripted gl_ClipDistance array.

2012-01-04 Thread Paul Berry
On drivers that set gl_shader_compiler_options::LowerClipDistance (for
example i965), we need to handle transform feedback of gl_ClipDistance
specially, to account for the fact that the hardware represents it as
an array of vec4's rather than an array of floats.

The previous way this was accounted for (translating the request for
gl_ClipDistance[n] to a request for a component of
gl_ClipDistanceMESA[n/4]) doesn't work when performing transform
feedback on the whole unsubscripted array, because we need to keep
track of the size of the gl_ClipDistance array prior to the lowering
pass.  So I replaced it with a boolean is_clip_distance_mesa, which
switches on the special logic that is needed to handle the lowered
version of gl_ClipDistance.

Fixes Piglit tests EXT_transform_feedback/builtin-varyings
gl_ClipDistance[{1,2,3,5,6,7}]-no-subscript.
---
 src/glsl/linker.cpp|   89 ++--
 src/mesa/main/mtypes.h |2 +
 2 files changed, 58 insertions(+), 33 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 828e4ea..5958516 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -246,7 +246,8 @@ count_attribute_slots(const glsl_type *t)
 /**
  * Verify that a vertex shader executable meets all semantic requirements.
  *
- * Also sets prog-Vert.UsesClipDistance as a side effect.
+ * Also sets prog-Vert.UsesClipDistance and prog-Vert.ClipDistanceArraySize
+ * as a side effect.
  *
  * \param shader  Vertex shader executable to be verified
  */
@@ -264,6 +265,8 @@ validate_vertex_shader_executable(struct gl_shader_program 
*prog,
   return false;
}
 
+   prog-Vert.ClipDistanceArraySize = 0;
+
if (prog-Version = 130) {
   /* From section 7.1 (Vertex Shader Special Variables) of the
* GLSL 1.30 spec:
@@ -282,6 +285,10 @@ validate_vertex_shader_executable(struct gl_shader_program 
*prog,
  return false;
   }
   prog-Vert.UsesClipDistance = clip_distance.variable_found();
+  ir_variable *clip_distance_var =
+ shader-symbols-get_variable(gl_ClipDistance);
+  if (clip_distance_var)
+ prog-Vert.ClipDistanceArraySize = clip_distance_var-type-length;
}
 
return true;
@@ -1399,7 +1406,10 @@ public:
 */
bool matches_var(ir_variable *var) const
{
-  return strcmp(var-name, this-var_name) == 0;
+  if (this-is_clip_distance_mesa)
+ return strcmp(var-name, gl_ClipDistanceMESA) == 0;
+  else
+ return strcmp(var-name, this-var_name) == 0;
}
 
/**
@@ -1408,10 +1418,10 @@ public:
 */
unsigned num_components() const
{
-  if (this-single_component == -1)
- return this-vector_elements * this-matrix_columns * this-size;
+  if (this-is_clip_distance_mesa)
+ return this-size;
   else
- return 1;
+ return this-vector_elements * this-matrix_columns * this-size;
}
 
 private:
@@ -1437,11 +1447,10 @@ private:
unsigned array_subscript;
 
/**
-* Which component to extract from the vertex shader output location that
-* the linker assigned to this variable.  -1 if all components should be
-* extracted.
+* True if the variable is gl_ClipDistance and the driver lowers
+* gl_ClipDistance to gl_ClipDistanceMESA.
 */
-   int single_component;
+   bool is_clip_distance_mesa;
 
/**
 * The vertex shader output location that the linker assigned for this
@@ -1487,7 +1496,7 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,
 
this-location = -1;
this-orig_name = input;
-   this-single_component = -1;
+   this-is_clip_distance_mesa = false;
 
const char *bracket = strrchr(input, '[');
 
@@ -1503,17 +1512,13 @@ tfeedback_decl::init(struct gl_context *ctx, struct 
gl_shader_program *prog,
   this-is_subscripted = false;
}
 
-   /* For drivers that lower gl_ClipDistance to gl_ClipDistanceMESA, we need
-* to convert a request for gl_ClipDistance[n] into a request for a
-* component of gl_ClipDistanceMESA[n/4].
+   /* For drivers that lower gl_ClipDistance to gl_ClipDistanceMESA, this
+* class must behave specially to account for the fact that gl_ClipDistance
+* is converted from a float[8] to a vec4[2].
 */
if (ctx-ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance 
strcmp(this-var_name, gl_ClipDistance) == 0) {
-  this-var_name = gl_ClipDistanceMESA;
-  if (this-is_subscripted) {
- this-single_component = this-array_subscript % 4;
- this-array_subscript /= 4;
-  }
+  this-is_clip_distance_mesa = true;
}
 
return true;
@@ -1533,8 +1538,6 @@ tfeedback_decl::is_same(const tfeedback_decl x, const 
tfeedback_decl y)
   return false;
if (x.is_subscripted  x.array_subscript != y.array_subscript)
   return false;
-   if (x.single_component != y.single_component)
-  return false;
return true;
 }
 
@@ -1555,27 +1558,36 @@ 

[Mesa-dev] [PATCH] mesa: Fix bogus transform feedback error message when subscripting non-array.

2012-01-04 Thread Paul Berry
Previous to this patch, if the client requested transform feedback
using a subscript, but the variable was not an array
(e.g. gl_FrontColor[0]), we would produce a bogus error message like
Transform feedback varying gl_FrontColor[0] found, but it's an array
([] expected).

Changed the error message to e.g. Transfrorm feedback varying
gl_FrontColor[0] requested, but gl_FrontColor is not an array.
---
 src/glsl/linker.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5958516..20d9f3e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1591,9 +1591,9 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
} else {
   /* Regular variable (scalar, vector, or matrix) */
   if (this-is_subscripted) {
- linker_error(prog, Transform feedback varying %s found, 
-  but it's an array ([] expected).,
-  this-orig_name);
+ linker_error(prog, Transform feedback varying %s requested, 
+  but %s is not an array.,
+  this-orig_name, this-var_name);
  return false;
   }
   this-location = output_var-location;
-- 
1.7.6.5

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


Re: [Mesa-dev] [PATCH] mesa: Fix bogus transform feedback error message when subscripting non-array.

2012-01-04 Thread Kenneth Graunke
On 01/04/2012 03:23 PM, Paul Berry wrote:
 Previous to this patch, if the client requested transform feedback
 using a subscript, but the variable was not an array
 (e.g. gl_FrontColor[0]), we would produce a bogus error message like
 Transform feedback varying gl_FrontColor[0] found, but it's an array
 ([] expected).
 
 Changed the error message to e.g. Transfrorm feedback varying
 gl_FrontColor[0] requested, but gl_FrontColor is not an array.
 ---
  src/glsl/linker.cpp |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
 index 5958516..20d9f3e 100644
 --- a/src/glsl/linker.cpp
 +++ b/src/glsl/linker.cpp
 @@ -1591,9 +1591,9 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
 } else {
/* Regular variable (scalar, vector, or matrix) */
if (this-is_subscripted) {
 - linker_error(prog, Transform feedback varying %s found, 
 -  but it's an array ([] expected).,
 -  this-orig_name);
 + linker_error(prog, Transform feedback varying %s requested, 
 +  but %s is not an array.,
 +  this-orig_name, this-var_name);
   return false;
}
this-location = output_var-location;

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Fix bogus transform feedback error message when subscripting non-array.

2012-01-04 Thread Eric Anholt
On Wed,  4 Jan 2012 15:23:06 -0800, Paul Berry stereotype...@gmail.com wrote:
 Previous to this patch, if the client requested transform feedback
 using a subscript, but the variable was not an array
 (e.g. gl_FrontColor[0]), we would produce a bogus error message like
 Transform feedback varying gl_FrontColor[0] found, but it's an array
 ([] expected).
 
 Changed the error message to e.g. Transfrorm feedback varying
 gl_FrontColor[0] requested, but gl_FrontColor is not an array.

Reviewed-by: Eric Anholt e...@anholt.net


pgprJbCjGJYzU.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-04 Thread Eric Anholt
On Wed, 04 Jan 2012 03:28:12 -0800, Kenneth Graunke kenn...@whitecape.org 
wrote:
 On 01/03/2012 09:43 PM, Marek Olšák wrote:
  This ProgramStringNotify call causes excessive shader recompilations
  in the game Cogs (from some Humble Bundle). Approximately 25% of
  in-game CPU time is spent on translating shaders and register
  allocation. If the shaders were larger, it would be much worse.
  Moreover, I have realized calling ProgramStringNotify is not needed
  for st/mesa in this case at all (I just comment it out if I want
  higher frame rates), because it doesn't use the prog-SamplerUnits
  array when translating shaders. The array is only used when we set
  samplers, so setting _NEW_TEXTURE is sufficient. It seems that i965
  could do the same thing. Another option would be to cache precompiled
  shaders, but that seems more complicated than doing what st/mesa does.
  
  Marek
 
 Yeah, I noticed that a while back too, but we never arrived at a
 solution and it slipped off my radar.  I agree completely,
 ProgramStringNotify is completely overkill and bogus.
 
 We actually already rely on _NEW_TEXTURE for all shader programs.  Since
 the uniform code already flags _NEW_TEXTURE, we should be able to just
 add the SamplerUnits array to the program key (specifically,
 brw_sampler_prog_key_data), and that should take care of any state
 dependent recompiles.  Then we wouldn't need ProgramStringNotify at all.
 
 Right?

Well, since the data stored is part of the program, and when just
changing programs _NEW_TEXTURE wouldn't get set, I think _NEW_PROGRAM is
the flag you mean.  That would make a ton of sense to me -- if you
depend on SamplerUnits for your program handling, go look at it when
_NEW_PROGRAM is flagged.


pgpUidtAmNDYx.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Add forgotten GL_RG_INTEGER format in unpack_color_span_float.

2012-01-04 Thread Kenneth Graunke
Fixes piglit test spec/EXT_texture_integer/texture_integer_glsl130 on
Sandybridge.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/mesa/main/pack.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 2933ff6..21096f9 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -3778,6 +3778,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
   srcFormat == GL_GREEN_INTEGER_EXT ||
   srcFormat == GL_BLUE_INTEGER_EXT ||
   srcFormat == GL_ALPHA_INTEGER_EXT ||
+  srcFormat == GL_RG_INTEGER ||
   srcFormat == GL_RGB_INTEGER_EXT ||
   srcFormat == GL_RGBA_INTEGER_EXT ||
   srcFormat == GL_BGR_INTEGER_EXT ||
-- 
1.7.8.1

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


Re: [Mesa-dev] [PATCH 0/2 v4] Add support for clip distances in Gallium

2012-01-04 Thread Bryan Cain
On 01/02/2012 02:58 PM, Bryan Cain wrote:
 This is the fourth revision of my changes to add support for gl_ClipDistance
 with Gallium.  The first three revisions were sent in closer succession about
 two weeks ago.  This revision is identical to v3 except for the inclusion of
 the changes suggested by Brian Paul in reply to the v3 patches.

Does anyone mind if I push this?  It's been on the list for two full
days with no objections.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-04 Thread Marek Olšák
On Thu, Jan 5, 2012 at 12:45 AM, Eric Anholt e...@anholt.net wrote:
 On Wed, 04 Jan 2012 03:28:12 -0800, Kenneth Graunke kenn...@whitecape.org 
 wrote:
 On 01/03/2012 09:43 PM, Marek Olšák wrote:
  This ProgramStringNotify call causes excessive shader recompilations
  in the game Cogs (from some Humble Bundle). Approximately 25% of
  in-game CPU time is spent on translating shaders and register
  allocation. If the shaders were larger, it would be much worse.
  Moreover, I have realized calling ProgramStringNotify is not needed
  for st/mesa in this case at all (I just comment it out if I want
  higher frame rates), because it doesn't use the prog-SamplerUnits
  array when translating shaders. The array is only used when we set
  samplers, so setting _NEW_TEXTURE is sufficient. It seems that i965
  could do the same thing. Another option would be to cache precompiled
  shaders, but that seems more complicated than doing what st/mesa does.
 
  Marek

 Yeah, I noticed that a while back too, but we never arrived at a
 solution and it slipped off my radar.  I agree completely,
 ProgramStringNotify is completely overkill and bogus.

 We actually already rely on _NEW_TEXTURE for all shader programs.  Since
 the uniform code already flags _NEW_TEXTURE, we should be able to just
 add the SamplerUnits array to the program key (specifically,
 brw_sampler_prog_key_data), and that should take care of any state
 dependent recompiles.  Then we wouldn't need ProgramStringNotify at all.

 Right?

 Well, since the data stored is part of the program, and when just
 changing programs _NEW_TEXTURE wouldn't get set, I think _NEW_PROGRAM is
 the flag you mean.  That would make a ton of sense to me -- if you
 depend on SamplerUnits for your program handling, go look at it when
 _NEW_PROGRAM is flagged.

I don't think this is about what makes sense in theory, but how each
driver handles SamplerUnits. st/mesa just rebinds textures, so it
expects _NEW_TEXTURE. i965 recompiles the fragment program, so it
expects _NEW_PROGRAM. The worst option would be to set both, but at
the same time it's the only option which would work for everybody now.

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


[Mesa-dev] [PATCH] mesa: Add missing GL_RG_INTEGER cases

2012-01-04 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Adds two missing '|| srcFormat == GL_RG_INTEGER' in assertions and a
bunch of missing pixel converions cases.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/pack.c |   39 +++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 2933ff6..8f2c8fd 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -692,6 +692,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint 
n, GLfloat rgba[][4],
  dst[i] = (GLubyte) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*2+0] = (GLubyte) rgba[i][RCOMP];
+ dst[i*2+1] = (GLubyte) rgba[i][GCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLubyte) rgba[i][RCOMP];
@@ -843,6 +849,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint 
n, GLfloat rgba[][4],
  dst[i] = (GLbyte) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*2+0] = (GLbyte) rgba[i][RCOMP];
+ dst[i*2+1] = (GLbyte) rgba[i][GCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLbyte) rgba[i][RCOMP];
@@ -994,6 +1006,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint 
n, GLfloat rgba[][4],
  dst[i] = (GLushort) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*2+0] = (GLushort) rgba[i][RCOMP];
+ dst[i*2+1] = (GLushort) rgba[i][GCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLushort) rgba[i][RCOMP];
@@ -1145,6 +1163,13 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, 
GLuint n, GLfloat rgba[][4],
  dst[i] = (GLshort) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*3+0] = (GLshort) rgba[i][RCOMP];
+ dst[i*3+1] = (GLshort) rgba[i][GCOMP];
+ dst[i*3+2] = (GLshort) rgba[i][BCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLshort) rgba[i][RCOMP];
@@ -1296,6 +1321,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, 
GLuint n, GLfloat rgba[][4],
  dst[i] = (GLuint) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*2+0] = (GLuint) rgba[i][RCOMP];
+ dst[i*2+1] = (GLuint) rgba[i][GCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLuint) rgba[i][RCOMP];
@@ -1454,6 +1485,12 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, 
GLuint n, GLfloat rgba[][4],
  dst[i] = (GLint) rgba[i][ACOMP];
   }
   break;
+   case GL_RG_INTEGER:
+  for (i=0;in;i++) {
+ dst[i*2+0] = (GLint) rgba[i][RCOMP];
+ dst[i*2+1] = (GLint) rgba[i][GCOMP];
+  }
+  break;
case GL_RGB_INTEGER_EXT:
   for (i=0;in;i++) {
  dst[i*3+0] = (GLint) rgba[i][RCOMP];
@@ -2397,6 +2434,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
   srcFormat == GL_GREEN_INTEGER_EXT ||
   srcFormat == GL_BLUE_INTEGER_EXT ||
   srcFormat == GL_ALPHA_INTEGER_EXT ||
+  srcFormat == GL_RG_INTEGER ||
   srcFormat == GL_RGB_INTEGER_EXT ||
   srcFormat == GL_RGBA_INTEGER_EXT ||
   srcFormat == GL_BGR_INTEGER_EXT ||
@@ -3778,6 +3816,7 @@ _mesa_unpack_color_span_float( struct gl_context *ctx,
   srcFormat == GL_GREEN_INTEGER_EXT ||
   srcFormat == GL_BLUE_INTEGER_EXT ||
   srcFormat == GL_ALPHA_INTEGER_EXT ||
+  srcFormat == GL_RG_INTEGER ||
   srcFormat == GL_RGB_INTEGER_EXT ||
   srcFormat == GL_RGBA_INTEGER_EXT ||
   srcFormat == GL_BGR_INTEGER_EXT ||
-- 
1.7.6.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

Re: [Mesa-dev] [PATCH] mesa: Fix bogus transform feedback error message when subscripting non-array.

2012-01-04 Thread Ian Romanick

On 01/04/2012 03:23 PM, Paul Berry wrote:

Previous to this patch, if the client requested transform feedback
using a subscript, but the variable was not an array
(e.g. gl_FrontColor[0]), we would produce a bogus error message like
Transform feedback varying gl_FrontColor[0] found, but it's an array
([] expected).

Changed the error message to e.g. Transfrorm feedback varying
gl_FrontColor[0] requested, but gl_FrontColor is not an array.


Much better.

Reviewed-by: Ian Romanick ian.d.roman...@intel.com


---
  src/glsl/linker.cpp |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 5958516..20d9f3e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1591,9 +1591,9 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
 } else {
/* Regular variable (scalar, vector, or matrix) */
if (this-is_subscripted) {
- linker_error(prog, Transform feedback varying %s found, 
-  but it's an array ([] expected).,
-  this-orig_name);
+ linker_error(prog, Transform feedback varying %s requested, 
+  but %s is not an array.,
+  this-orig_name, this-var_name);
   return false;
}
this-location = output_var-location;


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


Re: [Mesa-dev] [PATCH] mesa: Add missing GL_RG_INTEGER cases

2012-01-04 Thread Kenneth Graunke
On 01/04/2012 04:38 PM, Ian Romanick wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 Adds two missing '|| srcFormat == GL_RG_INTEGER' in assertions and a
 bunch of missing pixel converions cases.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com

Reviewed-by: Kenneth Graunke kenn...@whitecape.org

(My patch was woefully incomplete and didn't actually fix the test after
all.  I don't think I let it run to completion.)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glx: More hacking around versions of XCB that lack GLX_ARB_create_context support

2012-01-04 Thread Laurent Carlier
 From: Ian Romanick ian.d.roman...@intel.com
 
 Detect whether a new enough version of XCB is installed at configure
 time.  If it is not, don't enable the extension and don't build the
 unit tests.
 
 v2: Move the AM_CONDIATION outside the case-statement so that it is
 invoked even for non-GLX builds.  This prevents build failures with
 osmesa, for example.
 

Works fine for me, thanks.

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


[Mesa-dev] [PATCH] [RFC] r600g clip distance support

2012-01-04 Thread Vadim Girlin
The patch requires the Marek's gallium-clip-state branch [1] and the patches
from Bryan Cain for gallium/tgsi clip distance support [2].

Also it seems we need to increase MaxClipPlanes to 8 somewhere.

Tested on evergreen: fixes about 30 tests related to clip distance.

[1] http://lists.freedesktop.org/archives/mesa-dev/2011-December/016577.html
[2] http://lists.freedesktop.org/archives/mesa-dev/2012-January/016737.html

  r600g: implement clip distance

 src/gallium/drivers/r600/evergreen_state.c   |   22 ++---
 src/gallium/drivers/r600/r600_pipe.h |3 ++
 src/gallium/drivers/r600/r600_shader.c   |   42 ++---
 src/gallium/drivers/r600/r600_shader.h   |5 +++
 src/gallium/drivers/r600/r600_state.c|   23 ++
 src/gallium/drivers/r600/r600_state_common.c |   24 +++
 6 files changed, 103 insertions(+), 16 deletions(-)

-- 
1.7.7.5

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


[Mesa-dev] [PATCH] r600g: implement clip distance

2012-01-04 Thread Vadim Girlin
---
 src/gallium/drivers/r600/evergreen_state.c   |   22 ++---
 src/gallium/drivers/r600/r600_pipe.h |3 ++
 src/gallium/drivers/r600/r600_shader.c   |   42 ++---
 src/gallium/drivers/r600/r600_shader.h   |5 +++
 src/gallium/drivers/r600/r600_state.c|   23 ++
 src/gallium/drivers/r600/r600_state_common.c |   24 +++
 6 files changed, 103 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index f5efcbf..0e7c384 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -902,6 +902,7 @@ static void *evergreen_create_rs_state(struct pipe_context 
*ctx,
rs-clamp_fragment_color = state-clamp_fragment_color;
rs-flatshade = state-flatshade;
rs-sprite_coord_enable = state-sprite_coord_enable;
+   rs-user_clip_plane_enable = state-user_clip_plane_enable;
 
clip_rule = state-scissor ? 0x : 0x;
 
@@ -939,8 +940,8 @@ static void *evergreen_create_rs_state(struct pipe_context 
*ctx,

S_028814_POLYMODE_FRONT_PTYPE(r600_translate_fill(state-fill_front)) |

S_028814_POLYMODE_BACK_PTYPE(r600_translate_fill(state-fill_back)), 
0x, NULL, 0);
r600_pipe_state_add_reg(rstate, R_02881C_PA_CL_VS_OUT_CNTL,
-   
S_02881C_USE_VTX_POINT_SIZE(state-point_size_per_vertex) |
-   
S_02881C_VS_OUT_MISC_VEC_ENA(state-point_size_per_vertex), 0x, NULL, 
0);
+   
S_02881C_USE_VTX_POINT_SIZE(state-point_size_per_vertex),
+   S_02881C_USE_VTX_POINT_SIZE(1), NULL, 0);
r600_pipe_state_add_reg(rstate, R_028820_PA_CL_NANINF_CNTL, 0x, 
0x, NULL, 0);
/* point size 12.4 fixed point */
tmp = (unsigned)(state-point_size * 8.0);
@@ -987,9 +988,10 @@ static void *evergreen_create_rs_state(struct pipe_context 
*ctx,
r600_pipe_state_add_reg(rstate, R_028B7C_PA_SU_POLY_OFFSET_CLAMP, 
fui(state-offset_clamp), 0x, NULL, 0);
r600_pipe_state_add_reg(rstate, R_02820C_PA_SC_CLIPRECT_RULE, 
clip_rule, 0x, NULL, 0);
r600_pipe_state_add_reg(rstate, R_028810_PA_CL_CLIP_CNTL,
-   S_028810_PS_UCP_MODE(3) | 
(state-user_clip_plane_enable  63) |
-   S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) |
-   S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip), 
0x, NULL, 0);
+   S_028810_PS_UCP_MODE(3) | 
S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) |
+   S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip),
+   S_028810_PS_UCP_MODE(3) | 
S_028810_ZCLIP_NEAR_DISABLE(1) |
+   S_028810_ZCLIP_FAR_DISABLE(1), NULL, 0);
return rstate;
 }
 
@@ -2463,6 +2465,16 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, 
struct r600_pipe_shader
r600_pipe_state_add_reg(rstate,
R_03A200_SQ_LOOP_CONST_0 + (32 * 4), 0x01000FFF,
0x, NULL, 0);
+
+   r600_pipe_state_add_reg(rstate,
+   R_02881C_PA_CL_VS_OUT_CNTL,
+   
S_02881C_VS_OUT_CCDIST0_VEC_ENA((rshader-clip_dist_write  0x0F) != 0) |
+   
S_02881C_VS_OUT_CCDIST1_VEC_ENA((rshader-clip_dist_write  0xF0) != 0) |
+   
S_02881C_VS_OUT_MISC_VEC_ENA(rshader-vs_out_misc_write),
+   S_02881C_VS_OUT_CCDIST0_VEC_ENA(1) |
+   S_02881C_VS_OUT_CCDIST1_VEC_ENA(1) |
+   S_02881C_VS_OUT_MISC_VEC_ENA(1),
+   NULL, 0);
 }
 
 void evergreen_fetch_shader(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 447b9dc..0967018 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -109,6 +109,7 @@ struct r600_pipe_rasterizer {
boolean clamp_fragment_color;
boolean flatshade;
unsignedsprite_coord_enable;
+   unsigneduser_clip_plane_enable;
float   offset_units;
float   offset_scale;
 };
@@ -218,6 +219,8 @@ struct r600_pipe_context {
/* shader information */
boolean clamp_vertex_color;
boolean clamp_fragment_color;
+   unsigneduser_clip_plane_enable;
+   unsignedclip_dist_enable;
unsignedsprite_coord_enable;
boolean export_16bpc;
unsigned

Re: [Mesa-dev] [PATCH 18/20] mesa: Rewrite the way uniforms are tracked and handled

2012-01-04 Thread Ian Romanick

On 01/03/2012 09:43 PM, Marek Olšák wrote:

On Fri, Oct 28, 2011 at 7:42 PM, Ian Romanicki...@freedesktop.org  wrote:

diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index db2f200..50a724b 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -22,15 +22,16 @@
  * 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.
  */
+#includestdlib.h
  #include main/core.h
  #include main/context.h
  #include ir.h
  #include ir_uniform.h
+#include program/hash_table.h
  #include ../glsl/program.h
  #include ../glsl/ir_uniform.h

  extern C {
-#include main/image.h
  #include main/shaderapi.h
  #include main/shaderobj.h
  #include uniforms.h
@@ -44,42 +45,30 @@ _mesa_GetActiveUniformARB(GLhandleARB program, GLuint index,
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg =
   _mesa_lookup_shader_program_err(ctx, program, glGetActiveUniform);
-   const struct gl_program_parameter *param;

if (!shProg)
   return;

-   if (!shProg-Uniforms || index= shProg-Uniforms-NumUniforms) {
+   if (index= shProg-NumUserUniformStorage) {
   _mesa_error(ctx, GL_INVALID_VALUE, glGetActiveUniform(index));
   return;
}

-   param = get_uniform_parameter(shProg, index);
-   if (!param)
-  return;
-
-   const struct gl_uniform *const uni =shProg-Uniforms-Uniforms[index];
+   const struct gl_uniform_storage *const uni =shProg-UniformStorage[index];

if (nameOut) {
-  _mesa_copy_string(nameOut, maxLength, length, param-Name);
+  _mesa_copy_string(nameOut, maxLength, length, uni-name);
}

if (size) {
-  GLint typeSize = _mesa_sizeof_glsl_type(uni-Type-gl_type);
-  if ((GLint) param-Size  typeSize) {
- /* This is an array.
-  * Array elements are placed on vector[4] boundaries so they're
-  * a multiple of four floats.  We round typeSize up to next multiple
-  * of four to get the right size below.
-  */
- typeSize = (typeSize + 3)  ~3;
-  }
-  /* Note that the returned size is in units of thetype, not bytes */
-  *size = param-Size / typeSize;
+  /* array_elements is zero for non-arrays, but the API requires that 1 be
+   * returned.
+   */
+  *size = MAX2(1, uni-array_elements);
}

if (type) {
-  *type = uni-Type-gl_type;
+  *type = uni-type-gl_type;
}
  }

@@ -409,12 +398,21 @@ validate_uniform_parameters(struct gl_context *ctx,

_mesa_uniform_split_location_offset(location, loc, array_index);

-   if (*loc= shProg-Uniforms-NumUniforms) {
+   if (*loc= shProg-NumUserUniformStorage) {
   _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
  caller, location);
   return false;
}

+   /* This case should be impossible.  The implication is that a call like
+* glGetUniformLocation(prog, foo[8]) was successful but foo is not an
+* array.
+*/
+   if (*array_index != 0  shProg-UniformStorage[*loc].array_elements == 0) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, %s(location=%d),
+ caller, location);
+  return false;
+   }
return true;
  }

@@ -423,72 +421,81 @@ validate_uniform_parameters(struct gl_context *ctx,
  */
  extern C void
  _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
- GLsizei bufSize, GLenum returnType, GLvoid *paramsOut)
+ GLsizei bufSize, enum glsl_base_type returnType,
+ GLvoid *paramsOut)
  {
struct gl_shader_program *shProg =
   _mesa_lookup_shader_program_err(ctx, program, glGetUniformfv);
-   struct gl_program *prog;
-   GLint paramPos;
+   struct gl_uniform_storage *uni;
unsigned loc, offset;

if (!validate_uniform_parameters(ctx, shProg, location, 1,
loc,offset, glGetUniform, true))
   return;

-   if (!find_uniform_parameter_pos(shProg, loc,prog,paramPos)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION,  glGetUniformfv(location));
-   }
-   else {
-  const struct gl_program_parameter *p =
-prog-Parameters-Parameters[paramPos];
-  gl_constant_value (*values)[4];
-  GLint rows, cols, i, j, k;
-  GLsizei numBytes;
-  GLenum storage_type;
-
-  values = prog-Parameters-ParameterValues + paramPos + offset;
-
-  get_uniform_rows_cols(p,rows,cols);
-
-  numBytes = rows * cols * _mesa_sizeof_type(returnType);
-  if (bufSize  numBytes) {
- _mesa_error( ctx, GL_INVALID_OPERATION,
- glGetnUniformfvARB(out of bounds: bufSize is %d,
-  but %d bytes are required), bufSize, numBytes );
- return;
-  }
+   uni =shProg-UniformStorage[loc];

-  if (ctx-Const.NativeIntegers) {
-storage_type = base_uniform_type(p-DataType);
-  } else {
-storage_type = GL_FLOAT;
-  }
+   {
+  unsigned elements = 

Re: [Mesa-dev] [PATCH] mesa: only map src/dest regions in _mesa_copy_buffer_subdata()

2012-01-04 Thread Yuanhan Liu
On Wed, Jan 04, 2012 at 02:55:44PM -0700, Brian Paul wrote:
 We were wastefully mapping the whole source/dest buffers before.
 ---
  src/mesa/main/bufferobj.c |   12 ++--
  1 files changed, 6 insertions(+), 6 deletions(-)

Looks good to me.

Reviewed-by: Yuanhan Liu yuanhan@linux.intel.com
 
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 66957e4..c4a7b8d 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -502,19 +502,19 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size)
  {
 -   GLubyte *srcPtr, *dstPtr;
 +   void *srcPtr, *dstPtr;
  
 /* buffer should not already be mapped */
 assert(!_mesa_bufferobj_mapped(src));
 assert(!_mesa_bufferobj_mapped(dst));
  
 -   srcPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, src-Size,
 -GL_MAP_READ_BIT, src);
 -   dstPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, dst-Size,
 -GL_MAP_WRITE_BIT, dst);
 +   srcPtr = ctx-Driver.MapBufferRange(ctx, readOffset, size,
 +   GL_MAP_READ_BIT, src);
 +   dstPtr = ctx-Driver.MapBufferRange(ctx, writeOffset, size,
 +   GL_MAP_WRITE_BIT, dst);
  
 if (srcPtr  dstPtr)
 -  memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
 +  memcpy(dstPtr, srcPtr, size);
  
 ctx-Driver.UnmapBuffer(ctx, src);
 ctx-Driver.UnmapBuffer(ctx, dst);
 -- 
 1.7.3.4
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/7] i965: Add sensible disasm for the JMPI instruction.

2012-01-04 Thread Eric Anholt
We care about the jump distance, not that the first src is always the
ip register.
---
 src/mesa/drivers/dri/i965/brw_disasm.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c 
b/src/mesa/drivers/dri/i965/brw_disasm.c
index 23ad3de..cfea1a3 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -74,7 +74,7 @@ struct {
 [BRW_OPCODE_SEND] = { .name = send, .nsrc = 1, .ndst = 1 },
 [BRW_OPCODE_SENDC] = { .name = sendc, .nsrc = 1, .ndst = 1 },
 [BRW_OPCODE_NOP] = { .name = nop, .nsrc = 0, .ndst = 0 },
-[BRW_OPCODE_JMPI] = { .name = jmpi, .nsrc = 1, .ndst = 0 },
+[BRW_OPCODE_JMPI] = { .name = jmpi, .nsrc = 0, .ndst = 0 },
 [BRW_OPCODE_IF] = { .name = if, .nsrc = 2, .ndst = 0 },
 [BRW_OPCODE_IFF] = { .name = iff, .nsrc = 2, .ndst = 1 },
 [BRW_OPCODE_WHILE] = { .name = while, .nsrc = 2, .ndst = 0 },
@@ -932,6 +932,8 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, 
int gen)
inst-header.opcode == BRW_OPCODE_ENDIF ||
inst-header.opcode == BRW_OPCODE_WHILE)) {
format (file,  %d, inst-bits1.branch_gen6.jump_count);
+} else if (inst-header.opcode == BRW_OPCODE_JMPI) {
+   format (file,  %d, inst-bits3.d);
 }
 
 if (opcode[inst-header.opcode].nsrc  0) {
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 2/7] swrast: Move the check for fast_copy_pixels() ability to caller.

2012-01-04 Thread Eric Anholt
I'm going to reuse this function from glBlitFramebuffer() handling,
which wants to do the same thing.
---
 src/mesa/swrast/s_copypix.c |   14 +-
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 1dc4286..8fae01f 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -438,14 +438,6 @@ fast_copy_pixels(struct gl_context *ctx,
GLubyte *srcMap, *dstMap;
GLint srcRowStride, dstRowStride;
 
-   if (SWRAST_CONTEXT(ctx)-_RasterMask != 0x0 ||
-   ctx-Pixel.ZoomX != 1.0F ||
-   ctx-Pixel.ZoomY != 1.0F ||
-   ctx-_ImageTransferState) {
-  /* can't handle these */
-  return GL_FALSE;
-   }
-
if (type == GL_COLOR) {
   if (dstFb-_NumColorDrawBuffers != 1)
  return GL_FALSE;
@@ -582,7 +574,11 @@ _swrast_CopyPixels( struct gl_context *ctx,
if (swrast-NewState)
   _swrast_validate_derived( ctx );
 
-   if (fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
+   if (!(SWRAST_CONTEXT(ctx)-_RasterMask != 0x0 ||
+ctx-Pixel.ZoomX != 1.0F ||
+ctx-Pixel.ZoomY != 1.0F ||
+ctx-_ImageTransferState) 
+   fast_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type)) {
   /* all done */
   return;
}
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 4/7] swrast: Fix use of uninitialized value in rbmapping changes.

2012-01-04 Thread Eric Anholt
I'm so surprised that gcc didn't catch this that I feel like I must be
misreading.  srcMap is what we initialize (along with dstMap) from
this map value right after this check.
---
 src/mesa/swrast/s_copypix.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index a14b44b..1e0f9fe 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -500,7 +500,7 @@ swrast_fast_copy_pixels(struct gl_context *ctx,
   srcRb-Width, srcRb-Height,
   GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
   map, rowStride);
-  if (!srcMap) {
+  if (!map) {
  _mesa_error(ctx, GL_OUT_OF_MEMORY, glCopyPixels);
  return GL_TRUE; /* don't retry with slow path */
   }
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 5/7] mesa: Fix packing of stencil bits to MESA_FORMAT_Z32_FLOAT_X24S8.

2012-01-04 Thread Eric Anholt
We were converting our ubyte stencil value to a float.  Just write it
as a uint, which overwrites the X24 part of X24S8 with 0 but shouldn't
matter.
---
 src/mesa/main/format_pack.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
index 840559b..4367711 100644
--- a/src/mesa/main/format_pack.c
+++ b/src/mesa/main/format_pack.c
@@ -2453,7 +2453,7 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n,
   break;
case MESA_FORMAT_Z32_FLOAT_X24S8:
   {
- GLfloat *d = ((GLfloat *) dst);
+ GLuint *d = dst;
  GLuint i;
  for (i = 0; i  n; i++) {
 d[i * 2 + 1] = src[i];
-- 
1.7.7.3

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


[Mesa-dev] [PATCH 3/7] swrast: Use the fast copypixels code to implement fast glBlitFramebuffer().

2012-01-04 Thread Eric Anholt
They were meaning to do the same thing of memcpying rows, so just
write the code once.
---
 src/mesa/swrast/s_blit.c|  167 +--
 src/mesa/swrast/s_copypix.c |   13 ++--
 src/mesa/swrast/swrast.h|5 ++
 3 files changed, 46 insertions(+), 139 deletions(-)

diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
index 803ad2e..6ad4f3f 100644
--- a/src/mesa/swrast/s_blit.c
+++ b/src/mesa/swrast/s_blit.c
@@ -449,117 +449,6 @@ blit_linear(struct gl_context *ctx,
free(dstBuffer);
 }
 
-
-/**
- * Simple case:  Blit color, depth or stencil with no scaling or flipping.
- * XXX we could easily support vertical flipping here.
- */
-static void
-simple_blit(struct gl_context *ctx,
-GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
-GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
-GLbitfield buffer)
-{
-   struct gl_renderbuffer *readRb, *drawRb;
-   const GLint width = srcX1 - srcX0;
-   const GLint height = srcY1 - srcY0;
-   GLint row, srcY, dstY, yStep;
-   GLint comps, bytesPerRow;
-   void *rowBuffer;
-
-   /* only one buffer */
-   ASSERT(_mesa_bitcount(buffer) == 1);
-   /* no flipping checks */
-   ASSERT(srcX0  srcX1);
-   ASSERT(srcY0  srcY1);
-   ASSERT(dstX0  dstX1);
-   ASSERT(dstY0  dstY1);
-   /* size checks */
-   ASSERT(srcX1 - srcX0 == dstX1 - dstX0);
-   ASSERT(srcY1 - srcY0 == dstY1 - dstY0);
-
-   /* From the GL_ARB_framebuffer_object spec:
-*
-* If the source and destination buffers are identical, and the source
-*  and destination rectangles overlap, the result of the blit operation
-*  is undefined.
-*
-* However, we provide the expected result anyway by flipping the order of
-* the memcpy of rows.
-*/
-   if (srcY0  dstY0) {
-  /* src above dst: copy bottom-to-top */
-  yStep = 1;
-  srcY = srcY0;
-  dstY = dstY0;
-   }
-   else {
-  /* src below dst: copy top-to-bottom */
-  yStep = -1;
-  srcY = srcY1 - 1;
-  dstY = dstY1 - 1;
-   }
-
-   switch (buffer) {
-   case GL_COLOR_BUFFER_BIT:
-  readRb = ctx-ReadBuffer-_ColorReadBuffer;
-  drawRb = ctx-DrawBuffer-_ColorDrawBuffers[0];
-  comps = 4;
-  break;
-   case GL_DEPTH_BUFFER_BIT:
-  readRb = ctx-ReadBuffer-_DepthBuffer;
-  drawRb = ctx-DrawBuffer-_DepthBuffer;
-  comps = 1;
-  break;
-   case GL_STENCIL_BUFFER_BIT:
-  readRb = ctx-ReadBuffer-_StencilBuffer;
-  drawRb = ctx-DrawBuffer-_StencilBuffer;
-  comps = 1;
-  break;
-   default:
-  _mesa_problem(ctx, unexpected buffer in simple_blit());
-  return;
-   }
-
-   ASSERT(readRb-DataType == drawRb-DataType);
-
-   /* compute bytes per row */
-   switch (readRb-DataType) {
-   case GL_UNSIGNED_BYTE:
-  bytesPerRow = comps * width * sizeof(GLubyte);
-  break;
-   case GL_UNSIGNED_SHORT:
-  bytesPerRow = comps * width * sizeof(GLushort);
-  break;
-   case GL_UNSIGNED_INT:
-  bytesPerRow = comps * width * sizeof(GLuint);
-  break;
-   case GL_FLOAT:
-  bytesPerRow = comps * width * sizeof(GLfloat);
-  break;
-   default:
-  _mesa_problem(ctx, unexpected buffer type in simple_blit);
-  return;
-   }
-
-   /* allocate the row buffer */
-   rowBuffer = malloc(bytesPerRow);
-   if (!rowBuffer) {
-  _mesa_error(ctx, GL_OUT_OF_MEMORY, glBlitFrameBufferEXT);
-  return;
-   }
-
-   for (row = 0; row  height; row++) {
-  readRb-GetRow(ctx, readRb, width, srcX0, srcY, rowBuffer);
-  drawRb-PutRow(ctx, drawRb, width, dstX0, dstY, rowBuffer, NULL);
-  srcY += yStep;
-  dstY += yStep;
-   }
-
-   free(rowBuffer);
-}
-
-
 /**
  * Software fallback for glBlitFramebufferEXT().
  */
@@ -574,6 +463,11 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
   GL_DEPTH_BUFFER_BIT,
   GL_STENCIL_BUFFER_BIT
};
+   static const GLenum buffer_enums[3] = {
+  GL_COLOR,
+  GL_DEPTH,
+  GL_STENCIL,
+   };
GLint i;
 
if (!_mesa_clip_blit(ctx, srcX0, srcY0, srcX1, srcY1,
@@ -584,39 +478,46 @@ _swrast_BlitFramebuffer(struct gl_context *ctx,
if (SWRAST_CONTEXT(ctx)-NewState)
   _swrast_validate_derived(ctx);
 
-   swrast_render_start(ctx);
-
+   /* First, try covering whatever buffers possible using the fast 1:1 copy
+* path.
+*/
if (srcX1 - srcX0 == dstX1 - dstX0 
srcY1 - srcY0 == dstY1 - dstY0 
srcX0  srcX1 
srcY0  srcY1 
dstX0  dstX1 
dstY0  dstY1) {
-  /* no stretching or flipping.
-   * filter doesn't matter.
-   */
   for (i = 0; i  3; i++) {
  if (mask  buffers[i]) {
-simple_blit(ctx, srcX0, srcY0, srcX1, srcY1,
-dstX0, dstY0, dstX1, dstY1, buffers[i]);
- }
+   if (swrast_fast_copy_pixels(ctx,
+   srcX0, srcY0,
+   srcX1 - srcX0, srcY1 - srcY0,
+   

[Mesa-dev] [PATCH 7/7] i965: Turn on ARB_depth_buffer_float by default.

2012-01-04 Thread Eric Anholt
Everything about this that we have tests for works except for the
deprecated metaops.  The conclusion we came to on IRC sounded like we
were OK with turning it on as long as core functionality works.  The
remaining failures (copypixels, drawpixels) should just be a matter of
finishing the MapRenderbuffer for them.
---
 src/mesa/drivers/dri/intel/intel_extensions.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 09ee9ba..2aff14d 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -112,8 +112,7 @@ intelInitExtensions(struct gl_context *ctx)
 
if (intel-gen = 4) {
   ctx-Extensions.ARB_color_buffer_float = true;
-  if (override_version = 30)
-ctx-Extensions.ARB_depth_buffer_float = true;
+  ctx-Extensions.ARB_depth_buffer_float = true;
   ctx-Extensions.ARB_depth_clamp = true;
   ctx-Extensions.ARB_fragment_coord_conventions = true;
   ctx-Extensions.ARB_fragment_program_shadow = true;
-- 
1.7.7.3

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


Re: [Mesa-dev] [PATCH 1/7] i965: Add sensible disasm for the JMPI instruction.

2012-01-04 Thread Kenneth Graunke
On 01/04/2012 06:04 PM, Eric Anholt wrote:
 We care about the jump distance, not that the first src is always the
 ip register.
 ---
  src/mesa/drivers/dri/i965/brw_disasm.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

Patches 1-5 and 7 are
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

Patch 6 looks good so far too, but I may not finish reading it today.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: only map src/dest regions in _mesa_copy_buffer_subdata()

2012-01-04 Thread Kenneth Graunke
On 01/04/2012 01:55 PM, Brian Paul wrote:
 We were wastefully mapping the whole source/dest buffers before.
 ---
  src/mesa/main/bufferobj.c |   12 ++--
  1 files changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 66957e4..c4a7b8d 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -502,19 +502,19 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
GLintptr readOffset, GLintptr writeOffset,
GLsizeiptr size)
  {
 -   GLubyte *srcPtr, *dstPtr;
 +   void *srcPtr, *dstPtr;
  
 /* buffer should not already be mapped */
 assert(!_mesa_bufferobj_mapped(src));
 assert(!_mesa_bufferobj_mapped(dst));
  
 -   srcPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, src-Size,
 -GL_MAP_READ_BIT, src);
 -   dstPtr = (GLubyte *) ctx-Driver.MapBufferRange(ctx, 0, dst-Size,
 -GL_MAP_WRITE_BIT, dst);
 +   srcPtr = ctx-Driver.MapBufferRange(ctx, readOffset, size,
 +   GL_MAP_READ_BIT, src);
 +   dstPtr = ctx-Driver.MapBufferRange(ctx, writeOffset, size,
 +   GL_MAP_WRITE_BIT, dst);
  
 if (srcPtr  dstPtr)
 -  memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
 +  memcpy(dstPtr, srcPtr, size);
  
 ctx-Driver.UnmapBuffer(ctx, src);
 ctx-Driver.UnmapBuffer(ctx, dst);

LGTM.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 44480] New: Build error with LLVM -DLLVM_APPEND_VC_REV=ON

2012-01-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=44480

 Bug #: 44480
   Summary: Build error with LLVM -DLLVM_APPEND_VC_REV=ON
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: o...@ojab.ru


Created attachment 55154
  -- https://bugs.freedesktop.org/attachment.cgi?id=55154
Strip LLVM svn rev from `llvm-config --version` output

LLVM CMake build has an option to append svn rev to version
(LLVM_APPEND_VC_REV), related ./autogen.sh output looks like something like:
llvm-version:3.1svn-r147373

which lead us to -DHAVE_LLVM=0x0301svn-r147373 and
make[3]: Entering directory `/sources/mesa/src/gallium/auxiliary'
In file included from draw/draw_context.c:40:0:
draw/draw_vs.h:169:5: error: invalid suffix svn on integer constant
draw/draw_context.c:43:5: error: invalid suffix svn on integer constant

Possible patch in the attached file.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- 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