Mesa (master): ralloc: Move declarations before statements.

2013-04-17 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 392f6cfced304e8693fc93279560ab5dcc033d02
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=392f6cfced304e8693fc93279560ab5dcc033d02

Author: José Fonseca 
Date:   Thu Apr 18 06:21:04 2013 +0100

ralloc: Move declarations before statements.

Trivial.  Should fix MSVC build.

---

 src/glsl/ralloc.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c
index 0281642..e79dad7 100644
--- a/src/glsl/ralloc.c
+++ b/src/glsl/ralloc.c
@@ -107,11 +107,13 @@ void *
 ralloc_size(const void *ctx, size_t size)
 {
void *block = calloc(1, size + sizeof(ralloc_header));
+   ralloc_header *info;
+   ralloc_header *parent;
 
if (unlikely(block == NULL))
   return NULL;
-   ralloc_header *info = (ralloc_header *) block;
-   ralloc_header *parent = ctx != NULL ? get_header(ctx) : NULL;
+   info = (ralloc_header *) block;
+   parent = ctx != NULL ? get_header(ctx) : NULL;
 
add_child(parent, info);
 

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


Mesa (master): configure: enable vdpau and xvmc detection, with gallium

2013-04-17 Thread Matt Turner
Module: Mesa
Branch: master
Commit: c7b88ed16e6aa320fcf482d124a65b56d032956e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7b88ed16e6aa320fcf482d124a65b56d032956e

Author: Emil Velikov 
Date:   Thu Apr 18 01:40:40 2013 +0100

configure: enable vdpau and xvmc detection, with gallium

Currently the vdpau and xvmc detection code, is enabled for all builds. The
state trackers exist only within gallium. Enable whenever at least one gallium
driver is selected

v2: removed stray '-a'
[mattst88 v3]: Removed stray $.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63645
Reviewed-by: Matt Turner 
Signed-off-by: Emil Velikov 

---

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

diff --git a/configure.ac b/configure.ac
index ba92258..70c598e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1319,9 +1319,15 @@ dnl Gallium G3DVL configuration
 dnl
 AC_ARG_ENABLE([gallium-g3dvl],
 [AS_HELP_STRING([--disable-gallium-g3dvl],
-[build gallium g3dvl @<:@default=enabled@:>@])],
+[build gallium g3dvl @<:@default=auto@:>@])],
 [enable_gallium_g3dvl="$enableval"],
-[enable_gallium_g3dvl=yes])
+[enable_gallium_g3dvl=auto])
+if test "x$enable_gallium_g3dvl" = xauto; then
+if test "x$with_gallium_drivers" != x; then
+enable_gallium_g3dvl=yes
+fi
+fi
+
 if test "x$enable_gallium_g3dvl" = xyes; then
 if test "x$with_gallium_drivers" = x; then
 AC_MSG_ERROR([cannot enable G3DVL without Gallium])

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


Mesa (master): i965: Check reg.nr for BRW_ARF_NULL instead of reg.file.

2013-04-17 Thread Matt Turner
Module: Mesa
Branch: master
Commit: ecdda414d361ab4430fd5747c9217687c1f3d63f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecdda414d361ab4430fd5747c9217687c1f3d63f

Author: Matt Turner 
Date:   Mon Apr 15 15:00:08 2013 -0700

i965: Check reg.nr for BRW_ARF_NULL instead of reg.file.

Reviewed-by: Kenneth Graunke 

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 704f219..a98892b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -182,7 +182,7 @@ validate_reg(struct brw_instruction *insn, struct brw_reg 
reg)
}
 
if (reg.file == BRW_ARCHITECTURE_REGISTER_FILE &&
-   reg.file == BRW_ARF_NULL)
+   reg.nr == BRW_ARF_NULL)
   return;
 
assert(reg.hstride >= 0 && reg.hstride < Elements(hstride_for_reg));

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


Mesa (master): i965: Implement work-around for CMP with null dest on Haswell.

2013-04-17 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 60e4c994884ac10954f341db13a4c9c410c4dd0e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=60e4c994884ac10954f341db13a4c9c410c4dd0e

Author: Matt Turner 
Date:   Mon Apr 15 14:59:09 2013 -0700

i965: Implement work-around for CMP with null dest on Haswell.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_eu_emit.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 2578bf8..704f219 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1653,6 +1653,7 @@ void brw_CMP(struct brw_compile *p,
 struct brw_reg src0,
 struct brw_reg src1)
 {
+   struct intel_context *intel = &p->brw->intel;
struct brw_instruction *insn = next_insn(p, BRW_OPCODE_CMP);
 
insn->header.destreg__conditionalmod = conditional;
@@ -1672,6 +1673,17 @@ void brw_CMP(struct brw_compile *p,
   p->current->header.predicate_control = BRW_PREDICATE_NORMAL;
   p->flag_value = 0xff;
}
+
+   /* Item WaCMPInstNullDstForcesThreadSwitch in the Haswell Bspec workarounds
+* page says:
+*"Any CMP instruction with a null destination must use a {switch}."
+*/
+   if (intel->is_haswell) {
+  if (dest.file == BRW_ARCHITECTURE_REGISTER_FILE &&
+  dest.nr == BRW_ARF_NULL) {
+ insn->header.thread_control = BRW_THREAD_SWITCH;
+  }
+   }
 }
 
 /* Issue 'wait' instruction for n1, host could program MMIO

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


Mesa (master): i915g: Release old fragment shader sampler views with current pipe

2013-04-17 Thread Stephane Marchesin
Module: Mesa
Branch: master
Commit: 1a59cc777fb6c0383ed0c745000ca7409b1027d9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a59cc777fb6c0383ed0c745000ca7409b1027d9

Author: Stuart Abercrombie 
Date:   Thu Apr 11 10:57:43 2013 -0700

i915g: Release old fragment shader sampler views with current pipe

We were trying to use a destroy method from a deleted context.
This fix is based on what's in the svga driver.

Reviewed-by: Stéphane Marchesin 

---

 src/gallium/drivers/i915/i915_state.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state.c 
b/src/gallium/drivers/i915/i915_state.c
index 37ad1ed..4a4faa5 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -711,13 +711,18 @@ static void i915_set_fragment_sampler_views(struct 
pipe_context *pipe,
!memcmp(i915->fragment_sampler_views, views, num * sizeof(struct 
pipe_sampler_view *)))
   return;
 
-   for (i = 0; i < num; i++)
+   for (i = 0; i < num; i++) {
+  /* Note: we're using pipe_sampler_view_release() here to work around
+   * a possible crash when the old view belongs to another context that
+   * was already destroyed.
+   */
+  pipe_sampler_view_release(pipe, &i915->fragment_sampler_views[i]);
   pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
   views[i]);
+   }
 
for (i = num; i < i915->num_fragment_sampler_views; i++)
-  pipe_sampler_view_reference(&i915->fragment_sampler_views[i],
-  NULL);
+  pipe_sampler_view_release(pipe, &i915->fragment_sampler_views[i]);
 
i915->num_fragment_sampler_views = num;
 

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


Mesa (master): i965/vec4: Fix hypothetical use of uninitialized data in attribute_map[].

2013-04-17 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 417d8917d4924652f1cd0c64dbf3677d4eddbf8c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=417d8917d4924652f1cd0c64dbf3677d4eddbf8c

Author: Paul Berry 
Date:   Tue Apr 16 12:49:51 2013 -0700

i965/vec4: Fix hypothetical use of uninitialized data in attribute_map[].

Fixes issue identified by Klocwork analysis:

'attribute_map' array elements might be used uninitialized in this
function (vec4_visitor::lower_attributes_to_hw_regs).

The attribute_map array contains the mapping from shader input
attributes to the hardware registers they are stored in.
vec4_vs_visitor::setup_attributes() only populates elements of this
array which, according to core Mesa, are actually used by the shader.
Therefore, when vec4_visitor::lower_attributes_to_hw_regs() accesses
the array to lower a register access in the shader, it should in
principle only access elements of attribute_map that contain valid
data.  However, if a bug ever caused the driver back-end to access an
input that was not flagged as used by core Mesa, then
lower_attributes_to_hw_regs() would access uninitialized memory, which
could cause illegal instructions to get generated, resulting in a
possible GPU hang.

This patch makes the situation more robust by using memset() to
pre-initialize the attribute_map array to zero, so that if such a bug
ever occurred, lower_attributes_to_hw_regs() would generate a (mostly)
harmless access to r0.  In addition, it adds assertions to
lower_attributes_to_hw_regs() so that if we do have such a bug, we're
likely to discover it quickly.

Reviewed-by: Jordan Justen 

---

 src/mesa/drivers/dri/i965/brw_vec4.cpp |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index b0527c7..0afff6f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1197,6 +1197,11 @@ vec4_visitor::lower_attributes_to_hw_regs(const int 
*attribute_map)
   if (inst->dst.file == ATTR) {
 int grf = attribute_map[inst->dst.reg + inst->dst.reg_offset];
 
+ /* All attributes used in the shader need to have been assigned a
+  * hardware register by the caller
+  */
+ assert(grf != 0);
+
 struct brw_reg reg = brw_vec8_grf(grf, 0);
 reg.type = inst->dst.type;
 reg.dw1.bits.writemask = inst->dst.writemask;
@@ -1211,6 +1216,11 @@ vec4_visitor::lower_attributes_to_hw_regs(const int 
*attribute_map)
 
 int grf = attribute_map[inst->src[i].reg + inst->src[i].reg_offset];
 
+ /* All attributes used in the shader need to have been assigned a
+  * hardware register by the caller
+  */
+ assert(grf != 0);
+
 struct brw_reg reg = brw_vec8_grf(grf, 0);
 reg.dw1.bits.swizzle = inst->src[i].swizzle;
  reg.type = inst->src[i].type;
@@ -1230,6 +1240,7 @@ vec4_vs_visitor::setup_attributes(int payload_reg)
 {
int nr_attributes;
int attribute_map[VERT_ATTRIB_MAX + 1];
+   memset(attribute_map, 0, sizeof(attribute_map));
 
nr_attributes = 0;
for (int i = 0; i < VERT_ATTRIB_MAX; i++) {

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


Mesa (master): ralloc: don't write to memory in case of alloc fail.

2013-04-17 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 47bd6e46fe89e1cce61b11bcaa7b81f807011c23
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47bd6e46fe89e1cce61b11bcaa7b81f807011c23

Author: Dave Airlie 
Date:   Wed Apr 17 11:07:49 2013 +1000

ralloc: don't write to memory in case of alloc fail.

For some reason I made this happen under indirect rendering,
I think we might have a leak, valgrind gave out, so I said I'd
fix the basic problem.

NOTE: This is a candidate for stable branches.
Reviewed-by: Ian Romanick 
Reviewed-by: Kenneth Graunke 
Signed-off-by: Dave Airlie 

---

 src/glsl/ralloc.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c
index 59e71c4..0281642 100644
--- a/src/glsl/ralloc.c
+++ b/src/glsl/ralloc.c
@@ -108,6 +108,8 @@ ralloc_size(const void *ctx, size_t size)
 {
void *block = calloc(1, size + sizeof(ralloc_header));
 
+   if (unlikely(block == NULL))
+  return NULL;
ralloc_header *info = (ralloc_header *) block;
ralloc_header *parent = ctx != NULL ? get_header(ctx) : NULL;
 

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


Mesa (master): mesa: generate glGetInteger/Boolean/Float/Doublev() code for all APIs

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 815ca0bf38de89cff533a413066a7e23a0aa5fb0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=815ca0bf38de89cff533a413066a7e23a0aa5fb0

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

mesa: generate glGetInteger/Boolean/Float/Doublev() code for all APIs

No longer pass -a flag to the get_hash_generate.py script to specify
OpenGL, ES1, ES2, etc.  This updates the autoconf, scons and android
build files too (so we can bisect).

This is the last of the API-dependent conditional compilation in
core Mesa.

Reviewed-by: Jordan Justen 

---

 src/mesa/Android.gen.mk |3 +--
 src/mesa/Makefile.am|6 ++
 src/mesa/SConscript |7 +--
 src/mesa/main/get_hash_generator.py |   26 +++---
 4 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index 35f00da..c6280f5 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -111,8 +111,7 @@ $(intermediates)/main/api_exec.c: $(dispatch_deps)
$(call es-gen)
 
 GET_HASH_GEN := $(LOCAL_PATH)/main/get_hash_generator.py
-GET_HASH_GEN_FLAGS := $(patsubst %,-a %,$(MESA_ENABLED_APIS))
 
 $(intermediates)/main/get_hash.h: $(glapi)/gl_and_es_API.xml \
$(LOCAL_PATH)/main/get_hash_params.py $(GET_HASH_GEN)
-   @$(MESA_PYTHON2) $(GET_HASH_GEN) $(GET_HASH_GEN_FLAGS) -f $< > $@
+   @$(MESA_PYTHON2) $(GET_HASH_GEN) -f $< > $@
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 5850412..2d077f8 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -71,14 +71,12 @@ CLEANFILES = \
git_sha1.h.tmp
 
 GET_HASH_GEN = main/get_hash_generator.py
-GET_HASH_GEN_FLAGS := $(patsubst -DFEATURE_%=1,-a %, \
-   $(patsubst -DFEATURE_%=0,,$(API_DEFINES)))
 
 main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py\
 $(GET_HASH_GEN) Makefile
$(AM_V_GEN)set -e;  \
-   $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN)\
-   $(GET_HASH_GEN_FLAGS) -f $< > $@.tmp;   \
+   $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/$(GET_HASH_GEN)\
+   -f $< > $@.tmp; \
mv $@.tmp $@;
 
 noinst_LTLIBRARIES =
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index a61b475..3cd0f87 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -341,16 +341,11 @@ if env['gles']:
 
 enabled_apis += ['ES1', 'ES2']
 
-env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
-
-get_hash_gen_opts = ' '.join(["-a %s" % api for api in enabled_apis])
-
 get_hash_header = env.CodeGenerate(
   target = 'main/get_hash.h',
   script = 'main/get_hash_generator.py',
   source = GLAPI + 'gen/gl_and_es_API.xml',
-  command = python_cmd + ' $SCRIPT ' + get_hash_gen_opts +
-' -f $SOURCE > $TARGET'
+  command = python_cmd + ' $SCRIPT ' + ' -f $SOURCE > $TARGET'
 )
 
 #
diff --git a/src/mesa/main/get_hash_generator.py 
b/src/mesa/main/get_hash_generator.py
index 04bf9ff..96bc495 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -179,54 +179,34 @@ def generate_hash_tables(enum_list, enabled_apis, 
param_descriptors):
 
return params, merge_tables(sorted_tables)
 
-def opt_to_apis(feature):
-   _map = {"ES1": "GLES", "ES2": "GLES2", "GL": "GL"}
-   if feature not in _map:
-  return None
-
-   apis = set([_map[feature]])
-   if "GL" in apis:
-  apis.add("GL_CORE")
-   if "GLES2" in apis:
-  apis.add("GLES3")
-
-   return apis
 
 def show_usage():
sys.stderr.write(
 """Usage: %s [OPTIONS]
   -f   specify GL API XML file
-  -a [GL|ES1|ES2]specify APIs to generate hash tables for
 """ % (program))
exit(1)
 
 if __name__ == '__main__':
try:
-  (opts, args) = getopt.getopt(sys.argv[1:], "f:a:")
+  (opts, args) = getopt.getopt(sys.argv[1:], "f:")
except Exception,e:
   show_usage()
 
if len(args) != 0:
   show_usage()
 
-   enabled_apis = set([])
api_desc_file = ""
 
for opt_name, opt_val in opts:
   if opt_name == "-f":
  api_desc_file = opt_val
-  if opt_name == "-a":
- apis = opt_to_apis(opt_val.upper())
- if not apis:
-die("invalid API %s\n" % opt_val)
-
- enabled_apis |= apis
 
if not api_desc_file:
   die("missing descriptor file (-f)\n")
 
-   if len(enabled_apis) == 0:
-  die("need at least a single enabled API\n")
+   # generate the code for all APIs
+   enabled_apis = set(["GLES", "GLES2", "GLES3", "GL", "GL_CORE"])
 
try:
   api_desc = gl_XML.parse_GL_API(api_desc_file)

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


Mesa (master): mesa: remove mfeatures.h

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9835d9059683e285dc925801c4c98ea9bfc2ffb8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9835d9059683e285dc925801c4c98ea9bfc2ffb8

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

mesa: remove mfeatures.h

No longer needed.

Reviewed-by: Jordan Justen 

---

 src/mesa/main/mfeatures.h |   53 -
 1 files changed, 0 insertions(+), 53 deletions(-)

diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
deleted file mode 100644
index 55e9cf9..000
--- a/src/mesa/main/mfeatures.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Mesa 3-D graphics library
- * Version:  7.1
- *
- * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice 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
- * BRIAN PAUL 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 mfeatures.h
- * Flags to enable/disable specific parts of the API.
- */
-
-#ifndef FEATURES_H
-#define FEATURES_H
-
-#ifndef FEATURE_ES1
-#define FEATURE_ES1 0
-#endif
-#ifndef FEATURE_ES2
-#define FEATURE_ES2 0
-#endif
-
-#define FEATURE_ES (FEATURE_ES1 || FEATURE_ES2)
-
-#ifndef FEATURE_GL
-#define FEATURE_GL !FEATURE_ES
-#endif
-
-#if defined(IN_DRI_DRIVER) || (FEATURE_GL + FEATURE_ES1 + FEATURE_ES2 > 1)
-#define FEATURE_remap_table   1
-#else
-#define FEATURE_remap_table   0
-#endif
-
-#endif /* FEATURES_H */

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


Mesa (master): mesa: remove #include "mfeatures.h" from numerous source files

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b76f6d9557ff27140e18cf8aa2b57db8876d5d4d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b76f6d9557ff27140e18cf8aa2b57db8876d5d4d

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

mesa: remove #include "mfeatures.h" from numerous source files

None of the remaining FEATURE_x symbols in mfeatures.h are used anymore.

Reviewed-by: Jordan Justen 

---

 src/mesa/drivers/dri/intel/intel_buffer_objects.c |1 -
 src/mesa/drivers/dri/intel/intel_extensions.c |1 -
 src/mesa/drivers/dri/intel/intel_fbo.c|1 -
 src/mesa/drivers/dri/intel/intel_screen.c |1 -
 src/mesa/drivers/dri/intel/intel_tex_image.c  |1 -
 src/mesa/drivers/dri/nouveau/nouveau_driver.c |1 -
 src/mesa/drivers/dri/nouveau/nouveau_fbo.c|1 -
 src/mesa/drivers/dri/r200/r200_context.c  |1 -
 src/mesa/drivers/dri/r200/r200_tex.c  |1 -
 src/mesa/drivers/dri/radeon/radeon_context.c  |1 -
 src/mesa/drivers/dri/radeon/radeon_fbo.c  |1 -
 src/mesa/drivers/dri/radeon/radeon_tex.c  |1 -
 src/mesa/drivers/dri/radeon/radeon_texture.c  |1 -
 src/mesa/drivers/dri/radeon/radeon_texture.h  |1 -
 src/mesa/main/accum.c |1 -
 src/mesa/main/accum.h |1 -
 src/mesa/main/api_arrayelt.c  |1 -
 src/mesa/main/api_arrayelt.h  |1 -
 src/mesa/main/api_loopback.c  |1 -
 src/mesa/main/api_loopback.h  |2 --
 src/mesa/main/api_validate.c  |1 -
 src/mesa/main/api_validate.h  |1 -
 src/mesa/main/arrayobj.c  |1 -
 src/mesa/main/atifragshader.c |1 -
 src/mesa/main/atifragshader.h |1 -
 src/mesa/main/attrib.c|1 -
 src/mesa/main/attrib.h|1 -
 src/mesa/main/bufferobj.c |1 -
 src/mesa/main/bufferobj.h |1 -
 src/mesa/main/colortab.c  |1 -
 src/mesa/main/colortab.h  |1 -
 src/mesa/main/context.c   |1 -
 src/mesa/main/convolve.c  |1 -
 src/mesa/main/convolve.h  |1 -
 src/mesa/main/debug.h |1 -
 src/mesa/main/depth.h |1 -
 src/mesa/main/dlist.c |1 -
 src/mesa/main/dlist.h |1 -
 src/mesa/main/drawpix.c   |1 -
 src/mesa/main/drawpix.h   |1 -
 src/mesa/main/drawtex.c   |1 -
 src/mesa/main/drawtex.h   |1 -
 src/mesa/main/enable.c|1 -
 src/mesa/main/enums.h |1 -
 src/mesa/main/es1_conversion.c|1 -
 src/mesa/main/eval.c  |1 -
 src/mesa/main/eval.h  |1 -
 src/mesa/main/extensions.c|1 -
 src/mesa/main/extensions.h|1 -
 src/mesa/main/fbobject.c  |1 -
 src/mesa/main/feedback.c  |1 -
 src/mesa/main/feedback.h  |1 -
 src/mesa/main/ffvertex_prog.c |1 -
 src/mesa/main/fog.h   |1 -
 src/mesa/main/formatquery.c   |1 -
 src/mesa/main/formats.c   |1 -
 src/mesa/main/get.c   |1 -
 src/mesa/main/getstring.c |1 -
 src/mesa/main/hint.h  |1 -
 src/mesa/main/histogram.c |1 -
 src/mesa/main/histogram.h |1 -
 src/mesa/main/image.c |1 -
 src/mesa/main/light.h |1 -
 src/mesa/main/matrix.c|1 -
 src/mesa/main/mtypes.h|1 -
 src/mesa/main/pixel.c |1 -
 src/mesa/main/pixel.h |1 -
 src/mesa/main/pixelstore.c|1 -
 src/mesa/main/querymatrix.h   |1 -
 src/mesa/main/queryobj.c  |1 -
 src/mesa/main/queryobj.h  |1 -
 src/mesa/main/rastpos.c   |1 -
 src/mesa/main/rastpos.h   |1 -
 src/mesa/main/remap.c |1 -
 src/mesa/main/remap.h |1 -
 src/mesa/main/samplerobj.c|1 -
 src/mesa/main/shaderapi.c   

Mesa (master): glapi: no longer emit #include "mfeatures.h" in generated files

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c6e00b6f6c9ea54ac10a0fbb6af85d9673f9db2f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6e00b6f6c9ea54ac10a0fbb6af85d9673f9db2f

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

glapi: no longer emit #include "mfeatures.h" in generated files

None of the symbols in mfeatures.h are used anymore.

Reviewed-by: Jordan Justen 

---

 src/mapi/glapi/gen/gl_enums.py   |1 -
 src/mapi/glapi/gen/gl_genexec.py |1 -
 src/mapi/glapi/gen/gl_table.py   |6 --
 3 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index 0bf8b0a..3bd511e 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -43,7 +43,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
 
 def printRealHeader(self):
 print '#include "main/glheader.h"'
-print '#include "main/mfeatures.h"'
 print '#include "main/enums.h"'
 print '#include "main/imports.h"'
 print '#include "main/mtypes.h"'
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index a85b447..8267298 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -44,7 +44,6 @@ header = """/**
  */
 
 
-#include "main/mfeatures.h"
 #include "main/accum.h"
 #include "main/api_loopback.h"
 #include "main/api_exec.h"
diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index 99957f6..fd38468 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -97,12 +97,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
  * can SET_FuncName, are used to get and set the dispatch pointer for the
  * named function in the specified dispatch table.
  */
-
-/* GLXEXT is defined when building the GLX extension in the xserver.
- */
-#if !defined(GLXEXT)
-#include "main/mfeatures.h"
-#endif
 """
 return
 

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


Mesa (master): mesa: remove FEATURE_remap_table from remap.[ch]

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 7fd12a8ae1abc76af8e67595b87caaa811a5825c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7fd12a8ae1abc76af8e67595b87caaa811a5825c

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

mesa: remove FEATURE_remap_table from remap.[ch]

It was always defined.

Reviewed-by: Jordan Justen 

---

 src/mesa/main/remap.c |6 --
 src/mesa/main/remap.h |   34 --
 2 files changed, 0 insertions(+), 40 deletions(-)

diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c
index a098705..bc4ac9b 100644
--- a/src/mesa/main/remap.c
+++ b/src/mesa/main/remap.c
@@ -37,9 +37,6 @@
  */
 
 #include "mfeatures.h"
-
-#if FEATURE_remap_table
-
 #include "remap.h"
 #include "imports.h"
 #include "glapi/glapi.h"
@@ -223,6 +220,3 @@ _mesa_init_remap_table(void)
 driDispatchRemapTable_size,
 MESA_remap_table_functions);
 }
-
-
-#endif /* FEATURE_remap_table */
diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h
index fa31724..6f20c3e 100644
--- a/src/mesa/main/remap.h
+++ b/src/mesa/main/remap.h
@@ -42,8 +42,6 @@ struct gl_function_remap {
 };
 
 
-#if FEATURE_remap_table
-
 extern int
 driDispatchRemapTable[];
 
@@ -62,37 +60,5 @@ _mesa_map_static_functions(void);
 extern void
 _mesa_init_remap_table(void);
 
-#else /* FEATURE_remap_table */
-
-static inline const char *
-_mesa_get_function_spec(int func_index)
-{
-   return NULL;
-}
-
-static inline int
-_mesa_map_function_spec(const char *spec)
-{
-   return -1;
-}
-
-static inline void
-_mesa_map_function_array(const struct gl_function_remap *func_array)
-{
-}
-
-static inline void
-_mesa_map_static_functions(void)
-{
-}
-
-
-static inline void
-_mesa_init_remap_table(void)
-{
-}
-
-#endif /* FEATURE_remap_table */
-
 
 #endif /* REMAP_H */

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


Mesa (master): glapi: remove FEATURE_remap_table test (it's always defined)

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0bcced771683bf789d4a3894cb40e745599f667e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0bcced771683bf789d4a3894cb40e745599f667e

Author: Brian Paul 
Date:   Wed Apr 17 09:49:39 2013 -0600

glapi: remove FEATURE_remap_table test (it's always defined)

Reviewed-by: Jordan Justen 

---

 src/mapi/glapi/gen/gl_table.py |   15 ---
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index 382eaaf..99957f6 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -147,17 +147,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
 for f, index in abi_functions:
 print '#define _gloffset_%s %d' % (f.name, f.offset)
 
-print ''
-print '#if !FEATURE_remap_table'
-print ''
-
-for f, index in functions:
-print '#define _gloffset_%s %d' % (f.name, f.offset)
-
-print ''
-print '#else /* !FEATURE_remap_table */'
-print ''
-
 if self.es:
 remap_table = "esLocalRemapTable"
 
@@ -180,8 +169,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
 print '#define _gloffset_%s %s[%s_remap_index]' % (f.name, 
remap_table, f.name)
 
 print ''
-print '#endif /* !FEATURE_remap_table */'
-print ''
 
 for f, index in abi_functions + functions:
 arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
@@ -209,12 +196,10 @@ class PrintRemapTable(gl_XML.gl_print_base):
 print '#define SET_%s(disp, fn) SET_%s(disp, fn)' % 
(name, f.name)
 print ''
 
-print '#if FEATURE_remap_table'
 for f in alias_functions:
 for name in f.entry_points:
 if name != f.name:
 print '#define %s_remap_index %s_remap_index' % (name, 
f.name)
-print '#endif /* FEATURE_remap_table */'
 print ''
 
 return

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


Mesa (master): draw/so: respect leading/provoking vertex info

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: 8e7f7e9693814dec8196953786f4ae2e738453e2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e7f7e9693814dec8196953786f4ae2e738453e2

Author: Zack Rusin 
Date:   Wed Apr 17 15:21:35 2013 -0700

draw/so: respect leading/provoking vertex info

we were ignoring leading/provoking vertex settings which was
breaking decomposition of some strips.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/draw/draw_so_emit_tmp.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h 
b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h
index 4611cd0..282a52d 100644
--- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h
@@ -10,7 +10,7 @@
const unsigned prim = input_prims->prim;   \
const unsigned prim_flags = input_prims->flags;\
const boolean quads_flatshade_last = FALSE;\
-   const boolean last_vertex_last = TRUE; \
+   const boolean last_vertex_last = !so->draw->rasterizer->flatshade_first;  \
do {   \
   switch (prim) { \
   case PIPE_PRIM_LINES_ADJACENCY: \

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


Mesa (master): softpipe/so: use the correct variable for reporting stream out

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: 6bb217a4898b64add9c0a3b77cc0ce48409988f7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bb217a4898b64add9c0a3b77cc0ce48409988f7

Author: Zack Rusin 
Date:   Wed Apr 17 15:19:34 2013 -0700

softpipe/so: use the correct variable for reporting stream out

we were using the wrong vars, reporting incorrect stream output
statistics.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/drivers/softpipe/sp_query.c |   20 +++-
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_query.c 
b/src/gallium/drivers/softpipe/sp_query.c
index 62411de..b444e37 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -98,6 +98,10 @@ softpipe_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
   break;
case PIPE_QUERY_SO_STATISTICS:
   sq->so.primitives_storage_needed = 0;
+  sq->num_primitives_generated = 0;
+  softpipe->num_primitives_generated = 0;
+  sq->so.num_primitives_written = 0;
+  softpipe->so_stats.num_primitives_written = 0;
case PIPE_QUERY_PRIMITIVES_EMITTED:
   sq->so.num_primitives_written = 0;
   softpipe->so_stats.num_primitives_written = 0;
@@ -147,8 +151,11 @@ softpipe_end_query(struct pipe_context *pipe, struct 
pipe_query *q)
   sq->end = os_time_get_nano();
   break;
case PIPE_QUERY_SO_STATISTICS:
-  sq->so.primitives_storage_needed =
- softpipe->so_stats.primitives_storage_needed;
+  sq->num_primitives_generated =
+ softpipe->num_primitives_generated;
+  sq->so.num_primitives_written =
+ softpipe->so_stats.num_primitives_written;
+  break;
case PIPE_QUERY_PRIMITIVES_EMITTED:
   sq->so.num_primitives_written =
  softpipe->so_stats.num_primitives_written;
@@ -196,9 +203,12 @@ softpipe_get_query_result(struct pipe_context *pipe,
uint64_t *result = (uint64_t*)vresult;
 
switch (sq->type) {
-   case PIPE_QUERY_SO_STATISTICS:
-  memcpy(vresult, &sq->so,
- sizeof(struct pipe_query_data_so_statistics));
+   case PIPE_QUERY_SO_STATISTICS: {
+  struct pipe_query_data_so_statistics *stats =
+ (struct pipe_query_data_so_statistics *)vresult;
+  stats->num_primitives_written = sq->so.num_primitives_written;
+  stats->primitives_storage_needed = sq->num_primitives_generated;
+   }
   break;
case PIPE_QUERY_PIPELINE_STATISTICS:
   memcpy(vresult, &sq->stats,

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


Mesa (master): gallivm/gs: fix indirect addressing in geometry shaders

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: cb58c79efb1402cd89504856033b6322d0096233
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb58c79efb1402cd89504856033b6322d0096233

Author: Zack Rusin 
Date:   Wed Apr 17 12:15:12 2013 -0700

gallivm/gs: fix indirect addressing in geometry shaders

We were always treating the vertex index as a scalar but when the
shader is using indirect addressing it will be a vector of indices
for each channel. This was causing some nasty crashes insides
LLVM.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 
Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/draw/draw_llvm.c  |   34 +++
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h |1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |1 +
 3 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index 33fe40d..8e3ea88 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1253,6 +1253,7 @@ clipmask_booli32(struct gallivm_state *gallivm,
 static LLVMValueRef
 draw_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface,
  struct lp_build_tgsi_context * bld_base,
+ boolean is_indirect,
  LLVMValueRef vertex_index,
  LLVMValueRef attrib_index,
  LLVMValueRef swizzle_index)
@@ -1262,13 +1263,34 @@ draw_gs_llvm_fetch_input(const struct 
lp_build_tgsi_gs_iface *gs_iface,
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef indices[3];
LLVMValueRef res;
+   struct lp_type type = bld_base->base.type;
+
+   if (is_indirect) {
+  int i;
+  res = bld_base->base.zero;
+  for (i = 0; i < type.length; ++i) {
+ LLVMValueRef idx = lp_build_const_int32(gallivm, i);
+ LLVMValueRef vert_chan_index = LLVMBuildExtractElement(builder,
+vertex_index, 
idx, "");
+ LLVMValueRef channel_vec, value;
+ indices[0] = vert_chan_index;
+ indices[1] = attrib_index;
+ indices[2] = swizzle_index;
+ 
+ channel_vec = LLVMBuildGEP(builder, gs->input, indices, 3, "");
+ channel_vec = LLVMBuildLoad(builder, channel_vec, "");
+ value = LLVMBuildExtractElement(builder, channel_vec, idx, "");
+
+ res = LLVMBuildInsertElement(builder, res, value, idx, "");
+  }
+   } else {
+  indices[0] = vertex_index;
+  indices[1] = attrib_index;
+  indices[2] = swizzle_index;
 
-   indices[0] = vertex_index;
-   indices[1] = attrib_index;
-   indices[2] = swizzle_index;
-   
-   res = LLVMBuildGEP(builder, gs->input, indices, 3, "");
-   res = LLVMBuildLoad(builder, res, "");
+  res = LLVMBuildGEP(builder, gs->input, indices, 3, "");
+  res = LLVMBuildLoad(builder, res, "");
+   }
 
return res;
 }
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 0fbb8aa..78a1f0e 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -368,6 +368,7 @@ struct lp_build_tgsi_gs_iface
 {
LLVMValueRef (*fetch_input)(const struct lp_build_tgsi_gs_iface *gs_iface,
struct lp_build_tgsi_context * bld_base,
+   boolean is_indirect,
LLVMValueRef vertex_index,
LLVMValueRef attrib_index,
LLVMValueRef swizzle_index);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 28eb57b..ea7dec7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -829,6 +829,7 @@ emit_fetch_gs_input(
}
 
res = bld->gs_iface->fetch_input(bld->gs_iface, bld_base,
+reg->Dimension.Indirect,
 vertex_index, attrib_index,
 swizzle_index);
 

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


Mesa (master): st/wgl: fix issue with SwapBuffers of minimized windows

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 02039066a8bd4e9cdce7f7d4c90606b54018d74e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=02039066a8bd4e9cdce7f7d4c90606b54018d74e

Author: Brian Paul 
Date:   Wed Apr 17 16:16:24 2013 -0600

st/wgl: fix issue with SwapBuffers of minimized windows

If a window's minimized we get a zero-size window.  Skip the SwapBuffers
in that case to avoid some warning messages with the VMware svga driver.
Internal bug #996695

Reviewed-by: Jose Fonseca 

---

 src/gallium/state_trackers/wgl/stw_framebuffer.c |   22 +-
 src/gallium/state_trackers/wgl/stw_framebuffer.h |2 ++
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c 
b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index c22e0f1..18ecb05 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -140,6 +140,8 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb )
width  = client_rect.right  - client_rect.left;
height = client_rect.bottom - client_rect.top;
 
+   fb->minimized = width == 0 || height == 0;
+
if (width <= 0 || height <= 0) {
   /*
* When the window is minimized GetClientRect will return zeros.  Simply
@@ -530,15 +532,17 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
   }
}
 
-   if(fb->shared_surface) {
-  stw_dev->stw_winsys->compose(screen,
-   res,
-   fb->shared_surface,
-   &fb->client_rect,
-   data->PresentHistoryToken);
-   }
-   else {
-  stw_dev->stw_winsys->present( screen, res, hdc );
+   if (!fb->minimized) {
+  if (fb->shared_surface) {
+ stw_dev->stw_winsys->compose(screen,
+  res,
+  fb->shared_surface,
+  &fb->client_rect,
+  data->PresentHistoryToken);
+  }
+  else {
+ stw_dev->stw_winsys->present( screen, res, hdc );
+  }
}
 
stw_framebuffer_update(fb);
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h 
b/src/gallium/state_trackers/wgl/stw_framebuffer.h
index 3ba51ba..cee28e8 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
@@ -79,6 +79,8 @@ struct stw_framebuffer
/* FIXME: Make this work for multiple contexts bound to the same 
framebuffer */
boolean must_resize;
 
+   boolean minimized;  /**< Is the window currently minimized? */
+
unsigned width;
unsigned height;


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


Mesa (master): intel: Don't dereference a NULL pointer of calloc fails

2013-04-17 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 505ac6ddc6f83ee17655d54cf46ed71ead9e578c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=505ac6ddc6f83ee17655d54cf46ed71ead9e578c

Author: Ian Romanick 
Date:   Tue Apr 16 09:31:08 2013 -0700

intel: Don't dereference a NULL pointer of calloc fails

The caller of NewTextureObject does the right thing if NULL is returned,
so this function should do the right thing too.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/intel/intel_tex.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c 
b/src/mesa/drivers/dri/intel/intel_tex.c
index 1564f6c..9bba989 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -35,6 +35,10 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, 
GLenum target)
(void) ctx;
 
DBG("%s\n", __FUNCTION__);
+
+   if (obj == NULL)
+  return NULL;
+
_mesa_initialize_texture_object(&obj->base, name, target);
 
obj->needs_validate = true;

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


Mesa (master): i965: Trim trailing whitespace in brw_defines.h.

2013-04-17 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 50064164a461f838e01a875987034863b217f531
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50064164a461f838e01a875987034863b217f531

Author: Eric Anholt 
Date:   Thu Mar 21 10:07:31 2013 -0700

i965: Trim trailing whitespace in brw_defines.h.

It was all over the formats section I wanted to edit.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_defines.h |  288 +++---
 1 files changed, 144 insertions(+), 144 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index a13f9dc..38f0356 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -77,13 +77,13 @@
 #define _3DPRIM_LINESTRIP_CONT_BF 0x14
 #define _3DPRIM_TRIFAN_NOSTIPPLE  0x15
 
-#define BRW_ANISORATIO_2 0 
-#define BRW_ANISORATIO_4 1 
-#define BRW_ANISORATIO_6 2 
-#define BRW_ANISORATIO_8 3 
-#define BRW_ANISORATIO_104 
-#define BRW_ANISORATIO_125 
-#define BRW_ANISORATIO_146 
+#define BRW_ANISORATIO_2 0
+#define BRW_ANISORATIO_4 1
+#define BRW_ANISORATIO_6 2
+#define BRW_ANISORATIO_8 3
+#define BRW_ANISORATIO_104
+#define BRW_ANISORATIO_125
+#define BRW_ANISORATIO_146
 #define BRW_ANISORATIO_167
 
 #define BRW_BLENDFACTOR_ONE 0x1
@@ -188,14 +188,14 @@
 #define BRW_LOGICOPFUNCTION_COPY 12
 #define BRW_LOGICOPFUNCTION_OR_REVERSE   13
 #define BRW_LOGICOPFUNCTION_OR   14
-#define BRW_LOGICOPFUNCTION_SET  15  
+#define BRW_LOGICOPFUNCTION_SET  15
 
-#define BRW_MAPFILTER_NEAREST0x0 
-#define BRW_MAPFILTER_LINEAR 0x1 
+#define BRW_MAPFILTER_NEAREST0x0
+#define BRW_MAPFILTER_LINEAR 0x1
 #define BRW_MAPFILTER_ANISOTROPIC0x2
 
-#define BRW_MIPFILTER_NONE0   
-#define BRW_MIPFILTER_NEAREST 1   
+#define BRW_MIPFILTER_NONE0
+#define BRW_MIPFILTER_NEAREST 1
 #define BRW_MIPFILTER_LINEAR  3
 
 #define BRW_ADDRESS_ROUNDING_ENABLE_U_MAG  0x20
@@ -208,7 +208,7 @@
 #define BRW_POLYGON_FRONT_FACING 0
 #define BRW_POLYGON_BACK_FACING  1
 
-#define BRW_PREFILTER_ALWAYS 0x0 
+#define BRW_PREFILTER_ALWAYS 0x0
 #define BRW_PREFILTER_NEVER  0x1
 #define BRW_PREFILTER_LESS   0x2
 #define BRW_PREFILTER_EQUAL  0x3
@@ -218,10 +218,10 @@
 #define BRW_PREFILTER_GEQUAL 0x7
 
 #define BRW_PROVOKING_VERTEX_00
-#define BRW_PROVOKING_VERTEX_11 
+#define BRW_PROVOKING_VERTEX_11
 #define BRW_PROVOKING_VERTEX_22
 
-#define BRW_RASTRULE_UPPER_LEFT  0
+#define BRW_RASTRULE_UPPER_LEFT  0
 #define BRW_RASTRULE_UPPER_RIGHT 1
 /* These are listed as "Reserved, but not seen as useful"
  * in Intel documentation (page 212, "Point Rasterization Rule",
@@ -229,7 +229,7 @@
  * "Intel® 965 Express Chipset Family and Intel® G35 Express
  * Chipset Graphics Controller Programmer's Reference Manual,
  * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
- * available at 
+ * available at
  * http://intellinuxgraphics.org/documentation.html
  * at the time of this writing).
  *
@@ -267,88 +267,88 @@
 #define BRW_SURFACE_WRITEDISABLE_R_SHIFT   16
 #define BRW_SURFACE_WRITEDISABLE_A_SHIFT   17
 
-#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000 
-#define BRW_SURFACEFORMAT_R32G32B32A32_SINT  0x001 
-#define BRW_SURFACEFORMAT_R32G32B32A32_UINT  0x002 
-#define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003 
-#define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004 
-#define BRW_SURFACEFORMAT_R64G64_FLOAT   0x005 
-#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006 
+#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000
+#define BRW_SURFACEFORMAT_R32G32B32A32_SINT  0x001
+#define BRW_SURFACEFORMAT_R32G32B32A32_UINT  0x002
+#define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003
+#define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004
+#define BRW_SURFACEFORMAT_R64G64_FLOAT   0x005
+#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006
 #define BRW_SURFACEFORMAT_R32G32B32A32_SSCALED   0x007
 #define BRW_SURFACEFORMAT_R32G32B32A32_USCALED   0x008
 #define BRW_SURFACEFORMAT_R32G32B32A32_SFIXED0x020
-#define BRW_SURFACEFORMAT_R32G32B32_FLOAT0x040 
-#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041 
-#define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042 
-#define BRW_SURFACEFORMAT_R32G32B32_UNORM0x043 
-#define BRW_SURFACEFORMAT_R32G32B32_SNORM0x044 
-#define BRW_SURFACEFORMAT_R32G32B32_SSCALED  0x045 
-#define BRW_SURFACEFORMAT_R32G32B32_USCALED  0x046 
+#define BRW_SURFACEFORMAT_R32G32B32_FLOAT0x040
+#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041
+#define BRW_SUR

Mesa (master): r200: fix build failure introduced with cbbcb0247e6aa8d7adc274a94206ee02f9c70bea

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 867f71db6bdb7abe07aa23e4a0d73ea563218152
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=867f71db6bdb7abe07aa23e4a0d73ea563218152

Author: Laurent Carlier 
Date:   Wed Apr 17 21:40:16 2013 +0200

r200: fix build failure introduced with cbbcb0247e6aa8d7adc274a94206ee02f9c70bea

Signed-off-by: Brian Paul 

---

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

diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c 
b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 274e338..0f1e013 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -257,7 +257,7 @@ void r200ChooseVertexState( struct gl_context *ctx )
 * bigger one.
 */
if ((0 == (tnl->render_inputs_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, 
_TNL_NUM_TEX)))
-   || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+   || twosided
|| unfilled) {
   rmesa->swtcl.needproj = GL_TRUE;
   vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;

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


Mesa (master): st/mesa: clean up formatting in st_cb_msaa.c

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 107947548181da338accf0b0b9c6dea590c557ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=107947548181da338accf0b0b9c6dea590c557ba

Author: Brian Paul 
Date:   Wed Apr 17 10:02:29 2013 -0600

st/mesa: clean up formatting in st_cb_msaa.c

Insert blank lines, wrap lines, remove trailing whitespace, etc.

---

 src/mesa/state_tracker/st_cb_msaa.c |   30 ++
 1 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_msaa.c 
b/src/mesa/state_tracker/st_cb_msaa.c
index 3399a0c..b09e0e3 100644
--- a/src/mesa/state_tracker/st_cb_msaa.c
+++ b/src/mesa/state_tracker/st_cb_msaa.c
@@ -1,8 +1,8 @@
 /**
- * 
+ *
  * Copyright 2013 Red Hat
  * All Rights Reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
  * "Software"), to deal in the Software without restriction, including
@@ -10,11 +10,11 @@
  * distribute, sub license, 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 NON-INFRINGEMENT.
@@ -22,7 +22,7 @@
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
+ *
  **/
 
 #include "main/mfeatures.h"
@@ -35,20 +35,26 @@
 #include "state_tracker/st_cb_fbo.h"
 
 #include "pipe/p_context.h"
-static void st_GetSamplePosition(struct gl_context *ctx,
- struct gl_framebuffer *fb,
- GLuint index,
- GLfloat *outValue)
+
+
+static void
+st_GetSamplePosition(struct gl_context *ctx,
+ struct gl_framebuffer *fb,
+ GLuint index,
+ GLfloat *outValue)
 {
struct st_context *st = st_context(ctx);
- 
+
st_validate_state(st);
 
if (st->pipe->get_sample_position)
-  st->pipe->get_sample_position(st->pipe, (unsigned)fb->Visual.samples, 
index, outValue);
+  st->pipe->get_sample_position(st->pipe, (unsigned) fb->Visual.samples,
+index, outValue);
 }
 
-void st_init_msaa_functions(struct dd_function_table *functions)
+
+void
+st_init_msaa_functions(struct dd_function_table *functions)
 {
functions->GetSamplePosition = st_GetSamplePosition;
 }

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


Mesa (master): mesa: remove gl_context::_TriangleCaps

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 3350ca223e4319dce79d26652a3f9c1c63aaf9b3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3350ca223e4319dce79d26652a3f9c1c63aaf9b3

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove gl_context::_TriangleCaps

No longer used anywhere.

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |7 ---
 src/mesa/main/mtypes.h |5 -
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 07c73f5..4516db6 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -958,7 +958,7 @@ intelChooseRenderState(struct gl_context * ctx)
 {
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
-   GLuint flags = ctx->_TriangleCaps |
+   GLuint flags =
   ((ctx->Light.Enabled &&
 ctx->Light.Model.TwoSide) ? DD_TRI_LIGHT_TWOSIDE : 0) |
   ((ctx->Polygon.FrontMode != GL_FILL ||
@@ -1159,6 +1159,8 @@ static void
 intelRenderPrimitive(struct gl_context * ctx, GLenum prim)
 {
struct intel_context *intel = intel_context(ctx);
+   GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
 
if (0)
   fprintf(stderr, "%s %s\n", __FUNCTION__, _mesa_lookup_enum_by_nr(prim));
@@ -1172,8 +1174,7 @@ intelRenderPrimitive(struct gl_context * ctx, GLenum prim)
 * primitive will always be reset by lower level functions in that case,
 * potentially pingponging the state:
 */
-   if (reduced_prim[prim] == GL_TRIANGLES &&
-   (ctx->_TriangleCaps & DD_TRI_UNFILLED))
+   if (reduced_prim[prim] == GL_TRIANGLES && unfilled)
   return;
 
/* Set some primitive-dependent state and Start? a new primitive.
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 68afc24..027bb99 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3550,11 +3550,6 @@ struct gl_context
GLbitfield64 varying_vp_inputs;  /**< mask of VERT_BIT_* flags */
 
/** \name Derived state */
-   /*@{*/
-   /** Bitwise-or of DD_* flags.  Note that this bitfield may be used before
-* state validation so they need to always be current.
-*/
-   GLbitfield _TriangleCaps;
GLbitfield _ImageTransferState;/**< bitwise-or of IMAGE_*_BIT flags */
GLfloat _EyeZDir[3];
GLfloat _ModelViewInvScale;

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


Mesa (master): mesa: remove DD_TRI_SMOOTH flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 56dc53ed5bae2751eeadbfc1d163dfec72e8cfc8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=56dc53ed5bae2751eeadbfc1d163dfec72e8cfc8

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_TRI_SMOOTH flag

Reviewed-by: Eric Anholt 

---

 src/mesa/main/debug.c  |5 ++---
 src/mesa/main/enable.c |1 -
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |2 --
 4 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 77629b9..418f0e2 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,12 +100,11 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s\n",
+  "%s: (0x%x) %s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
-  (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : "",
-  (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : ""
+  (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : ""
   );
 }
 
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index fe15716..22a75c8 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -623,7 +623,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_POLYGON);
  ctx->Polygon.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_SMOOTH;
  break;
   case GL_POLYGON_STIPPLE:
  if (ctx->API != API_OPENGL_COMPAT)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 3d77fba..0463689 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3169,7 +3169,6 @@ struct gl_matrix_stack
 /*@{*/
 #define DD_TRI_LIGHT_TWOSIDE(1 << 1)
 #define DD_TRI_UNFILLED (1 << 2)
-#define DD_TRI_SMOOTH   (1 << 3)
 /*@}*/
 
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 01059fa..f724864 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -330,8 +330,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
 * Polygons
 */
if (1/*new_state & _NEW_POLYGON*/) {
-  if (ctx->Polygon.SmoothFlag)
- ctx->_TriangleCaps |= DD_TRI_SMOOTH;
   if (ctx->Polygon.FrontMode != GL_FILL
   || ctx->Polygon.BackMode != GL_FILL)
  ctx->_TriangleCaps |= DD_TRI_UNFILLED;

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


Mesa (master): mesa: remove DD_TRI_LIGHT_TWOSIDE flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: cbbcb0247e6aa8d7adc274a94206ee02f9c70bea
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cbbcb0247e6aa8d7adc274a94206ee02f9c70bea

Author: Brian Paul 
Date:   Wed Apr 17 11:58:33 2013 -0600

mesa: remove DD_TRI_LIGHT_TWOSIDE flag

v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |3 +++
 src/mesa/drivers/dri/r200/r200_swtcl.c |9 ++---
 src/mesa/drivers/dri/radeon/radeon_swtcl.c |   11 +++
 src/mesa/main/debug.c  |   12 
 src/mesa/main/debug.h  |1 -
 src/mesa/main/enable.c |4 
 src/mesa/main/light.c  |4 
 src/mesa/main/mtypes.h |   10 --
 src/mesa/main/state.c  |   27 ---
 src/mesa/tnl/t_vertex.c|   12 ++--
 10 files changed, 22 insertions(+), 71 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 9a9c56f..07c73f5 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -943,6 +943,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 /**/
 
 
+#define DD_TRI_LIGHT_TWOSIDE (1 << 1)
 #define DD_TRI_UNFILLED (1 << 2)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
@@ -958,6 +959,8 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
+  ((ctx->Light.Enabled &&
+ctx->Light.Model.TwoSide) ? DD_TRI_LIGHT_TWOSIDE : 0) |
   ((ctx->Polygon.FrontMode != GL_FILL ||
 ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
   (ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c 
b/src/mesa/drivers/dri/r200/r200_swtcl.c
index fb92e75..274e338 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -241,6 +241,7 @@ void r200ChooseVertexState( struct gl_context *ctx )
GLuint vap;
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
  ctx->Polygon.BackMode != GL_FILL);
+   GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
 
/* We must ensure that we don't do _tnl_need_projected_coords while in a
 * rasterization fallback.  As this function will be called again when we
@@ -573,15 +574,17 @@ void r200ChooseRenderState( struct gl_context *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint index = 0;
-   GLuint flags = ctx->_TriangleCaps;
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
  ctx->Polygon.BackMode != GL_FILL);
+   GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;
 
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
   return;
 
-   if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
-   if (unfilled) index |= R200_UNFILLED_BIT;
+   if (twosided)
+  index |= R200_TWOSIDE_BIT;
+   if (unfilled)
+  index |= R200_UNFILLED_BIT;
 
if (index != rmesa->radeon.swtcl.RenderIndex) {
   tnl->Driver.Render.Points = rast_tab[index].points;
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c 
b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index ed452df..1e80162 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -275,6 +275,7 @@ void radeonChooseVertexState( struct gl_context *ctx )
GLuint se_coord_fmt = rmesa->hw.set.cmd[SET_SE_COORDFMT];
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
  ctx->Polygon.BackMode != GL_FILL);
+   GLboolean twosided = ctx->Light.Enabled && ctx->Light.Model.TwoSide;

se_coord_fmt &= ~(RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
 RADEON_VTX_Z_PRE_MULT_1_OVER_W0 |
@@ -294,7 +295,7 @@ void radeonChooseVertexState( struct gl_context *ctx )
if ((0 == (tnl->render_inputs_bitset & 
 (BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)
  | BITFIELD64_BIT(_TNL_ATTRIB_COLOR1
-   || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+   || twosided
|| unfilled) {
   rmesa->swtcl.needproj = GL_TRUE;
   se_coord_fmt |= (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 |
@@ -696,15 +697,17 @@ void radeonChooseRenderState( struct gl_context *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint index = 0;
-   GLuint flags = ctx->_TriangleCaps;
GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
  ctx->Polygon.BackMode != GL_FILL);
+   GL

Mesa (master): mesa: remove DD_TRI_STIPPLE flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b32fb8ac9e05b78d2bd07fcaf0d5f68525c4aa3b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b32fb8ac9e05b78d2bd07fcaf0d5f68525c4aa3b

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_TRI_STIPPLE flag

Make it a local macro for the i915 driver.
v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |2 ++
 src/mesa/main/debug.c  |3 +--
 src/mesa/main/enable.c |1 -
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |2 --
 5 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 1c7fa88..e62fd61 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -944,6 +944,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 
 
 
+#define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
 #define DD_LINE_STIPPLE (1 << 7)
 #define DD_POINT_ATTEN  (1 << 9)
@@ -957,6 +958,7 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
+  (ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
   ((ctx->Polygon.OffsetPoint ||
 ctx->Polygon.OffsetLine ||
 ctx->Polygon.OffsetFill) ? DD_TRI_OFFSET : 0) |
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index d4ae741..77629b9 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,12 +100,11 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s\n",
+  "%s: (0x%x) %s%s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
   (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : "",
-  (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
   (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : ""
   );
 }
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 8811929..fe15716 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -632,7 +632,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_POLYGON);
  ctx->Polygon.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_TRI_STIPPLE;
  break;
   case GL_POLYGON_OFFSET_POINT:
  if (!_mesa_is_desktop_gl(ctx))
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 2928695..3d77fba 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3170,7 +3170,6 @@ struct gl_matrix_stack
 #define DD_TRI_LIGHT_TWOSIDE(1 << 1)
 #define DD_TRI_UNFILLED (1 << 2)
 #define DD_TRI_SMOOTH   (1 << 3)
-#define DD_TRI_STIPPLE  (1 << 4)
 /*@}*/
 
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index eeac711..01059fa 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -332,8 +332,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
if (1/*new_state & _NEW_POLYGON*/) {
   if (ctx->Polygon.SmoothFlag)
  ctx->_TriangleCaps |= DD_TRI_SMOOTH;
-  if (ctx->Polygon.StippleFlag)
- ctx->_TriangleCaps |= DD_TRI_STIPPLE;
   if (ctx->Polygon.FrontMode != GL_FILL
   || ctx->Polygon.BackMode != GL_FILL)
  ctx->_TriangleCaps |= DD_TRI_UNFILLED;

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


Mesa (master): mesa: remove DD_TRI_OFFSET flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: dfb1474aac97b94b36eed56954cbf2fadd0edded
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dfb1474aac97b94b36eed56954cbf2fadd0edded

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_TRI_OFFSET flag

Make it a local macro for the i915 driver.
v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |4 
 src/mesa/main/debug.c  |3 +--
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |   23 ---
 4 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 24a84cb..1c7fa88 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -944,6 +944,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 
 
 
+#define DD_TRI_OFFSET   (1 << 5)
 #define DD_LINE_STIPPLE (1 << 7)
 #define DD_POINT_ATTEN  (1 << 9)
 
@@ -956,6 +957,9 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
+  ((ctx->Polygon.OffsetPoint ||
+ctx->Polygon.OffsetLine ||
+ctx->Polygon.OffsetFill) ? DD_TRI_OFFSET : 0) |
   (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) |
   (ctx->Point._Attenuated ? DD_POINT_ATTEN : 0);
const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index aae1d02..d4ae741 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,13 +100,12 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
   (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : "",
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
-  (flags & DD_TRI_OFFSET)  ? "tri-offset, " : "",
   (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : ""
   );
 }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f91f352..2928695 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3171,7 +3171,6 @@ struct gl_matrix_stack
 #define DD_TRI_UNFILLED (1 << 2)
 #define DD_TRI_SMOOTH   (1 << 3)
 #define DD_TRI_STIPPLE  (1 << 4)
-#define DD_TRI_OFFSET   (1 << 5)
 /*@}*/
 
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 628e275..eeac711 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -314,22 +314,6 @@ update_twoside(struct gl_context *ctx)
 }
 
 
-/*
- * Check polygon state and set DD_TRI_OFFSET
- * in ctx->_TriangleCaps if needed.
- */
-static void
-update_polygon(struct gl_context *ctx)
-{
-   ctx->_TriangleCaps &= ~DD_TRI_OFFSET;
-
-   if (   ctx->Polygon.OffsetPoint
-   || ctx->Polygon.OffsetLine
-   || ctx->Polygon.OffsetFill)
-  ctx->_TriangleCaps |= DD_TRI_OFFSET;
-}
-
-
 /**
  * Update the ctx->_TriangleCaps bitfield.
  * XXX that bitfield should really go away someday!
@@ -353,10 +337,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield 
new_state)
   if (ctx->Polygon.FrontMode != GL_FILL
   || ctx->Polygon.BackMode != GL_FILL)
  ctx->_TriangleCaps |= DD_TRI_UNFILLED;
-  if (ctx->Polygon.OffsetPoint ||
-  ctx->Polygon.OffsetLine ||
-  ctx->Polygon.OffsetFill)
- ctx->_TriangleCaps |= DD_TRI_OFFSET;
}
 
/*
@@ -426,9 +406,6 @@ _mesa_update_state_locked( struct gl_context *ctx )
if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
   _mesa_update_draw_buffer_bounds( ctx );
 
-   if (new_state & _NEW_POLYGON)
-  update_polygon( ctx );
-
if (new_state & _NEW_LIGHT)
   _mesa_update_lighting( ctx );
 

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


Mesa (master): mesa: remove DD_POINT_ATTEN flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c6a81448f8d55a510d8e32cf28e1e174bf2574dd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6a81448f8d55a510d8e32cf28e1e174bf2574dd

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_POINT_ATTEN flag

For the i915 driver, make it a local macro.
v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |4 +++-
 src/mesa/main/debug.c  |5 ++---
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/points.c |5 -
 src/mesa/main/state.c  |8 
 5 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index 65b4949..24a84cb 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -945,6 +945,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 
 
 #define DD_LINE_STIPPLE (1 << 7)
+#define DD_POINT_ATTEN  (1 << 9)
 
 #define ANY_FALLBACK_FLAGS (DD_LINE_STIPPLE | DD_TRI_STIPPLE | DD_POINT_ATTEN)
 #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | 
DD_TRI_UNFILLED)
@@ -955,7 +956,8 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
-  (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0);
+  (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0) |
+  (ctx->Point._Attenuated ? DD_POINT_ATTEN : 0);
const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS));
GLuint index = 0;
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 28da81f..aae1d02 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,15 +100,14 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
   (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : "",
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
   (flags & DD_TRI_OFFSET)  ? "tri-offset, " : "",
-  (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : "",
-  (flags & DD_POINT_ATTEN) ? "point-atten, " : ""
+  (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : ""
   );
 }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fa58b17..f91f352 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3172,7 +3172,6 @@ struct gl_matrix_stack
 #define DD_TRI_SMOOTH   (1 << 3)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
-#define DD_POINT_ATTEN  (1 << 9)
 /*@}*/
 
 
diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c
index c925d4c..3239c6f 100644
--- a/src/mesa/main/points.c
+++ b/src/mesa/main/points.c
@@ -122,11 +122,6 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat 
*params)
  ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 ||
ctx->Point.Params[1] != 0.0 ||
ctx->Point.Params[2] != 0.0);
-
- if (ctx->Point._Attenuated)
-ctx->_TriangleCaps |= DD_POINT_ATTEN;
- else
-ctx->_TriangleCaps &= ~DD_POINT_ATTEN;
  break;
   case GL_POINT_SIZE_MIN_EXT:
  if (params[0] < 0.0F) {
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 4e66310..628e275 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -343,14 +343,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield 
new_state)
ctx->_TriangleCaps = 0;
 
/*
-* Points
-*/
-   if (1/*new_state & _NEW_POINT*/) {
-  if (ctx->Point._Attenuated)
- ctx->_TriangleCaps |= DD_POINT_ATTEN;
-   }
-
-   /*
 * Polygons
 */
if (1/*new_state & _NEW_POLYGON*/) {

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


Mesa (master): mesa: remove DD_POINT_SMOOTH flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4f57fbb507c77a627c9660756ce1b7ab8bcfeb78
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f57fbb507c77a627c9660756ce1b7ab8bcfeb78

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_POINT_SMOOTH flag

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/r200/r200_swtcl.c |2 +-
 src/mesa/drivers/dri/r200/r200_tcl.c   |2 +-
 src/mesa/main/debug.c  |3 +--
 src/mesa/main/enable.c |1 -
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |2 --
 6 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c 
b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 25bae21..5c6e276 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -318,7 +318,7 @@ static INLINE GLuint reduced_hw_prim( struct gl_context 
*ctx, GLuint prim)
 {
switch (prim) {
case GL_POINTS:
-  return ((!(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ?
+  return ((!ctx->Point.SmoothFlag) ?
 R200_VF_PRIM_POINT_SPRITES : R200_VF_PRIM_POINTS);
case GL_LINES:
/* fallthrough */
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c 
b/src/mesa/drivers/dri/r200/r200_tcl.c
index 703840d..548947d 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -69,7 +69,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define HAVE_ELTS1
 
 
-#define HW_POINTS   ((!(ctx->_TriangleCaps & DD_POINT_SMOOTH)) ? \
+#define HW_POINTS   ((!ctx->Point.SmoothFlag) ? \
R200_VF_PRIM_POINT_SPRITES : 
R200_VF_PRIM_POINTS)
 #define HW_LINESR200_VF_PRIM_LINES
 #define HW_LINE_LOOP0
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 533c5ed..28da81f 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,7 +100,7 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s%s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
@@ -108,7 +108,6 @@ _mesa_print_tri_caps( const char *name, GLuint flags )
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
   (flags & DD_TRI_OFFSET)  ? "tri-offset, " : "",
   (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : "",
-  (flags & DD_POINT_SMOOTH)? "point-smooth, " : "",
   (flags & DD_POINT_ATTEN) ? "point-atten, " : ""
   );
 }
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index ce92a42..8811929 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -615,7 +615,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_POINT);
  ctx->Point.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_POINT_SMOOTH;
  break;
   case GL_POLYGON_SMOOTH:
  if (!_mesa_is_desktop_gl(ctx))
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 0b12e48..fa58b17 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3172,7 +3172,6 @@ struct gl_matrix_stack
 #define DD_TRI_SMOOTH   (1 << 3)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
-#define DD_POINT_SMOOTH (1 << 8)
 #define DD_POINT_ATTEN  (1 << 9)
 /*@}*/
 
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 6578b37..4e66310 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -346,8 +346,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
 * Points
 */
if (1/*new_state & _NEW_POINT*/) {
-  if (ctx->Point.SmoothFlag)
- ctx->_TriangleCaps |= DD_POINT_SMOOTH;
   if (ctx->Point._Attenuated)
  ctx->_TriangleCaps |= DD_POINT_ATTEN;
}

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


Mesa (master): mesa: remove DD_TRI_UNFILLED flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c9bb052e31b7952272e60d28969e90eafb6b3e1f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9bb052e31b7952272e60d28969e90eafb6b3e1f

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_TRI_UNFILLED flag

Use alternate code in intel, r200, radeon drivers.
v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |4 +++-
 src/mesa/drivers/dri/r200/r200_state.c |5 +++--
 src/mesa/drivers/dri/r200/r200_swtcl.c |   14 +++---
 src/mesa/drivers/dri/radeon/radeon_state.c |5 +++--
 src/mesa/drivers/dri/radeon/radeon_swtcl.c |   14 +++---
 src/mesa/main/debug.c  |5 ++---
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/polygon.c|5 -
 src/mesa/main/state.c  |9 -
 src/mesa/tnl/t_vertex.c|   11 ---
 10 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index e62fd61..9a9c56f 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -943,7 +943,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 /**/
 
 
-
+#define DD_TRI_UNFILLED (1 << 2)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
 #define DD_LINE_STIPPLE (1 << 7)
@@ -958,6 +958,8 @@ intelChooseRenderState(struct gl_context * ctx)
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
GLuint flags = ctx->_TriangleCaps |
+  ((ctx->Polygon.FrontMode != GL_FILL ||
+ctx->Polygon.BackMode != GL_FILL) ? DD_TRI_UNFILLED : 0) |
   (ctx->Polygon.StippleFlag ? DD_TRI_STIPPLE : 0) |
   ((ctx->Polygon.OffsetPoint ||
 ctx->Polygon.OffsetLine ||
diff --git a/src/mesa/drivers/dri/r200/r200_state.c 
b/src/mesa/drivers/dri/r200/r200_state.c
index 93ae52a..6f79610 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -731,12 +731,13 @@ static void r200PolygonOffset( struct gl_context *ctx,
 static void r200PolygonMode( struct gl_context *ctx, GLenum face, GLenum mode )
 {
r200ContextPtr rmesa = R200_CONTEXT(ctx);
-   GLboolean flag = (ctx->_TriangleCaps & DD_TRI_UNFILLED) != 0;
+   GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
 
/* Can't generally do unfilled via tcl, but some good special
 * cases work.
 */
-   TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, flag);
+   TCL_FALLBACK( ctx, R200_TCL_FALLBACK_UNFILLED, unfilled);
if (rmesa->radeon.TclFallback) {
   r200ChooseRenderState( ctx );
   r200ChooseVertexState( ctx );
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c 
b/src/mesa/drivers/dri/r200/r200_swtcl.c
index 5c6e276..fb92e75 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -239,6 +239,8 @@ void r200ChooseVertexState( struct gl_context *ctx )
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint vte;
GLuint vap;
+   GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
 
/* We must ensure that we don't do _tnl_need_projected_coords while in a
 * rasterization fallback.  As this function will be called again when we
@@ -254,7 +256,8 @@ void r200ChooseVertexState( struct gl_context *ctx )
 * bigger one.
 */
if ((0 == (tnl->render_inputs_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, 
_TNL_NUM_TEX)))
-   || (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) {
+   || (ctx->_TriangleCaps & DD_TRI_LIGHT_TWOSIDE)
+   || unfilled) {
   rmesa->swtcl.needproj = GL_TRUE;
   vte |= R200_VTX_XY_FMT | R200_VTX_Z_FMT;
   vte &= ~R200_VTX_W0_FMT;
@@ -571,12 +574,14 @@ void r200ChooseRenderState( struct gl_context *ctx )
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint index = 0;
GLuint flags = ctx->_TriangleCaps;
+   GLboolean unfilled = (ctx->Polygon.FrontMode != GL_FILL ||
+ ctx->Polygon.BackMode != GL_FILL);
 
if (!rmesa->radeon.TclFallback || rmesa->radeon.Fallback)
   return;
 
if (flags & DD_TRI_LIGHT_TWOSIDE) index |= R200_TWOSIDE_BIT;
-   if (flags & DD_TRI_UNFILLED)  index |= R200_UNFILLED_BIT;
+   if (unfilled) index |= R200_UNFILLED_BIT;
 
if (index != rmesa->radeon.swtcl.RenderIndex) {
   tnl->Driver.Render.Points = rast_tab[index].points;
@@ -634,8 +639,11 @@ static void r200RasterPrimitive( struct gl_context *ctx, 
GLuint hwprim )
 static void r200RenderPrimitive( struct gl_context *ctx, GLenum prim )
 {
r200ContextPtr rmesa = R200_CONTEXT(ctx);
+   GLb

Mesa (master): mesa: remove DD_LINE_STIPPLE flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8ac8ae83609d5d5f28037ccd5b81ce5e40db2d33
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ac8ae83609d5d5f28037ccd5b81ce5e40db2d33

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_LINE_STIPPLE flag

For the i915 driver, make it a local macro.
v2: use conditional operator instead of bit shifting

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/i915/intel_tris.c |4 +++-
 src/mesa/main/debug.c  |3 +--
 src/mesa/main/enable.c |1 -
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |8 
 5 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
b/src/mesa/drivers/dri/i915/intel_tris.c
index b97fc98..65b4949 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -944,6 +944,7 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const 
GLuint * elts, GLuint
 
 
 
+#define DD_LINE_STIPPLE (1 << 7)
 
 #define ANY_FALLBACK_FLAGS (DD_LINE_STIPPLE | DD_TRI_STIPPLE | DD_POINT_ATTEN)
 #define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE | DD_TRI_OFFSET | 
DD_TRI_UNFILLED)
@@ -953,7 +954,8 @@ intelChooseRenderState(struct gl_context * ctx)
 {
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct intel_context *intel = intel_context(ctx);
-   GLuint flags = ctx->_TriangleCaps;
+   GLuint flags = ctx->_TriangleCaps |
+  (ctx->Line.StippleFlag ? DD_LINE_STIPPLE : 0);
const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS));
GLuint index = 0;
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 7dd108c..533c5ed 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,7 +100,7 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s%s%s%s\n",
   name,
   flags,
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
@@ -108,7 +108,6 @@ _mesa_print_tri_caps( const char *name, GLuint flags )
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
   (flags & DD_TRI_OFFSET)  ? "tri-offset, " : "",
   (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : "",
-  (flags & DD_LINE_STIPPLE)? "line-stipple, " : "",
   (flags & DD_POINT_SMOOTH)? "point-smooth, " : "",
   (flags & DD_POINT_ATTEN) ? "point-atten, " : ""
   );
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 5c36e05..ce92a42 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -439,7 +439,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_LINE);
  ctx->Line.StippleFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_STIPPLE;
  break;
   case GL_INDEX_LOGIC_OP:
  if (ctx->API != API_OPENGL_COMPAT)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 6aa3ab1..0b12e48 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3172,7 +3172,6 @@ struct gl_matrix_stack
 #define DD_TRI_SMOOTH   (1 << 3)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
-#define DD_LINE_STIPPLE (1 << 7)
 #define DD_POINT_SMOOTH (1 << 8)
 #define DD_POINT_ATTEN  (1 << 9)
 /*@}*/
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index e5e98dc..6578b37 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -353,14 +353,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield 
new_state)
}
 
/*
-* Lines
-*/
-   if (1/*new_state & _NEW_LINE*/) {
-  if (ctx->Line.StippleFlag)
- ctx->_TriangleCaps |= DD_LINE_STIPPLE;
-   }
-
-   /*
 * Polygons
 */
if (1/*new_state & _NEW_POLYGON*/) {

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


Mesa (master): mesa: remove unused DD_LINE_SMOOTH flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c1c5d689c5a8cc3ae72b81391be30f5296cc2993
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1c5d689c5a8cc3ae72b81391be30f5296cc2993

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove unused DD_LINE_SMOOTH flag

Reviewed-by: Eric Anholt 

---

 src/mesa/main/debug.c  |3 +--
 src/mesa/main/enable.c |1 -
 src/mesa/main/mtypes.h |1 -
 src/mesa/main/state.c  |2 --
 4 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index aee8ae2..4f3d3f6 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,7 +100,7 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n",
   name,
   flags,
   (flags & DD_SEPARATE_SPECULAR)   ? "separate-specular, " : "",
@@ -109,7 +109,6 @@ _mesa_print_tri_caps( const char *name, GLuint flags )
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
   (flags & DD_TRI_OFFSET)  ? "tri-offset, " : "",
   (flags & DD_TRI_SMOOTH)  ? "tri-smooth, " : "",
-  (flags & DD_LINE_SMOOTH) ? "line-smooth, " : "",
   (flags & DD_LINE_STIPPLE)? "line-stipple, " : "",
   (flags & DD_POINT_SMOOTH)? "point-smooth, " : "",
   (flags & DD_POINT_ATTEN) ? "point-atten, " : ""
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b688f05..5c36e05 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -431,7 +431,6 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 return;
  FLUSH_VERTICES(ctx, _NEW_LINE);
  ctx->Line.SmoothFlag = state;
- ctx->_TriangleCaps ^= DD_LINE_SMOOTH;
  break;
   case GL_LINE_STIPPLE:
  if (ctx->API != API_OPENGL_COMPAT)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index e46fa39..c97f907 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3173,7 +3173,6 @@ struct gl_matrix_stack
 #define DD_TRI_SMOOTH   (1 << 3)
 #define DD_TRI_STIPPLE  (1 << 4)
 #define DD_TRI_OFFSET   (1 << 5)
-#define DD_LINE_SMOOTH  (1 << 6)
 #define DD_LINE_STIPPLE (1 << 7)
 #define DD_POINT_SMOOTH (1 << 8)
 #define DD_POINT_ATTEN  (1 << 9)
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 251c1ae..f33bf08 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -366,8 +366,6 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
 * Lines
 */
if (1/*new_state & _NEW_LINE*/) {
-  if (ctx->Line.SmoothFlag)
- ctx->_TriangleCaps |= DD_LINE_SMOOTH;
   if (ctx->Line.StippleFlag)
  ctx->_TriangleCaps |= DD_LINE_STIPPLE;
}

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


Mesa (master): mesa: remove DD_SEPARATE_SPECULAR flag

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 55b2033f0a4896a7930469711a052083c15edd3f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=55b2033f0a4896a7930469711a052083c15edd3f

Author: Brian Paul 
Date:   Tue Apr 16 19:06:22 2013 -0600

mesa: remove DD_SEPARATE_SPECULAR flag

Reviewed-by: Eric Anholt 

---

 src/mesa/drivers/dri/r200/r200_tcl.c|3 ++-
 src/mesa/drivers/dri/radeon/radeon_maos_verts.c |3 ++-
 src/mesa/drivers/dri/radeon/radeon_tcl.c|3 ++-
 src/mesa/main/debug.c   |3 +--
 src/mesa/main/mtypes.h  |1 -
 src/mesa/main/state.c   |   15 ---
 6 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c 
b/src/mesa/drivers/dri/r200/r200_tcl.c
index f3cf34d..703840d 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #include "main/enums.h"
 #include "main/colormac.h"
 #include "main/light.h"
+#include "main/state.h"
 
 #include "vbo/vbo.h"
 #include "tnl/tnl.h"
@@ -402,7 +403,7 @@ static GLboolean r200_run_tcl_render( struct gl_context 
*ctx,
  FIXME: OTOH, we're missing the case where a ATI_fragment_shader 
accesses
  the secondary color (if lighting is disabled). The chip seems
  misconfigured for that though elsewhere (tcl output, might lock up) */
-  if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
+  if (_mesa_need_secondary_color(ctx)) {
 map_rev_fixed[5] = VERT_ATTRIB_COLOR1;
   }
 
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c 
b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index 985ad66..31edfe0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/mtypes.h"
+#include "main/state.h"
 
 #include "vbo/vbo.h"
 #include "math/m_translate.h"
@@ -63,7 +64,7 @@ static struct {
 #define DO_RGBA (IND & RADEON_CP_VC_FRMT_PKCOLOR)
 #define DO_SPEC_OR_FOG (IND & RADEON_CP_VC_FRMT_PKSPEC)
 #define DO_SPEC ((IND & RADEON_CP_VC_FRMT_PKSPEC) && \
-(ctx->_TriangleCaps & DD_SEPARATE_SPECULAR))
+_mesa_need_secondary_color(ctx))
 #define DO_FOG  ((IND & RADEON_CP_VC_FRMT_PKSPEC) && ctx->Fog.Enabled && \
 (ctx->Fog.FogCoordinateSource == GL_FOG_COORD))
 #define DO_TEX0 (IND & RADEON_CP_VC_FRMT_ST0)
diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c 
b/src/mesa/drivers/dri/radeon/radeon_tcl.c
index 7abc6c3..7832eaa 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #include "main/mtypes.h"
 #include "main/light.h"
 #include "main/enums.h"
+#include "main/state.h"
 
 #include "vbo/vbo.h"
 #include "tnl/tnl.h"
@@ -376,7 +377,7 @@ static GLboolean radeon_run_tcl_render( struct gl_context 
*ctx,
   inputs |= VERT_BIT_NORMAL;
}
 
-   if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
+   if (_mesa_need_secondary_color(ctx)) {
   inputs |= VERT_BIT_COLOR1;
}
 
diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c
index 4f3d3f6..7dd108c 100644
--- a/src/mesa/main/debug.c
+++ b/src/mesa/main/debug.c
@@ -100,10 +100,9 @@ void
 _mesa_print_tri_caps( const char *name, GLuint flags )
 {
_mesa_debug(NULL,
-  "%s: (0x%x) %s%s%s%s%s%s%s%s%s\n",
+  "%s: (0x%x) %s%s%s%s%s%s%s%s\n",
   name,
   flags,
-  (flags & DD_SEPARATE_SPECULAR)   ? "separate-specular, " : "",
   (flags & DD_TRI_LIGHT_TWOSIDE)   ? "tri-light-twoside, " : "",
   (flags & DD_TRI_UNFILLED)? "tri-unfilled, " : "",
   (flags & DD_TRI_STIPPLE) ? "tri-stipple, " : "",
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index c97f907..6aa3ab1 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3167,7 +3167,6 @@ struct gl_matrix_stack
  * Set in the __struct gl_contextRec::_TriangleCaps bitfield.
  */
 /*@{*/
-#define DD_SEPARATE_SPECULAR(1 << 0)
 #define DD_TRI_LIGHT_TWOSIDE(1 << 1)
 #define DD_TRI_UNFILLED (1 << 2)
 #define DD_TRI_SMOOTH   (1 << 3)
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index f33bf08..e5e98dc 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -54,16 +54,6 @@
 #include "blend.h"
 
 
-static void
-update_separate_specular(struct gl_context *ctx)
-{
-   if (_mesa_need_secondary_color(ctx))
-  ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
-   else
-  ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
-}
-
-
 /**
  * Update the following fields:
  *   ctx->VertexProgram._Enabled
@@ -392,8 +382,6 @@ update_tricaps(str

Mesa (master): draw/gs: make sure geometry shaders don't overflow

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: f01f754ca13373d62f5f4ba5ff76d83aa4eac62b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f01f754ca13373d62f5f4ba5ff76d83aa4eac62b

Author: Zack Rusin 
Date:   Tue Apr 16 20:31:22 2013 -0700

draw/gs: make sure geometry shaders don't overflow

The specification says that the geometry shader should exit if the
number of emitted vertices is bigger or equal to max_output_vertices and
we can't do that because we're running in the SoA mode, which means that
our storing routines will keep getting called on channels that have
overflown (even though they will be masked out, but we just can't skip
them).
So we need some scratch area where we can keep writing the overflown
vertices without overwriting anything important or crashing.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/draw/draw_gs.c|   50 +++---
 src/gallium/auxiliary/draw/draw_gs.h|1 +
 src/gallium/auxiliary/draw/draw_llvm.c  |6 +-
 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h |1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   34 +++-
 5 files changed, 81 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index 987c01a..2f94eae 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -280,6 +280,7 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
int max_prims_per_invocation = 0;
char *output_ptr = (char*)shader->gs_output;
int i, j, prim_idx;
+   unsigned next_prim_boundary = shader->primitive_boundary;
 
for (i = 0; i < shader->vector_length; ++i) {
   int prims = shader->llvm_emitted_primitives[i];
@@ -290,19 +291,42 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
   total_verts += shader->llvm_emitted_vertices[i];
}
 
-
output_ptr += shader->emitted_vertices * shader->vertex_size;
for (i = 0; i < shader->vector_length - 1; ++i) {
   int current_verts = shader->llvm_emitted_vertices[i];
-
-  if (current_verts != shader->max_output_vertices) {
- memcpy(output_ptr + (vertex_count + current_verts) * 
shader->vertex_size,
-output_ptr + (vertex_count + shader->max_output_vertices) * 
shader->vertex_size,
-shader->vertex_size * (total_verts - vertex_count));
+  int next_verts = shader->llvm_emitted_vertices[i + 1];
+#if 0
+  int j; 
+  for (j = 0; j < current_verts; ++j) {
+ struct vertex_header *vh = (struct vertex_header *)
+(output_ptr + shader->vertex_size * (i * next_prim_boundary + j));
+ debug_printf("--- %d) [%f, %f, %f, %f]\n", j + vertex_count,
+  vh->data[0][0], vh->data[0][1], vh->data[0][2], 
vh->data[0][3]);
+ 
+  }
+#endif
+  debug_assert(current_verts <= shader->max_output_vertices);
+  debug_assert(next_verts <= shader->max_output_vertices);
+  if (next_verts) {
+ memmove(output_ptr + (vertex_count + current_verts) * 
shader->vertex_size,
+ output_ptr + ((i + 1) * next_prim_boundary) * 
shader->vertex_size,
+ shader->vertex_size * next_verts);
   }
   vertex_count += current_verts;
}
 
+#if 0
+   {
+  int i;
+  for (i = 0; i < total_verts; ++i) {
+ struct vertex_header *vh = (struct vertex_header *)(output_ptr + 
shader->vertex_size * i);
+ debug_printf("%d) [%f, %f, %f, %f]\n", i,
+  vh->data[0][0], vh->data[0][1], vh->data[0][2], 
vh->data[0][3]);
+ 
+  }
+   }
+#endif
+
prim_idx = 0;
for (i = 0; i < shader->vector_length; ++i) {
   int num_prims = shader->llvm_emitted_primitives[i];
@@ -513,10 +537,12 @@ int draw_geometry_shader_run(struct draw_geometry_shader 
*shader,
 
output_verts->vertex_size = vertex_size;
output_verts->stride = output_verts->vertex_size;
+   /* we allocate exactly one extra vertex per primitive to allow the GS to 
emit
+* overflown vertices into some area where they won't harm anyone */
output_verts->verts =
   (struct vertex_header *)MALLOC(output_verts->vertex_size *
  max_out_prims *
- shader->max_output_vertices);
+ shader->primitive_boundary);
 
 #if 0
debug_printf("%s count = %d (in prims # = %d)\n",
@@ -724,6 +750,16 @@ draw_create_geometry_shader(struct draw_context *draw,
TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES)
  gs->max_output_vertices = gs->info.properties[i].data[0];
}
+   /* Primitive boundary is bigger than max_output_vertices by one, because
+* the specification says that the geometry shader should exit if the 
+* number of emitted vertices is bigger or equal to max_output_vertices and
+* we can't do that because we're running in the SoA mode, which means 

Mesa (master): draw: implement pipeline statistics in the draw module

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: 80ee4a407a2668f6a6a410c3e56ae9910510f773
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=80ee4a407a2668f6a6a410c3e56ae9910510f773

Author: Zack Rusin 
Date:   Thu Apr 11 06:11:29 2013 -0700

draw: implement pipeline statistics in the draw module

This is a basic implementation of the pipeline statistics in the
draw module. The interface is similar to the stream output statistics
and also requires that the callers explicitly enable it.
Included is the implementation of the interface in llvmpipe and
softpipe. Only softpipe enables the pipeline statistics capability
though because llvmpipe is lacking gathering of the fragment shading
and rasterization statistics.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/draw/draw_context.c  |   16 
 src/gallium/auxiliary/draw/draw_context.h  |7 
 src/gallium/auxiliary/draw/draw_gs.c   |   24 ++--
 src/gallium/auxiliary/draw/draw_private.h  |3 ++
 src/gallium/auxiliary/draw/draw_pt.c   |   11 ++
 src/gallium/auxiliary/draw/draw_pt_emit.c  |   15 +++-
 .../auxiliary/draw/draw_pt_fetch_shade_pipeline.c  |6 +++
 .../draw/draw_pt_fetch_shade_pipeline_llvm.c   |7 
 src/gallium/auxiliary/draw/draw_vbuf.h |8 
 src/gallium/auxiliary/util/u_prim.h|   35 ++
 src/gallium/drivers/llvmpipe/lp_context.h  |3 ++
 src/gallium/drivers/llvmpipe/lp_draw_arrays.c  |2 +
 src/gallium/drivers/llvmpipe/lp_query.c|   37 +++
 src/gallium/drivers/llvmpipe/lp_query.h|2 +
 src/gallium/drivers/llvmpipe/lp_rast.c |2 +
 src/gallium/drivers/llvmpipe/lp_setup_vbuf.c   |   23 
 src/gallium/drivers/softpipe/sp_context.h  |3 ++
 src/gallium/drivers/softpipe/sp_draw_arrays.c  |3 ++
 src/gallium/drivers/softpipe/sp_prim_vbuf.c|   23 
 src/gallium/drivers/softpipe/sp_quad_fs.c  |5 +++
 src/gallium/drivers/softpipe/sp_query.c|   39 +++-
 src/gallium/drivers/softpipe/sp_screen.c   |2 +-
 src/gallium/drivers/softpipe/sp_setup.c|4 ++
 23 files changed, 258 insertions(+), 22 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_context.c 
b/src/gallium/auxiliary/draw/draw_context.c
index 2fb9bac..0f98021 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -842,3 +842,19 @@ draw_get_shader_param(unsigned shader, enum 
pipe_shader_cap param)
return draw_get_shader_param_no_llvm(shader, param);
 }
 
+/**
+ * Enables or disables collection of statistics.
+ *
+ * Draw module is capable of generating statistics for the vertex
+ * processing pipeline. Collection of that data isn't free and so
+ * it's disabled by default. The users of the module can enable
+ * (or disable) this functionality through this function.
+ * The actual data will be emitted through the VBUF interface,
+ * the 'pipeline_statistics' callback to be exact.
+ */
+void
+draw_collect_pipeline_statistics(struct draw_context *draw,
+ boolean enable)
+{
+   draw->collect_statistics = enable;
+}
diff --git a/src/gallium/auxiliary/draw/draw_context.h 
b/src/gallium/auxiliary/draw/draw_context.h
index 1d25b7f..94fac88 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -264,6 +264,13 @@ void draw_set_driver_clipping( struct draw_context *draw,
 void draw_set_force_passthrough( struct draw_context *draw, 
  boolean enable );
 
+
+/***
+ * Draw statistics
+ */
+void draw_collect_pipeline_statistics(struct draw_context *draw,
+  boolean enable);
+
 
/***
  * Draw pipeline 
  */
diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index d95a4c5..f8cb04a 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -353,6 +353,10 @@ static void gs_flush(struct draw_geometry_shader *shader)
 
unsigned input_primitives = shader->fetched_prim_count;
 
+   if (shader->draw->collect_statistics) {
+  shader->draw->statistics.gs_invocations += input_primitives;
+   }
+
debug_assert(input_primitives > 0 &&
 input_primitives <= 4);
 
@@ -493,11 +497,14 @@ int draw_geometry_shader_run(struct draw_geometry_shader 
*shader,
   input_prim->count;
unsigned num_in_primitives =
   align(
- MAX2(u_gs_prims_for_vertices(input_prim->prim, num_input_verts),
-  u_gs_prims_for_vertices(shader->input_primitive, 
num_input_verts)),
+ MAX2(u_decomposed_

Mesa (master): draw/gs: Return early if the passed geometry shader is null

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: be497ac9d3b5c50a4cd126578081bd54b68f16a9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=be497ac9d3b5c50a4cd126578081bd54b68f16a9

Author: Zack Rusin 
Date:   Tue Apr 16 20:17:08 2013 -0700

draw/gs: Return early if the passed geometry shader is null

Can happen if we were using stream output without geometry
shader, by returning early we avoid a crash.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/draw/draw_gs.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index f8cb04a..987c01a 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -788,6 +788,9 @@ void draw_bind_geometry_shader(struct draw_context *draw,
 void draw_delete_geometry_shader(struct draw_context *draw,
  struct draw_geometry_shader *dgs)
 {
+   if (!dgs) {
+  return;
+   }
 #ifdef HAVE_LLVM
if (draw_get_option_use_llvm()) {
   struct llvm_geometry_shader *shader = llvm_geometry_shader(dgs);

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


Mesa (master): gallivm/gs: fix the end primitive calls

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: b739376cffec19870804b1ebd4bef3c2f654e943
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b739376cffec19870804b1ebd4bef3c2f654e943

Author: Zack Rusin 
Date:   Thu Apr 11 02:22:06 2013 -0700

gallivm/gs: fix the end primitive calls

The issue with SOA execution and end_primitive opcode is that it
can be executed both when we haven't emitted any vertices, in
which case we don't want to emit an empty primitive, and when
the execution mask is zero and the execution should be skipped. We
handled only the latter of those conditions. Now we're combining the
execution mask with a mask created from emitted vertices to handle
both cases. As a result we don't need the pending_end_primitive
flag which was broken because it was static and could be affected
by both above mentioned conditions at run-time.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi.h |6 --
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   71 ---
 2 files changed, 50 insertions(+), 27 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 23ccacc..f1b1d79 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -396,12 +396,6 @@ struct lp_build_tgsi_soa_context
LLVMValueRef emitted_prims_vec_ptr;
LLVMValueRef total_emitted_vertices_vec_ptr;
LLVMValueRef emitted_vertices_vec_ptr;
-   /* if a shader doesn't have ENDPRIM instruction but it has
-* a number of EMIT instructions it means the END instruction
-* implicitly invokes ENDPRIM. handle this via a flag here
-* in the future maybe we can enforce TGSI to always have
-* an explicit ENDPRIM */
-   boolean pending_end_primitive;
 
LLVMValueRef consts_ptr;
const LLVMValueRef *pos;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 7396536..9822f72 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -65,6 +65,7 @@
 #include "lp_bld_sample.h"
 #include "lp_bld_struct.h"
 
+#define DUMP_GS_EMITS 0
 
 static void lp_exec_mask_init(struct lp_exec_mask *mask, struct 
lp_build_context *bld)
 {
@@ -2278,27 +2279,25 @@ emit_vertex(
   increment_vec_ptr_by_mask(bld_base, bld->total_emitted_vertices_vec_ptr,
 masked_ones);
 #if DUMP_GS_EMITS
-  lp_build_print_value(bld->bld_base.base.gallivm, " +++ emit vertex 
masked ones = ",
+  lp_build_print_value(bld->bld_base.base.gallivm,
+   " +++ emit vertex masked ones = ",
masked_ones);
-  lp_build_print_value(bld->bld_base.base.gallivm, " +++ emit vertex 
emitted = ",
+  lp_build_print_value(bld->bld_base.base.gallivm,
+   " +++ emit vertex emitted = ",
total_emitted_vertices_vec);
 #endif
-  bld->pending_end_primitive = TRUE;
}
 }
 
 
 static void
-end_primitive(
-   const struct lp_build_tgsi_action * action,
-   struct lp_build_tgsi_context * bld_base,
-   struct lp_build_emit_data * emit_data)
+end_primitive_masked(struct lp_build_tgsi_context * bld_base,
+ LLVMValueRef masked_ones)
 {
struct lp_build_tgsi_soa_context * bld = lp_soa_context(bld_base);
LLVMBuilderRef builder = bld->bld_base.base.gallivm->builder;
 
if (bld->gs_iface->end_primitive) {
-  LLVMValueRef masked_ones = mask_to_one_vec(bld_base);
   LLVMValueRef emitted_vertices_vec =
  LLVMBuildLoad(builder, bld->emitted_vertices_vec_ptr, "");
   LLVMValueRef emitted_prims_vec =
@@ -2309,23 +2308,55 @@ end_primitive(
emitted_prims_vec);
 
 #if DUMP_GS_EMITS
-  lp_build_print_value(bld->bld_base.base.gallivm, " +++ end prim masked 
ones = ",
+  lp_build_print_value(bld->bld_base.base.gallivm,
+   " +++ end prim masked ones = ",
masked_ones);
-  lp_build_print_value(bld->bld_base.base.gallivm, " +++ end prim emitted 
verts1 = ",
+  lp_build_print_value(bld->bld_base.base.gallivm,
+   " +++ end prim emitted verts1 = ",
emitted_vertices_vec);
-  lp_build_print_value(bld->bld_base.base.gallivm, " +++ end prim emitted 
prims1 = ",
-   LLVMBuildLoad(builder, bld->emitted_prims_vec_ptr, 
""));
+  lp_build_print_value(bld->bld_base.base.gallivm,
+   " +++ end prim emitted prims1 = ",
+   LLVMBuildLoad(builder,
+ bld->emitted_prims_vec_ptr, ""));
 #endif
   increment_vec_ptr_by_mask(bld_base, bld->emitted_prims_vec_ptr,
 masked_ones);
   clear_uint_vec_ptr_from_mask(bld_base, bld

Mesa (master): tgsi/exec: geometry shaders are executed on a single primitive

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: 93627e33cc4c4e8f800fdb61693c1107e6cdcd2e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=93627e33cc4c4e8f800fdb61693c1107e6cdcd2e

Author: Zack Rusin 
Date:   Wed Apr 10 15:28:01 2013 -0700

tgsi/exec: geometry shaders are executed on a single primitive

which means that our execution mask in GS is equal to 1 not 0xf.

Signed-off-by: Zack Rusin 
Reviewed-by: Jose Fonseca 
Reviewed-by: Brian Paul 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c |   30 +-
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 3de1573..8b46785 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -4422,14 +4422,25 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
 {
uint i;
int pc = 0;
+   uint default_mask = 0xf;
 
-   mach->CondMask = 0xf;
-   mach->LoopMask = 0xf;
-   mach->ContMask = 0xf;
-   mach->FuncMask = 0xf;
-   mach->ExecMask = 0xf;
+   mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] = 0;
+   mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] = 0;
+
+   if( mach->Processor == TGSI_PROCESSOR_GEOMETRY ) {
+  mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0] = 0;
+  mach->Primitives[0] = 0;
+  /* GS runs on a single primitive for now */
+  default_mask = 0x1;
+   }
+
+   mach->CondMask = default_mask;
+   mach->LoopMask = default_mask;
+   mach->ContMask = default_mask;
+   mach->FuncMask = default_mask;
+   mach->ExecMask = default_mask;
 
-   mach->Switch.mask = 0xf;
+   mach->Switch.mask = default_mask;
 
assert(mach->CondStackTop == 0);
assert(mach->LoopStackTop == 0);
@@ -4438,13 +4449,6 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach )
assert(mach->BreakStackTop == 0);
assert(mach->CallStackTop == 0);
 
-   mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] = 0;
-   mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] = 0;
-
-   if( mach->Processor == TGSI_PROCESSOR_GEOMETRY ) {
-  mach->Temps[TEMP_PRIMITIVE_I].xyzw[TEMP_PRIMITIVE_C].u[0] = 0;
-  mach->Primitives[0] = 0;
-   }
 
/* execute declarations (interpolants) */
for (i = 0; i < mach->NumDeclarations; i++) {

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


Mesa (master): tgsi/exec: fix the udiv and umod instructions

2013-04-17 Thread Zack Rusin
Module: Mesa
Branch: master
Commit: 88db6f0a73cd988b14e95e5f506b4e5ac355f065
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=88db6f0a73cd988b14e95e5f506b4e5ac355f065

Author: Zack Rusin 
Date:   Wed Apr 10 15:25:18 2013 -0700

tgsi/exec: fix the udiv and umod instructions

Same as with llvmpipe: we can't be divind/moding by zero and we
need to make sure that dividing/moding by zero produces 0x.

Signed-off-by: Zack Rusin 
Reviewed-by: Brian Paul 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/tgsi/tgsi_exec.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 05f749e..3de1573 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -3445,10 +3445,10 @@ micro_udiv(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
 {
-   dst->u[0] = src0->u[0] / src1->u[0];
-   dst->u[1] = src0->u[1] / src1->u[1];
-   dst->u[2] = src0->u[2] / src1->u[2];
-   dst->u[3] = src0->u[3] / src1->u[3];
+   dst->u[0] = src1->u[0] ? src0->u[0] / src1->u[0] : ~0u;
+   dst->u[1] = src1->u[1] ? src0->u[1] / src1->u[1] : ~0u;
+   dst->u[2] = src1->u[2] ? src0->u[2] / src1->u[2] : ~0u;
+   dst->u[3] = src1->u[3] ? src0->u[3] / src1->u[3] : ~0u;
 }
 
 static void
@@ -3490,10 +3490,10 @@ micro_umod(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
 {
-   dst->u[0] = src0->u[0] % src1->u[0];
-   dst->u[1] = src0->u[1] % src1->u[1];
-   dst->u[2] = src0->u[2] % src1->u[2];
-   dst->u[3] = src0->u[3] % src1->u[3];
+   dst->u[0] = src1->u[0] ? src0->u[0] % src1->u[0] : ~0u;
+   dst->u[1] = src1->u[1] ? src0->u[1] % src1->u[1] : ~0u;
+   dst->u[2] = src1->u[2] ? src0->u[2] % src1->u[2] : ~0u;
+   dst->u[3] = src1->u[3] ? src0->u[3] % src1->u[3] : ~0u;
 }
 
 static void

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


Mesa (master): gallivm: JIT symbol resolution with linux perf.

2013-04-17 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: b8f6858fcb762b47ca2ad30efd286bd203042f17
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8f6858fcb762b47ca2ad30efd286bd203042f17

Author: José Fonseca 
Date:   Wed Apr 17 13:32:15 2013 +0100

gallivm: JIT symbol resolution with linux perf.

Details on docs/llvmpipe.html

Reviewed-by: Brian Paul 
Reviewed-by: Roland Scheidegger 

---

 bin/perf-annotate-jit  |  251 
 configure.ac   |7 -
 docs/llvmpipe.html |   40 ++--
 src/gallium/auxiliary/gallivm/lp_bld_debug.cpp |  117 +---
 src/gallium/auxiliary/gallivm/lp_bld_debug.h   |6 +-
 src/gallium/auxiliary/gallivm/lp_bld_init.c|   11 +-
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp  |   23 ---
 src/gallium/auxiliary/gallivm/lp_bld_misc.h|3 -
 8 files changed, 372 insertions(+), 86 deletions(-)

diff --git a/bin/perf-annotate-jit b/bin/perf-annotate-jit
new file mode 100755
index 000..7464340
--- /dev/null
+++ b/bin/perf-annotate-jit
@@ -0,0 +1,251 @@
+#!/usr/bin/env python
+#
+# Copyright 2012 VMware Inc
+# Copyright 2008-2009 Jose Fonseca
+#
+# 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 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.
+#
+
+"""Perf annotate for JIT code.
+
+Linux `perf annotate` does not work with JIT code.  This script takes the data
+produced by `perf script` command, plus the diassemblies outputed by gallivm
+into /tmp/perf-X.map.asm and produces output similar to `perf annotate`.
+
+See docs/llvmpipe.html for usage instructions.
+
+The `perf script` output parser was derived from the gprof2dot.py script.
+"""
+
+
+import sys
+import os.path
+import re
+import optparse
+import subprocess
+
+
+class Parser:
+"""Parser interface."""
+
+def __init__(self):
+pass
+
+def parse(self):
+raise NotImplementedError
+
+
+class LineParser(Parser):
+"""Base class for parsers that read line-based formats."""
+
+def __init__(self, file):
+Parser.__init__(self)
+self._file = file
+self.__line = None
+self.__eof = False
+self.line_no = 0
+
+def readline(self):
+line = self._file.readline()
+if not line:
+self.__line = ''
+self.__eof = True
+else:
+self.line_no += 1
+self.__line = line.rstrip('\r\n')
+
+def lookahead(self):
+assert self.__line is not None
+return self.__line
+
+def consume(self):
+assert self.__line is not None
+line = self.__line
+self.readline()
+return line
+
+def eof(self):
+assert self.__line is not None
+return self.__eof
+
+
+mapFile = None
+
+def lookupMap(filename, matchSymbol):
+global mapFile
+mapFile = filename
+stream = open(filename, 'rt')
+for line in stream:
+start, length, symbol = line.split()
+
+start = int(start, 16)
+length = int(length,16)
+
+if symbol == matchSymbol:
+return start
+
+return None
+
+def lookupAsm(filename, desiredFunction):
+stream = open(filename + '.asm', 'rt')
+while stream.readline() != desiredFunction + ':\n':
+pass
+
+asm = []
+line = stream.readline().strip()
+while line:
+addr, instr = line.split(':', 1)
+addr = int(addr)
+asm.append((addr, instr))
+line = stream.readline().strip()
+
+return asm
+
+
+
+samples = {}
+
+
+class PerfParser(LineParser):
+"""Parser for linux perf callgraph output.
+
+It expects output generated with
+
+perf record -g
+perf script
+"""
+
+def __init__(self, infile, symbol):
+LineParser.__init__(self, infile)
+   self.symbol = symbol
+
+def readline(self):
+# Override LineParser.readline to ignore comment lines
+while True:
+LineParser.readline(self)
+if self.eof() or not self.lookahead().st

Mesa (master): draw: Silence uninitialized var warnings.

2013-04-17 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 35ef27d485367ffede9f478c9865515814e119b7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=35ef27d485367ffede9f478c9865515814e119b7

Author: José Fonseca 
Date:   Wed Apr 17 13:32:46 2013 +0100

draw: Silence uninitialized var warnings.

Trivial.

---

 src/gallium/auxiliary/draw/draw_gs.c   |7 ---
 src/gallium/auxiliary/draw/draw_llvm.c |3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c 
b/src/gallium/auxiliary/draw/draw_gs.c
index 70db837..d95a4c5 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -643,13 +643,14 @@ draw_create_geometry_shader(struct draw_context *draw,
 const struct pipe_shader_state *state)
 {
 #ifdef HAVE_LLVM
+   boolean use_llvm = draw_get_option_use_llvm();
struct llvm_geometry_shader *llvm_gs;
 #endif
struct draw_geometry_shader *gs;
unsigned i;
 
 #ifdef HAVE_LLVM
-   if (draw_get_option_use_llvm()) {
+   if (use_llvm) {
   llvm_gs = CALLOC_STRUCT(llvm_geometry_shader);
 
   if (llvm_gs == NULL)
@@ -684,7 +685,7 @@ draw_create_geometry_shader(struct draw_context *draw,
gs->max_out_prims = 0;
 
 #ifdef HAVE_LLVM
-   if (draw_get_option_use_llvm()) {
+   if (use_llvm) {
   /* TODO: change the input array to handle the following
  vector length, instead of the currently hardcoded
  TGSI_NUM_CHANNELS
@@ -717,7 +718,7 @@ draw_create_geometry_shader(struct draw_context *draw,
gs->machine = draw->gs.tgsi.machine;
 
 #ifdef HAVE_LLVM
-   if (draw_get_option_use_llvm()) {
+   if (use_llvm) {
   int vector_size = gs->vector_length * sizeof(float);
   gs->gs_input = align_malloc(sizeof(struct draw_gs_inputs), 16);
   memset(gs->gs_input, 0, sizeof(struct draw_gs_inputs));
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c 
b/src/gallium/auxiliary/draw/draw_llvm.c
index 5100ce0..0e34978 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1742,6 +1742,9 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
   assert(sview_idx < Elements(draw->llvm->gs_jit_context.textures));
 
   jit_tex = &draw->llvm->gs_jit_context.textures[sview_idx];
+   } else {
+  assert(0);
+  return;
}
 
jit_tex->width = width;

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


Mesa (master): r600g/llvm: Use gprcount from llvm

2013-04-17 Thread Vincent Lejeune
Module: Mesa
Branch: master
Commit: 2b9ed257c0c4db879970afb2c5981c59ca70c21b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b9ed257c0c4db879970afb2c5981c59ca70c21b

Author: Vincent Lejeune 
Date:   Sat Apr 13 16:36:02 2013 +0200

r600g/llvm: Use gprcount from llvm

---

 src/gallium/drivers/r600/r600_llvm.c |2 ++
 src/gallium/drivers/r600/r600_llvm.h |1 +
 src/gallium/drivers/r600/r600_shader.c   |2 +-
 src/gallium/drivers/radeon/LLVM_REVISION.txt |2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c 
b/src/gallium/drivers/r600/r600_llvm.c
index e605e6b..35d6c90 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -555,6 +555,7 @@ unsigned r600_llvm_compile(
unsigned char ** inst_bytes,
unsigned * inst_byte_count,
enum radeon_family family,
+   unsigned *ngpr,
unsigned dump)
 {
unsigned r;
@@ -563,6 +564,7 @@ unsigned r600_llvm_compile(
r = radeon_llvm_compile(mod, &binary, gpu_family, dump);
*inst_bytes = binary.code;
*inst_byte_count = binary.code_size;
+   *ngpr = util_le32_to_cpu(*(uint32_t*)binary.config);
return r;
 }
 
diff --git a/src/gallium/drivers/r600/r600_llvm.h 
b/src/gallium/drivers/r600/r600_llvm.h
index b5e2af2..afc6881 100644
--- a/src/gallium/drivers/r600/r600_llvm.h
+++ b/src/gallium/drivers/r600/r600_llvm.h
@@ -20,6 +20,7 @@ unsigned r600_llvm_compile(
unsigned char ** inst_bytes,
unsigned * inst_byte_count,
enum radeon_family family,
+   unsigned *ngpr,
unsigned dump);
 
 #endif /* defined R600_USE_LLVM || defined HAVE_OPENCL */
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 5ac8c09..465186d 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1461,7 +1461,7 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
mod = r600_tgsi_llvm(&radeon_llvm_ctx, tokens);
 
if (r600_llvm_compile(mod, &inst_bytes, &inst_byte_count,
- rscreen->family, dump)) {
+ rscreen->family, &ctx.bc->ngpr, dump)) {
FREE(inst_bytes);
radeon_llvm_dispose(&radeon_llvm_ctx);
use_llvm = 0;
diff --git a/src/gallium/drivers/radeon/LLVM_REVISION.txt 
b/src/gallium/drivers/radeon/LLVM_REVISION.txt
index 3ff0602..b633ea6 100644
--- a/src/gallium/drivers/radeon/LLVM_REVISION.txt
+++ b/src/gallium/drivers/radeon/LLVM_REVISION.txt
@@ -1 +1 @@
-@179546
+@179684

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


Mesa (master): intel: Add a null pointer check before dereferencing the pointer

2013-04-17 Thread Anuj Phogat
Module: Mesa
Branch: master
Commit: 484b89ace99cb34719ff79c6aab1658bb8f3dc79
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=484b89ace99cb34719ff79c6aab1658bb8f3dc79

Author: Anuj Phogat 
Date:   Tue Apr 16 10:34:43 2013 -0700

intel: Add a null pointer check before dereferencing the pointer

Reviewed-by: Jordan Justen 
Reviewed-by: Matt Turner 

---

 src/mesa/drivers/dri/intel/intel_screen.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 16750f2..00e7bc6 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -368,6 +368,9 @@ intel_create_image_from_name(__DRIscreen *screen,
 int cpp;
 
 image = intel_allocate_image(format, loaderPrivate);
+if (image == NULL)
+   return NULL;
+
 if (image->format == MESA_FORMAT_NONE)
cpp = 1;
 else
@@ -504,6 +507,9 @@ intel_create_image(__DRIscreen *screen,
}
 
image = intel_allocate_image(format, loaderPrivate);
+   if (image == NULL)
+  return NULL;
+
cpp = _mesa_get_format_bytes(image->format);
image->region =
   intel_region_alloc(intelScreen, tiling, cpp, width, height, true);
@@ -707,6 +713,9 @@ intel_from_planar(__DRIimage *parent, int plane, void 
*loaderPrivate)
 stride = parent->strides[index];
 
 image = intel_allocate_image(dri_format, loaderPrivate);
+if (image == NULL)
+   return NULL;
+
 if (offset + height * stride > parent->region->bo->size) {
_mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds");
free(image);

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


Mesa (master): docs: Update 'Making new mesa release'

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: b03f6de63b05a3064d6d33e3c0a429ca97ba2be8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b03f6de63b05a3064d6d33e3c0a429ca97ba2be8

Author: Emil Velikov 
Date:   Fri Apr 12 12:41:52 2013 +0100

docs: Update 'Making new mesa release'

Add a note to update PACKAGE_VERSION for Android and scons builds

Signed-off-by: Emil Velikov 
Reviewed-by: Brian Paul 

---

 docs/devinfo.html |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index 5c03344..7176824 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -197,6 +197,8 @@ branch is relevant.
 
 
   Makefile.am
+  SConstruct
+  Android.common.mk
   PACKAGE_VERSION
   configure.ac
   AC_INIT

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


Mesa (master): docs: Add some missing release notes

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 91984a732e7ce8517250d39699bb6c2b47256ba6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=91984a732e7ce8517250d39699bb6c2b47256ba6

Author: Emil Velikov 
Date:   Fri Apr 12 12:41:51 2013 +0100

docs: Add some missing release notes

Signed-off-by: Emil Velikov 
Reviewed-by: Brian Paul 

---

 docs/relnotes.html |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/docs/relnotes.html b/docs/relnotes.html
index 049a979..819d2ce 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -22,6 +22,7 @@ The release notes summarize what's new or changed in each 
Mesa release.
 
 
 9.2 release notes
+9.1.1 release notes
 9.1 release notes
 9.0.3 release notes
 9.0.2 release notes
@@ -83,10 +84,12 @@ Versions of Mesa prior to 6.4 are summarized in the
 
 
 6.3.2 release notes
+6.3.1 release notes
 6.3 release notes
 6.2.1 release notes
 6.2 release notes
 6.1 release notes
+6.0.1 release notes
 6.0 release notes
 5.1 release notes
 5.0.2 release notes

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


Mesa (master): docs: move specs to a separate folder

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: cf9bf1d4a6dc3b26e2aa192517611eba3aa5be00
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf9bf1d4a6dc3b26e2aa192517611eba3aa5be00

Author: Emil Velikov 
Date:   Fri Apr 12 12:41:50 2013 +0100

docs: move specs to a separate folder

Handle legacy/obsolete specs as well
List all specs in extensions.html
Mark 'OLD' extensions as obsolete in extensions.html
Update the spec location in old relnotes

Signed-off-by: Emil Velikov 
Reviewed-by: Brian Paul 

---

 docs/extensions.html   |   34 ---
 docs/relnotes/5.1  |2 +-
 docs/{ => specs}/MESA_agp_offset.spec  |0
 docs/{ => specs}/MESA_copy_sub_buffer.spec |0
 docs/{ => specs}/MESA_drm_image.spec   |0
 docs/{ => specs}/MESA_multithread_makecurrent.spec |0
 docs/{ => specs}/MESA_pack_invert.spec |0
 docs/{ => specs}/MESA_pixmap_colormap.spec |0
 docs/{ => specs}/MESA_release_buffers.spec |0
 docs/{ => specs}/MESA_resize_buffers.spec  |0
 docs/{ => specs}/MESA_set_3dfx_mode.spec   |0
 docs/{ => specs}/MESA_shader_debug.spec|0
 docs/{ => specs}/MESA_swap_control.spec|0
 docs/{ => specs}/MESA_swap_frame_usage.spec|0
 docs/{ => specs}/MESA_texture_array.spec   |0
 docs/{ => specs}/MESA_texture_signed_rgba.spec |0
 docs/{ => specs}/MESA_window_pos.spec  |0
 docs/{ => specs}/MESA_ycbcr_texture.spec   |0
 .../{ => specs}/OLD/MESA_packed_depth_stencil.spec |0
 docs/{ => specs}/OLD/MESA_program_debug.spec   |0
 docs/{ => specs}/OLD/MESA_sprite_point.spec|0
 docs/{ => specs}/OLD/MESA_trace.spec   |0
 docs/{ => specs}/WL_bind_wayland_display.spec  |0
 docs/{ => specs}/enums.txt |0
 docs/xlibdriver.html   |6 ++--
 25 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/docs/extensions.html b/docs/extensions.html
index 5d790fb..40f59d3 100644
--- a/docs/extensions.html
+++ b/docs/extensions.html
@@ -23,19 +23,27 @@ The specifications follow.
 
 
 
-MESA_agp_offset.spec
-MESA_copy_sub_buffer.spec
-MESA_packed_depth_stencil.spec
-MESA_pack_invert.spec
-MESA_pixmap_colormap.spec
-MESA_release_buffers.spec
-MESA_resize_buffers.spec
-MESA_set_3dfx_mode.spec
-MESA_sprite_point.spec (obsolete)
-MESA_texture_signed_rgba.spec
-MESA_trace.spec (obsolete)
-MESA_window_pos.spec
-MESA_ycbcr_texture.spec
+MESA_agp_offset.spec
+MESA_copy_sub_buffer.spec
+MESA_drm_image.spec
+MESA_multithread_makecurrent.spec
+MESA_packed_depth_stencil.spec
 (obsolete)
+MESA_pack_invert.spec
+MESA_pixmap_colormap.spec
+MESA_program_debug.spec 
(obsolete)
+MESA_release_buffers.spec
+MESA_resize_buffers.spec
+MESA_set_3dfx_mode.spec
+MESA_shader_debug.spec
+MESA_sprite_point.spec 
(obsolete)
+MESA_swap_control.spec
+MESA_swap_frame_usage.spec
+MESA_texture_array.spec
+MESA_texture_signed_rgba.spec
+MESA_trace.spec (obsolete)
+MESA_window_pos.spec
+MESA_ycbcr_texture.spec
+WL_bind_wayland_display.spec
 
 
 
diff --git a/docs/relnotes/5.1 b/docs/relnotes/5.1
index aed6e10..59b7964 100644
--- a/docs/relnotes/5.1
+++ b/docs/relnotes/5.1
@@ -106,7 +106,7 @@ Vertex/Fragment program debugger
 
 GL_MESA_program_debug is an experimental extension to support
 interactive debugging of vertex and fragment programs.  See the
-docs/MESA_program_debug.spec file for details.
+docs/specs/OLD/MESA_program_debug.spec file for details.
 
 The bulk of the vertex/fragment program debugger is implemented
 outside of Mesa.  The GL_MESA_program_debug extension just has minimal
diff --git a/docs/MESA_agp_offset.spec b/docs/specs/MESA_agp_offset.spec
similarity index 100%
rename from docs/MESA_agp_offset.spec
rename to docs/specs/MESA_agp_offset.spec
diff --git a/docs/MESA_copy_sub_buffer.spec 
b/docs/specs/MESA_copy_sub_buffer.spec
similarity index 100%
rename from docs/MESA_copy_sub_buffer.spec
rename to docs/specs/MESA_copy_sub_buffer.spec
diff --git a/docs/MESA_drm_image.spec b/docs/specs/MESA_drm_image.spec
similarity index 100%
rename from docs/MESA_drm_image.spec
rename to docs/specs/MESA_drm_image.spec
diff --git a/docs/MESA_multithread_makecurrent.spec 
b/docs/specs/MESA_multithread_makecurrent.spec
similarity index 100%
rename from docs/MESA_multithread_makecurrent.spec
rename to docs/specs/MESA_multithread_makecurrent.spec
diff --git a/docs/MESA_pack_invert.spec b/docs/specs/MESA_pack_invert.spec
similarity index 100%
rename from docs/MESA_pack_invert.spec
rename to docs/specs/MESA_pack_invert.spec
diff --git a/docs/MESA_pixmap_colormap.spec 
b/docs/specs/MESA_pixmap_colormap.spec
similarity index 100%
rename from docs/MESA_pixmap_colormap.spec
rename to docs/specs/MESA_pixmap_colormap.spec
diff --git a/docs/MESA_release_buffers.spec 
b/docs/specs/MESA_release_buffers.spec
similarity inde

Mesa (master): docs: restructure release notes into separate folder

2013-04-17 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 5fd3b3b0857fc96b5e53a9a8bc3f11ddb3dc0ff7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fd3b3b0857fc96b5e53a9a8bc3f11ddb3dc0ff7

Author: Emil Velikov 
Date:   Fri Apr 12 12:41:49 2013 +0100

docs: restructure release notes into separate folder

relnotes-*html > relnotes/*html
RELNOTES-* > relnotes/*
fix links, css and frames

Signed-off-by: Emil Velikov 
Reviewed-by: Brian Paul 

---

 docs/devinfo.html  |6 +-
 docs/index.html|  106 +++---
 docs/relnotes.html |  152 ++--
 docs/{RELNOTES-3.1 => relnotes/3.1}|0
 docs/{RELNOTES-3.2 => relnotes/3.2}|0
 docs/{RELNOTES-3.2.1 => relnotes/3.2.1}|0
 docs/{RELNOTES-3.3 => relnotes/3.3}|0
 docs/{RELNOTES-3.4 => relnotes/3.4}|0
 docs/{RELNOTES-3.4.1 => relnotes/3.4.1}|0
 docs/{RELNOTES-3.4.2 => relnotes/3.4.2}|0
 docs/{RELNOTES-3.5 => relnotes/3.5}|0
 docs/{RELNOTES-4.0 => relnotes/4.0}|0
 docs/{RELNOTES-4.0.1 => relnotes/4.0.1}|0
 docs/{RELNOTES-4.0.2 => relnotes/4.0.2}|0
 docs/{RELNOTES-4.0.3 => relnotes/4.0.3}|0
 docs/{RELNOTES-4.1 => relnotes/4.1}|0
 docs/{RELNOTES-5.0 => relnotes/5.0}|0
 docs/{RELNOTES-5.0.1 => relnotes/5.0.1}|0
 docs/{RELNOTES-5.0.2 => relnotes/5.0.2}|0
 docs/{RELNOTES-5.1 => relnotes/5.1}|0
 docs/{RELNOTES-6.0 => relnotes/6.0}|0
 docs/{RELNOTES-6.0.1 => relnotes/6.0.1}|0
 docs/{RELNOTES-6.1 => relnotes/6.1}|0
 docs/{RELNOTES-6.2 => relnotes/6.2}|0
 docs/{RELNOTES-6.2.1 => relnotes/6.2.1}|0
 docs/{RELNOTES-6.3 => relnotes/6.3}|0
 docs/{RELNOTES-6.3.1 => relnotes/6.3.1}|0
 docs/{RELNOTES-6.3.2 => relnotes/6.3.2}|0
 docs/{RELNOTES-6.4 => relnotes/6.4}|0
 docs/{relnotes-6.4.1.html => relnotes/6.4.1.html}  |4 +-
 docs/{relnotes-6.4.2.html => relnotes/6.4.2.html}  |4 +-
 docs/{relnotes-6.4.html => relnotes/6.4.html}  |4 +-
 docs/{relnotes-6.5.1.html => relnotes/6.5.1.html}  |4 +-
 docs/{relnotes-6.5.2.html => relnotes/6.5.2.html}  |4 +-
 docs/{relnotes-6.5.3.html => relnotes/6.5.3.html}  |6 +-
 docs/{relnotes-6.5.html => relnotes/6.5.html}  |4 +-
 docs/{relnotes-7.0.1.html => relnotes/7.0.1.html}  |4 +-
 docs/{relnotes-7.0.2.html => relnotes/7.0.2.html}  |4 +-
 docs/{relnotes-7.0.3.html => relnotes/7.0.3.html}  |4 +-
 docs/{relnotes-7.0.4.html => relnotes/7.0.4.html}  |4 +-
 docs/{relnotes-7.0.html => relnotes/7.0.html}  |4 +-
 docs/{relnotes-7.1.html => relnotes/7.1.html}  |4 +-
 .../{relnotes-7.10.1.html => relnotes/7.10.1.html} |6 +-
 .../{relnotes-7.10.2.html => relnotes/7.10.2.html} |6 +-
 .../{relnotes-7.10.3.html => relnotes/7.10.3.html} |6 +-
 docs/{relnotes-7.10.html => relnotes/7.10.html}|8 +-
 .../{relnotes-7.11.1.html => relnotes/7.11.1.html} |6 +-
 .../{relnotes-7.11.2.html => relnotes/7.11.2.html} |6 +-
 docs/{relnotes-7.11.html => relnotes/7.11.html}|6 +-
 docs/{relnotes-7.2.html => relnotes/7.2.html}  |4 +-
 docs/{relnotes-7.3.html => relnotes/7.3.html}  |6 +-
 docs/{relnotes-7.4.1.html => relnotes/7.4.1.html}  |6 +-
 docs/{relnotes-7.4.2.html => relnotes/7.4.2.html}  |6 +-
 docs/{relnotes-7.4.3.html => relnotes/7.4.3.html}  |6 +-
 docs/{relnotes-7.4.4.html => relnotes/7.4.4.html}  |6 +-
 docs/{relnotes-7.4.html => relnotes/7.4.html}  |6 +-
 docs/{relnotes-7.5.1.html => relnotes/7.5.1.html}  |6 +-
 docs/{relnotes-7.5.2.html => relnotes/7.5.2.html}  |6 +-
 docs/{relnotes-7.5.html => relnotes/7.5.html}  |6 +-
 docs/{relnotes-7.6.1.html => relnotes/7.6.1.html}  |6 +-
 docs/{relnotes-7.6.html => relnotes/7.6.html}  |8 +-
 docs/{relnotes-7.7.1.html => relnotes/7.7.1.html}  |6 +-
 docs/{relnotes-7.7.html => relnotes/7.7.html}  |6 +-
 docs/{relnotes-7.8.1.html => relnotes/7.8.1.html}  |6 +-
 docs/{relnotes-7.8.2.html => relnotes/7.8.2.html}  |6 +-
 docs/{relnotes-7.8.3.html => relnotes/7.8.3.html}  |6 +-
 docs/{relnotes-7.8.html => relnotes/7.8.html}  |   10 +-
 docs/{relnotes-7.9.1.html => relnotes/7.9.1.html}  |6 +-
 docs/{relnotes-7.9.2.html => relnotes/7.9.2.html}  |6 +-
 docs/{relnotes-7.9.html => relnotes/7.9.html}  |8 +-
 docs/{relnotes-8.0.1.html => relnotes/8.0.1.html}  |6 +-
 docs/{relnotes-8.0.2.html => relnotes/8.0.2.html}  |6 +-
 docs/{relnotes-8.0.3.html => relnotes/8.0.3.html}  |6 +-
 docs/{relnotes-8.0.4.html => relnotes/8.0.4.html}  |6 +-
 docs/{relnotes-8.0.5.h

Mesa (master): gallium: Disambiguate TGSI_OPCODE_IF.

2013-04-17 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 50b3fc6204a28881f625605f988cb0866ae6a6a5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=50b3fc6204a28881f625605f988cb0866ae6a6a5

Author: José Fonseca 
Date:   Wed Apr 17 10:47:03 2013 +0100

gallium: Disambiguate TGSI_OPCODE_IF.

TGSI_OPCODE_IF condition had two possible interpretations:

- src.x != 0.0f

  - Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was false either for
vertex and fragment shaders
  - gallivm/llvmpipe
  - postprocess
  - vl state tracker
  - vega state tracker
  - most old drivers
  - old internal state trackers
  - many graw examples

- src.x != 0U

  - Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was true for both
vertex and fragment shaders
  - tgsi_exec/softpipe
  - r600
  - radeonsi
  - nv50

And drivers that use draw module also were a mess (because Mesa would
emit float IFs, but draw module supports native integers so it would
interpret IF arg as integers...)

This sort of works if the source argument is limited to float +0.0f or
+1.0f, integer 0, but would fail if source is float -0.0f, or integer in
the float NaN range.  It could also fail if source is integer 1, and
hardware flushes denormalized numbers to zero.

But with this change there are now two opcodes, IF and UIF, with clear
meaning.

Drivers that do not support native integers do not need to worry about
UIF.  However, for backwards compatibility with old state trackers and
examples, it is advisable that native integer capable drivers also
support the float IF opcode.

I tried to implement this for r600 and radeonsi based on the surrounding
code.  I couldn't do this for nouveau, so I just shunted IF/UIF
together, which matches the current behavior.

Reviewed-by: Roland Scheidegger 
Reviewed-by: Marek Olšák 

v2:
- Incorporate Roland's feedback.
- Fix r600_shader.c merge conflict.
- Fix typo in radeon, spotted by Michel Dänzer.
- Incorporte  Christoph Bumiller's patch to handle TGSI_OPCODE_IF(float)
  properly in nv50/ir.

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c |1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c|1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c   |1 +
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c|   17 
 src/gallium/auxiliary/tgsi/tgsi_dump.c |2 +
 src/gallium/auxiliary/tgsi/tgsi_exec.c |   22 ++
 src/gallium/auxiliary/tgsi/tgsi_info.c |3 +-
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h   |1 +
 src/gallium/docs/source/tgsi.rst   |   21 --
 .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp |5 ++-
 .../drivers/nv50/codegen/nv50_ir_lowering_nv50.cpp |2 +-
 .../drivers/nvc0/codegen/nv50_ir_lowering_nvc0.cpp |2 +-
 src/gallium/drivers/r600/r600_shader.c |   23 +++
 .../drivers/radeon/radeon_setup_tgsi_llvm.c|   41 ---
 src/gallium/include/pipe/p_shader_tokens.h |2 +-
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |8 +++-
 src/mesa/state_tracker/st_mesa_to_tgsi.c   |   12 +-
 17 files changed, 137 insertions(+), 27 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
index c71c1f1..e1c362b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -868,6 +868,7 @@ lp_set_default_actions(struct lp_build_tgsi_context * 
bld_base)
bld_base->op_actions[TGSI_OPCODE_COS].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_EX2].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_IF].fetch_args = scalar_unary_fetch_args;
+   bld_base->op_actions[TGSI_OPCODE_UIF].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_KIL].fetch_args = kil_fetch_args;
bld_base->op_actions[TGSI_OPCODE_KILP].fetch_args = kilp_fetch_args;
bld_base->op_actions[TGSI_OPCODE_RCP].fetch_args = scalar_unary_fetch_args;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
index 98bce0e..223184d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -837,6 +837,7 @@ lp_emit_instruction_aos(
   return FALSE;
 
case TGSI_OPCODE_IF:
+   case TGSI_OPCODE_UIF:
   return FALSE;
 
case TGSI_OPCODE_BGNLOOP:
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index 3c79abf..b00aa09 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -389,6 +389,7 @@ analyse_instruction(struct analysis_context *ctx,
 
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_IF:
+   case TGSI_OPCODE_UIF:
case TGSI_OPCODE_ELSE:
case TGSI_OPCODE_ENDIF:
case TGSI_OPCODE_BGNLOOP:
diff --git a/sr

Mesa (master): gallium: Eliminate TGSI_OPCODE_IFC.

2013-04-17 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: f61b7da80e238892b0832ec12b11589fba946b47
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f61b7da80e238892b0832ec12b11589fba946b47

Author: José Fonseca 
Date:   Sat Apr 13 10:28:01 2013 +0100

gallium: Eliminate TGSI_OPCODE_IFC.

Never used or implemented.

Reviewed-by: Roland Scheidegger 

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c |1 -
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c  |1 -
 src/gallium/auxiliary/tgsi/tgsi_info.c   |2 +-
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |1 -
 src/gallium/docs/source/tgsi.rst |5 -
 src/gallium/drivers/r300/r300_tgsi_to_rc.c   |1 -
 src/gallium/drivers/r600/r600_shader.c   |9 ++---
 src/gallium/include/pipe/p_shader_tokens.h   |2 +-
 8 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
index a4caf78..3c79abf 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c
@@ -389,7 +389,6 @@ analyse_instruction(struct analysis_context *ctx,
 
switch (inst->Instruction.Opcode) {
case TGSI_OPCODE_IF:
-   case TGSI_OPCODE_IFC:
case TGSI_OPCODE_ELSE:
case TGSI_OPCODE_ENDIF:
case TGSI_OPCODE_BGNLOOP:
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 853de09..239530d 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -1732,7 +1732,6 @@ near_end_of_shader(struct lp_build_tgsi_soa_context *bld,
  opcode == TGSI_OPCODE_CAL ||
  opcode == TGSI_OPCODE_CALLNZ ||
  opcode == TGSI_OPCODE_IF ||
- opcode == TGSI_OPCODE_IFC ||
  opcode == TGSI_OPCODE_BGNLOOP ||
  opcode == TGSI_OPCODE_SWITCH)
 return FALSE;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 1fadfec..716b16b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -151,7 +151,7 @@ static const struct tgsi_opcode_info 
opcode_info[TGSI_OPCODE_LAST] =
{ 0, 0, 0, 0, 0, 0, NONE, "", 111 }, /* removed */
{ 1, 1, 0, 0, 0, 0, REPL, "NRM4", TGSI_OPCODE_NRM4 },
{ 0, 1, 0, 0, 0, 0, NONE, "CALLNZ", TGSI_OPCODE_CALLNZ },
-   { 0, 1, 0, 0, 0, 0, NONE, "IFC", TGSI_OPCODE_IFC },
+   { 0, 1, 0, 0, 0, 0, NONE, "", 114 }, /* removed */
{ 0, 1, 0, 0, 0, 0, NONE, "BREAKC", TGSI_OPCODE_BREAKC },
{ 0, 1, 0, 0, 0, 0, NONE, "KIL", TGSI_OPCODE_KIL },
{ 0, 0, 0, 0, 0, 0, NONE, "END", TGSI_OPCODE_END },
diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h 
b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index fa30352..b8519c6 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -154,7 +154,6 @@ OP00(ENDSUB)
 OP00(NOP)
 OP11(NRM4)
 OP01(CALLNZ)
-OP01(IFC)
 OP01(BREAKC)
 OP01(KIL)
 OP00(END)
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 28308cb..0002626 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -1198,11 +1198,6 @@ XXX wait what
   TBD
 
 
-.. opcode:: IFC - If
-
-  TBD
-
-
 .. opcode:: BREAKC - Break Conditional
 
   TBD
diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c 
b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
index a0587b4..5e60e6c 100644
--- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c
+++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c
@@ -135,7 +135,6 @@ static unsigned translate_opcode(unsigned opcode)
 /* gap */
  /* case TGSI_OPCODE_NRM4: return RC_OPCODE_NRM4; */
  /* case TGSI_OPCODE_CALLNZ: return RC_OPCODE_CALLNZ; */
- /* case TGSI_OPCODE_IFC: return RC_OPCODE_IFC; */
  /* case TGSI_OPCODE_BREAKC: return RC_OPCODE_BREAKC; */
 case TGSI_OPCODE_KIL: return RC_OPCODE_KIL;
 }
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index f3e2187..7185c8e 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -6047,7 +6047,8 @@ static struct r600_shader_tgsi_instruction 
r600_shader_tgsi_instruction[] = {
{111,   0, ALU_OP0_NOP, tgsi_unsupported},
{TGSI_OPCODE_NRM4,  0, ALU_OP0_NOP, tgsi_unsupported},
{TGSI_OPCODE_CALLNZ,0, ALU_OP0_NOP, tgsi_unsupported},
-   {TGSI_OPCODE_IFC,   0, ALU_OP0_NOP, tgsi_unsupported},
+   /* gap */
+   {114,   0, ALU_OP0_NOP, tgsi_unsupported},
{TGSI_OPCODE_BREAKC,0, ALU_OP0_NOP, tgsi_unsupported},
{TGSI_OPCODE_KIL,   0, ALU_OP2_KILLGT, tgsi_kill},  /* conditional 
kill */
{TGSI_OPCODE_END,   0, ALU_OP0_NOP, tgsi_end},  /* aka HALT */
@@ -6240,7 +6241,8 @@ stati