aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 14:10:47 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 14:10:47 +0100
commit3bc24b271f45f9f33484b8cf53b44f33f7e8a237 (patch)
tree193651a94adb3804e800747e993d07b92688e4d4 /mesalib/src/mapi
parentc646056120fe14e4c4ccf81bac5d78d61225a8e8 (diff)
parent82c8df11062f72a7d467e26cedbbd8b322ff7a70 (diff)
downloadvcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.gz
vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.bz2
vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mapi/glapi/glapi_nop.c mesalib/src/mesa/main/bufferobj.c
Diffstat (limited to 'mesalib/src/mapi')
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_direct_state_access.xml112
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_enums.py6
-rwxr-xr-xmesalib/src/mapi/glapi/glapi.h10
-rw-r--r--mesalib/src/mapi/glapi/glapi_getproc.c4
-rwxr-xr-x[-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, 230 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 a756ad971..7c55ee443 100755
--- 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 89fb1dceb..8084e5757 100755
--- a/mesalib/src/mapi/glapi/glapi.h
+++ b/mesalib/src/mapi/glapi/glapi.h
@@ -76,6 +76,8 @@ struct _glapi_table;
typedef void (*_glapi_proc)(void); /* generic function pointer */
+typedef void (*_glapi_nop_handler_proc)(const char *name);
+
typedef void (*_glapi_warning_func)(void *ctx, const char *str, ...);
@@ -179,6 +181,14 @@ extern struct _glapi_table *
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
+void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func);
+
+/** Return pointer to new dispatch table filled with no-op functions */
+struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries);
+
+
#ifdef __cplusplus
}
diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c
index d52b26450..7f4dc7f4d 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 cbfbd2433..e006e0259 100644..100755
--- 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"
#undef _GLAPI_EXPORT
@@ -53,25 +61,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.
+ */
+static _glapi_nop_handler_proc nop_handler = NULL;
+
+
+/**
+ * Register the no-op handler call-back function.
*/
-#if defined(_WIN32) || defined(DEBUG)
+_GLAPI_EXPORT 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);
}
@@ -81,7 +96,8 @@ Warn(const char *func)
static GLint
NoOpUnused(void)
{
- return Warn(" function");
+ nop("unused GL entry point");
+ return 0;
}
/*
@@ -91,31 +107,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/gen/glapitemp.h"
-#else
-static int
-NoOpGeneric(void)
+/** Return pointer to new dispatch table filled with no-op functions */
+struct _glapi_table * _GLAPI_EXPORT
+_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/gen/glapitemp.h"
diff --git a/mesalib/src/mapi/glapi/glapi_priv.h b/mesalib/src/mapi/glapi/glapi_priv.h
index 0a998b475..cb4cb5b97 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.
*/