aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
commit82c8df11062f72a7d467e26cedbbd8b322ff7a70 (patch)
tree7e7a3e408d09d3e50ff0d2f9befeb5b7ab5617a5 /mesalib/src/mapi
parent8574eba804031f6b19713f0b02952280730bf62e (diff)
downloadvcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.gz
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.bz2
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.zip
randrproto fontconfig libX11 libXdmcp libxcb mesa xkbcomp xserver git update 22 Mar 2015
xserver commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56 libxcb commit a90be9955d2c5a635f791d44db1154633b9d3322 libX11 commit 5a499ca7b064bf7e6a4fcc169f22862dce0c60c5 libXdmcp commit 0c09444d276fbf46a0e8b427a4f6a325d0625742 xkbcomp commit fc3e6ddb2c8e922ea80f2dc5cbc1df2102e30d99 randrproto commit b1ba68df8a5fc113a387123ec2f312195e28e47f fontconfig commit 69ff6b6e260584e383c38b1b7034ddcbb23d214f mesa commit 397b491173f0d2df4deb44d21c170bf16840d507
Diffstat (limited to 'mesalib/src/mapi')
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml112
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_enums.py6
-rw-r--r--mesalib/src/mapi/glapi/glapi.h11
-rw-r--r--mesalib/src/mapi/glapi/glapi_getproc.c4
-rw-r--r--mesalib/src/mapi/glapi/glapi_nop.c85
-rw-r--r--mesalib/src/mapi/glapi/glapi_priv.h3
-rw-r--r--mesalib/src/mapi/mapi_glapi.c23
-rw-r--r--mesalib/src/mapi/table.c23
-rw-r--r--mesalib/src/mapi/table.h8
9 files changed, 231 insertions, 44 deletions
diff --git a/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml b/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 2fe1638fd..641e68f71 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -7,6 +7,110 @@
<enum name="QUERY_TARGET" value="0x82EA"/>
<enum name="TEXTURE_BINDING" value="0x82EB"/>
+ <!-- Buffer object functions -->
+
+ <function name="CreateBuffers" offset="assign">
+ <param name="n" type="GLsizei" />
+ <param name="buffers" type="GLuint *" />
+ </function>
+
+ <function name="NamedBufferStorage" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="data" type="const GLvoid *" />
+ <param name="flags" type="GLbitfield" />
+ </function>
+
+ <function name="NamedBufferData" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="data" type="const GLvoid *" />
+ <param name="usage" type="GLenum" />
+ </function>
+
+ <function name="NamedBufferSubData" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="CopyNamedBufferSubData" offset="assign">
+ <param name="readBuffer" type="GLuint" />
+ <param name="writeBuffer" type="GLuint" />
+ <param name="readOffset" type="GLintptr" />
+ <param name="writeOffset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ </function>
+
+ <function name="ClearNamedBufferData" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="internalformat" type="GLenum" />
+ <param name="format" type="GLenum" />
+ <param name="type" type="GLenum" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="ClearNamedBufferSubData" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="internalformat" type="GLenum" />
+ <param name="offset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="format" type="GLenum" />
+ <param name="type" type="GLenum" />
+ <param name="data" type="const GLvoid *" />
+ </function>
+
+ <function name="MapNamedBuffer" offset="assign">
+ <return type="GLvoid *" />
+ <param name="buffer" type="GLuint" />
+ <param name="access" type="GLenum" />
+ </function>
+
+ <function name="MapNamedBufferRange" offset="assign">
+ <return type="GLvoid *" />
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="length" type="GLsizeiptr" />
+ <param name="access" type="GLbitfield" />
+ </function>
+
+ <function name="UnmapNamedBuffer" offset="assign">
+ <return type="GLboolean" />
+ <param name="buffer" type="GLuint" />
+ </function>
+
+ <function name="FlushMappedNamedBufferRange" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="length" type="GLsizeiptr" />
+ </function>
+
+ <function name="GetNamedBufferParameteriv" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="params" type="GLint *" />
+ </function>
+
+ <function name="GetNamedBufferParameteri64v" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="params" type="GLint64 *" />
+ </function>
+
+ <function name="GetNamedBufferPointerv" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="pname" type="GLenum" />
+ <param name="params" type="GLvoid **" />
+ </function>
+
+ <function name="GetNamedBufferSubData" offset="assign">
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ <param name="data" type="GLvoid *" />
+ </function>
+
<!-- Texture object functions -->
<function name="CreateTextures" offset="assign">
@@ -21,6 +125,14 @@
<param name="buffer" type="GLuint" />
</function>
+ <function name="TextureBufferRange" offset="assign">
+ <param name="texture" type="GLuint" />
+ <param name="internalformat" type="GLenum" />
+ <param name="buffer" type="GLuint" />
+ <param name="offset" type="GLintptr" />
+ <param name="size" type="GLsizeiptr" />
+ </function>
+
<function name="TextureStorage1D" offset="assign">
<param name="texture" type="GLuint" />
<param name="levels" type="GLsizei" />
diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py
index d61618f4d..f45782df8 100644
--- a/mesalib/src/mapi/glapi/gen/gl_enums.py
+++ b/mesalib/src/mapi/glapi/gen/gl_enums.py
@@ -157,6 +157,12 @@ _mesa_lookup_prim_by_nr(GLuint nr)
string_offsets = {}
i = 0;
+ print '#if defined(__GNUC__)'
+ print '# define LONGSTRING __extension__'
+ print '#else'
+ print '# define LONGSTRING'
+ print '#endif'
+ print ''
print 'LONGSTRING static const char enum_string_table[] = '
for enum, name in enum_table:
print ' "%s\\0"' % (name)
diff --git a/mesalib/src/mapi/glapi/glapi.h b/mesalib/src/mapi/glapi/glapi.h
index 8d991fb3b..673295bca 100644
--- a/mesalib/src/mapi/glapi/glapi.h
+++ b/mesalib/src/mapi/glapi/glapi.h
@@ -80,6 +80,9 @@ extern "C" {
#endif
typedef void (*_glapi_proc)(void);
+
+typedef void (*_glapi_nop_handler_proc)(const char *name);
+
struct _glapi_table;
@@ -159,6 +162,14 @@ _GLAPI_EXPORT struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
+_GLAPI_EXPORT void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func);
+
+/** Return pointer to new dispatch table filled with no-op functions */
+_GLAPI_EXPORT struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries);
+
+
/** Deprecated function */
_GLAPI_EXPORT unsigned long
_glthread_GetID(void);
diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c
index bfde92cf2..524a771ca 100644
--- a/mesalib/src/mapi/glapi/glapi_getproc.c
+++ b/mesalib/src/mapi/glapi/glapi_getproc.c
@@ -30,6 +30,9 @@
*/
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
#include "glapi/glapi_priv.h"
#include "glapi/glapitable.h"
@@ -37,6 +40,7 @@
#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
+
/**********************************************************************
* Static function management.
*/
diff --git a/mesalib/src/mapi/glapi/glapi_nop.c b/mesalib/src/mapi/glapi/glapi_nop.c
index 628276e93..13db310b3 100644
--- a/mesalib/src/mapi/glapi/glapi_nop.c
+++ b/mesalib/src/mapi/glapi/glapi_nop.c
@@ -30,14 +30,22 @@
* This file defines a special dispatch table which is loaded with no-op
* functions.
*
- * When there's no current rendering context, calling a GL function like
- * glBegin() is a no-op. Apps should never normally do this. So as a
- * debugging aid, each of the no-op functions will emit a warning to
- * stderr if the MESA_DEBUG or LIBGL_DEBUG env var is set.
+ * Mesa can register a "no-op handler function" which will be called in
+ * the event that a no-op function is called.
+ *
+ * In the past, the dispatch table was loaded with pointers to a single
+ * no-op function. But that broke on Windows because the GL entrypoints
+ * use __stdcall convention. __stdcall means the callee cleans up the
+ * stack. So one no-op function can't properly clean up the stack. This
+ * would lead to crashes.
+ *
+ * Another benefit of unique no-op functions is we can accurately report
+ * the function's name in an error message.
*/
-
+#include <stdlib.h>
+#include <string.h>
#include "glapi/glapi_priv.h"
@@ -51,25 +59,32 @@ _glapi_set_warning_func(_glapi_proc func)
{
}
-/*
- * When GLAPIENTRY is __stdcall (i.e. Windows), the stack is popped by the
- * callee making the number/type of arguments significant.
+
+/**
+ * We'll jump though this function pointer whenever a no-op function
+ * is called.
*/
-#if defined(_WIN32) || defined(DEBUG)
+static _glapi_nop_handler_proc nop_handler = NULL;
+
+
+/**
+ * Register the no-op handler call-back function.
+ */
+void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func)
+{
+ nop_handler = func;
+}
+
/**
* Called by each of the no-op GL entrypoints.
*/
-static int
-Warn(const char *func)
+static void
+nop(const char *func)
{
-#if defined(DEBUG)
- if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
- fprintf(stderr, "GL User Error: gl%s called without a rendering context\n",
- func);
- }
-#endif
- return 0;
+ if (nop_handler)
+ nop_handler(func);
}
@@ -79,7 +94,8 @@ Warn(const char *func)
static GLint
NoOpUnused(void)
{
- return Warn(" function");
+ nop("unused GL entry point");
+ return 0;
}
/*
@@ -89,31 +105,28 @@ NoOpUnused(void)
#define KEYWORD1_ALT static
#define KEYWORD2 GLAPIENTRY
#define NAME(func) NoOp##func
-#define DISPATCH(func, args, msg) Warn(#func);
-#define RETURN_DISPATCH(func, args, msg) Warn(#func); return 0
+#define DISPATCH(func, args, msg) nop(#func);
+#define RETURN_DISPATCH(func, args, msg) nop(#func); return 0
/*
* Defines for the table of no-op entry points.
*/
#define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
+#define DISPATCH_TABLE_NAME __glapi_noop_table
+#define UNUSED_TABLE_NAME __unused_noop_functions
+
+#include "glapi/glapitemp.h"
-#else
-static int
-NoOpGeneric(void)
+/** Return pointer to new dispatch table filled with no-op functions */
+struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries)
{
- if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
- fprintf(stderr, "GL User Error: calling GL function without a rendering context\n");
+ struct _glapi_table *table = malloc(num_entries * sizeof(_glapi_proc));
+ if (table) {
+ memcpy(table, __glapi_noop_table,
+ num_entries * sizeof(_glapi_proc));
}
- return 0;
+ return table;
}
-
-#define TABLE_ENTRY(name) (_glapi_proc) NoOpGeneric
-
-#endif
-
-#define DISPATCH_TABLE_NAME __glapi_noop_table
-#define UNUSED_TABLE_NAME __unused_noop_functions
-
-#include "glapi/glapitemp.h"
diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h
index d3682603d..50f710edc 100644
--- a/mesalib/src/mapi/glapi/glapi_priv.h
+++ b/mesalib/src/mapi/glapi/glapi_priv.h
@@ -26,9 +26,6 @@
#ifndef _GLAPI_PRIV_H
#define _GLAPI_PRIV_H
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
diff --git a/mesalib/src/mapi/mapi_glapi.c b/mesalib/src/mapi/mapi_glapi.c
index 127dfafac..70605f3df 100644
--- a/mesalib/src/mapi/mapi_glapi.c
+++ b/mesalib/src/mapi/mapi_glapi.c
@@ -27,6 +27,7 @@
*/
#include <string.h>
+#include <stdlib.h>
#include "glapi/glapi.h"
#include "u_current.h"
#include "table.h" /* for MAPI_TABLE_NUM_SLOTS */
@@ -222,6 +223,28 @@ _glapi_get_proc_name(unsigned int offset)
return stub ? stub_get_name(stub) : NULL;
}
+/** Return pointer to new dispatch table filled with no-op functions */
+struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries)
+{
+ struct _glapi_table *table;
+
+ if (num_entries > MAPI_TABLE_NUM_SLOTS)
+ num_entries = MAPI_TABLE_NUM_SLOTS;
+
+ table = malloc(num_entries * sizeof(mapi_func));
+ if (table) {
+ memcpy(table, table_noop_array, num_entries * sizeof(mapi_func));
+ }
+ return table;
+}
+
+void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func)
+{
+ table_set_noop_handler(func);
+}
+
/**
* This is a deprecated function which should not be used anymore.
* It's only present to satisfy linking with older versions of libGL.
diff --git a/mesalib/src/mapi/table.c b/mesalib/src/mapi/table.c
index 0d2866618..748750197 100644
--- a/mesalib/src/mapi/table.c
+++ b/mesalib/src/mapi/table.c
@@ -30,16 +30,29 @@
#include "table.h"
+static nop_handler_proc nop_handler = NULL;
+
+void
+table_set_noop_handler(nop_handler_proc func)
+{
+ nop_handler = func;
+}
+
static void
noop_warn(const char *name)
{
- static int debug = -1;
+ if (nop_handler) {
+ nop_handler(name);
+ }
+ else {
+ static int debug = -1;
- if (debug < 0)
- debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"));
+ if (debug < 0)
+ debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"));
- if (debug)
- fprintf(stderr, "%s is no-op\n", name);
+ if (debug)
+ fprintf(stderr, "%s is no-op\n", name);
+ }
}
static int
diff --git a/mesalib/src/mapi/table.h b/mesalib/src/mapi/table.h
index e2d6ef03d..a1af40c6f 100644
--- a/mesalib/src/mapi/table.h
+++ b/mesalib/src/mapi/table.h
@@ -41,6 +41,14 @@ struct mapi_table;
extern const mapi_func table_noop_array[];
+
+typedef void (*nop_handler_proc)(const char *name);
+
+
+void
+table_set_noop_handler(nop_handler_proc func);
+
+
/**
* Get the no-op dispatch table.
*/