Define GLX_USE_APPLEGL, as config/darwin used to, to turn on specific code to use the applegl direct renderer Convert src/glx/apple/Makefile to automake Since the applegl libGL is now built by linking libappleglx into libGL, rather than by linking selected files into a special libGL: - Remove duplicate code in apple/glxreply.c and apple/apple_glx.c. This makes apple/glxreply.c empty, so remove it - Some indirect rendering code is already guarded by !GLX_USE_APPLEGL, but we need to add those guards to indirect_glx.c, indirect_init.c (via it's generator), render2.c and vertarr.c so they don't generate anything Fix and update various includes glapi_gentable.c (which is only used on darwin), should be included in shared glapi as well, to provide _glapi_create_table_from_handle() Note that neither swrast nor indirect is supported in the APPLEGL path at the moment, which makes things more complex than they need to be. More untangling is needed to allow that v2: Correct apple/Makefile.am for srcdir != builddir Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>tags/10.3-branchpoint
@@ -950,6 +950,10 @@ xyesno) | |||
if test x"$enable_dri3" = xyes; then | |||
dri_modules="$dri_modules xcb-dri3 xcb-present xcb-sync xshmfence >= $XSHMFENCE_REQUIRED" | |||
fi | |||
fi | |||
if test x"$dri_platform" = xapple ; then | |||
DEFINES="$DEFINES -DGLX_USE_APPLEGL" | |||
fi | |||
fi | |||
# add xf86vidmode if available | |||
@@ -2235,6 +2239,7 @@ AC_CONFIG_FILES([Makefile | |||
src/gbm/main/gbm.pc | |||
src/glsl/Makefile | |||
src/glx/Makefile | |||
src/glx/apple/Makefile | |||
src/glx/tests/Makefile | |||
src/gtest/Makefile | |||
src/loader/Makefile |
@@ -24,7 +24,7 @@ SHARED_GLAPI_CFLAGS = -DGLX_SHARED_GLAPI | |||
SHARED_GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la | |||
endif | |||
SUBDIRS=. tests | |||
SUBDIRS = | |||
if HAVE_XF86VIDMODE | |||
EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE | |||
@@ -86,6 +86,8 @@ libglx_la_SOURCES = \ | |||
glx_query.c \ | |||
glxhash.c | |||
libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la | |||
if HAVE_DRISW | |||
libglx_la_SOURCES += \ | |||
drisw_glx.c | |||
@@ -114,9 +116,10 @@ endif | |||
if HAVE_APPLEDRI | |||
libglx_la_SOURCES += \ | |||
applegl_glx.c | |||
endif | |||
libglx_la_LIBADD = $(top_builddir)/src/loader/libloader.la | |||
SUBDIRS += apple | |||
libglx_la_LIBADD += $(builddir)/apple/libappleglx.la | |||
endif | |||
GL_LIBS = \ | |||
libglx.la \ | |||
@@ -135,4 +138,6 @@ lib@GL_LIB@_la_SOURCES = | |||
lib@GL_LIB@_la_LIBADD = $(GL_LIBS) | |||
lib@GL_LIB@_la_LDFLAGS = $(GL_LDFLAGS) | |||
SUBDIRS += . tests | |||
include $(top_srcdir)/install-lib-links.mk |
@@ -1,131 +0,0 @@ | |||
TOP = ../../.. | |||
top_builddir = $(TOP) | |||
# This can be a filthy lie. But it doesn't currently build out-of-tree | |||
# anyway, so it's no worse than what we've got now. | |||
top_srcdir = $(TOP) | |||
include $(TOP)/configs/current | |||
#CC=gcc | |||
#GL_CFLAGS=-Wall -ggdb3 -Os -DHAVE_PTHREAD -D_REENTRANT $(RC_CFLAGS) $(CFLAGS) | |||
#GL_LDFLAGS=-L$(INSTALL_DIR)/lib -L$(X11_DIR)/lib $(LDFLAGS) -Wl,-single_module | |||
TCLSH=tclsh8.5 | |||
MKDIR=mkdir | |||
INSTALL=install | |||
LN=ln | |||
RM=rm | |||
#INCLUDE=-I. -Iinclude -I.. -DGLX_ALIAS_UNSUPPORTED -I$(INSTALL_DIR)/include -I$(X11_DIR)/include | |||
#COMPILE=$(CC) $(INCLUDE) $(GL_CFLAGS) -c | |||
#The directory with the final binaries. | |||
BUILD_DIR=builds | |||
default: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT) | |||
SOURCES = \ | |||
apple_cgl.c \ | |||
apple_glx.c \ | |||
apple_glx_context.c \ | |||
apple_glx_drawable.c \ | |||
apple_glx_log.c \ | |||
apple_glx_pbuffer.c \ | |||
apple_glx_pixmap.c \ | |||
apple_glx_surface.c \ | |||
apple_visual.c \ | |||
apple_glapi.c \ | |||
apple_xgl_api_read.c \ | |||
apple_xgl_api_stereo.c \ | |||
apple_xgl_api_viewport.c \ | |||
appledri.c \ | |||
../create_context.c \ | |||
../clientattrib.c \ | |||
../compsize.c \ | |||
../glxconfig.c \ | |||
glx_empty.c \ | |||
../glx_error.c \ | |||
../glx_pbuffer.c \ | |||
../glx_query.c \ | |||
../glxcmds.c \ | |||
../glxcurrent.c \ | |||
../glxext.c \ | |||
../glxextensions.c \ | |||
../glxhash.c \ | |||
glxreply.c \ | |||
../pixel.c \ | |||
../xfont.c \ | |||
../applegl_glx.c | |||
include $(TOP)/src/mesa/Makefile.sources | |||
# override GLAPI_LIB | |||
GLAPI_LIB = $(TOP)/src/mapi/glapi/libglapi.a | |||
LDFLAGS += -lXplugin -framework ApplicationServices -framework CoreFoundation | |||
OBJECTS = $(SOURCES:.c=.o) | |||
INCLUDES = -I. -Iinclude -I..\ | |||
-I$(TOP)/include \ | |||
-I$(TOP)/include/GL/internal \ | |||
-I$(TOP)/src/mesa \ | |||
-I$(TOP)/src/mesa/main \ | |||
-I$(TOP)/src/mapi \ | |||
-I$(TOP)/src/mapi/glapi \ | |||
$(LIBDRM_CFLAGS) \ | |||
$(DRI2PROTO_CFLAGS) \ | |||
$(X11_INCLUDES) | |||
##### RULES ##### | |||
.c.o: | |||
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ | |||
.S.o: | |||
$(CC) -c $(INCLUDES) $(CFLAGS) $(EXTRA_DEFINES) $< -o $@ | |||
##### TARGETS ##### | |||
default: depend $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT) | |||
# Make libGL | |||
$(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT): $(OBJECTS) $(GLAPI_LIB) Makefile | |||
$(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ | |||
-major 1 -minor 2 $(MKLIB_OPTIONS) \ | |||
-install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \ | |||
$(GL_LIB_DEPS) $(OBJECTS) $(GLAPI_LIB) | |||
$(GLAPI_LIB): | |||
@$(MAKE) -C $(TOP)/src/mapi/glapi | |||
depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile | |||
rm -f depend | |||
touch depend | |||
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \ | |||
$(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) | |||
# Emacs tags | |||
tags: | |||
etags `find . -name \*.[ch]` `find $(TOP)/include` | |||
install_headers: include/GL/gl.h | |||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL | |||
$(INSTALL) -m 644 include/GL/gl.h $(DESTDIR)$(INSTALL_DIR)/include/GL | |||
install_libraries: $(TOP)/$(LIB_DIR)/lib$(GL_LIB).$(LIB_EXT) | |||
$(MAKE) -C $(TOP)/src/mesa install-libgl | |||
install: install_libraries | |||
# Remove .o and backup files | |||
clean: | |||
-rm -f *.o *.a *~ | |||
-rm -f *.c~ *.h~ | |||
-rm -f *.dylib | |||
-rm -f include/GL/gl.h | |||
-rm -f *.o *~ | |||
-rm -f depend depend.bak | |||
-include depend |
@@ -0,0 +1,33 @@ | |||
noinst_LTLIBRARIES = libappleglx.la | |||
AM_CFLAGS = \ | |||
-I$(top_srcdir)/include \ | |||
-I$(top_srcdir)/src/glx \ | |||
-I$(top_srcdir)/src/mesa \ | |||
-I$(top_builddir)/src/mesa \ | |||
-I$(top_srcdir)/src/mapi \ | |||
-I$(top_srcdir)/src/mapi/glapi \ | |||
-I$(top_builddir)/src/mapi/glapi \ | |||
$(VISIBILITY_CFLAGS) \ | |||
$(SHARED_GLAPI_CFLAGS) \ | |||
$(DEFINES) \ | |||
$(X11_INCLUDES) | |||
libappleglx_la_SOURCES = \ | |||
apple_cgl.c \ | |||
apple_glapi.c \ | |||
apple_glx.c \ | |||
apple_glx_context.c \ | |||
apple_glx_drawable.c \ | |||
apple_glx_log.c \ | |||
apple_glx_pbuffer.c \ | |||
apple_glx_pixmap.c \ | |||
apple_glx_surface.c \ | |||
apple_visual.c \ | |||
apple_xgl_api_read.c \ | |||
apple_xgl_api_stereo.c \ | |||
apple_xgl_api_viewport.c \ | |||
appledri.c \ | |||
glx_empty.c | |||
libappleglx_la_LDFLAGS = -lXplugin -framework ApplicationServices -framework CoreFoundation |
@@ -38,6 +38,7 @@ | |||
#include <GL/gl.h> | |||
#include "main/glheader.h" | |||
#include "glapi.h" | |||
#include "glapitable.h" | |||
#include "main/dispatch.h" |
@@ -43,8 +43,6 @@ | |||
static bool initialized = false; | |||
static int dri_event_base = 0; | |||
const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }; | |||
int | |||
apple_get_dri_event_base(void) | |||
{ |
@@ -32,7 +32,6 @@ | |||
#include <stdbool.h> | |||
#include <GL/gl.h> | |||
#include <GL/glxint.h> | |||
#include <X11/Xlib.h> | |||
#define XP_NO_X_HEADERS |
@@ -37,6 +37,7 @@ | |||
#include "glxclient.h" | |||
#include "apple_glx_context.h" | |||
#include "apple_xgl_api.h" | |||
#include "main/glheader.h" | |||
#include "glapitable.h" | |||
extern struct _glapi_table * __ogl_framework_api; |
@@ -40,6 +40,7 @@ | |||
#include "glxclient.h" | |||
#include "apple_glx_context.h" | |||
#include "apple_xgl_api.h" | |||
#include "main/glheader.h" | |||
#include "glapitable.h" | |||
extern struct _glapi_table * __ogl_framework_api; | |||
@@ -75,7 +76,7 @@ __applegl_glDrawBuffer(GLenum mode) | |||
break; | |||
} | |||
__ogl_framework_api->DrawBuffersARB(n, buf); | |||
__ogl_framework_api->DrawBuffers(n, buf); | |||
} | |||
else { | |||
__ogl_framework_api->DrawBuffer(mode); | |||
@@ -116,9 +117,9 @@ __applegl_glDrawBuffers(GLsizei n, const GLenum * bufs) | |||
newbuf[outi++] = GL_FRONT_RIGHT; | |||
} | |||
__ogl_framework_api->DrawBuffersARB(outi, newbuf); | |||
__ogl_framework_api->DrawBuffers(outi, newbuf); | |||
} | |||
else { | |||
__ogl_framework_api->DrawBuffersARB(n, bufs); | |||
__ogl_framework_api->DrawBuffers(n, bufs); | |||
} | |||
} |
@@ -30,6 +30,7 @@ | |||
#include "glxclient.h" | |||
#include "apple_glx_context.h" | |||
#include "apple_xgl_api.h" | |||
#include "main/glheader.h" | |||
#include "glapitable.h" | |||
extern struct _glapi_table * __ogl_framework_api; |
@@ -1,134 +0,0 @@ | |||
/* | |||
* (C) Copyright Apple Inc. 2008 | |||
* (C) Copyright IBM Corporation 2004, 2005 | |||
* All Rights Reserved. | |||
* | |||
* Permission is hereby granted, free of charge, to any person obtaining a | |||
* copy of this software and associated documentation files (the "Software"), | |||
* to deal in the Software without restriction, including without limitation | |||
* the rights to use, copy, modify, merge, publish, distribute, sub license, | |||
* and/or sell copies of the Software, and to permit persons to whom the | |||
* Software is furnished to do so, subject to the following conditions: | |||
* | |||
* The above copyright notice and this permission notice (including the next | |||
* paragraph) shall be included in all copies or substantial portions of the | |||
* Software. | |||
* | |||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | |||
* IBM, | |||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF | |||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
* SOFTWARE. | |||
*/ | |||
#include <GL/gl.h> | |||
#include "glxclient.h" | |||
#include <GL/glxproto.h> | |||
CARD32 | |||
__glXReadReply(Display * dpy, size_t size, void *dest, | |||
GLboolean reply_is_always_array) | |||
{ | |||
xGLXSingleReply reply; | |||
(void) _XReply(dpy, (xReply *) & reply, 0, False); | |||
if (size != 0) { | |||
if ((reply.length > 0) || reply_is_always_array) { | |||
const GLint bytes = (reply_is_always_array) | |||
? (4 * reply.length) : (reply.size * size); | |||
const GLint extra = 4 - (bytes & 3); | |||
_XRead(dpy, dest, bytes); | |||
if (extra < 4) { | |||
_XEatData(dpy, extra); | |||
} | |||
} | |||
else { | |||
(void) memcpy(dest, &(reply.pad3), size); | |||
} | |||
} | |||
return reply.retval; | |||
} | |||
void | |||
__glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim, | |||
GLint width, GLint height, GLint depth, GLenum format, | |||
GLenum type, void *dest, GLboolean dimensions_in_reply) | |||
{ | |||
xGLXSingleReply reply; | |||
GLint size; | |||
(void) _XReply(dpy, (xReply *) & reply, 0, False); | |||
if (dimensions_in_reply) { | |||
width = reply.pad3; | |||
height = reply.pad4; | |||
depth = reply.pad5; | |||
if ((height == 0) || (max_dim < 2)) { | |||
height = 1; | |||
} | |||
if ((depth == 0) || (max_dim < 3)) { | |||
depth = 1; | |||
} | |||
} | |||
size = reply.length * 4; | |||
if (size != 0) { | |||
void *buf = malloc(size); | |||
if (buf == NULL) { | |||
_XEatData(dpy, size); | |||
__glXSetError(gc, GL_OUT_OF_MEMORY); | |||
} | |||
else { | |||
const GLint extra = 4 - (size & 3); | |||
_XRead(dpy, buf, size); | |||
if (extra < 4) { | |||
_XEatData(dpy, extra); | |||
} | |||
__glEmptyImage(gc, 3, width, height, depth, format, type, buf, dest); | |||
free(buf); | |||
} | |||
} | |||
} | |||
#if 0 | |||
GLubyte * | |||
__glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen) | |||
{ | |||
xGLXSingleReq *req; | |||
Display *const dpy = gc->currentDpy; | |||
(void) __glXFlushRenderBuffer(gc, gc->pc); | |||
LockDisplay(dpy); | |||
GetReqExtra(GLXSingle, cmdlen, req); | |||
req->reqType = gc->majorOpcode; | |||
req->contextTag = gc->currentContextTag; | |||
req->glxCode = sop; | |||
return (GLubyte *) (req) + sz_xGLXSingleReq; | |||
} | |||
#endif | |||
GLubyte * | |||
__glXSetupVendorRequest(struct glx_context * gc, GLint code, GLint vop, | |||
GLint cmdlen) | |||
{ | |||
xGLXVendorPrivateReq *req; | |||
Display *const dpy = gc->currentDpy; | |||
(void) __glXFlushRenderBuffer(gc, gc->pc); | |||
LockDisplay(dpy); | |||
GetReqExtra(GLXVendorPrivate, cmdlen, req); | |||
req->reqType = gc->majorOpcode; | |||
req->glxCode = code; | |||
req->vendorCode = vop; | |||
req->contextTag = gc->currentContextTag; | |||
return (GLubyte *) (req) + sz_xGLXVendorPrivateReq; | |||
} |
@@ -37,9 +37,9 @@ | |||
#include <dlfcn.h> | |||
#include "glxclient.h" | |||
#include "apple_glx_context.h" | |||
#include "apple_glx.h" | |||
#include "apple_cgl.h" | |||
#include "apple/apple_glx_context.h" | |||
#include "apple/apple_glx.h" | |||
#include "apple/apple_cgl.h" | |||
#include "glx_error.h" | |||
static void |
@@ -39,7 +39,7 @@ | |||
#ifdef GLX_USE_APPLEGL | |||
#include <pthread.h> | |||
#include "apple_glx_drawable.h" | |||
#include "apple/apple_glx_drawable.h" | |||
#endif | |||
#include "glx_error.h" |
@@ -41,8 +41,8 @@ | |||
#ifdef GLX_DIRECT_RENDERING | |||
#ifdef GLX_USE_APPLEGL | |||
#include "apple_glx_context.h" | |||
#include "apple_glx.h" | |||
#include "apple/apple_glx_context.h" | |||
#include "apple/apple_glx.h" | |||
#else | |||
#include <sys/time.h> | |||
#ifdef XF86VIDMODE |
@@ -38,12 +38,6 @@ | |||
#endif | |||
#include "glxclient.h" | |||
#ifdef GLX_USE_APPLEGL | |||
#include <stdlib.h> | |||
#include "apple_glx.h" | |||
#include "apple_glx_context.h" | |||
#endif | |||
#include "glapi.h" | |||
@@ -42,8 +42,8 @@ | |||
#include <X11/extensions/Xext.h> | |||
#include <X11/extensions/extutil.h> | |||
#ifdef GLX_USE_APPLEGL | |||
#include "apple_glx.h" | |||
#include "apple_visual.h" | |||
#include "apple/apple_glx.h" | |||
#include "apple/apple_visual.h" | |||
#endif | |||
#include "glxextensions.h" | |||
@@ -33,6 +33,8 @@ | |||
#include "glapi.h" | |||
#include "glxclient.h" | |||
#ifndef GLX_USE_APPLEGL | |||
extern struct _glapi_table *__glXNewIndirectAPI(void); | |||
/* | |||
@@ -488,3 +490,5 @@ indirect_create_screen(int screen, struct glx_display * priv) | |||
return psc; | |||
} | |||
#endif |
@@ -28,6 +28,8 @@ | |||
* Silicon Graphics, Inc. | |||
*/ | |||
#ifndef GLX_USE_APPLEGL | |||
#include "packrender.h" | |||
#include "indirect.h" | |||
#include "indirect_size.h" | |||
@@ -379,3 +381,5 @@ __indirect_glDisable(GLenum cap) | |||
__GLX_PUT_LONG(4, cap); | |||
__GLX_END(8); | |||
} | |||
#endif |
@@ -32,6 +32,7 @@ | |||
#include "indirect.h" | |||
#include "indirect_vertex_array.h" | |||
#ifndef GLX_USE_APPLEGL | |||
/*****************************************************************************/ | |||
@@ -210,3 +211,5 @@ __indirect_glInterleavedArrays(GLenum format, GLsizei stride, | |||
trueStride, | |||
(const char *) pointer + offsets[3]); | |||
} | |||
#endif |
@@ -48,13 +48,13 @@ if HAVE_SHARED_GLAPI | |||
AM_CPPFLAGS += \ | |||
-DMAPI_MODE_BRIDGE \ | |||
-DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\" | |||
glapi_GLAPI_sources = | |||
glapi_GLAPI_sources = $(GLAPI_UTIL_SOURCES) | |||
glapi_ASM_sources = | |||
glapi_MAPI_sources = $(MAPI_BRIDGE_FILES) | |||
else | |||
AM_CPPFLAGS += \ | |||
-DMAPI_MODE_UTIL | |||
glapi_GLAPI_sources = $(GLAPI_SOURCES) | |||
glapi_GLAPI_sources = $(GLAPI_SOURCES) $(GLAPI_UTIL_SOURCES) | |||
glapi_ASM_sources = $(GLAPI_ASM_SOURCES) | |||
glapi_MAPI_sources = $(MAPI_UTIL_FILES) | |||
endif |
@@ -1,9 +1,11 @@ | |||
# src/mapi/glapi/Makefile.sources | |||
GLAPI_UTIL_SOURCES = \ | |||
glapi_gentable.c | |||
GLAPI_SOURCES = \ | |||
glapi_dispatch.c \ | |||
glapi_entrypoint.c \ | |||
glapi_gentable.c \ | |||
glapi_getproc.c \ | |||
glapi_nop.c \ | |||
glapi.c \ |
@@ -947,6 +947,7 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base): | |||
#include "glapi.h" | |||
#include <assert.h> | |||
#ifndef GLX_USE_APPLEGL | |||
/** | |||
* No-op function used to initialize functions that have no GLX protocol | |||
@@ -984,6 +985,8 @@ struct _glapi_table * __glXNewIndirectAPI( void ) | |||
print """ | |||
return (struct _glapi_table *) table; | |||
} | |||
#endif | |||
""" | |||
return | |||