summaryrefslogtreecommitdiff
path: root/libGL
diff options
context:
space:
mode:
Diffstat (limited to 'libGL')
-rwxr-xr-xlibGL/Makefile4
-rwxr-xr-xlibGL/client_gl.c36
-rwxr-xr-xlibGL/client_glx.c72
-rwxr-xr-xlibGL/common.h2
-rwxr-xr-xlibGL/gl_func_perso.h3
-rwxr-xr-xlibGL/opengl_client.c15
-rwxr-xr-xlibGL/opengl_func.h9
-rwxr-xr-xlibGL/parse_gl_h.c5
8 files changed, 118 insertions, 28 deletions
diff --git a/libGL/Makefile b/libGL/Makefile
index b268820..3f5c0d0 100755
--- a/libGL/Makefile
+++ b/libGL/Makefile
@@ -1,6 +1,6 @@
BUILD_CC := gcc
CC = gcc
-GL_CFLAGS := -Wall -g -fno-strict-aliasing
+GL_CFLAGS := -Wall -g -fno-strict-aliasing -O3
all: libGL.so.1.2
@@ -34,7 +34,7 @@ parse_mesa_get_c: parse_mesa_get_c.c mesa_gl.h mesa_glext.h
$(BUILD_CC) -g -o $@ parse_mesa_get_c.c
install: libGL.so.1.2
- cp libGL.so.1.2 ../lib
+ cp libGL.so.1.2 ../lib/host-gl/
clean:
rm -f client_stub.c server_stub.c gl_func.h glgetv_cst.h parse_gl_h parse_mesa_get_c *.o gl_func_tabs.h
diff --git a/libGL/client_gl.c b/libGL/client_gl.c
index e73431b..8ba006e 100755
--- a/libGL/client_gl.c
+++ b/libGL/client_gl.c
@@ -2634,6 +2634,14 @@ GLAPI void APIENTRY EXT_FUNC(glTexSubImage3DEXT)( GLenum target,
CHECK_PROC(glTexSubImage3DEXT);
glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
}
+
+GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLint image)
+{
+ CHECK_PROC(glEGLImageTargetTexture2DOES);
+ long args[] = { INT_TO_ARG(target), INT_TO_ARG(image) };
+ do_opengl_call(glEGLImageTargetTexture2DOES_fake_func, NULL, args, NULL);
+}
+
GLAPI void APIENTRY glSelectBuffer( GLsizei size, GLuint *buffer )
{
if (size <= 0) return;
@@ -5805,6 +5813,34 @@ GLAPI GLint EXT_FUNC(glGetUniformLocation) (GLuint program, const GLcharARB *txt
return ret;
}
+/* TODO:re-design the uniformLocations data structure, so that can invalide it
+ * per program
+ */
+GLAPI void APIENTRY EXT_FUNC(glLinkProgram) (GLuint program)
+{
+ /* Invalid cashed uniformlocation */
+ GET_CURRENT_STATE();
+ state->countUniformLocations = 0;
+ free(state->uniformLocations);
+ state->uniformLocations = NULL;
+
+ CHECK_PROC(glLinkProgram);
+ long args[] = { UNSIGNED_INT_TO_ARG(program)};
+ do_opengl_call(glLinkProgram_func, NULL, args, NULL);
+}
+
+GLAPI void APIENTRY EXT_FUNC(glLinkProgramARB) (GLhandleARB program)
+{
+ /* Invalid cashed uniformlocation */
+ GET_CURRENT_STATE();
+ state->countUniformLocations = 0;
+ free(state->uniformLocations);
+ state->uniformLocations = NULL;
+
+ CHECK_PROC(glLinkProgramARB);
+ long args[] = { UNSIGNED_INT_TO_ARG(program)};
+ do_opengl_call(glLinkProgramARB_func, NULL, args, NULL);
+}
GLAPI void APIENTRY EXT_FUNC(glGetActiveUniformARB)(GLuint program,
GLuint index,
diff --git a/libGL/client_glx.c b/libGL/client_glx.c
index 7a46193..12d006f 100755
--- a/libGL/client_glx.c
+++ b/libGL/client_glx.c
@@ -503,10 +503,24 @@ Bool glXQueryVersion( Display *dpy, int *maj, int *min )
*/
static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info)
{
+ xcb_generic_error_t *error;
xcb_connection_t *xcb_conn = XGetXCBConnection(dpy);
xcb_get_window_attributes_reply_t *attr = xcb_get_window_attributes_reply(
xcb_conn,
- xcb_get_window_attributes(xcb_conn, win), 0);
+ xcb_get_window_attributes(xcb_conn, win), &error);
+
+#ifndef XCB_EVENT_ERROR_BAD_MATCH
+#define XCB_EVENT_ERROR_BAD_MATCH 8
+#endif
+ /* BAD_MATCH indicate the drawable is PIXMAP instead of window */
+ if ( !attr && error->error_code != XCB_EVENT_ERROR_BAD_MATCH )
+ {
+ info->width = 0;
+ info->height= 0;
+ info->map_state = IsUnviewable;
+ return;
+ }
+
if (attr) {
if (attr->map_state == XCB_MAP_STATE_VIEWABLE) {
info->map_state = IsViewable;
@@ -515,24 +529,21 @@ static void _get_window_info(Display *dpy, Window win, WindowInfoStruct* info)
} else {
info->map_state = IsUnmapped;
}
- xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply(
- xcb_conn,
- xcb_get_geometry(xcb_conn, win), 0);
- free (attr);
-
- if (geom) {
- info->width = geom->width;
- info->height = geom->height;
- free (geom);
- } else {
- info->width = 0;
- info->height= 0;
- }
- } else {
- // TODO: need error handling. Right now just simply set default value.
+ free (attr);
+ } else /* Keep rendering PIXMAP as it can be copied to any window */
+ info->map_state = IsViewable;
+
+ xcb_get_geometry_reply_t *geom = xcb_get_geometry_reply(
+ xcb_conn,
+ xcb_get_geometry(xcb_conn, win), 0);
+
+ if (geom) {
+ info->width = geom->width;
+ info->height = geom->height;
+ free (geom);
+ } else {
info->width = 0;
info->height= 0;
- info->map_state = IsUnviewable;
}
}
@@ -1288,18 +1299,34 @@ GLAPI void APIENTRY glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap )
log_gl("glXDestroyGLXPixmap : sorry, unsupported call and I don't really see how I could implement it...");
}
-GLAPI GLXPixmap APIENTRY glXCreatePixmap( Display *dpy, GLXFBConfig config,
+GLAPI GLXPixmap APIENTRY glXCreatePixmap( Display *dpy, GLXFBConfig fbconfig,
Pixmap pixmap, const int *attribList )
{
- CHECK_PROC_WITH_RET(glXCreatePixmap);
- /* FIXME */
- log_gl("glXCreatePixmap : sorry, unsupported call and I don't really see how I could implement it...");
- return 0;
+ CHECK_PROC_WITH_RET(glXCreatePixmap);
+
+ LOCK(glXCreatePixmap_func);
+ if (debug_gl) log_gl("glXCreatePixmap %p\n", (void*)fbconfig);
+
+ int emptyAttribList = None;
+ if (attribList == NULL) attribList = &emptyAttribList;
+ GLXPixmap glxpixmap;
+ long args[] = { POINTER_TO_ARG(dpy), INT_TO_ARG(fbconfig), INT_TO_ARG(pixmap),
+ POINTER_TO_ARG(attribList) };
+ int args_size[] = { 0, 0, 0, sizeof(int) * _compute_length_of_attrib_list_including_zero(attribList, 1) };
+ do_opengl_call_no_lock(glXCreatePixmap_func, &glxpixmap, args, args_size);
+ if (glxpixmap)
+ {
+ /*XXX:maintain the info?*/
+ }
+ UNLOCK(glXCreatePixmap_func);
+
+ return glxpixmap;
}
GLAPI void APIENTRY glXDestroyPixmap( Display *dpy, GLXPixmap pixmap )
{
CHECK_PROC(glXDestroyPixmap);
+ /* XXX:do nothing. Not sure about this implementation */
/* FIXME */
log_gl("glXDestroyPixmap : sorry, unsupported call and I don't really see how I could implement it...");
}
@@ -2690,6 +2717,7 @@ static const char* global_glXGetProcAddress_request =
"glTextureMaterialEXT\0"
"glTextureNormalEXT\0"
"glTextureRangeAPPLE\0"
+//"glEGLImageTargetTexture2DOES\n"
"glTrackMatrixNV\0"
"glTransformFeedbackAttribsNV\0"
"glTransformFeedbackVaryingsNV\0"
diff --git a/libGL/common.h b/libGL/common.h
index 36e09ca..a28aa49 100755
--- a/libGL/common.h
+++ b/libGL/common.h
@@ -41,7 +41,7 @@ extern int debug_gl;
extern int debug_array_ptr;
extern int disable_optim;
-#define IS_GLX_CALL(x) (x >= glXChooseVisual_func && x <= glXSwapIntervalSGI_func)
+#define IS_GLX_CALL(x) (x >= glXChooseVisual_func && x <= glXDestroyPixmap_func)
#define SIZE_BUFFER_COMMAND (1024*64)
//#define MAX_SIZE_BUFFER_COMMAND (1024*1024*10)
diff --git a/libGL/gl_func_perso.h b/libGL/gl_func_perso.h
index 3d45b51..7ae6e7d 100755
--- a/libGL/gl_func_perso.h
+++ b/libGL/gl_func_perso.h
@@ -58,6 +58,8 @@ MAGIC_MACRO(glXQueryExtension),
MAGIC_MACRO(glXGetScreenDriver),
MAGIC_MACRO(glXGetDriverConfig),
MAGIC_MACRO(glXSwapIntervalSGI),
+MAGIC_MACRO(glXCreatePixmap),
+MAGIC_MACRO(glXDestroyPixmap),
MAGIC_MACRO(glGetString),
@@ -94,6 +96,7 @@ MAGIC_MACRO(glVertexNormalColorTexCoord012PointerInterlaced_fake),
MAGIC_MACRO(glGenTextures_fake),
MAGIC_MACRO(glGenBuffersARB_fake),
MAGIC_MACRO(glGenLists_fake),
+MAGIC_MACRO(glEGLImageTargetTexture2DOES_fake),
MAGIC_MACRO(_glDrawElements_buffer),
MAGIC_MACRO(_glDrawRangeElements_buffer),
MAGIC_MACRO(_glMultiDrawElements_buffer),
diff --git a/libGL/opengl_client.c b/libGL/opengl_client.c
index e1b5a3c..3574faa 100755
--- a/libGL/opengl_client.c
+++ b/libGL/opengl_client.c
@@ -191,7 +191,7 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg
Signature *signature;
static char *command_buffer;
char *ret_buf = NULL;
- int again, req_args_buffer, req_ret_buffer, req_total_buffer;
+ int again, req_args_buffer, req_ret_buffer, req_total_buffer, check_buf_full;
int current_thread;
int ret_int = 0;
static int init, nr_serial, cur_ret_buf;
@@ -266,6 +266,7 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg
* buffer. call_opengl() will detect this and split the call up for us.
*/
+ check_buf_full = 0;
again = 0;
do {
if(!command_buffer)
@@ -317,7 +318,9 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg
cur_ret_buf = req_ret_buffer;
buffer_args(func_number, signature, args, args_size_opt, &cur_args_buffer);
nr_serial = 1;
- }
+ } else {
+ check_buf_full = 1;
+ }
}
/* If call is not bufferable or the buffer is full. */
@@ -332,8 +335,14 @@ void do_opengl_call_no_lock(int func_number, void* ret_ptr, long* args, int* arg
func_number == _render_surface_func))))
{
ret_int = call_opengl(command_buffer, cur_args_buffer - command_buffer, cur_ret_buf, ret_buf);
- decode_ret_buffer(func_number, signature, args, ret_buf?ret_buf:command_buffer, ret_ptr);
+ if (check_buf_full == 0 || func_number == _render_surface_func
+ || func_number == _resize_surface_func) {
+ decode_ret_buffer(func_number, signature, args, ret_buf?ret_buf:command_buffer, ret_ptr);
+ } else {
+ // FIX ME : this variable be used to prevent to copy return value to args
+ check_buf_full = 0;
+ }
cur_args_buffer = NULL; // Reset pointers.
if(again == 2) {
diff --git a/libGL/opengl_func.h b/libGL/opengl_func.h
index 7a32dc9..7d48aa0 100755
--- a/libGL/opengl_func.h
+++ b/libGL/opengl_func.h
@@ -438,11 +438,20 @@ static const int glXGetVideoSyncSGI_signature[] = { TYPE_INT, 1, 1, TYPE_OUT_1IN
static const int glXSwapIntervalSGI_signature[] = { TYPE_INT, 0, 1, TYPE_INT };
+static const int glXCreatePixmap_signature[] =
+ { TYPE_INT, 0, 4, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT, TYPE_ARRAY_INT };
+
+static const int glXDestroyPixmap_signature[] =
+ { TYPE_NONE, 0, 2, TYPE_IN_IGNORED_POINTER, TYPE_INT };
+
static const int glXBindTexImageATI_signature[] = { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
static const int glXReleaseTexImageATI_signature[] = { TYPE_NONE, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
static const int glXBindTexImageARB_signature[] = { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
static const int glXReleaseTexImageARB_signature[] = { TYPE_INT, 0, 3, TYPE_IN_IGNORED_POINTER, TYPE_INT, TYPE_INT };
+static const int glEGLImageTargetTexture2DOES_fake_signature[] =
+ { TYPE_NONE, 0, 2, TYPE_UNSIGNED_INT, TYPE_INT };
+
/* const GLubyte * glGetString( GLenum name ) */
static const int glGetString_signature[] = {TYPE_CONST_CHAR, 0, 1, TYPE_INT};
diff --git a/libGL/parse_gl_h.c b/libGL/parse_gl_h.c
index 21b200b..dd18c7c 100755
--- a/libGL/parse_gl_h.c
+++ b/libGL/parse_gl_h.c
@@ -795,6 +795,11 @@ static const char* just_for_server_side_list[] =
"glGetActiveVaryingNV",
+ "glLinkProgram",
+ "glLinkProgramARB",
+
+ /*"glEGLImageTargetTexture2DOES",*/
+
NULL,
};