Mesa (gallium-resources): 50 new commits

2010-03-18 Thread Keith Whitwell
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=feca9c3ca62daaf0d8745370106d4e3b22340c49
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 06:00:34 2010 +

gallium: update new merges to pipe_resource

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cad983eac77a0c5333e6a3ce92b90ac87407714
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 06:00:19 2010 +

drm/sw: update new merges to pipe_resource

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=191d39490ed792c569f98d42cf05891b264f71f8
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 06:00:01 2010 +

vg: update new merges to pipe_resource

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b727c59bc44812ad503d9390505c92b738a5b8b0
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 05:59:38 2010 +

llvmpipe: update new merges to pipe_resource

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f4b64b37fdcd70162c382b2ebbd494bef751dbd
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 05:59:23 2010 +

brw: pipe_resource fixes

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4aca209f531f1b65bf706ce1e5fc0375b587eb6
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 05:59:06 2010 +

util: update new merges to pipe_resource

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf6bef0afee10763c78509a3d17e9a6e49bcd3c8
Merge: 1997231916144485c3c4a36f53eda39fce460272 
6de8e563ac4dad818fc2bfea23f557919ed36234
Author: Keith Whitwell kei...@vmware.com
Date:   Thu Mar 18 05:38:50 2010 +

Merge commit 'origin/master' into gallium-resources

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6de8e563ac4dad818fc2bfea23f557919ed36234
Author: Kristian Høgsberg k...@bitplanet.net
Date:   Wed Mar 17 22:44:58 2010 -0400

intel: Call _mesa_make_current() after getting initial buffers

The default viewport is the window rectangle, which is set up by
_mesa_make_current().  To be able to do that we need to get the
window dimension (and buffers) first, so we have to call
intel_prepare_render() before we can call into _mesa_make_current().

Fixes #26676 and #26678.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0557d0a4b2c010b6f617613b2b46e055ce12fac9
Author: Brian Paul bri...@vmware.com
Date:   Wed Mar 17 16:26:41 2010 -0600

progs/trivial: added comments

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fecd4cde501e8b0b5d057a9cc9d2e3af8d853d9e
Author: Brian Paul bri...@vmware.com
Date:   Wed Mar 17 16:24:12 2010 -0600

gallivm/llvmpipe: basic stencil testing works

Most stencil demos look OK (modulo some unrelated rendering glitches).
Only single-sided stencil test works at this point.
There are probably some bugs to be found...

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=227824ac6999a8925b90f093b08a6284d33a7dad
Author: Brian Paul bri...@vmware.com
Date:   Wed Mar 17 15:09:35 2010 -0600

llvmpipe: remove incorrect depth test check

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b8db4ce156fbd4d094f46fad0b8b3291b057fff
Author: Brian Paul bri...@vmware.com
Date:   Wed Mar 17 15:07:45 2010 -0600

gallivm: added lp_build_andc()

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8dc8c3f5b11d5f158b0027d1501555c898e0451e
Author: Brian Paul bri...@vmware.com
Date:   Wed Mar 17 08:34:23 2010 -0600

llvmpipe: silence some pointer/casting warnings

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1c9e598838aeac3c8cb90afee00b2cc683be273
Author: Brian Paul bri...@vmware.com
Date:   Tue Mar 16 18:26:51 2010 -0600

gallivm/llvmpipe: more asst changes for stencil testing

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=67b82fc395fc9972fc08233044057ab540c7ab59
Author: Brian Paul bri...@vmware.com
Date:   Tue Mar 16 14:32:18 2010 -0600

gallivm/llmvpipe: pass stencil refs state into z/stencil build code

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8b1bb946f0bc7d1646e0625c239e08ac60b4fc7
Author: Brian Paul bri...@vmware.com
Date:   Tue Mar 16 14:11:43 2010 -0600

llvmpipe: use new LP_JIT_CTX_ enums for jit context field positions

Use the new enum values rather than integers in a few places.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eee51147979208feffdf37c588ebbce4df6b40d6
Author: Brian Paul bri...@vmware.com
Date:   Tue Mar 16 14:00:40 2010 -0600

llvmpipe: added stencil ref values to jit context state

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6379e47ebde2767ec88504313c4cf2d99ac44920
Author: Brian Paul bri...@vmware.com
Date:   Tue Mar 16 13:50:19 2010 -0600

llvmpipe: break lines

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=362c1bf75eb74de5b4655c481b74f79718ed4a34
Author: Eric Anholt e...@anholt.net
Date:   Wed Mar 17 09:09:54 2010 -0700

intel: Replace mt-pitch with mt-region-pitch.

Mesa (master): llvmpipe: Fix crashes when there is no depth buffer bound.

2010-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 9d48a621d2a0e55a76a2cfd0aea3b773e907ed50
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d48a621d2a0e55a76a2cfd0aea3b773e907ed50

Author: José Fonseca jfons...@vmware.com
Date:   Thu Mar 18 10:24:10 2010 +

llvmpipe: Fix crashes when there is no depth buffer bound.

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index b38e0f3..2cecf7e 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -152,6 +152,9 @@ generate_depth_stencil(LLVMBuilderRef builder,
const struct util_format_description *format_desc;
struct lp_type dst_type;
 
+   if (!key-depth.enabled  !key-stencil[0].enabled  
!key-stencil[1].enabled)
+  return;
+
format_desc = util_format_description(key-zsbuf_format);
assert(format_desc);
 

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


Mesa (7.8): intel: Call _mesa_make_current() after getting initial buffers

2010-03-18 Thread Kristian Høgsberg
Module: Mesa
Branch: 7.8
Commit: 38bd7282f2c2d28681f1c242545727e4c36df113
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=38bd7282f2c2d28681f1c242545727e4c36df113

Author: Kristian Høgsberg k...@bitplanet.net
Date:   Wed Mar 17 22:44:58 2010 -0400

intel: Call _mesa_make_current() after getting initial buffers

The default viewport is the window rectangle, which is set up by
_mesa_make_current().  To be able to do that we need to get the
window dimension (and buffers) first, so we have to call
intel_prepare_render() before we can call into _mesa_make_current().

Fixes #26676 and #26678.

---

 src/mesa/drivers/dri/intel/intel_context.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index d6a1ba6..c86dd1d 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -880,12 +880,12 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
   struct gl_framebuffer *fb = driDrawPriv-driverPrivate;
   struct gl_framebuffer *readFb = driReadPriv-driverPrivate;
 
-  _mesa_make_current(intel-ctx, fb, readFb);
   intel-driReadDrawable = driReadPriv;
   intel-driDrawable = driDrawPriv;
   driContextPriv-dri2.draw_stamp = driDrawPriv-dri2.stamp - 1;
   driContextPriv-dri2.read_stamp = driReadPriv-dri2.stamp - 1;
   intel_prepare_render(intel);
+  _mesa_make_current(intel-ctx, fb, readFb);
}
else {
   _mesa_make_current(NULL, NULL, NULL);

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


Mesa (master): dri/nouveau: Some minor vertex submission fixes.

2010-03-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: d475eae50b15646efd83fa7f73ad7f2b40dd5206
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d475eae50b15646efd83fa7f73ad7f2b40dd5206

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 11 21:48:51 2010 +0100

dri/nouveau: Some minor vertex submission fixes.

---

 src/mesa/drivers/dri/nouveau/nouveau_render_t.c |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c|   20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index c050578..7ccd7e6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -254,7 +254,7 @@ get_scratch_vbo(GLcontext *ctx, unsigned size, struct 
nouveau_bo **bo,
  */
 static inline unsigned
 get_max_vertices(GLcontext *ctx, const struct _mesa_index_buffer *ib,
-unsigned n)
+int n)
 {
struct nouveau_render_state *render = to_render_state(ctx);
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index a365b97..f20a7df 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -244,17 +244,20 @@ vbo_choose_attrs(GLcontext *ctx, const struct 
gl_client_array **arrays)
 }
 
 static unsigned
-get_max_client_stride(GLcontext *ctx)
+get_max_client_stride(GLcontext *ctx, const struct gl_client_array **arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
int i, s = 0;
 
for (i = 0; i  render-attr_count; i++) {
int attr = render-map[i];
-   struct nouveau_array_state *a = render-attrs[attr];
 
-   if (attr = 0  !a-bo)
-   s = MAX2(a-stride, s);
+   if (attr = 0) {
+   const struct gl_client_array *a = arrays[attr];
+
+   if (!_mesa_is_bufferobj(a-BufferObj))
+   s = MAX2(a-StrideB, s);
+   }
}
 
return s;
@@ -275,14 +278,15 @@ vbo_maybe_split(GLcontext *ctx, const struct 
gl_client_array **arrays,
 {
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
-   unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * nctx-bo.count,
+   unsigned pushbuf_avail = PUSHBUF_DWORDS - 2 * (nctx-bo.count +
+  render-attr_count),
vert_avail = get_max_vertices(ctx, NULL, pushbuf_avail),
idx_avail = get_max_vertices(ctx, ib, pushbuf_avail);
int stride;
 
/* Try to keep client buffers smaller than the scratch BOs. */
if (render-mode == VBO 
-   (stride = get_max_client_stride(ctx)))
+   (stride = get_max_client_stride(ctx, arrays)))
vert_avail = MIN2(vert_avail,
  RENDER_SCRATCH_SIZE / stride);
 
@@ -371,8 +375,6 @@ vbo_draw_vbo(GLcontext *ctx, const struct gl_client_array 
**arrays,
dispatch(ctx, start, delta, count);
BATCH_END();
}
-
-   FIRE_RING(chan);
 }
 
 /* Immediate rendering path. */
@@ -416,8 +418,6 @@ vbo_draw_imm(GLcontext *ctx, const struct gl_client_array 
**arrays,
 
BATCH_END();
}
-
-   FIRE_RING(chan);
 }
 
 /* draw_prims entry point when we're doing hw-tnl. */

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


Mesa (master): dri/nouveau: only reallocate texture when needed

2010-03-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 50be9bc6ce8582b3d3cd4fa47976cbeac28b8c26
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50be9bc6ce8582b3d3cd4fa47976cbeac28b8c26

Author: Xavier Chantry chantry.xav...@gmail.com
Date:   Sat Mar 13 19:28:07 2010 +0100

dri/nouveau: only reallocate texture when needed

nouveau reallocated the mipmap tree on every MIN_FILTER call to account
for mipmap change. We only need to do this if the texture does not fit
in the existing mipmap tree. This gives a big performance boost for a
game like bzflag which changes MIN_FILTER all the time for its font
rendering.

Signed-off-by: Xavier Chantry chantry.xav...@gmail.com
Signed-off-by: Francisco Jerez curroje...@riseup.net

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |   25 +--
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index bf365bf..20bc0f6 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -177,15 +177,15 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint 
internalFormat,
 }
 
 static GLboolean
-teximage_fits(struct gl_texture_object *t, int level,
- struct gl_texture_image *ti)
+teximage_fits(struct gl_texture_object *t, int level)
 {
struct nouveau_surface *s = to_nouveau_texture(t)-surfaces[level];
+   struct gl_texture_image *ti = t-Image[0][level];
 
-   return t-Target == GL_TEXTURE_RECTANGLE ||
-   (s-bo  s-width == ti-Width 
-s-height == ti-Height 
-s-format == ti-TexFormat);
+   return ti  (t-Target == GL_TEXTURE_RECTANGLE ||
+ (s-bo  s-width == ti-Width 
+  s-height == ti-Height 
+  s-format == ti-TexFormat));
 }
 
 static GLboolean
@@ -195,7 +195,7 @@ validate_teximage(GLcontext *ctx, struct gl_texture_object 
*t,
 {
struct gl_texture_image *ti = t-Image[0][level];
 
-   if (ti  teximage_fits(t, level, ti)) {
+   if (teximage_fits(t, level)) {
struct nouveau_surface *ss = to_nouveau_texture(t)-surfaces;
struct nouveau_surface *s = to_nouveau_teximage(ti)-surface;
 
@@ -304,9 +304,12 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
 void
 nouveau_texture_reallocate(GLcontext *ctx, struct gl_texture_object *t)
 {
-   texture_dirty(t);
-   relayout_texture(ctx, t);
-   nouveau_texture_validate(ctx, t);
+   if (!teximage_fits(t, t-BaseLevel) ||
+   !teximage_fits(t, get_last_level(t))) {
+   texture_dirty(t);
+   relayout_texture(ctx, t);
+   nouveau_texture_validate(ctx, t);
+   }
 }
 
 static unsigned
@@ -364,7 +367,7 @@ nouveau_teximage(GLcontext *ctx, GLint dims, GLenum target, 
GLint level,
}
 
if (level == t-BaseLevel) {
-   if (!teximage_fits(t, level, ti))
+   if (!teximage_fits(t, level))
relayout_texture(ctx, t);
nouveau_texture_validate(ctx, t);
}

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


Mesa (master): dri/nouveau: Implement texture matrices.

2010-03-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 1a812ab57a71d16e45ca44de7ae0570d2bd46674
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a812ab57a71d16e45ca44de7ae0570d2bd46674

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 14:13:36 2010 +0100

dri/nouveau: Implement texture matrices.

---

 src/mesa/drivers/dri/nouveau/nouveau_state.c  |7 +++
 src/mesa/drivers/dri/nouveau/nouveau_state.h  |4 
 src/mesa/drivers/dri/nouveau/nv04_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv10_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv10_driver.h|3 +++
 src/mesa/drivers/dri/nouveau/nv10_state_tex.c |   25 +
 src/mesa/drivers/dri/nouveau/nv20_context.c   |4 
 src/mesa/drivers/dri/nouveau/nv20_driver.h|3 +++
 src/mesa/drivers/dri/nouveau/nv20_state_tex.c |   24 
 9 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c 
b/src/mesa/drivers/dri/nouveau/nouveau_state.c
index bc61045..603a46e 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
@@ -454,12 +454,19 @@ nouveau_state_emit(GLcontext *ctx)
 static void
 nouveau_update_state(GLcontext *ctx, GLbitfield new_state)
 {
+   int i;
+
if (new_state  (_NEW_PROJECTION | _NEW_MODELVIEW))
context_dirty(ctx, PROJECTION);
 
if (new_state  _NEW_MODELVIEW)
context_dirty(ctx, MODELVIEW);
 
+   if (new_state  _NEW_TEXTURE_MATRIX) {
+   for (i = 0; i  ctx-Const.MaxTextureCoordUnits; i++)
+   context_dirty_i(ctx, TEX_MAT, i);
+   }
+
if (new_state  _NEW_CURRENT_ATTRIB 
new_state  _NEW_LIGHT) {
context_dirty(ctx, MATERIAL_FRONT_AMBIENT);
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.h 
b/src/mesa/drivers/dri/nouveau/nouveau_state.h
index d01d962..38ac975 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_state.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_state.h
@@ -89,6 +89,10 @@ enum {
NOUVEAU_STATE_TEX_GEN1,
NOUVEAU_STATE_TEX_GEN2,
NOUVEAU_STATE_TEX_GEN3,
+   NOUVEAU_STATE_TEX_MAT0,
+   NOUVEAU_STATE_TEX_MAT1,
+   NOUVEAU_STATE_TEX_MAT2,
+   NOUVEAU_STATE_TEX_MAT3,
NOUVEAU_STATE_TEX_OBJ0,
NOUVEAU_STATE_TEX_OBJ1,
NOUVEAU_STATE_TEX_OBJ2,
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c 
b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 3624b3a..6834f7c 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -276,6 +276,10 @@ const struct nouveau_driver nv04_driver = {
nouveau_emit_nothing,
nouveau_emit_nothing,
nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
nv04_emit_tex_obj,
nv04_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c 
b/src/mesa/drivers/dri/nouveau/nv10_context.c
index 860d0ae..d008063 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_context.c
@@ -412,6 +412,10 @@ const struct nouveau_driver nv10_driver = {
nv10_emit_tex_gen,
nouveau_emit_nothing,
nouveau_emit_nothing,
+   nv10_emit_tex_mat,
+   nv10_emit_tex_mat,
+   nouveau_emit_nothing,
+   nouveau_emit_nothing,
nv10_emit_tex_obj,
nv10_emit_tex_obj,
nouveau_emit_nothing,
diff --git a/src/mesa/drivers/dri/nouveau/nv10_driver.h 
b/src/mesa/drivers/dri/nouveau/nv10_driver.h
index d662712..cefd6c6 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_driver.h
+++ b/src/mesa/drivers/dri/nouveau/nv10_driver.h
@@ -134,6 +134,9 @@ void
 nv10_emit_tex_gen(GLcontext *ctx, int emit);
 
 void
+nv10_emit_tex_mat(GLcontext *ctx, int emit);
+
+void
 nv10_emit_tex_obj(GLcontext *ctx, int emit);
 
 /* nv10_state_tnl.c */
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 02a5ca7..9214872 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -32,11 +32,36 @@
 #include nouveau_util.h
 #include nv10_driver.h
 
+#define TX_MATRIX(i) (NV10TCL_TX0_MATRIX(0) + 64 * (i))
+
 void
 nv10_emit_tex_gen(GLcontext *ctx, int emit)
 {
 }
 
+void
+nv10_emit_tex_mat(GLcontext *ctx, int emit)
+{
+   const int i = emit - NOUVEAU_STATE_TEX_MAT0;
+   struct nouveau_context *nctx = to_nouveau_context(ctx);
+   struct nouveau_channel *chan = context_chan(ctx);
+   struct nouveau_grobj *celsius = context_eng3d(ctx);
+
+   if (nctx-fallback == HWTNL 
+   

Mesa (master): dri/nouveau: Avoid pushbuf flushes in the middle of LMA setup.

2010-03-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 6193c41bcd8c50d3f4fb38690061029866c37667
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6193c41bcd8c50d3f4fb38690061029866c37667

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 14:19:10 2010 +0100

dri/nouveau: Avoid pushbuf flushes in the middle of LMA setup.

---

 src/mesa/drivers/dri/nouveau/nv10_state_fb.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c 
b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
index 6bd383e..f7c3d36 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_fb.c
@@ -71,6 +71,7 @@ setup_lma_buffer(GLcontext *ctx)
nouveau_bo_markl(bctx, celsius, NV17TCL_LMA_DEPTH_BUFFER_OFFSET,
 nfb-lma_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
 
+   WAIT_RING(chan, 9);
BEGIN_RING(chan, celsius, NV17TCL_LMA_DEPTH_WINDOW_X, 4);
OUT_RINGf(chan, - 1792);
OUT_RINGf(chan, - 2304 + fb-Height);

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


Mesa (master): dri/nouveau: Flush after texture validation.

2010-03-18 Thread Francisco Jerez
Module: Mesa
Branch: master
Commit: 3c0eab714816618314324ac02712fa59e5ed385a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c0eab714816618314324ac02712fa59e5ed385a

Author: Francisco Jerez curroje...@riseup.net
Date:   Thu Mar 18 13:46:20 2010 +0100

dri/nouveau: Flush after texture validation.

Swizzling needs the destination surface in VRAM, but the subsequent
rendering operations making use of it are likely to not care. Fire the
ring after validation to leave the memory manager more room for
maneuvering.

---

 src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 20bc0f6..e890186 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -296,6 +296,8 @@ nouveau_texture_validate(GLcontext *ctx, struct 
gl_texture_object *t)
validate_teximage(ctx, t, i, 0, 0, 0,
  s-width, s-height, 1);
}
+
+   FIRE_RING(context_chan(ctx));
}
 
return GL_TRUE;

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


Mesa (7.8): st/mesa: s/unpack/pack/ to be more consistent

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: 7.8
Commit: b7e8039132830a2cd7a75691d11750d2ccc0a4e2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7e8039132830a2cd7a75691d11750d2ccc0a4e2

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 09:17:11 2010 -0600

st/mesa: s/unpack/pack/ to be more consistent

---

 src/mesa/state_tracker/st_cb_drawpixels.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
b/src/mesa/state_tracker/st_cb_drawpixels.c
index 7c611cb..b937288 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -939,7 +939,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
int ptw, pth;
GLboolean invertTex = GL_FALSE;
GLint readX, readY, readW, readH;
-   struct gl_pixelstore_attrib unpack = ctx-DefaultPacking;
+   struct gl_pixelstore_attrib pack = ctx-DefaultPacking;
 
pipe-flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
@@ -1003,7 +1003,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
readY = srcy;
readW = width;
readH = height;
-   _mesa_clip_readpixels(ctx, readX, readY, readW, readH, unpack);
+   _mesa_clip_readpixels(ctx, readX, readY, readW, readH, pack);
readW = MAX2(0, readW);
readH = MAX2(0, readH);
 
@@ -1046,13 +1046,13 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
   if (pipe-surface_copy) {
  pipe-surface_copy(pipe,
 psTex,   /* dest surf 
*/
-unpack.SkipPixels, unpack.SkipRows,  /* dest pos */
+pack.SkipPixels, pack.SkipRows,  /* dest pos */
 psRead,  /* src surf */
 readX, readY, readW, readH); /* src region 
*/
   } else {
  util_surface_copy(pipe, FALSE,
psTex,
-   unpack.SkipPixels, unpack.SkipRows,
+   pack.SkipPixels, pack.SkipRows,
psRead,
readX, readY, readW, readH);
   }
@@ -1091,7 +1091,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
  /* alternate path using get/put_tile() */
  GLfloat *buf = (GLfloat *) malloc(width * height * 4 * 
sizeof(GLfloat));
  pipe_get_tile_rgba(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_rgba(ptTex, unpack.SkipPixels, unpack.SkipRows,
+ pipe_put_tile_rgba(ptTex, pack.SkipPixels, pack.SkipRows,
 readW, readH, buf);
  free(buf);
   }
@@ -1099,7 +1099,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy,
  /* GL_DEPTH */
  GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
  pipe_get_tile_z(ptRead, readX, readY, readW, readH, buf);
- pipe_put_tile_z(ptTex, unpack.SkipPixels, unpack.SkipRows,
+ pipe_put_tile_z(ptTex, pack.SkipPixels, pack.SkipRows,
 readW, readH, buf);
  free(buf);
   }

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


Mesa (master): gallivm: checkpoint WIP two-sided stencil test

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ecf85c7d750478e433e640897bb25a18069f14de
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecf85c7d750478e433e640897bb25a18069f14de

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 11:18:01 2010 -0600

gallivm: checkpoint WIP two-sided stencil test

---

 src/gallium/auxiliary/gallivm/lp_bld_depth.c |  221 ++
 1 files changed, 191 insertions(+), 30 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index e4500e5..49de5c9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -52,7 +52,14 @@
  *  Z31 Z32 Z41 Z42 Z33 Z34 Z43 Z44 ...
  *  ... ... ... ... ... ... ... ... ...
  *
- * FIXME: Code generate stencil test
+ *
+ * Stencil test:
+ * Two-sided stencil test is supported but probably not as efficient as
+ * it could be.  Currently, we use if/then/else constructs to do the
+ * operations for front vs. back-facing polygons.  We could probably do
+ * both the front and back arithmetic then use a Select() instruction to
+ * choose the result depending on polyon orientation.  We'd have to
+ * measure performance both ways and see which is better.
  *
  * @author Jose Fonseca jfons...@vmware.com
  */
@@ -70,18 +77,28 @@
 #include lp_bld_swizzle.h
 
 
+/** Used to select fields from pipe_stencil_state */
+enum stencil_op {
+   S_FAIL_OP,
+   Z_FAIL_OP,
+   Z_PASS_OP
+};
+
+
 
 /**
- * Do the stencil test comparison (compare fb Z values against ref value.
- * \param stencilVals  vector of stencil values from framebuffer
+ * Do the stencil test comparison (compare FB stencil values against ref 
value).
+ * This will be used twice when generating two-sided stencil code.
+ * \param stencil  the front/back stencil state
  * \param stencilRef  the stencil reference value, replicated as a vector
- * \return mask of pass/fail values
+ * \param stencilVals  vector of stencil values from framebuffer
+ * \return vector mask of pass/fail values (~0 or 0)
  */
 static LLVMValueRef
-lp_build_stencil_test(struct lp_build_context *bld,
-  const struct pipe_stencil_state *stencil,
-  LLVMValueRef stencilRef,
-  LLVMValueRef stencilVals)
+lp_build_stencil_test_single(struct lp_build_context *bld,
+ const struct pipe_stencil_state *stencil,
+ LLVMValueRef stencilRef,
+ LLVMValueRef stencilVals)
 {
const unsigned stencilMax = 255; /* XXX fix */
struct lp_type type = bld-type;
@@ -104,23 +121,99 @@ lp_build_stencil_test(struct lp_build_context *bld,
 
 
 /**
+ * Do the one or two-sided stencil test comparison.
+ * \sa lp_build_stencil_test_single
+ * \param face  an integer indicating front (+) or back (-) facing polygon.
+ *  If NULL, assume front-facing.
+ */
+static LLVMValueRef
+lp_build_stencil_test(struct lp_build_context *bld,
+  const struct pipe_stencil_state stencil[2],
+  LLVMValueRef stencilRefs[2],
+  LLVMValueRef stencilVals,
+  LLVMValueRef face)
+{
+   LLVMValueRef res;
+
+   assert(stencil[0].enabled);
+
+   if (stencil[1].enabled  face) {
+  /* do two-sided test */
+  struct lp_build_flow_context *flow_ctx;
+  struct lp_build_if_state if_ctx;
+  LLVMValueRef front_facing;
+  LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
+  LLVMValueRef result = NULL;
+
+  flow_ctx = lp_build_flow_create(bld-builder);
+  lp_build_flow_scope_begin(flow_ctx);
+
+  lp_build_flow_scope_declare(flow_ctx, result);
+
+  /* front_facing = face  0.0 */
+  front_facing = lp_build_cmp(bld, PIPE_FUNC_GREATER, face, zero);
+
+  lp_build_if(if_ctx, flow_ctx, bld-builder, front_facing);
+  {
+ result = lp_build_stencil_test_single(bld, stencil[0],
+   stencilRefs[0], stencilVals);
+  }
+  lp_build_else(if_ctx);
+  {
+ result = lp_build_stencil_test_single(bld, stencil[1],
+   stencilRefs[1], stencilVals);
+  }
+  lp_build_endif(if_ctx);
+
+  lp_build_flow_scope_end(flow_ctx);
+  lp_build_flow_destroy(flow_ctx);
+
+  res = result;
+   }
+   else {
+  /* do single-side test */
+  res = lp_build_stencil_test_single(bld, stencil[0],
+ stencilRefs[0], stencilVals);
+   }
+
+   return res;
+}
+
+
+/**
  * Apply the stencil operator (add/sub/keep/etc) to the given vector
  * of stencil values.
  * \return  new stencil values vector
  */
 static LLVMValueRef
-lp_build_stencil_op(struct lp_build_context *bld,
-const struct pipe_stencil_state *stencil,
-unsigned stencil_op,
-LLVMValueRef stencilRef,
- 

Mesa (master): gallivm/llvmpipe: simplify front/ back stencil ref value handling

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 521c61ff017ab15b829abbe9a98b179136a36009
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=521c61ff017ab15b829abbe9a98b179136a36009

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 11:31:38 2010 -0600

gallivm/llvmpipe: simplify front/back stencil ref value handling

Instead of passing an array, just pass two scalar values.

---

 src/gallium/auxiliary/gallivm/lp_bld_depth.c |   41 --
 src/gallium/auxiliary/gallivm/lp_bld_depth.h |2 +-
 src/gallium/drivers/llvmpipe/lp_jit.c|   10 --
 src/gallium/drivers/llvmpipe/lp_jit.h|   12 +--
 src/gallium/drivers/llvmpipe/lp_setup.c  |8 ++--
 src/gallium/drivers/llvmpipe/lp_state_fs.c   |7 ++--
 6 files changed, 30 insertions(+), 50 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index 49de5c9..c253764 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -363,32 +363,6 @@ lp_depth_type(const struct util_format_description 
*format_desc,
 }
 
 
-/** Get front/back-face stencil ref value */
-static LLVMValueRef
-lp_build_get_stencil_ref(struct lp_build_context *bld,
- struct lp_type type, LLVMValueRef stencil_refs_ptr,
- unsigned face_index)
-{
-   LLVMValueRef indexes[2], ptr, ref, ref_vec;
-
-   assert(face_index  2);
-
-   /* load [face_index] element of the array */
-   indexes[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
-   indexes[1] = LLVMConstInt(LLVMInt32Type(), face_index, 0);
-   ptr = LLVMBuildGEP(bld-builder, stencil_refs_ptr, indexes, 2, );
-   ref = LLVMBuildLoad(bld-builder, ptr, );
-
-   /* convert int8 value to i32 */
-   ref = LLVMBuildZExt(bld-builder, ref, LLVMIntType(type.width), );
-
-   /* make scalar into vector */
-   ref_vec = lp_build_broadcast_scalar(bld, ref);
-
-   return ref_vec;
-}
-
-
 /**
  * Generate code for performing depth and/or stencil tests.
  * We operate on a vector of values (typically a 2x2 quad).
@@ -406,13 +380,12 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 struct lp_type type,
 const struct util_format_description *format_desc,
 struct lp_build_mask_context *mask,
-LLVMValueRef stencil_refs_ptr,
+LLVMValueRef stencil_refs[2],
 LLVMValueRef z_src,
 LLVMValueRef zs_dst_ptr)
 {
struct lp_build_context bld;
unsigned z_swizzle, s_swizzle;
-   LLVMValueRef stencil_refs[2];
LLVMValueRef zs_dst, z_dst = NULL;
LLVMValueRef stencil_vals = NULL;
LLVMValueRef z_bitmask = NULL, s_bitmask = NULL;
@@ -502,19 +475,17 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
lp_build_name(z_dst, zsbuf.z);
 
-
+   /*
printf(build depth %d stencil %d\n,
   depth-enabled,
   stencil[0].enabled);
-
+   */
 
if (stencil[0].enabled) {
-  /* Incoming stencil_refs is ptr to int8[2].  Get/convert to int32[4]. */
-  stencil_refs[0] = lp_build_get_stencil_ref(bld, type, stencil_refs_ptr, 
0);
+  /* convert scalar stencil refs into vectors */
+  stencil_refs[0] = lp_build_broadcast_scalar(bld, stencil_refs[0]);
+  stencil_refs[1] = lp_build_broadcast_scalar(bld, stencil_refs[1]);
 
-  if (stencil[1].enabled)
- stencil_refs[1] =
-lp_build_get_stencil_ref(bld, type, stencil_refs_ptr, 1);
 
   s_pass_mask = lp_build_stencil_test(bld, stencil,
   stencil_refs, stencil_vals, face);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.h 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
index eedc1e4..5708ced 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
@@ -57,7 +57,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 struct lp_type type,
 const struct util_format_description *format_desc,
 struct lp_build_mask_context *mask,
-LLVMValueRef stencil_refs,
+LLVMValueRef stencil_refs[2],
 LLVMValueRef zs_src,
 LLVMValueRef zs_dst_ptr);
 
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c 
b/src/gallium/drivers/llvmpipe/lp_jit.c
index 1eee921..927e472 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -96,7 +96,8 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
 
   elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatType(), 0);
   elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType();
-  elem_types[LP_JIT_CTX_STENCIL_REF] = LLVMArrayType(LLVMInt8Type(), 2);
+  elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] = 

Mesa (master): llvmpipe: set opaque = FALSE if stencil enabled

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: a1e7aeecc25cedbd54e43afa72a1a2926ae51a32
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1e7aeecc25cedbd54e43afa72a1a2926ae51a32

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 09:30:13 2010 -0600

llvmpipe: set opaque = FALSE if stencil enabled

Fixes occasional bad tiles seen in some demos like progs/demos/reflect.c

---

 src/gallium/drivers/llvmpipe/lp_state_fs.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 2cecf7e..921c51f 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1169,6 +1169,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
opaque = !key.blend.logicop_enable 
 !key.blend.rt[0].blend_enable 
 key.blend.rt[0].colormask == 0xf 
+!key.stencil[0].enabled 
 !key.alpha.enabled 
 !key.depth.enabled 
 !key.scissor 

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


Mesa (master): Add format B5G5R5X1

2010-03-18 Thread Alan Hourihane
Module: Mesa
Branch: master
Commit: 94abc4b51e134bee1ace2b57400e35c295bda6f8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=94abc4b51e134bee1ace2b57400e35c295bda6f8

Author: Alan Hourihane al...@vmware.com
Date:   Thu Mar 18 18:01:05 2010 +

Add format B5G5R5X1

---

 src/gallium/auxiliary/util/u_format.csv |1 +
 src/gallium/auxiliary/util/u_format_tests.c |7 +++
 src/gallium/auxiliary/util/u_gen_mipmap.c   |1 +
 src/gallium/auxiliary/util/u_pack_color.h   |   19 +
 src/gallium/auxiliary/util/u_tile.c |   55 +++
 src/gallium/include/pipe/p_format.h |1 +
 6 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.csv 
b/src/gallium/auxiliary/util/u_format.csv
index 96a0fa6..11243e7 100644
--- a/src/gallium/auxiliary/util/u_format.csv
+++ b/src/gallium/auxiliary/util/u_format.csv
@@ -63,6 +63,7 @@ PIPE_FORMAT_A8R8G8B8_UNORM, plain, 1, 1, un8 , un8 , 
un8 , un8 , yzwx, r
 PIPE_FORMAT_X8R8G8B8_UNORM, plain, 1, 1, un8 , un8 , un8 , un8 , yzw1, 
rgb
 PIPE_FORMAT_A8B8G8R8_UNORM, plain, 1, 1, un8 , un8 , un8 , un8 , wzyx, 
rgb
 PIPE_FORMAT_X8B8G8R8_UNORM, plain, 1, 1, un8 , un8 , un8 , un8 , wzy1, 
rgb
+PIPE_FORMAT_B5G5R5X1_UNORM, plain, 1, 1, un5 , un5 , un5 , un1 , zyx1, 
rgb
 PIPE_FORMAT_B5G5R5A1_UNORM, plain, 1, 1, un5 , un5 , un5 , un1 , zyxw, 
rgb
 PIPE_FORMAT_B4G4R4A4_UNORM, plain, 1, 1, un4 , un4 , un4 , un4 , zyxw, 
rgb
 PIPE_FORMAT_B5G6R5_UNORM  , plain, 1, 1, un5 , un6 , un5 , , zyx1, 
rgb
diff --git a/src/gallium/auxiliary/util/u_format_tests.c 
b/src/gallium/auxiliary/util/u_format_tests.c
index 182a474..9d6debc 100644
--- a/src/gallium/auxiliary/util/u_format_tests.c
+++ b/src/gallium/auxiliary/util/u_format_tests.c
@@ -120,6 +120,13 @@ util_format_test_cases[] =
 * 16-bit rendertarget formats
 */
 
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x), 
{0.0, 0.0, 0.0, 0.0}},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x001f), 
{0.0, 0.0, 1.0, 0.0}},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x03e0), 
{0.0, 1.0, 0.0, 0.0}},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x7c00), 
{1.0, 0.0, 0.0, 0.0}},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x8000), 
{0.0, 0.0, 0.0, 1.0}},
+   {PIPE_FORMAT_B5G5R5X1_UNORM, PACKED_1x16(0x7fff), PACKED_1x16(0x), 
{1.0, 1.0, 1.0, 1.0}},
+
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0x), PACKED_1x16(0x), 
{0.0, 0.0, 0.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0x), PACKED_1x16(0x001f), 
{0.0, 0.0, 1.0, 0.0}},
{PIPE_FORMAT_B5G5R5A1_UNORM, PACKED_1x16(0x), PACKED_1x16(0x03e0), 
{0.0, 1.0, 0.0, 0.0}},
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c 
b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 61d64cf..509d387 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -938,6 +938,7 @@ format_to_type_comps(enum pipe_format pformat,
   *datatype = DTYPE_UBYTE;
   *comps = 4;
   return;
+   case PIPE_FORMAT_B5G5R5X1_UNORM:
case PIPE_FORMAT_B5G5R5A1_UNORM:
   *datatype = DTYPE_USHORT_1_5_5_5_REV;
   *comps = 4;
diff --git a/src/gallium/auxiliary/util/u_pack_color.h 
b/src/gallium/auxiliary/util/u_pack_color.h
index 50f1b16..c5fd7a6 100644
--- a/src/gallium/auxiliary/util/u_pack_color.h
+++ b/src/gallium/auxiliary/util/u_pack_color.h
@@ -92,6 +92,11 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a,
  uc-us = ((r  0xf8)  8) | ((g  0xfc)  3) | (b  3);
   }
   return;
+   case PIPE_FORMAT_B5G5R5X1_UNORM:
+  {
+ uc-us = ((0x80)  8) | ((r  0xf8)  7) | ((g  0xf8)  2) | (b 
 3);
+  }
+  return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
   {
  uc-us = ((a  0x80)  8) | ((r  0xf8)  7) | ((g  0xf8)  2) | 
(b  3);
@@ -216,6 +221,15 @@ util_unpack_color_ub(enum pipe_format format, union 
util_color *uc,
  *a = (ubyte) 0xff;
   }
   return;
+   case PIPE_FORMAT_B5G5R5X1_UNORM:
+  {
+ ushort p = uc-us;
+ *r = (ubyte) (((p   7)  0xf8) | ((p  12)  0x7));
+ *g = (ubyte) (((p   2)  0xf8) | ((p   7)  0x7));
+ *b = (ubyte) (((p   3)  0xf8) | ((p   2)  0x7));
+ *a = (ubyte) 0xff;
+  }
+  return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
   {
  ushort p = uc-us;
@@ -361,6 +375,11 @@ util_pack_color(const float rgba[4], enum pipe_format 
format, union util_color *
  uc-us = ((r  0xf8)  8) | ((g  0xfc)  3) | (b  3);
   }
   return;
+   case PIPE_FORMAT_B5G5R5X1_UNORM:
+  {
+ uc-us = ((0x80)  8) | ((r  0xf8)  7) | ((g  0xf8)  2) | (b 
 3);
+  }
+  return;
case PIPE_FORMAT_B5G5R5A1_UNORM:
   {
  uc-us = ((a  0x80)  8) | ((r  0xf8)  7) | ((g  0xf8)  2) | 
(b  3);
diff --git 

Mesa (master): llvmpipe: defines for RAST_WHOLE, RAST_EDGE_TEST

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d219b8a022a6fdaa0106c6e160b594c359f85185
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d219b8a022a6fdaa0106c6e160b594c359f85185

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 12:04:50 2010 -0600

llvmpipe: defines for RAST_WHOLE, RAST_EDGE_TEST

---

 src/gallium/drivers/llvmpipe/lp_jit.h  |5 +++
 src/gallium/drivers/llvmpipe/lp_rast.c |   38 ++-
 src/gallium/drivers/llvmpipe/lp_state_fs.c |4 +-
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h 
b/src/gallium/drivers/llvmpipe/lp_jit.h
index bbd0c96..690b439 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -146,6 +146,11 @@ enum {
lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES, textures)
 
 
+/** Indexes into jit_function[] array */
+#define RAST_WHOLE 0
+#define RAST_EDGE_TEST 1
+
+
 typedef void
 (*lp_jit_frag_func)(const struct lp_jit_context *context,
 uint32_t x,
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c 
b/src/gallium/drivers/llvmpipe/lp_rast.c
index 81ea11a..30b43cc 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -312,15 +312,15 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
  depth = lp_rast_depth_pointer(rast, tile_x + x, tile_y + y);
 
  /* run shader */
- state-jit_function[0]( state-jit_context,
- tile_x + x, tile_y + y,
- inputs-a0,
- inputs-dadx,
- inputs-dady,
- color,
- depth,
- INT_MIN, INT_MIN, INT_MIN,
- NULL, NULL, NULL );
+ state-jit_function[RAST_WHOLE]( state-jit_context,
+  tile_x + x, tile_y + y,
+  inputs-a0,
+  inputs-dadx,
+  inputs-dady,
+  color,
+  depth,
+  INT_MIN, INT_MIN, INT_MIN,
+  NULL, NULL, NULL );
   }
}
 }
@@ -375,15 +375,17 @@ void lp_rast_shade_quads( struct lp_rasterizer_task *task,
assert(lp_check_alignment(inputs-step[2], 16));
 
/* run shader */
-   state-jit_function[1]( state-jit_context,
-x, y,
-inputs-a0,
-inputs-dadx,
-inputs-dady,
-color,
-depth,
-c1, c2, c3,
-inputs-step[0], inputs-step[1], inputs-step[2]);
+   state-jit_function[RAST_EDGE_TEST]( state-jit_context,
+x, y,
+inputs-a0,
+inputs-dadx,
+inputs-dady,
+color,
+depth,
+c1, c2, c3,
+inputs-step[0],
+inputs-step[1],
+inputs-step[2]);
 }
 
 
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c 
b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 0f96654..5f70d52 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1178,7 +1178,7 @@ llvmpipe_update_fs(struct llvmpipe_context *lp)
 ? TRUE : FALSE;
 
lp_setup_set_fs_functions(lp-setup, 
- shader-current-jit_function[0],
- shader-current-jit_function[1],
+ shader-current-jit_function[RAST_WHOLE],
+ shader-current-jit_function[RAST_EDGE_TEST],
  opaque);
 }

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


Mesa (master): gallivm/llvmpipe: added lp_rast_shader_inputs:: facing and pass through

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 22e6dc387039e79f6d1435ae8b7422a6514d5d10
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22e6dc387039e79f6d1435ae8b7422a6514d5d10

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 13:02:53 2010 -0600

gallivm/llvmpipe: added lp_rast_shader_inputs::facing and pass through

The triangle rasterizer sets this field to indicate front/back-facing.
It gets passed into the generated fragment code as another parameter.
Used now for stencil front/back selection but will also be used for
fragment shaders in general (see TGSI_SEMANTIC_FACE).

With this commit two-sided stenciling mostly works but there's
still a bug or two...

---

 src/gallium/auxiliary/gallivm/lp_bld_depth.c |   22 ++
 src/gallium/auxiliary/gallivm/lp_bld_depth.h |3 +-
 src/gallium/drivers/llvmpipe/lp_jit.h|1 +
 src/gallium/drivers/llvmpipe/lp_rast.c   |2 +
 src/gallium/drivers/llvmpipe/lp_rast.h   |2 +
 src/gallium/drivers/llvmpipe/lp_rast_priv.h  |1 +
 src/gallium/drivers/llvmpipe/lp_setup_tri.c  |2 +
 src/gallium/drivers/llvmpipe/lp_state_fs.c   |   61 ++---
 8 files changed, 57 insertions(+), 37 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index c253764..e1558dc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -143,7 +143,7 @@ lp_build_stencil_test(struct lp_build_context *bld,
   struct lp_build_if_state if_ctx;
   LLVMValueRef front_facing;
   LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
-  LLVMValueRef result = NULL;
+  LLVMValueRef result = bld-undef;
 
   flow_ctx = lp_build_flow_create(bld-builder);
   lp_build_flow_scope_begin(flow_ctx);
@@ -151,7 +151,7 @@ lp_build_stencil_test(struct lp_build_context *bld,
   lp_build_flow_scope_declare(flow_ctx, result);
 
   /* front_facing = face  0.0 */
-  front_facing = lp_build_cmp(bld, PIPE_FUNC_GREATER, face, zero);
+  front_facing = LLVMBuildFCmp(bld-builder, LLVMRealUGT, face, zero, );
 
   lp_build_if(if_ctx, flow_ctx, bld-builder, front_facing);
   {
@@ -287,7 +287,7 @@ lp_build_stencil_op(struct lp_build_context *bld,
   struct lp_build_if_state if_ctx;
   LLVMValueRef front_facing;
   LLVMValueRef zero = LLVMConstReal(LLVMFloatType(), 0.0);
-  LLVMValueRef result = NULL;
+  LLVMValueRef result = bld-undef;
 
   flow_ctx = lp_build_flow_create(bld-builder);
   lp_build_flow_scope_begin(flow_ctx);
@@ -295,7 +295,7 @@ lp_build_stencil_op(struct lp_build_context *bld,
   lp_build_flow_scope_declare(flow_ctx, result);
 
   /* front_facing = face  0.0 */
-  front_facing = lp_build_cmp(bld, PIPE_FUNC_GREATER, face, zero);
+  front_facing = LLVMBuildFCmp(bld-builder, LLVMRealUGT, face, zero, );
 
   lp_build_if(if_ctx, flow_ctx, bld-builder, front_facing);
   {
@@ -367,11 +367,15 @@ lp_depth_type(const struct util_format_description 
*format_desc,
  * Generate code for performing depth and/or stencil tests.
  * We operate on a vector of values (typically a 2x2 quad).
  *
+ * \param depth  the depth test state
+ * \param stencil  the front/back stencil state
  * \param type  the data type of the fragment depth/stencil values
  * \param format_desc  description of the depth/stencil surface
- * \param mask  the alive/dead pixel mask for the quad
- * \param src  the incoming depth/stencil values (a 2x2 quad)
- * \param dst_ptr  the outgoing/updated depth/stencil values
+ * \param mask  the alive/dead pixel mask for the quad (vector)
+ * \param stencil_refs  the front/back stencil ref values (scalar)
+ * \param z_src  the incoming depth/stencil values (a 2x2 quad)
+ * \param zs_dst_ptr  pointer to depth/stencil values in framebuffer
+ * \param facing  contains float value indicating front/back facing polygon
  */
 void
 lp_build_depth_stencil_test(LLVMBuilderRef builder,
@@ -382,7 +386,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 struct lp_build_mask_context *mask,
 LLVMValueRef stencil_refs[2],
 LLVMValueRef z_src,
-LLVMValueRef zs_dst_ptr)
+LLVMValueRef zs_dst_ptr,
+LLVMValueRef face)
 {
struct lp_build_context bld;
unsigned z_swizzle, s_swizzle;
@@ -391,7 +396,6 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
LLVMValueRef z_bitmask = NULL, s_bitmask = NULL;
LLVMValueRef z_pass = NULL, s_pass_mask = NULL;
LLVMValueRef orig_mask = mask-value;
-   LLVMValueRef face = NULL;
 
assert(depth-enabled || stencil[0].enabled);
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.h 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.h
index 5708ced..27dd46b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.h
+++ 

Mesa (master): progs/tests: comments and clean-ups

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 705ed3326c9b56fcee193748f87b14ed6d67b65f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=705ed3326c9b56fcee193748f87b14ed6d67b65f

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 14:53:43 2010 -0600

progs/tests: comments and clean-ups

---

 progs/tests/stencil_twoside.c |   32 +---
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c
index 7d871e5..f9c1091 100644
--- a/progs/tests/stencil_twoside.c
+++ b/progs/tests/stencil_twoside.c
@@ -85,6 +85,9 @@ static void Display( void )
/* Draw the first two squares using incr for the affected face
 */
 
+   /*
+* 2nd square
+*/
if (use20syntax) {
   stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
   stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -98,8 +101,8 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-   /* this should be front facing */
for ( i = 0 ; i  (max_stencil + 5) ; i++ ) {
+  /* this should be front facing */
   glVertex2f(-1, -1);
   glVertex2f( 1, -1);
   glVertex2f( 1,  1);
@@ -107,6 +110,7 @@ static void Display( void )
}
glEnd();
 
+   /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -116,6 +120,9 @@ static void Display( void )
glVertex2f(-1,  1);
glEnd();
 
+   /*
+* 3rd square
+*/
if (use20syntax) {
   stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
   stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -129,9 +136,8 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
-   /* this should be back facing */
for ( i = 0 ; i  (max_stencil + 5) ; i++ ) {
+  /* this should be back facing */
   glVertex2f(-1, -1);
   glVertex2f(-1,  1);
   glVertex2f( 1,  1);
@@ -139,6 +145,7 @@ static void Display( void )
}
glEnd();
 
+   /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -148,6 +155,9 @@ static void Display( void )
glVertex2f(-1,  1);
glEnd();
 
+   /*
+* 4th square
+*/
if (use20syntax) {
   stencil_func_separate(GL_FRONT, GL_NEVER, 0, ~0);
   stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -161,15 +171,13 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
-   /* this should be back facing */
for ( i = 0 ; i  (max_stencil + 5) ; i++ ) {
-   /* this should be back facing */
+  /* this should be back facing */
   glVertex2f(-1, -1);
   glVertex2f(-1,  1);
   glVertex2f( 1,  1);
   glVertex2f( 1, -1);
-   /* this should be front facing */
+  /* this should be front facing */
   glVertex2f(-1, -1);
   glVertex2f( 1, -1);
   glVertex2f( 1,  1);
@@ -177,6 +185,7 @@ static void Display( void )
}
glEnd();
 
+   /* stencil vals should be equal to max_stencil */
glStencilFunc(GL_EQUAL, max_stencil, ~0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
@@ -186,6 +195,9 @@ static void Display( void )
glVertex2f(-1,  1);
glEnd();
 
+   /*
+* 5th square
+*/
if (use20syntax) {
   stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
   stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
@@ -199,15 +211,13 @@ static void Display( void )
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.9, 0.9, 0.9 );
-
-   /* this should be back facing */
for ( i = 0 ; i  (max_stencil + 5) ; i++ ) {
-   /* this should be back facing */
+  /* this should be back facing */
   glVertex2f(-1, -1);
   glVertex2f(-1,  1);
   glVertex2f( 1,  1);
   glVertex2f( 1, -1);
-   /* this should be front facing */
+  /* this should be front facing */
   glVertex2f(-1, -1);
   glVertex2f( 1, -1);
   glVertex2f( 1,  1);

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


Mesa (master): gallivm: fix broken INCR/DECR stencil modes

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 66b6676d141463b8229e62be6249efd1cb6873a8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=66b6676d141463b8229e62be6249efd1cb6873a8

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 15:02:13 2010 -0600

gallivm: fix broken INCR/DECR stencil modes

We were mistakenly using the wrong data type for stencil values before.

---

 src/gallium/auxiliary/gallivm/lp_bld_depth.c |   23 +--
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index e1558dc..0841aa8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -104,6 +104,8 @@ lp_build_stencil_test_single(struct lp_build_context *bld,
struct lp_type type = bld-type;
LLVMValueRef res;
 
+   assert(type.sign);
+
assert(stencil-enabled);
 
if (stencil-valuemask != stencilMax) {
@@ -200,6 +202,8 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
LLVMValueRef max = lp_build_const_int_vec(type, stencilMax);
unsigned stencil_op;
 
+   assert(type.sign);
+
switch (op) {
case S_FAIL_OP:
   stencil_op = stencil-fail_op;
@@ -244,6 +248,7 @@ lp_build_stencil_op_single(struct lp_build_context *bld,
   break;
case PIPE_STENCIL_OP_INVERT:
   res = LLVMBuildNot(bld-builder, stencilVals, );
+  res = LLVMBuildAnd(bld-builder, res, max, );
   break;
default:
   assert(0  bad stencil op mode);
@@ -390,6 +395,8 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 LLVMValueRef face)
 {
struct lp_build_context bld;
+   struct lp_build_context sbld;
+   struct lp_type s_type;
unsigned z_swizzle, s_swizzle;
LLVMValueRef zs_dst, z_dst = NULL;
LLVMValueRef stencil_vals = NULL;
@@ -425,9 +432,13 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
   assert(type.norm);
}
 
-   /* Setup build context */
+   /* Setup build context for Z vals */
lp_build_context_init(bld, builder, type);
 
+   /* Setup build context for stencil vals */
+   s_type = lp_type_int_vec(type.width);
+   lp_build_context_init(sbld, builder, s_type);
+
/* Load current z/stencil value from z/stencil buffer */
zs_dst = LLVMBuildLoad(builder, zs_dst_ptr, );
 
@@ -491,13 +502,13 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
   stencil_refs[1] = lp_build_broadcast_scalar(bld, stencil_refs[1]);
 
 
-  s_pass_mask = lp_build_stencil_test(bld, stencil,
+  s_pass_mask = lp_build_stencil_test(sbld, stencil,
   stencil_refs, stencil_vals, face);
 
   /* apply stencil-fail operator */
   {
  LLVMValueRef s_fail_mask = lp_build_andc(bld, orig_mask, 
s_pass_mask);
- stencil_vals = lp_build_stencil_op(bld, stencil, S_FAIL_OP,
+ stencil_vals = lp_build_stencil_op(sbld, stencil, S_FAIL_OP,
 stencil_refs, stencil_vals,
 s_fail_mask, face);
   }
@@ -530,13 +541,13 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
 
  /* apply Z-fail operator */
  z_fail_mask = lp_build_andc(bld, orig_mask, z_pass);
- stencil_vals = lp_build_stencil_op(bld, stencil, Z_FAIL_OP,
+ stencil_vals = lp_build_stencil_op(sbld, stencil, Z_FAIL_OP,
 stencil_refs, stencil_vals,
 z_fail_mask, face);
 
  /* apply Z-pass operator */
  z_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, z_pass, );
- stencil_vals = lp_build_stencil_op(bld, stencil, Z_PASS_OP,
+ stencil_vals = lp_build_stencil_op(sbld, stencil, Z_PASS_OP,
 stencil_refs, stencil_vals,
 z_pass_mask, face);
   }
@@ -546,7 +557,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
* passed the stencil test.
*/
   s_pass_mask = LLVMBuildAnd(bld.builder, orig_mask, s_pass_mask, );
-  stencil_vals = lp_build_stencil_op(bld, stencil, Z_PASS_OP, 
stencil_refs,
+  stencil_vals = lp_build_stencil_op(sbld, stencil, Z_PASS_OP, 
stencil_refs,
  stencil_vals, s_pass_mask, face);
}
 

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


Mesa (master): progs/tests: also test stencil INCR_WRAP mode if supported

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c9c0baabdc653f162f9ce51cb17775aed1a707f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9c0baabdc653f162f9ce51cb17775aed1a707f7

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 15:04:31 2010 -0600

progs/tests: also test stencil INCR_WRAP mode if supported

---

 progs/tests/stencil_twoside.c |   53 
 1 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/progs/tests/stencil_twoside.c b/progs/tests/stencil_twoside.c
index f9c1091..1010139 100644
--- a/progs/tests/stencil_twoside.c
+++ b/progs/tests/stencil_twoside.c
@@ -26,7 +26,7 @@
  * \file stencil_twoside.c
  * 
  * Simple test of GL_ATI_separate_stencil (or the OGL 2.0 equivalent) 
functionality.
- * Four squares are drawn
+ * Five squares (or six if stencil wrap is available) are drawn
  * with different stencil modes, but all should be rendered with the same
  * final color.
  */
@@ -37,7 +37,7 @@
 #include GL/glut.h
 
 static int use20syntax = 1;
-static int Width = 550;
+static int Width = 650;
 static int Height = 200;
 static const GLfloat Near = 5.0, Far = 25.0;
 
@@ -70,7 +70,7 @@ static void Display( void )
 */
 
glDisable(GL_STENCIL_TEST);
-   glTranslatef(-6.0, 0, 0);
+   glTranslatef(-7.0, 0, 0);
glBegin(GL_QUADS);
glColor3f( 0.5, 0.5, 0.5 );
glVertex2f(-1, -1);
@@ -205,8 +205,8 @@ static void Display( void )
else {
   stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0);
}
-   stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_DECR);
-   stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR);
+   stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_INCR);
+   stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_DECR);
 
glTranslatef(3.0, 0, 0);
glBegin(GL_QUADS);
@@ -234,6 +234,47 @@ static void Display( void )
glVertex2f(-1,  1);
glEnd();
 
+   /*
+* 6th square
+*/
+   if (glutExtensionSupported(GL_EXT_stencil_wrap)) {
+  if (use20syntax) {
+ stencil_func_separate(GL_FRONT, GL_ALWAYS, 0, ~0);
+ stencil_func_separate(GL_BACK, GL_ALWAYS, 0, ~0);
+  }
+  else {
+ stencil_func_separate_ati(GL_ALWAYS, GL_ALWAYS, 0, ~0);
+  }
+  stencil_op_separate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP);
+  stencil_op_separate(GL_BACK, GL_KEEP, GL_KEEP, GL_INCR_WRAP);
+
+  glTranslatef(3.0, 0, 0);
+  glBegin(GL_QUADS);
+  glColor3f( 0.9, 0.9, 0.9 );
+  for ( i = 0 ; i  (max_stencil + 5) ; i++ ) {
+ /* this should be back facing */
+ glVertex2f(-1, -1);
+ glVertex2f(-1,  1);
+ glVertex2f( 1,  1);
+ glVertex2f( 1, -1);
+ /* this should be front facing */
+ glVertex2f(-1, -1);
+ glVertex2f( 1, -1);
+ glVertex2f( 1,  1);
+ glVertex2f(-1,  1);
+  }
+  glEnd();
+
+  glStencilFunc(GL_EQUAL, 260 - 255, ~0);
+  glBegin(GL_QUADS);
+  glColor3f( 0.5, 0.5, 0.5 );
+  glVertex2f(-1, -1);
+  glVertex2f( 1, -1);
+  glVertex2f( 1,  1);
+  glVertex2f(-1,  1);
+  glEnd();
+   }
+
glPopMatrix();
 
glutSwapBuffers();
@@ -288,7 +329,7 @@ static void Init( void )
stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) 
glutGetProcAddress( glStencilFuncSeparateATI );
stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( 
glStencilOpSeparate );
 
-   printf(\nAll 5 squares should be the same color.\n);
+   printf(\nAll 5 (or 6) squares should be the same color.\n);
 }
 
 

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


Mesa (mesa_7_7_branch): Use bit-wise not instead of logical not.

2010-03-18 Thread Ian Romanick
Module: Mesa
Branch: mesa_7_7_branch
Commit: d3a607f8893bfb0d31fe679c530db9743f14d15f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3a607f8893bfb0d31fe679c530db9743f14d15f

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar 18 15:35:05 2010 -0700

Use bit-wise not instead of logical not.

The assertion is checking that the low-order bits of offset are not
set.  It does this by anding the inverted offset mask with the
offset.  This is clearly intended to be a bit-wise invert.

Fixes bug #25984.
(cherry picked from commit fda5078324e0a940a2ddfdd1c63ffceb47c5a717)

---

 src/mesa/drivers/dri/i915/intel_tris.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 65db947..b1195da 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -254,7 +254,7 @@ void intel_flush_prim(struct intel_context *intel)
   BEGIN_BATCH(5, LOOP_CLIPRECTS);
   OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(1) | 1);
-  assert((offset  !S0_VB_OFFSET_MASK) == 0);
+  assert((offset  ~S0_VB_OFFSET_MASK) == 0);
   OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0, offset);
   OUT_BATCH((intel-vertex_size  S1_VERTEX_WIDTH_SHIFT) |
(intel-vertex_size  S1_VERTEX_PITCH_SHIFT));

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


Mesa (master): gallivm: support PIPE_FORMAT_Z24S8_UNORM in depth/ stencil code

2010-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8df65e98998b4c104db30cbba8a38be7eb2a9acd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8df65e98998b4c104db30cbba8a38be7eb2a9acd

Author: Brian Paul bri...@vmware.com
Date:   Thu Mar 18 17:27:39 2010 -0600

gallivm: support PIPE_FORMAT_Z24S8_UNORM in depth/stencil code

---

 src/gallium/auxiliary/gallivm/lp_bld_depth.c |   21 ++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_depth.c 
b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
index 0841aa8..5b5ae7b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_depth.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_depth.c
@@ -400,7 +400,7 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
unsigned z_swizzle, s_swizzle;
LLVMValueRef zs_dst, z_dst = NULL;
LLVMValueRef stencil_vals = NULL;
-   LLVMValueRef z_bitmask = NULL, s_bitmask = NULL;
+   LLVMValueRef z_bitmask = NULL, s_bitmask = NULL, s_shift = NULL;
LLVMValueRef z_pass = NULL, s_pass_mask = NULL;
LLVMValueRef orig_mask = mask-value;
 
@@ -416,6 +416,11 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
assert(z_swizzle != UTIL_FORMAT_SWIZZLE_NONE ||
   s_swizzle != UTIL_FORMAT_SWIZZLE_NONE);
 
+   if (stencil[0].enabled) {
+  assert(format_desc-format == PIPE_FORMAT_Z24S8_UNORM ||
+ format_desc-format == PIPE_FORMAT_S8Z24_UNORM);
+   }
+
/* Sanity checking */
assert(z_swizzle  4);
assert(format_desc-block.bits == type.width);
@@ -473,9 +478,16 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
  z_bitmask = lp_build_const_int_vec(type, mask_left ^ mask_right);
   }
 
-  s_bitmask = LLVMBuildNot(builder, z_bitmask, );
+  /* If PIPE_FORMAT_Z24S8, we'll shift zs  24 to position stencil_vals */
+  if (format_desc-format == PIPE_FORMAT_Z24S8_UNORM)
+ s_shift = lp_build_const_int_vec(type, 24);
+  else
+ s_shift = lp_build_const_int_vec(type, 0);
+
+  s_bitmask = lp_build_const_int_vec(s_type, 0xff);
 
-  stencil_vals = LLVMBuildAnd(builder, zs_dst, s_bitmask, );
+  stencil_vals = LLVMBuildLShr(builder, zs_dst, s_shift, );
+  stencil_vals = LLVMBuildAnd(builder, stencil_vals, s_bitmask, );
 
   if(padding_left)
  z_src = LLVMBuildLShr(builder, z_src,
@@ -561,6 +573,9 @@ lp_build_depth_stencil_test(LLVMBuilderRef builder,
  stencil_vals, s_pass_mask, face);
}
 
+   if (stencil_vals)
+  stencil_vals = LLVMBuildShl(bld.builder, stencil_vals, s_shift, );
+
/* Finally, merge/store the z/stencil values */
if ((depth-enabled  depth-writemask) ||
(stencil[0].enabled  stencil[0].writemask)) {

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


Mesa (7.8): intel: Correct value of S0_VB_OFFSET_MASK to match hardware docs.

2010-03-18 Thread Ian Romanick
Module: Mesa
Branch: 7.8
Commit: 689e4b554123bbf9af727b910dad9d1b32521f95
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=689e4b554123bbf9af727b910dad9d1b32521f95

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar 18 17:28:52 2010 -0700

intel: Correct value of S0_VB_OFFSET_MASK to match hardware docs.

---

 src/mesa/drivers/dri/intel/intel_reg.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_reg.h 
b/src/mesa/drivers/dri/intel/intel_reg.h
index d19f1ba..36d8180 100644
--- a/src/mesa/drivers/dri/intel/intel_reg.h
+++ b/src/mesa/drivers/dri/intel/intel_reg.h
@@ -70,8 +70,10 @@
 
 /** @{
  * 915 definitions
+ *
+ * 915 documents say that bits 31:28 and 1 are undefined, must be zero.
  */
-#define S0_VB_OFFSET_MASK  0xffc0
+#define S0_VB_OFFSET_MASK  0x0ffc
 #define S0_AUTO_CACHE_INV_DISABLE  (10)
 /** @} */
 

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


Mesa (mesa_7_7_branch): intel: Correct value of S0_VB_OFFSET_MASK to match hardware docs.

2010-03-18 Thread Ian Romanick
Module: Mesa
Branch: mesa_7_7_branch
Commit: 98aed6dc697d009bb08bd63b41bd3a6b66fb7333
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98aed6dc697d009bb08bd63b41bd3a6b66fb7333

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar 18 17:28:52 2010 -0700

intel: Correct value of S0_VB_OFFSET_MASK to match hardware docs.
(cherry picked from commit 689e4b554123bbf9af727b910dad9d1b32521f95)

---

 src/mesa/drivers/dri/intel/intel_reg.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_reg.h 
b/src/mesa/drivers/dri/intel/intel_reg.h
index d19f1ba..36d8180 100644
--- a/src/mesa/drivers/dri/intel/intel_reg.h
+++ b/src/mesa/drivers/dri/intel/intel_reg.h
@@ -70,8 +70,10 @@
 
 /** @{
  * 915 definitions
+ *
+ * 915 documents say that bits 31:28 and 1 are undefined, must be zero.
  */
-#define S0_VB_OFFSET_MASK  0xffc0
+#define S0_VB_OFFSET_MASK  0x0ffc
 #define S0_AUTO_CACHE_INV_DISABLE  (10)
 /** @} */
 

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


Mesa (7.8): intel: Use bit-wise not instead of logical not (i830 path)

2010-03-18 Thread Ian Romanick
Module: Mesa
Branch: 7.8
Commit: 062a208814ad65d330f403c46d4bed88648f334f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=062a208814ad65d330f403c46d4bed88648f334f

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar 18 17:30:15 2010 -0700

intel: Use bit-wise not instead of logical not (i830 path)

The assertion is checking that the low-order bits of offset are not
set.  It does this by anding the inverted offset mask with the
offset.  This is clearly intended to be a bit-wise invert.

Fixes bug #25984.

---

 src/mesa/drivers/dri/i915/intel_tris.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 4b6d3b4..81c4ade 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -270,7 +270,7 @@ void intel_flush_prim(struct intel_context *intel)
   OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
   /* S0 */
-  assert((offset  !S0_VB_OFFSET_MASK_830) == 0);
+  assert((offset  ~S0_VB_OFFSET_MASK_830) == 0);
   OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
offset | (intel-vertex_size  S0_VB_PITCH_SHIFT_830) |
S0_VB_ENABLE_830);

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


Mesa (mesa_7_7_branch): intel: Use bit-wise not instead of logical not ( i830 path)

2010-03-18 Thread Ian Romanick
Module: Mesa
Branch: mesa_7_7_branch
Commit: 3a3ef3d6c9a9f0fbea0674bd2c275be2be2f6519
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a3ef3d6c9a9f0fbea0674bd2c275be2be2f6519

Author: Ian Romanick ian.d.roman...@intel.com
Date:   Thu Mar 18 17:30:15 2010 -0700

intel: Use bit-wise not instead of logical not (i830 path)

The assertion is checking that the low-order bits of offset are not
set.  It does this by anding the inverted offset mask with the
offset.  This is clearly intended to be a bit-wise invert.

Fixes bug #25984.
(cherry picked from commit 062a208814ad65d330f403c46d4bed88648f334f)

---

 src/mesa/drivers/dri/i915/intel_tris.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index b1195da..5aefe45 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -273,7 +273,7 @@ void intel_flush_prim(struct intel_context *intel)
   OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(0) | I1_LOAD_S(2) | 1);
   /* S0 */
-  assert((offset  !S0_VB_OFFSET_MASK_830) == 0);
+  assert((offset  ~S0_VB_OFFSET_MASK_830) == 0);
   OUT_RELOC(vb_bo, I915_GEM_DOMAIN_VERTEX, 0,
offset | (intel-vertex_size  S0_VB_PITCH_SHIFT_830) |
S0_VB_ENABLE_830);

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


Mesa (master): r300g: add generating texture coordinates for point sprites (WIP)

2010-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: cba6430524198a1bdcdeada03cbe946a454f3935
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cba6430524198a1bdcdeada03cbe946a454f3935

Author: Marek Olšák mar...@gmail.com
Date:   Thu Dec 24 21:29:41 2009 +0100

r300g: add generating texture coordinates for point sprites (WIP)

---

 src/gallium/drivers/r300/r300_context.c |2 +
 src/gallium/drivers/r300/r300_context.h |   13 
 src/gallium/drivers/r300/r300_emit.c|6 
 src/gallium/drivers/r300/r300_state.c   |   35 ++-
 src/gallium/drivers/r300/r300_state_derived.c   |5 ++-
 src/gallium/drivers/r300/r300_state_invariant.c |   13 +---
 6 files changed, 61 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c 
b/src/gallium/drivers/r300/r300_context.c
index d994a46..210e31e 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -202,6 +202,8 @@ struct pipe_context* r300_create_context(struct 
pipe_screen* screen,
 
 r300_setup_atoms(r300);
 
+r300-sprite_coord_index = -1;
+
 /* Open up the OQ BO. */
 r300-oqbo = screen-buffer_create(screen, 4096,
 PIPE_BUFFER_USAGE_VERTEX, 4096);
diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index 0c8fb68..edebeab 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -98,6 +98,16 @@ struct r300_rs_state {
 uint32_t line_stipple_value;/* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
 uint32_t color_control; /* R300_GA_COLOR_CONTROL: 0x4278 */
 uint32_t polygon_mode;  /* R300_GA_POLY_MODE: 0x4288 */
+
+/* Specifies top of Raster pipe specific enable controls,
+ * i.e. texture coordinates stuffing for points, lines, triangles */
+uint32_t stuffing_enable;   /* R300_GB_ENABLE: 0x4008 */
+
+/* Point sprites texture coordinates, 0: lower left, 1: upper right */
+float point_texcoord_left;  /* R300_GA_POINT_S0: 0x4200 */
+float point_texcoord_bottom;/* R300_GA_POINT_T0: 0x4204 */
+float point_texcoord_right; /* R300_GA_POINT_S1: 0x4208 */
+float point_texcoord_top;   /* R300_GA_POINT_T1: 0x420c */
 };
 
 struct r300_rs_block {
@@ -390,6 +400,9 @@ struct r300_context {
 uint32_t zbuffer_bpp;
 /* Whether scissor is enabled. */
 boolean scissor_enabled;
+/* Point sprites texcoord index, -1 = unused. */
+int sprite_coord_index;
+
 /* upload managers */
 struct u_upload_mgr *upload_vb;
 struct u_upload_mgr *upload_ib;
diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index 3ad0e56..5522fb3 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -616,6 +616,12 @@ void r300_emit_rs_state(struct r300_context* r300, 
unsigned size, void* state)
 OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, rs-line_stipple_config);
 OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, rs-line_stipple_value);
 OUT_CS_REG(R300_GA_POLY_MODE, rs-polygon_mode);
+OUT_CS_REG(R300_GB_ENABLE, rs-stuffing_enable);
+OUT_CS_REG_SEQ(R300_GA_POINT_S0, 4);
+OUT_CS_32F(rs-point_texcoord_left);
+OUT_CS_32F(rs-point_texcoord_bottom);
+OUT_CS_32F(rs-point_texcoord_right);
+OUT_CS_32F(rs-point_texcoord_top);
 END_CS;
 }
 
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index d7d654d..db7844e 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -715,6 +715,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 {
 struct r300_screen* r300screen = r300_screen(pipe-screen);
 struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
+unsigned coord_index;
 
 /* Copy rasterizer state for Draw. */
 rs-rs = *state;
@@ -807,6 +808,32 @@ static void* r300_create_rs_state(struct pipe_context* 
pipe,
 rs-color_control = R300_SHADE_MODEL_SMOOTH;
 }
 
+/* Point sprites */
+if (state-sprite_coord_enable) {
+coord_index = ffs(state-sprite_coord_enable)-1;
+
+SCREEN_DBG(r300screen, DBG_DRAW,
+   r300: point sprite: shader coord=%d\n, coord_index);
+
+rs-stuffing_enable =
+R300_GB_POINT_STUFF_ENABLE |
+R300_GB_TEX_ST  (R300_GB_TEX0_SOURCE_SHIFT + (coord_index*2));
+
+rs-point_texcoord_left = 0.0f;
+rs-point_texcoord_right = 1.0f;
+
+switch (state-sprite_coord_mode) {
+case PIPE_SPRITE_COORD_UPPER_LEFT:
+rs-point_texcoord_top = 0.0f;
+rs-point_texcoord_bottom = 1.0f;
+break;
+case PIPE_SPRITE_COORD_LOWER_LEFT:
+rs-point_texcoord_top = 1.0f;
+rs-point_texcoord_bottom = 0.0f;
+break;
+}
+}
+
 return (void*)rs;
 }
 

Mesa (master): r300g: add PIPE_FORMAT_B5G5R5X1_UNORM colorbuffer support, cleanups

2010-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f6e987ce7839d66edb88403d2c9ac1b28db2832b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6e987ce7839d66edb88403d2c9ac1b28db2832b

Author: Marek Olšák mar...@gmail.com
Date:   Thu Mar 18 21:18:36 2010 +0100

r300g: add PIPE_FORMAT_B5G5R5X1_UNORM colorbuffer support, cleanups

---

 src/gallium/drivers/r300/r300_texture.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture.c 
b/src/gallium/drivers/r300/r300_texture.c
index 09067aa..cb53619 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -310,6 +310,7 @@ static uint32_t r300_translate_colorformat(enum pipe_format 
format)
 case PIPE_FORMAT_B5G6R5_UNORM:
 return R300_COLOR_FORMAT_RGB565;
 case PIPE_FORMAT_B5G5R5A1_UNORM:
+case PIPE_FORMAT_B5G5R5X1_UNORM:
 return R300_COLOR_FORMAT_ARGB1555;
 case PIPE_FORMAT_B4G4R4A4_UNORM:
 return R300_COLOR_FORMAT_ARGB;
@@ -420,9 +421,10 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 case PIPE_FORMAT_R8_SNORM:
 return modifier | R300_C2_SEL_R;
 
-/* ARGB 32-bit outputs. */
+/* BGRA outputs. */
 case PIPE_FORMAT_B5G6R5_UNORM:
 case PIPE_FORMAT_B5G5R5A1_UNORM:
+case PIPE_FORMAT_B5G5R5X1_UNORM:
 case PIPE_FORMAT_B4G4R4A4_UNORM:
 case PIPE_FORMAT_B8G8R8A8_UNORM:
 case PIPE_FORMAT_B8G8R8X8_UNORM:
@@ -430,25 +432,24 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 R300_C0_SEL_B | R300_C1_SEL_G |
 R300_C2_SEL_R | R300_C3_SEL_A;
 
-/* BGRA 32-bit outputs. */
+/* ARGB outputs. */
 case PIPE_FORMAT_A8R8G8B8_UNORM:
 case PIPE_FORMAT_X8R8G8B8_UNORM:
 return modifier |
 R300_C0_SEL_A | R300_C1_SEL_R |
 R300_C2_SEL_G | R300_C3_SEL_B;
 
-/* RGBA 32-bit outputs. */
+/* ABGR outputs. */
 case PIPE_FORMAT_A8B8G8R8_UNORM:
-case PIPE_FORMAT_R8G8B8A8_SNORM:
 case PIPE_FORMAT_X8B8G8R8_UNORM:
 return modifier |
 R300_C0_SEL_A | R300_C1_SEL_B |
 R300_C2_SEL_G | R300_C3_SEL_R;
 
-/* ABGR 32-bit outputs. */
+/* RGBA outputs. */
+case PIPE_FORMAT_R8G8B8A8_SNORM:
 case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
 case PIPE_FORMAT_R10G10B10A2_UNORM:
-/* RGBA high precision outputs (same swizzles as ABGR low precision) */
 case PIPE_FORMAT_R16G16B16A16_UNORM:
 case PIPE_FORMAT_R16G16B16A16_SNORM:
 //case PIPE_FORMAT_R16G16B16A16_FLOAT: /* not in pipe_format */

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


Mesa (master): r300g: mark SRGB colorbuffers as unsupported

2010-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0c81739528fd8f240176bb120c90c712f9606718
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c81739528fd8f240176bb120c90c712f9606718

Author: Marek Olšák mar...@gmail.com
Date:   Thu Mar 18 20:58:04 2010 +0100

r300g: mark SRGB colorbuffers as unsupported

I can't find the register bits for SRGB-aware blending and it's not even
exposed by fglrx so it's most probably not supported by hw.

---

 src/gallium/drivers/r300/r300_texture.c |   21 +
 1 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture.c 
b/src/gallium/drivers/r300/r300_texture.c
index 7c76560..09067aa 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -302,7 +302,6 @@ static uint32_t r300_translate_colorformat(enum pipe_format 
format)
 case PIPE_FORMAT_A8_UNORM:
 case PIPE_FORMAT_I8_UNORM:
 case PIPE_FORMAT_L8_UNORM:
-case PIPE_FORMAT_L8_SRGB:
 case PIPE_FORMAT_R8_UNORM:
 case PIPE_FORMAT_R8_SNORM:
 return R300_COLOR_FORMAT_I8;
@@ -317,18 +316,12 @@ static uint32_t r300_translate_colorformat(enum 
pipe_format format)
 
 /* 32-bit buffers. */
 case PIPE_FORMAT_B8G8R8A8_UNORM:
-case PIPE_FORMAT_B8G8R8A8_SRGB:
 case PIPE_FORMAT_B8G8R8X8_UNORM:
-case PIPE_FORMAT_B8G8R8X8_SRGB:
 case PIPE_FORMAT_A8R8G8B8_UNORM:
-case PIPE_FORMAT_A8R8G8B8_SRGB:
 case PIPE_FORMAT_X8R8G8B8_UNORM:
-case PIPE_FORMAT_X8R8G8B8_SRGB:
 case PIPE_FORMAT_A8B8G8R8_UNORM:
 case PIPE_FORMAT_R8G8B8A8_SNORM:
-case PIPE_FORMAT_A8B8G8R8_SRGB:
 case PIPE_FORMAT_X8B8G8R8_UNORM:
-case PIPE_FORMAT_X8B8G8R8_SRGB:
 case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
 return R300_COLOR_FORMAT_ARGB;
 case PIPE_FORMAT_R10G10B10A2_UNORM:
@@ -393,12 +386,7 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 desc = util_format_description(format);
 
 /* Specifies how the shader output is written to the fog unit. */
-if (desc-colorspace == UTIL_FORMAT_COLORSPACE_SRGB) {
-/* The gamma correction causes precision loss so we need
- * higher precision to maintain reasonable quality.
- * It has nothing to do with the colorbuffer format. */
-modifier |= R300_US_OUT_FMT_C4_10_GAMMA;
-} else if (desc-channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
+if (desc-channel[0].type == UTIL_FORMAT_TYPE_FLOAT) {
 if (desc-channel[0].size == 32) {
 modifier |= R300_US_OUT_FMT_C4_32_FP;
 } else {
@@ -428,7 +416,6 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 return modifier | R300_C2_SEL_A;
 case PIPE_FORMAT_I8_UNORM:
 case PIPE_FORMAT_L8_UNORM:
-case PIPE_FORMAT_L8_SRGB:
 case PIPE_FORMAT_R8_UNORM:
 case PIPE_FORMAT_R8_SNORM:
 return modifier | R300_C2_SEL_R;
@@ -438,18 +425,14 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 case PIPE_FORMAT_B5G5R5A1_UNORM:
 case PIPE_FORMAT_B4G4R4A4_UNORM:
 case PIPE_FORMAT_B8G8R8A8_UNORM:
-case PIPE_FORMAT_B8G8R8A8_SRGB:
 case PIPE_FORMAT_B8G8R8X8_UNORM:
-case PIPE_FORMAT_B8G8R8X8_SRGB:
 return modifier |
 R300_C0_SEL_B | R300_C1_SEL_G |
 R300_C2_SEL_R | R300_C3_SEL_A;
 
 /* BGRA 32-bit outputs. */
 case PIPE_FORMAT_A8R8G8B8_UNORM:
-case PIPE_FORMAT_A8R8G8B8_SRGB:
 case PIPE_FORMAT_X8R8G8B8_UNORM:
-case PIPE_FORMAT_X8R8G8B8_SRGB:
 return modifier |
 R300_C0_SEL_A | R300_C1_SEL_R |
 R300_C2_SEL_G | R300_C3_SEL_B;
@@ -457,9 +440,7 @@ static uint32_t r300_translate_out_fmt(enum pipe_format 
format)
 /* RGBA 32-bit outputs. */
 case PIPE_FORMAT_A8B8G8R8_UNORM:
 case PIPE_FORMAT_R8G8B8A8_SNORM:
-case PIPE_FORMAT_A8B8G8R8_SRGB:
 case PIPE_FORMAT_X8B8G8R8_UNORM:
-case PIPE_FORMAT_X8B8G8R8_SRGB:
 return modifier |
 R300_C0_SEL_A | R300_C1_SEL_B |
 R300_C2_SEL_G | R300_C3_SEL_R;

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


Mesa (master): r300g: fix breakage after the gallium-sampler-view merge

2010-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: afae0891949b72a2ede2a3b6a01d4d6bcf4ceae0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=afae0891949b72a2ede2a3b6a01d4d6bcf4ceae0

Author: Marek Olšák mar...@gmail.com
Date:   Fri Mar 19 01:13:57 2010 +0100

r300g: fix breakage after the gallium-sampler-view merge

---

 src/gallium/drivers/r300/r300_emit.c  |6 --
 src/gallium/drivers/r300/r300_state.c |   12 
 src/gallium/drivers/r300/r300_state_derived.c |   13 ++---
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index 5522fb3..c897df6 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -1050,9 +1050,11 @@ validate:
 }
 /* ...textures... */
 for (i = 0; i  texstate-count; i++) {
-tex = (struct 
r300_texture*)texstate-fragment_sampler_views[i]-texture;
-if (!tex || !texstate-sampler_states[i])
+if (!(texstate-tx_enable  (1  i))) {
 continue;
+}
+
+tex = (struct 
r300_texture*)texstate-fragment_sampler_views[i]-texture;
 if (!r300_add_texture(r300-rws, tex,
  RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 
0)) {
 r300-context.flush(r300-context, 0, NULL);
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index db7844e..bdfe74e 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -973,6 +973,7 @@ static void r300_set_fragment_sampler_views(struct 
pipe_context* pipe,
 struct r300_context* r300 = r300_context(pipe);
 struct r300_textures_state* state =
 (struct r300_textures_state*)r300-textures_state.state;
+struct r300_texture *texture;
 unsigned i;
 boolean is_r500 = r300_screen(r300-context.screen)-caps-is_r500;
 boolean dirty_tex = FALSE;
@@ -984,15 +985,18 @@ static void r300_set_fragment_sampler_views(struct 
pipe_context* pipe,
 
 for (i = 0; i  count; i++) {
 if (state-fragment_sampler_views[i] != views[i]) {
-struct r300_texture *texture;
- 
 pipe_sampler_view_reference(state-fragment_sampler_views[i],
 views[i]);
-dirty_tex = TRUE;
 
-texture = (struct r300_texture *)views[i]-texture;
+if (!views[i]) {
+continue;
+}
+
+/* A new sampler view (= texture)... */
+dirty_tex = TRUE;
 
 /* R300-specific - set the texrect factor in the fragment shader */
+texture = (struct r300_texture *)views[i]-texture;
 if (!is_r500  texture-is_npot) {
 /* XXX It would be nice to re-emit just 1 constant,
  * XXX not all of them */
diff --git a/src/gallium/drivers/r300/r300_state_derived.c 
b/src/gallium/drivers/r300/r300_state_derived.c
index 74663bd..8594735 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -335,20 +335,25 @@ static void r300_merge_textures_and_samplers(struct 
r300_context* r300)
 (struct r300_textures_state*)r300-textures_state.state;
 struct r300_texture_sampler_state *texstate;
 struct r300_sampler_state *sampler;
+struct pipe_sampler_view *view;
 struct r300_texture *tex;
 unsigned min_level, max_level, i, size;
 unsigned count = MIN2(state-texture_count, state-sampler_count);
 
 state-tx_enable = 0;
+state-count = 0;
 size = 2;
 
 for (i = 0; i  count; i++) {
 if (state-fragment_sampler_views[i]  state-sampler_states[i]) {
 state-tx_enable |= 1  i;
 
-tex = (struct r300_texture 
*)state-fragment_sampler_views[i]-texture;
+view = state-fragment_sampler_views[i];
+tex = (struct r300_texture *)view-texture;
 sampler = state-sampler_states[i];
 
+assert(view-format == tex-tex.format);
+
 texstate = state-regs[i];
 memcpy(texstate-format, tex-state, sizeof(uint32_t)*3);
 texstate-filter[0] = sampler-filter0;
@@ -370,8 +375,10 @@ static void r300_merge_textures_and_samplers(struct 
r300_context* r300)
 } else {
 /* determine min/max levels */
 /* the MAX_MIP level is the largest (finest) one */
-max_level = MIN2(sampler-max_lod, tex-tex.last_level);
-min_level = MIN2(sampler-min_lod, max_level);
+max_level = MIN3(sampler-max_lod, tex-tex.last_level,
+ view-last_level);
+min_level = MIN2(MAX2(sampler-min_lod, view-first_level),
+ max_level);
 texstate-format[0] |= R300_TX_NUM_LEVELS(max_level);
 texstate-filter[0] |= 

Mesa (master): r300g: lod min/ max clamping should be relative to the base level

2010-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 12a40dda394bd14e31c679551bc5abc8b601fdbf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12a40dda394bd14e31c679551bc5abc8b601fdbf

Author: Marek Olšák mar...@gmail.com
Date:   Fri Mar 19 04:46:15 2010 +0100

r300g: lod min/max clamping should be relative to the base level

---

 src/gallium/drivers/r300/r300_state_derived.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_state_derived.c 
b/src/gallium/drivers/r300/r300_state_derived.c
index 8594735..8178d55 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -375,9 +375,9 @@ static void r300_merge_textures_and_samplers(struct 
r300_context* r300)
 } else {
 /* determine min/max levels */
 /* the MAX_MIP level is the largest (finest) one */
-max_level = MIN3(sampler-max_lod, tex-tex.last_level,
- view-last_level);
-min_level = MIN2(MAX2(sampler-min_lod, view-first_level),
+max_level = MIN3(sampler-max_lod + view-first_level,
+ tex-tex.last_level, view-last_level);
+min_level = MIN2(sampler-min_lod + view-first_level,
  max_level);
 texstate-format[0] |= R300_TX_NUM_LEVELS(max_level);
 texstate-filter[0] |= R300_TX_MAX_MIP_LEVEL(min_level);

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