[Mesa-dev] [PATCH] adroid : glcpp: fix abuse of yylex

2012-10-01 Thread Negreanu Marius Adrian
Port the 'glcpp: fix abuse of yylex' commit to Android.mk
Also, since the Android.*.mk are sourced in a global namespace,
the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name,

The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a

There's also a bugzilla for this: 54947

Signed-off-by: Negreanu Marius Adrian 
---
 src/glsl/Android.gen.mk | 6 +++---
 src/mesa/Android.gen.mk | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
index e4ccb72..2ed9fa6 100644
--- a/src/glsl/Android.gen.mk
+++ b/src/glsl/Android.gen.mk
@@ -52,10 +52,10 @@ define local-l-or-ll-to-c-or-cpp
$(hide) $(LEX) --nounistd -o$@ $<
 endef
 
-define local-y-to-c-and-h
+define glsl_local-y-to-c-and-h
@mkdir -p $(dir $@)
@echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
-   $(hide) $(YACC) -o $@ $<
+   $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
 endef
 
 define local-yy-to-cpp-and-h
@@ -80,7 +80,7 @@ $(intermediates)/glcpp/glcpp-lex.c: 
$(LOCAL_PATH)/glcpp/glcpp-lex.l
$(call local-l-or-ll-to-c-or-cpp)
 
 $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
-   $(call local-y-to-c-and-h)
+   $(call glsl_local-y-to-c-and-h)
 
 BUILTIN_COMPILER := 
$(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
 
diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index f5e6323..c17df1a 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -75,10 +75,10 @@ define local-l-to-c
$(hide) $(LEX) -o$@ $<
 endef
 
-define local-y-to-c-and-h
+define mesa_local-y-to-c-and-h
@mkdir -p $(dir $@)
@echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
-   $(hide) $(YACC) -o $@ $<
+   $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
 endef
 
 define es-gen
@@ -104,7 +104,7 @@ $(intermediates)/main/api_exec_%_remap_helper.h: 
$(es_hdr_deps)
$(call es-gen, -c $*)
 
 $(intermediates)/program/program_parse.tab.c: 
$(LOCAL_PATH)/program/program_parse.y
-   $(local-y-to-c-and-h)
+   $(mesa_local-y-to-c-and-h)
 
 $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
$(local-l-to-c)
-- 
1.7.11.3

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


Re: [Mesa-dev] [PATCH 17/19] glx: Replace DRI2SwapBuffers() custom protocol with XCB.

2012-10-01 Thread Oliver McFadden
On Fri, Sep 28, 2012 at 04:12:28PM -0700, Chad Versace wrote:
> > +   swap_buffers_cookie =
> > +  xcb_dri2_swap_buffers_unchecked(c, pdraw->xDrawable,
> > +  target_msc_hi, target_msc_lo,
> > +  divisor_hi, divisor_lo,
> > +  remainder_hi, remainder_lo);
> > +   /* Immediately wait on the swapbuffers reply.  If we didn't, we'd 
> > have
> > +* to do so some time before reusing a (non-pageflipped) backbuffer.
> > +* Otherwise, the new rendering could get ahead of the X Server's
> > +* dispatch of the swapbuffer and you'd display garbage.
> > +*
> > +* We use XSync() first to reap the invalidate events through the 
> > event
> > +* filter, to ensure that the next drawing doesn't use an 
> > invalidated
> > +* buffer.
> > +*/
> > +   XSync(pdraw->psc->dpy, False);
> > +   swap_buffers_reply =
> > +  xcb_dri2_swap_buffers_reply(c, swap_buffers_cookie, NULL);
> > +   ret = merge_counter(swap_buffers_reply->swap_hi,
> > +   swap_buffers_reply->swap_lo);
> > +   free(swap_buffers_reply);
> 
> Will this sync harm performance for artificial benchmarks? I'm asking because
> this hunk reminds me of Oliver's comments that Dante was slower on EGL than 
> GLX
> perhaps due to extra X roundtrips.

When I forced the vblank_mode to 0 on EGL, by using eglSwapInterval(dpy,
0) since vblank_mode environment variable/driconf won't actually work
with the current master, I would receive _roughly_ the same
performance...  EGL was about 3 fps slower.  This is greater than the
margin of error.

I haven't yet had time to run Dante through a timedemo series
with/without this patch set, however:

> 
> Anyway, roll-our-own-X-protocol needs to die.

Agreed.

> Reviewed-by: Chad Versace 
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH 1/5] radeonsi: define SGPR register numbers

2012-10-01 Thread Michel Dänzer
On Son, 2012-09-30 at 15:06 +0200, Christian König wrote: 
> Instead of hardcoding them.
> 
> Signed-off-by: Christian König 

Nice, thanks!

Series is

Reviewed-by: Michel Dänzer 

(In exchange for review of the patches I sent out last Friday ;)


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


[Mesa-dev] [PATCH v6 1/1] intel: add support for ANGLE_texture_compression_dxt.

2012-10-01 Thread Oliver McFadden
Signed-off-by: Oliver McFadden 
CC: Brian Paul 
---
v6: API == ES2 checks.

 src/mapi/glapi/gen/es_EXT.xml |6 ++
 src/mesa/drivers/dri/intel/intel_extensions.c |1 +
 src/mesa/main/APIspec.xml |3 +++
 src/mesa/main/extensions.c|3 +++
 src/mesa/main/glformats.c |6 --
 src/mesa/main/mtypes.h|1 +
 src/mesa/main/texformat.c |   12 +---
 src/mesa/main/teximage.c  |   12 
 8 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index fc2ec62..2698110 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -731,4 +731,10 @@
 
 
 
+
+
+
+
+
+
 
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 89f6c1e..8a46488 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -182,6 +182,7 @@ intelInitExtensions(struct gl_context *ctx)
}
 
if (intel->ctx.Mesa_DXTn) {
+  ctx->Extensions.ANGLE_texture_compression_dxt = true;
   ctx->Extensions.EXT_texture_compression_s3tc = true;
   ctx->Extensions.S3_s3tc = true;
}
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml
index a65c5c5..c396952 100644
--- a/src/mesa/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
@@ -2172,6 +2172,9 @@


 
+   
+   
+

 
 
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index bd7c7ba..4971ebc 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -195,6 +195,8 @@ static const struct extension extension_table[] = {
{ "GL_EXT_texture3D",   o(EXT_texture3D),   
GLL,1996 },
{ "GL_EXT_texture_array",   o(EXT_texture_array),   
GL, 2006 },
{ "GL_EXT_texture_compression_dxt1",
o(EXT_texture_compression_s3tc),GL | ES1 | ES2, 2004 },
+   { "GL_ANGLE_texture_compression_dxt3",  
o(ANGLE_texture_compression_dxt),   ES2,2011 },
+   { "GL_ANGLE_texture_compression_dxt5",  
o(ANGLE_texture_compression_dxt),   ES2,2011 },
{ "GL_EXT_texture_compression_latc",
o(EXT_texture_compression_latc),GL, 2006 },
{ "GL_EXT_texture_compression_rgtc",
o(ARB_texture_compression_rgtc),GL, 2004 },
{ "GL_EXT_texture_compression_s3tc",
o(EXT_texture_compression_s3tc),GL, 2000 },
@@ -480,6 +482,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
_mesa_enable_extension(ctx, "GL_3DFX_texture_compression_FXT1");
if (ctx->Mesa_DXTn) {
+  ctx->Extensions.ANGLE_texture_compression_dxt = GL_TRUE;
   _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
   _mesa_enable_extension(ctx, "GL_S3_s3tc");
}
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 04029c0..ccdf56b 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -791,8 +791,10 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum 
format)
   return ctx->Extensions.EXT_texture_compression_s3tc;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-  return _mesa_is_desktop_gl(ctx)
- && ctx->Extensions.EXT_texture_compression_s3tc;
+  return (_mesa_is_desktop_gl(ctx) &&
+ ctx->Extensions.EXT_texture_compression_s3tc) ||
+(ctx->API == API_OPENGLES2 &&
+ ctx->Extensions.ANGLE_texture_compression_dxt);
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_RGBA_S3TC:
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ba43e57..e790e18 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2946,6 +2946,7 @@ struct gl_extensions
GLboolean dummy;  /* don't remove this! */
GLboolean dummy_true;  /* Set true by _mesa_init_extensions(). */
GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
+   GLboolean ANGLE_texture_compression_dxt;
GLboolean ARB_ES2_compatibility;
GLboolean ARB_base_instance;
GLboolean ARB_blend_func_extended;
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 17270ba..f0bc7fd 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -302,7 +302,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum 
target,
   }
}
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc) {
+   if (ctx->Extensions.EXT_texture_compression_s3tc ||
+   (ctx->API == API_OPENGLES2 &&
+   ctx->Extensions.ANGLE_texture_compression_dxt)) {
 

[Mesa-dev] [PATCH v2 1/1] intel: print performance debug messages to `logcat' on Android.

2012-10-01 Thread Oliver McFadden
Signed-off-by: Oliver McFadden 
CC: Chad Versace 
---
v2: don't split drv/app debug messages; instead print everything that may be
useful.  Suggested by community on mailing list.

 src/mesa/drivers/dri/Android.mk|3 ++-
 src/mesa/drivers/dri/intel/intel_context.c |5 +
 src/mesa/drivers/dri/intel/intel_context.h |   17 ++---
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 577f664..d6196bb 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -34,7 +34,8 @@ MESA_DRI_MODULE_UNSTRIPPED_PATH := 
$(TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED)/dri
 MESA_DRI_CFLAGS := \
-DFEATURE_GL=1 \
-DFEATURE_ES1=1 \
-   -DFEATURE_ES2=1
+   -DFEATURE_ES2=1 \
+   -DHAVE_ANDROID_PLATFORM
 
 MESA_DRI_C_INCLUDES := \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index 25334da..7eb2706 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -744,6 +744,11 @@ intelInitContext(struct intel_context *intel,
intelInitExtensions(ctx);
 
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+
+#ifdef HAVE_ANDROID_PLATFORM
+   INTEL_DEBUG |= DEBUG_PERF;
+#endif /* HAVE_ANDROID_PLATFORM */
+
if (INTEL_DEBUG & DEBUG_BUFMGR)
   dri_bufmgr_set_debug(intel->bufmgr, true);
 
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index d16101d..b732696 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -457,19 +457,30 @@ extern int INTEL_DEBUG;
 #define DEBUG_CLIP  0x200
 #define DEBUG_AUB   0x400
 
+#ifdef HAVE_ANDROID_PLATFORM
+#define LOG_TAG "INTEL-MESA"
+#include 
+#ifndef ALOGW
+#define ALOGW LOGW
+#endif
+#define dbg_printf(...)ALOGW(__VA_ARGS__)
+#else
+#define dbg_printf(...)printf(__VA_ARGS__)
+#endif /* HAVE_ANDROID_PLATFORM */
+
 #define DBG(...) do {  \
if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG))\
-   printf(__VA_ARGS__);\
+   dbg_printf(__VA_ARGS__);\
 } while(0)
 
 #define fallback_debug(...) do {   \
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) \
-   printf(__VA_ARGS__);\
+   dbg_printf(__VA_ARGS__);\
 } while(0)
 
 #define perf_debug(...) do {   \
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) \
-   printf(__VA_ARGS__);\
+   dbg_printf(__VA_ARGS__);\
 } while(0)
 
 #define PCI_CHIP_845_G 0x2562
-- 
1.7.8.6

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


[Mesa-dev] [PATCH v3 0/8] mesa: glGet: fix lookup for apps using multiple APIs

2012-10-01 Thread Imre Deak
In v3 I addressed the last comments from Brian and Ian. Before
committing the patchset would need another Reviewed-by besides Brian's.

This is also a candidate for the 9.0 branch. I've also pushed it
to the g...@github.com:ideak/mesa.git dev branch.

--Imre

Imre Deak (8):
  glapi: rename/move GL_POLYGON_OFFSET_BIAS to its extension section
  mesa: glGet: fix parameter lookup for apps using multiple APIs
  mesa: glGet: simplify the 'enum not found' condition
  mesa: glGet: rename *{_EXT,_ARB} enums missing from the XML spec
  scons/android: add flag to check for enabled GL APIs
  mesa: glGet: add script to generate hash tables in build time
  mesa: glGet: use the build time generated hash tables
  mesa: glGet: remove the unused TYPE_API_MASK flags

 src/mapi/glapi/gen/gl_API.xml   |3 +-
 src/mesa/Android.gen.mk |   10 +-
 src/mesa/Android.mk |9 +-
 src/mesa/Makefile.am|   12 +
 src/mesa/SConscript |   27 +-
 src/mesa/main/.gitignore|2 +
 src/mesa/main/context.c |5 +-
 src/mesa/main/get.c | 1052 ++-
 src/mesa/main/get_hash_generator.py |  214 +++
 src/mesa/main/get_hash_params.py|  730 
 10 files changed, 1028 insertions(+), 1036 deletions(-)
 create mode 100644 src/mesa/main/get_hash_generator.py
 create mode 100644 src/mesa/main/get_hash_params.py

-- 
1.7.9.5

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


[Mesa-dev] [PATCH v3 1/8] glapi: rename/move GL_POLYGON_OFFSET_BIAS to its extension section

2012-10-01 Thread Imre Deak
This should be named GL_POLYGON_OFFSET_BIAS_EXT and listed under the
EXT_polygon_offset section. (Solution by Ian Romanick)

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mapi/glapi/gen/gl_API.xml |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 751a18f..f83a7a7 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -2981,7 +2981,6 @@
 
 
 
-
 
 
 
@@ -8089,6 +8088,8 @@
 
 
 
+
+
 
 
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v3 2/8] mesa: glGet: fix parameter lookup for apps using multiple APIs

2012-10-01 Thread Imre Deak
The glGet hash was initialized only once for a single GL API, even if
the application later created a context for a different API. This
resulted in glGet failing for otherwise valid parameters in a context
if that parameter was invalid in another context created earlier.

Fix this by using a separate hash table for each API.

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/main/context.c |5 ++---
 src/mesa/main/get.c |   44 +---
 src/mesa/main/mtypes.h  |2 ++
 3 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index c50504d..bc1f42d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
 
   _mesa_get_cpu_features();
 
-  /* context dependence is never a one-time thing... */
-  _mesa_init_get_hash(ctx);
-
   for (i = 0; i < 256; i++) {
  _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
   }
@@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
 
/* per-API one-time init */
if (!(api_init_mask & (1 << ctx->API))) {
+  _mesa_init_get_hash(ctx);
+
   /*
* This is fine as ES does not use the remap table, but it may not be
* future-proof.  We cannot always initialize the remap table because
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 1420850..b46492c 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1385,29 +1385,37 @@ static const struct value_desc values[] = {
  * collisions for any enum (typical numbers).  And the code is very
  * simple, even though it feels a little magic. */
 
-static unsigned short table[1024];
+static unsigned short table[API_LAST + 1][1024];
 static const int prime_factor = 89, prime_step = 281;
 
 #ifdef GET_DEBUG
 static void
-print_table_stats(void)
+print_table_stats(int api)
 {
int i, j, collisions[11], count, hash, mask;
const struct value_desc *d;
-
+   const char *api_names[] = {
+  [API_OPENGL] = "GL",
+  [API_OPENGL_CORE] = "GL_CORE",
+  [API_OPENGLES] = "GLES",
+  [API_OPENGLES2] = "GLES2",
+   };
+   const char *api_name;
+
+   api_name = api < Elements(api_names) ? api_names[api] : "N/A";
count = 0;
-   mask = Elements(table) - 1;
+   mask = Elements(table[api]) - 1;
memset(collisions, 0, sizeof collisions);
 
-   for (i = 0; i < Elements(table); i++) {
-  if (!table[i])
+   for (i = 0; i < Elements(table[api]); i++) {
+  if (!table[api][i])
  continue;
   count++;
-  d = &values[table[i]];
+  d = &values[table[api][i]];
   hash = (d->pname * prime_factor);
   j = 0;
   while (1) {
- if (values[table[hash & mask]].pname == d->pname)
+ if (values[table[api][hash & mask]].pname == d->pname)
 break;
  hash += prime_step;
  j++;
@@ -1419,7 +1427,8 @@ print_table_stats(void)
  collisions[10]++;
}
 
-   printf("number of enums: %d (total %d)\n", count, Elements(values));
+   printf("number of enums for %s: %d (total %ld)\n",
+ api_name, count, Elements(values));
for (i = 0; i < Elements(collisions) - 1; i++)
   if (collisions[i] > 0)
  printf("  %d enums with %d %scollisions\n",
@@ -1438,10 +1447,13 @@ print_table_stats(void)
 void _mesa_init_get_hash(struct gl_context *ctx)
 {
int i, hash, index, mask;
+   int api;
int api_mask = 0, api_bit;
 
-   mask = Elements(table) - 1;
-   api_bit = 1 << ctx->API;
+   api = ctx->API;
+
+   mask = Elements(table[api]) - 1;
+   api_bit = 1 << api;
 
for (i = 0; i < Elements(values); i++) {
   if (values[i].type == TYPE_API_MASK) {
@@ -1454,8 +1466,8 @@ void _mesa_init_get_hash(struct gl_context *ctx)
   hash = (values[i].pname * prime_factor) & mask;
   while (1) {
  index = hash & mask;
- if (!table[index]) {
-table[index] = i;
+ if (!table[api][index]) {
+table[api][index] = i;
 break;
  }
  hash += prime_step;
@@ -1986,11 +1998,13 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
struct gl_texture_unit *unit;
int mask, hash;
const struct value_desc *d;
+   int api;
 
-   mask = Elements(table) - 1;
+   api = ctx->API;
+   mask = Elements(table[api]) - 1;
hash = (pname * prime_factor);
while (1) {
-  d = &values[table[hash & mask]];
+  d = &values[table[api][hash & mask]];
 
   /* If the enum isn't valid, the hash walk ends with index 0,
* which is the API mask entry at the beginning of values[]. */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ba43e57..f185ffd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3340,6 +3340,8 @@ typedef enum
API_OPENGLES,
API_OPENGLES2,
API_OPENGL_CORE,
+
+   API_LAST = API_OPENGL_CORE,
 } gl_api;
 
 /**
-- 
1.7.9.5

___

[Mesa-dev] [PATCH v3 3/8] mesa: glGet: simplify the 'enum not found' condition

2012-10-01 Thread Imre Deak
When traversing the hash table looking up an enum that is invalid we
eventually reach the first element in the descriptor array. By looking
at the type of that element, which is always TYPE_API_MASK, we know that
we can stop the search and return error. Since this element is always
the first it's enough to check for its index being 0 without looking at
its type.

Later in this patchset, when we generate the hash tables during build
time, this will allow us to remove the TYPE_API_MASK and related flags
completly.

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/main/get.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index b46492c..e09147b 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -2004,16 +2004,18 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
mask = Elements(table[api]) - 1;
hash = (pname * prime_factor);
while (1) {
-  d = &values[table[api][hash & mask]];
+  int idx = table[api][hash & mask];
 
   /* If the enum isn't valid, the hash walk ends with index 0,
-   * which is the API mask entry at the beginning of values[]. */
-  if (unlikely(d->type == TYPE_API_MASK)) {
+   * pointing to the first entry of values[] which doesn't hold
+   * any valid enum. */
+  if (unlikely(idx == 0)) {
  _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
_mesa_lookup_enum_by_nr(pname));
  return &error_value;
   }
 
+  d = &values[idx];
   if (likely(d->pname == pname))
  break;
 
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v3 4/8] mesa: glGet: rename *{_EXT, _ARB} enums missing from the XML spec

2012-10-01 Thread Imre Deak
The following enums used to be extensions but later became part of the
core specification. The _EXT/_ARB versions of these are not present in
in the current XML spec files, only defined in GL/glext.h

Later we'll need to look up these in a python script using the XML spec.
As a preparation for that remove the _EXT,_ARB suffix from these enums
and rename GL_DISTANCE_ATTENUATION_EXT to GL_POINT_DISTANCE_ATTENUATION.
Naturally, all enums keep their numerical values.

Note that similar renames shouldn't be necessary in the future: in case
of a new extension the XML spec is updated with the new _EXT/_ARB etc.
name and this name is added to the enum table in get.c.  Later the
extension may become part of the core spec, at which point the name w/o
the _EXT/_ARB suffix is added to the XML spec and the table in get.c
remains the same.

GL_BLEND_DST_ALPHA_EXT
GL_BLEND_DST_RGB_EXT
GL_BLEND_SRC_ALPHA_EXT
GL_BLEND_SRC_RGB_EXT
GL_COLOR_SUM_EXT
GL_COMPRESSED_TEXTURE_FORMATS_ARB
GL_CURRENT_FOG_COORDINATE_EXT
GL_CURRENT_SECONDARY_COLOR_EXT
GL_DISTANCE_ATTENUATION_EXT
GL_FOG_COORDINATE_ARRAY_EXT
GL_FOG_COORDINATE_ARRAY_STRIDE_EXT
GL_FOG_COORDINATE_ARRAY_TYPE_EXT
GL_FOG_COORDINATE_SOURCE_EXT
GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB
GL_PACK_IMAGE_HEIGHT_EXT
GL_PACK_SKIP_IMAGES_EXT
GL_SECONDARY_COLOR_ARRAY_EXT
GL_SECONDARY_COLOR_ARRAY_SIZE_EXT
GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT
GL_SECONDARY_COLOR_ARRAY_TYPE_EXT
GL_UNPACK_IMAGE_HEIGHT_EXT
GL_UNPACK_SKIP_IMAGES_EXT

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/main/get.c |   44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index e09147b..6c32f81 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -471,10 +471,10 @@ static const struct value_desc values[] = {
  extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
 
/* XXX: OES_blend_subtract */
-   { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
-   { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
-   { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
-   { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
+   { GL_BLEND_SRC_RGB, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
+   { GL_BLEND_DST_RGB, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
+   { GL_BLEND_SRC_ALPHA, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
+   { GL_BLEND_DST_ALPHA, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
 
/* GL_BLEND_EQUATION_RGB, which is what we're really after, is
 * defined identically to GL_BLEND_EQUATION. */
@@ -483,7 +483,7 @@ static const struct value_desc values[] = {
 
/* GL_ARB_texture_compression */
{ GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA 
},
-   { GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA },
+   { GL_COMPRESSED_TEXTURE_FORMATS, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA },
 
/* GL_ARB_multisample */
{ GL_SAMPLE_ALPHA_TO_COVERAGE_ARB,
@@ -578,7 +578,7 @@ static const struct value_desc values[] = {
  extra_flush_current },
{ GL_CURRENT_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0,
  extra_flush_current_valid_texture_unit },
-   { GL_DISTANCE_ATTENUATION_EXT, CONTEXT_FLOAT3(Point.Params[0]), NO_EXTRA },
+   { GL_POINT_DISTANCE_ATTENUATION, CONTEXT_FLOAT3(Point.Params[0]), NO_EXTRA 
},
{ GL_FOG, CONTEXT_BOOL(Fog.Enabled), NO_EXTRA },
{ GL_FOG_COLOR, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp },
{ GL_FOG_DENSITY, CONTEXT_FLOAT(Fog.Density), NO_EXTRA },
@@ -599,7 +599,7 @@ static const struct value_desc values[] = {
{ GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
  offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA },
{ GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA },
-   { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
+   { GL_PACK_SKIP_IMAGES, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
{ GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), 
NO_EXTRA },
{ GL_POINT_SIZE, CONTEXT_FLOAT(Point.Size), NO_EXTRA },
{ GL_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSizeAA), NO_EXTRA },
@@ -711,15 +711,15 @@ static const struct value_desc values[] = {
{ GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */
  CONTEXT_INT(Const.MaxTextureCoordUnits),
  extra_ARB_fragment_program_NV_fragment_program },
-   { GL_PACK_IMAGE_HEIGHT_EXT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA },
+   { GL_PACK_IMAGE_HEIGHT, CONTEXT_INT(Pack.ImageHeight), NO_EXTRA },
{ GL_PACK_ROW_LENGTH, CONTEXT_INT(Pack.RowLength), NO_EXTRA },
{ GL_PACK_SKIP_PIXELS, CONTEXT_INT(Pack.SkipPixels), NO_EXTRA },
{ GL_PACK_SKIP_ROWS, CONTEXT_INT(Pack.SkipRows), NO_EXTRA },
{ GL_UNPACK_ROW_LENGTH, CONTEXT_INT(Unpack.RowLength), NO_EXTRA },
{ GL_UNPACK_SKIP_PIXELS, CONTEXT_INT(Unpack.SkipPixels), NO_EXTRA }

[Mesa-dev] [PATCH v3 5/8] scons/android: add flag to check for enabled GL APIs

2012-10-01 Thread Imre Deak
Needed by the next patch.

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/Android.mk |9 -
 src/mesa/SConscript |9 +
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
index 4b62b81..c32b1c0 100644
--- a/src/mesa/Android.mk
+++ b/src/mesa/Android.mk
@@ -33,9 +33,7 @@ LOCAL_PATH := $(call my-dir)
 # X86_FILES
 include $(LOCAL_PATH)/sources.mak
 
-common_CFLAGS := \
-   -DFEATURE_ES1=1 \
-   -DFEATURE_ES2=1
+MESA_ENABLED_APIS := ES1 ES2
 
 common_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
@@ -100,9 +98,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE := libmesa_dricore
 LOCAL_MODULE_CLASS := STATIC_LIBRARIES
 
+MESA_ENABLED_APIS += GL
 LOCAL_CFLAGS := \
-   $(common_CFLAGS) \
-   -DFEATURE_GL=1
+   $(common_CFLAGS) \
+   $(patsubst %,-DFEATURE_%=1,$(MESA_ENABLED_APIS))
 
 LOCAL_C_INCLUDES := \
$(common_C_INCLUDES)
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 9819082..7d7d519 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -16,9 +16,8 @@ env.Append(CPPPATH = [
 '#/src/mesa',
 ])
 
-env.Append(CPPDEFINES = [
-'FEATURE_GL=1',
-])
+enabled_apis = []
+enabled_apis += ['GL']
 
 if env['platform'] == 'windows':
 env.Append(CPPDEFINES = [
@@ -335,7 +334,7 @@ GLAPI = '#src/mapi/glapi/'
 
 if env['gles']:
 
-env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
+enabled_apis += ['ES1', 'ES2']
 
 # generate GLES sources
 gles_sources = ['main/es1_conversion.c',]
@@ -368,6 +367,8 @@ if env['gles']:
 
 mesa_sources += gles_sources
 
+env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
+
 #
 # Assembly sources
 #
-- 
1.7.9.5

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


[Mesa-dev] [PATCH v3 7/8] mesa: glGet: use the build time generated hash tables

2012-10-01 Thread Imre Deak
Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/main/get.c| 1026 +---
 src/mesa/main/mtypes.h |2 -
 2 files changed, 13 insertions(+), 1015 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 6c32f81..c5ccd66 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -395,982 +395,13 @@ extra_NV_read_buffer_api_gl[] = {
  * glGet*v().  The table is partitioned into six parts: enums
  * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared
  * between OpenGL and GLES, enums exclusive to GLES, etc for the
- * remaining combinations.  When we add the enums to the hash table in
- * _mesa_init_get_hash(), we only add the enums for the API we're
- * instantiating and the different sections are guarded by #if
- * FEATURE_GL etc to make sure we only compile in the enums we may
- * need. */
-
-static const struct value_desc values[] = {
-   /* Enums shared between OpenGL, GLES1 and GLES2 */
-   { 0, 0, TYPE_API_MASK,
- API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT |
-   API_OPENGL_CORE_BIT,
- NO_EXTRA},
-   { GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
-   { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
-   { GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
-   { GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers },
-   { GL_COLOR_CLEAR_VALUE, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp 
},
-   { GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
-   { GL_CULL_FACE, CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA },
-   { GL_CULL_FACE_MODE, CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA },
-   { GL_DEPTH_BITS, BUFFER_INT(Visual.depthBits), NO_EXTRA },
-   { GL_DEPTH_CLEAR_VALUE, CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), NO_EXTRA 
},
-   { GL_DEPTH_FUNC, CONTEXT_ENUM(Depth.Func), NO_EXTRA },
-   { GL_DEPTH_RANGE, CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA },
-   { GL_DEPTH_TEST, CONTEXT_BOOL(Depth.Test), NO_EXTRA },
-   { GL_DEPTH_WRITEMASK, CONTEXT_BOOL(Depth.Mask), NO_EXTRA },
-   { GL_DITHER, CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA },
-   { GL_FRONT_FACE, CONTEXT_ENUM(Polygon.FrontFace), NO_EXTRA },
-   { GL_GREEN_BITS, BUFFER_INT(Visual.greenBits), extra_new_buffers },
-   { GL_LINE_WIDTH, CONTEXT_FLOAT(Line.Width), NO_EXTRA },
-   { GL_ALIASED_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidth), NO_EXTRA 
},
-   { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
-   { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
-   { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
- offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA },
-   { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA },
-   { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA },
-   { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA 
},
-   { GL_POLYGON_OFFSET_FACTOR, CONTEXT_FLOAT(Polygon.OffsetFactor ), NO_EXTRA 
},
-   { GL_POLYGON_OFFSET_UNITS, CONTEXT_FLOAT(Polygon.OffsetUnits ), NO_EXTRA },
-   { GL_POLYGON_OFFSET_FILL, CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA },
-   { GL_RED_BITS, BUFFER_INT(Visual.redBits), extra_new_buffers },
-   { GL_SCISSOR_BOX, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
-   { GL_SCISSOR_TEST, CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA },
-   { GL_STENCIL_BITS, BUFFER_INT(Visual.stencilBits), NO_EXTRA },
-   { GL_STENCIL_CLEAR_VALUE, CONTEXT_INT(Stencil.Clear), NO_EXTRA },
-   { GL_STENCIL_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_FUNC, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_PASS_DEPTH_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_PASS_DEPTH_PASS, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_REF, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_TEST, CONTEXT_BOOL(Stencil.Enabled), NO_EXTRA },
-   { GL_STENCIL_VALUE_MASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
-   { GL_STENCIL_WRITEMASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
-   { GL_SUBPIXEL_BITS, CONTEXT_INT(Const.SubPixelBits), NO_EXTRA },
-   { GL_TEXTURE_BINDING_2D, LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA },
-   { GL_UNPACK_ALIGNMENT, CONTEXT_INT(Unpack.Alignment), NO_EXTRA },
-   { GL_VIEWPORT, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
-
-   /* GL_ARB_multitexture */
-   { GL_ACTIVE_TEXTURE, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
-
-   /* Note that all the OES_* extensions require that the Mesa "struct
-* gl_extensions" include a member with the name of the extension.
-* That structure does not yet include OES extensions (and we're
-* not sure whether it will).  If it does, all the OES_*
-* extensions below should mark the dependency. */
-
-   /* GL_ARB_texture_cube_map */
-   { GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT,
- TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map },
-   { GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LO

[Mesa-dev] [PATCH v3 8/8] mesa: glGet: remove the unused TYPE_API_MASK flags

2012-10-01 Thread Imre Deak
Since we generate the hash tables in build time, these flags aren't used
any more, remove them.

Signed-off-by: Imre Deak 
Reviewed-by: Brian Paul 
---
 src/mesa/main/get.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index c5ccd66..b943d69 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -84,7 +84,6 @@
 
 enum value_type {
TYPE_INVALID,
-   TYPE_API_MASK,
TYPE_INT,
TYPE_INT_2,
TYPE_INT_3,
@@ -386,11 +385,6 @@ extra_NV_read_buffer_api_gl[] = {
EXTRA_END
 };
 
-#define API_OPENGL_BIT (1 << API_OPENGL)
-#define API_OPENGLES_BIT (1 << API_OPENGLES)
-#define API_OPENGLES2_BIT (1 << API_OPENGLES2)
-#define API_OPENGL_CORE_BIT (1 << API_OPENGL_CORE)
-
 /* This is the big table describing all the enums we accept in
  * glGet*v().  The table is partitioned into six parts: enums
  * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH v3 1/8] glapi: rename/move GL_POLYGON_OFFSET_BIAS to its extension section

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:37:58PM +0300, Imre Deak wrote:
> This should be named GL_POLYGON_OFFSET_BIAS_EXT and listed under the
> EXT_polygon_offset section. (Solution by Ian Romanick)
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mapi/glapi/gen/gl_API.xml |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index 751a18f..f83a7a7 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -2981,7 +2981,6 @@
>  
>  
>  
> -
>  
>  
>  
> @@ -8089,6 +8088,8 @@
>  
>  
>  
> +
> +
>  
>  
>  
> -- 
> 1.7.9.5
> 

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


Re: [Mesa-dev] [PATCH v3 2/8] mesa: glGet: fix parameter lookup for apps using multiple APIs

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:37:59PM +0300, Imre Deak wrote:
> The glGet hash was initialized only once for a single GL API, even if
> the application later created a context for a different API. This
> resulted in glGet failing for otherwise valid parameters in a context
> if that parameter was invalid in another context created earlier.
> 
> Fix this by using a separate hash table for each API.
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mesa/main/context.c |5 ++---
>  src/mesa/main/get.c |   44 +---
>  src/mesa/main/mtypes.h  |2 ++
>  3 files changed, 33 insertions(+), 18 deletions(-)
> 
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index c50504d..bc1f42d 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -404,9 +404,6 @@ one_time_init( struct gl_context *ctx )
>  
>_mesa_get_cpu_features();
>  
> -  /* context dependence is never a one-time thing... */
> -  _mesa_init_get_hash(ctx);
> -
>for (i = 0; i < 256; i++) {
>   _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
>}
> @@ -425,6 +422,8 @@ one_time_init( struct gl_context *ctx )
>  
> /* per-API one-time init */
> if (!(api_init_mask & (1 << ctx->API))) {
> +  _mesa_init_get_hash(ctx);
> +
>/*
> * This is fine as ES does not use the remap table, but it may not be
> * future-proof.  We cannot always initialize the remap table because
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 1420850..b46492c 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -1385,29 +1385,37 @@ static const struct value_desc values[] = {
>   * collisions for any enum (typical numbers).  And the code is very
>   * simple, even though it feels a little magic. */
>  
> -static unsigned short table[1024];
> +static unsigned short table[API_LAST + 1][1024];
>  static const int prime_factor = 89, prime_step = 281;
>  
>  #ifdef GET_DEBUG
>  static void
> -print_table_stats(void)
> +print_table_stats(int api)
>  {
> int i, j, collisions[11], count, hash, mask;
> const struct value_desc *d;
> -
> +   const char *api_names[] = {
> +  [API_OPENGL] = "GL",
> +  [API_OPENGL_CORE] = "GL_CORE",
> +  [API_OPENGLES] = "GLES",
> +  [API_OPENGLES2] = "GLES2",
> +   };
> +   const char *api_name;
> +
> +   api_name = api < Elements(api_names) ? api_names[api] : "N/A";
> count = 0;
> -   mask = Elements(table) - 1;
> +   mask = Elements(table[api]) - 1;
> memset(collisions, 0, sizeof collisions);
>  
> -   for (i = 0; i < Elements(table); i++) {
> -  if (!table[i])
> +   for (i = 0; i < Elements(table[api]); i++) {
> +  if (!table[api][i])
>   continue;
>count++;
> -  d = &values[table[i]];
> +  d = &values[table[api][i]];
>hash = (d->pname * prime_factor);
>j = 0;
>while (1) {
> - if (values[table[hash & mask]].pname == d->pname)
> + if (values[table[api][hash & mask]].pname == d->pname)
>  break;
>   hash += prime_step;
>   j++;
> @@ -1419,7 +1427,8 @@ print_table_stats(void)
>   collisions[10]++;
> }
>  
> -   printf("number of enums: %d (total %d)\n", count, Elements(values));
> +   printf("number of enums for %s: %d (total %ld)\n",
> + api_name, count, Elements(values));
> for (i = 0; i < Elements(collisions) - 1; i++)
>if (collisions[i] > 0)
>   printf("  %d enums with %d %scollisions\n",
> @@ -1438,10 +1447,13 @@ print_table_stats(void)
>  void _mesa_init_get_hash(struct gl_context *ctx)
>  {
> int i, hash, index, mask;
> +   int api;
> int api_mask = 0, api_bit;
>  
> -   mask = Elements(table) - 1;
> -   api_bit = 1 << ctx->API;
> +   api = ctx->API;
> +
> +   mask = Elements(table[api]) - 1;
> +   api_bit = 1 << api;
>  
> for (i = 0; i < Elements(values); i++) {
>if (values[i].type == TYPE_API_MASK) {
> @@ -1454,8 +1466,8 @@ void _mesa_init_get_hash(struct gl_context *ctx)
>hash = (values[i].pname * prime_factor) & mask;
>while (1) {
>   index = hash & mask;
> - if (!table[index]) {
> -table[index] = i;
> + if (!table[api][index]) {
> +table[api][index] = i;
>  break;
>   }
>   hash += prime_step;
> @@ -1986,11 +1998,13 @@ find_value(const char *func, GLenum pname, void **p, 
> union value *v)
> struct gl_texture_unit *unit;
> int mask, hash;
> const struct value_desc *d;
> +   int api;
>  
> -   mask = Elements(table) - 1;
> +   api = ctx->API;
> +   mask = Elements(table[api]) - 1;
> hash = (pname * prime_factor);
> while (1) {
> -  d = &values[table[hash & mask]];
> +  d = &values[table[api][hash & mask]];
>  
>/* If the enum isn't valid, the hash walk ends with index 0,
> * which is the API mask 

Re: [Mesa-dev] [PATCH v3 3/8] mesa: glGet: simplify the 'enum not found' condition

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:38:00PM +0300, Imre Deak wrote:
> When traversing the hash table looking up an enum that is invalid we
> eventually reach the first element in the descriptor array. By looking
> at the type of that element, which is always TYPE_API_MASK, we know that
> we can stop the search and return error. Since this element is always
> the first it's enough to check for its index being 0 without looking at
> its type.
> 
> Later in this patchset, when we generate the hash tables during build
> time, this will allow us to remove the TYPE_API_MASK and related flags
> completly.
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mesa/main/get.c |8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index b46492c..e09147b 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -2004,16 +2004,18 @@ find_value(const char *func, GLenum pname, void **p, 
> union value *v)
> mask = Elements(table[api]) - 1;
> hash = (pname * prime_factor);
> while (1) {
> -  d = &values[table[api][hash & mask]];
> +  int idx = table[api][hash & mask];
>  
>/* If the enum isn't valid, the hash walk ends with index 0,
> -   * which is the API mask entry at the beginning of values[]. */
> -  if (unlikely(d->type == TYPE_API_MASK)) {
> +   * pointing to the first entry of values[] which doesn't hold
> +   * any valid enum. */
> +  if (unlikely(idx == 0)) {
>   _mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
> _mesa_lookup_enum_by_nr(pname));
>   return &error_value;
>}
>  
> +  d = &values[idx];
>if (likely(d->pname == pname))
>   break;
>  
> -- 
> 1.7.9.5
> 

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


Re: [Mesa-dev] [PATCH v3 4/8] mesa: glGet: rename *{_EXT, _ARB} enums missing from the XML spec

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:38:01PM +0300, Imre Deak wrote:
> The following enums used to be extensions but later became part of the
> core specification. The _EXT/_ARB versions of these are not present in
> in the current XML spec files, only defined in GL/glext.h
> 
> Later we'll need to look up these in a python script using the XML spec.
> As a preparation for that remove the _EXT,_ARB suffix from these enums
> and rename GL_DISTANCE_ATTENUATION_EXT to GL_POINT_DISTANCE_ATTENUATION.
> Naturally, all enums keep their numerical values.
> 
> Note that similar renames shouldn't be necessary in the future: in case
> of a new extension the XML spec is updated with the new _EXT/_ARB etc.
> name and this name is added to the enum table in get.c.  Later the
> extension may become part of the core spec, at which point the name w/o
> the _EXT/_ARB suffix is added to the XML spec and the table in get.c
> remains the same.
> 
> GL_BLEND_DST_ALPHA_EXT
> GL_BLEND_DST_RGB_EXT
> GL_BLEND_SRC_ALPHA_EXT
> GL_BLEND_SRC_RGB_EXT
> GL_COLOR_SUM_EXT
> GL_COMPRESSED_TEXTURE_FORMATS_ARB
> GL_CURRENT_FOG_COORDINATE_EXT
> GL_CURRENT_SECONDARY_COLOR_EXT
> GL_DISTANCE_ATTENUATION_EXT
> GL_FOG_COORDINATE_ARRAY_EXT
> GL_FOG_COORDINATE_ARRAY_STRIDE_EXT
> GL_FOG_COORDINATE_ARRAY_TYPE_EXT
> GL_FOG_COORDINATE_SOURCE_EXT
> GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB
> GL_PACK_IMAGE_HEIGHT_EXT
> GL_PACK_SKIP_IMAGES_EXT
> GL_SECONDARY_COLOR_ARRAY_EXT
> GL_SECONDARY_COLOR_ARRAY_SIZE_EXT
> GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT
> GL_SECONDARY_COLOR_ARRAY_TYPE_EXT
> GL_UNPACK_IMAGE_HEIGHT_EXT
> GL_UNPACK_SKIP_IMAGES_EXT
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 

I could make a nit-pick here that the GL_POINT_DISTANCE_ATTENUATION
rename should be a separate patch, since this one appears to simply be
s/\(_EXT\|_ARB\)\>// but if it's okay with Brian, it's fine by me.

> ---
>  src/mesa/main/get.c |   44 ++--
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index e09147b..6c32f81 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -471,10 +471,10 @@ static const struct value_desc values[] = {
>   extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
>  
> /* XXX: OES_blend_subtract */
> -   { GL_BLEND_SRC_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
> -   { GL_BLEND_DST_RGB_EXT, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
> -   { GL_BLEND_SRC_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
> -   { GL_BLEND_DST_ALPHA_EXT, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
> +   { GL_BLEND_SRC_RGB, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
> +   { GL_BLEND_DST_RGB, CONTEXT_ENUM(Color.Blend[0].DstRGB), NO_EXTRA },
> +   { GL_BLEND_SRC_ALPHA, CONTEXT_ENUM(Color.Blend[0].SrcA), NO_EXTRA },
> +   { GL_BLEND_DST_ALPHA, CONTEXT_ENUM(Color.Blend[0].DstA), NO_EXTRA },
>  
> /* GL_BLEND_EQUATION_RGB, which is what we're really after, is
>  * defined identically to GL_BLEND_EQUATION. */
> @@ -483,7 +483,7 @@ static const struct value_desc values[] = {
>  
> /* GL_ARB_texture_compression */
> { GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT, 0, 
> NO_EXTRA },
> -   { GL_COMPRESSED_TEXTURE_FORMATS_ARB, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA 
> },
> +   { GL_COMPRESSED_TEXTURE_FORMATS, LOC_CUSTOM, TYPE_INT_N, 0, NO_EXTRA },
>  
> /* GL_ARB_multisample */
> { GL_SAMPLE_ALPHA_TO_COVERAGE_ARB,
> @@ -578,7 +578,7 @@ static const struct value_desc values[] = {
>   extra_flush_current },
> { GL_CURRENT_TEXTURE_COORDS, LOC_CUSTOM, TYPE_FLOAT_4, 0,
>   extra_flush_current_valid_texture_unit },
> -   { GL_DISTANCE_ATTENUATION_EXT, CONTEXT_FLOAT3(Point.Params[0]), NO_EXTRA 
> },
> +   { GL_POINT_DISTANCE_ATTENUATION, CONTEXT_FLOAT3(Point.Params[0]), 
> NO_EXTRA },
> { GL_FOG, CONTEXT_BOOL(Fog.Enabled), NO_EXTRA },
> { GL_FOG_COLOR, LOC_CUSTOM, TYPE_FLOATN_4, 0, extra_new_frag_clamp },
> { GL_FOG_DENSITY, CONTEXT_FLOAT(Fog.Density), NO_EXTRA },
> @@ -599,7 +599,7 @@ static const struct value_desc values[] = {
> { GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
>   offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA },
> { GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA },
> -   { GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
> +   { GL_PACK_SKIP_IMAGES, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
> { GL_PERSPECTIVE_CORRECTION_HINT, 
> CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA },
> { GL_POINT_SIZE, CONTEXT_FLOAT(Point.Size), NO_EXTRA },
> { GL_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSizeAA), NO_EXTRA },
> @@ -711,15 +711,15 @@ static const struct value_desc values[] = {
> { GL_MAX_TEXTURE_COORDS_ARB, /* == GL_MAX_TEXTURE_COORDS_NV */
>   CONTEXT_INT(Const.MaxTextureCoordUnits),
>   extra_ARB_fragment_program_NV_fragment_p

Re: [Mesa-dev] [PATCH v3 5/8] scons/android: add flag to check for enabled GL APIs

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:38:02PM +0300, Imre Deak wrote:
> Needed by the next patch.
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mesa/Android.mk |9 -
>  src/mesa/SConscript |9 +
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/src/mesa/Android.mk b/src/mesa/Android.mk
> index 4b62b81..c32b1c0 100644
> --- a/src/mesa/Android.mk
> +++ b/src/mesa/Android.mk
> @@ -33,9 +33,7 @@ LOCAL_PATH := $(call my-dir)
>  # X86_FILES
>  include $(LOCAL_PATH)/sources.mak
>  
> -common_CFLAGS := \
> - -DFEATURE_ES1=1 \
> - -DFEATURE_ES2=1
> +MESA_ENABLED_APIS := ES1 ES2
>  
>  common_C_INCLUDES := \
>   $(MESA_TOP)/src/mapi \
> @@ -100,9 +98,10 @@ include $(CLEAR_VARS)
>  LOCAL_MODULE := libmesa_dricore
>  LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>  
> +MESA_ENABLED_APIS += GL
>  LOCAL_CFLAGS := \
> - $(common_CFLAGS) \
> - -DFEATURE_GL=1
> +   $(common_CFLAGS) \
> +   $(patsubst %,-DFEATURE_%=1,$(MESA_ENABLED_APIS))
>  
>  LOCAL_C_INCLUDES := \
>   $(common_C_INCLUDES)
> diff --git a/src/mesa/SConscript b/src/mesa/SConscript
> index 9819082..7d7d519 100644
> --- a/src/mesa/SConscript
> +++ b/src/mesa/SConscript
> @@ -16,9 +16,8 @@ env.Append(CPPPATH = [
>  '#/src/mesa',
>  ])
>  
> -env.Append(CPPDEFINES = [
> -'FEATURE_GL=1',
> -])
> +enabled_apis = []
> +enabled_apis += ['GL']
>  
>  if env['platform'] == 'windows':
>  env.Append(CPPDEFINES = [
> @@ -335,7 +334,7 @@ GLAPI = '#src/mapi/glapi/'
>  
>  if env['gles']:
>  
> -env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
> +enabled_apis += ['ES1', 'ES2']
>  
>  # generate GLES sources
>  gles_sources = ['main/es1_conversion.c',]
> @@ -368,6 +367,8 @@ if env['gles']:
>  
>  mesa_sources += gles_sources
>  
> +env.Append(CPPDEFINES = ["FEATURE_%s=1" % api for api in enabled_apis])
> +
>  #
>  # Assembly sources
>  #
> -- 
> 1.7.9.5
> 

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


Re: [Mesa-dev] [PATCH v3 7/8] mesa: glGet: use the build time generated hash tables

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:38:04PM +0300, Imre Deak wrote:
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mesa/main/get.c| 1026 
> +---
>  src/mesa/main/mtypes.h |2 -
>  2 files changed, 13 insertions(+), 1015 deletions(-)
> 
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 6c32f81..c5ccd66 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -395,982 +395,13 @@ extra_NV_read_buffer_api_gl[] = {
>   * glGet*v().  The table is partitioned into six parts: enums
>   * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared
>   * between OpenGL and GLES, enums exclusive to GLES, etc for the
> - * remaining combinations.  When we add the enums to the hash table in
> - * _mesa_init_get_hash(), we only add the enums for the API we're
> - * instantiating and the different sections are guarded by #if
> - * FEATURE_GL etc to make sure we only compile in the enums we may
> - * need. */
> -
> -static const struct value_desc values[] = {
> -   /* Enums shared between OpenGL, GLES1 and GLES2 */
> -   { 0, 0, TYPE_API_MASK,
> - API_OPENGL_BIT | API_OPENGLES_BIT | API_OPENGLES2_BIT |
> -   API_OPENGL_CORE_BIT,
> - NO_EXTRA},
> -   { GL_ALPHA_BITS, BUFFER_INT(Visual.alphaBits), extra_new_buffers },
> -   { GL_BLEND, CONTEXT_BIT0(Color.BlendEnabled), NO_EXTRA },
> -   { GL_BLEND_SRC, CONTEXT_ENUM(Color.Blend[0].SrcRGB), NO_EXTRA },
> -   { GL_BLUE_BITS, BUFFER_INT(Visual.blueBits), extra_new_buffers },
> -   { GL_COLOR_CLEAR_VALUE, LOC_CUSTOM, TYPE_FLOATN_4, 0, 
> extra_new_frag_clamp },
> -   { GL_COLOR_WRITEMASK, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
> -   { GL_CULL_FACE, CONTEXT_BOOL(Polygon.CullFlag), NO_EXTRA },
> -   { GL_CULL_FACE_MODE, CONTEXT_ENUM(Polygon.CullFaceMode), NO_EXTRA },
> -   { GL_DEPTH_BITS, BUFFER_INT(Visual.depthBits), NO_EXTRA },
> -   { GL_DEPTH_CLEAR_VALUE, CONTEXT_FIELD(Depth.Clear, TYPE_DOUBLEN), 
> NO_EXTRA },
> -   { GL_DEPTH_FUNC, CONTEXT_ENUM(Depth.Func), NO_EXTRA },
> -   { GL_DEPTH_RANGE, CONTEXT_FIELD(Viewport.Near, TYPE_FLOATN_2), NO_EXTRA },
> -   { GL_DEPTH_TEST, CONTEXT_BOOL(Depth.Test), NO_EXTRA },
> -   { GL_DEPTH_WRITEMASK, CONTEXT_BOOL(Depth.Mask), NO_EXTRA },
> -   { GL_DITHER, CONTEXT_BOOL(Color.DitherFlag), NO_EXTRA },
> -   { GL_FRONT_FACE, CONTEXT_ENUM(Polygon.FrontFace), NO_EXTRA },
> -   { GL_GREEN_BITS, BUFFER_INT(Visual.greenBits), extra_new_buffers },
> -   { GL_LINE_WIDTH, CONTEXT_FLOAT(Line.Width), NO_EXTRA },
> -   { GL_ALIASED_LINE_WIDTH_RANGE, CONTEXT_FLOAT2(Const.MinLineWidth), 
> NO_EXTRA },
> -   { GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA 
> },
> -   { GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA 
> },
> -   { GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
> - offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA },
> -   { GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA },
> -   { GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA },
> -   { GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), 
> NO_EXTRA },
> -   { GL_POLYGON_OFFSET_FACTOR, CONTEXT_FLOAT(Polygon.OffsetFactor ), 
> NO_EXTRA },
> -   { GL_POLYGON_OFFSET_UNITS, CONTEXT_FLOAT(Polygon.OffsetUnits ), NO_EXTRA 
> },
> -   { GL_POLYGON_OFFSET_FILL, CONTEXT_BOOL(Polygon.OffsetFill), NO_EXTRA },
> -   { GL_RED_BITS, BUFFER_INT(Visual.redBits), extra_new_buffers },
> -   { GL_SCISSOR_BOX, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
> -   { GL_SCISSOR_TEST, CONTEXT_BOOL(Scissor.Enabled), NO_EXTRA },
> -   { GL_STENCIL_BITS, BUFFER_INT(Visual.stencilBits), NO_EXTRA },
> -   { GL_STENCIL_CLEAR_VALUE, CONTEXT_INT(Stencil.Clear), NO_EXTRA },
> -   { GL_STENCIL_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
> -   { GL_STENCIL_FUNC, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA },
> -   { GL_STENCIL_PASS_DEPTH_FAIL, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA 
> },
> -   { GL_STENCIL_PASS_DEPTH_PASS, LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, NO_EXTRA 
> },
> -   { GL_STENCIL_REF, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
> -   { GL_STENCIL_TEST, CONTEXT_BOOL(Stencil.Enabled), NO_EXTRA },
> -   { GL_STENCIL_VALUE_MASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
> -   { GL_STENCIL_WRITEMASK, LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA },
> -   { GL_SUBPIXEL_BITS, CONTEXT_INT(Const.SubPixelBits), NO_EXTRA },
> -   { GL_TEXTURE_BINDING_2D, LOC_CUSTOM, TYPE_INT, TEXTURE_2D_INDEX, NO_EXTRA 
> },
> -   { GL_UNPACK_ALIGNMENT, CONTEXT_INT(Unpack.Alignment), NO_EXTRA },
> -   { GL_VIEWPORT, LOC_CUSTOM, TYPE_INT_4, 0, NO_EXTRA },
> -
> -   /* GL_ARB_multitexture */
> -   { GL_ACTIVE_TEXTURE, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
> -
> -   /* Note that all the OES_* extensions require that the Mesa "struct
> -* gl_extensions" include a member with the name of the extension.
> -* That structure does not yet include OES extensions (and we're
> -* not sure whether it wi

Re: [Mesa-dev] [PATCH v3 8/8] mesa: glGet: remove the unused TYPE_API_MASK flags

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 01:38:05PM +0300, Imre Deak wrote:
> Since we generate the hash tables in build time, these flags aren't used
> any more, remove them.
> 
> Signed-off-by: Imre Deak 
> Reviewed-by: Brian Paul 
Reviewed-by: Oliver McFadden 
> ---
>  src/mesa/main/get.c |6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index c5ccd66..b943d69 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -84,7 +84,6 @@
>  
>  enum value_type {
> TYPE_INVALID,
> -   TYPE_API_MASK,
> TYPE_INT,
> TYPE_INT_2,
> TYPE_INT_3,
> @@ -386,11 +385,6 @@ extra_NV_read_buffer_api_gl[] = {
> EXTRA_END
>  };
>  
> -#define API_OPENGL_BIT (1 << API_OPENGL)
> -#define API_OPENGLES_BIT (1 << API_OPENGLES)
> -#define API_OPENGLES2_BIT (1 << API_OPENGLES2)
> -#define API_OPENGL_CORE_BIT (1 << API_OPENGL_CORE)
> -
>  /* This is the big table describing all the enums we accept in
>   * glGet*v().  The table is partitioned into six parts: enums
>   * understood by all GL APIs (OpenGL, GLES and GLES2), enums shared
> -- 
> 1.7.9.5
> 

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


Re: [Mesa-dev] [PATCH 1/2] radeonsi: Better indexing of parameters in the pixel shader.

2012-10-01 Thread Alex Deucher
On Fri, Sep 28, 2012 at 12:34 PM, Michel Dänzer  wrote:
> From: Michel Dänzer 
>
> We were previously using the TGSI input index, which can exceed the number of
> parameters passed from the vertex shader via the parameter cache. Now we use
> a separate index which only counts those parameters.
>
> Prevents piglit regressions with the following fix.
>
> Signed-off-by: Michel Dänzer 

for the series:
Reviewed-by: Alex Deucher 

> ---
>  src/gallium/drivers/radeonsi/radeonsi_shader.c |   10 ++
>  src/gallium/drivers/radeonsi/radeonsi_shader.h |1 +
>  src/gallium/drivers/radeonsi/si_state_draw.c   |9 +
>  3 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c 
> b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index 57950a7..dbf2fa4 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -239,6 +239,7 @@ static void declare_input_fs(
>  {
> const char * intr_name;
> unsigned chan;
> +   struct si_shader *shader = &si_shader_ctx->shader->shader;
> struct lp_build_context * base =
> &si_shader_ctx->radeon_bld.soa.bld_base.base;
> struct gallivm_state * gallivm = base->gallivm;
> @@ -255,10 +256,7 @@ static void declare_input_fs(
>  * register field value
>  */
> LLVMValueRef params = use_sgpr(base->gallivm, SGPR_I32, 6);
> -
> -
> -   /* XXX: Is this the input_index? */
> -   LLVMValueRef attr_number = lp_build_const_int32(gallivm, input_index);
> +   LLVMValueRef attr_number;
>
> if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) {
> for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) {
> @@ -274,6 +272,10 @@ static void declare_input_fs(
> return;
> }
>
> +   shader->input[input_index].param_offset = shader->ninterp++;
> +   attr_number = lp_build_const_int32(gallivm,
> +  
> shader->input[input_index].param_offset);
> +
> /* XXX: Handle all possible interpolation modes */
> switch (decl->Interp.Interpolate) {
> case TGSI_INTERPOLATE_COLOR:
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h 
> b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> index aa2888c..6d2b188 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.h
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> @@ -63,6 +63,7 @@ struct si_shader {
> unsignednoutput;
> struct si_shader_io output[32];
>
> +   unsignedninterp;
> booluses_kill;
> boolfs_write_all;
> unsignednr_cbufs;
> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
> b/src/gallium/drivers/radeonsi/si_state_draw.c
> index db8f17f..e6a2a58 100644
> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
> @@ -101,7 +101,6 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, 
> struct si_pipe_shader *s
> struct si_pm4_state *pm4;
> unsigned i, exports_ps, num_cout, spi_ps_in_control, 
> db_shader_control;
> unsigned num_sgprs, num_user_sgprs;
> -   int ninterp = 0;
> boolean have_linear = FALSE, have_centroid = FALSE, have_perspective 
> = FALSE;
> unsigned fragcoord_interp_mode = 0;
> unsigned spi_baryc_cntl, spi_ps_input_ena;
> @@ -131,7 +130,7 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, 
> struct si_pipe_shader *s
> }
> continue;
> }
> -   ninterp++;
> +
> /* XXX: Flat shading hangs the GPU */
> if (shader->shader.input[i].interpolate == 
> TGSI_INTERPOLATE_CONSTANT ||
> (shader->shader.input[i].interpolate == 
> TGSI_INTERPOLATE_COLOR &&
> @@ -172,7 +171,7 @@ static void si_pipe_shader_ps(struct pipe_context *ctx, 
> struct si_pipe_shader *s
> exports_ps = 2;
> }
>
> -   spi_ps_in_control = S_0286D8_NUM_INTERP(ninterp);
> +   spi_ps_in_control = S_0286D8_NUM_INTERP(shader->shader.ninterp);
>
> spi_baryc_cntl = 0;
> if (have_perspective)
> @@ -365,7 +364,9 @@ static void si_update_spi_map(struct r600_context *rctx)
> tmp |= S_028644_OFFSET(0x20);
> }
>
> -   si_pm4_set_reg(pm4, R_028644_SPI_PS_INPUT_CNTL_0 + i * 4, 
> tmp);
> +   si_pm4_set_reg(pm4,
> +  R_028644_SPI_PS_INPUT_CNTL_0 + 
> ps->input[i].param_offset * 4,
> +  tmp);
> }
>
> si_pm4_set_state(rctx, spi, pm4);
> --
> 1.7.10.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman

Re: [Mesa-dev] [PATCH v6 1/1] intel: add support for ANGLE_texture_compression_dxt.

2012-10-01 Thread Brian Paul

On 10/01/2012 04:12 AM, Oliver McFadden wrote:

Signed-off-by: Oliver McFadden
CC: Brian Paul
---
v6: API == ES2 checks.


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


Re: [Mesa-dev] [PATCH] glapi: Do not use backtrace on Cygwin.

2012-10-01 Thread Brian Paul

On 09/29/2012 04:29 PM, Vinson Lee wrote:

execinfo.h is not available on Cygwin.

Signed-off-by: Vinson Lee
---
  src/mapi/glapi/gen/gl_gentable.py |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_gentable.py 
b/src/mapi/glapi/gen/gl_gentable.py
index 5657e32..edaabdb 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -42,7 +42,7 @@ header = """/* GLXEXT is the define used in the xserver when 
the GLX extension i
  #endif

  #if (defined(GLXEXT)&&  defined(HAVE_BACKTRACE)) \\
-   || (!defined(GLXEXT)&&  defined(DEBUG)&&  !defined(_WIN32_WCE))
+   || (!defined(GLXEXT)&&  defined(DEBUG)&&  !defined(_WIN32_WCE)&&  
!defined(__CYGWIN__))
  #define USE_BACKTRACE
  #endif



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


[Mesa-dev] [Bug 55445] Torchlight: crash due to texture error

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

Michel Dänzer  changed:

   What|Removed |Added

   Assignee|dri-devel@lists.freedesktop |mesa-dev@lists.freedesktop.
   |.org|org
  Component|Drivers/Gallium/r600|Mesa core

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


Re: [Mesa-dev] [PATCH] Revert "radeon/llvm: Inital flow control support for SI"

2012-10-01 Thread Tom Stellard
On Fri, Sep 28, 2012 at 06:24:13PM +0200, Michel Dänzer wrote:
> From: Michel Dänzer 
> 
> This reverts commit bfd55711c1eb32ffbfceb9d566abae98f0015f23.
> 
> It makes piglit unreliable due to VM protection faults and GPU lockups.
> 
> Signed-off-by: Michel Dänzer 
>  src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp |1 -
>  
> diff --git a/src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp 
> b/src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp
> index 0b70191..c1b6840 100644
> --- a/src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp
> +++ b/src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp
> @@ -134,7 +134,6 @@ bool AMDGPUPassConfig::addPreEmitPass() {
>  addPass(FinalizeMachineBundlesID);
>} else {
>  PM->add(createSILowerLiteralConstantsPass(*TM));
> -PM->add(createSILowerFlowControlPass(*TM));
>}
>  

Instead of reverting the entire commit, you can just tell the
TargetMachine not to add the SILowerFlowControlPass.  It should have the
same effect as a full revert.

With that change:

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


[Mesa-dev] [Bug 55445] Torchlight: crash due to texture error

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

--- Comment #5 from Brian Paul  ---
Can you tell me what exactly are the parameters to glCompressedTexImage2D which
cause this error?

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


Re: [Mesa-dev] [PATCH] adroid : glcpp: fix abuse of yylex

2012-10-01 Thread Oliver McFadden
On Fri, Sep 28, 2012 at 05:36:40PM +0300, Negreanu Marius Adrian wrote:
> Port the 'glcpp: fix abuse of yylex' commit to Android.mk
> Also, since the Android.*.mk are sourced in a global namespace,
> the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name,
> 
> The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a
> 
> There's also a bugzilla for this: 54947
> 
> Signed-off-by: Negreanu Marius Adrian 
Reviewed-by: Oliver McFadden 

Adding Dave Airlie to CC due to his authorship of the original fix
commit.  Dave, could you also review?

If Adrian cannot push upstream I'll push on his behalf after review.

> ---
>  src/glsl/Android.gen.mk | 6 +++---
>  src/mesa/Android.gen.mk | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
> index e4ccb72..2ed9fa6 100644
> --- a/src/glsl/Android.gen.mk
> +++ b/src/glsl/Android.gen.mk
> @@ -52,10 +52,10 @@ define local-l-or-ll-to-c-or-cpp
>   $(hide) $(LEX) --nounistd -o$@ $<
>  endef
>  
> -define local-y-to-c-and-h
> +define glsl_local-y-to-c-and-h
>   @mkdir -p $(dir $@)
>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> - $(hide) $(YACC) -o $@ $<
> + $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
>  endef
>  
>  define local-yy-to-cpp-and-h
> @@ -80,7 +80,7 @@ $(intermediates)/glcpp/glcpp-lex.c: 
> $(LOCAL_PATH)/glcpp/glcpp-lex.l
>   $(call local-l-or-ll-to-c-or-cpp)
>  
>  $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
> - $(call local-y-to-c-and-h)
> + $(call glsl_local-y-to-c-and-h)
>  
>  BUILTIN_COMPILER := 
> $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
>  
> diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
> index f5e6323..c17df1a 100644
> --- a/src/mesa/Android.gen.mk
> +++ b/src/mesa/Android.gen.mk
> @@ -75,10 +75,10 @@ define local-l-to-c
>   $(hide) $(LEX) -o$@ $<
>  endef
>  
> -define local-y-to-c-and-h
> +define mesa_local-y-to-c-and-h
>   @mkdir -p $(dir $@)
>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> - $(hide) $(YACC) -o $@ $<
> + $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>  endef
>  
>  define es-gen
> @@ -104,7 +104,7 @@ $(intermediates)/main/api_exec_%_remap_helper.h: 
> $(es_hdr_deps)
>   $(call es-gen, -c $*)
>  
>  $(intermediates)/program/program_parse.tab.c: 
> $(LOCAL_PATH)/program/program_parse.y
> - $(local-y-to-c-and-h)
> + $(mesa_local-y-to-c-and-h)
>  
>  $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
>   $(local-l-to-c)
> -- 
> 1.7.11.3
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH] adroid : glcpp: fix abuse of yylex

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 05:16:55PM +0300, Oliver McFadden wrote:
> On Fri, Sep 28, 2012 at 05:36:40PM +0300, Negreanu Marius Adrian wrote:
> > Port the 'glcpp: fix abuse of yylex' commit to Android.mk
> > Also, since the Android.*.mk are sourced in a global namespace,
> > the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name,
> > 
> > The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a
> > 
> > There's also a bugzilla for this: 54947
> > 
> > Signed-off-by: Negreanu Marius Adrian 
> Reviewed-by: Oliver McFadden 
> 
> Adding Dave Airlie to CC due to his authorship of the original fix
> commit.  Dave, could you also review?
> 
> If Adrian cannot push upstream I'll push on his behalf after review.

Of course the patch title should be fixed for a typo: "adroid" ->
"android"

> 
> > ---
> >  src/glsl/Android.gen.mk | 6 +++---
> >  src/mesa/Android.gen.mk | 6 +++---
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
> > index e4ccb72..2ed9fa6 100644
> > --- a/src/glsl/Android.gen.mk
> > +++ b/src/glsl/Android.gen.mk
> > @@ -52,10 +52,10 @@ define local-l-or-ll-to-c-or-cpp
> > $(hide) $(LEX) --nounistd -o$@ $<
> >  endef
> >  
> > -define local-y-to-c-and-h
> > +define glsl_local-y-to-c-and-h
> > @mkdir -p $(dir $@)
> > @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> > -   $(hide) $(YACC) -o $@ $<
> > +   $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
> >  endef
> >  
> >  define local-yy-to-cpp-and-h
> > @@ -80,7 +80,7 @@ $(intermediates)/glcpp/glcpp-lex.c: 
> > $(LOCAL_PATH)/glcpp/glcpp-lex.l
> > $(call local-l-or-ll-to-c-or-cpp)
> >  
> >  $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
> > -   $(call local-y-to-c-and-h)
> > +   $(call glsl_local-y-to-c-and-h)
> >  
> >  BUILTIN_COMPILER := 
> > $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
> >  
> > diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
> > index f5e6323..c17df1a 100644
> > --- a/src/mesa/Android.gen.mk
> > +++ b/src/mesa/Android.gen.mk
> > @@ -75,10 +75,10 @@ define local-l-to-c
> > $(hide) $(LEX) -o$@ $<
> >  endef
> >  
> > -define local-y-to-c-and-h
> > +define mesa_local-y-to-c-and-h
> > @mkdir -p $(dir $@)
> > @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> > -   $(hide) $(YACC) -o $@ $<
> > +   $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
> >  endef
> >  
> >  define es-gen
> > @@ -104,7 +104,7 @@ $(intermediates)/main/api_exec_%_remap_helper.h: 
> > $(es_hdr_deps)
> > $(call es-gen, -c $*)
> >  
> >  $(intermediates)/program/program_parse.tab.c: 
> > $(LOCAL_PATH)/program/program_parse.y
> > -   $(local-y-to-c-and-h)
> > +   $(mesa_local-y-to-c-and-h)
> >  
> >  $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
> > $(local-l-to-c)
> > -- 
> > 1.7.11.3
> > 
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
> -- 
> Oliver McFadden.
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH v6 1/1] intel: add support for ANGLE_texture_compression_dxt.

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 08:04:17AM -0600, Brian Paul wrote:
> On 10/01/2012 04:12 AM, Oliver McFadden wrote:
> > Signed-off-by: Oliver McFadden
> > CC: Brian Paul
> > ---
> > v6: API == ES2 checks.
> 
> LGTM.  Reviewed-by: Brian Paul 

Great, pushed!  Sorry for the many iterations of this patch...

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


Re: [Mesa-dev] [PATCH 1/2] radeon/llvm: use specialised R600.store.pixel.* for fragment shader

2012-10-01 Thread Tom Stellard
On Sat, Sep 29, 2012 at 05:19:21PM +0200, Vincent Lejeune wrote:
> ---
>  src/gallium/drivers/radeon/AMDGPUISelLowering.cpp  |  1 +
>  src/gallium/drivers/radeon/AMDGPUISelLowering.h|  1 +
>  .../radeon/MCTargetDesc/R600MCCodeEmitter.cpp  | 21 ++-
>  src/gallium/drivers/radeon/R600ISelLowering.cpp| 66 
> ++
>  src/gallium/drivers/radeon/R600Instructions.td | 57 +++
>  .../drivers/radeon/R600IntrinsicsNoOpenCL.td   |  6 ++
>  src/gallium/drivers/radeon/R600IntrinsicsOpenCL.td |  6 ++
>  .../drivers/radeon/R600MachineFunctionInfo.cpp |  4 +-
>  .../drivers/radeon/R600MachineFunctionInfo.h   |  2 +
>  9 files changed, 162 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeon/AMDGPUISelLowering.cpp 
> b/src/gallium/drivers/radeon/AMDGPUISelLowering.cpp
> index 04dadc3..5cb4d87 100644
> --- a/src/gallium/drivers/radeon/AMDGPUISelLowering.cpp
> +++ b/src/gallium/drivers/radeon/AMDGPUISelLowering.cpp
> @@ -348,5 +348,6 @@ const char* 
> AMDGPUTargetLowering::getTargetNodeName(unsigned Opcode) const
>NODE_NAME_CASE(URECIP)
>NODE_NAME_CASE(INTERP)
>NODE_NAME_CASE(INTERP_P0)
> +  NODE_NAME_CASE(EXPORT)
>}
>  }
> diff --git a/src/gallium/drivers/radeon/AMDGPUISelLowering.h 
> b/src/gallium/drivers/radeon/AMDGPUISelLowering.h
> index 2d8ed82..58d2287 100644
> --- a/src/gallium/drivers/radeon/AMDGPUISelLowering.h
> +++ b/src/gallium/drivers/radeon/AMDGPUISelLowering.h
> @@ -121,6 +121,7 @@ enum
>URECIP,
>INTERP,
>INTERP_P0,
> +  EXPORT,
>LAST_AMDGPU_ISD_NUMBER
>  };
>  
> diff --git a/src/gallium/drivers/radeon/MCTargetDesc/R600MCCodeEmitter.cpp 
> b/src/gallium/drivers/radeon/MCTargetDesc/R600MCCodeEmitter.cpp
> index a11f482..623676c 100644
> --- a/src/gallium/drivers/radeon/MCTargetDesc/R600MCCodeEmitter.cpp
> +++ b/src/gallium/drivers/radeon/MCTargetDesc/R600MCCodeEmitter.cpp
> @@ -108,7 +108,8 @@ enum InstrTypes {
>INSTR_TEX,
>INSTR_FC,
>INSTR_NATIVE,
> -  INSTR_VTX
> +  INSTR_VTX,
> +  INSTR_EXPORT
>  };
>  
>  enum FCInstr {
> @@ -183,6 +184,24 @@ void R600MCCodeEmitter::EncodeInstruction(const MCInst 
> &MI, raw_ostream &OS,
>  Emit(InstWord2, OS);
>  break;
>}
> +case AMDGPU::R600_Export:
> +case AMDGPU::R600_Export_DONE:
> +  {
> +uint64_t Inst = getBinaryCodeForInstr(MI, Fixups);
> +EmitByte(INSTR_EXPORT, OS);
> +const MCOperand &MO = MI.getOperand(0);
> +EmitByte(getHWReg(MO.getReg()), OS);
> +if (MI.getOpcode() == AMDGPU::R600_Export)
> +  EmitByte(0x27, OS);
> +else
> +  EmitByte(0x28, OS);
> +EmitByte(MI.getOperand(2).getImm(), OS);
> +EmitByte(MI.getOperand(3).getImm(), OS);
> +EmitByte(MI.getOperand(4).getImm(), OS);
> +EmitByte(MI.getOperand(5).getImm(), OS);
> +EmitByte(MI.getOperand(6).getImm(), OS);
> +break;
> +  }

Going forward, I would really like to have LLVM use the real encoding
for instructions rather than using the bytestream.  Could you change
the encoding to be more like what we do for VTX instructions?

>  
>  default:
>EmitALUInstr(MI, Fixups, OS);
> diff --git a/src/gallium/drivers/radeon/R600ISelLowering.cpp 
> b/src/gallium/drivers/radeon/R600ISelLowering.cpp
> index 5dd2f53..cda7a38 100644
> --- a/src/gallium/drivers/radeon/R600ISelLowering.cpp
> +++ b/src/gallium/drivers/radeon/R600ISelLowering.cpp
> @@ -264,6 +264,24 @@ MachineBasicBlock * 
> R600TargetLowering::EmitInstrWithCustomInserter(
>  
>return BB;
>  }
> +  case AMDGPU::R600_Export:
> +{
> +  MachineBasicBlock::iterator SecondI = I;
> +  SecondI++;
> +  SecondI++;
> +  if (SecondI != BB->end())
> +return BB;

A RAT_WRITE_* instruction checks if the next instruction is AMDIL::RETURN
to determine whether or it is the last instruction in the program.
I know this isn't really ideal, but could you do the same here, just to
be consistent.

> +  BuildMI(*BB, I, BB->findDebugLoc(I), 
> TII->get(AMDGPU::R600_Export_DONE))
> +.addOperand(MI->getOperand(0))
> +.addOperand(MI->getOperand(1))
> +.addOperand(MI->getOperand(2))
> +.addOperand(MI->getOperand(3))
> +.addOperand(MI->getOperand(4))
> +.addOperand(MI->getOperand(5))
> +.addOperand(MI->getOperand(6));
> +  break;
> +}
> +
>}
>  
>MI->eraseFromParent();
> @@ -300,6 +318,54 @@ SDValue R600TargetLowering::LowerOperation(SDValue Op, 
> SelectionDAG &DAG) const
>}
>return DAG.getCopyToReg(Chain, Op.getDebugLoc(), Reg, 
> Op.getOperand(2));
>  }
> +case AMDGPUIntrinsic::R600_store_pixel_color: {
> +  MachineFunction &MF = DAG.getMachineFunction();
> +  R600MachineFunctionInfo * MFI = MF.getInfo();
> +  int64_t RegIndex = 
> cast(Op.getOperand(3))->getZExtValue();
> +  unsigned Slot = RegIndex / 4;
> +
> +

Re: [Mesa-dev] [PATCH 2/2] r600g: make tgsi-to-llvm generates store.pixel* intrinsic for fs

2012-10-01 Thread Tom Stellard
On Sat, Sep 29, 2012 at 05:19:22PM +0200, Vincent Lejeune wrote:
> ---
>  src/gallium/drivers/r600/r600_llvm.c | 66 ++
>  src/gallium/drivers/r600/r600_shader.c   | 79 
> ++--
>  src/gallium/drivers/radeon/radeon_llvm.h |  4 ++
>  3 files changed, 137 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_llvm.c 
> b/src/gallium/drivers/r600/r600_llvm.c
> index 71ea578..dddc867 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -115,6 +115,8 @@ static void llvm_emit_epilogue(struct 
> lp_build_tgsi_context * bld_base)
>   struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
>   struct lp_build_context * base = &bld_base->base;
>   unsigned i;
> + 
> + unsigned color_count = 0;
>  
>   /* Add the necessary export instructions */
>   for (i = 0; i < ctx->output_reg_count; i++) {
> @@ -123,18 +125,66 @@ static void llvm_emit_epilogue(struct 
> lp_build_tgsi_context * bld_base)
>   LLVMValueRef output;
>   unsigned adjusted_reg_idx = i +
>   ctx->reserved_reg_count;
> - LLVMValueRef reg_index = lp_build_const_int32(
> - base->gallivm,
> - radeon_llvm_reg_index_soa(adjusted_reg_idx, 
> chan));
>  
>   output = LLVMBuildLoad(base->gallivm->builder,
>   ctx->soa.outputs[i][chan], "");
>  
> - lp_build_intrinsic_binary(
> - base->gallivm->builder,
> - "llvm.AMDGPU.store.output",
> - LLVMVoidTypeInContext(base->gallivm->context),
> - output, reg_index);
> + if (ctx->type == TGSI_PROCESSOR_VERTEX) {
> + LLVMValueRef reg_index = lp_build_const_int32(
> + base->gallivm,
> + 
> radeon_llvm_reg_index_soa(adjusted_reg_idx, chan));
> + lp_build_intrinsic_binary(
> + base->gallivm->builder,
> + "llvm.AMDGPU.store.output",
> + 
> LLVMVoidTypeInContext(base->gallivm->context),
> + output, reg_index);
> + } else if (ctx->type == TGSI_PROCESSOR_FRAGMENT) {
> + switch (ctx->r600_outputs[i].name) {
> + case TGSI_SEMANTIC_COLOR:
> + if ( color_count/4 < 
> ctx->color_buffer_count + ctx->extra_buffer) {
> + if (ctx->fs_color_all) {
> + for (unsigned j = 0; j 
> < ctx->color_buffer_count; j++) {
> + LLVMValueRef 
> reg_index = lp_build_const_int32(
> + 
> base->gallivm,
> + (j * 4) 
> + chan);
> + 
> lp_build_intrinsic_binary(
> + 
> base->gallivm->builder,
> + 
> "llvm.R600.store.pixel.color",
> + 
> LLVMVoidTypeInContext(base->gallivm->context),
> + output, 
> reg_index);
> + }
> + } else {
> + LLVMValueRef reg_index 
> = lp_build_const_int32(
> + base->gallivm,
> + 
> (color_count++/4) * 4 + chan);
> + 
> lp_build_intrinsic_binary(
> + 
> base->gallivm->builder,
> + 
> "llvm.R600.store.pixel.color",
> + 
> LLVMVoidTypeInContext(base->gallivm->context),
> + output, 
> reg_index);
> + }
> + }
> + break;
> + case TGSI_SEMANTIC_POSITION:
> + if (chan != 2)
> + c

Re: [Mesa-dev] automake-gallium testing

2012-10-01 Thread Andreas Boll
2012/9/21 Matt Turner :
> On Mon, Sep 17, 2012 at 8:22 AM, Andreas Boll
>  wrote:
>> Yep, vdpau is also affected.
>>
>> $ LD_LIBRARY_PATH="/home/andreas/mesa-testing/lib/vdpau"
>> VDPAU_DRIVER=r600' vdpauinfo
>> display: :0   screen: 0
>> Failed to open VDPAU backend
>> /home/andreas/mesa-testing/lib/vdpau/libvdpau_r600.so: undefined
>> symbol: xcb_dri2_id
>> Error creating VDPAU device: 1
>
> Thanks. I think this should be fixed now. I feel like I'm starting to
> go blind checking nm output against scanelf -n.

Hi Matt,

I've tested your automake-gallium2 branch and found another regression
in the vdpau state tracker.

I've bisected to this commit:

5a20b8689989faa027f7ad29bb23b33a2d81d4b9 is the first bad commit
commit 5a20b8689989faa027f7ad29bb23b33a2d81d4b9
Author: Matt Turner 
Date:   Tue Sep 4 13:13:51 2012 -0700

Remove vdpau hack

Steps to reproduce:

$ ./autogen.sh --prefix=$HOME/mesa-testing \
--with-gallium-drivers=r600,swrast \
--with-dri-drivers= \
--enable-texture-float \
--enable-glx-tls \
--enable-gallium-g3dvl \
--enable-vdpau \
--enable-xvmc

$ make
$ make install

$ LD_LIBRARY_PATH="/home/andreas/mesa-testing/lib/vdpau"
VDPAU_DRIVER=r600 vdpauinfo
display: :0   screen: 0
/home/andreas/mesa-testing/lib/vdpau/libvdpau_r600.so.1: undefined
symbol: vdp_imp_device_create_x11
Error creating VDPAU device: 1

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


Re: [Mesa-dev] [PATCH 19/19] mesa/tests: Sanity check the ES2 dispatch table

2012-10-01 Thread Ian Romanick

On 09/30/2012 03:20 PM, Paul Berry wrote:

On 28 September 2012 14:15, Ian Romanick mailto:i...@freedesktop.org>> wrote:

On 09/28/2012 01:55 PM, Paul Berry wrote:

On 5 September 2012 15:09, Ian Romanick mailto:i...@freedesktop.org>
>> wrote:

 From: Ian Romanick mailto:ian.d.roman...@intel.com>
 >>


 This test is only built when shared-glapi is used.  Because
of changes
 elsewhere in the tree that were necessary to make
shared-glapi work
 correct with GLX, it's not feasible to make the test
function both ways.

 Signed-off-by: Ian Romanick mailto:ian.d.roman...@intel.com>
 >>



This test is failing on my system when I run "make check":

[--] 1 test from DispatchSanity_test
[ RUN  ] DispatchSanity_test.GLES2
Mesa warning: couldn't open libtxc_dxtn.so, software DXTn
compression/decompression unavailable
dispatch_sanity.cpp:122: Failure
Value of: table[i]
Actual: 0x4de54e
Expected: (_glapi_proc) _mesa_generic_nop
Which is: 0x41af72
i = 321
[  FAILED  ] DispatchSanity_test.GLES2 (4 ms)
[--] 1 test from DispatchSanity_test (4 ms total)

Is anybody else getting this problem?


Can you put the following in the SET_by_offset macro
(src/mesa/main/dispatch.h in your build directory):

 if (offset == 321) abort(); \

then backtrace to see what API function is at fault?


Argh, for reasons I haven't figured out yet, the failure only happens
when I run "make check".  It doesn't happen when I run the test directly
from the command line (or in the debugger), which makes backtracing
difficult :)

Probably there is something wrong with my build environment.  I'll
troubleshoot some more on my own and get back to you if I don't get
anywhere.


I've noticed that 'make check' and .libs/main-test can pick up different 
versions of libglapi.  You may need to use LD_PRELOAD to be sure it 
picks up the right version when not using 'make check'.


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


Re: [Mesa-dev] Mesa 9.0 release plans

2012-10-01 Thread Ian Romanick

On 09/28/2012 04:32 PM, Chad Versace wrote:

On 09/28/2012 04:10 PM, Ian Romanick wrote:

There are only a few patches left on master marked as candidates for the
branch.  These basically fall into three groups:




- TexImage performance improvement for Google Chrome.  There's still some 
debate about whether or not these should be picked.
413c4914129cd26ca87960852d8c0264c0fb29e7 intel: Improve teximage perf for 
Google Chrome paint rects (v3)
b1d0fe022dc4826dadce014ab8fe062a82f75a16 intel: Fix segfault in 
intel_texsubimage_tiled_memcpy
b5891286202987dfc2606ac716050c0ee426de11 intel: Fix yet-another-bug in 
intel_texsubimage_tiled_memcpy



These are a nice-to-have but not critical. I'd like to see them committed
because they improve Chrome's texture upload workload by 3-5x depending on
environmental factors. But I won't cry if people object.


There is another bug that bisects to this series, so I'm NAKing it.

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

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


Re: [Mesa-dev] Mesa 9.0 release plans

2012-10-01 Thread Ian Romanick

On 09/28/2012 09:22 PM, Kenneth Graunke wrote:

On 09/28/2012 04:10 PM, Ian Romanick wrote:

There are only a few patches left on master marked as candidates for the
branch.  These basically fall into three groups:

- Fix mipmap generation.  There is stil one outstanding bug related to
integer textures.  Anuj is working on a fix (disable mipmap generation
for integer textures).  Once this is available, the whole series will be
picked.

299acac849eb8506de9760c94c6e8e8b1046d909 _mesa_meta_GenerateMipmap:
Support all texture targets by generating shaders at runtime
15bf3103b48a5928321fe56fbb3ed28a0f314418 _mesa_meta_GenerateMipmap:
Generate separate shaders for glsl 120 / 130
eb1d87fb945783448cc40ad43c9cd4d98002d424 meta: Add on demand compilation
of per target shader programs

- TexImage performance improvement for Google Chrome.  There's still
some debate about whether or not these should be picked.
413c4914129cd26ca87960852d8c0264c0fb29e7 intel: Improve teximage perf
for Google Chrome paint rects (v3)
b1d0fe022dc4826dadce014ab8fe062a82f75a16 intel: Fix segfault in
intel_texsubimage_tiled_memcpy
b5891286202987dfc2606ac716050c0ee426de11 intel: Fix yet-another-bug in
intel_texsubimage_tiled_memcpy

- A set of fixes for r600g.  The first had a pile of conflicts, and I
don't have hardware to test.  I punted this back to Marek.

933faae2b8669f459e7ab27d6bcbfb6f4136b6d5 r600g: flush FMASK and CMASK
when changing colorbuffers on Evergreen
836325bf7edd797e02ab0717a05ca5c51aa1ac93 r600g: fix instance divisor on
Cayman
fd5c5384648a0d6191c19748a2d1f1148c5ee98f r600g: fix RSQ of negative
value on Cayman
96f50d0cf7bb13507f272d2f6ef9a6fca24d18e1 r600g: fix EXP on Cayman

My goal is to have all of these resolved by Monday or Tuesday, and we'll
do the release on Friday (10/5).

Sound good?


There are still a number of regressions on master vs. 8.0.  Notably,
Pineview is in really horrible shape.  There're a few patches on the


I thought it was only a disaster on master.  Is 9.0 branch just as bad?


list that still need to get into master...then 9.0.


Do you have a list?


But I think we can pull that off still.


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


Re: [Mesa-dev] Please test the automake-gallium branch

2012-10-01 Thread Tom Stellard
On Wed, Sep 26, 2012 at 04:09:38PM -0700, Matt Turner wrote:
> On Wed, Sep 26, 2012 at 2:50 PM, Török Edwin
>  wrote:
> > On 09/26/2012 11:59 PM, Matt Turner wrote:
> >> I've pushed an automake-gallium2 branch to my repo with a number of
> >> fixes squashed-in.
> >>
> >> git://people.freedesktop.org/~mattst88/mesa automake-gallium2
> >
> > Nice progress!
> >
> > I was able to build it after reversing the 'if' below.
> 
> Weird. I don't have this problem.
> 
> > It doesn't load though:
> > libGL: OpenDriver: trying opt/xorg/lib/dri/r600_dri.so
> > libGL error: dlopen opt/xorg/lib/dri/r600_dri.so failed 
> > (opt/xorg/lib/dri/r600_dri.so: undefined symbol: 
> > _ZN4llvm13ParseAssemblyEPNS_12MemoryBufferEPNS_6ModuleERNS_12SMDiagnosticERNS_11LLVMContextE)
> 
> Tom, are there some extra LLVM libs that need to be linked in, or is
> this a problem caused by switching the if statement? I'm not able to
> reproduce this locally (with LLVM-3.1).
> 

I have not seen this error either.  I will try to reproduce when I get a
chance.

> > diff --git a/src/gallium/drivers/radeon/Makefile.am 
> > b/src/gallium/drivers/radeon/Makefile.am
> > index d0e0ec3..668ad5f 100644
> > --- a/src/gallium/drivers/radeon/Makefile.am
> > +++ b/src/gallium/drivers/radeon/Makefile.am
> > @@ -28,9 +28,9 @@ SIRegisterGetHWRegNum.inc: SIGenRegisterInfo.pl
> >
> >  R600Intrinsics.td: R600IntrinsicsNoOpenCL.td R600IntrinsicsOpenCL.td
> >  if HAVE_R600_LLVM_INTRINSICS
> > -   cp $(srcdir)/R600IntrinsicsNoOpenCL.td R600Intrinsics.td
> > -else
> > cp $(srcdir)/R600IntrinsicsOpenCL.td R600Intrinsics.td
> > +else
> > +   cp $(srcdir)/R600IntrinsicsNoOpenCL.td R600Intrinsics.td
> >  endif
> >
> > However it still seems to be missing a dependency as rerunning configure
> > doesn't cause the .td file to be copied, had to manually remove it.
> 
> Tom's area. Let's see what he thinks.
> 

I'm very close to requiring LLVM 3.2 for compute support, which means
we can get rid of this bad hack.  So, I'll try to fix this in master.
In the short term, you can just rename R600IntrinsicsNoOpenCL.td to
R600Intrinsics.td and drop this part of the Makefile.

-Tom

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


[Mesa-dev] [Bug 55503] New: Constant vertex attributes broken

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

  Priority: medium
Bug ID: 55503
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Constant vertex attributes broken
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: rob...@sixbynine.org
  Hardware: Other
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

Created attachment 67932
  --> https://bugs.freedesktop.org/attachment.cgi?id=67932&action=edit
Standalone gles2 test using const attributes

We recently added support in Cogl for using constant attributes which we want
to use as part of a UI runtime + editor we are currently working on but I'm
finding that they don't work with Mesa, even when using
LIBGL_ALWAYS_SOFTWARE=1.

I was able to reproduce the issue in a standalone gles2 test case which I've
attached and hopefully that will help clarify the problem.

I spent a bit of time trying to debug the issue myself yesterday, and although
I can't say I quite got my head around how the attribute state moves around I
did  managed to cobble together a patch that works for me. The thing I found
that looked amiss was in recalculate_input_bindings in the VP_ARB case:

  if (vertexAttrib[VERT_ATTRIB_GENERIC0].Enabled)
 inputs[0] = &vertexAttrib[VERT_ATTRIB_GENERIC0];
  else if (vertexAttrib[VERT_ATTRIB_POS].Enabled)
 inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
  else {
 inputs[0] = &vbo->currval[VBO_ATTRIB_POS];
 const_inputs |= VERT_BIT_POS;
  }

  

  for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {
 if (vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
inputs[VERT_ATTRIB_GENERIC(i)] =
&vertexAttrib[VERT_ATTRIB_GENERIC(i)];
 else {
inputs[VERT_ATTRIB_GENERIC(i)] =
&vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
 }
  }

Given that the test is a gles2 test I wouldn't expect that we should be special
casing inputs[0] and in this case it is also legitimate for
vertexAttrib[VERT_ATTRIB_GENERIC0] to be disabled which I guess shouldn't lead
us to refer to the legacy _POS attribute which is what it looks like is
happening. Also the loop that comes later to iterate the generic attributes
then starts at index 1 assuming that we've already dealt with 0 as a special
case which doesn't seem right for gles2.

I hacked the code like this to do what I guessed made more sense for gles2:

--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -473,11 +473,18 @@ recalculate_input_bindings(struct gl_context *ctx)
* Otherwise, legacy attributes available in the legacy slots,
* generic attributes in the generic slots and materials are not
* available as per-vertex attributes.
+   *
+   * If we aren't running with the legacy GL profile, with deprecated
+   * features, (GLES2 or GL_CORE) then generic[0] has its own current
value
+   * instead of being an alias for the legacy position array.
*/
   if (vertexAttrib[VERT_ATTRIB_GENERIC0].Enabled)
 inputs[0] = &vertexAttrib[VERT_ATTRIB_GENERIC0];
-  else if (vertexAttrib[VERT_ATTRIB_POS].Enabled)
-inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
+  else if (ctx->API != API_OPENGL) {
+inputs[0] = &vbo->currval[VBO_ATTRIB_GENERIC0];
+ const_inputs |= VERT_BIT_GENERIC(0);
+  } else if (vertexAttrib[VERT_ATTRIB_POS].Enabled)
+ inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
   else {
 inputs[0] = &vbo->currval[VBO_ATTRIB_POS];
  const_inputs |= VERT_BIT_POS;

and that seems to fix the test app for me. I had also tried skipping out the
whole inputs[0] special case if API==API_OPENGL, and basing the following for
loops at i = 0 but for some reason that doesn't work so I guess other things
are assuming that inputs[0] is a bit special.

If you look at the attached test there are a few #ifdefs I left in there to
affect the test. In create_shaders() there is an #if 0 to simply swap the order
of the two constant attributes in the glsl and for me this results in the
output color changing. There is an #ifdef to use glBindAttribLocation which
makes the test work for me. Finally there are #ifdefs to switch to using
glVertexAttribPointer instead of glVertexAttrib[24]f that also make the test
work.

When working, the test should output a constant pinky-purple (0xff00)
across the whole window, whereas I see red or blue depending on the order of
the attribute declarations in the glsl.

The color output by the fragment shader takes the red and green and alpha
components from the "test" attribute and the blue component comes from the .s
component of the "tex_coord" attribute. Although it looks awkward, I just did
that to make sure the v_tex_coord varying and tex_coord attribute wouldn't
somehow be optimized out due to not being r

[Mesa-dev] [Bug 55503] Constant vertex attributes broken

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

--- Comment #1 from Robert Bragg  ---
Created attachment 67934
  --> https://bugs.freedesktop.org/attachment.cgi?id=67934&action=edit
vbo: generic[0] only aliases pos if API=GL

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


[Mesa-dev] [Bug 55505] New: EnumStrings.LookUpByNumber regression

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

  Priority: medium
Bug ID: 55505
CC: omcfa...@gmail.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: EnumStrings.LookUpByNumber regression
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

$ make check
[...]
[ RUN  ] EnumStrings.LookUpByNumber
enum_strings.cpp:43: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE"
Expected: everything[i].name
Which is: "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"
enum_strings.cpp:43: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE"
Expected: everything[i].name
Which is: "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"
[  FAILED  ] EnumStrings.LookUpByNumber (1 ms)



9545d9611fd983fd63960de787dff51aedd4a7f9 is the first bad commit
commit 9545d9611fd983fd63960de787dff51aedd4a7f9
Author: Oliver McFadden 
Date:   Wed Sep 26 20:59:50 2012 +0300

intel: add support for ANGLE_texture_compression_dxt.

Signed-off-by: Oliver McFadden 
Reviewed-by: Brian Paul 

:04 04 10f19c68e82ac368bc2f17e73e82e5c3b3b8bb54
621cdebaa9d1585bf0b36b095fd9ceeb71619beb Msrc

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


Re: [Mesa-dev] [PATCH] i965/vs: fix unit mismatch in base_offset.

2012-10-01 Thread Kenneth Graunke
On 09/30/2012 10:08 PM, Kenneth Graunke wrote:
> On 09/20/2012 07:06 PM, Paul Berry wrote:
>> Callers of emit_scratch_{read,write}() pass a base_offset that is
>> measured in bytes, but emit_scratch_{read,write}() was assuming it was
>> measured in multiples of a complete register.  As a result, a shader
>> using a scratch read/write offset greater than zero (in practice, a
>> shader containing more than one variable in scratch) would use too
>> large an offset, frequently exceeding the available scratch space.
>>
>> This patch corrects the mismatch by dividing base_offset by REG_SIZE
>> at the beginning of emit_scratch_{read,write}().
>>
>> NOTE: This is a candidate for stable release branches.
>> ---
>>
>> No test cases were failing because of this bug, but it was getting in
>> the way of Ken's efforts to implement register spilling for vertex
>> shaders.
>>
>> Ken: I've done a full piglit run on master to verify that it doesn't
>> regress anything, but I didn't check whether there are any remaining
>> regressions when I apply it to your "spilling" branch.  All I checked
>> was that it fixed the 3 regressions you told me about earlier today.
>>
>>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 14 ++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
>> b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> index 682837f..60fab54 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> @@ -2443,12 +2443,19 @@ 
>> vec4_visitor::get_pull_constant_offset(vec4_instruction *inst,
>>  /**
>>   * Emits an instruction before @inst to load the value named by @orig_src
>>   * from scratch space at @base_offset to @temp.
>> + *
>> + * @base_offset is measured in bytes.
>>   */
>>  void
>>  vec4_visitor::emit_scratch_read(vec4_instruction *inst,
>>  dst_reg temp, src_reg orig_src,
>>  int base_offset)
>>  {
>> +   /* Convert base_offset from bytes to a register number, since that's what
>> +* get_scratch_offset() expects.
>> +*/
>> +   base_offset /= REG_SIZE;
>> +
>> int reg_offset = base_offset + orig_src.reg_offset;
>> src_reg index = get_scratch_offset(inst, orig_src.reladdr, reg_offset);
>>  
>> @@ -2458,12 +2465,19 @@ vec4_visitor::emit_scratch_read(vec4_instruction 
>> *inst,
>>  /**
>>   * Emits an instruction after @inst to store the value to be written
>>   * to @orig_dst to scratch space at @base_offset, from @temp.
>> + *
>> + * @base_offset is measured in bytes.
>>   */
>>  void
>>  vec4_visitor::emit_scratch_write(vec4_instruction *inst,
>>   src_reg temp, dst_reg orig_dst,
>>   int base_offset)
>>  {
>> +   /* Convert base_offset from bytes to a register number, since that's what
>> +* get_scratch_offset() expects.
>> +*/
>> +   base_offset /= REG_SIZE;
>> +
>> int reg_offset = base_offset + orig_dst.reg_offset;
>> src_reg index = get_scratch_offset(inst, orig_dst.reladdr, reg_offset);
> 
> Okay.  I've looked at this a bit more, and I think your patch is right,
> but there might be a bug pre-Gen6.
> 
> Here's my thinking.  In move_grf_array_access_to_scratch(), I see:
> 
>c->last_scratch += this->virtual_grf_sizes[src->reg] * 8 * 4;
> 
> This is clearly in measured in bytes: 8 * 4 is the size of a vec8 (or
> simd4x2) register.  This is passed to emit_scratch_read/write.
> 
> So the base_offset argument to emit_scratch_read/write is measured in
> bytes.  Your patch then causes it to be divided by REG_SIZE (8*4)
> (ironically undoing the earlier scaling), at which point base_offset is
> again the number of simd4x2 registers, or OWords.  We add reg_offset,
> which is also in OWords.
> 
> We then pass that to get_scratch_offset.  Everything's dandy for Gen6+,
> we want OWords.  But for earlier hardware, we hit:
> 
>/* Pre-gen6, the message header uses byte offsets instead of vec4
> * (16-byte) offset units.
> */
>if (intel->gen < 6)
>   message_header_scale *= 16;
> 
> At which point I say...16 bytes???   We're converting from units of
> OWords/SIMD4x2 registers, not units of vec4s.  So I believe this should
> be 32 bytes (REG_SIZE aka 8*4).
> 
> Thoughts?

Ooops.  Paul pointed out two problems with my analysis:
- An OWord is the size of a vec4, not a vec8, since a float is actually
a DWord.  (Grumble...terminology...)
- message_header_scale is actually initalized to 2, which scales from
number of whole 4x2 registers (vec8s) to OWords (vec4s).  This also
should correctly scale by 32 on Gen4-5.

So I believe Paul's patch is correct and the Gen4-5 bug I was concerned
about does not actually exist.

I respun a version that just leaves the variable in number of registers,
rather than multiplying by 32 to get bytes and immediately dividing
again.  Neither of us have a strong preference.  I'll send mine out
momentarily.

[Mesa-dev] [PATCH] dri drivers: Link dricommon before dynamic libraries

2012-10-01 Thread Matt Turner
I think libtool should be handling this for us, but the build fails for
Jordan because libdricommon (a static library, which uses expat) appears
before -lexpat on the linker command.
---
*This* is why there can never be enough build system testing.

Related: now that we have libdricore, why isn't libdricommon in it?

 src/mesa/drivers/dri/i915/Makefile.am|4 ++--
 src/mesa/drivers/dri/i965/Makefile.am|4 ++--
 src/mesa/drivers/dri/nouveau/Makefile.am |4 ++--
 src/mesa/drivers/dri/r200/Makefile.am|4 ++--
 src/mesa/drivers/dri/radeon/Makefile.am  |4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/Makefile.am 
b/src/mesa/drivers/dri/i915/Makefile.am
index 7ec4c22..cbdcf84 100644
--- a/src/mesa/drivers/dri/i915/Makefile.am
+++ b/src/mesa/drivers/dri/i915/Makefile.am
@@ -51,9 +51,9 @@ i915_dri_la_SOURCES = \
 
 i915_dri_la_LDFLAGS = -module -avoid-version -shared
 i915_dri_la_LIBADD = \
+   ../common/libdricommon.la \
$(DRI_LIB_DEPS) \
-   $(INTEL_LIBS) \
-   ../common/libdricommon.la
+   $(INTEL_LIBS)
 
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
b/src/mesa/drivers/dri/i965/Makefile.am
index 574a499..2cdfb51 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -55,9 +55,9 @@ libi965_dri_la_SOURCES = \
 # list of libs to be linked against by i965_dri.so and i965 test programs.
 COMMON_LIBS = \
libi965_dri.la \
+   ../common/libdricommon.la \
$(DRI_LIB_DEPS) \
-   $(INTEL_LIBS) \
-   ../common/libdricommon.la
+   $(INTEL_LIBS)
 
 TEST_LIBS = \
$(COMMON_LIBS) \
diff --git a/src/mesa/drivers/dri/nouveau/Makefile.am 
b/src/mesa/drivers/dri/nouveau/Makefile.am
index 82d3804..4589b05 100644
--- a/src/mesa/drivers/dri/nouveau/Makefile.am
+++ b/src/mesa/drivers/dri/nouveau/Makefile.am
@@ -47,9 +47,9 @@ nouveau_vieux_dri_la_SOURCES = \
 
 nouveau_vieux_dri_la_LDFLAGS = -module -avoid-version -shared
 nouveau_vieux_dri_la_LIBADD = \
+   ../common/libdricommon.la \
$(DRI_LIB_DEPS) \
-   $(NOUVEAU_LIBS) \
-   ../common/libdricommon.la
+   $(NOUVEAU_LIBS)
 
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
diff --git a/src/mesa/drivers/dri/r200/Makefile.am 
b/src/mesa/drivers/dri/r200/Makefile.am
index 5ec53de..8920ab0 100644
--- a/src/mesa/drivers/dri/r200/Makefile.am
+++ b/src/mesa/drivers/dri/r200/Makefile.am
@@ -49,9 +49,9 @@ r200_dri_la_SOURCES = \
 
 r200_dri_la_LDFLAGS = -module -avoid-version -shared
 r200_dri_la_LIBADD = \
+   ../common/libdricommon.la \
$(DRI_LIB_DEPS) \
-   $(RADEON_LIBS) \
-   ../common/libdricommon.la
+   $(RADEON_LIBS)
 
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
diff --git a/src/mesa/drivers/dri/radeon/Makefile.am 
b/src/mesa/drivers/dri/radeon/Makefile.am
index ec2d42e..36b852e 100644
--- a/src/mesa/drivers/dri/radeon/Makefile.am
+++ b/src/mesa/drivers/dri/radeon/Makefile.am
@@ -49,9 +49,9 @@ radeon_dri_la_SOURCES = \
 
 radeon_dri_la_LDFLAGS = -module -avoid-version -shared
 radeon_dri_la_LIBADD = \
+   ../common/libdricommon.la \
$(DRI_LIB_DEPS) \
-   $(RADEON_LIBS) \
-   ../common/libdricommon.la
+   $(RADEON_LIBS)
 
 # Provide compatibility with scripts for the old Mesa build system for
 # a while by putting a link to the driver into /lib of the build tree.
-- 
1.7.8.6

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


Re: [Mesa-dev] [PATCH] dri drivers: Link dricommon before dynamic libraries

2012-10-01 Thread Jordan Justen
On Mon, 2012-10-01 at 13:06 -0700, Matt Turner wrote:
> I think libtool should be handling this for us, but the build fails for
> Jordan because libdricommon (a static library, which uses expat) appears
> before -lexpat on the linker command.

You are missing Signed-off-by...

It fixes the make check build issue for me. Thanks for helping
debug this on my build.

Reviewed-by: Jordan Justen 
Tested-by: Jordan Justen 

> ---
> *This* is why there can never be enough build system testing.
> 
> Related: now that we have libdricore, why isn't libdricommon in it?
> 
>  src/mesa/drivers/dri/i915/Makefile.am|4 ++--
>  src/mesa/drivers/dri/i965/Makefile.am|4 ++--
>  src/mesa/drivers/dri/nouveau/Makefile.am |4 ++--
>  src/mesa/drivers/dri/r200/Makefile.am|4 ++--
>  src/mesa/drivers/dri/radeon/Makefile.am  |4 ++--
>  5 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/Makefile.am 
> b/src/mesa/drivers/dri/i915/Makefile.am
> index 7ec4c22..cbdcf84 100644
> --- a/src/mesa/drivers/dri/i915/Makefile.am
> +++ b/src/mesa/drivers/dri/i915/Makefile.am
> @@ -51,9 +51,9 @@ i915_dri_la_SOURCES = \
>  
>  i915_dri_la_LDFLAGS = -module -avoid-version -shared
>  i915_dri_la_LIBADD = \
> + ../common/libdricommon.la \
>   $(DRI_LIB_DEPS) \
> - $(INTEL_LIBS) \
> - ../common/libdricommon.la
> + $(INTEL_LIBS)
>  
>  # Provide compatibility with scripts for the old Mesa build system for
>  # a while by putting a link to the driver into /lib of the build tree.
> diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
> b/src/mesa/drivers/dri/i965/Makefile.am
> index 574a499..2cdfb51 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.am
> +++ b/src/mesa/drivers/dri/i965/Makefile.am
> @@ -55,9 +55,9 @@ libi965_dri_la_SOURCES = \
>  # list of libs to be linked against by i965_dri.so and i965 test programs.
>  COMMON_LIBS = \
>   libi965_dri.la \
> + ../common/libdricommon.la \
>   $(DRI_LIB_DEPS) \
> - $(INTEL_LIBS) \
> - ../common/libdricommon.la
> + $(INTEL_LIBS)
>  
>  TEST_LIBS = \
>   $(COMMON_LIBS) \
> diff --git a/src/mesa/drivers/dri/nouveau/Makefile.am 
> b/src/mesa/drivers/dri/nouveau/Makefile.am
> index 82d3804..4589b05 100644
> --- a/src/mesa/drivers/dri/nouveau/Makefile.am
> +++ b/src/mesa/drivers/dri/nouveau/Makefile.am
> @@ -47,9 +47,9 @@ nouveau_vieux_dri_la_SOURCES = \
>  
>  nouveau_vieux_dri_la_LDFLAGS = -module -avoid-version -shared
>  nouveau_vieux_dri_la_LIBADD = \
> + ../common/libdricommon.la \
>   $(DRI_LIB_DEPS) \
> - $(NOUVEAU_LIBS) \
> - ../common/libdricommon.la
> + $(NOUVEAU_LIBS)
>  
>  # Provide compatibility with scripts for the old Mesa build system for
>  # a while by putting a link to the driver into /lib of the build tree.
> diff --git a/src/mesa/drivers/dri/r200/Makefile.am 
> b/src/mesa/drivers/dri/r200/Makefile.am
> index 5ec53de..8920ab0 100644
> --- a/src/mesa/drivers/dri/r200/Makefile.am
> +++ b/src/mesa/drivers/dri/r200/Makefile.am
> @@ -49,9 +49,9 @@ r200_dri_la_SOURCES = \
>  
>  r200_dri_la_LDFLAGS = -module -avoid-version -shared
>  r200_dri_la_LIBADD = \
> + ../common/libdricommon.la \
>   $(DRI_LIB_DEPS) \
> - $(RADEON_LIBS) \
> - ../common/libdricommon.la
> + $(RADEON_LIBS)
>  
>  # Provide compatibility with scripts for the old Mesa build system for
>  # a while by putting a link to the driver into /lib of the build tree.
> diff --git a/src/mesa/drivers/dri/radeon/Makefile.am 
> b/src/mesa/drivers/dri/radeon/Makefile.am
> index ec2d42e..36b852e 100644
> --- a/src/mesa/drivers/dri/radeon/Makefile.am
> +++ b/src/mesa/drivers/dri/radeon/Makefile.am
> @@ -49,9 +49,9 @@ radeon_dri_la_SOURCES = \
>  
>  radeon_dri_la_LDFLAGS = -module -avoid-version -shared
>  radeon_dri_la_LIBADD = \
> + ../common/libdricommon.la \
>   $(DRI_LIB_DEPS) \
> - $(RADEON_LIBS) \
> - ../common/libdricommon.la
> + $(RADEON_LIBS)
>  
>  # Provide compatibility with scripts for the old Mesa build system for
>  # a while by putting a link to the driver into /lib of the build tree.


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


[Mesa-dev] [PATCH 1/2] build: Use AX_PROG_BISON

2012-10-01 Thread Matt Turner
No one tests yacc/byacc. Let's just request bison specifically.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46815
---
 configure.ac|   10 ++-
 m4/ax_prog_bison.m4 |   71 +++
 2 files changed, 74 insertions(+), 7 deletions(-)
 create mode 100644 m4/ax_prog_bison.m4

diff --git a/configure.ac b/configure.ac
index 896f98a..bf01924 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,13 +58,9 @@ if test "x$MKDEP" = "x"; then
 AC_MSG_ERROR([makedepend is required to build Mesa])
 fi
 
-AC_PROG_YACC
-AC_PATH_PROG([YACC_INST], $YACC)
-if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"; then
-if test -z "$YACC_INST"; then
-AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
-fi
-fi
+AX_PROG_BISON([],
+  AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"]
+[AC_MSG_ERROR([bison not found - unable to compile 
glcpp-parse.y])]))
 AC_PROG_LEX
 
 AC_PATH_PROG([PERL], [perl])
diff --git a/m4/ax_prog_bison.m4 b/m4/ax_prog_bison.m4
new file mode 100644
index 000..dae4470
--- /dev/null
+++ b/m4/ax_prog_bison.m4
@@ -0,0 +1,71 @@
+# ===
+#   http://www.gnu.org/software/autoconf-archive/ax_prog_bison.html
+# ===
+#
+# SYNOPSIS
+#
+#   AX_PROG_BISON(ACTION-IF-TRUE,ACTION-IF-FALSE)
+#
+# DESCRIPTION
+#
+#   Check whether bison is the parser generator. Run ACTION-IF-TRUE if
+#   successful, ACTION-IF-FALSE otherwise
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Francesco Salvestrini 

+#   Copyright (c) 2010 Diego Elio Petteno` 
+#
+#   This program is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation; either version 2 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see .
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 9
+
+# mattst88:
+# Modified YACC assignment to remove -o y.tab.c since we're writing
+# our own .y/.yy rules.
+#
+# Replaced m4_ifnblank(...) with m4_ifval(m4_normalize(...), ...)
+# since m4_ifnblank requires autoconf-2.64.
+
+AC_DEFUN([AX_PROG_BISON], [
+  AC_REQUIRE([AC_PROG_YACC])
+  AC_REQUIRE([AC_PROG_EGREP])
+
+  AC_CACHE_CHECK([if bison is the parser generator],[ax_cv_prog_bison],[
+AS_IF([$YACC --version 2>/dev/null | $EGREP -q '^bison '],
+  [ax_cv_prog_bison=yes], [ax_cv_prog_bison=no])
+  ])
+  AS_IF([test "$ax_cv_prog_bison" = "yes"], [
+  dnl replace the yacc-compatible compiler with the real bison, as
+  dnl otherwise autoconf limits us to the POSIX yacc.
+  dnl We also change the generated filename to the old one, so that
+  dnl automake's ylwrap can deal with it.
+  YACC="${YACC% -y}"
+] m4_ifval(m4_normalize([$1]), [[$1]]),
+m4_ifval(m4_normalize([$2]), [[$2]])
+  )
+])
-- 
1.7.8.6

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


[Mesa-dev] [PATCH 2/2] build: Use AX_PROG_FLEX

2012-10-01 Thread Matt Turner
---
 configure.ac   |4 ++-
 m4/ax_prog_flex.m4 |   63 
 2 files changed, 66 insertions(+), 1 deletions(-)
 create mode 100644 m4/ax_prog_flex.m4

diff --git a/configure.ac b/configure.ac
index bf01924..929f672 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,9 @@ fi
 AX_PROG_BISON([],
   AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"]
 [AC_MSG_ERROR([bison not found - unable to compile 
glcpp-parse.y])]))
-AC_PROG_LEX
+AX_PROG_FLEX([],
+ AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"]
+   [AC_MSG_ERROR([flex not found - unable to compile 
glcpp-lex.l])]))
 
 AC_PATH_PROG([PERL], [perl])
 
diff --git a/m4/ax_prog_flex.m4 b/m4/ax_prog_flex.m4
new file mode 100644
index 000..117f8fe
--- /dev/null
+++ b/m4/ax_prog_flex.m4
@@ -0,0 +1,63 @@
+# ===
+#   http://www.gnu.org/software/autoconf-archive/ax_prog_flex.html
+# ===
+#
+# SYNOPSIS
+#
+#   AX_PROG_FLEX(ACTION-IF-TRUE,ACTION-IF-FALSE)
+#
+# DESCRIPTION
+#
+#   Check whether flex is the scanner generator. Run ACTION-IF-TRUE if
+#   successful, ACTION-IF-FALSE otherwise
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Francesco Salvestrini 

+#   Copyright (c) 2010 Diego Elio Petteno` 
+#
+#   This program is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation; either version 2 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see .
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 9
+
+# mattst88:
+# Replaced m4_ifnblank(...) with m4_ifval(m4_normalize(...), ...)
+# since m4_ifnblank requires autoconf-2.64.
+
+AC_DEFUN([AX_PROG_FLEX], [
+  AC_REQUIRE([AM_PROG_LEX])
+  AC_REQUIRE([AC_PROG_EGREP])
+
+  AC_CACHE_CHECK([if flex is the lexer generator],[ax_cv_prog_flex],[
+AS_IF([$LEX --version 2>/dev/null | $EGREP -q '^flex '],
+  [ax_cv_prog_flex=yes], [ax_cv_prog_flex=no])
+  ])
+  AS_IF([test "$ax_cv_prog_flex" = "yes"],
+m4_ifval(m4_normalize([$1]), [[$1]]),
+m4_ifval(m4_normalize([$2]), [[$2]])
+  )
+])
-- 
1.7.8.6

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


Re: [Mesa-dev] [PATCH v2 1/1] intel: print performance debug messages to `logcat' on Android.

2012-10-01 Thread Eric Anholt
Oliver McFadden  writes:
> diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
> b/src/mesa/drivers/dri/intel/intel_context.c
> index 25334da..7eb2706 100644
> --- a/src/mesa/drivers/dri/intel/intel_context.c
> +++ b/src/mesa/drivers/dri/intel/intel_context.c
> @@ -744,6 +744,11 @@ intelInitContext(struct intel_context *intel,
> intelInitExtensions(ctx);
>  
> INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
> +
> +#ifdef HAVE_ANDROID_PLATFORM
> +   INTEL_DEBUG |= DEBUG_PERF;
> +#endif /* HAVE_ANDROID_PLATFORM */
> +
> if (INTEL_DEBUG & DEBUG_BUFMGR)
>dri_bufmgr_set_debug(intel->bufmgr, true);

I don't see why the driver should be logging debug messages by default.
You want to be able to actually ship this driver for non-developers.



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


[Mesa-dev] [Bug 55505] EnumStrings.LookUpByNumber regression

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

--- Comment #1 from Ian Romanick  ---
The fix is to s/(DXT[35])_EXT/\1_ANGLE/ in that file.  Oliver, can you take
this?

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


[Mesa-dev] [Bug 55505] EnumStrings.LookUpByNumber regression

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

Oliver McFadden  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|mesa-dev@lists.freedesktop. |omcfa...@gmail.com
   |org |

--- Comment #2 from Oliver McFadden  ---
(In reply to comment #1)
> The fix is to s/(DXT[35])_EXT/\1_ANGLE/ in that file.  Oliver, can you take
> this?

Yes.

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


Re: [Mesa-dev] [PATCH v2 1/1] intel: print performance debug messages to `logcat' on Android.

2012-10-01 Thread Kenneth Graunke
On 10/01/2012 02:35 PM, Eric Anholt wrote:
> Oliver McFadden  writes:
>> diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
>> b/src/mesa/drivers/dri/intel/intel_context.c
>> index 25334da..7eb2706 100644
>> --- a/src/mesa/drivers/dri/intel/intel_context.c
>> +++ b/src/mesa/drivers/dri/intel/intel_context.c
>> @@ -744,6 +744,11 @@ intelInitContext(struct intel_context *intel,
>> intelInitExtensions(ctx);
>>  
>> INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
>> +
>> +#ifdef HAVE_ANDROID_PLATFORM
>> +   INTEL_DEBUG |= DEBUG_PERF;
>> +#endif /* HAVE_ANDROID_PLATFORM */
>> +
>> if (INTEL_DEBUG & DEBUG_BUFMGR)
>>dri_bufmgr_set_debug(intel->bufmgr, true);
> 
> I don't see why the driver should be logging debug messages by default.
> You want to be able to actually ship this driver for non-developers.

At least normally, this causes a _ton_ of spew which can actually
introduce significant amounts of printf overhead.

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


Re: [Mesa-dev] [PATCH 17/19] glx: Replace DRI2SwapBuffers() custom protocol with XCB.

2012-10-01 Thread Eric Anholt
Chad Versace  writes:

>> +   swap_buffers_cookie =
>> +  xcb_dri2_swap_buffers_unchecked(c, pdraw->xDrawable,
>> +  target_msc_hi, target_msc_lo,
>> +  divisor_hi, divisor_lo,
>> +  remainder_hi, remainder_lo);
>> +   /* Immediately wait on the swapbuffers reply.  If we didn't, we'd 
>> have
>> +* to do so some time before reusing a (non-pageflipped) backbuffer.
>> +* Otherwise, the new rendering could get ahead of the X Server's
>> +* dispatch of the swapbuffer and you'd display garbage.
>> +*
>> +* We use XSync() first to reap the invalidate events through the 
>> event
>> +* filter, to ensure that the next drawing doesn't use an invalidated
>> +* buffer.
>> +*/
>> +   XSync(pdraw->psc->dpy, False);
>> +   swap_buffers_reply =
>> +  xcb_dri2_swap_buffers_reply(c, swap_buffers_cookie, NULL);
>> +   ret = merge_counter(swap_buffers_reply->swap_hi,
>> +   swap_buffers_reply->swap_lo);
>> +   free(swap_buffers_reply);
>
> Will this sync harm performance for artificial benchmarks? I'm asking because
> this hunk reminds me of Oliver's comments that Dante was slower on EGL than 
> GLX
> perhaps due to extra X roundtrips.

DRI2SwapBuffers had a round-trip built into it.


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


[Mesa-dev] [PATCH 1/2] i965/vs: Fix unit mismatch in scratch base_offset parameter.

2012-10-01 Thread Kenneth Graunke
move_grf_array_access_to_scratch() calculates scratch buffer offsets in
bytes.  However, emit_scratch_read/write() expects the base_offset
parameter to be measured in OWords.

As a result, a shader using a scratch read/write offset greater than
zero (in practice, a shader containing more than one variable in
scratch) would use too large an offset, frequently exceeding the
available scratch space.

This patch corrects the mismatch by removing spurious conversion from
OWords to bytes in move_grf_array_access_to_scratch().

This is based on a patch by Paul Berry.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 8 ++--
 src/mesa/drivers/dri/i965/brw_vs.c | 2 +-
 src/mesa/drivers/dri/i965/brw_vs.h | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 682837f..59428a1 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2443,6 +2443,8 @@ vec4_visitor::get_pull_constant_offset(vec4_instruction 
*inst,
 /**
  * Emits an instruction before @inst to load the value named by @orig_src
  * from scratch space at @base_offset to @temp.
+ *
+ * @base_offset is measured in 32-byte units (the size of a register).
  */
 void
 vec4_visitor::emit_scratch_read(vec4_instruction *inst,
@@ -2458,6 +2460,8 @@ vec4_visitor::emit_scratch_read(vec4_instruction *inst,
 /**
  * Emits an instruction after @inst to store the value to be written
  * to @orig_dst to scratch space at @base_offset, from @temp.
+ *
+ * @base_offset is measured in 32-byte units (the size of a register).
  */
 void
 vec4_visitor::emit_scratch_write(vec4_instruction *inst,
@@ -2501,7 +2505,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
   if (inst->dst.file == GRF && inst->dst.reladdr &&
  scratch_loc[inst->dst.reg] == -1) {
 scratch_loc[inst->dst.reg] = c->last_scratch;
-c->last_scratch += this->virtual_grf_sizes[inst->dst.reg] * 8 * 4;
+c->last_scratch += this->virtual_grf_sizes[inst->dst.reg];
   }
 
   for (int i = 0 ; i < 3; i++) {
@@ -2510,7 +2514,7 @@ vec4_visitor::move_grf_array_access_to_scratch()
 if (src->file == GRF && src->reladdr &&
 scratch_loc[src->reg] == -1) {
scratch_loc[src->reg] = c->last_scratch;
-   c->last_scratch += this->virtual_grf_sizes[src->reg] * 8 * 4;
+   c->last_scratch += this->virtual_grf_sizes[src->reg];
 }
   }
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c 
b/src/mesa/drivers/dri/i965/brw_vs.c
index 4507f6c..4e95074 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -306,7 +306,7 @@ do_vs_prog(struct brw_context *brw,
  "Try reducing the number of live vec4 values to "
  "improve performance.\n");
 
-  c.prog_data.total_scratch = brw_get_scratch_size(c.last_scratch);
+  c.prog_data.total_scratch = 
brw_get_scratch_size(c.last_scratch*REG_SIZE);
 
   brw_get_scratch_bo(intel, &brw->vs.scratch_bo,
 c.prog_data.total_scratch * brw->max_vs_threads);
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h 
b/src/mesa/drivers/dri/i965/brw_vs.h
index e04247f..adeff7f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -93,7 +93,7 @@ struct brw_vs_compile {
GLuint nr_inputs;
 
GLuint first_output;
-   GLuint last_scratch;
+   GLuint last_scratch; /**< measured in 32-byte (register size) units */
 
GLuint first_tmp;
GLuint last_tmp;
-- 
1.7.11.4

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


[Mesa-dev] [PATCH 2/2] i965/vs: Implement register spilling.

2012-10-01 Thread Kenneth Graunke
To validate this code, I ran piglit -t vs quick.tests with the "go spill
everything" debugging code enabled.  There was only one regression:
glsl-vs-unroll-explosion simply ran out of registers.  This should be
fine in the real world, since no one actually spills every single
register.

NOTE: This is a candidate for the 9.0 branch. Even if it proves to have
bugs, it's likely better than simply failing to compile.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_vec4.h   |   3 +
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp|  14 +++
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp | 128 -
 3 files changed, 144 insertions(+), 1 deletion(-)

Unfortunately, this assertion fails on the one game that needs it;
oglconform's vertexshader advanced.TestLights test also hits the same
assertion failure (and I would have expected this to fix that test).

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index deac55d..407e227 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -314,6 +314,9 @@ public:
void setup_payload();
void reg_allocate_trivial();
void reg_allocate();
+   void evaluate_spill_costs(float *spill_costs, bool *no_spill);
+   int choose_spill_reg(struct ra_graph *g);
+   void spill_reg(int spill_reg);
void move_grf_array_access_to_scratch();
void move_uniform_array_access_to_pull_constants();
void move_push_constants_to_pull_constants();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 27758ab..22671f3 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -809,6 +809,20 @@ vec4_visitor::run()
   return false;
 
setup_payload();
+
+   if (false) {
+  /* Debug of register spilling: Go spill everything. */
+  const int grf_count = virtual_grf_count;
+  float spill_costs[virtual_grf_count];
+  bool no_spill[virtual_grf_count];
+  evaluate_spill_costs(spill_costs, no_spill);
+  for (int i = 0; i < grf_count; i++) {
+ if (no_spill[i])
+continue;
+ spill_reg(i);
+  }
+   }
+
reg_allocate();
 
if (failed)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index 2cda678..01ca6b5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -203,8 +203,16 @@ vec4_visitor::reg_allocate()
}
 
if (!ra_allocate_no_spills(g)) {
+  /* Failed to allocate registers.  Spill a reg, and the caller will
+   * loop back into here to try again.
+   */
+  int reg = choose_spill_reg(g);
+  if (reg == -1) {
+ fail("no register to spill\n");
+  } else {
+ spill_reg(reg);
+  }
   ralloc_free(g);
-  fail("No register spilling support yet\n");
   return;
}
 
@@ -233,4 +241,122 @@ vec4_visitor::reg_allocate()
ralloc_free(g);
 }
 
+void
+vec4_visitor::evaluate_spill_costs(float *spill_costs, bool *no_spill)
+{
+   float loop_scale = 1.0;
+
+   for (int i = 0; i < this->virtual_grf_count; i++) {
+  spill_costs[i] = 0.0;
+  no_spill[i] = virtual_grf_sizes[i] != 1;
+   }
+
+   /* Calculate costs for spilling nodes.  Call it a cost of 1 per
+* spill/unspill we'll have to do, and guess that the insides of
+* loops run 10 times.
+*/
+   foreach_list(node, &this->instructions) {
+  vec4_instruction *inst = (vec4_instruction *) node;
+
+  for (unsigned int i = 0; i < 3; i++) {
+if (inst->src[i].file == GRF) {
+   spill_costs[inst->src[i].reg] += loop_scale;
+if (inst->src[i].reladdr)
+   no_spill[inst->src[i].reg] = true;
+}
+  }
+
+  if (inst->dst.file == GRF) {
+spill_costs[inst->dst.reg] += loop_scale;
+ if (inst->dst.reladdr)
+no_spill[inst->dst.reg] = true;
+  }
+
+  switch (inst->opcode) {
+
+  case BRW_OPCODE_DO:
+loop_scale *= 10;
+break;
+
+  case BRW_OPCODE_WHILE:
+loop_scale /= 10;
+break;
+
+  case VS_OPCODE_SCRATCH_READ:
+  case VS_OPCODE_SCRATCH_WRITE:
+ for (int i = 0; i < 3; i++) {
+if (inst->src[i].file == GRF)
+   no_spill[inst->src[i].reg] = true;
+ }
+if (inst->dst.file == GRF)
+   no_spill[inst->dst.reg] = true;
+break;
+
+  default:
+break;
+  }
+   }
+}
+
+int
+vec4_visitor::choose_spill_reg(struct ra_graph *g)
+{
+   float spill_costs[this->virtual_grf_count];
+   bool no_spill[this->virtual_grf_count];
+
+   evaluate_spill_costs(spill_costs, no_spill);
+
+   for (int i = 0; i < this->virtual_grf_count; i++) {
+  if (!no_spill[i])
+ ra_set_node_spill_cost(g, i, spill_costs[i]);
+   }
+
+   return ra_get_best_spil

[Mesa-dev] [PATCH] register_allocate: don't consider trivially colorable registers for spilling.

2012-10-01 Thread Paul Berry
Previously, we considered all registers as candidates for spilling.
This was counterproductive--for any registers that have already been
removed from the interference graph, there is no benefit to spilling
them, since they don't contribute to register pressure.

This patch ensures that we will only try to spill registers that are
still in the interference graph after register allocation has failed.

This is consistent with the recommendations of the paper "Retargetable
Graph-Coloring Register Allocation for Irregular Architectures", on
which our register allocator is based.
---

Note: I haven't found a shader whose performance is significantly
improved by this patch (it seems that usually, our heuristics happen
to select registers that are still in the interference graph), but it
still seems justified on theoretical grounds.

 src/mesa/program/register_allocate.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/program/register_allocate.c 
b/src/mesa/program/register_allocate.c
index 97d4e33..88793db 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -555,6 +555,13 @@ ra_get_best_spill_node(struct ra_graph *g)
   if (cost <= 0.0)
 continue;
 
+  /* Only consider registers for spilling if they are still in the
+   * interference graph (those on the stack have already been proven to be
+   * allocatable without spilling).
+   */
+  if (g->nodes[n].in_stack)
+ continue;
+
   benefit = ra_get_spill_benefit(g, n);
 
   if (benefit / cost > best_benefit) {
-- 
1.7.12.1

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


Re: [Mesa-dev] [PATCH v2 1/1] intel: print performance debug messages to `logcat' on Android.

2012-10-01 Thread Oliver McFadden
On Mon, Oct 01, 2012 at 02:55:31PM -0700, Kenneth Graunke wrote:
> On 10/01/2012 02:35 PM, Eric Anholt wrote:
> > Oliver McFadden  writes:
> >> diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
> >> b/src/mesa/drivers/dri/intel/intel_context.c
> >> index 25334da..7eb2706 100644
> >> --- a/src/mesa/drivers/dri/intel/intel_context.c
> >> +++ b/src/mesa/drivers/dri/intel/intel_context.c
> >> @@ -744,6 +744,11 @@ intelInitContext(struct intel_context *intel,
> >> intelInitExtensions(ctx);
> >>  
> >> INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), 
> >> debug_control);
> >> +
> >> +#ifdef HAVE_ANDROID_PLATFORM
> >> +   INTEL_DEBUG |= DEBUG_PERF;
> >> +#endif /* HAVE_ANDROID_PLATFORM */
> >> +
> >> if (INTEL_DEBUG & DEBUG_BUFMGR)
> >>dri_bufmgr_set_debug(intel->bufmgr, true);
> > 
> > I don't see why the driver should be logging debug messages by default.
> > You want to be able to actually ship this driver for non-developers.
> 
> At least normally, this causes a _ton_ of spew which can actually
> introduce significant amounts of printf overhead.
> 

The objective is to inform the application developer when they are doing
something stupid; most of them will not go through the trouble of
looking up how to turn on Intel performance debugging.

I would like to see this upstream, but I can understand if you would
prefer this patch be carried internally.

In any case, Android logcat is not exactly known for it's sparseness; in
fact the opposite.  I have seen such stupidity as "Hi, I'm still
connected to the 'FUBAR' network!" every few seconds.  :-(

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


[Mesa-dev] [PATCH 1/1] mesa: tests: EnumStrings.LookUpByNumber

2012-10-01 Thread Oliver McFadden
[ RUN  ] EnumStrings.LookUpByNumber
enum_strings.cpp:43: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE"
Expected: everything[i].name
Which is: "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"
enum_strings.cpp:43: Failure
Value of: _mesa_lookup_enum_by_nr(everything[i].value)
  Actual: "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE"
Expected: everything[i].name
Which is: "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"
[  FAILED  ] EnumStrings.LookUpByNumber (2 ms)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55505
Signed-off-by: Oliver McFadden 
CC: Ian Romanick 
---
 src/mesa/main/tests/enum_strings.cpp |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/tests/enum_strings.cpp 
b/src/mesa/main/tests/enum_strings.cpp
index b9def32..ebb2b17 100644
--- a/src/mesa/main/tests/enum_strings.cpp
+++ b/src/mesa/main/tests/enum_strings.cpp
@@ -824,8 +824,8 @@ const struct enum_info everything[] = {
{ 0x83A3, "GL_RGBA4_S3TC" },
{ 0x83F0, "GL_COMPRESSED_RGB_S3TC_DXT1_EXT" },
{ 0x83F1, "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" },
-   { 0x83F2, "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT" },
-   { 0x83F3, "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT" },
+   { 0x83F2, "GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE" },
+   { 0x83F3, "GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE" },
{ 0x844D, "GL_NEAREST_CLIPMAP_NEAREST_SGIX" },
{ 0x844E, "GL_NEAREST_CLIPMAP_LINEAR_SGIX" },
{ 0x844F, "GL_LINEAR_CLIPMAP_NEAREST_SGIX" },
-- 
1.7.8.6

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


Re: [Mesa-dev] [PATCH 19/19] mesa/tests: Sanity check the ES2 dispatch table

2012-10-01 Thread Oliver McFadden
On Fri, Sep 28, 2012 at 02:15:18PM -0700, Ian Romanick wrote:
> On 09/28/2012 01:55 PM, Paul Berry wrote:
> > On 5 September 2012 15:09, Ian Romanick  > > wrote:
> >
> > From: Ian Romanick  > >
> >
> > This test is only built when shared-glapi is used.  Because of changes
> > elsewhere in the tree that were necessary to make shared-glapi work
> > correct with GLX, it's not feasible to make the test function both ways.
> >
> > Signed-off-by: Ian Romanick  > >
> >
> >
> > This test is failing on my system when I run "make check":
> >
> > [--] 1 test from DispatchSanity_test
> > [ RUN  ] DispatchSanity_test.GLES2
> > Mesa warning: couldn't open libtxc_dxtn.so, software DXTn
> > compression/decompression unavailable
> > dispatch_sanity.cpp:122: Failure
> > Value of: table[i]
> >Actual: 0x4de54e
> > Expected: (_glapi_proc) _mesa_generic_nop
> > Which is: 0x41af72
> > i = 321
> > [  FAILED  ] DispatchSanity_test.GLES2 (4 ms)
> > [--] 1 test from DispatchSanity_test (4 ms total)
> >
> > Is anybody else getting this problem?
> 
> Can you put the following in the SET_by_offset macro 
> (src/mesa/main/dispatch.h in your build directory):
> 
>  if (offset == 321) abort(); \
> 
> then backtrace to see what API function is at fault?

[--] 1 test from DispatchSanity_test
[ RUN  ] DispatchSanity_test.GLES2
[SET_VertexPointer:5719] SET_by_offset(0x1aa7960, 321, fn)!
/bin/sh: line 5:  8122 Aborted ${dir}$tst
FAIL: main-test

If it helps... I didn't actually run this in GDB, just added the
printf()/abort() debugging which was already there but commented out.

> 
> > Here's how I have Mesa configured:
> >
> > ./autogen.sh \
> >  --with-gallium-drivers= \
> >  --enable-gles1 \
> >  --disable-glut \
> >  --enable-debug \
> >  --enable-egl \
> >  --enable-gles2 \
> >  --enable-texture-float \
> >  --enable-glx-tls \
> >  --enable-shared-glapi \
> >  "--prefix=$PLATFORM_INSTALL_DIR" \
> >  --with-dri-drivers=swrast,i915,i965 \
> >  CFLAGS="-O0 $CFLAGS" \
> >  CXXFLAGS="-O0 $CXXFLAGS"
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH 2/7] i965: Allow fast depth clears if scissoring doesn't do anything.

2012-10-01 Thread Oliver McFadden
On Fri, Sep 28, 2012 at 08:41:51AM -0700, Ian Romanick wrote:
> On 09/19/2012 01:27 PM, Kenneth Graunke wrote:
> > A game we're working with leaves scissoring enabled, but frequently sets
> > the scissor rectangle to the size of the whole screen.  In that case,
> > scissoring has no effect, so it's safe to go ahead with a fast clear.
> >
> > Chad believe this should help with Oliver McFadden's "Dante" as well.
> >
> > v2/Chad: Use the drawbuffer dimensions rather than the miptree slice
> > dimensions.  The miptree slice may be slightly larger due to alignment
> > restrictions.
> 
> There was some question of whether this actually gave any performance 
> improvement or just made the INTEL_DEBUG=perf warning go away.  Can we 
> see any actual performance delta in Dante?

I will try to get you some numbers during this week.  If I have time; my
schedule is fairly packed.

> 
> > Signed-off-by: Kenneth Graunke 
> > Signed-off-by: Chad Versace 
> > Cc: Oliver McFadden 
> > ---
> >   src/mesa/drivers/dri/i965/brw_clear.c | 14 +-
> >   1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
> > b/src/mesa/drivers/dri/i965/brw_clear.c
> > index c3c75df..625cc85 100644
> > --- a/src/mesa/drivers/dri/i965/brw_clear.c
> > +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> > @@ -77,6 +77,18 @@ debug_mask(const char *name, GLbitfield mask)
> >   }
> >
> >   /**
> > + * Returns true if the scissor is a noop (cuts out nothing).
> > + */
> > +static bool
> > +noop_scissor(struct gl_context *ctx, struct gl_framebuffer *fb)
> > +{
> > +   return ctx->Scissor.X <= 0 &&
> > +  ctx->Scissor.Y <= 0 &&
> > +  ctx->Scissor.Width >= fb->Width &&
> > +  ctx->Scissor.Height >= fb->Height;
> > +}
> > +
> > +/**
> >* Implements fast depth clears on gen6+.
> >*
> >* Fast clears basically work by setting a flag in each of the subspans
> > @@ -110,7 +122,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
> >   * a previous clear had happened at a different clear value and 
> > resolve it
> >   * first.
> >   */
> > -   if (ctx->Scissor.Enabled) {
> > +   if (ctx->Scissor.Enabled && !noop_scissor(ctx, fb)) {
> > perf_debug("Failed to fast clear depth due to scissor being 
> > enabled.  "
> >"Possible 5%% performance win if avoided.\n");
> > return false;
> >
> 

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


Re: [Mesa-dev] [PATCH] adroid : glcpp: fix abuse of yylex

2012-10-01 Thread Dave Airlie
On Tue, Oct 2, 2012 at 12:16 AM, Oliver McFadden
 wrote:
> On Fri, Sep 28, 2012 at 05:36:40PM +0300, Negreanu Marius Adrian wrote:
>> Port the 'glcpp: fix abuse of yylex' commit to Android.mk
>> Also, since the Android.*.mk are sourced in a global namespace,
>> the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name,
>>
>> The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a
>>
>> There's also a bugzilla for this: 54947
>>
>> Signed-off-by: Negreanu Marius Adrian 
> Reviewed-by: Oliver McFadden 
>
> Adding Dave Airlie to CC due to his authorship of the original fix
> commit.  Dave, could you also review?

apart from typo
Reviewed-by: Dave Airlie 

>
> If Adrian cannot push upstream I'll push on his behalf after review.
>
>> ---
>>  src/glsl/Android.gen.mk | 6 +++---
>>  src/mesa/Android.gen.mk | 6 +++---
>>  2 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
>> index e4ccb72..2ed9fa6 100644
>> --- a/src/glsl/Android.gen.mk
>> +++ b/src/glsl/Android.gen.mk
>> @@ -52,10 +52,10 @@ define local-l-or-ll-to-c-or-cpp
>>   $(hide) $(LEX) --nounistd -o$@ $<
>>  endef
>>
>> -define local-y-to-c-and-h
>> +define glsl_local-y-to-c-and-h
>>   @mkdir -p $(dir $@)
>>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
>> - $(hide) $(YACC) -o $@ $<
>> + $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
>>  endef
>>
>>  define local-yy-to-cpp-and-h
>> @@ -80,7 +80,7 @@ $(intermediates)/glcpp/glcpp-lex.c: 
>> $(LOCAL_PATH)/glcpp/glcpp-lex.l
>>   $(call local-l-or-ll-to-c-or-cpp)
>>
>>  $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
>> - $(call local-y-to-c-and-h)
>> + $(call glsl_local-y-to-c-and-h)
>>
>>  BUILTIN_COMPILER := 
>> $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
>>
>> diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
>> index f5e6323..c17df1a 100644
>> --- a/src/mesa/Android.gen.mk
>> +++ b/src/mesa/Android.gen.mk
>> @@ -75,10 +75,10 @@ define local-l-to-c
>>   $(hide) $(LEX) -o$@ $<
>>  endef
>>
>> -define local-y-to-c-and-h
>> +define mesa_local-y-to-c-and-h
>>   @mkdir -p $(dir $@)
>>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
>> - $(hide) $(YACC) -o $@ $<
>> + $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>>  endef
>>
>>  define es-gen
>> @@ -104,7 +104,7 @@ $(intermediates)/main/api_exec_%_remap_helper.h: 
>> $(es_hdr_deps)
>>   $(call es-gen, -c $*)
>>
>>  $(intermediates)/program/program_parse.tab.c: 
>> $(LOCAL_PATH)/program/program_parse.y
>> - $(local-y-to-c-and-h)
>> + $(mesa_local-y-to-c-and-h)
>>
>>  $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
>>   $(local-l-to-c)
>> --
>> 1.7.11.3
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
> --
> Oliver McFadden.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 55445] Torchlight: crash due to texture error

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

--- Comment #6 from Tim Allen  ---
In the thread linked from comment 2, the guy who ported Torchlight to Linux
says that the actual call to glCompressedTexture2D() happens within the bowels
of the OGRE 3D library and so the exact parameters aren't readily available
without some kind of debugging/API-tracing tool. I'll see what I can do, if
nobody else beats me to it, but in the interim here's what we do know:

- Using Mesa-based GL drivers (that is, not the proprietary nVidia/ATI
  drivers), Torchlight always crashes when descending from dungeon-level 19 to
  dungeon level 20.
- When it crashes, Ogre prints the message pasted in comment 0, naming mipmap
  2 of "trail37.dds".
- It turns out, trail37.dds is one of three textures (out of 2776 in the game)
  that have non-power-of-two dimensions. Specifically, it's 200x64 pixels.
- trail37.dds is also S3TC-compressed (like all but 16 of the game's textures),
  which means its dimensions need to be a multiple of 4 in each direction.
- The base texture is 200x64 pixels, which is fine.
- Mipmap level 1 is 100x32 pixels, which is fine.
- Mipmap level 2 is 50x16 pixels, but 50 is not a multiple of 4.
  mesa/main/teximage.c has specific code to return GL_INVALID_OPERATION if
  given dimensions that aren't a multiple of the compression algorithm's
  block-size, and the error message it includes is exactly the one seen if you
  start Torchlight with MESA_DEBUG=1 set. This is also consistent with the Ogre
  error that mentions mipmap 2.

It's not immediately clear what Mesa *should* do when fed compressed texture
data that isn't a multiple of the block-size, apart from 'not crash'. It looks
like attachment 67879 opts for "quietly round the dimensions up to the nearest
multiple of four", but that doesn't seem right - you'd wind up with 1-3 pixels
of black (or gibberish, depending on how the compression works), at the edge of
the texture.

I notice Mesa already has some support for such textures: the error-detecting
code in teximage.c actually tests "(width > bw && width % bw > 0)" so
presumably a 1x3 or 2x4 texture would work just fine. Whatever Mesa does to
clip off unwanted pixels when "width < bw", I guess it should do in the
"width > bw" case as well.

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


[Mesa-dev] [PATCH] mesa: Flag _NEW_VARYING_VP_INPUTS when TexEnv programs are active.

2012-10-01 Thread Kenneth Graunke
The idea here is to not flag _NEW_VARYING_VP_INPUTS when shaders (either
GLSL or ARB vp/fp) are in use.  If either TNL or TexEnv programs are
active, at least one stage is using fixed function.

On Pineview, fixes 20 Piglit, 60 oglconforms, and 7 ES 1.1 conformance
tests, as well as missing textures in Xonotic.  These were all
regressions since commit fb4a34e60eb4c1bdc7b0fdcd98d1bf3038c354e8.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49127
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54807
Signed-off-by: Kenneth Graunke 
---
 src/mesa/main/state.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here's a different patch, suggested by Ian.  Either seems to work fine.

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 76946bd..fb8b71c 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -627,7 +627,8 @@ _mesa_set_varying_vp_inputs( struct gl_context *ctx,
*
* It's okay to check the VP pointer here, because this is called after
* _mesa_update_state in the vbo module. */
-  if (ctx->VertexProgram._TnlProgram) {
+  if (ctx->VertexProgram._TnlProgram ||
+  ctx->FragmentProgram._TexEnvProgram) {
  ctx->NewState |= _NEW_VARYING_VP_INPUTS;
   }
   /*printf("%s %x\n", __FUNCTION__, varying_inputs);*/
-- 
1.7.10.3

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


[Mesa-dev] [Bug 55445] Torchlight: crash due to texture error

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

Brian Rogers  changed:

   What|Removed |Added

 CC||br...@xyzw.org

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


Re: [Mesa-dev] [PATCH] adroid : glcpp: fix abuse of yylex

2012-10-01 Thread Oliver McFadden
On Tue, Oct 02, 2012 at 12:38:02PM +1000, Dave Airlie wrote:
> On Tue, Oct 2, 2012 at 12:16 AM, Oliver McFadden
>  wrote:
> > On Fri, Sep 28, 2012 at 05:36:40PM +0300, Negreanu Marius Adrian wrote:
> >> Port the 'glcpp: fix abuse of yylex' commit to Android.mk
> >> Also, since the Android.*.mk are sourced in a global namespace,
> >> the local-y-to-c-and-h is prefixed with the LOCAL_MODULE name,
> >>
> >> The initial fix commit is 53d46bc787318ccf9911fdd1d5fe99ee4db7f41a
> >>
> >> There's also a bugzilla for this: 54947
> >>
> >> Signed-off-by: Negreanu Marius Adrian 
> > Reviewed-by: Oliver McFadden 
> >
> > Adding Dave Airlie to CC due to his authorship of the original fix
> > commit.  Dave, could you also review?
> 
> apart from typo
> Reviewed-by: Dave Airlie 

Thanks, pushed with typo fix.

> 
> >
> > If Adrian cannot push upstream I'll push on his behalf after review.
> >
> >> ---
> >>  src/glsl/Android.gen.mk | 6 +++---
> >>  src/mesa/Android.gen.mk | 6 +++---
> >>  2 files changed, 6 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/src/glsl/Android.gen.mk b/src/glsl/Android.gen.mk
> >> index e4ccb72..2ed9fa6 100644
> >> --- a/src/glsl/Android.gen.mk
> >> +++ b/src/glsl/Android.gen.mk
> >> @@ -52,10 +52,10 @@ define local-l-or-ll-to-c-or-cpp
> >>   $(hide) $(LEX) --nounistd -o$@ $<
> >>  endef
> >>
> >> -define local-y-to-c-and-h
> >> +define glsl_local-y-to-c-and-h
> >>   @mkdir -p $(dir $@)
> >>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> >> - $(hide) $(YACC) -o $@ $<
> >> + $(hide) $(YACC) -o $@ -p "glcpp_parser_" $<
> >>  endef
> >>
> >>  define local-yy-to-cpp-and-h
> >> @@ -80,7 +80,7 @@ $(intermediates)/glcpp/glcpp-lex.c: 
> >> $(LOCAL_PATH)/glcpp/glcpp-lex.l
> >>   $(call local-l-or-ll-to-c-or-cpp)
> >>
> >>  $(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
> >> - $(call local-y-to-c-and-h)
> >> + $(call glsl_local-y-to-c-and-h)
> >>
> >>  BUILTIN_COMPILER := 
> >> $(BUILD_OUT_EXECUTABLES)/mesa_builtin_compiler$(BUILD_EXECUTABLE_SUFFIX)
> >>
> >> diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
> >> index f5e6323..c17df1a 100644
> >> --- a/src/mesa/Android.gen.mk
> >> +++ b/src/mesa/Android.gen.mk
> >> @@ -75,10 +75,10 @@ define local-l-to-c
> >>   $(hide) $(LEX) -o$@ $<
> >>  endef
> >>
> >> -define local-y-to-c-and-h
> >> +define mesa_local-y-to-c-and-h
> >>   @mkdir -p $(dir $@)
> >>   @echo "Mesa Yacc: $(PRIVATE_MODULE) <= $<"
> >> - $(hide) $(YACC) -o $@ $<
> >> + $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
> >>  endef
> >>
> >>  define es-gen
> >> @@ -104,7 +104,7 @@ $(intermediates)/main/api_exec_%_remap_helper.h: 
> >> $(es_hdr_deps)
> >>   $(call es-gen, -c $*)
> >>
> >>  $(intermediates)/program/program_parse.tab.c: 
> >> $(LOCAL_PATH)/program/program_parse.y
> >> - $(local-y-to-c-and-h)
> >> + $(mesa_local-y-to-c-and-h)
> >>
> >>  $(intermediates)/program/lex.yy.c: $(LOCAL_PATH)/program/program_lexer.l
> >>   $(local-l-to-c)
> >> --
> >> 1.7.11.3
> >>
> >> ___
> >> mesa-dev mailing list
> >> mesa-dev@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> > --
> > Oliver McFadden.

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


[Mesa-dev] [Bug 55445] Torchlight: crash due to texture error

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

Tim Allen  changed:

   What|Removed |Added

 CC||screwt...@froup.com

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