print header
print '#include <X11/Xlib-xcb.h>'
print
+ print '#ifdef HAVE_PTHREAD'
+ print
print 'static _X_INLINE int safe_mul(int a, int b)'
print '{'
print ' if (a < 0 || b < 0) return -1;'
print
def printRealFooter(self):
- pass
+ print
+ print '#endif'
def print_sync_call(self, func):
call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format(
#ifndef _GLTHREAD_H
#define _GLTHREAD_H
+#include "main/mtypes.h"
+
+/* Command size is a number of bytes stored in a short. */
+#define MARSHAL_MAX_CMD_SIZE 65535
+
#ifdef HAVE_PTHREAD
#include <inttypes.h>
#include <stdbool.h>
#include <pthread.h>
-#include "main/mtypes.h"
enum marshal_dispatch_cmd_id;
-/* Command size is a number of bytes stored in a short. */
-#define MARSHAL_MAX_CMD_SIZE 65535
-
struct glthread_state
{
/** The worker thread that asynchronously processes our GL commands. */
{
}
+static inline void
+_mesa_glthread_flush_batch(struct gl_context *ctx)
+{
+}
+
#endif /* !HAVE_PTHREAD */
#endif /* _GLTHREAD_H*/
uint16_t cmd_size;
};
+#ifdef HAVE_PTHREAD
static inline void *
_mesa_glthread_allocate_command(struct gl_context *ctx,
return cmd_base;
}
+/**
+ * Instead of conditionally handling marshaling previously-bound user vertex
+ * array data in draw calls (deprecated and removed in GL core), we just
+ * disable threading at the point where the user sets a user vertex array.
+ */
+static inline bool
+_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
+{
+ struct glthread_state *glthread = ctx->GLThread;
+
+ return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo;
+}
+
+/**
+ * Instead of conditionally handling marshaling immediate index data in draw
+ * calls (deprecated and removed in GL core), we just disable threading.
+ */
+static inline bool
+_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
+{
+ struct glthread_state *glthread = ctx->GLThread;
+
+ return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo;
+}
+
+#else
+
+/* FIXME: dummy functions for non PTHREAD platforms */
+static inline void *
+_mesa_glthread_allocate_command(struct gl_context *ctx,
+ uint16_t cmd_id,
+ size_t size)
+{
+ return NULL;
+}
+
+static inline bool
+_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
+{
+ return false;
+}
+
+static inline bool
+_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
+{
+ return false;
+}
+
+#endif
+
#define DEBUG_MARSHAL_PRINT_CALLS 0
static inline void
return ctx->API != API_OPENGL_CORE;
}
-/**
- * Instead of conditionally handling marshaling previously-bound user vertex
- * array data in draw calls (deprecated and removed in GL core), we just
- * disable threading at the point where the user sets a user vertex array.
- */
-static inline bool
-_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
-{
- struct glthread_state *glthread = ctx->GLThread;
-
- return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo;
-}
-
-/**
- * Instead of conditionally handling marshaling immediate index data in draw
- * calls (deprecated and removed in GL core), we just disable threading.
- */
-static inline bool
-_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
-{
- struct glthread_state *glthread = ctx->GLThread;
-
- return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo;
-}
-
struct marshal_cmd_ShaderSource;
struct marshal_cmd_Flush;
struct marshal_cmd_BindBuffer;