Re: [Mesa-dev] [PATCH] mesa: Fix error generation for glClearBuffer{i ui}v with GL_DEPTH or GL_STENCIL

2011-11-04 Thread Eric Anholt
On Thu,  3 Nov 2011 15:29:29 -0700, Ian Romanick i...@freedesktop.org wrote:
 From: Ian Romanick ian.d.roman...@intel.com
 
 The spec says Only ClearBufferiv should be used to clear
 stencil buffers. and Only ClearBufferfv should be used to clear
 depth buffers.  However, on the following page it also says:
 
 The result of ClearBuffer is undefined if no conversion between
 the type of the specified value and the type of the buffer being
 cleared is defined (for example, if ClearBufferiv is called for a
 fixed- or floating-point buffer, or if ClearBufferfv is called
 for a signed or unsigned integer buffer). *This is not an error.*
 
 Emphasis mine.
 
 Fixes problems with piglit's clearbuffer-invalid-drawbuffer test.
 
 Signed-off-by: Ian Romanick ian.d.roman...@intel.com
 ---
  src/mesa/main/clear.c |   56 
 +
  1 files changed, 56 insertions(+), 0 deletions(-)
 
 diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
 index c35675f..c4e87e1 100644
 --- a/src/mesa/main/clear.c
 +++ b/src/mesa/main/clear.c
 @@ -373,6 +373,23 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, 
 const GLint *value)
   }
}
break;
 +   case GL_DEPTH:
 +  /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
 +   *
 +   * The result of ClearBuffer is undefined if no conversion between
 +   * the type of the specified value and the type of the buffer being
 +   * cleared is defined (for example, if ClearBufferiv is called for 
 a
 +   * fixed- or floating-point buffer, or if ClearBufferfv is called
 +   * for a signed or unsigned integer buffer). This is not an error.
 +   *
 +   * In this case we take undefined and not an error to mean 
 ignore.
 +   */
 +  if (drawbuffer != 0) {
 + _mesa_error(ctx, GL_INVALID_VALUE, glClearBufferiv(drawbuffer=%d),
 + drawbuffer);
 + return;
 +  }
 +  return;

Quoting spec about not generating an error for some condition right
above code for generating an error for an unrelated condition is rather
confusing.

I think quoting the bits about the required value for drawbuffer as well
would clear that up to me.


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


[Mesa-dev] [Bug 41571] libglapi.so.0: undefined symbol: is_selinux_enabled

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=41571

--- Comment #5 from Chia-I Wu olva...@gmail.com 2011-11-04 01:36:19 PDT ---
Created attachment 53140
  -- https://bugs.freedesktop.org/attachment.cgi?id=53140
link with -lselinux

Does this patch help?  You need to re-run autogen.sh.

-- 
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 42517] Abort with llvmpipe renderer: ir_swizzle @ 0x2e8f0a0 specifies a channel not present in the value.

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42517

Vinson Lee v...@vmware.com changed:

   What|Removed |Added

 AssignedTo|mesa-dev@lists.freedesktop. |i...@freedesktop.org
   |org |
  Component|Mesa core   |glsl-compiler

--- Comment #1 from Vinson Lee v...@vmware.com 2011-11-04 01:38:20 PDT ---
Look to be a GLSL compiler issue. Assigning it to the glsl-compiler component.


mesa-7.11/src/glsl/ir_validate.cpp
   447  ir_visitor_status
   448  ir_validate::visit_leave(ir_swizzle *ir)
   449  {
   450 int chans[4] = {ir-mask.x, ir-mask.y, ir-mask.z, ir-mask.w};
   451  
   452 for (unsigned int i = 0; i  ir-type-vector_elements; i++) {
   453if (chans[i] = ir-val-type-vector_elements) {
   454   printf(ir_swizzle @ %p specifies a channel not present 
   455  in the value.\n, (void *) ir);
   456   ir-print();
   457   abort();
   458}
   459 }
   460  
   461 return visit_continue;
   462  }

-- 
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 42586] New: [PNV]mesa demo/arbocclude fail to show the animation displayed

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42586

 Bug #: 42586
   Summary: [PNV]mesa demo/arbocclude fail to show the animation
displayed
Classification: Unclassified
   Product: Mesa
   Version: 7.11
  Platform: All
OS/Version: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Demos
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: guang.a.y...@intel.com
CC: yi@intel.com


System Environment:
--
Platform:   Pineview
Libdrm: (master)2.4.27-1-g961bf9b5c2866ccb4fedf2b45b29fb688519d0db
Mesa:   (7.11)b95767a57ad499a2ed7431e8b0b52966c6dc0a45
Xserver:   (server-1.11-branch)xorg-server-1.11.1
Xf86_video_intel: 
(master)2.16.901-31-g6fd0754e9c81164ca0fdcf96ba2bfb419568187f
Cairo:  (master)c64ec4e49c1f06a451187d5f8360df09a777f61c
Kernel: (master)c3b92c8787367a8bb53d57d9789b558f1295cc96

Bug detailed description:
---
Startx and run mesa demo arbocclude, we only get two blue rectangles, miss the
rotating snakes.

Reproduce steps:

1.xinit 
2. Mesa_demos/src/demos/arbocclude

-- 
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] Performance glxSwapBuffers 32 bit vs. 64 bit

2011-11-04 Thread Theiss, Ingo
Hi everyone,

this is my first post to a mailing list here at freedesktop.org and I hope this 
is the right place for my question/problem.

I am using VirtualGL (http://www.virtualgl.org) for full 3D hardware 
accelerated remote OpenGL applications with latest mesa from git (compiled for 
both 32 bit and 64 bit) on my 64 bit Debian Wheezy box.

When I run a 32 bit application with VirtualGL I suffer nearly 50% performance 
drop compared when running the same 64 bit application with virtualGL. In the 
first place I have contacted the VirtualGL developer and he said that the 
performance drop is not a VirtualGL problem but related to the underlying 3D 
driver. The performance drop seems related to the function glxSwapBuffers which 
can be seen in the function call tracing of VirtualGL:

64 bit application with VirtualGL
-
[VGL] glXSwapBuffers (dpy=0x00deb900(:0) drawable=0x00a2 
pbw-getglxdrawable()=0x0082 ) 28.770924 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.005960 ms
[VGL] glViewport (x=0 y=0 width=1240 height=900 ) 0.003099 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.002861 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.002861 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.00 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.000954 ms
[VGL] glXSwapBuffers (dpy=0x00deb900(:0) drawable=0x00a2 
pbw-getglxdrawable()=0x0082 ) 29.365063 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.006914 ms

32 bit application with VirtualGL
-
[VGL] glXSwapBuffers (dpy=0x087f7458(:0.0) drawable=0x00a2 
pbw-getglxdrawable()=0x0082 ) 65.419075 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.005930 ms
[VGL] glViewport (x=0 y=0 width=1240 height=900 ) 0.003049 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.002989 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.004064 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.001051 ms
[VGL] glPopAttrib (pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.001044 ms
[VGL] glXSwapBuffers (dpy=0x087f7458(:0.0) drawable=0x00a2 
pbw-getglxdrawable()=0x0082 ) 65.005891 ms
[VGL] glDrawBuffer (mode=0x0405 pbw-_dirty=0 pbw-_rdirty=0 
pbw-getglxdrawable()=0x0082 ) 0.004926 ms


Is this performance drop a normal or expected behaviour when running a 32 bit 
application on 64 bit OS or some kind of bug?

Please be kind with me as I am not a developer and hardly understand all the 
stuff you guys are doing.

Thanks for your time!

Regards,

Ingo



PS: Enclosed you will find the output from glxinfo.

64 bit glxinfo
---

name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: VirtualGL
server glx version string: 1.4
server glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info, 
GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig, 
GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
client glx vendor string: VirtualGL
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info, 
GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig, 
GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
GLX version: 1.4
GLX extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info, 
GLX_EXT_visual_rating, GLX_SGI_make_current_read, GLX_SGIX_fbconfig, 
GLX_SGIX_pbuffer, GLX_SUN_get_transparent_index, GLX_ARB_create_context
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD BARTS
OpenGL version string: 2.1 Mesa 7.12-devel (git-9954a93)

32 bit glxinfo
---

name of display: :0.0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: VirtualGL
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_get_proc_address, GLX_ARB_multisample, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig, 
GLX_SGIX_pbuffer, GLX_SGI_make_current_read, 
GLX_SUN_get_transparent_index, 
client glx vendor string: VirtualGL
client glx version string: 1.4
client glx extensions:
GLX_ARB_create_context, GLX_ARB_get_proc_address, GLX_ARB_multisample, 
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig, 
GLX_SGIX_pbuffer, GLX_SGI_make_current_read, 
GLX_SUN_get_transparent_index, 
GLX version: 1.4
GLX extensions:
GLX_ARB_create_context, GLX_ARB_get_proc_address, 

[Mesa-dev] [Bug 42461] Render error when there is no vertex shader

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42461

zhao jian jian.j.z...@intel.com changed:

   What|Removed |Added

 Status|RESOLVED|VERIFIED

--- Comment #5 from zhao jian jian.j.z...@intel.com 2011-11-04 06:21:48 PDT 
---
(In reply to comment #4)
 The test fails because it is completely broken.  It calls
 piglit_ortho_projection, then it draws a rectangle from (0, 0)-(0.5, 0.5). 
 That rectangle covers a quarter of the pixels in the lower-left corner of the
 window.  This is clearly not what was wanted.
 Deleting the call to piglit_ortho_projection causes the test to pass.

Ian, thanks very much for your explaination. I will close it now.

-- 
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] glReadPixels broken w/ latest MapRenderbuffer changes

2011-11-04 Thread Brian Paul
The pure, non-DRI swrast driver dies in all glReadPixels calls when 
reading from the front/back color buffers.  So basically all piglit 
tests fail.


I think that the problem is there is no rb-Data for these surfaces; 
they're XImages/Pixmaps.  The xlib driver needs to have 
Map/UnmapRenderbuffer functions that can access the pixels in the 
XImage/Pixmaps.


Sorry I didn't spot that before you pushed the series, Eric.

I may not be able to dig into this until later, or the weekend.

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


Re: [Mesa-dev] [PATCH] pp: Reorder calloc to avoid memory leak on error path.

2011-11-04 Thread Brian Paul

On 11/03/2011 10:00 PM, Vinson Lee wrote:

Fixes Coverity resource leak defect.
---
  src/gallium/auxiliary/postprocess/pp_mlaa.c |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c 
b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index f514e69..51bc02e 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -212,9 +212,7 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned 
int n,

 struct pipe_box box;
 struct pipe_resource res;
-
-   char *tmp_text = CALLOC(sizeof(blend2fs_1) + sizeof(blend2fs_2) +
-   IMM_SPACE, sizeof(char));
+   char *tmp_text;

 constbuf = pipe_buffer_create(ppq-p-screen, PIPE_BIND_CONSTANT_BUFFER,
   PIPE_USAGE_STATIC, sizeof(constants));
@@ -226,6 +224,9 @@ pp_jimenezmlaa_init_run(struct pp_queue_t *ppq, unsigned 
int n,

 pp_debug(mlaa: using %u max search steps\n, val);

+   tmp_text = CALLOC(sizeof(blend2fs_1) + sizeof(blend2fs_2) +
+ IMM_SPACE, sizeof(char));
+
 if (!tmp_text) {
pp_debug(Failed to allocate shader space\n);
return;


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] g3dvl: Fix memory leaks on error paths.

2011-11-04 Thread Brian Paul

On 11/03/2011 10:12 PM, Vinson Lee wrote:

Fixes Coverity resource leak defect.
---
  src/gallium/auxiliary/vl/vl_mpeg12_decoder.c |5 -
  1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c 
b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index d4b8ae0..2442d78 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -1116,11 +1116,14 @@ vl_create_mpeg12_decoder(struct pipe_context *context,

 default:
assert(0);
+  FREE(dec);
return NULL;
 }

-   if (!format_config)
+   if (!format_config) {
+  FREE(dec);
return NULL;
+   }

 if (!init_zscan(dec, format_config))
goto error_zscan;



Reviewed-by: Brian Paul bri...@vmware.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa/st: Be nice with the stack -- use malloc for large structures/arrays.

2011-11-04 Thread jfonseca
From: José Fonseca jfons...@vmware.com

st_translate_program's data was taking 51K off the stack, causing stack
overflow on Windows.
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |   52 +--
 1 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 6b841f1..529f5f6 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -79,6 +79,12 @@ extern C {
(1  PROGRAM_CONSTANT) | \
(1  PROGRAM_UNIFORM))
 
+/**
+ * Maximum number of temporary registers.
+ *
+ * It is too big for stack allocated arrays -- it will cause stack overflow on
+ * Windows and likely Mac OS X.
+ */
 #define MAX_TEMPS 4096
 
 /* will be 4 for GLSL 4.00 */
@@ -3004,9 +3010,13 @@ 
glsl_to_tgsi_visitor::remove_output_reads(gl_register_file type)
GLint outputMap[VERT_RESULT_MAX];
GLint outputTypes[VERT_RESULT_MAX];
GLuint numVaryingReads = 0;
-   GLboolean usedTemps[MAX_TEMPS];
+   GLboolean *usedTemps;
GLuint firstTemp = 0;
 
+   usedTemps = new GLboolean[MAX_TEMPS];
+   if (!usedTemps) {
+  return;
+   }
_mesa_find_used_registers(prog, PROGRAM_TEMPORARY,
  usedTemps, MAX_TEMPS);
 
@@ -3039,6 +3049,8 @@ 
glsl_to_tgsi_visitor::remove_output_reads(gl_register_file type)
   }
}
 
+   delete [] usedTemps;
+
if (numVaryingReads == 0)
   return; /* nothing to be done */
 
@@ -3110,9 +3122,13 @@ get_src_arg_mask(st_dst_reg dst, st_src_reg src)
 void
 glsl_to_tgsi_visitor::simplify_cmp(void)
 {
-   unsigned tempWrites[MAX_TEMPS];
+   unsigned *tempWrites;
unsigned outputWrites[MAX_PROGRAM_OUTPUTS];
 
+   tempWrites = new unsigned[MAX_TEMPS];
+   if (!tempWrites) {
+  return;
+   }
memset(tempWrites, 0, sizeof(tempWrites));
memset(outputWrites, 0, sizeof(outputWrites));
 
@@ -3128,7 +3144,7 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
   inst-op == TGSI_OPCODE_END ||
   inst-op == TGSI_OPCODE_ENDSUB ||
   inst-op == TGSI_OPCODE_RET) {
- return;
+ break;
   }
 
   if (inst-dst.file == PROGRAM_OUTPUT) {
@@ -3153,6 +3169,8 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
  inst-src[0] = inst-src[1];
   }
}
+
+   delete [] tempWrites;
 }
 
 /* Replaces all references to a temporary register index with another index. */
@@ -4580,14 +4598,19 @@ st_translate_program(
const ubyte outputSemanticIndex[],
boolean passthrough_edgeflags)
 {
-   struct st_translate translate, *t;
+   struct st_translate *t;
unsigned i;
enum pipe_error ret = PIPE_OK;
 
assert(numInputs = Elements(t-inputs));
assert(numOutputs = Elements(t-outputs));
 
-   t = translate;
+   t = CALLOC_STRUCT(st_translate);
+   if (!t) {
+  ret = PIPE_ERROR_OUT_OF_MEMORY;
+  goto out;
+   }
+
memset(t, 0, sizeof *t);
 
t-procType = procType;
@@ -4642,7 +4665,8 @@ st_translate_program(
 break;
  default:
 assert(!fragment shader outputs must be POSITION/STENCIL/COLOR);
-return PIPE_ERROR_BAD_INPUT;
+ret = PIPE_ERROR_BAD_INPUT;
+goto out;
  }
   }
}
@@ -4823,13 +4847,17 @@ st_translate_program(
}
 
 out:
-   FREE(t-insn);
-   FREE(t-labels);
-   FREE(t-constants);
-   FREE(t-immediates);
+   if (t) {
+  FREE(t-insn);
+  FREE(t-labels);
+  FREE(t-constants);
+  FREE(t-immediates);
+
+  if (t-error) {
+ debug_printf(%s: translate error flag set\n, __FUNCTION__);
+  }
 
-   if (t-error) {
-  debug_printf(%s: translate error flag set\n, __FUNCTION__);
+  FREE(t);
}
 
return ret;
-- 
1.7.7.1

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


[Mesa-dev] [PATCH 1/2] st/mesa: set geometry shader to NULL when doing internal drawing

2011-11-04 Thread Marek Olšák
The code expects the geometry shader to be NULL.
We don't have geometry shaders now, but it's good to be prepared.
---
 src/gallium/auxiliary/util/u_blit.c   |   25 +
 src/gallium/auxiliary/util/u_gen_mipmap.c |   16 
 src/mesa/state_tracker/st_cb_bitmap.c |   11 +++
 src/mesa/state_tracker/st_cb_clear.c  |9 +
 src/mesa/state_tracker/st_cb_drawpixels.c |   10 ++
 src/mesa/state_tracker/st_cb_drawtex.c|9 +
 src/mesa/state_tracker/st_context.h   |1 +
 src/mesa/state_tracker/st_extensions.c|4 +++-
 8 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blit.c 
b/src/gallium/auxiliary/util/u_blit.c
index 87530e9..190e93f 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -66,6 +66,8 @@ struct blit_state
struct pipe_vertex_element velem[2];
enum pipe_texture_target internal_target;
 
+   boolean has_geometry_shader;
+
void *vs;
void *fs[TGSI_WRITEMASK_XYZW + 1];
void *fs_depth;
@@ -142,6 +144,11 @@ util_create_blit(struct pipe_context *pipe, struct 
cso_context *cso)
else
   ctx-internal_target = PIPE_TEXTURE_RECT;
 
+   if (pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
+PIPE_SHADER_CAP_MAX_INSTRUCTIONS)  0) {
+  ctx-has_geometry_shader = TRUE;
+   }
+
return ctx;
 }
 
@@ -531,6 +538,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_save_framebuffer(ctx-cso);
cso_save_fragment_shader(ctx-cso);
cso_save_vertex_shader(ctx-cso);
+   if (ctx-has_geometry_shader) {
+  cso_save_geometry_shader(ctx-cso);
+   }
cso_save_clip(ctx-cso);
cso_save_vertex_elements(ctx-cso);
cso_save_vertex_buffers(ctx-cso);
@@ -574,6 +584,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
   set_fragment_shader(ctx, writemask);
}
set_vertex_shader(ctx);
+   if (ctx-has_geometry_shader) {
+  cso_set_geometry_shader_handle(ctx-cso, NULL);
+   }
 
/* drawing dest */
memset(fb, 0, sizeof(fb));
@@ -612,6 +625,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_restore_framebuffer(ctx-cso);
cso_restore_fragment_shader(ctx-cso);
cso_restore_vertex_shader(ctx-cso);
+   if (ctx-has_geometry_shader) {
+  cso_restore_geometry_shader(ctx-cso);
+   }
cso_restore_clip(ctx-cso);
cso_restore_vertex_elements(ctx-cso);
cso_restore_vertex_buffers(ctx-cso);
@@ -719,6 +735,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_framebuffer(ctx-cso);
cso_save_fragment_shader(ctx-cso);
cso_save_vertex_shader(ctx-cso);
+   if (ctx-has_geometry_shader) {
+  cso_save_geometry_shader(ctx-cso);
+   }
cso_save_clip(ctx-cso);
cso_save_vertex_elements(ctx-cso);
cso_save_vertex_buffers(ctx-cso);
@@ -754,6 +773,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
/* shaders */
set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW);
set_vertex_shader(ctx);
+   if (ctx-has_geometry_shader) {
+  cso_set_geometry_shader_handle(ctx-cso, NULL);
+   }
 
/* drawing dest */
memset(fb, 0, sizeof(fb));
@@ -788,6 +810,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_framebuffer(ctx-cso);
cso_restore_fragment_shader(ctx-cso);
cso_restore_vertex_shader(ctx-cso);
+   if (ctx-has_geometry_shader) {
+  cso_restore_geometry_shader(ctx-cso);
+   }
cso_restore_clip(ctx-cso);
cso_restore_vertex_elements(ctx-cso);
cso_restore_vertex_buffers(ctx-cso);
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c 
b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 4a16624..92302f5 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -66,6 +66,8 @@ struct gen_mipmap_state
struct pipe_clip_state clip;
struct pipe_vertex_element velem[2];
 
+   boolean has_geometry_shader;
+
void *vs;
void *fs[TGSI_TEXTURE_COUNT]; /** Not all are used, but simplifies code */
 
@@ -1308,6 +1310,11 @@ util_create_gen_mipmap(struct pipe_context *pipe,
   ctx-vertices[i][1][3] = 1.0f; /* q */
}
 
+   if (pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
+PIPE_SHADER_CAP_MAX_INSTRUCTIONS)  0) {
+  ctx-has_geometry_shader = TRUE;
+   }
+
/* Note: the actual vertex buffer is allocated as needed below */
 
return ctx;
@@ -1561,6 +1568,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_framebuffer(ctx-cso);
cso_save_fragment_shader(ctx-cso);
cso_save_vertex_shader(ctx-cso);
+   if (ctx-has_geometry_shader) {
+  cso_save_geometry_shader(ctx-cso);
+   }
cso_save_viewport(ctx-cso);
cso_save_clip(ctx-cso);
cso_save_vertex_elements(ctx-cso);
@@ -1574,6 +1584,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 
set_fragment_shader(ctx, type);
set_vertex_shader(ctx);
+   if (ctx-has_geometry_shader) {
+   

[Mesa-dev] [PATCH 2/2] gallium/cso_cache: remove one call to pipe_sampler_view_reference

2011-11-04 Thread Marek Olšák
---
 src/gallium/auxiliary/cso_cache/cso_context.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index fdd40fc..b91fe1a 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -1265,8 +1265,10 @@ restore_sampler_views(struct cso_context *ctx,
uint i;
 
for (i = 0; i  info-nr_views_saved; i++) {
-  pipe_sampler_view_reference(info-views[i], info-views_saved[i]);
-  pipe_sampler_view_reference(info-views_saved[i], NULL);
+  pipe_sampler_view_reference(info-views[i], NULL);
+  /* move the reference from one pointer to another */
+  info-views[i] = info-views_saved[i];
+  info-views_saved[i] = NULL;
}
for (; i  info-nr_views; i++) {
   pipe_sampler_view_reference(info-views[i], NULL);
-- 
1.7.4.1

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


Re: [Mesa-dev] [PATCH 1/2] swrast: update program type assertion

2011-11-04 Thread Ian Romanick

On 11/03/2011 06:58 PM, Brian Paul wrote:

Fixes bogus failed assertion when using NV_fragment_program, such
as with demos/fplight.c

Note: This is a candidate for the 7.11 branch.
---
  src/mesa/swrast/s_context.c |4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 9112cf3..98702f0 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -249,7 +249,9 @@ _swrast_update_fog_state( struct gl_context *ctx )
 SWcontext *swrast = SWRAST_CONTEXT(ctx);
 const struct gl_fragment_program *fp = ctx-FragmentProgram._Current;

-   assert((fp == NULL) || (fp-Base.Target == GL_FRAGMENT_PROGRAM_ARB));
+   assert((fp == NULL) ||
+  (fp-Base.Target == GL_FRAGMENT_PROGRAM_ARB) ||
+  (fp-Base.Target == GL_FRAGMENT_PROGRAM_NV));

 /* determine if fog is needed, and if so, which fog mode */
 swrast-_FogEnabled = (fp == NULL  ctx-Fog.Enabled);


It seems like I have have added other similar assertions when I did the 
big fog rework.  Is this the only one that needs fixing?

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


[Mesa-dev] [PATCH 1/2] r600g: precalculate semantic indices for SPI setup

2011-11-04 Thread Vadim Girlin
There is no need to duplicate semantic mapping which is done in hw, so get
rid of r600_find_vs_semantic_index.

TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

Signed-off-by: Vadim Girlin vadimgir...@gmail.com
---

This patch and the next one were tested on the evergreen,
there are some changes in the test results:

Following tests are passing due to slightly different handling of 
TGSI_SEMANTIC_BCOLOR (it's still not completely correct).
vertex-program-two-side enabled back back2  fail - pass
vertex-program-two-side enabled back front2 fail - pass
vertex-program-two-side enabled front back2 fail - pass

This test usually fails for me after these patches, but passes when
it's run independently - probably unrelated:
time-elapsedpass - fail

 src/gallium/drivers/r600/evergreen_state.c   |   19 
 src/gallium/drivers/r600/r600_shader.c   |   67 --
 src/gallium/drivers/r600/r600_shader.h   |2 +-
 src/gallium/drivers/r600/r600_state.c|   20 +++-
 src/gallium/drivers/r600/r600_state_common.c |   13 ++---
 5 files changed, 64 insertions(+), 57 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index fd2e5da..904267d 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -2375,20 +2375,20 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, 
struct r600_pipe_shader
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
struct r600_pipe_state *rstate = shader-rstate;
struct r600_shader *rshader = shader-shader;
-   unsigned spi_vs_out_id[10];
-   unsigned i, tmp, nparams;
+   unsigned spi_vs_out_id[10] = {};
+   unsigned i, tmp, nparams = 0;
 
/* clear previous register */
rstate-nregs = 0;
 
-   /* so far never got proper semantic id from tgsi */
-   for (i = 0; i  10; i++) {
-   spi_vs_out_id[i] = 0;
-   }
-   for (i = 0; i  32; i++) {
-   tmp = i  ((i  3) * 8);
-   spi_vs_out_id[i / 4] |= tmp;
+   for (i = 0; i  rshader-noutput; i++) {
+   if (rshader-output[i].spi_sid) {
+   tmp = rshader-output[i].spi_sid  ((nparams  3) * 8);
+   spi_vs_out_id[nparams / 4] |= tmp;
+   nparams++;
+   }
}
+
for (i = 0; i  10; i++) {
r600_pipe_state_add_reg(rstate,
R_02861C_SPI_VS_OUT_ID_0 + i * 4,
@@ -2399,7 +2399,6 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, 
struct r600_pipe_shader
 * VS is required to export at least one param and 
r600_shader_from_tgsi()
 * takes care of adding a dummy export.
 */
-   nparams = rshader-noutput - rshader-npos;
if (nparams  1)
nparams = 1;
 
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 87164ce..448e03a 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -57,24 +57,6 @@ issued in the w slot as well.
 The compiler must issue the source argument to slots z, y, and x
 */
 
-
-int r600_find_vs_semantic_index(struct r600_shader *vs,
-   struct r600_shader *ps, int id)
-{
-   struct r600_shader_io *input = ps-input[id];
-   int index = 0;
-
-   for (int i = 0; i  vs-noutput; i++) {
-   if (input-name == vs-output[i].name 
-   input-sid == vs-output[i].sid)
-   return index;
-   else if (vs-output[i].name != TGSI_SEMANTIC_POSITION 
-vs-output[i].name != TGSI_SEMANTIC_PSIZE)
-   index++;
-   }
-   return 0;
-}
-
 static int r600_pipe_shader(struct pipe_context *ctx, struct r600_pipe_shader 
*shader)
 {
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
@@ -361,6 +343,44 @@ static int evergreen_interp_flat(struct r600_shader_ctx 
*ctx, int input)
  * DB_SOURCE_FORMAT - export control restrictions
  *
  */
+
+
+/* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
+static int r600_spi_sid(struct r600_shader_io * io)
+{
+   int index, name = io-name;
+
+   /* These params are handled differently, they don't need
+* semantic indices, so we'll use 0 for them.
+*/
+   if (name == TGSI_SEMANTIC_POSITION ||
+   name == TGSI_SEMANTIC_PSIZE ||
+   name == TGSI_SEMANTIC_FACE)
+   index = 0;
+   else {
+   if (name == TGSI_SEMANTIC_GENERIC) {
+   /* For generic params simply use sid from tgsi */
+   index = io-sid;
+   } else {
+
+   /* FIXME: two-side rendering is 

[Mesa-dev] [PATCH 2/2] r600g: move SPI setup to PS setup

2011-11-04 Thread Vadim Girlin
SPI semantic indices for PS/VS are now static, so we don't
need to update spi config for every shaders combination. We can move
the functionality of r600_spi_update to r600(evergreen)_pipe_shader_ps.

Flatshade state is now controlled by the global FLAT_SHADE_ENA flag
instead of updating FLAT_SHADE for all inputs.

Sprite coord still requires the update of spi setup when
sprite_coord_enable is first changed from zero (enabled), and then
only when it's changed to other non-zero value (enabled for other input).
Change to zero (disabling) and back to the same value is handled via
global SPRITE_COORD_ENA.

New field sprite_coord_enable added to struct r600_pipe_shader
to track current state for the pixel shader. It's checked in the
r600_update_derived_state.

Signed-off-by: Vadim Girlin vadimgir...@gmail.com
---
 src/gallium/drivers/r600/evergreen_state.c   |   30 +-
 src/gallium/drivers/r600/r600_pipe.h |4 +-
 src/gallium/drivers/r600/r600_state.c|   29 +-
 src/gallium/drivers/r600/r600_state_common.c |   84 +-
 4 files changed, 73 insertions(+), 74 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 904267d..c0b057c 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -908,7 +908,7 @@ static void *evergreen_create_rs_state(struct pipe_context 
*ctx,
rstate-id = R600_PIPE_STATE_RASTERIZER;
if (state-flatshade_first)
prov_vtx = 0;
-   tmp = S_0286D4_FLAT_SHADE_ENA(1);
+   tmp = S_0286D4_FLAT_SHADE_ENA(state-flatshade);
if (state-sprite_coord_enable) {
tmp |= S_0286D4_PNT_SPRITE_ENA(1) |
S_0286D4_PNT_SPRITE_OVRD_X(2) |
@@ -2246,7 +2246,7 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, 
struct r600_pipe_shader
int pos_index = -1, face_index = -1;
int ninterp = 0;
boolean have_linear = FALSE, have_centroid = FALSE, have_perspective = 
FALSE;
-   unsigned spi_baryc_cntl;
+   unsigned spi_baryc_cntl, sid, tmp, idx = 0;
 
rstate-nregs = 0;
 
@@ -2267,7 +2267,31 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, 
struct r600_pipe_shader
if (rshader-input[i].centroid)
have_centroid = TRUE;
}
+
+   sid = rshader-input[i].spi_sid;
+
+   if (sid) {
+
+   tmp = S_028644_SEMANTIC(sid);
+
+   if (rshader-input[i].name == TGSI_SEMANTIC_COLOR ||
+   rshader-input[i].name == 
TGSI_SEMANTIC_BCOLOR ||
+   rshader-input[i].name == 
TGSI_SEMANTIC_POSITION) {
+   tmp |= S_028644_FLAT_SHADE(1);
+   }
+
+   if (rshader-input[i].name == TGSI_SEMANTIC_GENERIC 
+   rctx-sprite_coord_enable  (1  
rshader-input[i].sid)) {
+   tmp |= S_028644_PT_SPRITE_TEX(1);
+   }
+
+   r600_pipe_state_add_reg(rstate, 
R_028644_SPI_PS_INPUT_CNTL_0 + idx * 4,
+   tmp, 0x, NULL, 0);
+
+   idx++;
+   }
}
+
for (i = 0; i  rshader-noutput; i++) {
if (rshader-output[i].name == TGSI_SEMANTIC_POSITION)
db_shader_control |= S_02880C_Z_EXPORT_ENABLE(1);
@@ -2368,6 +2392,8 @@ void evergreen_pipe_shader_ps(struct pipe_context *ctx, 
struct r600_pipe_shader
r600_pipe_state_add_reg(rstate,
R_03A200_SQ_LOOP_CONST_0, 0x01000FFF,
0x, NULL, 0);
+
+   shader-sprite_coord_enable = rctx-sprite_coord_enable;
 }
 
 void evergreen_pipe_shader_vs(struct pipe_context *ctx, struct 
r600_pipe_shader *shader)
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 330e320..92cb34d 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -68,7 +68,6 @@ enum r600_pipe_state_id {
R600_PIPE_STATE_RESOURCE,
R600_PIPE_STATE_POLYGON_OFFSET,
R600_PIPE_STATE_FETCH_SHADER,
-   R600_PIPE_STATE_SPI,
R600_PIPE_NSTATES
 };
 
@@ -133,6 +132,7 @@ struct r600_pipe_shader {
struct r600_resource*bo_fetch;
struct r600_vertex_element  vertex_elements;
struct tgsi_token   *tokens;
+   unsignedsprite_coord_enable;
 };
 
 struct r600_pipe_sampler_state {
@@ -215,9 +215,7 @@ struct r600_pipe_context {
/* shader information */
boolean clamp_vertex_color;
boolean clamp_fragment_color;
-   boolean spi_dirty;
unsigned  

Re: [Mesa-dev] [PATCH 1/2] swrast: update program type assertion

2011-11-04 Thread Brian Paul

On 11/04/2011 11:15 AM, Ian Romanick wrote:

On 11/03/2011 06:58 PM, Brian Paul wrote:

Fixes bogus failed assertion when using NV_fragment_program, such
as with demos/fplight.c

Note: This is a candidate for the 7.11 branch.
---
src/mesa/swrast/s_context.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 9112cf3..98702f0 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -249,7 +249,9 @@ _swrast_update_fog_state( struct gl_context *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
const struct gl_fragment_program *fp = ctx-FragmentProgram._Current;

- assert((fp == NULL) || (fp-Base.Target == GL_FRAGMENT_PROGRAM_ARB));
+ assert((fp == NULL) ||
+ (fp-Base.Target == GL_FRAGMENT_PROGRAM_ARB) ||
+ (fp-Base.Target == GL_FRAGMENT_PROGRAM_NV));

/* determine if fog is needed, and if so, which fog mode */
swrast-_FogEnabled = (fp == NULL ctx-Fog.Enabled);


It seems like I have have added other similar assertions when I did
the big fog rework. Is this the only one that needs fixing?


That's the only failure I've seen.

-Brian

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


[Mesa-dev] [PATCH] t_vertex: fix mipmap generation on rv100 swtcl.

2011-11-04 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

the meta mipmap generator on rv100 is passing a s,t,r coordinate, but r100
is ancient so has no r handling in hw, so we have to pass a s,t,q with q
set to 1.

/me dares someone to review this :)

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/mesa/tnl/t_vertex_generic.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
index 7b7f511..7150874 100644
--- a/src/mesa/tnl/t_vertex_generic.c
+++ b/src/mesa/tnl/t_vertex_generic.c
@@ -207,6 +207,18 @@ static inline void insert_3f_xyw_4( const struct 
tnl_clipspace_attr *a, GLubyte
out[2] = in[3];
 }
 
+/* R100 has no R coordinate, but meta mipmap generate causes it to see one,
+   so just pack s and t and set q to 1 */
+static inline void insert_3f_xyw_3( const struct tnl_clipspace_attr *a, 
GLubyte *v, const GLfloat *in )
+{
+   GLfloat *out = (GLfloat *)(v);
+   (void) a;
+   DEBUG_INSERT;
+   out[0] = in[0];
+   out[1] = in[1];
+   out[2] = 1;
+}
+
 static inline void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, 
GLubyte *v, const GLfloat *in )
 {
(void) a; (void) v; (void) in;
@@ -801,7 +813,7 @@ const struct tnl_format_info _tnl_format_info[EMIT_MAX] =
 
{ 3f_xyw,
  extract_3f_xyw,
- { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_err, 
+ { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_3,
insert_3f_xyw_4 },
  3 * sizeof(GLfloat) },
 
-- 
1.7.6.4

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


Re: [Mesa-dev] [PATCH 1/2] st/mesa: set geometry shader to NULL when doing internal drawing

2011-11-04 Thread Jose Fonseca
What about checking has_geometry_shader inside cso module, and make 
cso_save_geometry_shader no-ops when it's false?

Seems less code and more reusable.

Jose

- Original Message -
 The code expects the geometry shader to be NULL.
 We don't have geometry shaders now, but it's good to be prepared.
 ---
  src/gallium/auxiliary/util/u_blit.c   |   25
  +
  src/gallium/auxiliary/util/u_gen_mipmap.c |   16 
  src/mesa/state_tracker/st_cb_bitmap.c |   11 +++
  src/mesa/state_tracker/st_cb_clear.c  |9 +
  src/mesa/state_tracker/st_cb_drawpixels.c |   10 ++
  src/mesa/state_tracker/st_cb_drawtex.c|9 +
  src/mesa/state_tracker/st_context.h   |1 +
  src/mesa/state_tracker/st_extensions.c|4 +++-
  8 files changed, 84 insertions(+), 1 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_blit.c
 b/src/gallium/auxiliary/util/u_blit.c
 index 87530e9..190e93f 100644
 --- a/src/gallium/auxiliary/util/u_blit.c
 +++ b/src/gallium/auxiliary/util/u_blit.c
 @@ -66,6 +66,8 @@ struct blit_state
 struct pipe_vertex_element velem[2];
 enum pipe_texture_target internal_target;
  
 +   boolean has_geometry_shader;
 +
 void *vs;
 void *fs[TGSI_WRITEMASK_XYZW + 1];
 void *fs_depth;
 @@ -142,6 +144,11 @@ util_create_blit(struct pipe_context *pipe,
 struct cso_context *cso)
 else
ctx-internal_target = PIPE_TEXTURE_RECT;
  
 +   if (pipe-screen-get_shader_param(pipe-screen,
 PIPE_SHADER_GEOMETRY,
 +PIPE_SHADER_CAP_MAX_INSTRUCTIONS) 
 0) {
 +  ctx-has_geometry_shader = TRUE;
 +   }
 +
 return ctx;
  }
  
 @@ -531,6 +538,9 @@ util_blit_pixels_writemask(struct blit_state
 *ctx,
 cso_save_framebuffer(ctx-cso);
 cso_save_fragment_shader(ctx-cso);
 cso_save_vertex_shader(ctx-cso);
 +   if (ctx-has_geometry_shader) {
 +  cso_save_geometry_shader(ctx-cso);
 +   }
 cso_save_clip(ctx-cso);
 cso_save_vertex_elements(ctx-cso);
 cso_save_vertex_buffers(ctx-cso);
 @@ -574,6 +584,9 @@ util_blit_pixels_writemask(struct blit_state
 *ctx,
set_fragment_shader(ctx, writemask);
 }
 set_vertex_shader(ctx);
 +   if (ctx-has_geometry_shader) {
 +  cso_set_geometry_shader_handle(ctx-cso, NULL);
 +   }
  
 /* drawing dest */
 memset(fb, 0, sizeof(fb));
 @@ -612,6 +625,9 @@ util_blit_pixels_writemask(struct blit_state
 *ctx,
 cso_restore_framebuffer(ctx-cso);
 cso_restore_fragment_shader(ctx-cso);
 cso_restore_vertex_shader(ctx-cso);
 +   if (ctx-has_geometry_shader) {
 +  cso_restore_geometry_shader(ctx-cso);
 +   }
 cso_restore_clip(ctx-cso);
 cso_restore_vertex_elements(ctx-cso);
 cso_restore_vertex_buffers(ctx-cso);
 @@ -719,6 +735,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
 cso_save_framebuffer(ctx-cso);
 cso_save_fragment_shader(ctx-cso);
 cso_save_vertex_shader(ctx-cso);
 +   if (ctx-has_geometry_shader) {
 +  cso_save_geometry_shader(ctx-cso);
 +   }
 cso_save_clip(ctx-cso);
 cso_save_vertex_elements(ctx-cso);
 cso_save_vertex_buffers(ctx-cso);
 @@ -754,6 +773,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
 /* shaders */
 set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW);
 set_vertex_shader(ctx);
 +   if (ctx-has_geometry_shader) {
 +  cso_set_geometry_shader_handle(ctx-cso, NULL);
 +   }
  
 /* drawing dest */
 memset(fb, 0, sizeof(fb));
 @@ -788,6 +810,9 @@ util_blit_pixels_tex(struct blit_state *ctx,
 cso_restore_framebuffer(ctx-cso);
 cso_restore_fragment_shader(ctx-cso);
 cso_restore_vertex_shader(ctx-cso);
 +   if (ctx-has_geometry_shader) {
 +  cso_restore_geometry_shader(ctx-cso);
 +   }
 cso_restore_clip(ctx-cso);
 cso_restore_vertex_elements(ctx-cso);
 cso_restore_vertex_buffers(ctx-cso);
 diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c
 b/src/gallium/auxiliary/util/u_gen_mipmap.c
 index 4a16624..92302f5 100644
 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c
 +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
 @@ -66,6 +66,8 @@ struct gen_mipmap_state
 struct pipe_clip_state clip;
 struct pipe_vertex_element velem[2];
  
 +   boolean has_geometry_shader;
 +
 void *vs;
 void *fs[TGSI_TEXTURE_COUNT]; /** Not all are used, but
 simplifies code */
  
 @@ -1308,6 +1310,11 @@ util_create_gen_mipmap(struct pipe_context
 *pipe,
ctx-vertices[i][1][3] = 1.0f; /* q */
 }
  
 +   if (pipe-screen-get_shader_param(pipe-screen,
 PIPE_SHADER_GEOMETRY,
 +PIPE_SHADER_CAP_MAX_INSTRUCTIONS) 
 0) {
 +  ctx-has_geometry_shader = TRUE;
 +   }
 +
 /* Note: the actual vertex buffer is allocated as needed below */
  
 return ctx;
 @@ -1561,6 +1568,9 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
 cso_save_framebuffer(ctx-cso);
 cso_save_fragment_shader(ctx-cso);
 cso_save_vertex_shader(ctx-cso);
 +   if 

Re: [Mesa-dev] [PATCH 2/2] gallium/cso_cache: remove one call to pipe_sampler_view_reference

2011-11-04 Thread Jose Fonseca
Looks ok to me.

Jose

- Original Message -
 ---
  src/gallium/auxiliary/cso_cache/cso_context.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c
 b/src/gallium/auxiliary/cso_cache/cso_context.c
 index fdd40fc..b91fe1a 100644
 --- a/src/gallium/auxiliary/cso_cache/cso_context.c
 +++ b/src/gallium/auxiliary/cso_cache/cso_context.c
 @@ -1265,8 +1265,10 @@ restore_sampler_views(struct cso_context *ctx,
 uint i;
  
 for (i = 0; i  info-nr_views_saved; i++) {
 -  pipe_sampler_view_reference(info-views[i],
 info-views_saved[i]);
 -  pipe_sampler_view_reference(info-views_saved[i], NULL);
 +  pipe_sampler_view_reference(info-views[i], NULL);
 +  /* move the reference from one pointer to another */
 +  info-views[i] = info-views_saved[i];
 +  info-views_saved[i] = NULL;
 }
 for (; i  info-nr_views; i++) {
pipe_sampler_view_reference(info-views[i], NULL);
 --
 1.7.4.1
 
 ___
 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] [PATCH] t_vertex: fix mipmap generation on rv100 swtcl.

2011-11-04 Thread Roland Scheidegger
Am 04.11.2011 18:49, schrieb Dave Airlie:
 From: Dave Airlie airl...@redhat.com
 
 the meta mipmap generator on rv100 is passing a s,t,r coordinate, but r100
 is ancient so has no r handling in hw, so we have to pass a s,t,q with q
 set to 1.
 
 /me dares someone to review this :)
 
 Signed-off-by: Dave Airlie airl...@redhat.com
 ---
  src/mesa/tnl/t_vertex_generic.c |   14 +-
  1 files changed, 13 insertions(+), 1 deletions(-)
 
 diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c
 index 7b7f511..7150874 100644
 --- a/src/mesa/tnl/t_vertex_generic.c
 +++ b/src/mesa/tnl/t_vertex_generic.c
 @@ -207,6 +207,18 @@ static inline void insert_3f_xyw_4( const struct 
 tnl_clipspace_attr *a, GLubyte
 out[2] = in[3];
  }
  
 +/* R100 has no R coordinate, but meta mipmap generate causes it to see one,
 +   so just pack s and t and set q to 1 */
 +static inline void insert_3f_xyw_3( const struct tnl_clipspace_attr *a, 
 GLubyte *v, const GLfloat *in )
 +{
 +   GLfloat *out = (GLfloat *)(v);
 +   (void) a;
 +   DEBUG_INSERT;
 +   out[0] = in[0];
 +   out[1] = in[1];
 +   out[2] = 1;
 +}
 +
  static inline void insert_3f_xyw_err( const struct tnl_clipspace_attr *a, 
 GLubyte *v, const GLfloat *in )
  {
 (void) a; (void) v; (void) in;
 @@ -801,7 +813,7 @@ const struct tnl_format_info _tnl_format_info[EMIT_MAX] =
  
 { 3f_xyw,
   extract_3f_xyw,
 - { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_err, 
 + { insert_3f_xyw_err, insert_3f_xyw_err, insert_3f_xyw_3,
 insert_3f_xyw_4 },
   3 * sizeof(GLfloat) },
  

I think the comment is a bit confusing (it's not quite correct to say
r100 has no r handling as the limitation is that is only has 3 coords
and the 3rd is interpreted either as r (for cube or possibly volume
textures, the latter we never got to work) or q IIRC).
As for the code looks a bit hackish but if it works? I don't quite
understand though why this would only happen with meta mipmap code.
Or maybe could fix this in radeon?
I assume the 3f_xyw is caused by this bit in radeon_swtcl.c:
case 3:
case 4:
   if (ctx-Texture.Unit[i]._ReallyEnabled  (TEXTURE_CUBE_BIT) ) {
  EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_3F,
 radeon_cp_vc_frmts[i][1] );
   } else {
  EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_3F_XYW,
 radeon_cp_vc_frmts[i][1] );
   }
   break;

If so maybe could downgrade the size 3 case to a EMIT_2F instead if it's
not a cube map? Not sure off-hand why it's done that way. Maybe because
of apps using 3 coords then swapping 3rd and 4th coord in texturematrix
(IIRC ut2k3 for instance does that) but that probably shouldn't be
relevant here for swtnl code - or if it is the whole logic would look
broken.

Roland

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


[Mesa-dev] [Bug 42540] glxgears segfaults on POWER / Xvnc

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42540

--- Comment #2 from hugh.m.bri...@gmail.com 2011-11-04 12:53:06 PDT ---
José Fonseca 

Thanks very much for your help. 

I dont know if real X works; I dont have root access. I asked the admin to
install a few debug libraries. Here is the result:

#0  0x7c0802a6f8010010 in ?? ()
#1  0x0fffb7cd1454 in llvm_pipeline_generic (middle=0x100a3840, 
fetch_info=0xfffe098, prim_info=0xfffe068)
at draw/draw_pt_fetch_shade_pipeline_llvm.c:246
#2  0x0fffb7cd1588 in llvm_middle_end_linear_run (middle=optimized out, 
start=optimized out, count=value has been optimized out
)
at draw/draw_pt_fetch_shade_pipeline_llvm.c:364
#3  0x0fffb7c61d58 in vsplit_segment_simple_linear (icount=82, istart=0, 
flags=0, vsplit=0x100a09f0) at draw/draw_pt_vsplit_tmp.h:237
#4  vsplit_run_linear (frontend=0x100a09f0, start=optimized out, count=82)
at draw/draw_split_tmp.h:61
#5  0x0fffb7c5cc2c in draw_pt_arrays (draw=optimized out, 
prim=optimized out, start=optimized out, count=82)
at draw/draw_pt.c:113
#6  0x0fffb7c5d098 in draw_vbo (draw=0x100980d0, info=0xfffe3e4)
at draw/draw_pt.c:491
#7  0x0fffb7a6968c in llvmpipe_draw_vbo (pipe=0x100534e0, 
info=0xfffe3e4) at lp_draw_arrays.c:81
#8  0x0fffb7b39428 in st_draw_vbo (ctx=0x100f9690, arrays=optimized out, 
prims=optimized out, nr_prims=optimized out, ib=optimized out, 
index_bounds_valid=optimized out, min_index=0, max_index=161)
at state_tracker/st_draw.c:763
#9  0x0fffb7c15b08 in vbo_save_playback_vertex_list (ctx=0x100f9690, 
data=0x10152908) at vbo/vbo_save_draw.c:293
#10 0x0fffb7a8f930 in ext_opcode_execute (node=0x10152900, ctx=0x100f9690)
at main/dlist.c:592
#11 execute_list (ctx=0x100f9690, list=optimized out) at main/dlist.c:7464
#12 0x0fffb7a94024 in _mesa_CallList (list=optimized out)
at main/dlist.c:8873
#13 0x0080b2d7e998 in glCallList (list=optimized out)
at ../../../src/mapi/glapi/glapitemp.h:97
#14 0x10002b54 in draw () at glxgears.c:263
#15 0x1000201c in draw_gears () at glxgears.c:315
#16 draw_frame (win=optimized out, dpy=optimized out) at glxgears.c:340
#17 event_loop (win=2097154, dpy=0x10030010) at glxgears.c:696
#18 main (argc=optimized out, argv=optimized out) at glxgears.c:776

On your other question:

export GALLIUM_DRIVER=softpipe
export DRAW_USE_LLVM=no

this makes it work OK with Xvnc. Thank you!

-- 
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] r600g: precalculate semantic indices for SPI setup

2011-11-04 Thread Alex Deucher
On Fri, Nov 4, 2011 at 1:24 PM, Vadim Girlin vadimgir...@gmail.com wrote:
 There is no need to duplicate semantic mapping which is done in hw, so get
 rid of r600_find_vs_semantic_index.

 TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

Pushed.  Thanks!  Note that the hw can use semantic ids for vertex
fetch as well.

Alex


 Signed-off-by: Vadim Girlin vadimgir...@gmail.com
 ---

 This patch and the next one were tested on the evergreen,
 there are some changes in the test results:

 Following tests are passing due to slightly different handling of
 TGSI_SEMANTIC_BCOLOR (it's still not completely correct).
        vertex-program-two-side enabled back back2      fail - pass
        vertex-program-two-side enabled back front2     fail - pass
        vertex-program-two-side enabled front back2     fail - pass

 This test usually fails for me after these patches, but passes when
 it's run independently - probably unrelated:
        time-elapsed    pass - fail

  src/gallium/drivers/r600/evergreen_state.c   |   19 
  src/gallium/drivers/r600/r600_shader.c       |   67 
 --
  src/gallium/drivers/r600/r600_shader.h       |    2 +-
  src/gallium/drivers/r600/r600_state.c        |   20 +++-
  src/gallium/drivers/r600/r600_state_common.c |   13 ++---
  5 files changed, 64 insertions(+), 57 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index fd2e5da..904267d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -2375,20 +2375,20 @@ void evergreen_pipe_shader_vs(struct pipe_context 
 *ctx, struct r600_pipe_shader
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate = shader-rstate;
        struct r600_shader *rshader = shader-shader;
 -       unsigned spi_vs_out_id[10];
 -       unsigned i, tmp, nparams;
 +       unsigned spi_vs_out_id[10] = {};
 +       unsigned i, tmp, nparams = 0;

        /* clear previous register */
        rstate-nregs = 0;

 -       /* so far never got proper semantic id from tgsi */
 -       for (i = 0; i  10; i++) {
 -               spi_vs_out_id[i] = 0;
 -       }
 -       for (i = 0; i  32; i++) {
 -               tmp = i  ((i  3) * 8);
 -               spi_vs_out_id[i / 4] |= tmp;
 +       for (i = 0; i  rshader-noutput; i++) {
 +               if (rshader-output[i].spi_sid) {
 +                       tmp = rshader-output[i].spi_sid  ((nparams  3) * 
 8);
 +                       spi_vs_out_id[nparams / 4] |= tmp;
 +                       nparams++;
 +               }
        }
 +
        for (i = 0; i  10; i++) {
                r600_pipe_state_add_reg(rstate,
                                        R_02861C_SPI_VS_OUT_ID_0 + i * 4,
 @@ -2399,7 +2399,6 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, 
 struct r600_pipe_shader
         * VS is required to export at least one param and 
 r600_shader_from_tgsi()
         * takes care of adding a dummy export.
         */
 -       nparams = rshader-noutput - rshader-npos;
        if (nparams  1)
                nparams = 1;

 diff --git a/src/gallium/drivers/r600/r600_shader.c 
 b/src/gallium/drivers/r600/r600_shader.c
 index 87164ce..448e03a 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -57,24 +57,6 @@ issued in the w slot as well.
  The compiler must issue the source argument to slots z, y, and x
  */

 -
 -int r600_find_vs_semantic_index(struct r600_shader *vs,
 -                               struct r600_shader *ps, int id)
 -{
 -       struct r600_shader_io *input = ps-input[id];
 -       int index = 0;
 -
 -       for (int i = 0; i  vs-noutput; i++) {
 -               if (input-name == vs-output[i].name 
 -                               input-sid == vs-output[i].sid)
 -                       return index;
 -               else if (vs-output[i].name != TGSI_SEMANTIC_POSITION 
 -                                vs-output[i].name != TGSI_SEMANTIC_PSIZE)
 -                       index++;
 -       }
 -       return 0;
 -}
 -
  static int r600_pipe_shader(struct pipe_context *ctx, struct 
 r600_pipe_shader *shader)
  {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 @@ -361,6 +343,44 @@ static int evergreen_interp_flat(struct r600_shader_ctx 
 *ctx, int input)
  * DB_SOURCE_FORMAT - export control restrictions
  *
  */
 +
 +
 +/* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
 +static int r600_spi_sid(struct r600_shader_io * io)
 +{
 +       int index, name = io-name;
 +
 +       /* These params are handled differently, they don't need
 +        * semantic indices, so we'll use 0 for them.
 +        */
 +       if (name == TGSI_SEMANTIC_POSITION ||
 +               name == TGSI_SEMANTIC_PSIZE ||
 +               name == TGSI_SEMANTIC_FACE)
 +               index = 0;
 +       else {

Re: [Mesa-dev] [PATCH 1/3] glsl: Assign transform feedback varying slots in linker.

2011-11-04 Thread Paul Berry
Sorry I missed the first round of feedback on these patches.  I hope my
comments aren't coming too late.

On 1 November 2011 12:48, Marek Olšák mar...@gmail.com wrote:

 From: Dan McCabe zen3d.li...@gmail.com

 Modify the linker to assign additional slots for varying
 variables used by transform feedback. This is done after other
 varyings are already assigned slots.

 Since this is done after previous varying slot assignments,
 the code needs to know how many varyings are already assigned
 slots. A new function max_varying() is introduced to examine a
 previously processed shader to find the largest varying already
 assigned a slot. All new varyings will be assigned slots after
 this one. If varyings are found, -1 is returned.

 [ Marek Olšák: fix segfault in accessing names ]
 ---
  src/glsl/linker.cpp |   84
 +++
  1 files changed, 84 insertions(+), 0 deletions(-)

 diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
 index beadec6..e6012bf 100644
 --- a/src/glsl/linker.cpp
 +++ b/src/glsl/linker.cpp
 @@ -207,6 +207,25 @@ invalidate_variable_locations(gl_shader *sh, enum
 ir_variable_mode mode,
}
  }

 +
 +int
 +max_varying(gl_shader *sh, enum ir_variable_mode mode)
 +{
 +   int max_varying = -1;
 +
 +   foreach_list(node, sh-ir) {
 +  ir_variable *const var = ((ir_instruction *) node)-as_variable();
 +
 +  if ((var == NULL) || (var-mode != (unsigned) mode))
 +continue;
 +
 +  if (var-location  max_varying)
 +max_varying = var-location;
 +   }
 +
 +   return max_varying;
 +}


A few comments on this function:

1. It should be declared static, since it's only used in this file.

2. Since it's only called with mode == ir_var_out, it might make more sense
to drop that argument and call the function max_out_location().

3. Judging by how the return value of this function is used (it has 1 added
to it and then the value is adjusted to be at least VERT_RESULT_VAR0), it
seems like the real purpose of this function is to figure out the first
slot into which varyings can be safely assigned.  Consider renaming this
function to something like find_free_varying_slots and having it return
the first slot into which varyings can be safely assigned.

4. This function might be unnecessary--see my comment below.


 +

  /**
  * Determine the number of attribute slots required for a particular type
 @@ -1597,6 +1616,69 @@ assign_varying_locations(struct gl_context *ctx,


  void
 +assign_transform_feedback_varying_locations(struct gl_context *ctx,
 +   struct gl_shader_program
 *prog)

+{
 +   struct gl_shader *vs = prog-_LinkedShaders[MESA_SHADER_VERTEX];
 +
 +   if (vs == NULL)
 +  return;
 +
 +   char **names = prog-TransformFeedback.VaryingNames;
 +   int num_names = prog-TransformFeedback.NumVarying;
 +
 +   if (num_names = 0)
 +  return;
 +
 +   int num_varying = max_varying(vs, ir_var_out) + 1;
 +   unsigned output_index =
 + (num_varying  VERT_RESULT_VAR0)
 +? num_varying
 +: VERT_RESULT_VAR0;


The effect of this code is to just recompute the value that output_index
had when assign_varying_locations() finished.  Wouldn't it be better to
just have assign_varying_locations() just store the value of output_index
somewhere so we can retrieve it here?

Or, perhaps it would be better to merge all of this code into
assign_varying_locations().  Really, both of these functions are doing the
same task, they are just using different criteria (assign_varying_locations
assigns locations to vertex shader outputs if they are used by the fragment
shader, this function assigns locations to vertex shader outputs if they
are used by transform feedback).


 +
 +   foreach_list(node, vs-ir) {
 +  ir_variable *const output_var = ((ir_instruction *)
 node)-as_variable();
 +
 +  if (output_var == NULL
 +  ||  output_var-mode != ir_var_out
 +  ||  output_var-location != -1)
 +continue;
 +
 +  /* Find a transform feedback varying variable that has
 +   * the same name as the shader variable.
 +   */
 +  int varying_index = -1;
 +  for (int num_name = 0; num_name  num_names; num_name++) {
 + char *name = names[num_name];
 + if (strcmp(output_var-name, name) == 0) {
 +varying_index = num_name;
 +break;
 + }
 +  }
 +
 +  if (varying_index == -1)
 +continue;
 +
 +  output_var-location = output_index;
 +
 +  /* FINISHME: Support for varying records in GLSL 1.50. */
 +  assert(!output_var-type-is_record());
 +
 +  if (output_var-type-is_array()) {
 +const unsigned slots = output_var-type-length
 +   * output_var-type-fields.array-matrix_columns;
 +
 +output_index += slots;
 +  } else {
 +const unsigned slots = output_var-type-matrix_columns;
 +
 +output_index += slots;
 +  }


Aside: I have just realized that the technique we 

Re: [Mesa-dev] [PATCH 2/3] glsl: translate transform feedback varyings into low-level representation

2011-11-04 Thread Paul Berry
On 1 November 2011 12:48, Marek Olšák mar...@gmail.com wrote:

 This adds a function that takes an array of varyings from
 glTranformFeedbackVaryingsEXT and generates gl_transform_feedback_info,
 which is supposed to be consumed by drivers. Useful for ir_to_mesa
 and glsl_to_tgsi.

 v2:
 - changes per Kenneth Graunke's comment
 - expose the TFB varying parser in ir.h
 ---
  src/glsl/Makefile   |1 +
  src/glsl/SConscript |1 +
  src/glsl/ir.h   |   35 
  src/glsl/ir_set_transform_feedback_outs.cpp |  268
 +++
  src/mesa/main/mtypes.h  |   12 ++
  5 files changed, 317 insertions(+), 0 deletions(-)
  create mode 100644 src/glsl/ir_set_transform_feedback_outs.cpp

 diff --git a/src/glsl/Makefile b/src/glsl/Makefile
 index 504f1fb..f3b8e2e 100644
 --- a/src/glsl/Makefile
 +++ b/src/glsl/Makefile
 @@ -48,6 +48,7 @@ CXX_SOURCES = \
ir_reader.cpp \
ir_rvalue_visitor.cpp \
ir_set_program_inouts.cpp \
 +   ir_set_transform_feedback_outs.cpp \
ir_validate.cpp \
ir_variable.cpp \
ir_variable_refcount.cpp \
 diff --git a/src/glsl/SConscript b/src/glsl/SConscript
 index 09c7edb..ccd93fe 100644
 --- a/src/glsl/SConscript
 +++ b/src/glsl/SConscript
 @@ -59,6 +59,7 @@ glsl_sources = [
 'ir_reader.cpp',
 'ir_rvalue_visitor.cpp',
 'ir_set_program_inouts.cpp',
 +'ir_set_transform_feedback_outs.cpp',
 'ir_validate.cpp',
 'ir_variable.cpp',
 'ir_variable_refcount.cpp',
 diff --git a/src/glsl/ir.h b/src/glsl/ir.h
 index 404d4cf..f7eaa0a 100644
 --- a/src/glsl/ir.h
 +++ b/src/glsl/ir.h
 @@ -1696,4 +1696,39 @@ extern char *
  prototype_string(const glsl_type *return_type, const char *name,
 exec_list *parameters);

 +/**
 + * Set transform feedback output locations and other related info
 + * in gl_program.
 + *
 + * \param shaderprog  The inputs are the parameters
 + *from glTransformFeedbackVaryings expected
 + *to be in gl_shader_program::TransformFeedback.
 + *
 + * \param infoWhere the resulting info is stored.
 + */
 +extern void
 +do_set_transform_feedback_outs(exec_list *instructions,
 +   struct gl_shader_program *shaderprog,
 +   struct gl_transform_feedback_info *info);
 +
 +/**
 + * The result of parse_tfeedback_decl.
 + */
 +struct tfeedback_decl {
 +   char *name;
 +   bool is_array;
 +   unsigned array_index;
 +};
 +
 +/**
 + * This expects expressions of the form var and var[i],
 + * where i is a literal.
 + *
 + * \param mem_ctxRalloc context.
 + * \param input  Input string to be parsed.
 + * \param decl   Output structure.
 + */
 +bool parse_tfeedback_decl(const void *mem_ctx, const char *input,
 +  struct tfeedback_decl *decl);
 +
  #endif /* IR_H */
 diff --git a/src/glsl/ir_set_transform_feedback_outs.cpp
 b/src/glsl/ir_set_transform_feedback_outs.cpp
 new file mode 100644
 index 000..ec20108
 --- /dev/null
 +++ b/src/glsl/ir_set_transform_feedback_outs.cpp
 @@ -0,0 +1,268 @@
 +/*
 + * Copyright © 2010 Intel Corporation
 + * Copyright © 2011 Marek Olšák mar...@gmail.com
 + *
 + * Permission is hereby granted, free of charge, to any person obtaining a
 + * copy of this software and associated documentation files (the
 Software),
 + * to deal in the Software without restriction, including without
 limitation
 + * the rights to use, copy, modify, merge, publish, distribute,
 sublicense,
 + * and/or sell copies of the Software, and to permit persons to whom the
 + * Software is furnished to do so, subject to the following conditions:
 + *
 + * The above copyright notice and this permission notice (including the
 next
 + * paragraph) shall be included in all copies or substantial portions of
 the
 + * Software.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR
 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY,
 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
 SHALL
 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 OTHER
 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 + * DEALINGS IN THE SOFTWARE.
 + */
 +
 +/**
 + * \file ir_set_transform_feedback_outs.cpp
 + *
 + * Used to obtain info about shader outputs from the GLSL IR
 + * for transform feedback.
 + * The driver codegen backend needs to know locations of the outputs
 + * which are to be stored in transform feedback buffers and the number
 + * of components each such output has.
 + *
 + * This is similar to ir_set_program_inouts.
 + */

+
 +extern C {
 +#include program/hash_table.h
 +}
 +#include main/core.h
 +#include ir.h
 +#include ir_visitor.h
 +#include glsl_types.h
 +#include 

[Mesa-dev] [PATCH 1/2] st/mesa: set geometry shader to NULL when doing internal drawing

2011-11-04 Thread Marek Olšák
The code expects the geometry shader to be NULL.
We don't have geometry shaders now, but it's good to be prepared.

v2: check for support in the cso context
---
 src/gallium/auxiliary/cso_cache/cso_context.c |   17 -
 src/gallium/auxiliary/util/u_blit.c   |6 ++
 src/gallium/auxiliary/util/u_gen_mipmap.c |3 +++
 src/mesa/state_tracker/st_cb_bitmap.c |5 +
 src/mesa/state_tracker/st_cb_clear.c  |3 +++
 src/mesa/state_tracker/st_cb_drawpixels.c |4 
 src/mesa/state_tracker/st_cb_drawtex.c|3 +++
 src/mesa/state_tracker/st_extensions.c|3 ++-
 8 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c 
b/src/gallium/auxiliary/cso_cache/cso_context.c
index b91fe1a..d1b4dc2 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -78,6 +78,8 @@ struct cso_context {
struct pipe_context *pipe;
struct cso_cache *cache;
 
+   boolean has_geometry_shader;
+
struct sampler_info fragment_samplers;
struct sampler_info vertex_samplers;
 
@@ -270,6 +272,11 @@ struct cso_context *cso_create_context( struct 
pipe_context *pipe )
/* Enable for testing: */
if (0) cso_set_maximum_cache_size( ctx-cache, 4 );
 
+   if (pipe-screen-get_shader_param(pipe-screen, PIPE_SHADER_GEOMETRY,
+PIPE_SHADER_CAP_MAX_INSTRUCTIONS)  0) {
+  ctx-has_geometry_shader = TRUE;
+   }
+
return ctx;
 
 out:
@@ -785,7 +792,7 @@ void cso_restore_stencil_ref(struct cso_context *ctx)
 enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx,
void *handle)
 {
-   if (ctx-geometry_shader != handle) {
+   if (ctx-has_geometry_shader  ctx-geometry_shader != handle) {
   ctx-geometry_shader = handle;
   ctx-pipe-bind_gs_state(ctx-pipe, handle);
}
@@ -804,12 +811,20 @@ void cso_delete_geometry_shader(struct cso_context *ctx, 
void *handle)
 
 void cso_save_geometry_shader(struct cso_context *ctx)
 {
+   if (!ctx-has_geometry_shader) {
+  return;
+   }
+
assert(!ctx-geometry_shader_saved);
ctx-geometry_shader_saved = ctx-geometry_shader;
 }
 
 void cso_restore_geometry_shader(struct cso_context *ctx)
 {
+   if (!ctx-has_geometry_shader) {
+  return;
+   }
+
if (ctx-geometry_shader_saved != ctx-geometry_shader) {
   ctx-pipe-bind_gs_state(ctx-pipe, ctx-geometry_shader_saved);
   ctx-geometry_shader = ctx-geometry_shader_saved;
diff --git a/src/gallium/auxiliary/util/u_blit.c 
b/src/gallium/auxiliary/util/u_blit.c
index 87530e9..6a4324b 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -531,6 +531,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_save_framebuffer(ctx-cso);
cso_save_fragment_shader(ctx-cso);
cso_save_vertex_shader(ctx-cso);
+   cso_save_geometry_shader(ctx-cso);
cso_save_clip(ctx-cso);
cso_save_vertex_elements(ctx-cso);
cso_save_vertex_buffers(ctx-cso);
@@ -574,6 +575,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
   set_fragment_shader(ctx, writemask);
}
set_vertex_shader(ctx);
+   cso_set_geometry_shader_handle(ctx-cso, NULL);
 
/* drawing dest */
memset(fb, 0, sizeof(fb));
@@ -612,6 +614,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
cso_restore_framebuffer(ctx-cso);
cso_restore_fragment_shader(ctx-cso);
cso_restore_vertex_shader(ctx-cso);
+   cso_restore_geometry_shader(ctx-cso);
cso_restore_clip(ctx-cso);
cso_restore_vertex_elements(ctx-cso);
cso_restore_vertex_buffers(ctx-cso);
@@ -719,6 +722,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_framebuffer(ctx-cso);
cso_save_fragment_shader(ctx-cso);
cso_save_vertex_shader(ctx-cso);
+   cso_save_geometry_shader(ctx-cso);
cso_save_clip(ctx-cso);
cso_save_vertex_elements(ctx-cso);
cso_save_vertex_buffers(ctx-cso);
@@ -754,6 +758,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
/* shaders */
set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW);
set_vertex_shader(ctx);
+   cso_set_geometry_shader_handle(ctx-cso, NULL);
 
/* drawing dest */
memset(fb, 0, sizeof(fb));
@@ -788,6 +793,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_framebuffer(ctx-cso);
cso_restore_fragment_shader(ctx-cso);
cso_restore_vertex_shader(ctx-cso);
+   cso_restore_geometry_shader(ctx-cso);
cso_restore_clip(ctx-cso);
cso_restore_vertex_elements(ctx-cso);
cso_restore_vertex_buffers(ctx-cso);
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c 
b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 4a16624..436a0e42 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1561,6 +1561,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_framebuffer(ctx-cso);

Re: [Mesa-dev] [PATCH 1/2] st/mesa: set geometry shader to NULL when doing internal drawing

2011-11-04 Thread Jose Fonseca
- Original Message -
 The code expects the geometry shader to be NULL.
 We don't have geometry shaders now, but it's good to be prepared.
 
 v2: check for support in the cso context
 ---
  src/gallium/auxiliary/cso_cache/cso_context.c |   17
  -
  src/gallium/auxiliary/util/u_blit.c   |6 ++
  src/gallium/auxiliary/util/u_gen_mipmap.c |3 +++
  src/mesa/state_tracker/st_cb_bitmap.c |5 +
  src/mesa/state_tracker/st_cb_clear.c  |3 +++
  src/mesa/state_tracker/st_cb_drawpixels.c |4 
  src/mesa/state_tracker/st_cb_drawtex.c|3 +++
  src/mesa/state_tracker/st_extensions.c|3 ++-
  8 files changed, 42 insertions(+), 2 deletions(-)
 

Much nicer. Thanks Marek.

[...]
 @@ -785,7 +792,7 @@ void cso_restore_stencil_ref(struct cso_context
 *ctx)
  enum pipe_error cso_set_geometry_shader_handle(struct cso_context
  *ctx,
 void *handle)
  {
 -   if (ctx-geometry_shader != handle) {
 +   if (ctx-has_geometry_shader  ctx-geometry_shader != handle) {

In here it's better assert that when ctx-has_geometry_shader == FALSE, then 
handle must be NULL.

ctx-geometry_shader = handle;
ctx-pipe-bind_gs_state(ctx-pipe, handle);
 }

Otherwise looks great.

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


Re: [Mesa-dev] glReadPixels broken w/ latest MapRenderbuffer changes

2011-11-04 Thread Eric Anholt
On Fri, 04 Nov 2011 07:31:54 -0600, Brian Paul bri...@vmware.com wrote:
 The pure, non-DRI swrast driver dies in all glReadPixels calls when 
 reading from the front/back color buffers.  So basically all piglit 
 tests fail.
 
 I think that the problem is there is no rb-Data for these surfaces; 
 they're XImages/Pixmaps.  The xlib driver needs to have 
 Map/UnmapRenderbuffer functions that can access the pixels in the 
 XImage/Pixmaps.
 
 Sorry I didn't spot that before you pushed the series, Eric.
 
 I may not be able to dig into this until later, or the weekend.

Wow, the spans code for that driver is hideous.  Who still uses it?
Also, color index?  Really?


pgp58DtCH90rK.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 1/2] r600g: precalculate semantic indices for SPI setup

2011-11-04 Thread Marek Olšák
FYI, this commit completely breaks RV670. glxgears is completely
black, other apps are either black or rendered incorrectly (mostly
one-colored, the clear color I guess).

Marek

On Fri, Nov 4, 2011 at 6:24 PM, Vadim Girlin vadimgir...@gmail.com wrote:
 There is no need to duplicate semantic mapping which is done in hw, so get
 rid of r600_find_vs_semantic_index.

 TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

 Signed-off-by: Vadim Girlin vadimgir...@gmail.com
 ---

 This patch and the next one were tested on the evergreen,
 there are some changes in the test results:

 Following tests are passing due to slightly different handling of
 TGSI_SEMANTIC_BCOLOR (it's still not completely correct).
        vertex-program-two-side enabled back back2      fail - pass
        vertex-program-two-side enabled back front2     fail - pass
        vertex-program-two-side enabled front back2     fail - pass

 This test usually fails for me after these patches, but passes when
 it's run independently - probably unrelated:
        time-elapsed    pass - fail

  src/gallium/drivers/r600/evergreen_state.c   |   19 
  src/gallium/drivers/r600/r600_shader.c       |   67 
 --
  src/gallium/drivers/r600/r600_shader.h       |    2 +-
  src/gallium/drivers/r600/r600_state.c        |   20 +++-
  src/gallium/drivers/r600/r600_state_common.c |   13 ++---
  5 files changed, 64 insertions(+), 57 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index fd2e5da..904267d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -2375,20 +2375,20 @@ void evergreen_pipe_shader_vs(struct pipe_context 
 *ctx, struct r600_pipe_shader
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate = shader-rstate;
        struct r600_shader *rshader = shader-shader;
 -       unsigned spi_vs_out_id[10];
 -       unsigned i, tmp, nparams;
 +       unsigned spi_vs_out_id[10] = {};
 +       unsigned i, tmp, nparams = 0;

        /* clear previous register */
        rstate-nregs = 0;

 -       /* so far never got proper semantic id from tgsi */
 -       for (i = 0; i  10; i++) {
 -               spi_vs_out_id[i] = 0;
 -       }
 -       for (i = 0; i  32; i++) {
 -               tmp = i  ((i  3) * 8);
 -               spi_vs_out_id[i / 4] |= tmp;
 +       for (i = 0; i  rshader-noutput; i++) {
 +               if (rshader-output[i].spi_sid) {
 +                       tmp = rshader-output[i].spi_sid  ((nparams  3) * 
 8);
 +                       spi_vs_out_id[nparams / 4] |= tmp;
 +                       nparams++;
 +               }
        }
 +
        for (i = 0; i  10; i++) {
                r600_pipe_state_add_reg(rstate,
                                        R_02861C_SPI_VS_OUT_ID_0 + i * 4,
 @@ -2399,7 +2399,6 @@ void evergreen_pipe_shader_vs(struct pipe_context *ctx, 
 struct r600_pipe_shader
         * VS is required to export at least one param and 
 r600_shader_from_tgsi()
         * takes care of adding a dummy export.
         */
 -       nparams = rshader-noutput - rshader-npos;
        if (nparams  1)
                nparams = 1;

 diff --git a/src/gallium/drivers/r600/r600_shader.c 
 b/src/gallium/drivers/r600/r600_shader.c
 index 87164ce..448e03a 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -57,24 +57,6 @@ issued in the w slot as well.
  The compiler must issue the source argument to slots z, y, and x
  */

 -
 -int r600_find_vs_semantic_index(struct r600_shader *vs,
 -                               struct r600_shader *ps, int id)
 -{
 -       struct r600_shader_io *input = ps-input[id];
 -       int index = 0;
 -
 -       for (int i = 0; i  vs-noutput; i++) {
 -               if (input-name == vs-output[i].name 
 -                               input-sid == vs-output[i].sid)
 -                       return index;
 -               else if (vs-output[i].name != TGSI_SEMANTIC_POSITION 
 -                                vs-output[i].name != TGSI_SEMANTIC_PSIZE)
 -                       index++;
 -       }
 -       return 0;
 -}
 -
  static int r600_pipe_shader(struct pipe_context *ctx, struct 
 r600_pipe_shader *shader)
  {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 @@ -361,6 +343,44 @@ static int evergreen_interp_flat(struct r600_shader_ctx 
 *ctx, int input)
  * DB_SOURCE_FORMAT - export control restrictions
  *
  */
 +
 +
 +/* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
 +static int r600_spi_sid(struct r600_shader_io * io)
 +{
 +       int index, name = io-name;
 +
 +       /* These params are handled differently, they don't need
 +        * semantic indices, so we'll use 0 for them.
 +        */
 +       if (name == TGSI_SEMANTIC_POSITION ||
 +               name == TGSI_SEMANTIC_PSIZE ||

[Mesa-dev] GL_EXT_texture_integer on i965

2011-11-04 Thread Eric Anholt
Here's a patch series to get GL_EXT_texture_integer partially working
on i965, hidden under the GL 3.0 override.  There's a bunch of support
I think isn't finished yet, mostly because testing is in a bad state.
A few things I noticed while looking at the spec:

Test Per-fragment operations that require floating-point color
components, including multisample alpha operations, alpha test,
blending, and dithering, have no effect when the corresponding colors
are written to an integer color buffer.

Test texture border color

Test texture logic op

Test rendering from each internalformat

Test rendering to each internalformat

Test getteximage from each internalformat

Test teximage clamping to the range of the internalformat

Test fragment clamping

Test reading RGBA to LUMINANCE_INTEGER producing L=R

Test gettexparameter of integer border values

Test glBlitFramebuffer() for integer

Test glBlitFramebuffer() for mixing int/float buffers.

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


[Mesa-dev] [PATCH 04/10] i965: Add mapping from MESA_FORMAT to BRW_SURFACEFORMAT for integer.

2011-11-04 Thread Eric Anholt
Like non-integer, we can't render to RGB textures, so we promote them
to RGBA.
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   24 ++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 04dc389..66ff1e6 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -124,6 +124,30 @@ brw_format_for_mesa_format(gl_format mesa_format)
   [MESA_FORMAT_SIGNED_RG_RGTC2] = BRW_SURFACEFORMAT_BC5_SNORM,
   [MESA_FORMAT_RGB9_E5_FLOAT] = BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP,
   [MESA_FORMAT_R11_G11_B10_FLOAT] = BRW_SURFACEFORMAT_R11G11B10_FLOAT,
+
+  [MESA_FORMAT_R_INT32] = BRW_SURFACEFORMAT_R32_SINT,
+  [MESA_FORMAT_RG_INT32] = BRW_SURFACEFORMAT_R32G32_SINT,
+  [MESA_FORMAT_RGB_INT32] = BRW_SURFACEFORMAT_R32G32B32_SINT,
+  [MESA_FORMAT_RGBA_INT32] = BRW_SURFACEFORMAT_R32G32B32A32_SINT,
+
+  [MESA_FORMAT_R_UINT32] = BRW_SURFACEFORMAT_R32_UINT,
+  [MESA_FORMAT_RG_UINT32] = BRW_SURFACEFORMAT_R32G32_UINT,
+  [MESA_FORMAT_RGB_UINT32] = BRW_SURFACEFORMAT_R32G32B32_UINT,
+  [MESA_FORMAT_RGBA_UINT32] = BRW_SURFACEFORMAT_R32G32B32A32_UINT,
+
+  [MESA_FORMAT_RGBA_UINT16] = BRW_SURFACEFORMAT_R16G16B16A16_UINT,
+  [MESA_FORMAT_RGBA_INT16] = BRW_SURFACEFORMAT_R16G16B16A16_SINT,
+  [MESA_FORMAT_RG_UINT16] = BRW_SURFACEFORMAT_R16G16_UINT,
+  [MESA_FORMAT_RG_INT16] = BRW_SURFACEFORMAT_R16G16_SINT,
+  [MESA_FORMAT_R_UINT16] = BRW_SURFACEFORMAT_R16_UINT,
+  [MESA_FORMAT_R_INT16] = BRW_SURFACEFORMAT_R16_SINT,
+
+  [MESA_FORMAT_RGBA_UINT8] = BRW_SURFACEFORMAT_R8G8B8A8_UINT,
+  [MESA_FORMAT_RGBA_INT8] = BRW_SURFACEFORMAT_R8G8B8A8_SINT,
+  [MESA_FORMAT_RG_UINT8] = BRW_SURFACEFORMAT_R8G8_UINT,
+  [MESA_FORMAT_RG_INT8] = BRW_SURFACEFORMAT_R8G8_SINT,
+  [MESA_FORMAT_R_UINT8] = BRW_SURFACEFORMAT_R8_UINT,
+  [MESA_FORMAT_R_INT8] = BRW_SURFACEFORMAT_R8_SINT,
};
assert(mesa_format  MESA_FORMAT_COUNT);
return table[mesa_format];
-- 
1.7.7

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


[Mesa-dev] [PATCH 01/10] i965: Re-disable EXT_texture_float pre-gen5.

2011-11-04 Thread Eric Anholt
Texture filtering is not supported on floating-point textures until
gen5, which showed up as failures in texwrap in particular.
---
 src/mesa/drivers/dri/intel/intel_extensions.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 7a5ef3e..5212168 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -93,8 +93,14 @@ intelInitExtensions(struct gl_context *ctx)
ctx-Const.GLSLVersion = 120;
_mesa_override_glsl_version(ctx);
 
-   if (intel-gen = 5)
+   if (intel-gen = 5) {
   ctx-Extensions.EXT_timer_query = true;
+#ifdef TEXTURE_FLOAT_ENABLED
+  ctx-Extensions.ARB_texture_float = true;
+  ctx-Extensions.EXT_texture_shared_exponent = true;
+  ctx-Extensions.EXT_packed_float = true;
+#endif
+   }
 
if (intel-gen = 4) {
   ctx-Extensions.ARB_color_buffer_float = true;
@@ -107,11 +113,6 @@ intelInitExtensions(struct gl_context *ctx)
   ctx-Extensions.ARB_point_sprite = true;
   ctx-Extensions.ARB_seamless_cube_map = true;
   ctx-Extensions.ARB_shader_texture_lod = true;
-#ifdef TEXTURE_FLOAT_ENABLED
-  ctx-Extensions.ARB_texture_float = true;
-  ctx-Extensions.EXT_texture_shared_exponent = true;
-  ctx-Extensions.EXT_packed_float = true;
-#endif
   ctx-Extensions.ARB_texture_compression_rgtc = true;
   ctx-Extensions.ARB_texture_rg = true;
   ctx-Extensions.EXT_draw_buffers2 = true;
-- 
1.7.7

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


[Mesa-dev] [PATCH 02/10] docs: Note EXT_texture_array on i965.

2011-11-04 Thread Eric Anholt
---
 docs/relnotes-7.12.html |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/docs/relnotes-7.12.html b/docs/relnotes-7.12.html
index a92278e..06aeda0 100644
--- a/docs/relnotes-7.12.html
+++ b/docs/relnotes-7.12.html
@@ -41,7 +41,7 @@ tbd
 liGL_ARB_vertex_type_2_10_10_10_rev (r600g)
 liGL_ARB_texture_storage (gallium drivers and swrast)
 liGL_EXT_packed_float (i965)
-liGL_EXT_texture_array (r600g)
+liGL_EXT_texture_array (r600g, i965)
 liGL_EXT_texture_shared_exponent (i965)
 liGL_NV_fog_distance (all gallium drivers, nouveau classic)
 liGL_NV_primitive_restart (r600g)
-- 
1.7.7

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


[Mesa-dev] [PATCH 03/10] intel: Expose GL_EXT_texture_integer when GL 3.0 override is set.

2011-11-04 Thread Eric Anholt
This will let the feature be incrementally developed, hidden behind
the flag we're all using as we work on GL 3.0 support.
---
 src/mesa/drivers/dri/intel/intel_extensions.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 5212168..effa3bf 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -41,6 +41,14 @@ void
 intelInitExtensions(struct gl_context *ctx)
 {
struct intel_context *intel = intel_context(ctx);
+   char *override = getenv(MESA_GL_VERSION_OVERRIDE);
+   int override_major, override_minor;
+   int override_version = 0;
+
+   if (override 
+   sscanf(override, %u.%u, override_major, override_minor) == 2) {
+  override_version = override_major * 10 + override_minor;
+   }
 
ctx-Extensions.ARB_draw_elements_base_vertex = true;
ctx-Extensions.ARB_explicit_attrib_location = true;
@@ -118,6 +126,8 @@ intelInitExtensions(struct gl_context *ctx)
   ctx-Extensions.EXT_draw_buffers2 = true;
   ctx-Extensions.EXT_framebuffer_sRGB = true;
   ctx-Extensions.EXT_texture_array = true;
+  if (override_version = 30)
+ctx-Extensions.EXT_texture_integer = true;
   ctx-Extensions.EXT_texture_snorm = true;
   ctx-Extensions.EXT_texture_sRGB = true;
   ctx-Extensions.EXT_texture_sRGB_decode = true;
-- 
1.7.7

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


[Mesa-dev] [PATCH 05/10] i965: Enable ChooseTexFormat for supported GL_EXT_texture_integer formats.

2011-11-04 Thread Eric Anholt
We don't get to use the 3-component formats, but faking of RGB with
RGBA seems to be working.
---
 src/mesa/drivers/dri/intel/intel_context.c |   28 
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index 801b747..6b493e1 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -706,6 +706,34 @@ intelInitContext(struct intel_context *intel,
   ctx-TextureFormatSupported[MESA_FORMAT_SLA8] = true;
}
 
+   if (intel-gen = 4) {
+  /* Each combination of 32-bit ints are supported, but the RGB 32-bit ints
+   * don't support use as a render target (GPU hangs).
+   */
+  ctx-TextureFormatSupported[MESA_FORMAT_R_INT32] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_INT32] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_INT32] = GL_TRUE;
+
+  ctx-TextureFormatSupported[MESA_FORMAT_R_UINT32] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_UINT32] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_UINT32] = GL_TRUE;
+
+  /* For 16 and 8 bits, RGB is unsupported entirely. */
+  ctx-TextureFormatSupported[MESA_FORMAT_R_UINT16] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_UINT16] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_UINT16] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_R_INT16] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_INT16] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_INT16] = GL_TRUE;
+
+  ctx-TextureFormatSupported[MESA_FORMAT_R_UINT8] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_UINT8] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_UINT8] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_R_INT8] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RG_INT8] = GL_TRUE;
+  ctx-TextureFormatSupported[MESA_FORMAT_RGBA_INT8] = GL_TRUE;
+   }
+
 #ifdef TEXTURE_FLOAT_ENABLED
ctx-TextureFormatSupported[MESA_FORMAT_RGBA_FLOAT32] = true;
ctx-TextureFormatSupported[MESA_FORMAT_RG_FLOAT32] = true;
-- 
1.7.7

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


[Mesa-dev] [PATCH 06/10] i965/fs: Add support for user-defined out variables.

2011-11-04 Thread Eric Anholt
Before, I was tracking the ir_variable * found for gl_FragColor or
gl_FragData[].  Instead, when visiting those variables, set up an
array of per-render-target fs_regs to copy the output data from.  This
cleans up the color emit path, while making handling of multiple
user-defined out variables easier.

Note that brw_type_for_base_type() now returns a sensible value for
arrays.  This probably obsoletes a bunch of type overrides we have
laying around.
---
 src/mesa/drivers/dri/i965/brw_fs.h   |8 +-
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   80 ++---
 src/mesa/drivers/dri/i965/brw_shader.cpp |1 +
 3 files changed, 50 insertions(+), 39 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index e2ad649..854a935 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -376,9 +376,8 @@ public:
   else
 this-reg_null_cmp = reg_null_f;
 
-  this-frag_color = NULL;
-  this-frag_data = NULL;
   this-frag_depth = NULL;
+  memset(this-outputs, 0, sizeof(this-outputs));
   this-first_non_payload_grf = 0;
 
   this-current_annotation = NULL;
@@ -526,7 +525,7 @@ public:
void emit_if_gen6(ir_if *ir);
void emit_unspill(fs_inst *inst, fs_reg reg, uint32_t spill_offset);
 
-   void emit_color_write(int index, int first_color_mrf, fs_reg color);
+   void emit_color_write(int target, int index, int first_color_mrf);
void emit_fb_writes();
bool try_rewrite_rhs_to_dst(ir_assignment *ir,
   fs_reg dst,
@@ -574,7 +573,8 @@ public:
int *params_remap;
 
struct hash_table *variable_ht;
-   ir_variable *frag_color, *frag_data, *frag_depth;
+   ir_variable *frag_depth;
+   fs_reg outputs[BRW_MAX_DRAW_BUFFERS];
int first_non_payload_grf;
int urb_setup[FRAG_ATTRIB_MAX];
bool kill_emitted;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 15009dc..e28a2e4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -58,14 +58,6 @@ fs_visitor::visit(ir_variable *ir)
if (variable_storage(ir))
   return;
 
-   if (strcmp(ir-name, gl_FragColor) == 0) {
-  this-frag_color = ir;
-   } else if (strcmp(ir-name, gl_FragData) == 0) {
-  this-frag_data = ir;
-   } else if (strcmp(ir-name, gl_FragDepth) == 0) {
-  this-frag_depth = ir;
-   }
-
if (ir-mode == ir_var_in) {
   if (!strcmp(ir-name, gl_FragCoord)) {
 reg = emit_fragcoord_interpolation(ir);
@@ -77,9 +69,32 @@ fs_visitor::visit(ir_variable *ir)
   assert(reg);
   hash_table_insert(this-variable_ht, reg, ir);
   return;
-   }
+   } else if (ir-mode == ir_var_out) {
+  reg = new(this-mem_ctx) fs_reg(this, ir-type);
+
+  if (strcmp(ir-name, gl_FragColor) == 0) {
+for (int i = 0; i  c-key.nr_color_regions; i++) {
+   this-outputs[i] = *reg;
+}
+  } else if (strcmp(ir-name, gl_FragData) == 0) {
+for (int i = 0; i  c-key.nr_color_regions; i++) {
+   this-outputs[i] = *reg;
+   this-outputs[i].reg_offset += 4 * i;
+}
+  } else if (strcmp(ir-name, gl_FragDepth) == 0) {
+this-frag_depth = ir;
+  } else {
+assert(ir-location = FRAG_RESULT_DATA0 
+   ir-location  FRAG_RESULT_DATA0 + BRW_MAX_DRAW_BUFFERS);
 
-   if (ir-mode == ir_var_uniform) {
+/* General color output. */
+for (unsigned int i = 0; i  MAX2(1, ir-type-length); i++) {
+   int output = ir-location - FRAG_RESULT_DATA0 + i;
+   this-outputs[output] = *reg;
+   this-outputs[output].reg_offset += 4 * i;
+}
+  }
+   } else if (ir-mode == ir_var_uniform) {
   int param_index = c-prog_data.nr_params;
 
   if (c-dispatch_width == 16) {
@@ -1830,10 +1845,18 @@ fs_visitor::emit_interpolation_setup_gen6()
 }
 
 void
-fs_visitor::emit_color_write(int index, int first_color_mrf, fs_reg color)
+fs_visitor::emit_color_write(int target, int index, int first_color_mrf)
 {
int reg_width = c-dispatch_width / 8;
fs_inst *inst;
+   fs_reg color = outputs[target];
+   fs_reg mrf;
+
+   /* If there's no color data to be written, skip it. */
+   if (color.file == BAD_FILE)
+  return;
+
+   color.reg_offset += index;
 
if (c-dispatch_width == 8 || intel-gen = 6) {
   /* SIMD8 write looks like:
@@ -1853,7 +1876,7 @@ fs_visitor::emit_color_write(int index, int 
first_color_mrf, fs_reg color)
* m + 7: a1
*/
   inst = emit(BRW_OPCODE_MOV,
- fs_reg(MRF, first_color_mrf + index * reg_width),
+ fs_reg(MRF, first_color_mrf + index * reg_width, color.type),
  color);
   inst-saturate = c-key.clamp_fragment_color;
} else {
@@ -1874,19 +1897,22 @@ fs_visitor::emit_color_write(int index, int 
first_color_mrf, fs_reg color)
  * 

[Mesa-dev] [PATCH 08/10] meta: Add support for glClear() to integer color buffers.

2011-11-04 Thread Eric Anholt
This requires using a new fragment shader to get the integer color
output, and a new vertex shader because #version has to match between
the two.
---
 src/mesa/drivers/common/meta.c |  108 ++--
 1 files changed, 104 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 3e55334..fcff0ae 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -182,7 +182,6 @@ struct save_state
GLboolean Lighting;
 };
 
-
 /**
  * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc.
  * This is currently shared by all the meta ops.  But we could create a
@@ -221,6 +220,9 @@ struct clear_state
GLuint VBO;
GLuint ShaderProg;
GLint ColorLocation;
+
+   GLuint IntegerShaderProg;
+   GLint IntegerColorLocation;
 };
 
 
@@ -310,6 +312,67 @@ struct gl_meta_state
struct drawtex_state DrawTex;  /** For _mesa_meta_DrawTex() */
 };
 
+static GLuint
+compile_shader_with_debug(struct gl_context *ctx, GLenum target, const 
GLcharARB *source)
+{
+   GLuint shader;
+   GLint ok, size;
+   GLchar *info;
+
+   shader = _mesa_CreateShaderObjectARB(target);
+   _mesa_ShaderSourceARB(shader, 1, source, NULL);
+   _mesa_CompileShaderARB(shader);
+
+   _mesa_GetShaderiv(shader, GL_COMPILE_STATUS, ok);
+   if (ok)
+  return shader;
+
+   _mesa_GetShaderiv(shader, GL_INFO_LOG_LENGTH, size);
+   if (size == 0)
+  return 0;
+
+   info = malloc(size);
+   if (!info)
+  return 0;
+
+   _mesa_GetProgramInfoLog(shader, size, NULL, info);
+   _mesa_problem(ctx,
+meta program compile failed:\n%s\n
+source:\n%s\n,
+info, source);
+
+   free(info);
+
+   return 0;
+}
+
+static GLuint
+link_program_with_debug(struct gl_context *ctx, GLuint program)
+{
+   GLint ok, size;
+   GLchar *info;
+
+   _mesa_LinkProgramARB(program);
+
+   _mesa_GetProgramiv(program, GL_LINK_STATUS, ok);
+   if (ok)
+  return program;
+
+   _mesa_GetProgramiv(program, GL_INFO_LOG_LENGTH, size);
+   if (size == 0)
+  return 0;
+
+   info = malloc(size);
+   if (!info)
+  return 0;
+
+   _mesa_GetProgramInfoLog(program, size, NULL, info);
+   _mesa_problem(ctx, meta program link failed:\n%s, info);
+
+   free(info);
+
+   return 0;
+}
 
 /**
  * Initialize meta-ops for a context.
@@ -1646,6 +1709,22 @@ meta_glsl_clear_init(struct gl_context *ctx, struct 
clear_state *clear)
   {\n
  gl_FragColor = color;\n
   }\n;
+   const char *vs_int_source =
+  #version 130\n
+  attribute vec4 position;\n
+  void main()\n
+  {\n
+ gl_Position = position;\n
+  }\n;
+   const char *fs_int_source =
+  #version 130\n
+  uniform ivec4 color;\n
+  out ivec4 out_color;\n
+  \n
+  void main()\n
+  {\n
+ out_color = color;\n
+  }\n;
GLuint vs, fs;
 
if (clear-ArrayObj != 0)
@@ -1679,6 +1758,21 @@ meta_glsl_clear_init(struct gl_context *ctx, struct 
clear_state *clear)
 
clear-ColorLocation = _mesa_GetUniformLocationARB(clear-ShaderProg,
  color);
+
+   if (ctx-Const.GLSLVersion = 130) {
+  vs = compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_int_source);
+  fs = compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_int_source);
+
+  clear-IntegerShaderProg = _mesa_CreateProgramObjectARB();
+  _mesa_AttachShader(clear-IntegerShaderProg, fs);
+  _mesa_AttachShader(clear-IntegerShaderProg, vs);
+  _mesa_BindAttribLocationARB(clear-IntegerShaderProg, 0, position);
+
+  link_program_with_debug(ctx, clear-IntegerShaderProg);
+
+  clear-IntegerColorLocation =
+_mesa_GetUniformLocationARB(clear-IntegerShaderProg, color);
+   }
 }
 
 /**
@@ -1722,9 +1816,15 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield 
buffers)
 
meta_glsl_clear_init(ctx, clear);
 
-   _mesa_UseProgramObjectARB(clear-ShaderProg);
-   _mesa_Uniform4fvARB(clear-ColorLocation, 1,
-  ctx-Color.ClearColor.f);
+   if (fb-_IntegerColor) {
+  _mesa_UseProgramObjectARB(clear-IntegerShaderProg);
+  _mesa_Uniform4ivARB(clear-IntegerColorLocation, 1,
+ ctx-Color.ClearColor.i);
+   } else {
+  _mesa_UseProgramObjectARB(clear-ShaderProg);
+  _mesa_Uniform4fvARB(clear-ColorLocation, 1,
+ ctx-Color.ClearColor.f);
+   }
 
_mesa_BindVertexArray(clear-ArrayObj);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear-VBO);
-- 
1.7.7

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


[Mesa-dev] [PATCH 09/10] mesa: Add support for unpacking 32-bit integer formats to int spans.

2011-11-04 Thread Eric Anholt
This is the inverse operation to _mesa_pack_rgba_span_int.  The 16-bit
code isn't done because of lack of testing and not being sure how sign
extension/clamping should be handled between, say, 16-bit int and
32-bit int or uint.
---
 src/mesa/main/format_unpack.c |  120 +
 src/mesa/main/format_unpack.h |8 +++
 2 files changed, 128 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index eaa33df..525bbcb 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -1258,7 +1258,127 @@ _mesa_unpack_rgba_row(gl_format format, GLuint n,
}
 }
 
+static void
+unpack_int_rgba_RGBA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   memcpy(dst, src, n * 4 * sizeof(GLuint));
+}
+
+static void
+unpack_int_rgba_RGB_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = src[i * 3 + 0];
+  dst[i][1] = src[i * 3 + 1];
+  dst[i][2] = src[i * 3 + 2];
+  dst[i][3] = 1;
+   }
+}
+
+static void
+unpack_int_rgba_RG_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = src[i * 2 + 0];
+  dst[i][1] = src[i * 2 + 1];
+  dst[i][2] = 0;
+  dst[i][3] = 1;
+   }
+}
+
+static void
+unpack_int_rgba_R_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = src[i];
+  dst[i][1] = 0;
+  dst[i][2] = 0;
+  dst[i][3] = 1;
+   }
+}
+
+static void
+unpack_int_rgba_LUMINANCE_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = dst[i][1] = dst[i][2] = src[i];
+  dst[i][3] = 1;
+   }
+}
 
+static void
+unpack_int_rgba_LUMINANCE_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], 
GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = dst[i][1] = dst[i][2] = src[i * 2 + 0];
+  dst[i][3] = src[i * 2 + 1];
+   }
+}
+
+static void
+unpack_int_rgba_INTENSITY_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
+{
+   unsigned int i;
+
+   for (i = 0; i  n; i++) {
+  dst[i][0] = dst[i][1] = dst[i][2] = dst[i][3] = src[i];
+   }
+}
+
+void
+_mesa_unpack_int_rgba_row(gl_format format, GLuint n,
+ const void *src, GLuint dst[][4])
+{
+   switch (format) {
+  /* Since there won't be any sign extension happening, there's no need to
+   * make separate paths for 32-bit-to-32-bit integer unpack.
+   */
+   case MESA_FORMAT_RGBA_UINT32:
+   case MESA_FORMAT_RGBA_INT32:
+  unpack_int_rgba_RGBA_UINT32(src, dst, n);
+  break;
+   case MESA_FORMAT_RGB_UINT32:
+   case MESA_FORMAT_RGB_INT32:
+  unpack_int_rgba_RGB_UINT32(src, dst, n);
+  break;
+   case MESA_FORMAT_RG_UINT32:
+   case MESA_FORMAT_RG_INT32:
+  unpack_int_rgba_RG_UINT32(src, dst, n);
+  break;
+   case MESA_FORMAT_R_UINT32:
+   case MESA_FORMAT_R_INT32:
+  unpack_int_rgba_R_UINT32(src, dst, n);
+  break;
+
+   case MESA_FORMAT_LUMINANCE_UINT32:
+   case MESA_FORMAT_LUMINANCE_INT32:
+  unpack_int_rgba_LUMINANCE_UINT32(src, dst, n);
+  break;
+   case MESA_FORMAT_LUMINANCE_ALPHA_UINT32:
+   case MESA_FORMAT_LUMINANCE_ALPHA_INT32:
+  unpack_int_rgba_LUMINANCE_ALPHA_UINT32(src, dst, n);
+  break;
+   case MESA_FORMAT_INTENSITY_UINT32:
+   case MESA_FORMAT_INTENSITY_INT32:
+  unpack_int_rgba_INTENSITY_UINT32(src, dst, n);
+  break;
+
+   default:
+  _mesa_problem(NULL, %s: bad format %s, __FUNCTION__,
+_mesa_get_format_name(format));
+  return;
+   }
+}
 
 /**
  * Unpack a 2D rect of pixels returning float RGBA colors.
diff --git a/src/mesa/main/format_unpack.h b/src/mesa/main/format_unpack.h
index a8a829c..0d13a2d 100644
--- a/src/mesa/main/format_unpack.h
+++ b/src/mesa/main/format_unpack.h
@@ -29,12 +29,20 @@ _mesa_unpack_rgba_row(gl_format format, GLuint n,
   const void *src, GLfloat dst[][4]);
 
 
+void
+_mesa_unpack_int_rgba_row(gl_format format, GLuint n,
+ const void *src, GLuint dst[][4]);
+
 extern void
 _mesa_unpack_rgba_block(gl_format format,
 const void *src, GLint srcRowStride,
 GLfloat dst[][4], GLint dstRowStride,
 GLuint x, GLuint y, GLuint width, GLuint height);
 
+extern void
+_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
+  const void *src, GLuint dst[][4]);
+
 
 extern void
 _mesa_unpack_float_z_row(gl_format format, GLuint n,
-- 
1.7.7

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


[Mesa-dev] [PATCH 07/10] i965: Claim to support rendering to integer FBOs.

2011-11-04 Thread Eric Anholt
We're missing support for the software paths still, but basic
rendering is working.
---
 src/mesa/drivers/dri/intel/intel_span.c   |7 ++-
 src/mesa/drivers/dri/intel/intel_tex_format.c |6 ++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_span.c 
b/src/mesa/drivers/dri/intel/intel_span.c
index 604962d..e66b0f6 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -421,7 +421,12 @@ static span_init_func 
intel_span_init_funcs[MESA_FORMAT_COUNT] =
 bool
 intel_span_supports_format(gl_format format)
 {
-   return intel_span_init_funcs[format] != NULL;
+   /* Rendering to/from integer textures will be done using MapRenderbuffer,
+* rather than coding up new paths through GetRow/PutRow(), so claim support
+* for those formats in here for now.
+*/
+   return (intel_span_init_funcs[format] != NULL ||
+  _mesa_is_format_integer_color(format));
 }
 
 /**
diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c 
b/src/mesa/drivers/dri/intel/intel_tex_format.c
index 6890a69..caef5b2 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_format.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_format.c
@@ -9,6 +9,12 @@
 GLenum
 intel_mesa_format_to_rb_datatype(gl_format format)
 {
+   /* These formats won't be going through the GetRow/PutRow() interfaces, so
+* just return a type.
+*/
+   if (_mesa_is_format_integer_color(format))
+  return GL_UNSIGNED_INT;
+
switch (format) {
case MESA_FORMAT_ARGB:
case MESA_FORMAT_XRGB:
-- 
1.7.7

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


[Mesa-dev] [PATCH 10/10] swrast: Add support for glReadPixels() to integer types.

2011-11-04 Thread Eric Anholt
With this change, i965 passes
GL_EXT_texture_integer/fbo_integer_precision_clear
---
 src/mesa/swrast/s_readpix.c |   19 +--
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 50422db..54f42db 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -236,7 +236,10 @@ slow_read_rgba_pixels( struct gl_context *ctx,
   GLbitfield transferOps )
 {
struct gl_renderbuffer *rb = ctx-ReadBuffer-_ColorReadBuffer;
-   GLfloat rgba[MAX_WIDTH][4];
+   union {
+  float f[MAX_WIDTH][4];
+  unsigned int i[MAX_WIDTH][4];
+   } rgba;
GLubyte *dst, *map;
int dstStride, stride, j;
 
@@ -248,11 +251,15 @@ slow_read_rgba_pixels( struct gl_context *ctx,
   map, stride);
 
for (j = 0; j  height; j++) {
-  _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb-Format),
-   width, map, rgba);
-  _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst,
-packing, transferOps);
-
+  if (_mesa_is_integer_format(format)) {
+_mesa_unpack_int_rgba_row(rb-Format, width, map, rgba.i);
+_mesa_pack_rgba_span_int(ctx, width, rgba.i, format, type, dst);
+  } else {
+_mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb-Format),
+  width, map, rgba.f);
+_mesa_pack_rgba_span_float(ctx, width, rgba.f, format, type, dst,
+   packing, transferOps);
+  }
   dst += dstStride;
   map += stride;
}
-- 
1.7.7

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


Re: [Mesa-dev] glReadPixels broken w/ latest MapRenderbuffer changes

2011-11-04 Thread Brian Paul

On 11/04/2011 03:48 PM, Eric Anholt wrote:

On Fri, 04 Nov 2011 07:31:54 -0600, Brian Paulbri...@vmware.com  wrote:

The pure, non-DRI swrast driver dies in all glReadPixels calls when
reading from the front/back color buffers.  So basically all piglit
tests fail.

I think that the problem is there is no rb-Data for these surfaces;
they're XImages/Pixmaps.  The xlib driver needs to have
Map/UnmapRenderbuffer functions that can access the pixels in the
XImage/Pixmaps.

Sorry I didn't spot that before you pushed the series, Eric.

I may not be able to dig into this until later, or the weekend.


Wow, the spans code for that driver is hideous.  Who still uses it?
Also, color index?  Really?


Back when I first wrote the xlib driver, 8bpp X terminals were still 
pretty common.  For a while I was using a monochrome X terminal and 
Mesa was able to dither down to 1bpp!


Directly reading/writing spans to Ximages and Pixmaps was the fast way 
to do sw rendering once upon a time.


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


Re: [Mesa-dev] [PATCH 1/2] r600g: precalculate semantic indices for SPI setup

2011-11-04 Thread Alex Deucher
On Fri, Nov 4, 2011 at 5:53 PM, Marek Olšák mar...@gmail.com wrote:
 FYI, this commit completely breaks RV670. glxgears is completely
 black, other apps are either black or rendered incorrectly (mostly
 one-colored, the clear color I guess).

I knew I should have tested 6xx before I pushed.  Reverted for now.

Alex


 Marek

 On Fri, Nov 4, 2011 at 6:24 PM, Vadim Girlin vadimgir...@gmail.com wrote:
 There is no need to duplicate semantic mapping which is done in hw, so get
 rid of r600_find_vs_semantic_index.

 TGSI name/sid pair is mapped to the 8-bit semantic index for SPI.

 Signed-off-by: Vadim Girlin vadimgir...@gmail.com
 ---

 This patch and the next one were tested on the evergreen,
 there are some changes in the test results:

 Following tests are passing due to slightly different handling of
 TGSI_SEMANTIC_BCOLOR (it's still not completely correct).
        vertex-program-two-side enabled back back2      fail - pass
        vertex-program-two-side enabled back front2     fail - pass
        vertex-program-two-side enabled front back2     fail - pass

 This test usually fails for me after these patches, but passes when
 it's run independently - probably unrelated:
        time-elapsed    pass - fail

  src/gallium/drivers/r600/evergreen_state.c   |   19 
  src/gallium/drivers/r600/r600_shader.c       |   67 
 --
  src/gallium/drivers/r600/r600_shader.h       |    2 +-
  src/gallium/drivers/r600/r600_state.c        |   20 +++-
  src/gallium/drivers/r600/r600_state_common.c |   13 ++---
  5 files changed, 64 insertions(+), 57 deletions(-)

 diff --git a/src/gallium/drivers/r600/evergreen_state.c 
 b/src/gallium/drivers/r600/evergreen_state.c
 index fd2e5da..904267d 100644
 --- a/src/gallium/drivers/r600/evergreen_state.c
 +++ b/src/gallium/drivers/r600/evergreen_state.c
 @@ -2375,20 +2375,20 @@ void evergreen_pipe_shader_vs(struct pipe_context 
 *ctx, struct r600_pipe_shader
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
        struct r600_pipe_state *rstate = shader-rstate;
        struct r600_shader *rshader = shader-shader;
 -       unsigned spi_vs_out_id[10];
 -       unsigned i, tmp, nparams;
 +       unsigned spi_vs_out_id[10] = {};
 +       unsigned i, tmp, nparams = 0;

        /* clear previous register */
        rstate-nregs = 0;

 -       /* so far never got proper semantic id from tgsi */
 -       for (i = 0; i  10; i++) {
 -               spi_vs_out_id[i] = 0;
 -       }
 -       for (i = 0; i  32; i++) {
 -               tmp = i  ((i  3) * 8);
 -               spi_vs_out_id[i / 4] |= tmp;
 +       for (i = 0; i  rshader-noutput; i++) {
 +               if (rshader-output[i].spi_sid) {
 +                       tmp = rshader-output[i].spi_sid  ((nparams  3) * 
 8);
 +                       spi_vs_out_id[nparams / 4] |= tmp;
 +                       nparams++;
 +               }
        }
 +
        for (i = 0; i  10; i++) {
                r600_pipe_state_add_reg(rstate,
                                        R_02861C_SPI_VS_OUT_ID_0 + i * 4,
 @@ -2399,7 +2399,6 @@ void evergreen_pipe_shader_vs(struct pipe_context 
 *ctx, struct r600_pipe_shader
         * VS is required to export at least one param and 
 r600_shader_from_tgsi()
         * takes care of adding a dummy export.
         */
 -       nparams = rshader-noutput - rshader-npos;
        if (nparams  1)
                nparams = 1;

 diff --git a/src/gallium/drivers/r600/r600_shader.c 
 b/src/gallium/drivers/r600/r600_shader.c
 index 87164ce..448e03a 100644
 --- a/src/gallium/drivers/r600/r600_shader.c
 +++ b/src/gallium/drivers/r600/r600_shader.c
 @@ -57,24 +57,6 @@ issued in the w slot as well.
  The compiler must issue the source argument to slots z, y, and x
  */

 -
 -int r600_find_vs_semantic_index(struct r600_shader *vs,
 -                               struct r600_shader *ps, int id)
 -{
 -       struct r600_shader_io *input = ps-input[id];
 -       int index = 0;
 -
 -       for (int i = 0; i  vs-noutput; i++) {
 -               if (input-name == vs-output[i].name 
 -                               input-sid == vs-output[i].sid)
 -                       return index;
 -               else if (vs-output[i].name != TGSI_SEMANTIC_POSITION 
 -                                vs-output[i].name != TGSI_SEMANTIC_PSIZE)
 -                       index++;
 -       }
 -       return 0;
 -}
 -
  static int r600_pipe_shader(struct pipe_context *ctx, struct 
 r600_pipe_shader *shader)
  {
        struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 @@ -361,6 +343,44 @@ static int evergreen_interp_flat(struct r600_shader_ctx 
 *ctx, int input)
  * DB_SOURCE_FORMAT - export control restrictions
  *
  */
 +
 +
 +/* Map name/sid pair from tgsi to the 8-bit semantic index for SPI setup */
 +static int r600_spi_sid(struct r600_shader_io * io)
 +{
 +       int index, name = io-name;
 +
 +       /* These params are handled differently, they don't need
 +        * 

[Mesa-dev] [PATCH 1/4] mesa: Stub implementation of glBindFragDataLocation

2011-11-04 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

This just validates the input parameters so far.

Fixes piglit's bindfragdata-invalid-parameters test.

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/shader_query.cpp |   37 +
 src/mesa/main/shaderapi.c  |   18 --
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index bd873a4..0694b48 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -237,3 +237,40 @@ _mesa_longest_attribute_name_length(struct 
gl_shader_program *shProg)
 
return longest;
 }
+
+void GLAPIENTRY
+_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
+  const GLchar *name)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_shader_program *const shProg =
+  _mesa_lookup_shader_program_err(ctx, program, glBindFragDataLocation);
+   if (!shProg)
+  return;
+
+   if (!name)
+  return;
+
+   if (strncmp(name, gl_, 3) == 0) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  glBindFragDataLocation(illegal name));
+  return;
+   }
+
+   if (colorNumber = ctx-Const.MaxDrawBuffers) {
+  _mesa_error(ctx, GL_INVALID_VALUE, glBindFragDataLocation(index));
+  return;
+   }
+
+   /* Replace the current value if it's already in the list.  Add
+* FRAG_RESULT_DATA0 because that's how the linker differentiates
+* between built-in attributes and user-defined attributes.
+*/
+
+
+   /*
+* Note that this binding won't go into effect until
+* glLinkProgram is called again.
+*/
+}
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 56d955c..078f534 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -325,14 +325,6 @@ attach_shader(struct gl_context *ctx, GLuint program, 
GLuint shader)
 }
 
 
-static void
-bind_frag_data_location(struct gl_context *ctx, GLuint program,
-GLuint colorNumber, const GLchar *name)
-{
-   _mesa_problem(ctx, bind_frag_data_location() not implemented yet);
-}
-
-
 static GLuint
 create_shader(struct gl_context *ctx, GLenum type)
 {
@@ -1049,16 +1041,6 @@ _mesa_AttachShader(GLuint program, GLuint shader)
 }
 
 
-/* GL_EXT_gpu_shader4, GL3 */
-void GLAPIENTRY
-_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
-   const GLchar *name)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   bind_frag_data_location(ctx, program, colorNumber, name);
-}
-
-
 void GLAPIENTRY
 _mesa_CompileShaderARB(GLhandleARB shaderObj)
 {
-- 
1.7.6.4

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


[Mesa-dev] [PATCH 2/4] mesa: Keep track of user settings for fragment data locations

2011-11-04 Thread Ian Romanick
From: Ian Romanick ian.d.roman...@intel.com

Signed-off-by: Ian Romanick ian.d.roman...@intel.com
---
 src/mesa/main/mtypes.h |9 +
 src/mesa/main/shader_query.cpp |2 +-
 src/mesa/main/shaderobj.c  |6 ++
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6190972..5862f93 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2184,6 +2184,15 @@ struct gl_shader_program
 */
struct string_to_uint_map *AttributeBindings;
 
+   /**
+* User-defined fragment data bindings
+*
+* These are set via \c glBindFragDataLocation and are used to direct the
+* GLSL linker.  These are \b not the values used in the compiled shader,
+* and they are \b not the values returned by \c glGetFragDataLocation.
+*/
+   struct string_to_uint_map *FragDataBindings;
+
/** Transform feedback varyings */
struct {
   GLenum BufferMode;
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 0694b48..23667a1 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -267,7 +267,7 @@ _mesa_BindFragDataLocation(GLuint program, GLuint 
colorNumber,
 * FRAG_RESULT_DATA0 because that's how the linker differentiates
 * between built-in attributes and user-defined attributes.
 */
-
+   shProg-FragDataBindings-put(colorNumber + FRAG_RESULT_DATA0, name);
 
/*
 * Note that this binding won't go into effect until
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index ccf7efd..5efc651 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -241,6 +241,7 @@ _mesa_init_shader_program(struct gl_context *ctx, struct 
gl_shader_program *prog
prog-RefCount = 1;
 
prog-AttributeBindings = string_to_uint_map_ctor();
+   prog-FragDataBindings = string_to_uint_map_ctor();
 
 #if FEATURE_ARB_geometry_shader4
prog-Geom.VerticesOut = 0;
@@ -311,6 +312,11 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
   shProg-AttributeBindings = NULL;
}
 
+   if (shProg-FragDataBindings) {
+  string_to_uint_map_dtor(shProg-FragDataBindings);
+  shProg-FragDataBindings = NULL;
+   }
+
/* detach shaders */
for (i = 0; i  shProg-NumShaders; i++) {
   _mesa_reference_shader(ctx, shProg-Shaders[i], NULL);
-- 
1.7.6.4

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


Re: [Mesa-dev] [PATCH 2/3] glsl: translate transform feedback varyings into low-level representation

2011-11-04 Thread Marek Olšák
Hi Paul,

I won't comment on the patch 1, because I didn't write it, I was just
preserving history.

On Fri, Nov 4, 2011 at 10:00 PM, Paul Berry stereotype...@gmail.com wrote:
[snip]
 +bool parse_tfeedback_decl(const void *mem_ctx, const char *input,
 +                          struct tfeedback_decl *decl)
 +{
 +   /* We don't have to be pedantic about what is a valid GLSL variable
 name,
 +    * because any variable with an invalid name can't exist in the IR
 anyway.
 +    */
 +
 +   const char *bracket = strrchr(input, '[');
 +
 +   if (bracket) {
 +      decl-name = ralloc_strndup(mem_ctx, input, bracket - input);
 +      if (sscanf(bracket, [%u], decl-array_index) == 1) {
 +         decl-is_array = true;
 +         return true; /* Found: var[i] */
 +      }
 +   } else {
 +      decl-name = ralloc_strdup(mem_ctx, input);
 +      return true;
 +   }
 +
 +   return false;
 +}

 For non-arrays, this function doesn't assign to decl-is_array or
 decl-array_index.  That's a problem, because its caller
 (ir_set_transform_feedback_outs::ir_set_transform_feedback_outs()) passes
 uninitialized memory for decl.  We could fix the problem by having
 ir_set_transform_feedback_outs::ir_set_transform_feedback_outs() initialize
 the memory first, but I would prefer if we fixed the problem by always
 assigning to all fields of decl, since we're effectively treating it as an
 output of this function.

Yeah, that was unintentional.

Regarding the other comments, I don't know the GLSL compiler so well.
I had forked ir_set_program_inouts and was basing upon that. Now that
I think about it, it makes more sense to do it like you say. :)

Concerning this:

varying mat4 r;
glTransformFeedbackVaryingsEXT(.. r[1] ..);

The EXT spec doesn't state whether this is legal. It says nothing
about matrices, actually.

[snip]

 The patch series doesn't add any code that calls this function.  Is that
 planned for a future patch?


The function is already used here:
http://cgit.freedesktop.org/~mareko/mesa/log/?h=transform-feedback

It's a work in progress, but EXT_transform_feedback already works
quite well and ARB_transform_feedback2 too except
glDrawTransformFeedback, which isn't fully implemented yet. Despite
your remarks, the GLSL linker works pretty good for me, so I am going
to take a break from it for a while.

Feel free to take over all 3 patches and implement it properly, as I
might not have time to get to it again soon.

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


[Mesa-dev] [Bug 41571] libglapi.so.0: undefined symbol: is_selinux_enabled

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=41571

--- Comment #6 from Alexandre Demers alexandre.f.dem...@gmail.com 2011-11-04 
16:57:49 PDT ---
Yes, I just tested it and it now works fine. Thank you.

-- 
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] [PATCH 2/2] mesa: implement DrawTransformFeedback from ARB_transform_feedback2

2011-11-04 Thread Marek Olšák
It's like DrawArrays, but the count is taken from a transform feedback
object.

This removes DrawTransformFeedback from dd_function_table and adds the same
function to GLvertexformat (with the function parameters matching GL).

The vbo_draw_func callback has a new parameter
struct gl_transform_feedback_object *tfb_vertcount.

The rest of the code just validates states and forwards the transform
feedback object into vbo_draw_func.
---
 src/mesa/drivers/dri/i965/brw_draw.c |3 +-
 src/mesa/drivers/dri/i965/brw_draw.h |3 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |   15 +++--
 src/mesa/main/api_validate.c |   34 +
 src/mesa/main/api_validate.h |   10 +++
 src/mesa/main/dd.h   |3 +-
 src/mesa/main/mtypes.h   |2 +
 src/mesa/main/transformfeedback.c|   65 ++
 src/mesa/main/transformfeedback.h|6 +-
 src/mesa/main/varray.h   |7 ++
 src/mesa/main/vtxfmt.c   |1 +
 src/mesa/state_tracker/st_cb_rasterpos.c |3 +-
 src/mesa/state_tracker/st_cb_xformfb.c   |   13 
 src/mesa/state_tracker/st_draw.c |4 +-
 src/mesa/state_tracker/st_draw.h |6 +-
 src/mesa/state_tracker/st_draw_feedback.c|3 +-
 src/mesa/tnl/t_draw.c|3 +-
 src/mesa/tnl/tnl.h   |3 +-
 src/mesa/vbo/vbo.h   |4 +-
 src/mesa/vbo/vbo_exec_array.c|   93 --
 src/mesa/vbo/vbo_exec_draw.c |3 +-
 src/mesa/vbo/vbo_rebase.c|3 +-
 src/mesa/vbo/vbo_save_api.c  |   11 +++
 src/mesa/vbo/vbo_save_draw.c |3 +-
 src/mesa/vbo/vbo_split_copy.c|3 +-
 src/mesa/vbo/vbo_split_inplace.c |3 +-
 26 files changed, 207 insertions(+), 100 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 1571fb7..4c53cf5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -414,7 +414,8 @@ void brw_draw_prims( struct gl_context *ctx,
 const struct _mesa_index_buffer *ib,
 GLboolean index_bounds_valid,
 GLuint min_index,
-GLuint max_index )
+GLuint max_index,
+struct gl_transform_feedback_object *tfb_vertcount )
 {
bool retval;
 
diff --git a/src/mesa/drivers/dri/i965/brw_draw.h 
b/src/mesa/drivers/dri/i965/brw_draw.h
index 1fe4172..b910419 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.h
+++ b/src/mesa/drivers/dri/i965/brw_draw.h
@@ -41,7 +41,8 @@ void brw_draw_prims( struct gl_context *ctx,
 const struct _mesa_index_buffer *ib,
 GLboolean index_bounds_valid,
 GLuint min_index,
-GLuint max_index );
+GLuint max_index,
+struct gl_transform_feedback_object *tfb_vertcount );
 
 void brw_draw_init( struct brw_context *brw );
 void brw_draw_destroy( struct brw_context *brw );
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index d8b331c..de04d18 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -219,7 +219,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx, const struct 
gl_client_array **arr
  const struct _mesa_prim *prims, GLuint nr_prims,
  const struct _mesa_index_buffer *ib,
  GLboolean index_bounds_valid,
- GLuint min_index, GLuint max_index);
+ GLuint min_index, GLuint max_index,
+ struct gl_transform_feedback_object *tfb_vertcount);
 
 static GLboolean
 vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays,
@@ -430,7 +431,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
  const struct _mesa_prim *prims, GLuint nr_prims,
  const struct _mesa_index_buffer *ib,
  GLboolean index_bounds_valid,
- GLuint min_index, GLuint max_index)
+ GLuint min_index, GLuint max_index,
+ struct gl_transform_feedback_object *tfb_vertcount)
 {
struct nouveau_render_state *render = to_render_state(ctx);
 
@@ -464,7 +466,8 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
const struct _mesa_prim *prims, GLuint nr_prims,
const struct _mesa_index_buffer *ib,
GLboolean index_bounds_valid,
-   GLuint min_index, GLuint max_index)
+   GLuint min_index, GLuint max_index,
+

[Mesa-dev] [PATCH 1/2] mesa: add missing checks to compute_version

2011-11-04 Thread Marek Olšák
---
 src/mesa/main/version.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 17c0600..49cdc30 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -124,9 +124,11 @@ compute_version(struct gl_context *ctx)
   ctx-Extensions.EXT_pixel_buffer_object 
   ctx-Extensions.EXT_texture_sRGB);
const GLboolean ver_3_0 = (ver_2_1 
+  ctx-Const.GLSLVersion = 130 
   ctx-Extensions.ARB_color_buffer_float 
   ctx-Extensions.ARB_depth_buffer_float 
   ctx-Extensions.ARB_half_float_pixel 
+  ctx-Extensions.ARB_half_float_vertex 
   ctx-Extensions.ARB_map_buffer_range 
   ctx-Extensions.ARB_texture_float 
   ctx-Extensions.ARB_texture_rg 
@@ -145,6 +147,7 @@ compute_version(struct gl_context *ctx)
   ctx-Extensions.EXT_transform_feedback 
   ctx-Extensions.NV_conditional_render);
const GLboolean ver_3_1 = (ver_3_0 
+  ctx-Const.GLSLVersion = 140 
   ctx-Extensions.ARB_copy_buffer 
   ctx-Extensions.ARB_draw_instanced 
   ctx-Extensions.ARB_texture_buffer_object 
@@ -154,6 +157,7 @@ compute_version(struct gl_context *ctx)
   ctx-Extensions.NV_texture_rectangle 
   ctx-Const.MaxVertexTextureImageUnits = 16);
const GLboolean ver_3_2 = (ver_3_1 
+  ctx-Const.GLSLVersion = 150 
   ctx-Extensions.ARB_depth_clamp 
   ctx-Extensions.ARB_draw_elements_base_vertex 
   ctx-Extensions.ARB_fragment_coord_conventions 
@@ -164,6 +168,7 @@ compute_version(struct gl_context *ctx)
   ctx-Extensions.ARB_texture_multisample 
   ctx-Extensions.EXT_vertex_array_bgra);
const GLboolean ver_3_3 = (ver_3_2 
+  ctx-Const.GLSLVersion = 330 
   ctx-Extensions.ARB_blend_func_extended 
   ctx-Extensions.ARB_explicit_attrib_location 
   ctx-Extensions.ARB_instanced_arrays 
-- 
1.7.4.1

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


[Mesa-dev] [Bug 42610] New: [PATCH] gallivm: build failure due to llvm-trunk api change.

2011-11-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=42610

 Bug #: 42610
   Summary: [PATCH] gallivm: build failure due to llvm-trunk api
change.
Classification: Unclassified
   Product: Mesa
   Version: git
  Platform: x86 (IA32)
   URL: http://mesa3d.org/
OS/Version: Linux (All)
Status: NEW
  Keywords: patch
  Severity: major
  Priority: high
 Component: Other
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: chris.pcguy.i...@gmail.com


Created attachment 53164
  -- https://bugs.freedesktop.org/attachment.cgi?id=53164
[PATCH] gallivm: change 'sys::getHostTriple' to 'sys::getDefaultTargetTriple'
for LLVM = 0x0301

in llvm-trunk (3.1, 0x0301) 'sys::getHostTriple' got renamed to
'sys::getDefaultTargetTriple'.

-- 
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