Mesa-master: remove OpenGL-ES patches

This commit is contained in:
Stephan Raue 2009-09-09 20:18:03 +02:00
parent 93ae45d96a
commit 468f200159
14 changed files with 0 additions and 21557 deletions

View File

@ -1,25 +0,0 @@
From d53566a498a502966ba0a1e863ec0eacdbf3cbbe Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 13:23:43 -0600
Subject: [PATCH 01/14] mesa: fix set_tex_parameteri() call
---
src/mesa/main/texparam.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 05d1442..6cbb999 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -599,7 +599,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
iparams[1] = (GLint) params[1];
iparams[2] = (GLint) params[2];
iparams[3] = (GLint) params[3];
- need_update = set_tex_parameteri(ctx, target, iparams);
+ need_update = set_tex_parameteri(ctx, texObj, pname, iparams);
}
break;
#endif
--
1.6.2.4

View File

@ -1,32 +0,0 @@
From d759a537726eccda7d6fccf6ecd09fdac0667088 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 13:24:20 -0600
Subject: [PATCH 02/14] st: added preprocessor test for FEATURE_texture_s3tc
---
src/mesa/state_tracker/st_cb_texture.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 90a059c..019edb7 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -119,6 +119,7 @@ static GLboolean
is_compressed_mesa_format(const struct gl_texture_format *format)
{
switch (format->MesaFormat) {
+#if FEATURE_texture_s3tc
case MESA_FORMAT_RGB_DXT1:
case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGBA_DXT3:
@@ -128,6 +129,7 @@ is_compressed_mesa_format(const struct gl_texture_format *format)
case MESA_FORMAT_SRGBA_DXT3:
case MESA_FORMAT_SRGBA_DXT5:
return GL_TRUE;
+#endif
default:
return GL_FALSE;
}
--
1.6.2.4

View File

@ -1,25 +0,0 @@
From 6d710440334e321ebccaf2530cedfc161bf6aafc Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 13:24:37 -0600
Subject: [PATCH 03/14] mesa: silence warning
---
src/mesa/main/fbobject.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 825a230..877ec00 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -644,6 +644,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
return;
}
}
+#else
+ (void) j;
#endif
if (numImages == 0) {
--
1.6.2.4

View File

@ -1,80 +0,0 @@
From afb6542cd49f8188ec9857664f99a4e3444db98c Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 3 Sep 2009 11:03:20 +0800
Subject: [PATCH 04/14] glapi: Prefix includes with glapi.
This allows different sets of generated headers to be used.
---
src/mesa/glapi/glapi.c | 8 ++++----
src/mesa/glapi/glapi_getproc.c | 8 ++++----
src/mesa/glapi/glthread.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index e36fccb..ad72fe4 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -69,9 +69,9 @@
#include <assert.h>
#endif
-#include "glapi.h"
-#include "glapioffsets.h"
-#include "glapitable.h"
+#include "glapi/glapi.h"
+#include "glapi/glapioffsets.h"
+#include "glapi/glapitable.h"
/***** BEGIN NO-OP DISPATCH *****/
@@ -145,7 +145,7 @@ static GLint NoOpUnused(void)
return 0;
}
-#include "glapitemp.h"
+#include "glapi/glapitemp.h"
/***** END NO-OP DISPATCH *****/
diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c
index ed443c1..decdd05 100644
--- a/src/mesa/glapi/glapi_getproc.c
+++ b/src/mesa/glapi/glapi_getproc.c
@@ -34,9 +34,9 @@
#include <string.h>
#include "main/glheader.h"
#include "main/compiler.h"
-#include "glapi.h"
-#include "glapioffsets.h"
-#include "glapitable.h"
+#include "glapi/glapi.h"
+#include "glapi/glapioffsets.h"
+#include "glapi/glapitable.h"
static void
@@ -75,7 +75,7 @@ str_dup(const char *str)
#endif
/* The code in this file is auto-generated with Python */
-#include "glprocs.h"
+#include "glapi/glprocs.h"
/**
diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c
index 737fd4d..dc90b36 100644
--- a/src/mesa/glapi/glthread.c
+++ b/src/mesa/glapi/glthread.c
@@ -33,7 +33,7 @@
#endif
#include "main/compiler.h"
-#include "glthread.h"
+#include "glapi/glthread.h"
/*
--
1.6.2.4

View File

@ -1,329 +0,0 @@
From 8c7897870af76e1e6ce809ec81b99f33383053d7 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 3 Sep 2009 11:05:06 +0800
Subject: [PATCH 05/14] glapi: Add OpenGL ES compatibility mode to scripts.
When the mode is on, the scripts would generate headers that are
suitable for OpenGL ES overlay, that will be later introduced.
---
src/mesa/glapi/gl_offsets.py | 25 +++++++++++----
src/mesa/glapi/gl_procs.py | 27 ++++++++++++++---
src/mesa/glapi/gl_table.py | 67 +++++++++++++++++++++++++++++------------
3 files changed, 87 insertions(+), 32 deletions(-)
diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py
index 59f8d37..197efca 100644
--- a/src/mesa/glapi/gl_offsets.py
+++ b/src/mesa/glapi/gl_offsets.py
@@ -30,9 +30,10 @@ import license
import sys, getopt
class PrintGlOffsets(gl_XML.gl_print_base):
- def __init__(self):
+ def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
+ self.es = es
self.name = "gl_offsets.py (from Mesa)"
self.header_tag = '_GLAPI_OFFSETS_H_'
self.license = license.bsd_license_template % ( \
@@ -56,7 +57,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
for f in abi_functions:
- print '#define _gloffset_%s %d' % (f.name, f.offset)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define _gloffset_%s %d' % (name, f.offset)
last_static = f.offset
print ''
@@ -64,7 +67,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
print ''
for [f, index] in functions:
- print '#define _gloffset_%s %d' % (f.name, f.offset)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define _gloffset_%s %d' % (name, f.offset)
print '#define _gloffset_FIRST_DYNAMIC %d' % (api.next_offset)
@@ -73,7 +78,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
print ''
for [f, index] in functions:
- print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (name, f.name)
print ''
print '#endif /* !defined(IN_DRI_DRIVER) */'
@@ -82,22 +89,26 @@ class PrintGlOffsets(gl_XML.gl_print_base):
def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
+ print " -c Enable compability with OpenGL ES."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:c")
except Exception,e:
show_usage()
+ es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
+ elif arg == "-c":
+ es = True
api = gl_XML.parse_GL_API( file_name )
- printer = PrintGlOffsets()
+ printer = PrintGlOffsets(es)
printer.Print( api )
diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py
index cd1a68c..4af96ad 100644
--- a/src/mesa/glapi/gl_procs.py
+++ b/src/mesa/glapi/gl_procs.py
@@ -30,9 +30,10 @@ import gl_XML, glX_XML
import sys, getopt
class PrintGlProcs(gl_XML.gl_print_base):
- def __init__(self, long_strings):
+ def __init__(self, long_strings, es=False):
gl_XML.gl_print_base.__init__(self)
+ self.es = es
self.long_strings = long_strings
self.name = "gl_procs.py (from Mesa)"
self.license = license.bsd_license_template % ( \
@@ -85,6 +86,18 @@ typedef struct {
def printBody(self, api):
print ''
+ if self.es:
+ print '/* OpenGL ES specific prototypes */'
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ cat, num = api.get_category_for_name(n)
+ if ((cat.startswith("es") and not (cat.endswith("core") or cat.endswith("compat"))) or
+ cat.startswith("GL_OES")):
+ print '/* category %s */' % api.get_category_for_name(n)[0]
+ print 'GLAPI %s GLAPIENTRY %s(%s);' \
+ % (func.return_type, "gl" + n, func.get_parameter_string(n))
+ print ''
+
if self.long_strings:
print 'static const char gl_string_table[] ='
else:
@@ -155,8 +168,9 @@ typedef struct {
def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
- print "mode can be one of:"
+ print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
+ print "-c Enable compability with OpenGL ES."
+ print "-m mode mode can be one of:"
print " long - Create code for compilers that can handle very"
print " long string constants. (default)"
print " short - Create code for compilers that can only handle"
@@ -167,11 +181,12 @@ if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
except Exception,e:
show_usage()
long_string = 1
+ es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
@@ -182,7 +197,9 @@ if __name__ == '__main__':
long_string = 1
else:
show_usage()
+ elif arg == "-c":
+ es = True
api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer = PrintGlProcs(long_string)
+ printer = PrintGlProcs(long_string, es)
printer.Print(api)
diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py
index 55a3374..611dfd2 100644
--- a/src/mesa/glapi/gl_table.py
+++ b/src/mesa/glapi/gl_table.py
@@ -30,9 +30,10 @@ import license
import sys, getopt
class PrintGlTable(gl_XML.gl_print_base):
- def __init__(self):
+ def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
+ self.es = es
self.header_tag = '_GLAPI_TABLE_H_'
self.name = "gl_table.py (from Mesa)"
self.license = license.bsd_license_template % ( \
@@ -42,10 +43,27 @@ class PrintGlTable(gl_XML.gl_print_base):
def printBody(self, api):
+ if self.es:
+ typedefs = []
+ for t in api.typeIterate():
+ if t.name == "fixed":
+ typedefs.append("typedef int GLfixed;")
+ elif t.name == "clampx":
+ typedefs.append("typedef int GLclampx;")
+ if typedefs:
+ print '#ifndef HAVE_GLES_TYPES'
+ print "\n".join(typedefs)
+ print '#endif'
+ print ''
+ print 'struct _glapi_table'
+ print '{'
+
for f in api.functionIterateByOffset():
arg_string = f.get_parameter_string()
print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (f.return_type, f.name, arg_string, f.offset)
+ print '};'
+
def printRealHeader(self):
print '#ifndef GLAPIENTRYP'
@@ -56,21 +74,18 @@ class PrintGlTable(gl_XML.gl_print_base):
print '# define GLAPIENTRYP GLAPIENTRY *'
print '#endif'
print ''
- print ''
- print 'struct _glapi_table'
- print '{'
return
def printRealFooter(self):
- print '};'
return
class PrintRemapTable(gl_XML.gl_print_base):
- def __init__(self):
+ def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
+ self.es = es
self.header_tag = '_DISPATCH_H_'
self.name = "gl_table.py (from Mesa)"
self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
@@ -127,9 +142,11 @@ class PrintRemapTable(gl_XML.gl_print_base):
for f in abi_functions:
- print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
- print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
- print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (name, f.name)
+ print '#define GET_%s(disp) ((disp)->%s)' % (name, f.name)
+ print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (name, f.name)
print ''
@@ -137,9 +154,11 @@ class PrintRemapTable(gl_XML.gl_print_base):
print ''
for [f, index] in functions:
- print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
- print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
- print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (name, f.name)
+ print '#define GET_%s(disp) ((disp)->%s)' % (name, f.name)
+ print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (name, f.name)
print ''
print '#else'
@@ -149,7 +168,9 @@ class PrintRemapTable(gl_XML.gl_print_base):
print ''
for [f, index] in functions:
- print '#define %s_remap_index %u' % (f.name, index)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define %s_remap_index %u' % (name, index)
print ''
@@ -157,9 +178,11 @@ class PrintRemapTable(gl_XML.gl_print_base):
arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string)
- print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name)
- print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name)
- print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name)
+ for name in f.entry_points:
+ if name == f.name or self.es:
+ print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (name, cast, f.name)
+ print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (name, f.name)
+ print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (name, f.name)
print ''
@@ -168,29 +191,33 @@ class PrintRemapTable(gl_XML.gl_print_base):
def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
print " -m mode Mode can be 'table' or 'remap_table'."
+ print " -c Enable compability with OpenGL ES."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
except Exception,e:
show_usage()
mode = "table"
+ es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
elif arg == "-m":
mode = val
+ elif arg == "-c":
+ es = True
if mode == "table":
- printer = PrintGlTable()
+ printer = PrintGlTable(es)
elif mode == "remap_table":
- printer = PrintRemapTable()
+ printer = PrintRemapTable(es)
else:
show_usage()
--
1.6.2.4

View File

@ -1,25 +0,0 @@
From a9293db50e645a44b8cc2c4b82f9dc521c27d076 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 14:29:24 -0600
Subject: [PATCH 09/14] es: update window title
---
progs/es1/xegl/tri.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/progs/es1/xegl/tri.c b/progs/es1/xegl/tri.c
index ca37c2d..233c021 100644
--- a/progs/es1/xegl/tri.c
+++ b/progs/es1/xegl/tri.c
@@ -427,7 +427,7 @@ main(int argc, char *argv[])
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
- "tri", 0, 0, winWidth, winHeight,
+ "OpenGL ES 1.x tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
--
1.6.2.4

View File

@ -1,22 +0,0 @@
From b8e64cc4390fb2f499f659374d8b4705846c7a19 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 14:29:33 -0600
Subject: [PATCH 10/14] es: updated Makefile comment
---
progs/es1/xegl/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/progs/es1/xegl/Makefile b/progs/es1/xegl/Makefile
index fe0b05c..4b21ee3 100644
--- a/progs/es1/xegl/Makefile
+++ b/progs/es1/xegl/Makefile
@@ -1,4 +1,4 @@
-# progs/gles/xegl/Makefile
+# progs/es1/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
--
1.6.2.4

View File

@ -1,594 +0,0 @@
From 96260c3e52d2f02170f935820d96ceef7a971e47 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 14:29:47 -0600
Subject: [PATCH 11/14] es: OpenGL ES 2.x demo programs
---
progs/es2/xegl/Makefile | 51 +++++
progs/es2/xegl/tri.c | 516 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 567 insertions(+), 0 deletions(-)
create mode 100644 progs/es2/xegl/Makefile
create mode 100644 progs/es2/xegl/tri.c
diff --git a/progs/es2/xegl/Makefile b/progs/es2/xegl/Makefile
new file mode 100644
index 0000000..8904203
--- /dev/null
+++ b/progs/es2/xegl/Makefile
@@ -0,0 +1,51 @@
+# progs/es/es2/xegl/Makefile
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+
+INCLUDE_DIRS = \
+ -I$(TOP)/include \
+
+HEADERS = $(TOP)/include/GLES/egl.h
+
+
+ES2_LIB_DEPS = \
+ $(TOP)/$(LIB_DIR)/libEGL.so \
+ $(TOP)/$(LIB_DIR)/libGLESv2.so
+
+
+ES2_LIBS = \
+ -L$(TOP)/$(LIB_DIR) -lEGL \
+ -L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB)
+
+PROGRAMS = \
+ es2_info \
+ tri
+
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+
+
+default: $(PROGRAMS)
+
+
+
+es2_info.c:
+ cp ../../es1/xegl/es1_info.c es2_info.c
+
+es2_info: es2_info.o $(ES2_LIB_DEPS)
+ $(CC) $(CFLAGS) es2_info.o $(ES2_LIBS) -o $@
+
+tri: tri.o $(ES2_LIB_DEPS)
+ $(CC) $(CFLAGS) tri.o $(ES2_LIBS) -o $@
+
+
+
+clean:
+ rm -f *.o *~
+ rm -f $(PROGRAMS)
+ rm -f es2_info.c
+
diff --git a/progs/es2/xegl/tri.c b/progs/es2/xegl/tri.c
new file mode 100644
index 0000000..7238369
--- /dev/null
+++ b/progs/es2/xegl/tri.c
@@ -0,0 +1,516 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ **************************************************************************/
+
+/*
+ * Draw a triangle with X/EGL and OpenGL ES 2.x
+ */
+
+#define USE_FULL_GL 0
+
+
+
+#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/keysym.h>
+#if USE_FULL_GL
+#include <GL/gl.h> /* use full OpenGL */
+#else
+#include <GLES2/gl2.h> /* use OpenGL ES 2.x */
+#endif
+#include <EGL/egl.h>
+
+
+#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
+
+
+
+static GLfloat view_rotx = 0.0, view_roty = 0.0;
+
+static GLint u_matrix = -1;
+static GLint attr_pos = 0, attr_color = 1;
+
+
+static void
+make_z_rot_matrix(GLfloat angle, GLfloat *m)
+{
+ float c = cos(angle * M_PI / 180.0);
+ float s = sin(angle * M_PI / 180.0);
+ int i;
+ for (i = 0; i < 16; i++)
+ m[i] = 0.0;
+ m[0] = m[5] = m[10] = m[15] = 1.0;
+
+ m[0] = c;
+ m[1] = s;
+ m[4] = -s;
+ m[5] = c;
+}
+
+static void
+make_scale_matrix(GLfloat xs, GLfloat ys, GLfloat zs, GLfloat *m)
+{
+ int i;
+ for (i = 0; i < 16; i++)
+ m[i] = 0.0;
+ m[0] = xs;
+ m[5] = ys;
+ m[10] = zs;
+ m[15] = 1.0;
+}
+
+
+static void
+mul_matrix(GLfloat *prod, const GLfloat *a, const GLfloat *b)
+{
+#define A(row,col) a[(col<<2)+row]
+#define B(row,col) b[(col<<2)+row]
+#define P(row,col) p[(col<<2)+row]
+ GLfloat p[16];
+ GLint i;
+ for (i = 0; i < 4; i++) {
+ const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
+ P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
+ P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
+ P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
+ P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
+ }
+ memcpy(prod, p, sizeof(p));
+#undef A
+#undef B
+#undef PROD
+}
+
+
+static void
+draw(void)
+{
+ static const GLfloat verts[3][2] = {
+ { -1, -1 },
+ { 1, -1 },
+ { 0, 1 }
+ };
+ static const GLfloat colors[3][3] = {
+ { 1, 0, 0 },
+ { 0, 1, 0 },
+ { 0, 0, 1 }
+ };
+ GLfloat mat[16], rot[16], scale[16];
+
+ /* Set modelview/projection matrix */
+ make_z_rot_matrix(view_rotx, rot);
+ make_scale_matrix(0.5, 0.5, 0.5, scale);
+ mul_matrix(mat, rot, scale);
+ glUniformMatrix4fv(u_matrix, 1, GL_FALSE, mat);
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ {
+ glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
+ glVertexAttribPointer(attr_color, 3, GL_FLOAT, GL_FALSE, 0, colors);
+ glEnableVertexAttribArray(attr_pos);
+ glEnableVertexAttribArray(attr_color);
+
+ glDrawArrays(GL_TRIANGLES, 0, 3);
+
+ glDisableVertexAttribArray(attr_pos);
+ glDisableVertexAttribArray(attr_color);
+ }
+}
+
+
+/* new window size or exposure */
+static void
+reshape(int width, int height)
+{
+ glViewport(0, 0, (GLint) width, (GLint) height);
+}
+
+
+static void
+create_shaders(void)
+{
+ static const char *fragShaderText =
+ "varying vec4 v_color;\n"
+ "void main() {\n"
+ " gl_FragColor = v_color;\n"
+ "}\n";
+ static const char *vertShaderText =
+ "uniform mat4 modelviewProjection;\n"
+ "attribute vec4 pos;\n"
+ "attribute vec4 color;\n"
+ "varying vec4 v_color;\n"
+ "void main() {\n"
+ " gl_Position = modelviewProjection * pos;\n"
+ " v_color = color;\n"
+ "}\n";
+
+ GLuint fragShader, vertShader, program;
+ GLint stat;
+
+ fragShader = glCreateShader(GL_FRAGMENT_SHADER);
+ glShaderSource(fragShader, 1, (const char **) &fragShaderText, NULL);
+ glCompileShader(fragShader);
+ glGetShaderiv(fragShader, GL_COMPILE_STATUS, &stat);
+ if (!stat) {
+ printf("Error: fragment shader did not compile!\n");
+ exit(1);
+ }
+
+ vertShader = glCreateShader(GL_VERTEX_SHADER);
+ glShaderSource(vertShader, 1, (const char **) &vertShaderText, NULL);
+ glCompileShader(vertShader);
+ glGetShaderiv(vertShader, GL_COMPILE_STATUS, &stat);
+ if (!stat) {
+ printf("Error: vertex shader did not compile!\n");
+ exit(1);
+ }
+
+ program = glCreateProgram();
+ glAttachShader(program, fragShader);
+ glAttachShader(program, vertShader);
+ glLinkProgram(program);
+
+ glGetProgramiv(program, GL_LINK_STATUS, &stat);
+ if (!stat) {
+ char log[1000];
+ GLsizei len;
+ glGetProgramInfoLog(program, 1000, &len, log);
+ printf("Error: linking:\n%s\n", log);
+ exit(1);
+ }
+
+ glUseProgram(program);
+
+ if (1) {
+ /* test setting attrib locations */
+ glBindAttribLocation(program, attr_pos, "pos");
+ glBindAttribLocation(program, attr_color, "color");
+ glLinkProgram(program); /* needed to put attribs into effect */
+ }
+ else {
+ /* test automatic attrib locations */
+ attr_pos = glGetAttribLocation(program, "pos");
+ attr_color = glGetAttribLocation(program, "color");
+ }
+
+ u_matrix = glGetUniformLocation(program, "modelviewProjection");
+ printf("Uniform modelviewProjection at %d\n", u_matrix);
+ printf("Attrib pos at %d\n", attr_pos);
+ printf("Attrib color at %d\n", attr_color);
+}
+
+
+static void
+init(void)
+{
+ typedef void (*proc)();
+
+#if 1 /* test code */
+ proc p = eglGetProcAddress("eglCreateContext");
+ assert(p);
+ p = eglGetProcAddress("glMapBufferOES");
+ assert(p);
+#endif
+
+ glClearColor(0.4, 0.4, 0.4, 0.0);
+
+ create_shaders();
+}
+
+
+/*
+ * Create an RGB, double-buffered X window.
+ * Return the window and context handles.
+ */
+static void
+make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
+ const char *name,
+ int x, int y, int width, int height,
+ Window *winRet,
+ EGLContext *ctxRet,
+ EGLSurface *surfRet)
+{
+ static const EGLint attribs[] = {
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_DEPTH_SIZE, 1,
+ EGL_NONE
+ };
+ static const EGLint ctx_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ int scrnum;
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ Window root;
+ Window win;
+ XVisualInfo *visInfo, visTemplate;
+ int num_visuals;
+ EGLContext ctx;
+ EGLConfig config;
+ EGLint num_configs;
+ EGLint vid;
+
+ scrnum = DefaultScreen( x_dpy );
+ root = RootWindow( x_dpy, scrnum );
+
+ if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
+ printf("Error: couldn't get an EGL visual config\n");
+ exit(1);
+ }
+
+ assert(config);
+ assert(num_configs > 0);
+
+ if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
+ printf("Error: eglGetConfigAttrib() failed\n");
+ exit(1);
+ }
+
+ /* The X window visual must match the EGL config */
+ visTemplate.visualid = vid;
+ visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
+ if (!visInfo) {
+ printf("Error: couldn't get X visual\n");
+ exit(1);
+ }
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow( x_dpy, root, 0, 0, width, height,
+ 0, visInfo->depth, InputOutput,
+ visInfo->visual, mask, &attr );
+
+ /* set hints and properties */
+ {
+ XSizeHints sizehints;
+ sizehints.x = x;
+ sizehints.y = y;
+ sizehints.width = width;
+ sizehints.height = height;
+ sizehints.flags = USSize | USPosition;
+ XSetNormalHints(x_dpy, win, &sizehints);
+ XSetStandardProperties(x_dpy, win, name, name,
+ None, (char **)NULL, 0, &sizehints);
+ }
+
+#if USE_FULL_GL /* XXX fix this when eglBindAPI() works */
+ eglBindAPI(EGL_OPENGL_API);
+#else
+ eglBindAPI(EGL_OPENGL_ES_API);
+#endif
+
+ ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
+ if (!ctx) {
+ printf("Error: eglCreateContext failed\n");
+ exit(1);
+ }
+
+ /* test eglQueryContext() */
+ {
+ EGLint val;
+ eglQueryContext(egl_dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &val);
+ assert(val == 2);
+ }
+
+ *surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
+ if (!*surfRet) {
+ printf("Error: eglCreateWindowSurface failed\n");
+ exit(1);
+ }
+
+ {
+ EGLint val;
+ eglQuerySurface(egl_dpy, *surfRet, EGL_WIDTH, &val);
+ assert(val == width);
+ eglQuerySurface(egl_dpy, *surfRet, EGL_HEIGHT, &val);
+ assert(val == height);
+ eglQuerySurface(egl_dpy, *surfRet, EGL_SURFACE_TYPE, &val);
+ assert(val == EGL_WINDOW_BIT);
+ }
+
+ XFree(visInfo);
+
+ *winRet = win;
+ *ctxRet = ctx;
+}
+
+
+static void
+event_loop(Display *dpy, Window win,
+ EGLDisplay egl_dpy, EGLSurface egl_surf)
+{
+ while (1) {
+ int redraw = 0;
+ XEvent event;
+
+ XNextEvent(dpy, &event);
+
+ switch (event.type) {
+ case Expose:
+ redraw = 1;
+ break;
+ case ConfigureNotify:
+ reshape(event.xconfigure.width, event.xconfigure.height);
+ break;
+ case KeyPress:
+ {
+ char buffer[10];
+ int r, code;
+ code = XLookupKeysym(&event.xkey, 0);
+ if (code == XK_Left) {
+ view_roty += 5.0;
+ }
+ else if (code == XK_Right) {
+ view_roty -= 5.0;
+ }
+ else if (code == XK_Up) {
+ view_rotx += 5.0;
+ }
+ else if (code == XK_Down) {
+ view_rotx -= 5.0;
+ }
+ else {
+ r = XLookupString(&event.xkey, buffer, sizeof(buffer),
+ NULL, NULL);
+ if (buffer[0] == 27) {
+ /* escape */
+ return;
+ }
+ }
+ }
+ redraw = 1;
+ break;
+ default:
+ ; /*no-op*/
+ }
+
+ if (redraw) {
+ draw();
+ eglSwapBuffers(egl_dpy, egl_surf);
+ }
+ }
+}
+
+
+static void
+usage(void)
+{
+ printf("Usage:\n");
+ printf(" -display <displayname> set the display to run on\n");
+ printf(" -info display OpenGL renderer info\n");
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ const int winWidth = 300, winHeight = 300;
+ Display *x_dpy;
+ Window win;
+ EGLSurface egl_surf;
+ EGLContext egl_ctx;
+ EGLDisplay egl_dpy;
+ char *dpyName = NULL;
+ GLboolean printInfo = GL_FALSE;
+ EGLint egl_major, egl_minor;
+ int i;
+ const char *s;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-display") == 0) {
+ dpyName = argv[i+1];
+ i++;
+ }
+ else if (strcmp(argv[i], "-info") == 0) {
+ printInfo = GL_TRUE;
+ }
+ else {
+ usage();
+ return -1;
+ }
+ }
+
+ x_dpy = XOpenDisplay(dpyName);
+ if (!x_dpy) {
+ printf("Error: couldn't open display %s\n",
+ dpyName ? dpyName : getenv("DISPLAY"));
+ return -1;
+ }
+
+ egl_dpy = eglGetDisplay(x_dpy);
+ if (!egl_dpy) {
+ printf("Error: eglGetDisplay() failed\n");
+ return -1;
+ }
+
+ if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
+ printf("Error: eglInitialize() failed\n");
+ return -1;
+ }
+
+ s = eglQueryString(egl_dpy, EGL_VERSION);
+ printf("EGL_VERSION = %s\n", s);
+
+ s = eglQueryString(egl_dpy, EGL_VENDOR);
+ printf("EGL_VENDOR = %s\n", s);
+
+ s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
+ printf("EGL_EXTENSIONS = %s\n", s);
+
+ s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
+ printf("EGL_CLIENT_APIS = %s\n", s);
+
+ make_x_window(x_dpy, egl_dpy,
+ "OpenGL ES 2.x tri", 0, 0, winWidth, winHeight,
+ &win, &egl_ctx, &egl_surf);
+
+ XMapWindow(x_dpy, win);
+ if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
+ printf("Error: eglMakeCurrent() failed\n");
+ return -1;
+ }
+
+ if (printInfo) {
+ printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
+ }
+
+ init();
+
+ /* Set initial projection/viewing transformation.
+ * We can't be sure we'll get a ConfigureNotify event when the window
+ * first appears.
+ */
+ reshape(winWidth, winHeight);
+
+ event_loop(x_dpy, win, egl_dpy, egl_surf);
+
+ eglDestroyContext(egl_dpy, egl_ctx);
+ eglDestroySurface(egl_dpy, egl_surf);
+ eglTerminate(egl_dpy);
+
+
+ XDestroyWindow(x_dpy, win);
+ XCloseDisplay(x_dpy);
+
+ return 0;
+}
--
1.6.2.4

View File

@ -1,22 +0,0 @@
From ea625e90c1f9058a67e1a7906c8dce3224e2ee13 Mon Sep 17 00:00:00 2001
From: Brian Paul <brianp@vmware.com>
Date: Tue, 12 May 2009 14:30:40 -0600
Subject: [PATCH 12/14] es: fix comment
---
progs/es2/xegl/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/progs/es2/xegl/Makefile b/progs/es2/xegl/Makefile
index 8904203..bd5611a 100644
--- a/progs/es2/xegl/Makefile
+++ b/progs/es2/xegl/Makefile
@@ -1,4 +1,4 @@
-# progs/es/es2/xegl/Makefile
+# progs/es2/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
--
1.6.2.4

View File

@ -1,39 +0,0 @@
From ba0efedd82bcbbd12fcced80fd72e7f5cd4ca55d Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 3 Sep 2009 11:27:30 +0800
Subject: [PATCH 13/14] progs/es: Link to libX11.
---
progs/es1/xegl/Makefile | 2 +-
progs/es2/xegl/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/progs/es1/xegl/Makefile b/progs/es1/xegl/Makefile
index 4b21ee3..7f684d6 100644
--- a/progs/es1/xegl/Makefile
+++ b/progs/es1/xegl/Makefile
@@ -17,7 +17,7 @@ ES1_LIB_DEPS = \
ES1_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
- -L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB)
+ -L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
PROGRAMS = \
drawtex \
diff --git a/progs/es2/xegl/Makefile b/progs/es2/xegl/Makefile
index bd5611a..88bb012 100644
--- a/progs/es2/xegl/Makefile
+++ b/progs/es2/xegl/Makefile
@@ -17,7 +17,7 @@ ES2_LIB_DEPS = \
ES2_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
- -L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB)
+ -L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) -lX11
PROGRAMS = \
es2_info \
--
1.6.2.4

View File

@ -1,208 +0,0 @@
From 5d16f7dc6922ae26b23080ec8cbe62c94580893a Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olvaffe@gmail.com>
Date: Thu, 3 Sep 2009 11:31:17 +0800
Subject: [PATCH 14/14] st/es: Add OpenGL ES state tracker.
---
src/gallium/state_trackers/es/Makefile | 91 ++++++++++++++++++++++++
src/gallium/state_trackers/es/st_es1_context.c | 41 +++++++++++
src/gallium/state_trackers/es/st_es2_context.c | 41 +++++++++++
3 files changed, 173 insertions(+), 0 deletions(-)
create mode 100644 src/gallium/state_trackers/es/Makefile
create mode 100644 src/gallium/state_trackers/es/st_es1_context.c
create mode 100644 src/gallium/state_trackers/es/st_es2_context.c
diff --git a/src/gallium/state_trackers/es/Makefile b/src/gallium/state_trackers/es/Makefile
new file mode 100644
index 0000000..897d715
--- /dev/null
+++ b/src/gallium/state_trackers/es/Makefile
@@ -0,0 +1,91 @@
+# src/gallium/state_trackers/es/Makefile
+
+# Build the ES 1/2 state tracker libraries
+# This consists of core Mesa ES, plus GL/gallium state tracker plus.
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+GLES_1_VERSION_MAJOR = 1
+GLES_1_VERSION_MINOR = 1
+GLES_1_VERSION_PATCH = 0
+
+GLES_2_VERSION_MAJOR = 2
+GLES_2_VERSION_MINOR = 0
+GLES_2_VERSION_PATCH = 0
+
+
+# Maybe move these into configs/default:
+GLES_1_LIB = GLESv1_CM
+GLES_1_LIB_NAME = lib$(GLES_1_LIB).so
+GLES_2_LIB = GLESv2
+GLES_2_LIB_NAME = lib$(GLES_2_LIB).so
+
+
+INCLUDE_DIRS = \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/include
+
+ES1_SOURCES = \
+ st_es1_context.c \
+
+ES1_OBJECTS = $(ES1_SOURCES:.c=.o)
+
+ES2_SOURCES = \
+ st_es2_context.c \
+
+ES2_OBJECTS = $(ES2_SOURCES:.c=.o)
+
+
+# we only need the gallium libs that the state trackers directly use:
+GALLIUM_LIBS = \
+ $(TOP)/src/gallium/auxiliary/cso_cache/libcso_cache.a \
+ $(TOP)/src/gallium/auxiliary/rtasm/librtasm.a \
+ $(TOP)/src/gallium/auxiliary/tgsi/libtgsi.a \
+ $(TOP)/src/gallium/auxiliary/util/libutil.a
+
+ES1_LIBS = \
+ $(TOP)/src/mesa/es/libes1gallium.a \
+ $(TOP)/src/mesa/es/libes1api.a
+
+ES2_LIBS = \
+ $(TOP)/src/mesa/es/libes2gallium.a \
+ $(TOP)/src/mesa/es/libes2api.a
+
+SYS_LIBS = -lm -pthread
+
+
+.c.o:
+ $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
+
+
+# Default: make both GL ES 1.1 and GL ES 2.0 libraries
+default: $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)
+
+# Make the shared libs
+$(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME): $(ES1_OBJECTS) $(ES1_LIBS)
+ $(TOP)/bin/mklib -o $(GLES_1_LIB) \
+ -major $(GLES_1_VERSION_MAJOR) \
+ -minor $(GLES_1_VERSION_MINOR) \
+ -patch $(GLES_1_VERSION_PATCH) \
+ -install $(TOP)/$(LIB_DIR) \
+ $(ES1_OBJECTS) \
+ -Wl,--whole-archive $(ES1_LIBS) -Wl,--no-whole-archive \
+ -Wl,--start-group $(GALLIUM_LIBS) -Wl,--end-group \
+ $(SYS_LIBS)
+
+$(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME): $(ES2_OBJECTS) $(ES1_LIBS)
+ $(TOP)/bin/mklib -o $(GLES_2_LIB) \
+ -major $(GLES_2_VERSION_MAJOR) \
+ -minor $(GLES_2_VERSION_MINOR) \
+ -patch $(GLES_2_VERSION_PATCH) \
+ -install $(TOP)/$(LIB_DIR) \
+ $(ES2_OBJECTS) \
+ -Wl,--whole-archive $(ES2_LIBS) -Wl,--no-whole-archive \
+ -Wl,--start-group $(GALLIUM_LIBS) -Wl,--end-group \
+ $(SYS_LIBS)
+
+clean:
+ -rm -f *.o *~
+ -rm -f $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME)* $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)*
+ -rm -f *.pyc
diff --git a/src/gallium/state_trackers/es/st_es1_context.c b/src/gallium/state_trackers/es/st_es1_context.c
new file mode 100644
index 0000000..46daf54
--- /dev/null
+++ b/src/gallium/state_trackers/es/st_es1_context.c
@@ -0,0 +1,41 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * TUNGSTEN GRAPHICS 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.
+ **************************************************************************/
+
+
+/**
+ * Extra per-context init for OpenGL ES 1.x only.
+ */
+
+
+#include "main/context.h"
+
+
+/**
+ * Called from _mesa_initialize_context()
+ */
+void
+_mesa_initialize_context_extra(GLcontext *ctx)
+{
+ /* nothing for ES 1.x */
+}
diff --git a/src/gallium/state_trackers/es/st_es2_context.c b/src/gallium/state_trackers/es/st_es2_context.c
new file mode 100644
index 0000000..982df70
--- /dev/null
+++ b/src/gallium/state_trackers/es/st_es2_context.c
@@ -0,0 +1,41 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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, sublicense,
+ * 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * TUNGSTEN GRAPHICS 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.
+ **************************************************************************/
+
+
+/**
+ * Extra per-context init for OpenGL ES 2.x only.
+ */
+
+
+#include "main/context.h"
+
+
+/**
+ * Called from _mesa_initialize_context()
+ */
+void
+_mesa_initialize_context_extra(GLcontext *ctx)
+{
+ ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */
+}
--
1.6.2.4