Mesa (master): glapi: Encapsulate nop table knowledge in new _mesa_new_nop_table function

2015-05-26 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 2b8c51834bcc34a70dec9b470a28c0ef972d6993
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b8c51834bcc34a70dec9b470a28c0ef972d6993

Author: Ian Romanick 
Date:   Tue May 26 11:41:44 2015 -0700

glapi: Encapsulate nop table knowledge in new _mesa_new_nop_table function

Encapsulate the knowledge about how to build the nop table in a new
_mesa_new_nop_table function.  This makes it easier for dispatch_sanity
to keep working now and in the future.

Signed-off-by: Ian Romanick 
Reviewed-by: Brian Paul 
Reviewed-by: Emil Velikov 
Tested-by: Mark Janes 
Cc: 10.6 

---

 src/mesa/main/api_exec.h|3 +++
 src/mesa/main/context.c |   16 
 src/mesa/main/tests/dispatch_sanity.cpp |2 +-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h
index 12249fe..655cb32 100644
--- a/src/mesa/main/api_exec.h
+++ b/src/mesa/main/api_exec.h
@@ -38,6 +38,9 @@ _mesa_initialize_exec_table(struct gl_context *ctx);
 extern void
 _mesa_initialize_dispatch_tables(struct gl_context *ctx);
 
+extern struct _glapi_table *
+_mesa_new_nop_table(unsigned numEntries);
+
 #ifdef __cplusplus
 } // extern "C"
 #endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 02875ba..e4faf3d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -962,12 +962,12 @@ generic_nop(void)
  * the __stdcall convention which requires the callee to clean up the
  * call stack.  That's impossible with one generic no-op function.
  */
-#if !USE_GLAPI_NOP_FEATURES
-static struct _glapi_table *
-new_nop_table(unsigned numEntries)
+struct _glapi_table *
+_mesa_new_nop_table(unsigned numEntries)
 {
struct _glapi_table *table;
 
+#if !USE_GLAPI_NOP_FEATURES
table = malloc(numEntries * sizeof(_glapi_proc));
if (table) {
   _glapi_proc *entry = (_glapi_proc *) table;
@@ -976,9 +976,11 @@ new_nop_table(unsigned numEntries)
  entry[i] = (_glapi_proc) generic_nop;
   }
}
+#else
+   table = _glapi_new_nop_table(numEntries);
+#endif
return table;
 }
-#endif
 
 
 /**
@@ -996,10 +998,7 @@ alloc_dispatch_table(void)
 */
int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
 
-#if !USE_GLAPI_NOP_FEATURES
-   struct _glapi_table *table = new_nop_table(numEntries);
-#else
-   struct _glapi_table *table = _glapi_new_nop_table(numEntries);
+   struct _glapi_table *table = _mesa_new_nop_table(numEntries);
 
 #if defined(_WIN32)
if (table) {
@@ -1023,6 +1022,7 @@ alloc_dispatch_table(void)
}
 #endif
 
+#if USE_GLAPI_NOP_FEATURES
_glapi_set_nop_handler(nop_handler);
 #endif
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index d38b68d..c6f3c39 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -96,7 +96,7 @@ DispatchSanity_test::SetUp()
_mesa_init_driver_functions(&driver_functions);
 
const unsigned size = _glapi_get_dispatch_table_size();
-   nop_table = (_glapi_proc *) _glapi_new_nop_table(size);
+   nop_table = (_glapi_proc *) _mesa_new_nop_table(size);
 }
 
 void

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


Mesa (master): docs: Fix some typos in the developer notes

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8d813d14e1f5c690c6737c6cd6fc01937a7d4246
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d813d14e1f5c690c6737c6cd6fc01937a7d4246

Author: Thomas Helland 
Date:   Tue May 26 12:14:00 2015 -0600

docs: Fix some typos in the developer notes

Found when double-checking my review on Brian's series.

Signed-off-by: Thomas Helland 
Reviewed-by: Brian Paul 

---

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

diff --git a/docs/devinfo.html b/docs/devinfo.html
index eb3aba1..0da18b9 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -564,7 +564,7 @@ Edit docs/relnotes/X.Y.Z.html to add the sha256sums printed 
as part of "make
 tarballs" in the previous step. Commit this change.
 
 
-Push all commits and the tag creates above
+Push all commits and the tag created above
 
 
 This is the first step that cannot easily be undone. The release is going
@@ -591,7 +591,7 @@ signatures to the freedesktop.org server:
mv ~/MesaLib-X.Y.Z* .
 
 
-Back on mesa master, andd the new release notes into the tree
+Back on mesa master, add the new release notes into the tree
 
 
 Something like the following steps will do the trick:

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


Mesa (master): mesa: do not use _glapi_new_nop_table() for DRI builds

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: be71bbfaa2ad201b570b56847a13328fc359d0ee
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=be71bbfaa2ad201b570b56847a13328fc359d0ee

Author: Brian Paul 
Date:   Fri May 15 09:08:14 2015 -0600

mesa: do not use _glapi_new_nop_table() for DRI builds

Commit 4bdbb588a9d38 introduced new _glapi_new_nop_table() and
_glapi_set_nop_handler() functions in the glapi dispatcher (which
live in libGL.so).  The calls to those functions from context.c
would be undefined (i.e. an ABI break) if the libGL used at runtime
was older.

For the time being, use the old single generic_nop() function for
non-Windows builds to avoid this problem.  At some point in the future
it should be safe to remove this work-around.  See comments for more
details.

v2: Incorporate feedback from Emil.  Use _WIN32 instead of
GLX_DIRECT_RENDERING to control behavior, move comments.

Cc: 10.6 
Reviewed-and-tested-by: Ian Romanick 

---

 src/mesa/main/context.c |   62 +--
 1 file changed, 60 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 544cc14..02875ba 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -883,6 +883,19 @@ update_default_objects(struct gl_context *ctx)
 }
 
 
+/* XXX this is temporary and should be removed at some point in the
+ * future when there's a reasonable expectation that the libGL library
+ * contains the _glapi_new_nop_table() and _glapi_set_nop_handler()
+ * functions which were added in Mesa 10.6.
+ */
+#if !defined(_WIN32)
+/* Avoid libGL / driver ABI break */
+#define USE_GLAPI_NOP_FEATURES 0
+#else
+#define USE_GLAPI_NOP_FEATURES 1
+#endif
+
+
 /**
  * This function is called by the glapi no-op functions.  For each OpenGL
  * function/entrypoint there's a simple no-op function.  These "no-op"
@@ -898,6 +911,7 @@ update_default_objects(struct gl_context *ctx)
  *
  * \param name  the name of the OpenGL function
  */
+#if USE_GLAPI_NOP_FEATURES
 static void
 nop_handler(const char *name)
 {
@@ -914,6 +928,7 @@ nop_handler(const char *name)
}
 #endif
 }
+#endif
 
 
 /**
@@ -923,7 +938,45 @@ nop_handler(const char *name)
 static void GLAPIENTRY
 nop_glFlush(void)
 {
-   /* don't record an error like we do in _mesa_generic_nop() */
+   /* don't record an error like we do in nop_handler() */
+}
+#endif
+
+
+#if !USE_GLAPI_NOP_FEATURES
+static int
+generic_nop(void)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   _mesa_error(ctx, GL_INVALID_OPERATION,
+   "unsupported function called "
+   "(unsupported extension or deprecated function?)");
+   return 0;
+}
+#endif
+
+
+/**
+ * Create a new API dispatch table in which all entries point to the
+ * generic_nop() function.  This will not work on Windows because of
+ * the __stdcall convention which requires the callee to clean up the
+ * call stack.  That's impossible with one generic no-op function.
+ */
+#if !USE_GLAPI_NOP_FEATURES
+static struct _glapi_table *
+new_nop_table(unsigned numEntries)
+{
+   struct _glapi_table *table;
+
+   table = malloc(numEntries * sizeof(_glapi_proc));
+   if (table) {
+  _glapi_proc *entry = (_glapi_proc *) table;
+  unsigned i;
+  for (i = 0; i < numEntries; i++) {
+ entry[i] = (_glapi_proc) generic_nop;
+  }
+   }
+   return table;
 }
 #endif
 
@@ -941,7 +994,11 @@ alloc_dispatch_table(void)
 * Mesa we do this to accommodate different versions of libGL and various
 * DRI drivers.
 */
-   GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
+   int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
+
+#if !USE_GLAPI_NOP_FEATURES
+   struct _glapi_table *table = new_nop_table(numEntries);
+#else
struct _glapi_table *table = _glapi_new_nop_table(numEntries);
 
 #if defined(_WIN32)
@@ -967,6 +1024,7 @@ alloc_dispatch_table(void)
 #endif
 
_glapi_set_nop_handler(nop_handler);
+#endif
 
return table;
 }

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


Mesa (master): docs: add information about reviewing patches

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 2ab0ca36c155cc77e3d5c950270c70a24efee3d3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ab0ca36c155cc77e3d5c950270c70a24efee3d3

Author: Brian Paul 
Date:   Tue May 26 11:30:22 2015 -0600

docs: add information about reviewing patches

Reviewed-by: Matt Turner 

---

 docs/devinfo.html |   25 +
 1 file changed, 25 insertions(+)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index f5113b0..eb3aba1 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -266,6 +266,31 @@ re-sending the whole series). Using --in-reply-to makes
 it harder for reviewers to accidentally review old patches.
 
 
+Reviewing Patches
+
+
+When you've reviewed a patch on the mailing list, please be unambiguous
+about your review.  That is, state either
+
+Reviewed-by: Joe Hacker 
+
+or
+
+Acked-by: Joe Hacker 
+
+Rather than saying just "LGTM" or "Seems OK".
+
+
+
+If small changes are suggested, it's OK to say something like:
+
+   With the above fixes, Reviewed-by: Joe Hacker 
+
+which tells the patch author that the patch can be committed, as long
+as the issues are resolved first.
+
+
+
 Marking a commit as a candidate for a stable branch
 
 

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


Mesa (master): docs: update the coding style information

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c6184f84b7227e1548947e42bca3ff3ddb7e379c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6184f84b7227e1548947e42bca3ff3ddb7e379c

Author: Brian Paul 
Date:   Mon May 25 10:18:35 2015 -0600

docs: update the coding style information

This hasn't been updated in a long time and from recent discussion on
the mailing list, it's not always clear what's expected.  Hopefully,
this will help a bit.

v2: document function brace placement, per Thomas Helland.

Reviewed-by: Thomas Helland 

---

 docs/devinfo.html |  159 ++---
 1 file changed, 90 insertions(+), 69 deletions(-)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index e068d87..f5113b0 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -28,97 +28,118 @@
 Coding Style
 
 
-Mesa's code style has changed over the years.  Here's the latest.
+Mesa is over 20 years old and the coding style has evolved over time.
+Some old parts use a style that's a bit out of date.
+If the guidelines below don't cover something, try following the format of
+existing, neighboring code.
 
 
 
-Comment your code!  It's extremely important that open-source code be
-well documented.  Also, strive to write clean, easily understandable code.
+Basic formatting guidelines
 
 
-
-3-space indentation
-
-
-
-If you use tabs, set them to 8 columns
-
+
+3-space indentation, no tabs.
+Limit lines to 78 or fewer characters.  The idea is to prevent line
+wrapping in 80-column editors and terminals.  There are exceptions, such
+as if you're defining a large, static table of information.
+Opening braces go on the same line as the if/for/while statement.
+For example:
+
+   if (condition) {
+  foo;
+   } else {
+  bar;
+   }
+
 
-
-Line width: the preferred width to fill comments and code in Mesa is 78
-columns.  Exceptions are sometimes made for clarity (e.g. tabular data is
-sometimes filled to a much larger width so that extraneous carriage returns
-don't obscure the table).
-
+Put a space before/after operators.  For example, a = b + c;
+and not a=b+c;
 
-
-Brace example:
-
+This GNU indent command generally does the right thing for formatting:
 
-   if (condition) {
-  foo;
-   }
-   else {
-  bar;
-   }
-
-   switch (condition) {
-   case 0:
-  foo();
-  break;
-
-   case 1: {
-  ...
-  break;
-   }
-
-   default:
-  ...
-  break;
-   }
+   indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
 
 
-
-Here's the GNU indent command which will best approximate my preferred style:
-(Note that it won't format switch statements in the preferred way)
-
+Use comments wherever you think it would be helpful for other developers.
+Several specific cases and style examples follow.  Note that we roughly
+follow http://www.stack.nl/~dimitri/doxygen/";>Doxygen conventions.
+
+
+Single-line comments:
 
-   indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
+   /* null-out pointer to prevent dangling reference below */
+   bufferObj = NULL;
+
+Or,
+
+   bufferObj = NULL;  /* prevent dangling reference below */
+
+Multi-line comment:
+
+   /* If this is a new buffer object id, or one which was generated but
+* never used before, allocate a buffer object now.
+*/
+
+We try to quote the OpenGL specification where prudent:
+
+   /* Page 38 of the PDF of the OpenGL ES 3.0 spec says:
+*
+* "An INVALID_OPERATION error is generated for any of the following
+* conditions:
+*
+* *  is zero."
+*
+* Additionally, page 94 of the PDF of the OpenGL 4.5 core spec
+* (30.10.2014) also says this, so it's no longer allowed for desktop GL,
+* either.
+*/
+
+Function comment example:
+
+   /**
+* Create and initialize a new buffer object.  Called via the
+* ctx->Driver.CreateObject() driver callback function.
+* \param  name  integer name of the object
+* \param  type  one of GL_FOO, GL_BAR, etc.
+* \return  pointer to new object or NULL if error
+*/
+   struct gl_object *
+   _mesa_create_object(GLuint name, GLenum type)
+   {
+  /* function body */
+   }
 
 
+Put the function return type and qualifiers on one line and the function
+name and parameters on the next, as seen above.  This makes it easy to use
+grep ^function_name dir/* to find function definitions.  Also,
+the opening brace goes on the next line by itself (see above.)
 
-
-Local variable name example:  localVarName (no underscores)
-
-
-
-Constants and macros are ALL_UPPERCASE, with _ between words
-
-
-
-Global variables are not allowed.
-
-
-
-Function name examples:
-
+Function names follow various conventions depending on the type of 
function:
 
-   glFooBar()   - a public GL entry point (in glapi_dispatch.c)
-   _mesa_FooBar()   - the internal immediate mode function
-   save_FooBar()- retained mode (display list) function in dlist.c

Mesa (master): docs: update documentation about patch formatting, testing, etc

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d959885b9109878acc427b9321e46d8c6d133d1a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d959885b9109878acc427b9321e46d8c6d133d1a

Author: Brian Paul 
Date:   Mon May 25 09:42:04 2015 -0600

docs: update documentation about patch formatting, testing, etc

v2: correctly escape < and > chars.

Reviewed-by: Thomas Helland 

---

 docs/devinfo.html |  104 +++--
 1 file changed, 102 insertions(+), 2 deletions(-)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index c7e4171..e068d87 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -124,13 +124,113 @@ src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as 
examples.
 Submitting patches
 
 
-You should always run the Mesa Testsuite before submitting patches.
-The Testsuite can be run using the 'make check' command. All tests
+The basic guidelines for submitting patches are:
+
+
+
+Patches should be sufficiently tested before submitting.
+Code patches should follow Mesa coding conventions.
+Whenever possible, patches should only effect individual Mesa/Gallium
+components.
+Patches should never introduce build breaks and should be bisectable (see
+git bisect.)
+Patches should be properly formatted (see below).
+Patches should be submitted to mesa-dev for review using
+git send-email.
+Patches should not mix code changes with code formatting changes (except,
+perhaps, in very trivial cases.)
+
+
+Patch formatting
+
+
+The basic rules for patch formatting are:
+
+
+
+Lines should be limited to 75 characters or less so that git logs
+displayed in 80-column terminals avoid line wrapping.  Note that git
+log uses 4 spaces of indentation (4 + 75 < 80).
+The first line should be a short, concise summary of the change prefixed
+with a module name.  Examples:
+
+mesa: Add support for querying GL_VERTEX_ATTRIB_ARRAY_LONG
+
+gallium: add PIPE_CAP_DEVICE_RESET_STATUS_QUERY
+
+i965: Fix missing type in local variable declaration.
+
+Subsequent patch comments should describe the change in more detail,
+if needed.  For example:
+
+i965: Remove end-of-thread SEND alignment code.
+
+This was present in Eric's initial implementation of the compaction code
+for Sandybridge (commit 077d01b6). There is no documentation saying this
+is necessary, and removing it causes no regressions in piglit on any
+platform.
+
+A "Signed-off-by:" line is not required, but not discouraged either.
+If a patch address a bugzilla issue, that should be noted in the
+patch comment.  For example:
+
+   Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89689
+
+If there have been several revisions to a patch during the review
+process, they should be noted such as in this example:
+
+st/mesa: add ARB_texture_stencil8 support (v4)
+
+if we support stencil texturing, enable texture_stencil8
+there is no requirement to support native S8 for this,
+the texture can be converted to x24s8 fine.
+
+v2: fold fixes from Marek in:
+   a) put S8 last in the list
+   b) fix renderable to always test for d/s renderable
+fixup the texture case to use a stencil only format
+for picking the format for the texture view.
+v3: hit fallback for getteximage
+v4: put s8 back in front, it shouldn't get picked now (Ilia)
+
+If someone tested your patch, document it with a line like this:
+
+Tested-by: Joe Hacker 
+
+If the patch was reviewed (usually the case) or acked by someone,
+that should be documented with:
+
+Reviewed-by: Joe Hacker 
+Acked-by: Joe Hacker 
+
+
+
+
+
+Testing Patches
+
+
+It should go without saying that patches must be tested.  In general,
+do whatever testing is prudent.
+
+
+
+You should always run the Mesa test suite before submitting patches.
+The test suite can be run using the 'make check' command. All tests
 must pass before patches will be accepted, this may mean you have
 to update the tests themselves.
 
 
 
+Whenever possible and applicable, test the patch with
+http://people.freedesktop.org/~nh/piglit/";>Piglit to
+check for regressions.
+
+
+
+Mailing Patches
+
+
 Patches should be sent to the Mesa mailing list for review.
 When submitting a patch make sure to use git send-email rather than attaching
 patches to emails. Sending patches as attachments prevents people from being

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


Mesa (master): docs: reorganize devnotes.html file

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 98f2f47f7a1d893bb482d508a690c417c2453c6e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98f2f47f7a1d893bb482d508a690c417c2453c6e

Author: Brian Paul 
Date:   Mon May 25 09:13:09 2015 -0600

docs: reorganize devnotes.html file

Move "Adding Extensions" to the end.  Add a simple table of contents
at the top.

Reviewed-by: Thomas Helland 

---

 docs/devinfo.html |  110 +
 1 file changed, 61 insertions(+), 49 deletions(-)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index 8d20eea..c7e4171 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -17,55 +17,15 @@
 Development Notes
 
 
-Adding Extensions
-
-
-To add a new GL extension to Mesa you have to do at least the following.
-
 
-
-   If glext.h doesn't define the extension, edit include/GL/gl.h and add
-   code like this:
-   
- #ifndef GL_EXT_the_extension_name
- #define GL_EXT_the_extension_name 1
- /* declare the new enum tokens */
- /* prototype the new functions */
- /* TYPEDEFS for the new functions */
- #endif
-   
-
-
-   In the src/mapi/glapi/gen/ directory, add the new extension functions and
-   enums to the gl_API.xml file.
-   Then, a bunch of source files must be regenerated by executing the
-   corresponding Python scripts.
-
-
-   Add a new entry to the gl_extensions struct in mtypes.h
-
-
-   Update the extensions.c file.
-
-
-   From this point, the best way to proceed is to find another extension,
-   similar to the new one, that's already implemented in Mesa and use it
-   as an example.
-
-
-   If the new extension adds new GL state, the functions in get.c, enable.c
-   and attrib.c will most likely require new code.
-
-
-   The dispatch tests check_table.cpp and dispatch_sanity.cpp
-   should be updated with details about the new extensions functions. These
-   tests are run using 'make check'
-
+Coding Style
+Submitting Patches
+Making a New Mesa Release
+Adding Extensions
 
 
 
-
-Coding Style
+Coding Style
 
 
 Mesa's code style has changed over the years.  Here's the latest.
@@ -160,7 +120,8 @@ of bool, true, and
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
 
 
-Submitting patches
+
+Submitting patches
 
 
 You should always run the Mesa Testsuite before submitting patches.
@@ -184,7 +145,7 @@ re-sending the whole series). Using --in-reply-to makes
 it harder for reviewers to accidentally review old patches.
 
 
-Marking a commit as a candidate for a stable branch
+Marking a commit as a candidate for a stable branch
 
 
 If you want a commit to be applied to a stable branch,
@@ -221,7 +182,7 @@ the upcoming stable release can always be seen on the
 http://cworth.org/~cworth/mesa-stable-queue/";>Mesa Stable Queue
 page.
 
-Criteria for accepting patches to the stable branch
+Criteria for accepting patches to the stable branch
 
 Mesa has a designated release manager for each stable branch, and the release
 manager is the only developer that should be pushing changes to these
@@ -306,7 +267,8 @@ be rejected:
   regression that is unaacceptable for the stable branch.
 
 
-Making a New Mesa Release
+
+Making a New Mesa Release
 
 
 These are the instructions for making a new Mesa release.
@@ -543,6 +505,56 @@ release announcement:
 
 
 
+
+Adding Extensions
+
+
+To add a new GL extension to Mesa you have to do at least the following.
+
+
+
+   If glext.h doesn't define the extension, edit include/GL/gl.h and add
+   code like this:
+   
+ #ifndef GL_EXT_the_extension_name
+ #define GL_EXT_the_extension_name 1
+ /* declare the new enum tokens */
+ /* prototype the new functions */
+ /* TYPEDEFS for the new functions */
+ #endif
+   
+
+
+   In the src/mapi/glapi/gen/ directory, add the new extension functions and
+   enums to the gl_API.xml file.
+   Then, a bunch of source files must be regenerated by executing the
+   corresponding Python scripts.
+
+
+   Add a new entry to the gl_extensions struct in mtypes.h
+
+
+   Update the extensions.c file.
+
+
+   From this point, the best way to proceed is to find another extension,
+   similar to the new one, that's already implemented in Mesa and use it
+   as an example.
+
+
+   If the new extension adds new GL state, the functions in get.c, enable.c
+   and attrib.c will most likely require new code.
+
+
+   The dispatch tests check_table.cpp and dispatch_sanity.cpp
+   should be updated with details about the new extensions functions. These
+   tests are run using 'make check'
+
+
+
+
+
+
 
 
 

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


Mesa (master): mesa: add some comments in copyimage.c

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: dce53a7d2453c0b2b69a345340455866e75f0a8d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dce53a7d2453c0b2b69a345340455866e75f0a8d

Author: Brian Paul 
Date:   Fri May 22 17:26:12 2015 -0700

mesa: add some comments in copyimage.c

Reviewed-by: Topi Pohjolainen 

---

 src/mesa/main/copyimage.c |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index 789f9a6..e8732c6 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -40,6 +40,19 @@ enum mesa_block_class {
BLOCK_CLASS_64_BITS
 };
 
+/**
+ * Prepare the source or destination resource, including:
+ * - Error checking
+ * - Creating texture wrappers for renderbuffers
+ * \param name  the texture or renderbuffer name
+ * \param target  GL_TEXTURE target or GL_RENDERBUFFER.  For the later, will
+ *be changed to a compatible GL_TEXTURE target.
+ * \param level  mipmap level
+ * \param tex_obj  returns a pointer to a texture object
+ * \param tex_image  returns a pointer to a texture image
+ * \param tmp_tex  returns temporary texture object name
+ * \return true if success, false if error
+ */
 static bool
 prepare_target(struct gl_context *ctx, GLuint name, GLenum *target, int level,
struct gl_texture_object **tex_obj,
@@ -167,6 +180,12 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum 
*target, int level,
return true;
 }
 
+
+/**
+ * Check that the x,y,z,width,height,region is within the texture image
+ * dimensions.
+ * \return true if bounds OK, false if regions is out of bounds
+ */
 static bool
 check_region_bounds(struct gl_context *ctx,
 const struct gl_texture_image *tex_image,
@@ -187,6 +206,7 @@ check_region_bounds(struct gl_context *ctx,
   return false;
}
 
+   /* Check X direction */
if (x + width > tex_image->Width) {
   _mesa_error(ctx, GL_INVALID_VALUE,
   "glCopyImageSubData(%sX or %sWidth exceeds image bounds)",
@@ -194,6 +214,7 @@ check_region_bounds(struct gl_context *ctx,
   return false;
}
 
+   /* Check Y direction */
switch (tex_image->TexObject->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_1D_ARRAY:
@@ -214,6 +235,7 @@ check_region_bounds(struct gl_context *ctx,
   break;
}
 
+   /* Check Z direction */
switch (tex_image->TexObject->Target) {
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:

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


Mesa (master): mesa: add const qualifer on _mesa_is_compressed_format()

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 09eabf5be68b901999ef15733a22dfcb82dfec5f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=09eabf5be68b901999ef15733a22dfcb82dfec5f

Author: Brian Paul 
Date:   Fri May 22 16:39:32 2015 -0700

mesa: add const qualifer on _mesa_is_compressed_format()

Reviewed-by: Topi Pohjolainen 

---

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

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 8ced579..6a77c91 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -1200,7 +1200,7 @@ _mesa_is_depth_or_stencil_format(GLenum format)
  * \return GL_TRUE if compressed, GL_FALSE if uncompressed
  */
 GLboolean
-_mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
+_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
 {
switch (format) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
index e1ecd64..8881cb7 100644
--- a/src/mesa/main/glformats.h
+++ b/src/mesa/main/glformats.h
@@ -96,7 +96,7 @@ extern GLboolean
 _mesa_is_depth_or_stencil_format(GLenum format);
 
 extern GLboolean
-_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
+_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format);
 
 extern GLenum
 _mesa_base_format_to_integer_format(GLenum format);

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


Mesa (master): xlib: fix X_GLXCreateContextAtrribs/Attribs typo

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: eec904d29c0d996fb05f24771a2fdd33e152f519
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=eec904d29c0d996fb05f24771a2fdd33e152f519

Author: Brian Paul 
Date:   Fri May 22 13:39:03 2015 -0700

xlib: fix X_GLXCreateContextAtrribs/Attribs typo

In case the glproto.h file isn't up to date, we provide the #define
for X_GLXCreateContextAttribsARB.

v2: fix other occurances, improve #ifndef test, per Jose.

Reviewed-by: Jose Fonseca 

---

 src/gallium/state_trackers/glx/xlib/glx_api.c |   27 -
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c 
b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 0508255..0456d44 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -40,6 +40,13 @@
 
 #include "xm_api.h"
 
+/* An "Atrribs/Attribs" typo was fixed in glxproto.h in Nov 2014.
+ * This is in case we don't have the updated header.
+ */
+#if !defined(X_GLXCreateContextAttribsARB) && \
+ defined(X_GLXCreateContextAtrribsARB)
+#define X_GLXCreateContextAttribsARB X_GLXCreateContextAtrribsARB
+#endif 
 
 /* This indicates the client-side GLX API and GLX encoder version. */
 #define CLIENT_MAJOR_VERSION 1
@@ -2168,7 +2175,7 @@ glXQueryDrawable(Display *dpy, GLXDrawable draw, int 
attribute,
 #endif
 
   default:
- generate_error(dpy, BadValue, 0, X_GLXCreateContextAtrribsARB, true);
+ generate_error(dpy, BadValue, 0, X_GLXCreateContextAttribsARB, true);
  return;
}
 }
@@ -2762,14 +2769,14 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig 
config,
  break;
   default:
  /* bad attribute */
- generate_error(dpy, BadValue, 0, X_GLXCreateContextAtrribsARB, True);
+ generate_error(dpy, BadValue, 0, X_GLXCreateContextAttribsARB, True);
  return NULL;
   }
}
 
/* check contextFlags */
if (contextFlags & ~contextFlagsAll) {
-  generate_error(dpy, BadValue, 0, X_GLXCreateContextAtrribsARB, True);
+  generate_error(dpy, BadValue, 0, X_GLXCreateContextAttribsARB, True);
   return NULL;
}
 
@@ -2777,14 +2784,14 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig 
config,
if (profileMask != GLX_CONTEXT_CORE_PROFILE_BIT_ARB &&
profileMask != GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB &&
profileMask != GLX_CONTEXT_ES_PROFILE_BIT_EXT) {
-  generate_error(dpy, GLXBadProfileARB, 0, X_GLXCreateContextAtrribsARB, 
False);
+  generate_error(dpy, GLXBadProfileARB, 0, X_GLXCreateContextAttribsARB, 
False);
   return NULL;
}
 
/* check renderType */
if (renderType != GLX_RGBA_TYPE &&
renderType != GLX_COLOR_INDEX_TYPE) {
-  generate_error(dpy, BadValue, 0, X_GLXCreateContextAtrribsARB, True);
+  generate_error(dpy, BadValue, 0, X_GLXCreateContextAttribsARB, True);
   return NULL;
}
 
@@ -2797,7 +2804,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig 
config,
  (majorVersion == 3 && minorVersion > 3) ||
  (majorVersion == 4 && minorVersion > 5) ||
  majorVersion > 4))) {
-  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAtrribsARB, True);
+  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAttribsARB, True);
   return NULL;
}
if (profileMask == GLX_CONTEXT_ES_PROFILE_BIT_EXT &&
@@ -2809,18 +2816,18 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig 
config,
* different error code for invalid ES versions, but this is what NVIDIA
* does and piglit expects.
*/
-  generate_error(dpy, GLXBadProfileARB, 0, X_GLXCreateContextAtrribsARB, 
False);
+  generate_error(dpy, GLXBadProfileARB, 0, X_GLXCreateContextAttribsARB, 
False);
   return NULL;
}
 
if ((contextFlags & GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB) &&
majorVersion < 3) {
-  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAtrribsARB, True);
+  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAttribsARB, True);
   return NULL;
}
 
if (renderType == GLX_COLOR_INDEX_TYPE && majorVersion >= 3) {
-  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAtrribsARB, True);
+  generate_error(dpy, BadMatch, 0, X_GLXCreateContextAttribsARB, True);
   return NULL;
}
 
@@ -2830,7 +2837,7 @@ glXCreateContextAttribsARB(Display *dpy, GLXFBConfig 
config,
 majorVersion, minorVersion,
 profileMask, contextFlags);
if (!ctx) {
-  generate_error(dpy, GLXBadFBConfig, 0, X_GLXCreateContextAtrribsARB, 
False);
+  generate_error(dpy, GLXBadFBConfig, 0, X_GLXCreateContextAttribsARB, 
False);
}
 
return ctx;

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


Mesa (master): mesa: const qualify, return bool for _mesa_texture_view_compatible_format()

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 3ddd1cf7d128018639de7e4c8bc17896233ebdb7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ddd1cf7d128018639de7e4c8bc17896233ebdb7

Author: Brian Paul 
Date:   Fri May 22 16:42:21 2015 -0700

mesa: const qualify, return bool for _mesa_texture_view_compatible_format()

Reviewed-by: Topi Pohjolainen 

---

 src/mesa/main/textureview.c |   12 ++--
 src/mesa/main/textureview.h |4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index cd87a27..a1cbec5 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -167,7 +167,7 @@ static const struct internal_format_class_info 
s3tc_compatible_internal_formats[
  * \return VIEW_CLASS if internalformat found in table, false otherwise.
  */
 static GLenum
-lookup_view_class(struct gl_context *ctx, GLenum internalformat)
+lookup_view_class(const struct gl_context *ctx, GLenum internalformat)
 {
GLuint i;
 
@@ -320,8 +320,8 @@ target_valid(struct gl_context *ctx, GLenum origTarget, 
GLenum newTarget)
  * If an error is found, record it with _mesa_error()
  * \return false if any error, true otherwise.
  */
-GLboolean
-_mesa_texture_view_compatible_format(struct gl_context *ctx,
+bool
+_mesa_texture_view_compatible_format(const struct gl_context *ctx,
  GLenum origInternalFormat,
  GLenum newInternalFormat)
 {
@@ -334,14 +334,14 @@ _mesa_texture_view_compatible_format(struct gl_context 
*ctx,
 * or an INVALID_OPERATION error is generated.
 */
if (origInternalFormat == newInternalFormat)
-  return GL_TRUE;
+  return true;
 
origViewClass = lookup_view_class(ctx, origInternalFormat);
newViewClass = lookup_view_class(ctx, newInternalFormat);
if ((origViewClass == newViewClass) && origViewClass != false)
-  return GL_TRUE;
+  return true;
 
-   return GL_FALSE;
+   return false;
 }
 /**
  * Helper function for TexStorage and teximagemultisample to set immutable
diff --git a/src/mesa/main/textureview.h b/src/mesa/main/textureview.h
index 549a13c..596a3a8 100644
--- a/src/mesa/main/textureview.h
+++ b/src/mesa/main/textureview.h
@@ -29,8 +29,8 @@
 #ifndef TEXTUREVIEW_H
 #define TEXTUREVIEW_H
 
-GLboolean
-_mesa_texture_view_compatible_format(struct gl_context *ctx,
+bool
+_mesa_texture_view_compatible_format(const struct gl_context *ctx,
  GLenum origInternalFormat,
  GLenum newInternalFormat);
 

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


Mesa (master): mesa: code clean-ups in textureview.[ch]

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 8369675a55ab300a84b3a82632042a33883ca255
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8369675a55ab300a84b3a82632042a33883ca255

Author: Brian Paul 
Date:   Fri May 22 17:20:57 2015 -0700

mesa: code clean-ups in textureview.[ch]

Reviewed-by: Topi Pohjolainen 

---

 src/mesa/main/textureview.c |   83 +++
 src/mesa/main/textureview.h |5 +--
 2 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index a1cbec5..6b0aed4 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -176,9 +176,11 @@ lookup_view_class(const struct gl_context *ctx, GLenum 
internalformat)
  return compatible_internal_formats[i].view_class;
}
 
-   if (ctx->Extensions.EXT_texture_compression_s3tc && 
ctx->Extensions.EXT_texture_sRGB) {
+   if (ctx->Extensions.EXT_texture_compression_s3tc &&
+   ctx->Extensions.EXT_texture_sRGB) {
   for (i = 0; i < ARRAY_SIZE(s3tc_compatible_internal_formats); i++) {
- if (s3tc_compatible_internal_formats[i].internal_format == 
internalformat)
+ if (s3tc_compatible_internal_formats[i].internal_format
+ == internalformat)
 return s3tc_compatible_internal_formats[i].view_class;
   }
}
@@ -226,7 +228,8 @@ initialize_texture_fields(struct gl_context *ctx,
 0, internalFormat, texFormat);
   }
 
-  _mesa_next_mipmap_level_size(target, 0, levelWidth, levelHeight, 
levelDepth,
+  _mesa_next_mipmap_level_size(target, 0,
+   levelWidth, levelHeight, levelDepth,
&levelWidth, &levelHeight, &levelDepth);
}
 
@@ -343,6 +346,7 @@ _mesa_texture_view_compatible_format(const struct 
gl_context *ctx,
 
return false;
 }
+
 /**
  * Helper function for TexStorage and teximagemultisample to set immutable
  * texture state needed by ARB_texture_view.
@@ -357,17 +361,19 @@ _mesa_set_texture_view_state(struct gl_context *ctx,
/* Get a reference to what will become this View's base level */
texImage = _mesa_select_tex_image(texObj, target, 0);
 
-   /* When an immutable texture is created via glTexStorage or 
glTexImageMultisample,
+   /* When an immutable texture is created via glTexStorage or
+* glTexImageMultisample,
 * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
 * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
 * If the texture target is TEXTURE_1D_ARRAY then
 * TEXTURE_VIEW_NUM_LAYERS becomes height.
 * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
-* or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes 
depth.
+* or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes
+* depth.
 * If the texture target is TEXTURE_CUBE_MAP, then
 * TEXTURE_VIEW_NUM_LAYERS becomes 6.
 * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
-* 
+*
 * ARB_texture_multisample: Multisample textures do
 * not have multiple image levels.
 */
@@ -401,7 +407,6 @@ _mesa_set_texture_view_state(struct gl_context *ctx,
case GL_TEXTURE_CUBE_MAP:
   texObj->NumLayers = 6;
   break;
-
}
 }
 
@@ -435,16 +440,20 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
   minlevel, numlevels, minlayer, numlayers);
 
if (origtexture == 0) {
-  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)", 
origtexture);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)",
+  origtexture);
   return;
}
 
/* Need original texture information to validate arguments */
origTexObj = _mesa_lookup_texture(ctx, origtexture);
 
-   /* If  is not the name of a texture, INVALID_VALUE is 
generated. */
+   /* If  is not the name of a texture, INVALID_VALUE
+* is generated.
+*/
if (!origTexObj) {
-  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)", 
origtexture);
+  _mesa_error(ctx, GL_INVALID_VALUE, "glTextureView(origtexture = %u)",
+  origtexture);
   return;
}
 
@@ -452,7 +461,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
 * INVALID_OPERATION is generated.
 */
if (!origTexObj->Immutable) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(origtexture not 
immutable)");
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glTextureView(origtexture not immutable)");
   return;
}
 
@@ -467,7 +477,8 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
 */
texObj = _mesa_lookup_texture(ctx, texture);
if (texObj == NULL) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(texture = %u 
non-gen name)", texture);
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+ 

Mesa (master): mesa: move decls, add const qualifiers in copyimage.c

2015-05-26 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 0b76541ce0cc34020ef1057a17149cbf9cb3dbe1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0b76541ce0cc34020ef1057a17149cbf9cb3dbe1

Author: Brian Paul 
Date:   Fri May 22 17:22:47 2015 -0700

mesa: move decls, add const qualifiers in copyimage.c

Reviewed-by: Topi Pohjolainen 

---

 src/mesa/main/copyimage.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index fd22f28..789f9a6 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -46,8 +46,6 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum 
*target, int level,
struct gl_texture_image **tex_image, GLuint *tmp_tex,
const char *dbg_prefix)
 {
-   struct gl_renderbuffer *rb;
-
if (name == 0) {
   _mesa_error(ctx, GL_INVALID_VALUE,
   "glCopyImageSubData(%sName = %d)", dbg_prefix, name);
@@ -87,7 +85,7 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum 
*target, int level,
}
 
if (*target == GL_RENDERBUFFER) {
-  rb = _mesa_lookup_renderbuffer(ctx, name);
+  struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
   if (!rb) {
  _mesa_error(ctx, GL_INVALID_VALUE,
  "glCopyImageSubData(%sName = %u)", dbg_prefix, name);
@@ -170,7 +168,8 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum 
*target, int level,
 }
 
 static bool
-check_region_bounds(struct gl_context *ctx, struct gl_texture_image *tex_image,
+check_region_bounds(struct gl_context *ctx,
+const struct gl_texture_image *tex_image,
 int x, int y, int z, int width, int height, int depth,
 const char *dbg_prefix)
 {
@@ -260,7 +259,7 @@ check_region_bounds(struct gl_context *ctx, struct 
gl_texture_image *tex_image,
 }
 
 static bool
-compressed_format_compatible(struct gl_context *ctx,
+compressed_format_compatible(const struct gl_context *ctx,
  GLenum compressedFormat, GLenum otherFormat)
 {
enum mesa_block_class compressedClass, otherClass;
@@ -348,8 +347,8 @@ compressed_format_compatible(struct gl_context *ctx,
 }
 
 static bool
-copy_format_compatible(struct gl_context *ctx,
-GLenum srcFormat, GLenum dstFormat)
+copy_format_compatible(const struct gl_context *ctx,
+   GLenum srcFormat, GLenum dstFormat)
 {
/*
 * From ARB_copy_image spec:
@@ -389,7 +388,7 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, 
GLint srcLevel,
struct gl_texture_object *srcTexObj, *dstTexObj;
struct gl_texture_image *srcTexImage, *dstTexImage;
GLuint src_bw, src_bh, dst_bw, dst_bh;
-   int i, srcNewZ, dstNewZ;
+   int i;
 
if (MESA_VERBOSE & VERBOSE_API)
   _mesa_debug(ctx, "glCopyImageSubData(%u, %s, %d, %d, %d, %d, "
@@ -447,6 +446,8 @@ _mesa_CopyImageSubData(GLuint srcName, GLenum srcTarget, 
GLint srcLevel,
}
 
for (i = 0; i < srcDepth; ++i) {
+  int srcNewZ, dstNewZ;
+
   if (srcTexObj->Target == GL_TEXTURE_CUBE_MAP) {
  srcTexImage = srcTexObj->Image[i + srcZ][srcLevel];
  srcNewZ = 0;

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


Mesa (master): glapi: Avoid argparse type argument for API XML input files.

2015-05-26 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: b787f48ed2a7e1855100afd943ae6b407abb401f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b787f48ed2a7e1855100afd943ae6b407abb401f

Author: Jose Fonseca 
Date:   Tue May 26 11:01:57 2015 +0100

glapi: Avoid argparse type argument for API XML input files.

argparse type is a nice type saver for simple data types, but it doesn't
look a good fit for the input XML file:

- Certain implementations of argparse (particularly python 2.7.3's)
  invoke the type constructor for the default argument even when an
  option is passed in the command line.  Causing `No such file or
  directory: 'gl_API.xml'` when the current dir is not
  src/mapi/glapi/gen.

- The parser takes multiple arguments.  This is currently worked around
  using lambdas, but that unnecessarily complex and hard to read.
  Furthermore it's odd to have a side-effect as heavy as parsing XML
  happening deep inside the argument parsing.

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

Reviewed-by: Brian Paul 

---

 src/mapi/glapi/gen/gl_procs.py |7 +++
 src/mapi/glapi/gen/gl_table.py |9 +
 src/mapi/glapi/gen/remap_helper.py |8 
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
index cf6d2de..685e2fa 100644
--- a/src/mapi/glapi/gen/gl_procs.py
+++ b/src/mapi/glapi/gen/gl_procs.py
@@ -165,14 +165,12 @@ typedef struct {
 
 def _parser():
 """Parse arguments and return a namepsace."""
-api_type = lambda x: gl_XML.parse_GL_API(x, glX_XML.glx_item_factory())
 
 parser = argparse.ArgumentParser()
 parser.add_argument('-f', '--filename',
-type=api_type,
 default='gl_API.xml',
 metavar="input_file_name",
-dest='api',
+dest='file_name',
 help="Path to an XML description of OpenGL API.")
 parser.add_argument('-c', '--es-version',
 dest='es',
@@ -184,7 +182,8 @@ def _parser():
 def main():
 """Main function."""
 args = _parser()
-PrintGlProcs(args.es).Print(args.api)
+api = gl_XML.parse_GL_API(args.file_name, glX_XML.glx_item_factory())
+PrintGlProcs(args.es).Print(api)
 
 
 if __name__ == '__main__':
diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
index 30903fd..3f02902 100644
--- a/src/mapi/glapi/gen/gl_table.py
+++ b/src/mapi/glapi/gen/gl_table.py
@@ -206,10 +206,9 @@ def _parser():
 """Parse arguments and return a namespace."""
 parser = argparse.ArgumentParser()
 parser.add_argument('-f', '--filename',
-type=gl_XML.parse_GL_API,
 default='gl_API.xml',
 metavar="input_file_name",
-dest='api',
+dest='file_name',
 help="Path to an XML description of OpenGL API.")
 parser.add_argument('-m', '--mode',
 choices=['table', 'remap_table'],
@@ -229,15 +228,17 @@ def main():
 """Main function."""
 args = _parser()
 
+api = gl_XML.parse_GL_API(args.file_name)
+
 if args.mode == "table":
 printer = PrintGlTable(args.es)
 elif args.mode == "remap_table":
 printer = PrintRemapTable(args.es)
 
 if args.es is not None:
-args.api.filter_functions_by_api(args.es)
+api.filter_functions_by_api(args.es)
 
-printer.Print(args.api)
+printer.Print(api)
 
 
 if __name__ == '__main__':
diff --git a/src/mapi/glapi/gen/remap_helper.py 
b/src/mapi/glapi/gen/remap_helper.py
index 9e3c390..94ae193 100644
--- a/src/mapi/glapi/gen/remap_helper.py
+++ b/src/mapi/glapi/gen/remap_helper.py
@@ -170,10 +170,9 @@ def _parser():
 """Parse input options and return a namsepace."""
 parser = argparse.ArgumentParser()
 parser.add_argument('-f', '--filename',
-type=gl_XML.parse_GL_API,
 default="gl_API.xml",
 metavar="input_file_name",
-dest='api',
+dest='file_name',
 help="An xml description file.")
 parser.add_argument('-c', '--es-version',
 choices=[None, 'es1', 'es2'],
@@ -188,11 +187,12 @@ def main():
 """Main function."""
 args = _parser()
 
+api = gl_XML.parse_GL_API(args.file_name)
 if args.es is not None:
-args.api.filter_functions_by_api(args.es)
+api.filter_functions_by_api(args.es)
 
 printer = PrintGlRemap()
-printer.Print(args.api)
+printer.Print(api)
 
 
 if __name__ == '__main__':

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


Mesa (master): gallium: use const in set_tess_state

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 92c31bb0dd8149d3e5db48b8dec62b242be80d28
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=92c31bb0dd8149d3e5db48b8dec62b242be80d28

Author: Marek Olšák 
Date:   Mon May 18 12:34:44 2015 +0200

gallium: use const in set_tess_state

Reviewed-by: Ilia Mirkin 

---

 src/gallium/drivers/trace/tr_context.c |4 ++--
 src/gallium/include/pipe/p_context.h   |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/trace/tr_context.c 
b/src/gallium/drivers/trace/tr_context.c
index a1aeebd..0013c96 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -1511,8 +1511,8 @@ static void trace_context_memory_barrier(struct 
pipe_context *_context,
 
 
 static void trace_context_set_tess_state(struct pipe_context *_context,
- float default_outer_level[4],
- float default_inner_level[2])
+ const float default_outer_level[4],
+ const float default_inner_level[2])
 {
struct trace_context *tr_context = trace_context(_context);
struct pipe_context *context = tr_context->pipe;
diff --git a/src/gallium/include/pipe/p_context.h 
b/src/gallium/include/pipe/p_context.h
index c25bfa6..c2eedf8 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -232,8 +232,8 @@ struct pipe_context {
  struct pipe_sampler_view **);
 
void (*set_tess_state)(struct pipe_context *,
-  float default_outer_level[4],
-  float default_inner_level[2]);
+  const float default_outer_level[4],
+  const float default_inner_level[2]);
 
/**
 * Bind an array of shader resources that will be used by the

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


Mesa (master): gallium: rename TGSI tessellation processor types to match pipe shader names

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0d84b6cf84971f3378bb95c85f7d39e0c6680b8f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d84b6cf84971f3378bb95c85f7d39e0c6680b8f

Author: Marek Olšák 
Date:   Mon May 18 13:52:30 2015 +0200

gallium: rename TGSI tessellation processor types to match pipe shader names

I forgot to do this when pushing the interface changes.

Reviewed-by: Ilia Mirkin 

---

 src/gallium/auxiliary/tgsi/tgsi_dump.c |6 +++---
 src/gallium/auxiliary/tgsi/tgsi_info.c |4 ++--
 src/gallium/auxiliary/tgsi/tgsi_sanity.c   |   12 ++--
 src/gallium/auxiliary/tgsi/tgsi_scan.c |8 
 src/gallium/include/pipe/p_shader_tokens.h |4 ++--
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c 
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index c584c2b..c80d7a2 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -286,15 +286,15 @@ iter_declaration(
if (decl->Declaration.File == TGSI_FILE_INPUT &&
(iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY ||
 (!patch &&
- (iter->processor.Processor == TGSI_PROCESSOR_TESSCTRL ||
-  iter->processor.Processor == TGSI_PROCESSOR_TESSEVAL {
+ (iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL ||
+  iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL {
   TXT("[]");
}
 
/* all non-patch tess ctrl shader outputs are two dimensional */
if (decl->Declaration.File == TGSI_FILE_OUTPUT &&
!patch &&
-   iter->processor.Processor == TGSI_PROCESSOR_TESSCTRL) {
+   iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL) {
   TXT("[]");
}
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c 
b/src/gallium/auxiliary/tgsi/tgsi_info.c
index eb447cb..9295311 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -302,9 +302,9 @@ tgsi_get_processor_name( uint processor )
   return "fragment shader";
case TGSI_PROCESSOR_GEOMETRY:
   return "geometry shader";
-   case TGSI_PROCESSOR_TESSCTRL:
+   case TGSI_PROCESSOR_TESS_CTRL:
   return "tessellation control shader";
-   case TGSI_PROCESSOR_TESSEVAL:
+   case TGSI_PROCESSOR_TESS_EVAL:
   return "tessellation evaluation shader";
default:
   return "unknown shader type!";
diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c 
b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
index 2ac74fb..be4851f 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c
@@ -415,8 +415,8 @@ iter_declaration(
  decl->Semantic.Name == TGSI_SEMANTIC_TESSINNER;
   if (file == TGSI_FILE_INPUT && !patch && (
 processor == TGSI_PROCESSOR_GEOMETRY ||
-processor == TGSI_PROCESSOR_TESSCTRL ||
-processor == TGSI_PROCESSOR_TESSEVAL)) {
+processor == TGSI_PROCESSOR_TESS_CTRL ||
+processor == TGSI_PROCESSOR_TESS_EVAL)) {
  uint vert;
  for (vert = 0; vert < ctx->implied_array_size; ++vert) {
 scan_register *reg = MALLOC(sizeof(scan_register));
@@ -424,7 +424,7 @@ iter_declaration(
 check_and_declare(ctx, reg);
  }
   } else if (file == TGSI_FILE_OUTPUT && !patch &&
- processor == TGSI_PROCESSOR_TESSCTRL) {
+ processor == TGSI_PROCESSOR_TESS_CTRL) {
  uint vert;
  for (vert = 0; vert < ctx->implied_out_array_size; ++vert) {
 scan_register *reg = MALLOC(sizeof(scan_register));
@@ -489,7 +489,7 @@ iter_property(
prop->Property.PropertyName == TGSI_PROPERTY_GS_INPUT_PRIM) {
   ctx->implied_array_size = u_vertices_per_prim(prop->u[0].Data);
}
-   if (iter->processor.Processor == TGSI_PROCESSOR_TESSCTRL &&
+   if (iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL &&
prop->Property.PropertyName == TGSI_PROPERTY_TCS_VERTICES_OUT)
   ctx->implied_out_array_size = prop->u[0].Data;
return TRUE;
@@ -499,8 +499,8 @@ static boolean
 prolog(struct tgsi_iterate_context *iter)
 {
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
-   if (iter->processor.Processor == TGSI_PROCESSOR_TESSCTRL ||
-   iter->processor.Processor == TGSI_PROCESSOR_TESSEVAL)
+   if (iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL ||
+   iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL)
   ctx->implied_array_size = 32;
return TRUE;
 }
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c 
b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 3f94bab..d821072 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -74,8 +74,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
assert(procType == TGSI_PROCESSOR_FRAGMENT ||
   procType == TGSI_PROCESSOR_VERTEX ||
   procType == TGSI_PROCESSOR_GEOMETRY ||
-  procType == 

Mesa (master): tgsi/ureg: enable creating tessellation shaders with ureg_create_shader

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 3d35027fdc383c2bd009f3690b2b160e3b39d58b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d35027fdc383c2bd009f3690b2b160e3b39d58b

Author: Marek Olšák 
Date:   Mon May 18 02:23:04 2015 +0200

tgsi/ureg: enable creating tessellation shaders with ureg_create_shader

Reviewed-by: Ilia Mirkin 

---

 src/gallium/auxiliary/tgsi/tgsi_ureg.c |   18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c 
b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 7a8bf54..037d31a 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -1667,10 +1667,20 @@ void *ureg_create_shader( struct ureg_program *ureg,
else
   memset(&state.stream_output, 0, sizeof(state.stream_output));
 
-   if (ureg->processor == TGSI_PROCESSOR_VERTEX)
-  return pipe->create_vs_state( pipe, &state );
-   else
-  return pipe->create_fs_state( pipe, &state );
+   switch (ureg->processor) {
+   case TGSI_PROCESSOR_VERTEX:
+  return pipe->create_vs_state(pipe, &state);
+   case TGSI_PROCESSOR_TESS_CTRL:
+  return pipe->create_tcs_state(pipe, &state);
+   case TGSI_PROCESSOR_TESS_EVAL:
+  return pipe->create_tes_state(pipe, &state);
+   case TGSI_PROCESSOR_GEOMETRY:
+  return pipe->create_gs_state(pipe, &state);
+   case TGSI_PROCESSOR_FRAGMENT:
+  return pipe->create_fs_state(pipe, &state);
+   default:
+  return NULL;
+   }
 }
 
 

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


Mesa (master): radeonsi: fix scratch buffer setup for geometry shaders

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: fa7f606e89dc4447f07fec0b84d396a4ff25ee7e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa7f606e89dc4447f07fec0b84d396a4ff25ee7e

Author: Marek Olšák 
Date:   Mon May 18 14:56:34 2015 +0200

radeonsi: fix scratch buffer setup for geometry shaders

Cc: 10.6 
Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_state_shaders.c |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 25811ab..610af94 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -841,8 +841,15 @@ static void si_update_spi_tmpring_size(struct si_context 
*sctx)
si_pm4_bind_state(sctx, ps, 
sctx->ps_shader->current->pm4);
if (si_update_scratch_buffer(sctx, sctx->gs_shader))
si_pm4_bind_state(sctx, gs, 
sctx->gs_shader->current->pm4);
-   if (si_update_scratch_buffer(sctx, sctx->vs_shader))
-   si_pm4_bind_state(sctx, vs, 
sctx->vs_shader->current->pm4);
+
+   /* VS can be bound as ES or VS. */
+   if (sctx->gs_shader) {
+   if (si_update_scratch_buffer(sctx, sctx->vs_shader))
+   si_pm4_bind_state(sctx, es, 
sctx->vs_shader->current->pm4);
+   } else {
+   if (si_update_scratch_buffer(sctx, sctx->vs_shader))
+   si_pm4_bind_state(sctx, vs, 
sctx->vs_shader->current->pm4);
+   }
}
 
/* The LLVM shader backend should be reporting aligned scratch_sizes. */

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


Mesa (master): radeonsi: use a switch statement in si_delete_shader_selector

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 224a77cc60cc0e7f8a14e35ebca6e42544af39b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=224a77cc60cc0e7f8a14e35ebca6e42544af39b1

Author: Marek Olšák 
Date:   Sun Feb 22 15:38:21 2015 +0100

radeonsi: use a switch statement in si_delete_shader_selector

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_state_shaders.c |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index e037ce4..208c852 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -592,15 +592,22 @@ static void si_delete_shader_selector(struct pipe_context 
*ctx,
 
while (p) {
c = p->next_variant;
-   if (sel->type == PIPE_SHADER_GEOMETRY) {
+   switch (sel->type) {
+   case PIPE_SHADER_VERTEX:
+   if (p->key.vs.as_es)
+   si_pm4_delete_state(sctx, es, p->pm4);
+   else
+   si_pm4_delete_state(sctx, vs, p->pm4);
+   break;
+   case PIPE_SHADER_GEOMETRY:
si_pm4_delete_state(sctx, gs, p->pm4);
si_pm4_delete_state(sctx, vs, p->gs_copy_shader->pm4);
-   } else if (sel->type == PIPE_SHADER_FRAGMENT)
+   break;
+   case PIPE_SHADER_FRAGMENT:
si_pm4_delete_state(sctx, ps, p->pm4);
-   else if (p->key.vs.as_es)
-   si_pm4_delete_state(sctx, es, p->pm4);
-   else
-   si_pm4_delete_state(sctx, vs, p->pm4);
+   break;
+   }
+
si_shader_destroy(ctx, p);
free(p);
p = c;

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


Mesa (master): tgsi/text: enable parsing tessellation shaders

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: c1266f28d6af7788e19634f0d36257e78d1139be
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1266f28d6af7788e19634f0d36257e78d1139be

Author: Marek Olšák 
Date:   Mon May 18 02:21:47 2015 +0200

tgsi/text: enable parsing tessellation shaders

Reviewed-by: Ilia Mirkin 

---

 src/gallium/auxiliary/tgsi/tgsi_text.c |4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index a9734db..a6675c5 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -297,6 +297,10 @@ static boolean parse_header( struct translate_ctx *ctx )
   processor = TGSI_PROCESSOR_VERTEX;
else if (str_match_nocase_whole( &ctx->cur, "GEOM" ))
   processor = TGSI_PROCESSOR_GEOMETRY;
+   else if (str_match_nocase_whole( &ctx->cur, "TESS_CTRL" ))
+  processor = TGSI_PROCESSOR_TESS_CTRL;
+   else if (str_match_nocase_whole( &ctx->cur, "TESS_EVAL" ))
+  processor = TGSI_PROCESSOR_TESS_EVAL;
else if (str_match_nocase_whole( &ctx->cur, "COMP" ))
   processor = TGSI_PROCESSOR_COMPUTE;
else {

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


Mesa (master): radeonsi: add support for PIPE_CAP_TGSI_TEXCOORD

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: e4339bc9886a26d75b924ad045c3ddd003f802c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4339bc9886a26d75b924ad045c3ddd003f802c3

Author: Marek Olšák 
Date:   Sat May  9 19:36:17 2015 +0200

radeonsi: add support for PIPE_CAP_TGSI_TEXCOORD

Without it, texcoords are mapped to GENERIC[0..7], PointCoord is mapped to
GENERIC[8], and user-defined varyings start from GENERIC[9]. Since texcoords
can only be used between VS and PS, and PointCoord is PS-only, it's silly to
always start from GENERIC[9] in all other shaders (such as LS, HS, ES, GS).

This adds support for TEXCOORD and PCOORD semantics. As a result, st/mesa
will use GENERIC[0] as a base for user-defined varyings, which should make
linking ES and GS as well as tessellation shaders at runtime easier.

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_pipe.c  |2 +-
 src/gallium/drivers/radeonsi/si_shader.c|1 +
 src/gallium/drivers/radeonsi/si_state.c |   20 
 src/gallium/drivers/radeonsi/si_state_shaders.c |5 +++--
 4 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 9d60ef1..b57aa5f 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -251,6 +251,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_POLYGON_OFFSET_CLAMP:
case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
+   case PIPE_CAP_TGSI_TEXCOORD:
return 1;
 
case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
@@ -286,7 +287,6 @@ static int si_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
case PIPE_CAP_USER_VERTEX_BUFFERS:
-   case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_FAKE_SW_MSAA:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 89f02ab..5c22252 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1183,6 +1183,7 @@ handle_semantic:
continue;
case TGSI_SEMANTIC_PRIMID:
case TGSI_SEMANTIC_FOG:
+   case TGSI_SEMANTIC_TEXCOORD:
case TGSI_SEMANTIC_GENERIC:
target = V_008DFC_SQ_EXP_PARAM + param_count;
shader->vs_output_param_offset[i] = param_count;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 7f0fdd5..d1b3ca2 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -636,18 +636,14 @@ static void *si_create_rs_state(struct pipe_context *ctx,
rs->offset_units = state->offset_units;
rs->offset_scale = state->offset_scale * 12.0f;
 
-   tmp = S_0286D4_FLAT_SHADE_ENA(1);
-   if (state->sprite_coord_enable) {
-   tmp |= S_0286D4_PNT_SPRITE_ENA(1) |
-   
S_0286D4_PNT_SPRITE_OVRD_X(V_0286D4_SPI_PNT_SPRITE_SEL_S) |
-   
S_0286D4_PNT_SPRITE_OVRD_Y(V_0286D4_SPI_PNT_SPRITE_SEL_T) |
-   
S_0286D4_PNT_SPRITE_OVRD_Z(V_0286D4_SPI_PNT_SPRITE_SEL_0) |
-   
S_0286D4_PNT_SPRITE_OVRD_W(V_0286D4_SPI_PNT_SPRITE_SEL_1);
-   if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
-   tmp |= S_0286D4_PNT_SPRITE_TOP_1(1);
-   }
-   }
-   si_pm4_set_reg(pm4, R_0286D4_SPI_INTERP_CONTROL_0, tmp);
+   si_pm4_set_reg(pm4, R_0286D4_SPI_INTERP_CONTROL_0,
+   S_0286D4_FLAT_SHADE_ENA(1) |
+   S_0286D4_PNT_SPRITE_ENA(1) |
+   S_0286D4_PNT_SPRITE_OVRD_X(V_0286D4_SPI_PNT_SPRITE_SEL_S) |
+   S_0286D4_PNT_SPRITE_OVRD_Y(V_0286D4_SPI_PNT_SPRITE_SEL_T) |
+   S_0286D4_PNT_SPRITE_OVRD_Z(V_0286D4_SPI_PNT_SPRITE_SEL_0) |
+   S_0286D4_PNT_SPRITE_OVRD_W(V_0286D4_SPI_PNT_SPRITE_SEL_1) |
+   S_0286D4_PNT_SPRITE_TOP_1(state->sprite_coord_mode != 
PIPE_SPRITE_COORD_UPPER_LEFT));
 
/* point size 12.4 fixed point */
tmp = (unsigned)(state->point_size * 8.0);
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 1bbc6b3..5974e77 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -661,8 +661,9 @@ bcolor:
(interpolate == TGSI_INTERPOLATE_COLOR && sctx->flatshade))
tmp |= S_028644_FLAT_SHADE(1);
 
-   if (name == TGSI_SEMANTIC_GENERIC &&
-   sctx->sprit

Mesa (master): radeonsi: use a switch statement in si_shader_selector_key

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0c5a309cee868cd6e3870f439f560f5f32eb7c40
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c5a309cee868cd6e3870f439f560f5f32eb7c40

Author: Marek Olšák 
Date:   Sun Feb 22 15:21:59 2015 +0100

radeonsi: use a switch statement in si_shader_selector_key

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_state_shaders.c |   25 +++
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 610af94..e037ce4 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -356,21 +356,25 @@ static INLINE void si_shader_selector_key(struct 
pipe_context *ctx,
  union si_shader_key *key)
 {
struct si_context *sctx = (struct si_context *)ctx;
-   memset(key, 0, sizeof(*key));
+   unsigned i;
 
-   if (sel->type == PIPE_SHADER_VERTEX) {
-   unsigned i;
-   if (!sctx->vertex_elements)
-   return;
+   memset(key, 0, sizeof(*key));
 
-   for (i = 0; i < sctx->vertex_elements->count; ++i)
-   key->vs.instance_divisors[i] = 
sctx->vertex_elements->elements[i].instance_divisor;
+   switch (sel->type) {
+   case PIPE_SHADER_VERTEX:
+   if (sctx->vertex_elements)
+   for (i = 0; i < sctx->vertex_elements->count; ++i)
+   key->vs.instance_divisors[i] =
+   
sctx->vertex_elements->elements[i].instance_divisor;
 
if (sctx->gs_shader) {
key->vs.as_es = 1;
key->vs.gs_used_inputs = 
sctx->gs_shader->gs_used_inputs;
}
-   } else if (sel->type == PIPE_SHADER_FRAGMENT) {
+   break;
+   case PIPE_SHADER_GEOMETRY:
+   break;
+   case PIPE_SHADER_FRAGMENT: {
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 
if 
(sel->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
@@ -398,11 +402,14 @@ static INLINE void si_shader_selector_key(struct 
pipe_context *ctx,
}
 
key->ps.alpha_func = PIPE_FUNC_ALWAYS;
-
/* Alpha-test should be disabled if colorbuffer 0 is integer. */
if (sctx->queued.named.dsa &&
!sctx->framebuffer.cb0_is_integer)
key->ps.alpha_func = sctx->queued.named.dsa->alpha_func;
+   break;
+   }
+   default:
+   assert(0);
}
 }
 

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


Mesa (master): radeonsi: don' t count special outputs for the VS export count

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: af4b9c7c2e119d373f9684119b833a8b62cbb756
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=af4b9c7c2e119d373f9684119b833a8b62cbb756

Author: Marek Olšák 
Date:   Mon May 18 14:50:19 2015 +0200

radeonsi: don't count special outputs for the VS export count

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_state_shaders.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 5974e77..25811ab 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -182,8 +182,13 @@ static void si_shader_vs(struct si_shader *shader)
for (nparams = 0, i = 0 ; i < info->num_outputs; i++) {
switch (info->output_semantic_name[i]) {
case TGSI_SEMANTIC_CLIPVERTEX:
+   case TGSI_SEMANTIC_CLIPDIST:
+   case TGSI_SEMANTIC_CULLDIST:
case TGSI_SEMANTIC_POSITION:
case TGSI_SEMANTIC_PSIZE:
+   case TGSI_SEMANTIC_EDGEFLAG:
+   case TGSI_SEMANTIC_VIEWPORT_INDEX:
+   case TGSI_SEMANTIC_LAYER:
break;
default:
nparams++;

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


Mesa (master): radeonsi: remove unused cases from si_shader_io_get_unique_index

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f41517242aaad3cb67fb7f6c9a03dc34198ca500
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f41517242aaad3cb67fb7f6c9a03dc34198ca500

Author: Marek Olšák 
Date:   Sun May 10 18:03:47 2015 +0200

radeonsi: remove unused cases from si_shader_io_get_unique_index

These can't occur between VS and GS, because GS is only supported
in the core profile.

Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeonsi/si_shader.c |   17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 5c22252..47e5f96 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -128,21 +128,10 @@ unsigned si_shader_io_get_unique_index(unsigned 
semantic_name, unsigned index)
case TGSI_SEMANTIC_CLIPDIST:
assert(index <= 1);
return 2 + index;
-   case TGSI_SEMANTIC_CLIPVERTEX:
-   return 4;
-   case TGSI_SEMANTIC_COLOR:
-   assert(index <= 1);
-   return 5 + index;
-   case TGSI_SEMANTIC_BCOLOR:
-   assert(index <= 1);
-   return 7 + index;
-   case TGSI_SEMANTIC_FOG:
-   return 9;
-   case TGSI_SEMANTIC_EDGEFLAG:
-   return 10;
case TGSI_SEMANTIC_GENERIC:
-   assert(index <= 63-11);
-   return 11 + index;
+   assert(index <= 63-4);
+   return 4 + index;
+
default:
assert(0);
return 63;

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


Mesa (master): clover: Build fix for FreeBSD.

2015-05-26 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 967825d053f71c5f5fc3ba31eabc0c6004fde4f1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=967825d053f71c5f5fc3ba31eabc0c6004fde4f1

Author: Koop Mast 
Date:   Tue May 26 10:24:40 2015 +0200

clover: Build fix for FreeBSD.

Cc: 10.6 10.5 

---

 src/gallium/state_trackers/clover/core/error.hpp |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/clover/core/error.hpp 
b/src/gallium/state_trackers/clover/core/error.hpp
index eb65d62..780b973 100644
--- a/src/gallium/state_trackers/clover/core/error.hpp
+++ b/src/gallium/state_trackers/clover/core/error.hpp
@@ -26,6 +26,7 @@
 #include "CL/cl.h"
 
 #include 
+#include 
 
 namespace clover {
class command_queue;

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


Mesa (master): i965/skl: Add a message header for the TXF_MCS instruction in vec4vs

2015-05-26 Thread Neil Roberts
Module: Mesa
Branch: master
Commit: 5ae6c7bfce5c9fb91ab6cef2ea74a39af091d5f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ae6c7bfce5c9fb91ab6cef2ea74a39af091d5f6

Author: Neil Roberts 
Date:   Wed May 20 19:26:02 2015 +0100

i965/skl: Add a message header for the TXF_MCS instruction in vec4vs

When using SIMD4x2 on Skylake, the sampler instructions need a message
header to select the correct mode. This was added for most sample
instructions in 0ac4c2727 but the TXF_MCS instruction is emitted
separately and it was missed.

This fixes a bunch of Piglit tests which test texelFetch in a geometry
shader, for example:

 spec/arb_texture_multisample/texelfetch/2-gs-sampler2dms

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kenneth Graunke 

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 5a60fe4..59a73a9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2460,11 +2460,27 @@ vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg 
coordinate, src_reg sampler
   new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
 dst_reg(this, glsl_type::uvec4_type));
inst->base_mrf = 2;
-   inst->mlen = 1;
inst->src[1] = sampler;
 
+   int param_base;
+
+   if (devinfo->gen >= 9) {
+  /* Gen9+ needs a message header in order to use SIMD4x2 mode */
+  vec4_instruction *header_inst = new(mem_ctx)
+ vec4_instruction(VS_OPCODE_SET_SIMD4X2_HEADER_GEN9,
+  dst_reg(MRF, inst->base_mrf));
+
+  emit(header_inst);
+
+  inst->mlen = 2;
+  inst->header_size = 1;
+  param_base = inst->base_mrf + 1;
+   } else {
+  inst->mlen = 1;
+  param_base = inst->base_mrf;
+   }
+
/* parameters are: u, v, r, lod; lod will always be zero due to api 
restrictions */
-   int param_base = inst->base_mrf;
int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1;
int zero_mask = 0xf & ~coord_mask;
 

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