aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--X11/xtrans/Xtranssock.c21
-rw-r--r--X11/xtrans/configure.ac2
-rw-r--r--fontconfig/configure.ac2
-rw-r--r--fontconfig/fc-cache/fc-cache.c2
-rw-r--r--libxcb/src/xcb_out.c57
-rw-r--r--libxcb/src/xcb_util.c17
-rw-r--r--libxcb/xcb-proto/src/dri2.xml2
-rw-r--r--libxcb/xcb-proto/src/xf86vidmode.xml2
-rw-r--r--libxcb/xcb-proto/src/xinput.xml2
-rw-r--r--libxcb/xcb-proto/src/xprint.xml4
-rw-r--r--mesalib/configure.ac122
-rw-r--r--mesalib/docs/GL3.txt17
-rw-r--r--mesalib/docs/devinfo.html5
-rw-r--r--mesalib/docs/relnotes/10.2.html3
-rw-r--r--mesalib/include/GLES2/gl2ext.h91
-rw-r--r--mesalib/include/GLES3/gl31.h1184
-rw-r--r--mesalib/include/GLES3/gl3platform.h2
-rw-r--r--mesalib/install-gallium-links.mk4
-rw-r--r--mesalib/install-lib-links.mk2
-rw-r--r--mesalib/src/Makefile.am8
-rw-r--r--mesalib/src/gallium/Automake.inc69
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c42
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c540
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h23
-rw-r--r--mesalib/src/glsl/ast.h13
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp180
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp21
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h4
-rw-r--r--mesalib/src/glsl/ir.cpp9
-rw-r--r--mesalib/src/glsl/ir.h15
-rw-r--r--mesalib/src/glsl/ir_optimization.h6
-rw-r--r--mesalib/src/glsl/ir_validate.cpp3
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.cpp8
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.h3
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp14
-rw-r--r--mesalib/src/glsl/link_uniform_initializers.cpp117
-rw-r--r--mesalib/src/glsl/linker.cpp6
-rw-r--r--mesalib/src/glsl/loop_analysis.h3
-rw-r--r--mesalib/src/glsl/loop_unroll.cpp86
-rw-r--r--mesalib/src/glsl/lower_ubo_reference.cpp10
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp30
-rw-r--r--mesalib/src/glsl/opt_tree_grafting.cpp30
-rw-r--r--mesalib/src/glsl/opt_vectorize.cpp1
-rw-r--r--mesalib/src/glsl/test_optpass.cpp7
-rw-r--r--mesalib/src/loader/loader.c6
-rw-r--r--mesalib/src/mapi/Makefile.sources23
-rw-r--r--mesalib/src/mapi/glapi/Makefile.sources4
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml122
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am44
-rw-r--r--mesalib/src/mapi/glapi/gen/SConscript2
-rw-r--r--mesalib/src/mapi/glapi/gen/es_EXT.xml2
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_API.xml32
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_and_es_API.xml129
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_procs.py43
-rwxr-xr-xmesalib/src/mapi/mapi_abi.py18
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.am27
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/megadriver_stub.c4
-rw-r--r--mesalib/src/mesa/main/attrib.c20
-rw-r--r--mesalib/src/mesa/main/bufferobj.c6
-rw-r--r--mesalib/src/mesa/main/bufferobj.h7
-rw-r--r--mesalib/src/mesa/main/drawpix.c2
-rw-r--r--mesalib/src/mesa/main/errors.c2
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp3
-rw-r--r--mesalib/src/mesa/main/format_unpack.c80
-rw-r--r--mesalib/src/mesa/main/formats.c20
-rw-r--r--mesalib/src/mesa/main/imports.h6
-rw-r--r--mesalib/src/mesa/main/macros.h11
-rw-r--r--mesalib/src/mesa/main/mtypes.h5
-rw-r--r--mesalib/src/mesa/main/pack.c116
-rw-r--r--mesalib/src/mesa/main/shader_query.cpp36
-rw-r--r--mesalib/src/mesa/main/texcompress_etc.c78
-rw-r--r--mesalib/src/mesa/main/texformat.c22
-rw-r--r--mesalib/src/mesa/main/texobj.c7
-rw-r--r--mesalib/src/mesa/main/texparam.c3
-rw-r--r--mesalib/src/mesa/main/texstore.c34
-rw-r--r--mesalib/src/mesa/main/vdpau.c8
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp3
-rw-r--r--mesalib/src/mesa/program/prog_noise.c36
-rw-r--r--mesalib/src/mesa/program/program_parse.y5
-rw-r--r--mesalib/src/mesa/program/symbol_table.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c22
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c55
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c28
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_eglimage.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c48
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c13
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c75
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.h8
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c115
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h30
-rw-r--r--mesalib/src/mesa/state_tracker/st_vdpau.c11
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c1127
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h955
-rw-r--r--mesalib/src/mesa/tnl/t_context.c2
-rw-r--r--mesalib/src/mesa/tnl/t_draw.c34
-rw-r--r--mesalib/src/mesa/tnl/tnl.h9
-rw-r--r--pixman/configure.ac18
-rw-r--r--pixman/pixman/Makefile.am2
-rw-r--r--pixman/pixman/pixman-arm-asm.h37
-rw-r--r--pixman/pixman/pixman-arm-neon-asm-bilinear.S12
-rw-r--r--pixman/pixman/pixman-arm-neon-asm.S12
-rw-r--r--pixman/pixman/pixman-arm-simd-asm-scaled.S11
-rw-r--r--pixman/pixman/pixman-arm-simd-asm.S78
-rw-r--r--pixman/pixman/pixman-arm-simd.c6
-rw-r--r--pixman/test/tolerance-test.c4
-rw-r--r--pixman/test/utils-prng.c10
-rw-r--r--pixman/test/utils-prng.h9
-rw-r--r--xorg-server/Xext/Makefile.am4
-rw-r--r--xorg-server/Xi/Makefile.am5
-rw-r--r--xorg-server/composite/compext.c13
-rw-r--r--xorg-server/composite/compinit.c24
-rw-r--r--xorg-server/composite/compint.h7
-rw-r--r--xorg-server/composite/compositeext.h4
-rw-r--r--xorg-server/composite/compwindow.c18
-rw-r--r--xorg-server/configure.ac48
-rw-r--r--xorg-server/dix/events.c46
-rw-r--r--xorg-server/dix/globals.c3
-rw-r--r--xorg-server/dri3/dri3.h14
-rw-r--r--xorg-server/dri3/dri3_request.c38
-rw-r--r--xorg-server/dri3/dri3_screen.c16
-rw-r--r--xorg-server/fb/Makefile.am3
-rw-r--r--xorg-server/fb/fbpict.c4
-rw-r--r--xorg-server/fb/fbpict.h15
-rw-r--r--xorg-server/glamor/Makefile.am10
-rw-r--r--xorg-server/glamor/glamor.c34
-rw-r--r--xorg-server/glamor/glamor.h21
-rw-r--r--xorg-server/glamor/glamor_core.c14
-rw-r--r--xorg-server/glamor/glamor_egl.c11
-rw-r--r--xorg-server/glamor/glamor_egl_stubs.c4
-rw-r--r--xorg-server/glamor/glamor_fillspans.c107
-rw-r--r--xorg-server/glamor/glamor_font.c186
-rw-r--r--xorg-server/glamor/glamor_font.h49
-rw-r--r--xorg-server/glamor/glamor_getspans.c92
-rw-r--r--xorg-server/glamor/glamor_glyphblt.c261
-rw-r--r--xorg-server/glamor/glamor_pixmap.c4
-rw-r--r--xorg-server/glamor/glamor_points.c21
-rw-r--r--xorg-server/glamor/glamor_polyfillrect.c123
-rw-r--r--xorg-server/glamor/glamor_priv.h73
-rw-r--r--xorg-server/glamor/glamor_program.c18
-rw-r--r--xorg-server/glamor/glamor_rects.c189
-rw-r--r--xorg-server/glamor/glamor_setspans.c118
-rw-r--r--xorg-server/glamor/glamor_spans.c438
-rw-r--r--xorg-server/glamor/glamor_text.c526
-rw-r--r--xorg-server/glamor/glamor_transfer.c264
-rw-r--r--xorg-server/glamor/glamor_transfer.h55
-rw-r--r--xorg-server/glamor/glamor_xv.c14
-rw-r--r--xorg-server/hw/Makefile.am9
-rw-r--r--xorg-server/hw/dmx/Makefile.am1
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c1
-rwxr-xr-xxorg-server/hw/kdrive/ephyr/hostx.c5
-rw-r--r--xorg-server/hw/kdrive/src/Makefile.am5
-rw-r--r--xorg-server/hw/vfb/Makefile.am11
-rw-r--r--xorg-server/hw/xfree86/.gitignore1
-rw-r--r--xorg-server/hw/xfree86/Makefile.am3
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c28
-rw-r--r--xorg-server/hw/xfree86/common/xf86Globals.c2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c31
-rw-r--r--xorg-server/hw/xfree86/common/xf86Init.c16
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Privstr.h4
-rw-r--r--xorg-server/hw/xfree86/dixmods/Makefile.am4
-rw-r--r--xorg-server/hw/xfree86/man/Xorg.man6
-rw-r--r--xorg-server/hw/xfree86/man/xorg.conf.man6
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.h4
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Cursors.c35
-rw-r--r--xorg-server/hw/xfree86/os-support/linux/systemd-logind.c34
-rw-r--r--xorg-server/hw/xfree86/parser/DRI.c1
-rw-r--r--xorg-server/hw/xfree86/parser/Extensions.c1
-rw-r--r--xorg-server/hw/xfree86/ramdac/IBM.c6
-rw-r--r--xorg-server/hw/xfree86/ramdac/TI.c3
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.c11
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86Cursor.h4
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h2
-rw-r--r--xorg-server/hw/xfree86/ramdac/xf86HWCurs.c15
-rw-r--r--xorg-server/hw/xnest/Makefile.am9
-rw-r--r--xorg-server/hw/xquartz/Makefile.am1
-rw-r--r--xorg-server/hw/xquartz/X11Controller.m5
-rw-r--r--xorg-server/hw/xwayland/.gitignore3
-rw-r--r--xorg-server/hw/xwayland/Makefile.am30
-rw-r--r--xorg-server/hw/xwayland/xwayland-cursor.c193
-rw-r--r--xorg-server/hw/xwayland/xwayland-cvt.c304
-rw-r--r--xorg-server/hw/xwayland/xwayland-input.c666
-rw-r--r--xorg-server/hw/xwayland/xwayland-output.c226
-rw-r--r--xorg-server/hw/xwayland/xwayland-shm.c292
-rw-r--r--xorg-server/hw/xwayland/xwayland.c652
-rw-r--r--xorg-server/hw/xwayland/xwayland.h164
-rw-r--r--xorg-server/hw/xwin/Makefile.am9
-rw-r--r--xorg-server/include/input.h1
-rw-r--r--xorg-server/include/opaque.h1
-rw-r--r--xorg-server/include/scrnintstr.h7
-rw-r--r--xorg-server/include/xorg-config.h.in11
-rw-r--r--xorg-server/include/xwin-config.h.in3
-rw-r--r--xorg-server/mi/mi.h4
-rw-r--r--xorg-server/mi/miscrinit.c1
-rw-r--r--xorg-server/mi/miwindow.c66
-rw-r--r--xorg-server/os/connection.c12
-rw-r--r--xorg-server/os/utils.c2
-rw-r--r--xorg-server/test/Makefile.am6
-rw-r--r--xorg-server/xkb/xkbAccessX.c2
205 files changed, 8423 insertions, 3906 deletions
diff --git a/X11/xtrans/Xtranssock.c b/X11/xtrans/Xtranssock.c
index 6d4207f1c..9dda1295f 100644
--- a/X11/xtrans/Xtranssock.c
+++ b/X11/xtrans/Xtranssock.c
@@ -456,6 +456,27 @@ TRANS(SocketOpen) (int i, int type)
}
#endif
+ /*
+ * Some systems provide a really small default buffer size for
+ * UNIX sockets. Bump it up a bit such that large transfers don't
+ * proceed at glacial speed.
+ */
+#ifdef SO_SNDBUF
+ if (Sockettrans2devtab[i].family == AF_UNIX)
+ {
+ SOCKLEN_T len = sizeof (int);
+ int val;
+
+ if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF,
+ (char *) &val, &len) == 0 && val < 64 * 1024)
+ {
+ val = 64 * 1024;
+ setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF,
+ (char *) &val, sizeof (int));
+ }
+ }
+#endif
+
return ciptr;
}
diff --git a/X11/xtrans/configure.ac b/X11/xtrans/configure.ac
index 6898c6d25..bb8a34cce 100644
--- a/X11/xtrans/configure.ac
+++ b/X11/xtrans/configure.ac
@@ -21,7 +21,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([xtrans], [1.3.3],
+AC_INIT([xtrans], [1.3.4],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xtrans])
AC_CONFIG_SRCDIR([Makefile.am])
diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac
index 80875dfa2..ce468b89e 100644
--- a/fontconfig/configure.ac
+++ b/fontconfig/configure.ac
@@ -155,7 +155,7 @@ AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getpr
dnl AC_CHECK_FUNCS doesn't check for header files.
dnl posix_fadvise() may be not available in older libc.
AC_CHECK_SYMBOL([posix_fadvise], [fcntl.h], [fc_func_posix_fadvise=1], [fc_func_posix_fadvise=0])
-AC_DEFINE_UNQUOTED([HAVE_POSIX_FADVISE], [$fc_func_posix_fadvise], [Define to 1 if you have the 'posix_fadivse' function.])
+AC_DEFINE_UNQUOTED([HAVE_POSIX_FADVISE], [$fc_func_posix_fadvise], [Define to 1 if you have the 'posix_fadvise' function.])
if test "$os_win32" = "no"; then
AC_MSG_CHECKING([for scandir])
fc_saved_CFLAGS="$CFLAGS"
diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c
index 99e0e9f42..90ebad32f 100644
--- a/fontconfig/fc-cache/fc-cache.c
+++ b/fontconfig/fc-cache/fc-cache.c
@@ -388,7 +388,7 @@ main (int argc, char **argv)
list = FcStrListCreate (updateDirs);
if (list)
{
- ret += scanDirs (list, config, FcTrue, really_force, verbose, FcFalse, &changed, NULL);
+ ret += scanDirs (list, config, FcTrue, FcFalse, verbose, FcFalse, &changed, NULL);
FcStrListDone (list);
}
FcStrSetDestroy (updateDirs);
diff --git a/libxcb/src/xcb_out.c b/libxcb/src/xcb_out.c
index f11e2966f..4deec3304 100644
--- a/libxcb/src/xcb_out.c
+++ b/libxcb/src/xcb_out.c
@@ -104,6 +104,33 @@ static void get_socket_back(xcb_connection_t *c)
_xcb_in_replies_done(c);
}
+static void prepare_socket_request(xcb_connection_t *c)
+{
+ /* We're about to append data to out.queue, so we need to
+ * atomically test for an external socket owner *and* some other
+ * thread currently writing.
+ *
+ * If we have an external socket owner, we have to get the socket back
+ * before we can use it again.
+ *
+ * If some other thread is writing to the socket, we assume it's
+ * writing from out.queue, and so we can't stick data there.
+ *
+ * We satisfy this condition by first calling get_socket_back
+ * (which may drop the lock, but will return when XCB owns the
+ * socket again) and then checking for another writing thread and
+ * escaping the loop if we're ready to go.
+ */
+ for (;;) {
+ if(c->has_error)
+ return;
+ get_socket_back(c);
+ if (!c->out.writing)
+ break;
+ pthread_cond_wait(&c->out.cond, &c->iolock);
+ }
+}
+
/* Public interface */
void xcb_prefetch_maximum_request_length(xcb_connection_t *c)
@@ -237,24 +264,23 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect
/* get a sequence number and arrange for delivery. */
pthread_mutex_lock(&c->iolock);
- /* wait for other writing threads to get out of my way. */
- while(c->out.writing)
- pthread_cond_wait(&c->out.cond, &c->iolock);
- get_socket_back(c);
+
+ prepare_socket_request(c);
/* send GetInputFocus (sync_req) when 64k-2 requests have been sent without
- * a reply. */
- if(req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2)
- send_sync(c);
- /* Also send sync_req (could use NoOp) at 32-bit wrap to avoid having
+ * a reply.
+ * Also send sync_req (could use NoOp) at 32-bit wrap to avoid having
* applications see sequence 0 as that is used to indicate
- * an error in sending the request */
- if((unsigned int) (c->out.request + 1) == 0)
+ * an error in sending the request
+ */
+
+ while ((req->isvoid && c->out.request == c->in.request_expected + (1 << 16) - 2) ||
+ (unsigned int) (c->out.request + 1) == 0)
+ {
send_sync(c);
+ prepare_socket_request(c);
+ }
- /* The above send_sync calls could drop the I/O lock, but this
- * thread will still exclude any other thread that tries to write,
- * so the sequence number postconditions still hold. */
send_request(c, req->isvoid, workaround, flags, vector, veclen);
request = c->has_error ? 0 : c->out.request;
pthread_mutex_unlock(&c->iolock);
@@ -374,10 +400,7 @@ int _xcb_out_send(xcb_connection_t *c, struct iovec *vector, int count)
void _xcb_out_send_sync(xcb_connection_t *c)
{
- /* wait for other writing threads to get out of my way. */
- while(c->out.writing)
- pthread_cond_wait(&c->out.cond, &c->iolock);
- get_socket_back(c);
+ prepare_socket_request(c);
send_sync(c);
}
diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c
index 3cf752644..3449cb2a4 100644
--- a/libxcb/src/xcb_util.c
+++ b/libxcb/src/xcb_util.c
@@ -467,16 +467,17 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname,
if(!parsed) {
c = _xcb_conn_ret_error(XCB_CONN_CLOSED_PARSE_ERR);
goto out;
- } else {
+ }
+
#ifdef _WIN32
- WSADATA wsaData;
- if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
- c = _xcb_conn_ret_error(XCB_CONN_ERROR);
- goto out;
- }
-#endif
- fd = _xcb_open(host, protocol, display);
+ WSADATA wsaData;
+ if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
+ c = _xcb_conn_ret_error(XCB_CONN_ERROR);
+ goto out;
}
+#endif
+
+ fd = _xcb_open(host, protocol, display);
if(fd == -1) {
c = _xcb_conn_ret_error(XCB_CONN_ERROR);
diff --git a/libxcb/xcb-proto/src/dri2.xml b/libxcb/xcb-proto/src/dri2.xml
index 0160c6ba8..20d664912 100644
--- a/libxcb/xcb-proto/src/dri2.xml
+++ b/libxcb/xcb-proto/src/dri2.xml
@@ -98,7 +98,7 @@ authorization from the authors.
<op op="&amp;">
<op op="+">
<fieldref>driver_name_length</fieldref>
- <value> 3 </value>
+ <value>3</value>
</op>
<unop op="~">
<value>3</value>
diff --git a/libxcb/xcb-proto/src/xf86vidmode.xml b/libxcb/xcb-proto/src/xf86vidmode.xml
index 9dacaef41..a165c11d9 100644
--- a/libxcb/xcb-proto/src/xf86vidmode.xml
+++ b/libxcb/xcb-proto/src/xf86vidmode.xml
@@ -159,7 +159,7 @@ authorization from the authors.
<op op="&amp;">
<op op="+">
<fieldref>vendor_length</fieldref>
- <value> 3 </value>
+ <value>3</value>
</op>
<unop op="~">
<value>3</value>
diff --git a/libxcb/xcb-proto/src/xinput.xml b/libxcb/xcb-proto/src/xinput.xml
index fa115bdcd..924c003c7 100644
--- a/libxcb/xcb-proto/src/xinput.xml
+++ b/libxcb/xcb-proto/src/xinput.xml
@@ -1000,7 +1000,7 @@ authorization from the authors.
<!-- ChangeDeviceProperty -->
<enum name="PropertyFormat">
- <item name="8Bits"> <value> 8</value> </item>
+ <item name="8Bits"> <value>8</value> </item>
<item name="16Bits"> <value>16</value> </item>
<item name="32Bits"> <value>32</value> </item>
</enum>
diff --git a/libxcb/xcb-proto/src/xprint.xml b/libxcb/xcb-proto/src/xprint.xml
index ffd8df1ea..e32293f3b 100644
--- a/libxcb/xcb-proto/src/xprint.xml
+++ b/libxcb/xcb-proto/src/xprint.xml
@@ -235,7 +235,9 @@ authorization from the authors.
<pad bytes="1" />
<field type="CARD32" name="stringLen" />
<pad bytes="20" />
- <field type="STRING8" name="attributes" />
+ <list type="STRING8" name="attributes">
+ <fieldref>stringLen</fieldref>
+ </list>
</reply>
</request>
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 1e5e49667..c71fa2627 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -28,7 +28,7 @@ AC_SUBST([OSMESA_VERSION])
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.38
-LIBDRM_RADEON_REQUIRED=2.4.50
+LIBDRM_RADEON_REQUIRED=2.4.53
LIBDRM_INTEL_REQUIRED=2.4.52
LIBDRM_NVVIEUX_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
@@ -284,15 +284,18 @@ dnl Can't have static and shared libraries, default to static if user
dnl explicitly requested. If both disabled, set to static since shared
dnl was explicitly requested.
case "x$enable_static$enable_shared" in
-xnoyes )
+xyesyes)
+ AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
+ enable_shared=no
;;
-* )
- AC_MSG_WARN([Messa build supports only shared libraries, enabling shared])
+xnono)
+ AC_MSG_WARN([Cannot disable both static and shared libraries, enabling shared])
enable_shared=yes
- enable_static=no
;;
esac
+AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
+
dnl
dnl other compiler options
dnl
@@ -313,6 +316,22 @@ if test "x$enable_debug" = xyes; then
fi
dnl
+dnl Check if linker supports garbage collection
+dnl
+save_LDFLAGS=$LDFLAGS
+LDFLAGS="$LDFLAGS -Wl,--gc-sections"
+AC_MSG_CHECKING([whether ld supports --gc-sections])
+AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
+ [AC_MSG_RESULT([yes])
+ GC_SECTIONS="-Wl,--gc-sections";],
+ [AC_MSG_RESULT([no])
+ GC_SECTIONS="";])
+LDFLAGS=$save_LDFLAGS
+
+AC_SUBST([GC_SECTIONS])
+
+dnl
dnl compatibility symlinks
dnl
case "$host_os" in
@@ -527,11 +546,20 @@ AC_ARG_ENABLE([dri],
[enable DRI modules @<:@default=enabled@:>@])],
[enable_dri="$enableval"],
[enable_dri=yes])
+
+case "$host_os" in
+linux*)
+ dri3_default=yes
+ ;;
+*)
+ dri3_default=no
+ ;;
+esac
AC_ARG_ENABLE([dri3],
[AS_HELP_STRING([--enable-dri3],
- [enable DRI3 @<:@default=enabled@:>@])],
+ [enable DRI3 @<:@default=auto@:>@])],
[enable_dri3="$enableval"],
- [enable_dri3=yes])
+ [enable_dri3="$dri3_default"])
AC_ARG_ENABLE([glx],
[AS_HELP_STRING([--enable-glx],
[enable GLX library @<:@default=enabled@:>@])],
@@ -750,8 +778,8 @@ if test "x$enable_dri" = xyes; then
fi
if test "x$enable_gallium_osmesa" = xyes; then
- if test -z "$with_gallium_drivers"; then
- AC_MSG_ERROR([Cannot enable gallium_osmesa without Gallium])
+ if ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
+ AC_MSG_ERROR([gallium_osmesa requires the gallium swrast driver])
fi
if test "x$enable_osmesa" = xyes; then
AC_MSG_ERROR([Cannot enable both classic and Gallium OSMesa implementations])
@@ -769,10 +797,21 @@ if test "x$have_libdrm" = xyes; then
DEFINES="$DEFINES -DHAVE_LIBDRM"
fi
+case "$host_os" in
+linux*)
+ need_libudev=yes ;;
+*)
+ need_libudev=no ;;
+esac
+
PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED],
have_libudev=yes, have_libudev=no)
if test "x$enable_dri" = xyes; then
+ if test "$enable_static" = yes; then
+ AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
+ fi
+
# not a hard requirement as swrast does not depend on it
if test "x$have_libdrm" = xyes; then
DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED"
@@ -823,9 +862,6 @@ xyesno)
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
if test x"$enable_dri3" = xyes; then
- if test x"$have_libudev" != xyes; then
- AC_MSG_ERROR([DRI3 requires libudev >= $LIBUDEV_REQUIRED])
- fi
PKG_CHECK_MODULES([DRI3PROTO], [dri3proto >= $DRI3PROTO_REQUIRED])
PKG_CHECK_MODULES([PRESENTPROTO], [presentproto >= $PRESENTPROTO_REQUIRED])
fi
@@ -978,7 +1014,7 @@ if test "x$enable_dri" = xyes; then
gnu*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DHAVE_ALIAS"
- ;;
+ ;;
solaris*)
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1"
;;
@@ -996,7 +1032,7 @@ if test "x$enable_dri" = xyes; then
fi
# Check for expat
- PKG_CHECK_EXISTS([EXPAT], [have_expat=yes], [have_expat=no])
+ PKG_CHECK_EXISTS([expat], [have_expat=yes], [have_expat=no])
if test "x$have_expat" = "xyes"; then
PKG_CHECK_MODULES([EXPAT], [expat], [],
AC_MSG_ERROR([Expat required for DRI.]))
@@ -1020,12 +1056,9 @@ if test "x$enable_dri" = xyes; then
# put all the necessary libs together
DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
- GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIBS -lm $CLOCK_LIB $PTHREAD_LIBS $DLOPEN_LIBS"
-
fi
AC_SUBST([DRI_LIB_DEPS])
-AC_SUBST([GALLIUM_DRI_LIB_DEPS])
DRI_DIRS=''
dnl Duplicates in DRI_DIRS are removed by sorting it at the end of this block
@@ -1104,7 +1137,12 @@ x16|x32)
esac
if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then
- OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
+ # only link libraries with osmesa if shared
+ if test "$enable_static" = no; then
+ OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
+ else
+ OSMESA_LIB_DEPS=""
+ fi
OSMESA_MESA_DEPS=""
OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
fi
@@ -1126,7 +1164,7 @@ if test "x$enable_gbm" = xauto; then
esac
fi
if test "x$enable_gbm" = xyes; then
- if test x"$have_libudev" != xyes; then
+ if test "x$need_libudev$have_libudev" = xyesno; then
AC_MSG_ERROR([gbm requires udev >= $LIBUDEV_REQUIRED])
fi
@@ -1138,7 +1176,11 @@ if test "x$enable_gbm" = xyes; then
fi
fi
AM_CONDITIONAL(HAVE_GBM, test "x$enable_gbm" = xyes)
-GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
+if test "x$need_libudev" = xyes; then
+ GBM_PC_REQ_PRIV="libudev >= $LIBUDEV_REQUIRED"
+else
+ GBM_PC_REQ_PRIV=""
+fi
GBM_PC_LIB_PRIV="$DLOPEN_LIBS"
AC_SUBST([GBM_PC_REQ_PRIV])
AC_SUBST([GBM_PC_LIB_PRIV])
@@ -1153,8 +1195,11 @@ if test "x$enable_egl" = xyes; then
AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
- if test "x$enable_dri" = xyes; then
- HAVE_EGL_DRIVER_DRI2=1
+ if test "$enable_static" != yes; then
+ if test "x$enable_dri" = xyes; then
+ HAVE_EGL_DRIVER_DRI2=1
+ fi
+
fi
fi
AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes)
@@ -1252,7 +1297,7 @@ AM_CONDITIONAL(HAVE_OPENVG, test "x$enable_openvg" = xyes)
dnl
dnl Gallium G3DVL configuration
dnl
-if test -n "$with_gallium_drivers"; then
+if test -n "$with_gallium_drivers" && ! echo "$with_gallium_drivers" | grep -q 'swrast'; then
if test "x$enable_xvmc" = xauto; then
PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
fi
@@ -1420,8 +1465,8 @@ for plat in $egl_platforms; do
;;
esac
- case "$plat$have_libudev" in
- waylandno|drmno)
+ case "$plat$need_libudev$have_libudev" in
+ waylandyesno|drmyesno)
AC_MSG_ERROR([cannot build $plat platform without udev >= $LIBUDEV_REQUIRED]) ;;
esac
done
@@ -1435,15 +1480,15 @@ else
EGL_NATIVE_PLATFORM="_EGL_INVALID_PLATFORM"
fi
-if echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1; then
+if echo "$egl_platforms" | grep -q 'x11'; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
NEED_WINSYS_XLIB=yes
fi
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep 'x11' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep 'wayland' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' >/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep -q 'fbdev')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
@@ -1683,7 +1728,7 @@ gallium_require_llvm() {
gallium_require_drm_loader() {
if test "x$enable_gallium_loader" = xyes; then
- if test "x$have_libudev" != xyes; then
+ if test "x$need_libudev$have_libudev" = xyesno; then
AC_MSG_ERROR([Gallium drm loader requires libudev >= $LIBUDEV_REQUIRED])
fi
if test "x$have_libdrm" != xyes; then
@@ -1955,9 +2000,14 @@ AC_SUBST([VDPAU_MINOR], 0)
AC_SUBST([XVMC_MAJOR], 1)
AC_SUBST([XVMC_MINOR], 0)
-AC_SUBST([XA_MAJOR], 2)
-AC_SUBST([XA_MINOR], 2)
-AC_SUBST([XA_TINY], 0)
+XA_HEADER="$srcdir/src/gallium/state_trackers/xa/xa_tracker.h"
+XA_MAJOR=`grep "#define XA_TRACKER_VERSION_MAJOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MAJOR //'`
+XA_MINOR=`grep "#define XA_TRACKER_VERSION_MINOR" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_MINOR //'`
+XA_TINY=`grep "#define XA_TRACKER_VERSION_PATCH" $XA_HEADER | $SED 's/^#define XA_TRACKER_VERSION_PATCH //'`
+
+AC_SUBST([XA_MAJOR], $XA_MAJOR)
+AC_SUBST([XA_MINOR], $XA_MINOR)
+AC_SUBST([XA_TINY], $XA_TINY)
AC_SUBST([XA_VERSION], "$XA_MAJOR.$XA_MINOR.$XA_TINY")
dnl Restore LDFLAGS and CPPFLAGS
@@ -1977,8 +2027,6 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([Makefile
src/Makefile
- src/egl/Makefile
- src/egl/drivers/Makefile
src/egl/drivers/dri2/Makefile
src/egl/main/Makefile
src/egl/main/egl.pc
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index b7e4c8764..0b663dd34 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -97,17 +97,28 @@ GL 3.3 --- all DONE: i965, nv50, nvc0, r600, radeonsi
GL 4.0:
GLSL 4.0 not started
- GL_ARB_texture_query_lod DONE (i965)
+ GL_ARB_texture_query_lod DONE (i965, nv50, nvc0)
GL_ARB_draw_buffers_blend DONE (i965, nv50, nvc0, r600, radeonsi, softpipe)
GL_ARB_draw_indirect DONE (i965)
GL_ARB_gpu_shader5 started
+ - 'precise' qualifier not started
+ - Dynamically uniform sampler array indices not started
+ - Dynamically uniform UBO array indices not started
+ - Implicit signed -> unsigned conversions not started
+ - Fused multiply-add DONE
+ - Packing/bitfield/conversion functions DONE
+ - Enhanced textureGather DONE
+ - Geometry shader instancing DONE
+ - Geometry shader multiple streams not started
+ - Enhanced per-sample shading DONE
+ - Interpolation functions started
GL_ARB_gpu_shader_fp64 not started
GL_ARB_sample_shading DONE (i965)
GL_ARB_shader_subroutine not started
GL_ARB_tessellation_shader not started
GL_ARB_texture_buffer_object_rgb32 DONE (i965, nvc0, r600, radeonsi, softpipe)
GL_ARB_texture_cube_map_array DONE (i965, nv50, nvc0, r600, softpipe)
- GL_ARB_texture_gather DONE (i965, nv50)
+ GL_ARB_texture_gather DONE (i965, nv50, nvc0)
GL_ARB_transform_feedback2 DONE (i965, nv50, nvc0, r600, radeonsi)
GL_ARB_transform_feedback3 DONE (i965, nv50, nvc0, r600, radeonsi)
@@ -162,7 +173,7 @@ GL 4.3:
GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi)
GL_ARB_texture_query_levels DONE (i965)
GL_ARB_texture_storage_multisample DONE (all drivers that support GL_ARB_texture_multisample)
- GL_ARB_texture_view started (Courtney Goeltzenleuchter, Chris Forbes)
+ GL_ARB_texture_view DONE (i965)
GL_ARB_vertex_attrib_binding DONE (all drivers)
diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html
index d4a6dfb59..67c1f34bd 100644
--- a/mesalib/docs/devinfo.html
+++ b/mesalib/docs/devinfo.html
@@ -56,6 +56,11 @@ To add a new GL extension to Mesa you have to do at least the following.
If the new extension adds new GL state, the functions in get.c, enable.c
and attrib.c will most likely require new code.
</li>
+<li>
+ The dispatch tests check_table.cpp and dispatch_sanity.cpp
+ should be updated with details about the new extensions functions. These
+ tests are run using 'make check'
+</li>
</ul>
diff --git a/mesalib/docs/relnotes/10.2.html b/mesalib/docs/relnotes/10.2.html
index da79e7d80..d7d557bd0 100644
--- a/mesalib/docs/relnotes/10.2.html
+++ b/mesalib/docs/relnotes/10.2.html
@@ -44,8 +44,9 @@ Note: some of the new features are only available with certain drivers.
</p>
<ul>
-<li>GL_ARB_buffer_storage on r300, r600, and radeonsi</li>
+<li>GL_ARB_buffer_storage on i965, r300, r600, and radeonsi</li>
<li>GL_ARB_stencil_texturing on i965/gen8+</li>
+<li>GL_ARB_texture_view on i965/gen7</li>
</ul>
diff --git a/mesalib/include/GLES2/gl2ext.h b/mesalib/include/GLES2/gl2ext.h
index 2a84c4d81..a5e3f47d6 100644
--- a/mesalib/include/GLES2/gl2ext.h
+++ b/mesalib/include/GLES2/gl2ext.h
@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
-** Copyright (c) 2013 The Khronos Group Inc.
+** Copyright (c) 2013-2014 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
@@ -33,14 +33,14 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
-** Khronos $Revision: 24614 $ on $Date: 2013-12-30 04:44:46 -0800 (Mon, 30 Dec 2013) $
+** Khronos $Revision: 25922 $ on $Date: 2014-03-17 03:54:32 -0700 (Mon, 17 Mar 2014) $
*/
#ifndef GL_APIENTRYP
#define GL_APIENTRYP GL_APIENTRY*
#endif
-/* Generated on date 20131230 */
+/* Generated on date 20140317 */
/* Generated C header for:
* API: gles2
@@ -52,6 +52,30 @@ extern "C" {
* Extensions removed: _nomatch_^
*/
+#ifndef GL_KHR_blend_equation_advanced
+#define GL_KHR_blend_equation_advanced 1
+#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
+#define GL_MULTIPLY_KHR 0x9294
+#define GL_SCREEN_KHR 0x9295
+#define GL_OVERLAY_KHR 0x9296
+#define GL_DARKEN_KHR 0x9297
+#define GL_LIGHTEN_KHR 0x9298
+#define GL_COLORDODGE_KHR 0x9299
+#define GL_COLORBURN_KHR 0x929A
+#define GL_HARDLIGHT_KHR 0x929B
+#define GL_SOFTLIGHT_KHR 0x929C
+#define GL_DIFFERENCE_KHR 0x929E
+#define GL_EXCLUSION_KHR 0x92A0
+#define GL_HSL_HUE_KHR 0x92AD
+#define GL_HSL_SATURATION_KHR 0x92AE
+#define GL_HSL_COLOR_KHR 0x92AF
+#define GL_HSL_LUMINOSITY_KHR 0x92B0
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
+#endif
+#endif /* GL_KHR_blend_equation_advanced */
+
#ifndef GL_KHR_debug
#define GL_KHR_debug 1
typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
@@ -277,6 +301,31 @@ GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname,
#define GL_OES_rgb8_rgba8 1
#endif /* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_sample_shading
+#define GL_OES_sample_shading 1
+#define GL_SAMPLE_SHADING_OES 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
+#endif
+#endif /* GL_OES_sample_shading */
+
+#ifndef GL_OES_sample_variables
+#define GL_OES_sample_variables 1
+#endif /* GL_OES_sample_variables */
+
+#ifndef GL_OES_shader_image_atomic
+#define GL_OES_shader_image_atomic 1
+#endif /* GL_OES_shader_image_atomic */
+
+#ifndef GL_OES_shader_multisample_interpolation
+#define GL_OES_shader_multisample_interpolation 1
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
+#endif /* GL_OES_shader_multisample_interpolation */
+
#ifndef GL_OES_standard_derivatives
#define GL_OES_standard_derivatives 1
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
@@ -366,6 +415,25 @@ GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum att
#define GL_OES_texture_npot 1
#endif /* GL_OES_texture_npot */
+#ifndef GL_OES_texture_stencil8
+#define GL_OES_texture_stencil8 1
+#define GL_STENCIL_INDEX_OES 0x1901
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif /* GL_OES_texture_stencil8 */
+
+#ifndef GL_OES_texture_storage_multisample_2d_array
+#define GL_OES_texture_storage_multisample_2d_array 1
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_OES_texture_storage_multisample_2d_array */
+
#ifndef GL_OES_vertex_array_object
#define GL_OES_vertex_array_object 1
#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
@@ -613,6 +681,16 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei
#define GL_ARM_rgba8 1
#endif /* GL_ARM_rgba8 */
+#ifndef GL_ARM_shader_framebuffer_fetch
+#define GL_ARM_shader_framebuffer_fetch 1
+#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
+#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
+#endif /* GL_ARM_shader_framebuffer_fetch */
+
+#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
+#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
+#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
+
#ifndef GL_DMP_shader_binary
#define GL_DMP_shader_binary 1
#define GL_SHADER_BINARY_DMP 0x9250
@@ -990,6 +1068,13 @@ GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLin
#define GL_EXT_shader_integer_mix 1
#endif /* GL_EXT_shader_integer_mix */
+#ifndef GL_EXT_shader_pixel_local_storage
+#define GL_EXT_shader_pixel_local_storage 1
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
+#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
+#endif /* GL_EXT_shader_pixel_local_storage */
+
#ifndef GL_EXT_shader_texture_lod
#define GL_EXT_shader_texture_lod 1
#endif /* GL_EXT_shader_texture_lod */
diff --git a/mesalib/include/GLES3/gl31.h b/mesalib/include/GLES3/gl31.h
new file mode 100644
index 000000000..cb41e981b
--- /dev/null
+++ b/mesalib/include/GLES3/gl31.h
@@ -0,0 +1,1184 @@
+#ifndef __gl31_h_
+#define __gl31_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are 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 Materials.
+**
+** THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision$ on $Date$
+*/
+
+#include <GLES3/gl3platform.h>
+
+/* Generated on date 20140317 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2.[0-9]|3.[01]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_NONE 0
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef unsigned short GLhalf;
+#define GL_READ_BUFFER 0x0C02
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_RED 0x1903
+#define GL_RGB8 0x8051
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_RGBA32F 0x8814
+#define GL_RGB32F 0x8815
+#define GL_RGBA16F 0x881A
+#define GL_RGB16F 0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_RGB9_E5 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI 0x8D70
+#define GL_RGB32UI 0x8D71
+#define GL_RGBA16UI 0x8D76
+#define GL_RGB16UI 0x8D77
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGB8UI 0x8D7D
+#define GL_RGBA32I 0x8D82
+#define GL_RGB32I 0x8D83
+#define GL_RGBA16I 0x8D88
+#define GL_RGB16I 0x8D89
+#define GL_RGBA8I 0x8D8E
+#define GL_RGB8I 0x8D8F
+#define GL_RED_INTEGER 0x8D94
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_HALF_FLOAT 0x140B
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_RG8 0x822B
+#define GL_R16F 0x822D
+#define GL_R32F 0x822E
+#define GL_RG16F 0x822F
+#define GL_RG32F 0x8230
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_COPY_READ_BUFFER_BINDING 0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_OBJECT_TYPE 0x9112
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_STATUS 0x9114
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_UNSIGNALED 0x9118
+#define GL_SIGNALED 0x9119
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_WAIT_FAILED 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_RGB10_A2UI 0x906F
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS 0x87FF
+#define GL_COMPRESSED_R11_EAC 0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
+#define GL_COMPRESSED_RG11_EAC 0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
+#define GL_COMPRESSED_RGB8_ETC2 0x9274
+#define GL_COMPRESSED_SRGB8_ETC2 0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifndef GL_ES_VERSION_3_1
+#define GL_ES_VERSION_3_1 1
+#define GL_COMPUTE_SHADER 0x91B9
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
+#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_COMPUTE_SHADER_BIT 0x00000020
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#define GL_MAX_UNIFORM_LOCATIONS 0x826E
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
+#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
+#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
+#define GL_UNIFORM 0x92E1
+#define GL_UNIFORM_BLOCK 0x92E2
+#define GL_PROGRAM_INPUT 0x92E3
+#define GL_PROGRAM_OUTPUT 0x92E4
+#define GL_BUFFER_VARIABLE 0x92E5
+#define GL_SHADER_STORAGE_BLOCK 0x92E6
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
+#define GL_ACTIVE_RESOURCES 0x92F5
+#define GL_MAX_NAME_LENGTH 0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
+#define GL_NAME_LENGTH 0x92F9
+#define GL_TYPE 0x92FA
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_OFFSET 0x92FC
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
+#define GL_NUM_ACTIVE_VARIABLES 0x9304
+#define GL_ACTIVE_VARIABLES 0x9305
+#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
+#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
+#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
+#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
+#define GL_LOCATION 0x930E
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#define GL_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#define GL_IMAGE_BINDING_NAME 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED 0x8F3C
+#define GL_IMAGE_BINDING_LAYER 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS 0x8F3E
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_COMMAND_BARRIER_BIT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
+#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_READ_ONLY 0x88B8
+#define GL_WRITE_ONLY 0x88B9
+#define GL_READ_WRITE 0x88BA
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
+#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
+#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
+#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
+#define GL_STENCIL_INDEX 0x1901
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_VERTEX_ATTRIB_BINDING 0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
+#define GL_VERTEX_BINDING_DIVISOR 0x82D6
+#define GL_VERTEX_BINDING_OFFSET 0x82D7
+#define GL_VERTEX_BINDING_STRIDE 0x82D8
+#define GL_VERTEX_BINDING_BUFFER 0x8F4F
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
+#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
+GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
+GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
+GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
+GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
+GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
+#endif /* GL_ES_VERSION_3_1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mesalib/include/GLES3/gl3platform.h b/mesalib/include/GLES3/gl3platform.h
index 1bd1a850f..b1e869dd1 100644
--- a/mesalib/include/GLES3/gl3platform.h
+++ b/mesalib/include/GLES3/gl3platform.h
@@ -1,7 +1,7 @@
#ifndef __gl3platform_h_
#define __gl3platform_h_
-/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
/*
* This document is licensed under the SGI Free Software B License Version
diff --git a/mesalib/install-gallium-links.mk b/mesalib/install-gallium-links.mk
index 5ee923b25..757b28870 100644
--- a/mesalib/install-gallium-links.mk
+++ b/mesalib/install-gallium-links.mk
@@ -1,6 +1,7 @@
# Provide compatibility with scripts for the old Mesa build system for
# a while by putting a link to the driver into /lib of the build tree.
+if BUILD_SHARED
if HAVE_COMPAT_SYMLINKS
all-local : .libs/install-gallium-links
@@ -11,7 +12,7 @@ all-local : .libs/install-gallium-links
link_dir=$(top_builddir)/$(LIB_DIR)/egl; \
fi; \
$(MKDIR_P) $$link_dir; \
- file_list=$(dri_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
+ file_list=$(dri_LTLIBRARIES:%.la=.libs/%.so); \
file_list+=$(vdpau_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \
@@ -23,3 +24,4 @@ all-local : .libs/install-gallium-links
fi; \
done && touch $@
endif
+endif
diff --git a/mesalib/install-lib-links.mk b/mesalib/install-lib-links.mk
index 0e1371987..09fb86a0b 100644
--- a/mesalib/install-lib-links.mk
+++ b/mesalib/install-lib-links.mk
@@ -1,6 +1,7 @@
# Provide compatibility with scripts for the old Mesa build system for
# a while by putting a link to the driver into /lib of the build tree.
+if BUILD_SHARED
if HAVE_COMPAT_SYMLINKS
all-local : .libs/install-mesa-links
@@ -14,3 +15,4 @@ all-local : .libs/install-mesa-links
fi; \
done && touch $@
endif
+endif
diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am
index 5b2549d9d..9d1580f90 100644
--- a/mesalib/src/Makefile.am
+++ b/mesalib/src/Makefile.am
@@ -33,12 +33,16 @@ if HAVE_EGL_PLATFORM_WAYLAND
SUBDIRS += egl/wayland
endif
+if HAVE_EGL_DRIVER_DRI2
+SUBDIRS += egl/drivers/dri2
+endif
+
if HAVE_GBM
SUBDIRS += gbm
endif
if HAVE_EGL
-SUBDIRS += egl
+SUBDIRS += egl/main
endif
if HAVE_GALLIUM
@@ -55,3 +59,5 @@ SUBDIRS += \
gallium/tests/unit
endif
endif
+
+EXTRA_DIST = getopt
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc
index 1acc99ef5..1f5d532e4 100644
--- a/mesalib/src/gallium/Automake.inc
+++ b/mesalib/src/gallium/Automake.inc
@@ -54,41 +54,72 @@ GALLIUM_VIDEO_CFLAGS = \
DRI_VERSION_SCRIPT ?= $(top_srcdir)/src/gallium/state_trackers/dri/dri.link
GALLIUM_DRI_LINKER_FLAGS = \
+ -shared \
+ -shrext .so \
-module \
-avoid-version \
- -Wl,--version-script=$(DRI_VERSION_SCRIPT) \
- -shared \
- -no-undefined
+ $(GC_SECTIONS) \
+ -Wl,--version-script=$(DRI_VERSION_SCRIPT)
GALLIUM_VDPAU_LINKER_FLAGS = \
+ -shared \
-module \
+ -no-undefined \
-version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-export-symbols-regex $(VDPAU_EXPORTS) \
- -shared \
- -no-undefined
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
GALLIUM_XVMC_LINKER_FLAGS = \
+ -shared \
-module \
+ -no-undefined \
-version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
- -shared \
-export-symbols-regex '^XvMC' \
- -no-undefined
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
+
+GALLIUM_OMX_LINKER_FLAGS = \
+ -shared \
+ -module \
+ -no-undefined \
+ -export-symbols-regex $(EXPORTS) \
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
+
+GALLIUM_COMMON_LIB_DEPS = \
+ -lm \
+ $(CLOCK_LIB) \
+ $(PTHREAD_LIBS) \
+ $(DLOPEN_LIBS)
+
+GALLIUM_DRI_LIB_DEPS = \
+ $(top_builddir)/src/mesa/libmesagallium.la \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(SELINUX_LIBS) \
+ $(LIBDRM_LIBS) \
+ $(EXPAT_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_VDPAU_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
$(VDPAU_LIBS) \
$(LIBDRM_LIBS) \
- -lm \
- $(CLOCK_LIB) \
- $(PTHREAD_LIBS) \
- $(DLOPEN_LIBS)
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_XVMC_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
$(XVMC_LIBS) \
- $(LIBDRM_LIBS)
+ $(LIBDRM_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
+
+GALLIUM_OMX_LIB_DEPS = \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
+ $(OMX_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/include \
@@ -96,3 +127,17 @@ GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary \
$(DEFINES) \
$(VISIBILITY_CFLAGS)
+
+if HAVE_MESA_LLVM
+
+GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_VDPAU_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_XVMC_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
+
+GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_VDPAU_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
+
+endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 1e7f374ab..7b058fe22 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -688,7 +688,7 @@ static void set_texcoords_in_vertices(const float coord[4],
static void blitter_set_texcoords(struct blitter_context_priv *ctx,
struct pipe_sampler_view *src,
unsigned src_width0, unsigned src_height0,
- unsigned layer, unsigned sample,
+ float layer, unsigned sample,
int x1, int y1, int x2, int y2)
{
unsigned i;
@@ -700,11 +700,11 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
if (src->texture->target == PIPE_TEXTURE_CUBE ||
src->texture->target == PIPE_TEXTURE_CUBE_ARRAY) {
set_texcoords_in_vertices(coord, &face_coord[0][0], 2);
- util_map_texcoords2d_onto_cubemap(layer % 6,
+ util_map_texcoords2d_onto_cubemap((unsigned)layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
&ctx->vertices[0][1][0], 8,
- TRUE);
+ FALSE);
} else {
set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
}
@@ -734,7 +734,7 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
case PIPE_TEXTURE_CUBE_ARRAY:
for (i = 0; i < 4; i++)
- ctx->vertices[i][1][3] = (float) (layer / 6); /*w*/
+ ctx->vertices[i][1][3] = (float) ((unsigned)layer / 6); /*w*/
break;
case PIPE_TEXTURE_2D:
@@ -1528,9 +1528,31 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
- int z;
- for (z = 0; z < dstbox->depth; z++) {
+ int dst_z;
+ for (dst_z = 0; dst_z < dstbox->depth; dst_z++) {
struct pipe_surface *old;
+ float dst2src_scale = srcbox->depth / (float)dstbox->depth;
+
+ /* Scale Z properly if the blit is scaled.
+ *
+ * When downscaling, we want the coordinates centered, so that
+ * mipmapping works for 3D textures. For example, when generating
+ * a 4x4x4 level, this wouldn't average the pixels:
+ *
+ * src Z: 0 1 2 3 4 5 6 7
+ * dst Z: 0 1 2 3
+ *
+ * Because the pixels are not centered below the pixels of the higher
+ * level. Therefore, we want this:
+ * src Z: 0 1 2 3 4 5 6 7
+ * dst Z: 0 1 2 3
+ *
+ * dst_offset defines the offset needed for centering the pixels and
+ * it works with any scaling (not just 2x).
+ */
+ float dst_offset = ((srcbox->depth - 1) -
+ (dstbox->depth - 1) * dst2src_scale) * 0.5;
+ float src_z = (dst_z + dst_offset) * dst2src_scale;
/* Set framebuffer state. */
if (blit_depth || blit_stencil) {
@@ -1548,7 +1570,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
for (i = 0; i <= max_sample; i++) {
pipe->set_sample_mask(pipe, 1 << i);
blitter_set_texcoords(ctx, src, src_width0, src_height0,
- srcbox->z + z,
+ srcbox->z + src_z,
i, srcbox->x, srcbox->y,
srcbox->x + srcbox->width,
srcbox->y + srcbox->height);
@@ -1560,7 +1582,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
/* Normal copy, MSAA upsampling, or MSAA resolve. */
pipe->set_sample_mask(pipe, ~0);
blitter_set_texcoords(ctx, src, src_width0, src_height0,
- srcbox->z + z, 0,
+ srcbox->z + src_z, 0,
srcbox->x, srcbox->y,
srcbox->x + srcbox->width,
srcbox->y + srcbox->height);
@@ -1572,10 +1594,10 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
/* Get the next surface or (if this is the last iteration)
* just unreference the last one. */
old = dst;
- if (z < dstbox->depth-1) {
+ if (dst_z < dstbox->depth-1) {
dst = ctx->base.get_next_surface_layer(ctx->base.pipe, dst);
}
- if (z) {
+ if (dst_z) {
pipe_surface_reference(&old, NULL);
}
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index a2f42189f..aa8eaebb6 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -3,6 +3,7 @@
* Copyright 2008 VMware, Inc.
* All Rights Reserved.
* Copyright 2008 VMware, Inc. All rights reserved.
+ * Copyright 2014 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -30,509 +31,98 @@
* @file
* Mipmap generation utility
*
- * @author Brian Paul
+ * @author Brian Paul, Marek Olšák
*/
-#include "pipe/p_context.h"
-#include "util/u_debug.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "pipe/p_shader_tokens.h"
-#include "pipe/p_state.h"
-
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_draw_quad.h"
#include "util/u_gen_mipmap.h"
-#include "util/u_simple_shaders.h"
-#include "util/u_math.h"
-#include "util/u_texture.h"
-#include "util/u_half.h"
-#include "util/u_surface.h"
-
-#include "cso_cache/cso_context.h"
-
-
-struct gen_mipmap_state
-{
- struct pipe_context *pipe;
- struct cso_context *cso;
-
- struct pipe_blend_state blend_keep_color, blend_write_color;
- struct pipe_depth_stencil_alpha_state dsa_keep_depth, dsa_write_depth;
- struct pipe_rasterizer_state rasterizer;
- struct pipe_sampler_state sampler;
- struct pipe_vertex_element velem[2];
-
- void *vs;
-
- /** Not all are used, but simplifies code */
- void *fs_color[TGSI_TEXTURE_COUNT];
- void *fs_depth[TGSI_TEXTURE_COUNT];
-
- struct pipe_resource *vbuf; /**< quad vertices */
- unsigned vbuf_slot;
-
- float vertices[4][2][4]; /**< vertex/texcoords for quad */
-};
-
-
-/**
- * Create a mipmap generation context.
- * The idea is to create one of these and re-use it each time we need to
- * generate a mipmap.
- */
-struct gen_mipmap_state *
-util_create_gen_mipmap(struct pipe_context *pipe,
- struct cso_context *cso)
-{
- struct gen_mipmap_state *ctx;
- uint i;
-
- ctx = CALLOC_STRUCT(gen_mipmap_state);
- if (!ctx)
- return NULL;
-
- ctx->pipe = pipe;
- ctx->cso = cso;
-
- /* disabled blending/masking */
- memset(&ctx->blend_keep_color, 0, sizeof(ctx->blend_keep_color));
- memset(&ctx->blend_write_color, 0, sizeof(ctx->blend_write_color));
- ctx->blend_write_color.rt[0].colormask = PIPE_MASK_RGBA;
-
- /* no-op depth/stencil/alpha */
- memset(&ctx->dsa_keep_depth, 0, sizeof(ctx->dsa_keep_depth));
- memset(&ctx->dsa_write_depth, 0, sizeof(ctx->dsa_write_depth));
- ctx->dsa_write_depth.depth.enabled = 1;
- ctx->dsa_write_depth.depth.func = PIPE_FUNC_ALWAYS;
- ctx->dsa_write_depth.depth.writemask = 1;
-
- /* rasterizer */
- memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
- ctx->rasterizer.cull_face = PIPE_FACE_NONE;
- ctx->rasterizer.half_pixel_center = 1;
- ctx->rasterizer.bottom_edge_rule = 1;
- ctx->rasterizer.depth_clip = 1;
-
- /* sampler state */
- memset(&ctx->sampler, 0, sizeof(ctx->sampler));
- ctx->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
- ctx->sampler.normalized_coords = 1;
-
- /* vertex elements state */
- memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
- for (i = 0; i < 2; i++) {
- ctx->velem[i].src_offset = i * 4 * sizeof(float);
- ctx->velem[i].instance_divisor = 0;
- ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso);
- ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- }
-
- /* vertex data that doesn't change */
- for (i = 0; i < 4; i++) {
- ctx->vertices[i][0][2] = 0.0f; /* z */
- ctx->vertices[i][0][3] = 1.0f; /* w */
- ctx->vertices[i][1][3] = 1.0f; /* q */
- }
-
- /* Note: the actual vertex buffer is allocated as needed below */
-
- return ctx;
-}
-
-
-/**
- * Helper function to set the fragment shaders.
- */
-static INLINE void
-set_fragment_shader(struct gen_mipmap_state *ctx, uint type,
- boolean output_depth)
-{
- if (output_depth) {
- if (!ctx->fs_depth[type])
- ctx->fs_depth[type] =
- util_make_fragment_tex_shader_writedepth(ctx->pipe, type,
- TGSI_INTERPOLATE_LINEAR);
-
- cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth[type]);
- }
- else {
- if (!ctx->fs_color[type])
- ctx->fs_color[type] =
- util_make_fragment_tex_shader(ctx->pipe, type,
- TGSI_INTERPOLATE_LINEAR);
-
- cso_set_fragment_shader_handle(ctx->cso, ctx->fs_color[type]);
- }
-}
-
-
-/**
- * Helper function to set the vertex shader.
- */
-static INLINE void
-set_vertex_shader(struct gen_mipmap_state *ctx)
-{
- /* vertex shader - still required to provide the linkage between
- * fragment shader input semantics and vertex_element/buffers.
- */
- if (!ctx->vs)
- {
- const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
- TGSI_SEMANTIC_GENERIC };
- const uint semantic_indexes[] = { 0, 0 };
- ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2,
- semantic_names,
- semantic_indexes);
- }
-
- cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
-}
-
-
-/**
- * Get next "slot" of vertex space in the vertex buffer.
- * We're allocating one large vertex buffer and using it piece by piece.
- */
-static unsigned
-get_next_slot(struct gen_mipmap_state *ctx)
-{
- const unsigned max_slots = 4096 / sizeof ctx->vertices;
-
- if (ctx->vbuf_slot >= max_slots) {
- pipe_resource_reference(&ctx->vbuf, NULL);
- ctx->vbuf_slot = 0;
- }
-
- if (!ctx->vbuf) {
- ctx->vbuf = pipe_buffer_create(ctx->pipe->screen,
- PIPE_BIND_VERTEX_BUFFER,
- PIPE_USAGE_STREAM,
- max_slots * sizeof ctx->vertices);
- }
-
- return ctx->vbuf_slot++ * sizeof ctx->vertices;
-}
-
-
-static unsigned
-set_vertex_data(struct gen_mipmap_state *ctx,
- enum pipe_texture_target tex_target,
- uint face, float r)
-{
- unsigned offset;
-
- /* vert[0].position */
- ctx->vertices[0][0][0] = -1.0f; /*x*/
- ctx->vertices[0][0][1] = -1.0f; /*y*/
-
- /* vert[1].position */
- ctx->vertices[1][0][0] = 1.0f;
- ctx->vertices[1][0][1] = -1.0f;
-
- /* vert[2].position */
- ctx->vertices[2][0][0] = 1.0f;
- ctx->vertices[2][0][1] = 1.0f;
-
- /* vert[3].position */
- ctx->vertices[3][0][0] = -1.0f;
- ctx->vertices[3][0][1] = 1.0f;
-
- /* Setup vertex texcoords. This is a little tricky for cube maps. */
- if (tex_target == PIPE_TEXTURE_CUBE ||
- tex_target == PIPE_TEXTURE_CUBE_ARRAY) {
- static const float st[4][2] = {
- {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
- };
-
- util_map_texcoords2d_onto_cubemap(face, &st[0][0], 2,
- &ctx->vertices[0][1][0], 8,
- FALSE);
-
- /* set the layer for cube arrays */
- ctx->vertices[0][1][3] = r;
- ctx->vertices[1][1][3] = r;
- ctx->vertices[2][1][3] = r;
- ctx->vertices[3][1][3] = r;
- }
- else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
- /* 1D texture array */
- ctx->vertices[0][1][0] = 0.0f; /*s*/
- ctx->vertices[0][1][1] = r; /*t*/
- ctx->vertices[0][1][2] = 0.0f; /*r*/
-
- ctx->vertices[1][1][0] = 1.0f;
- ctx->vertices[1][1][1] = r;
- ctx->vertices[1][1][2] = 0.0f;
-
- ctx->vertices[2][1][0] = 1.0f;
- ctx->vertices[2][1][1] = r;
- ctx->vertices[2][1][2] = 0.0f;
-
- ctx->vertices[3][1][0] = 0.0f;
- ctx->vertices[3][1][1] = r;
- ctx->vertices[3][1][2] = 0.0f;
- } else {
- /* 1D/2D/3D/2D array */
- ctx->vertices[0][1][0] = 0.0f; /*s*/
- ctx->vertices[0][1][1] = 0.0f; /*t*/
- ctx->vertices[0][1][2] = r; /*r*/
-
- ctx->vertices[1][1][0] = 1.0f;
- ctx->vertices[1][1][1] = 0.0f;
- ctx->vertices[1][1][2] = r;
-
- ctx->vertices[2][1][0] = 1.0f;
- ctx->vertices[2][1][1] = 1.0f;
- ctx->vertices[2][1][2] = r;
-
- ctx->vertices[3][1][0] = 0.0f;
- ctx->vertices[3][1][1] = 1.0f;
- ctx->vertices[3][1][2] = r;
- }
-
- offset = get_next_slot( ctx );
-
- pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf,
- offset, sizeof(ctx->vertices), ctx->vertices);
-
- return offset;
-}
-
-
-
-/**
- * Destroy a mipmap generation context
- */
-void
-util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
-{
- struct pipe_context *pipe = ctx->pipe;
- unsigned i;
-
- for (i = 0; i < Elements(ctx->fs_color); i++)
- if (ctx->fs_color[i])
- pipe->delete_fs_state(pipe, ctx->fs_color[i]);
-
- for (i = 0; i < Elements(ctx->fs_depth); i++)
- if (ctx->fs_depth[i])
- pipe->delete_fs_state(pipe, ctx->fs_depth[i]);
-
- if (ctx->vs)
- pipe->delete_vs_state(pipe, ctx->vs);
-
- pipe_resource_reference(&ctx->vbuf, NULL);
-
- FREE(ctx);
-}
+#include "util/u_format.h"
+#include "util/u_inlines.h"
/**
* Generate mipmap images. It's assumed all needed texture memory is
* already allocated.
*
- * \param psv the sampler view to the texture to generate mipmap levels for
- * \param face which cube face to generate mipmaps for (0 for non-cube maps)
- * \param baseLevel the first mipmap level to use as a src
- * \param lastLevel the last mipmap level to generate
+ * \param pt the texture to generate mipmap levels for
+ * \param format format of texture
+ * \param first_layer the first layer to generate mipmap levels for
+ * (ignored for 3D textures)
+ * \param last_layer the last layer to generate mipmap levels for
+ * (ignored for 3D textures)
+ * \param base_level the first mipmap level to use as a src
+ * \param last_level the last mipmap level to generate
* \param filter the minification filter used to generate mipmap levels with
- * \param filter one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST
+ * one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST
*/
-void
-util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_sampler_view *psv,
- uint face, uint baseLevel, uint lastLevel, uint filter)
+boolean
+util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt,
+ enum pipe_format format, uint base_level, uint last_level,
+ uint first_layer, uint last_layer, uint filter)
{
- struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_framebuffer_state fb;
- struct pipe_resource *pt = psv->texture;
+ struct pipe_blit_info blit;
uint dstLevel;
- uint offset;
- uint type;
- boolean is_depth = util_format_is_depth_or_stencil(psv->format);
+ boolean is_zs = util_format_is_depth_or_stencil(format);
+ boolean has_depth =
+ util_format_has_depth(util_format_description(format));
+
+ /* nothing to do for stencil-only formats */
+ if (is_zs && !has_depth)
+ return TRUE;
+
+ /* nothing to do for integer formats */
+ if (!is_zs && util_format_is_pure_integer(format))
+ return TRUE;
+
+ if (!screen->is_format_supported(screen, format, pt->target,
+ pt->nr_samples,
+ PIPE_BIND_SAMPLER_VIEW |
+ (is_zs ? PIPE_BIND_DEPTH_STENCIL :
+ PIPE_BIND_RENDER_TARGET))) {
+ return FALSE;
+ }
/* The texture object should have room for the levels which we're
* about to generate.
*/
- assert(lastLevel <= pt->last_level);
+ assert(last_level <= pt->last_level);
/* If this fails, why are we here? */
- assert(lastLevel > baseLevel);
-
+ assert(last_level > base_level);
assert(filter == PIPE_TEX_FILTER_LINEAR ||
filter == PIPE_TEX_FILTER_NEAREST);
- type = util_pipe_tex_to_tgsi_tex(pt->target, 1);
-
- /* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, psv->format, pt->target,
- pt->nr_samples,
- is_depth ? PIPE_BIND_DEPTH_STENCIL :
- PIPE_BIND_RENDER_TARGET)) {
- /* The caller should check if the format is renderable. */
- assert(0);
- return;
- }
-
- /* save state (restored below) */
- cso_save_blend(ctx->cso);
- cso_save_depth_stencil_alpha(ctx->cso);
- cso_save_rasterizer(ctx->cso);
- cso_save_sample_mask(ctx->cso);
- cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_save_stream_outputs(ctx->cso);
- cso_save_framebuffer(ctx->cso);
- cso_save_fragment_shader(ctx->cso);
- cso_save_vertex_shader(ctx->cso);
- cso_save_geometry_shader(ctx->cso);
- cso_save_viewport(ctx->cso);
- cso_save_vertex_elements(ctx->cso);
- cso_save_aux_vertex_buffer_slot(ctx->cso);
- cso_save_render_condition(ctx->cso);
+ memset(&blit, 0, sizeof(blit));
+ blit.src.resource = blit.dst.resource = pt;
+ blit.src.format = blit.dst.format = format;
+ /* don't set the stencil mask, stencil shouldn't be changed */
+ blit.mask = is_zs ? PIPE_MASK_Z : PIPE_MASK_RGBA;
+ blit.filter = filter;
- /* bind our state */
- cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color :
- &ctx->blend_write_color);
- cso_set_depth_stencil_alpha(ctx->cso, is_depth ? &ctx->dsa_write_depth :
- &ctx->dsa_keep_depth);
- cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_sample_mask(ctx->cso, ~0);
- cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
- cso_set_stream_outputs(ctx->cso, 0, NULL, NULL);
- cso_set_render_condition(ctx->cso, NULL, FALSE, 0);
+ for (dstLevel = base_level + 1; dstLevel <= last_level; dstLevel++) {
+ blit.src.level = dstLevel - 1;
+ blit.dst.level = dstLevel;
- set_fragment_shader(ctx, type, is_depth);
- set_vertex_shader(ctx);
- cso_set_geometry_shader_handle(ctx->cso, NULL);
+ blit.src.box.width = u_minify(pt->width0, blit.src.level);
+ blit.src.box.height = u_minify(pt->height0, blit.src.level);
- /* init framebuffer state */
- memset(&fb, 0, sizeof(fb));
+ blit.dst.box.width = u_minify(pt->width0, blit.dst.level);
+ blit.dst.box.height = u_minify(pt->height0, blit.dst.level);
- /* set min/mag to same filter for faster sw speed */
- ctx->sampler.mag_img_filter = filter;
- ctx->sampler.min_img_filter = filter;
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- struct pipe_viewport_state vp;
- unsigned nr_layers, layer, i;
- float rcoord = 0.0f;
-
- if (pt->target == PIPE_TEXTURE_3D)
- nr_layers = u_minify(pt->depth0, dstLevel);
- else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
- pt->target == PIPE_TEXTURE_1D_ARRAY ||
- pt->target == PIPE_TEXTURE_CUBE_ARRAY)
- nr_layers = pt->array_size;
- else
- nr_layers = 1;
-
- for (i = 0; i < nr_layers; i++) {
- struct pipe_surface *surf, surf_templ;
- if (pt->target == PIPE_TEXTURE_3D) {
- /* in theory with geom shaders and driver with full layer support
- could do that in one go. */
- layer = i;
- /* XXX hmm really? */
- rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2);
- } else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
- pt->target == PIPE_TEXTURE_1D_ARRAY) {
- layer = i;
- rcoord = (float)layer;
- } else if (pt->target == PIPE_TEXTURE_CUBE_ARRAY) {
- layer = i;
- face = layer % 6;
- rcoord = layer / 6;
- } else
- layer = face;
-
- u_surface_default_template(&surf_templ, pt);
- surf_templ.u.tex.level = dstLevel;
- surf_templ.u.tex.first_layer = layer;
- surf_templ.u.tex.last_layer = layer;
- surf = pipe->create_surface(pipe, pt, &surf_templ);
-
- /*
- * Setup framebuffer / dest surface
- */
- if (is_depth) {
- fb.nr_cbufs = 0;
- fb.zsbuf = surf;
- }
- else {
- fb.nr_cbufs = 1;
- fb.cbufs[0] = surf;
- }
- fb.width = u_minify(pt->width0, dstLevel);
- fb.height = u_minify(pt->height0, dstLevel);
- cso_set_framebuffer(ctx->cso, &fb);
-
- /* viewport */
- vp.scale[0] = 0.5f * fb.width;
- vp.scale[1] = 0.5f * fb.height;
- vp.scale[2] = 1.0f;
- vp.scale[3] = 1.0f;
- vp.translate[0] = 0.5f * fb.width;
- vp.translate[1] = 0.5f * fb.height;
- vp.translate[2] = 0.0f;
- vp.translate[3] = 0.0f;
- cso_set_viewport(ctx->cso, &vp);
-
- /*
- * Setup sampler state
- * Note: we should only have to set the min/max LOD clamps to ensure
- * we grab texels from the right mipmap level. But some hardware
- * has trouble with min clamping so we also set the lod_bias to
- * try to work around that.
- */
- ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel;
- ctx->sampler.lod_bias = (float) srcLevel;
- cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
- cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
-
- cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv);
-
- /* quad coords in clip coords */
- offset = set_vertex_data(ctx,
- pt->target,
- face,
- rcoord);
-
- util_draw_vertex_buffer(ctx->pipe,
- ctx->cso,
- ctx->vbuf,
- cso_get_aux_vertex_buffer_slot(ctx->cso),
- offset,
- PIPE_PRIM_TRIANGLE_FAN,
- 4, /* verts */
- 2); /* attribs/vert */
-
- /* need to signal that the texture has changed _after_ rendering to it */
- pipe_surface_reference( &surf, NULL );
+ if (pt->target == PIPE_TEXTURE_3D) {
+ /* generate all layers/slices at once */
+ blit.src.box.z = blit.dst.box.z = 0;
+ blit.src.box.depth = util_max_layer(pt, blit.src.level)+1;
+ blit.dst.box.depth = util_max_layer(pt, blit.dst.level)+1;
+ }
+ else {
+ blit.src.box.z = blit.dst.box.z = first_layer;
+ blit.src.box.depth = blit.dst.box.depth =
+ (last_layer + 1 - first_layer);
}
- }
- /* restore state we changed */
- cso_restore_blend(ctx->cso);
- cso_restore_depth_stencil_alpha(ctx->cso);
- cso_restore_rasterizer(ctx->cso);
- cso_restore_sample_mask(ctx->cso);
- cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_restore_framebuffer(ctx->cso);
- cso_restore_fragment_shader(ctx->cso);
- cso_restore_vertex_shader(ctx->cso);
- cso_restore_geometry_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
- cso_restore_vertex_elements(ctx->cso);
- cso_restore_stream_outputs(ctx->cso);
- cso_restore_aux_vertex_buffer_slot(ctx->cso);
- cso_restore_render_condition(ctx->cso);
+ pipe->blit(pipe, &blit);
+ }
+ return TRUE;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
index ffeff425e..99d017888 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
@@ -35,26 +35,13 @@
extern "C" {
#endif
-
-struct pipe_context;
-struct pipe_resource;
-struct cso_context;
-
-struct gen_mipmap_state;
-
-
-extern struct gen_mipmap_state *
-util_create_gen_mipmap(struct pipe_context *pipe, struct cso_context *cso);
-
-
-extern void
-util_destroy_gen_mipmap(struct gen_mipmap_state *ctx);
+struct pipe_context;
-extern void
-util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_sampler_view *psv,
- uint layer, uint baseLevel, uint lastLevel, uint filter);
+extern boolean
+util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt,
+ enum pipe_format format, uint base_level, uint last_level,
+ uint first_layer, uint last_layer, uint filter);
#ifdef __cplusplus
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index eb047e0a2..a59ebcb9f 100644
--- a/mesalib/src/glsl/ast.h
+++ b/mesalib/src/glsl/ast.h
@@ -221,6 +221,13 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
+ ir_rvalue *do_hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool needs_rvalue);
+
virtual void print(void) const;
enum ast_operators oper;
@@ -291,6 +298,9 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
private:
/**
* Is this function call actually a constructor?
@@ -363,6 +373,9 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
};
/**
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 8f6e90174..717dc68ea 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -56,6 +56,9 @@
#include "glsl_types.h"
#include "program/hash_table.h"
#include "ir.h"
+#include "ir_builder.h"
+
+using namespace ir_builder;
static void
detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
@@ -733,10 +736,12 @@ mark_whole_array_access(ir_rvalue *access)
}
}
-ir_rvalue *
+static bool
do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
const char *non_lvalue_description,
- ir_rvalue *lhs, ir_rvalue *rhs, bool is_initializer,
+ ir_rvalue *lhs, ir_rvalue *rhs,
+ ir_rvalue **out_rvalue, bool needs_rvalue,
+ bool is_initializer,
YYLTYPE lhs_loc)
{
void *ctx = state;
@@ -855,27 +860,33 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
* to handle things like:
*
* i = j += 1;
- *
- * So we always just store the computed value being assigned to a
- * temporary and return a deref of that temporary. If the rvalue
- * ends up not being used, the temp will get copy-propagated out.
*/
- ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
- ir_var_temporary);
- ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
- instructions->push_tail(var);
- instructions->push_tail(new(ctx) ir_assignment(deref_var, rhs));
- deref_var = new(ctx) ir_dereference_variable(var);
+ if (needs_rvalue) {
+ ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
+ ir_var_temporary);
+ instructions->push_tail(var);
+ instructions->push_tail(assign(var, rhs));
+
+ if (!error_emitted) {
+ ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
+ instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
+ }
+ ir_rvalue *rvalue = new(ctx) ir_dereference_variable(var);
- if (!error_emitted)
- instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
+ if (extract_channel) {
+ rvalue = new(ctx) ir_expression(ir_binop_vector_extract,
+ rvalue,
+ extract_channel->clone(ctx, NULL));
+ }
- if (extract_channel) {
- return new(ctx) ir_expression(ir_binop_vector_extract,
- new(ctx) ir_dereference_variable(var),
- extract_channel->clone(ctx, NULL));
+ *out_rvalue = rvalue;
+ } else {
+ if (!error_emitted)
+ instructions->push_tail(new(ctx) ir_assignment(lhs, rhs));
+ *out_rvalue = NULL;
}
- return new(ctx) ir_dereference_variable(var);
+
+ return error_emitted;
}
static ir_rvalue *
@@ -906,6 +917,20 @@ ast_node::hir(exec_list *instructions,
return NULL;
}
+void
+ast_function_expression::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ (void)hir(instructions, state);
+}
+
+void
+ast_aggregate_initializer::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ (void)hir(instructions, state);
+}
+
static ir_rvalue *
do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
{
@@ -1075,6 +1100,21 @@ ir_rvalue *
ast_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
+ return do_hir(instructions, state, true);
+}
+
+void
+ast_expression::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ do_hir(instructions, state, false);
+}
+
+ir_rvalue *
+ast_expression::do_hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool needs_rvalue)
+{
void *ctx = state;
static const int operations[AST_NUM_OPERATORS] = {
-1, /* ast_assign doesn't convert to ir_expression. */
@@ -1148,11 +1188,11 @@ ast_expression::hir(exec_list *instructions,
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0], op[1], false,
- this->subexpressions[0]->get_location());
- error_emitted = result->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0], op[1], &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1418,11 +1458,12 @@ ast_expression::hir(exec_list *instructions,
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = (op[0]->type->is_error());
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
/* GLSL 1.10 does not allow array assignment. However, we don't have to
* explicitly test for this because none of the binary expression
@@ -1444,11 +1485,12 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1460,11 +1502,12 @@ ast_expression::hir(exec_list *instructions,
&loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1477,11 +1520,12 @@ ast_expression::hir(exec_list *instructions,
state, &loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1589,11 +1633,12 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1617,12 +1662,14 @@ ast_expression::hir(exec_list *instructions,
*/
result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
- (void)do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
+ ir_rvalue *junk_rvalue;
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &junk_rvalue, false, false,
+ this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error();
break;
}
@@ -1744,9 +1791,9 @@ ast_expression::hir(exec_list *instructions,
}
}
type = NULL; /* use result->type, not type. */
- assert(result != NULL);
+ assert(result != NULL || !needs_rvalue);
- if (result->type->is_error() && !error_emitted)
+ if (result && result->type->is_error() && !error_emitted)
_mesa_glsl_error(& loc, state, "type mismatch");
return result;
@@ -1767,7 +1814,7 @@ ast_expression_statement::hir(exec_list *instructions,
* anything in that case.
*/
if (expression != NULL)
- expression->hir(instructions, state);
+ expression->hir_no_rvalue(instructions, state);
/* Statements do not have r-values.
*/
@@ -2831,10 +2878,12 @@ process_initializer(ir_variable *var, ast_declaration *decl,
*/
const glsl_type *initializer_type;
if (!type->qualifier.flags.q.uniform) {
- result = do_assignment(initializer_instructions, state,
- NULL,
- lhs, rhs, true,
- type->get_location());
+ do_assignment(initializer_instructions, state,
+ NULL,
+ lhs, rhs,
+ &result, true,
+ true,
+ type->get_location());
initializer_type = result->type;
} else
initializer_type = rhs->type;
@@ -5267,12 +5316,19 @@ ast_interface_block::hir(exec_list *instructions,
earlier->reinit_interface_type(block_type);
delete var;
} else {
+ /* Propagate the "binding" keyword into this UBO's fields;
+ * the UBO declaration itself doesn't get an ir_variable unless it
+ * has an instance name. This is ugly.
+ */
+ var->data.explicit_binding = this->layout.flags.q.explicit_binding;
+ var->data.binding = this->layout.binding;
+
state->symbols->add_variable(var);
instructions->push_tail(var);
}
} else {
/* In order to have an array size, the block must also be declared with
- * an instane name.
+ * an instance name.
*/
assert(this->array_specifier == NULL);
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 61ae62150..03c2a972a 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -66,10 +66,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->translation_unit.make_empty();
this->symbols = new(mem_ctx) glsl_symbol_table;
- this->num_uniform_blocks = 0;
- this->uniform_block_array_size = 0;
- this->uniform_blocks = NULL;
-
this->info_log = ralloc_strdup(mem_ctx, "");
this->error = false;
this->loop_nesting_ast = NULL;
@@ -1448,7 +1444,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
/* Do some optimization at compile time to reduce shader IR size
* and reduce later work if the same shader is linked multiple times
*/
- while (do_common_optimization(shader->ir, false, false, 32, options))
+ while (do_common_optimization(shader->ir, false, false, options,
+ ctx->Const.NativeIntegers))
;
validate_ir_tree(shader->ir);
@@ -1464,12 +1461,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
shader->IsES = state->es_shader;
shader->uses_builtin_functions = state->uses_builtin_functions;
- if (shader->UniformBlocks)
- ralloc_free(shader->UniformBlocks);
- shader->NumUniformBlocks = state->num_uniform_blocks;
- shader->UniformBlocks = state->uniform_blocks;
- ralloc_steal(shader, shader->UniformBlocks);
-
if (!state->error)
set_shader_inout_layout(shader, state);
@@ -1501,8 +1492,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
bool
do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations,
- const struct gl_shader_compiler_options *options)
+ const struct gl_shader_compiler_options *options,
+ bool native_integers)
{
GLboolean progress = GL_FALSE;
@@ -1538,7 +1529,7 @@ do_common_optimization(exec_list *ir, bool linked,
progress = do_constant_variable_unlinked(ir) || progress;
progress = do_constant_folding(ir) || progress;
progress = do_cse(ir) || progress;
- progress = do_algebraic(ir) || progress;
+ progress = do_algebraic(ir, native_integers) || progress;
progress = do_lower_jumps(ir) || progress;
progress = do_vec_index_to_swizzle(ir) || progress;
progress = lower_vector_insert(ir, false) || progress;
@@ -1551,7 +1542,7 @@ do_common_optimization(exec_list *ir, bool linked,
loop_state *ls = analyze_loop_variables(ir);
if (ls->loop_found) {
progress = set_loop_controls(ir, ls) || progress;
- progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+ progress = unroll_loops(ir, ls, options) || progress;
}
delete ls;
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 2e22c8c91..0fd778dc3 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -179,10 +179,6 @@ struct _mesa_glsl_parse_state {
exec_list translation_unit;
glsl_symbol_table *symbols;
- unsigned num_uniform_blocks;
- unsigned uniform_block_array_size;
- struct gl_uniform_block *uniform_blocks;
-
unsigned num_supported_versions;
struct {
unsigned ver;
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 85fbfa9c4..f8f661d5e 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -1223,6 +1223,15 @@ ir_constant::is_basis() const
return ones == 1;
}
+bool
+ir_constant::is_uint16_constant() const
+{
+ if (!type->is_integer())
+ return false;
+
+ return value.u[0] < (1 << 16);
+}
+
ir_loop::ir_loop()
{
this->ir_type = ir_type_loop;
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index ee276d2be..6c7c60a27 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -265,6 +265,13 @@ public:
*/
virtual bool is_basis() const;
+ /**
+ * Determine if an r-value is an unsigned integer constant which can be
+ * stored in 16 bits.
+ *
+ * \sa ir_constant::is_uint16_constant.
+ */
+ virtual bool is_uint16_constant() const { return false; }
/**
* Return a generic value of error_type.
@@ -2165,6 +2172,14 @@ public:
virtual bool is_basis() const;
/**
+ * Return true for constants that could be stored as 16-bit unsigned values.
+ *
+ * Note that this will return true even for signed integer ir_constants, as
+ * long as the value is non-negative and fits in 16-bits.
+ */
+ virtual bool is_uint16_constant() const;
+
+ /**
* Value of the constant.
*
* The field used to back the values supplied by the constant is determined
diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h
index 5f4a2f405..40bb61392 100644
--- a/mesalib/src/glsl/ir_optimization.h
+++ b/mesalib/src/glsl/ir_optimization.h
@@ -66,10 +66,10 @@ enum lower_packing_builtins_op {
bool do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations,
- const struct gl_shader_compiler_options *options);
+ const struct gl_shader_compiler_options *options,
+ bool native_integers);
-bool do_algebraic(exec_list *instructions);
+bool do_algebraic(exec_list *instructions, bool native_integers);
bool do_constant_folding(exec_list *instructions);
bool do_constant_variable(exec_list *instructions);
bool do_constant_variable_unlinked(exec_list *instructions);
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index 527acea4c..71defc815 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -381,6 +381,9 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_binop_min:
case ir_binop_max:
case ir_binop_pow:
+ assert(ir->operands[0]->type->base_type ==
+ ir->operands[1]->type->base_type);
+
if (ir->operands[0]->type->is_scalar())
assert(ir->operands[1]->type == ir->type);
else if (ir->operands[1]->type->is_scalar())
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
index f2f46a211..d19ce20c7 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
@@ -46,6 +46,14 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
b->type = block_type;
b->has_instance_name = var->is_interface_instance();
+ if (var->data.explicit_binding) {
+ b->has_binding = true;
+ b->binding = var->data.binding;
+ } else {
+ b->has_binding = false;
+ b->binding = 0;
+ }
+
_mesa_hash_table_insert(ht, h, var->get_interface_type()->name,
(void *) b);
return b;
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.h b/mesalib/src/glsl/link_uniform_block_active_visitor.h
index fba628a8f..d76dbcaf1 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.h
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.h
@@ -36,7 +36,10 @@ struct link_uniform_block_active {
unsigned *array_elements;
unsigned num_array_elements;
+ unsigned binding;
+
bool has_instance_name;
+ bool has_binding;
};
class link_uniform_block_active_visitor : public ir_hierarchical_visitor {
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index 72d6c5323..1a0e64318 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -251,7 +251,17 @@ link_uniform_blocks(void *mem_ctx,
blocks[i].Name = ralloc_asprintf(blocks, "%s[%u]", name,
b->array_elements[j]);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+
+ /* The GL_ARB_shading_language_420pack spec says:
+ *
+ * "If the binding identifier is used with a uniform block
+ * instanced as an array then the first element of the array
+ * takes the specified block binding and each subsequent
+ * element takes the next consecutive uniform block binding
+ * point."
+ */
+ blocks[i].Binding = (b->has_binding) ? b->binding + j : 0;
+
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
@@ -269,7 +279,7 @@ link_uniform_blocks(void *mem_ctx,
} else {
blocks[i].Name = ralloc_strdup(blocks, block_type->name);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+ blocks[i].Binding = (b->has_binding) ? b->binding : 0;
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp
index 9d6977d57..e60bb64bc 100644
--- a/mesalib/src/glsl/link_uniform_initializers.cpp
+++ b/mesalib/src/glsl/link_uniform_initializers.cpp
@@ -46,6 +46,18 @@ get_storage(gl_uniform_storage *storage, unsigned num_storage,
return NULL;
}
+static unsigned
+get_uniform_block_index(const gl_shader_program *shProg,
+ const char *uniformBlockName)
+{
+ for (unsigned i = 0; i < shProg->NumUniformBlocks; i++) {
+ if (!strcmp(shProg->UniformBlocks[i].Name, uniformBlockName))
+ return i;
+ }
+
+ return GL_INVALID_INDEX;
+}
+
void
copy_constant_to_storage(union gl_constant_value *storage,
const ir_constant *val,
@@ -84,8 +96,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
}
void
-set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
- const char *name, const glsl_type *type, int binding)
+set_sampler_binding(gl_shader_program *prog, const char *name, int binding)
{
struct gl_uniform_storage *const storage =
get_storage(prog->UniformStorage, prog->NumUserUniformStorage, name);
@@ -95,42 +106,53 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
return;
}
- if (storage->type->is_sampler()) {
- unsigned elements = MAX2(storage->array_elements, 1);
+ const unsigned elements = MAX2(storage->array_elements, 1);
- /* From section 4.4.4 of the GLSL 4.20 specification:
- * "If the binding identifier is used with an array, the first element
- * of the array takes the specified unit and each subsequent element
- * takes the next consecutive unit."
- */
- for (unsigned int i = 0; i < elements; i++) {
- storage->storage[i].i = binding + i;
- }
+ /* Section 4.4.4 (Opaque-Uniform Layout Qualifiers) of the GLSL 4.20 spec
+ * says:
+ *
+ * "If the binding identifier is used with an array, the first element
+ * of the array takes the specified unit and each subsequent element
+ * takes the next consecutive unit."
+ */
+ for (unsigned int i = 0; i < elements; i++) {
+ storage->storage[i].i = binding + i;
+ }
- for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- gl_shader *shader = prog->_LinkedShaders[sh];
+ for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
+ gl_shader *shader = prog->_LinkedShaders[sh];
- if (shader && storage->sampler[sh].active) {
- for (unsigned i = 0; i < elements; i++) {
- unsigned index = storage->sampler[sh].index + i;
+ if (shader && storage->sampler[sh].active) {
+ for (unsigned i = 0; i < elements; i++) {
+ unsigned index = storage->sampler[sh].index + i;
- shader->SamplerUnits[index] = storage->storage[i].i;
- }
+ shader->SamplerUnits[index] = storage->storage[i].i;
}
}
- } else if (storage->block_index != -1) {
+ }
+
+ storage->initialized = true;
+}
+
+void
+set_block_binding(gl_shader_program *prog, const char *block_name, int binding)
+{
+ const unsigned block_index = get_uniform_block_index(prog, block_name);
+
+ if (block_index == GL_INVALID_INDEX) {
+ assert(block_index != GL_INVALID_INDEX);
+ return;
+ }
+
/* This is a field of a UBO. val is the binding index. */
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
- int stage_index = prog->UniformBlockStageIndex[i][storage->block_index];
+ int stage_index = prog->UniformBlockStageIndex[i][block_index];
if (stage_index != -1) {
struct gl_shader *sh = prog->_LinkedShaders[i];
sh->UniformBlocks[stage_index].Binding = binding;
}
}
- }
-
- storage->initialized = true;
}
void
@@ -232,8 +254,51 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
mem_ctx = ralloc_context(NULL);
if (var->data.explicit_binding) {
- linker::set_uniform_binding(mem_ctx, prog, var->name,
- var->type, var->data.binding);
+ const glsl_type *const type = var->type;
+
+ if (type->is_sampler()
+ || (type->is_array() && type->fields.array->is_sampler())) {
+ linker::set_sampler_binding(prog, var->name, var->data.binding);
+ } else if (var->is_in_uniform_block()) {
+ const glsl_type *const iface_type = var->get_interface_type();
+
+ /* If the variable is an array and it is an interface instance,
+ * we need to set the binding for each array element. Just
+ * checking that the variable is an array is not sufficient.
+ * The variable could be an array element of a uniform block
+ * that lacks an instance name. For example:
+ *
+ * uniform U {
+ * float f[4];
+ * };
+ *
+ * In this case "f" would pass is_in_uniform_block (above) and
+ * type->is_array(), but it will fail is_interface_instance().
+ */
+ if (var->is_interface_instance() && var->type->is_array()) {
+ for (unsigned i = 0; i < var->type->length; i++) {
+ const char *name =
+ ralloc_asprintf(mem_ctx, "%s[%u]", iface_type->name, i);
+
+ /* Section 4.4.3 (Uniform Block Layout Qualifiers) of the
+ * GLSL 4.20 spec says:
+ *
+ * "If the binding identifier is used with a uniform
+ * block instanced as an array then the first element
+ * of the array takes the specified block binding and
+ * each subsequent element takes the next consecutive
+ * uniform block binding point."
+ */
+ linker::set_block_binding(prog, name,
+ var->data.binding + i);
+ }
+ } else {
+ linker::set_block_binding(prog, iface_type->name,
+ var->data.binding);
+ }
+ } else {
+ assert(!"Explicit binding not on a sampler or UBO.");
+ }
} else if (var->constant_value) {
linker::set_uniform_initializer(mem_ctx, prog, var->name,
var->type, var->constant_value);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 3bf278965..c8dc0661d 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2296,9 +2296,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
lower_clip_distance(prog->_LinkedShaders[i]);
}
- unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
-
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i]))
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
+ &ctx->ShaderCompilerOptions[i],
+ ctx->Const.NativeIntegers))
;
}
diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h
index f841042f0..295dc797c 100644
--- a/mesalib/src/glsl/loop_analysis.h
+++ b/mesalib/src/glsl/loop_analysis.h
@@ -53,7 +53,8 @@ set_loop_controls(exec_list *instructions, loop_state *ls);
extern bool
-unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations);
+unroll_loops(exec_list *instructions, loop_state *ls,
+ const struct gl_shader_compiler_options *options);
ir_rvalue *
find_initial_value(ir_loop *loop, ir_variable *var);
diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp
index 789655ebd..da532804a 100644
--- a/mesalib/src/glsl/loop_unroll.cpp
+++ b/mesalib/src/glsl/loop_unroll.cpp
@@ -25,15 +25,18 @@
#include "loop_analysis.h"
#include "ir_hierarchical_visitor.h"
+#include "main/mtypes.h"
+
namespace {
class loop_unroll_visitor : public ir_hierarchical_visitor {
public:
- loop_unroll_visitor(loop_state *state, unsigned max_iterations)
+ loop_unroll_visitor(loop_state *state,
+ const struct gl_shader_compiler_options *options)
{
this->state = state;
this->progress = false;
- this->max_iterations = max_iterations;
+ this->options = options;
}
virtual ir_visitor_status visit_leave(ir_loop *ir);
@@ -45,7 +48,7 @@ public:
loop_state *state;
bool progress;
- unsigned max_iterations;
+ const struct gl_shader_compiler_options *options;
};
} /* anonymous namespace */
@@ -60,12 +63,17 @@ is_break(ir_instruction *ir)
class loop_unroll_count : public ir_hierarchical_visitor {
public:
int nodes;
- bool fail;
+ bool unsupported_variable_indexing;
+ /* If there are nested loops, the node count will be inaccurate. */
+ bool nested_loop;
- loop_unroll_count(exec_list *list)
+ loop_unroll_count(exec_list *list, loop_variable_state *ls,
+ const struct gl_shader_compiler_options *options)
+ : ls(ls), options(options)
{
nodes = 0;
- fail = false;
+ nested_loop = false;
+ unsupported_variable_indexing = false;
run(list);
}
@@ -84,9 +92,57 @@ public:
virtual ir_visitor_status visit_enter(ir_loop *)
{
- fail = true;
+ nested_loop = true;
+ return visit_continue;
+ }
+
+ virtual ir_visitor_status visit_enter(ir_dereference_array *ir)
+ {
+ /* Check for arrays variably-indexed by a loop induction variable.
+ * Unrolling the loop may convert that access into constant-indexing.
+ *
+ * Many drivers don't support particular kinds of variable indexing,
+ * and have to resort to using lower_variable_index_to_cond_assign to
+ * handle it. This results in huge amounts of horrible code, so we'd
+ * like to avoid that if possible. Here, we just note that it will
+ * happen.
+ */
+ if ((ir->array->type->is_array() || ir->array->type->is_matrix()) &&
+ !ir->array_index->as_constant()) {
+ ir_variable *array = ir->array->variable_referenced();
+ loop_variable *lv = ls->get(ir->array_index->variable_referenced());
+ if (array && lv && lv->is_induction_var()) {
+ switch (array->data.mode) {
+ case ir_var_auto:
+ case ir_var_temporary:
+ case ir_var_const_in:
+ case ir_var_function_in:
+ case ir_var_function_out:
+ case ir_var_function_inout:
+ if (options->EmitNoIndirectTemp)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_uniform:
+ if (options->EmitNoIndirectUniform)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_shader_in:
+ if (options->EmitNoIndirectInput)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_shader_out:
+ if (options->EmitNoIndirectOutput)
+ unsupported_variable_indexing = true;
+ break;
+ }
+ }
+ }
return visit_continue;
}
+
+private:
+ loop_variable_state *ls;
+ const struct gl_shader_compiler_options *options;
};
@@ -244,16 +300,21 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
iterations = ls->limiting_terminator->iterations;
+ const int max_iterations = options->MaxUnrollIterations;
+
/* Don't try to unroll loops that have zillions of iterations either.
*/
- if (iterations > (int) max_iterations)
+ if (iterations > max_iterations)
return visit_continue;
/* Don't try to unroll nested loops and loops with a huge body.
*/
- loop_unroll_count count(&ir->body_instructions);
+ loop_unroll_count count(&ir->body_instructions, ls, options);
+
+ bool loop_too_large =
+ count.nested_loop || count.nodes * iterations > max_iterations * 5;
- if (count.fail || count.nodes * iterations > (int)max_iterations * 5)
+ if (loop_too_large && !count.unsupported_variable_indexing)
return visit_continue;
/* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.
@@ -338,9 +399,10 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
bool
-unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations)
+unroll_loops(exec_list *instructions, loop_state *ls,
+ const struct gl_shader_compiler_options *options)
{
- loop_unroll_visitor v(ls, max_iterations);
+ loop_unroll_visitor v(ls, options);
v.run(instructions);
diff --git a/mesalib/src/glsl/lower_ubo_reference.cpp b/mesalib/src/glsl/lower_ubo_reference.cpp
index c73b148b0..90e65bd0e 100644
--- a/mesalib/src/glsl/lower_ubo_reference.cpp
+++ b/mesalib/src/glsl/lower_ubo_reference.cpp
@@ -194,12 +194,16 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
array_stride = glsl_align(array_stride, 16);
}
- ir_constant *const_index = deref_array->array_index->as_constant();
+ ir_rvalue *array_index = deref_array->array_index;
+ if (array_index->type->base_type == GLSL_TYPE_INT)
+ array_index = i2u(array_index);
+
+ ir_constant *const_index = array_index->as_constant();
if (const_index) {
- const_offset += array_stride * const_index->value.i[0];
+ const_offset += array_stride * const_index->value.u[0];
} else {
offset = add(offset,
- mul(deref_array->array_index,
+ mul(array_index,
new(mem_ctx) ir_constant(array_stride)));
}
deref = deref_array->array->as_dereference();
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 8494bd9ec..9d5539252 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -45,10 +45,11 @@ namespace {
class ir_algebraic_visitor : public ir_rvalue_visitor {
public:
- ir_algebraic_visitor()
+ ir_algebraic_visitor(bool native_integers)
{
this->progress = false;
this->mem_ctx = NULL;
+ this->native_integers = native_integers;
}
virtual ~ir_algebraic_visitor()
@@ -70,6 +71,7 @@ public:
void *mem_ctx;
+ bool native_integers;
bool progress;
};
@@ -445,6 +447,28 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_less:
+ case ir_binop_lequal:
+ case ir_binop_greater:
+ case ir_binop_gequal:
+ case ir_binop_equal:
+ case ir_binop_nequal:
+ for (int add_pos = 0; add_pos < 2; add_pos++) {
+ ir_expression *add = op_expr[add_pos];
+
+ if (!add || add->operation != ir_binop_add)
+ continue;
+
+ ir_constant *zero = op_const[1 - add_pos];
+ if (!is_vec_zero(zero))
+ continue;
+
+ return new(mem_ctx) ir_expression(ir->operation,
+ add->operands[0],
+ neg(add->operands[1]));
+ }
+ break;
+
case ir_binop_rshift:
case ir_binop_lshift:
/* 0 >> x == 0 */
@@ -623,9 +647,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue)
}
bool
-do_algebraic(exec_list *instructions)
+do_algebraic(exec_list *instructions, bool native_integers)
{
- ir_algebraic_visitor v;
+ ir_algebraic_visitor v(native_integers);
visit_list_elements(&v, instructions);
diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp
index f3bd580af..d47613c21 100644
--- a/mesalib/src/glsl/opt_tree_grafting.cpp
+++ b/mesalib/src/glsl/opt_tree_grafting.cpp
@@ -127,12 +127,12 @@ ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue)
return false;
if (debug) {
- printf("GRAFTING:\n");
- this->graft_assign->print();
- printf("\n");
- printf("TO:\n");
- (*rvalue)->print();
- printf("\n");
+ fprintf(stderr, "GRAFTING:\n");
+ this->graft_assign->fprint(stderr);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "TO:\n");
+ (*rvalue)->fprint(stderr);
+ fprintf(stderr, "\n");
}
this->graft_assign->remove();
@@ -164,9 +164,9 @@ ir_tree_grafting_visitor::check_graft(ir_instruction *ir, ir_variable *var)
{
if (dereferences_variable(this->graft_assign->rhs, var)) {
if (debug) {
- printf("graft killed by: ");
- ir->print();
- printf("\n");
+ fprintf(stderr, "graft killed by: ");
+ ir->fprint(stderr);
+ fprintf(stderr, "\n");
}
return visit_stop;
}
@@ -316,9 +316,9 @@ try_tree_grafting(ir_assignment *start,
ir_tree_grafting_visitor v(start, lhs_var);
if (debug) {
- printf("trying to graft: ");
- lhs_var->print();
- printf("\n");
+ fprintf(stderr, "trying to graft: ");
+ lhs_var->fprint(stderr);
+ fprintf(stderr, "\n");
}
for (ir_instruction *ir = (ir_instruction *)start->next;
@@ -326,9 +326,9 @@ try_tree_grafting(ir_assignment *start,
ir = (ir_instruction *)ir->next) {
if (debug) {
- printf("- ");
- ir->print();
- printf("\n");
+ fprintf(stderr, "- ");
+ ir->fprint(stderr);
+ fprintf(stderr, "\n");
}
ir_visitor_status s = ir->accept(&v);
diff --git a/mesalib/src/glsl/opt_vectorize.cpp b/mesalib/src/glsl/opt_vectorize.cpp
index 3306397fd..f9a3b6183 100644
--- a/mesalib/src/glsl/opt_vectorize.cpp
+++ b/mesalib/src/glsl/opt_vectorize.cpp
@@ -260,6 +260,7 @@ ir_vectorize_visitor::visit_enter(ir_assignment *ir)
if (ir->condition ||
this->channels >= 4 ||
!single_channel_write_mask(ir->write_mask) ||
+ this->assignment[write_mask_to_swizzle(ir->write_mask)] != NULL ||
(lhs && !ir->lhs->equals(lhs)) ||
(rhs && !ir->rhs->equals(rhs, ir_type_swizzle))) {
try_vectorize();
diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp
index f1b9579cd..db5cb2662 100644
--- a/mesalib/src/glsl/test_optpass.cpp
+++ b/mesalib/src/glsl/test_optpass.cpp
@@ -62,11 +62,10 @@ do_optimization(struct exec_list *ir, const char *optimization,
int int_3;
int int_4;
- if (sscanf(optimization, "do_common_optimization ( %d , %d ) ",
- &int_0, &int_1) == 2) {
- return do_common_optimization(ir, int_0 != 0, false, int_1, options);
+ if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) {
+ return do_common_optimization(ir, int_0 != 0, false, options, true);
} else if (strcmp(optimization, "do_algebraic") == 0) {
- return do_algebraic(ir);
+ return do_algebraic(ir, true);
} else if (strcmp(optimization, "do_constant_folding") == 0) {
return do_constant_folding(ir);
} else if (strcmp(optimization, "do_constant_variable") == 0) {
diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c
index e343f4a57..666d0158a 100644
--- a/mesalib/src/loader/loader.c
+++ b/mesalib/src/loader/loader.c
@@ -202,7 +202,7 @@ out:
return (*chip_id >= 0);
}
-#elif defined(ANDROID) && !defined(__NOT_HAVE_DRM_H)
+#elif !defined(__NOT_HAVE_DRM_H)
/* for i915 */
#include <i915_drm.h>
@@ -219,12 +219,12 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
version = drmGetVersion(fd);
if (!version) {
log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd\n");
- return FALSE;
+ return 0;
}
if (!version->name) {
log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name\n");
drmFreeVersion(version);
- return FALSE;
+ return 0;
}
if (strcmp(version->name, "i915") == 0) {
diff --git a/mesalib/src/mapi/Makefile.sources b/mesalib/src/mapi/Makefile.sources
index aff465a60..37ca4842c 100644
--- a/mesalib/src/mapi/Makefile.sources
+++ b/mesalib/src/mapi/Makefile.sources
@@ -15,22 +15,37 @@
# this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined.
MAPI_UTIL_FILES = \
+ $(TOP)/src/mapi/u_compiler.h \
$(TOP)/src/mapi/u_current.c \
- $(TOP)/src/mapi/u_execmem.c
+ $(TOP)/src/mapi/u_current.h \
+ $(TOP)/src/mapi/u_execmem.c \
+ $(TOP)/src/mapi/u_execmem.h \
+ $(TOP)/src/mapi/u_macros.h \
+ $(TOP)/src/mapi/u_thread.h
-MAPI_FILES = \
+MAPI_BRIDGE_FILES = \
$(TOP)/src/mapi/entry.c \
+ $(TOP)/src/mapi/entry.h \
+ $(TOP)/src/mapi/entry_x86-64_tls.h \
+ $(TOP)/src/mapi/entry_x86_tls.h \
+ $(TOP)/src/mapi/entry_x86_tsd.h \
+ $(TOP)/src/mapi/mapi_tmp.h
+
+MAPI_FILES = \
$(TOP)/src/mapi/mapi.c \
+ $(TOP)/src/mapi/mapi.h \
$(TOP)/src/mapi/stub.c \
+ $(TOP)/src/mapi/stub.h \
$(TOP)/src/mapi/table.c \
+ $(TOP)/src/mapi/table.h \
$(MAPI_UTIL_FILES)
MAPI_GLAPI_FILES = \
$(TOP)/src/mapi/entry.c \
$(TOP)/src/mapi/mapi_glapi.c \
$(TOP)/src/mapi/stub.c \
+ $(TOP)/src/mapi/stub.h \
$(TOP)/src/mapi/table.c \
+ $(TOP)/src/mapi/table.h \
$(MAPI_UTIL_FILES)
-MAPI_BRIDGE_FILES = \
- $(TOP)/src/mapi/entry.c
diff --git a/mesalib/src/mapi/glapi/Makefile.sources b/mesalib/src/mapi/glapi/Makefile.sources
index 100e6347e..04fef6c9e 100644
--- a/mesalib/src/mapi/glapi/Makefile.sources
+++ b/mesalib/src/mapi/glapi/Makefile.sources
@@ -6,7 +6,9 @@ GLAPI_SOURCES = \
glapi_gentable.c \
glapi_getproc.c \
glapi_nop.c \
- glapi.c
+ glapi.c \
+ glapi.h \
+ glapi_priv.h
X86_API = \
glapi_x86.S
diff --git a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
index 80234ea5e..d006917af 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
@@ -15,69 +15,69 @@
<enum name="ALL_SHADER_BITS" value="0xFFFFFFFF"/>
<enum name="PROGRAM_SEPARABLE" value="0x8258"/>
- <function name="UseProgramStages" offset="assign">
+ <function name="UseProgramStages" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="stages" type="GLbitfield" />
<param name="program" type="GLuint" />
</function>
- <function name="ActiveShaderProgram" offset="assign">
+ <function name="ActiveShaderProgram" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="program" type="GLuint" />
</function>
- <function name="CreateShaderProgramv" offset="assign">
+ <function name="CreateShaderProgramv" offset="assign" static_dispatch="false">
<param name="type" type="GLenum" />
<param name="count" type="GLsizei" />
<param name="strings" type="const GLchar * const *" />
<return type="GLuint"/>
</function>
- <function name="BindProgramPipeline" offset="assign">
+ <function name="BindProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
</function>
- <function name="DeleteProgramPipelines" offset="assign">
+ <function name="DeleteProgramPipelines" offset="assign" static_dispatch="false">
<param name="n" type="GLsizei" />
<param name="pipelines" type="const GLuint *" />
</function>
- <function name="GenProgramPipelines" offset="assign">
+ <function name="GenProgramPipelines" offset="assign" static_dispatch="false">
<param name="n" type="GLsizei" />
<param name="pipelines" type="GLuint *" />
</function>
- <function name="IsProgramPipeline" offset="assign">
+ <function name="IsProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<return type="GLboolean"/>
</function>
<!-- Function already included on ARB_get_program_binary.xml. Keep a commented
version here for completeness -->
<!--
- <function name="ProgramParameteri" offset="assign" es2="3.0">
+ <function name="ProgramParameteri" offset="assign" es2="3.0" static_dispatch="false">
<param name="program" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="value" type="GLint"/>
</function>
-->
- <function name="GetProgramPipelineiv" offset="assign">
+ <function name="GetProgramPipelineiv" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="pname" type="GLenum" />
<param name="params" type="GLint *" />
</function>
- <function name="ProgramUniform1i" offset="assign">
+ <function name="ProgramUniform1i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
</function>
- <function name="ProgramUniform2i" offset="assign">
+ <function name="ProgramUniform2i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
<param name="y" type="GLint" />
</function>
- <function name="ProgramUniform3i" offset="assign">
+ <function name="ProgramUniform3i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
<param name="y" type="GLint" />
<param name="z" type="GLint" />
</function>
- <function name="ProgramUniform4i" offset="assign">
+ <function name="ProgramUniform4i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
@@ -85,25 +85,25 @@
<param name="z" type="GLint" />
<param name="w" type="GLint" />
</function>
- <function name="ProgramUniform1ui" offset="assign">
+ <function name="ProgramUniform1ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
</function>
- <function name="ProgramUniform2ui" offset="assign">
+ <function name="ProgramUniform2ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
<param name="y" type="GLuint" />
</function>
- <function name="ProgramUniform3ui" offset="assign">
+ <function name="ProgramUniform3ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
<param name="y" type="GLuint" />
<param name="z" type="GLuint" />
</function>
- <function name="ProgramUniform4ui" offset="assign">
+ <function name="ProgramUniform4ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
@@ -111,25 +111,25 @@
<param name="z" type="GLuint" />
<param name="w" type="GLuint" />
</function>
- <function name="ProgramUniform1f" offset="assign">
+ <function name="ProgramUniform1f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
</function>
- <function name="ProgramUniform2f" offset="assign">
+ <function name="ProgramUniform2f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
<param name="y" type="GLfloat" />
</function>
- <function name="ProgramUniform3f" offset="assign">
+ <function name="ProgramUniform3f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
<param name="y" type="GLfloat" />
<param name="z" type="GLfloat" />
</function>
- <function name="ProgramUniform4f" offset="assign">
+ <function name="ProgramUniform4f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
@@ -137,145 +137,145 @@
<param name="z" type="GLfloat" />
<param name="w" type="GLfloat" />
</function>
- <function name="ProgramUniform1iv" offset="assign">
+ <function name="ProgramUniform1iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform2iv" offset="assign">
+ <function name="ProgramUniform2iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform3iv" offset="assign">
+ <function name="ProgramUniform3iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform4iv" offset="assign">
+ <function name="ProgramUniform4iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform1uiv" offset="assign">
+ <function name="ProgramUniform1uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform2uiv" offset="assign">
+ <function name="ProgramUniform2uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform3uiv" offset="assign">
+ <function name="ProgramUniform3uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform4uiv" offset="assign">
+ <function name="ProgramUniform4uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform1fv" offset="assign">
+ <function name="ProgramUniform1fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform2fv" offset="assign">
+ <function name="ProgramUniform2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform3fv" offset="assign">
+ <function name="ProgramUniform3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform4fv" offset="assign">
+ <function name="ProgramUniform4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2fv" offset="assign">
+ <function name="ProgramUniformMatrix2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3fv" offset="assign">
+ <function name="ProgramUniformMatrix3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4fv" offset="assign">
+ <function name="ProgramUniformMatrix4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2x3fv" offset="assign">
+ <function name="ProgramUniformMatrix2x3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3x2fv" offset="assign">
+ <function name="ProgramUniformMatrix3x2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2x4fv" offset="assign">
+ <function name="ProgramUniformMatrix2x4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4x2fv" offset="assign">
+ <function name="ProgramUniformMatrix4x2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3x4fv" offset="assign">
+ <function name="ProgramUniformMatrix3x4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4x3fv" offset="assign">
+ <function name="ProgramUniformMatrix4x3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ValidateProgramPipeline" offset="assign">
+ <function name="ValidateProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
</function>
- <function name="GetProgramPipelineInfoLog" offset="assign">
+ <function name="GetProgramPipelineInfoLog" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="bufSize" type="GLsizei" />
<param name="length" type="GLsizei *" />
@@ -283,25 +283,25 @@
</function>
<!-- depends on GL_ARB_gpu_shader_fp64
- <function name="ProgramUniform1d" offset="assign">
+ <function name="ProgramUniform1d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
</function>
- <function name="ProgramUniform2d" offset="assign">
+ <function name="ProgramUniform2d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
<param name="y" type="GLdouble" />
</function>
- <function name="ProgramUniform3d" offset="assign">
+ <function name="ProgramUniform3d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
<param name="y" type="GLdouble" />
<param name="z" type="GLdouble" />
</function>
- <function name="ProgramUniform4d" offset="assign">
+ <function name="ProgramUniform4d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
@@ -309,88 +309,88 @@
<param name="z" type="GLdouble" />
<param name="w" type="GLdouble" />
</function>
- <function name="ProgramUniformMatrix2x3dv" offset="assign">
+ <function name="ProgramUniformMatrix2x3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3x2dv" offset="assign">
+ <function name="ProgramUniformMatrix3x2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix2x4dv" offset="assign">
+ <function name="ProgramUniformMatrix2x4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4x2dv" offset="assign">
+ <function name="ProgramUniformMatrix4x2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3x4dv" offset="assign">
+ <function name="ProgramUniformMatrix3x4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4x3dv" offset="assign">
+ <function name="ProgramUniformMatrix4x3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix2dv" offset="assign">
+ <function name="ProgramUniformMatrix2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3dv" offset="assign">
+ <function name="ProgramUniformMatrix3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4dv" offset="assign">
+ <function name="ProgramUniformMatrix4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform1dv" offset="assign">
+ <function name="ProgramUniform1dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform2dv" offset="assign">
+ <function name="ProgramUniform2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform3dv" offset="assign">
+ <function name="ProgramUniform3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform4dv" offset="assign">
+ <function name="ProgramUniform4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 7b3c118f0..6b932e73f 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -59,7 +59,26 @@ EXTRA_DIST= \
$(BUILT_SOURCES) \
$(MESA_GLAPI_DIR)/glapi_x86.S \
$(MESA_GLAPI_DIR)/glapi_x86-64.S \
- $(MESA_GLAPI_DIR)/glapi_sparc.S
+ $(MESA_GLAPI_DIR)/glapi_sparc.S \
+ $(COMMON_GLX) \
+ extension_helper.py \
+ gl_apitemp.py \
+ gl_enums.py \
+ gl_genexec.py \
+ gl_gentable.py \
+ gl_offsets.py \
+ gl_procs.py \
+ gl_SPARC_asm.py \
+ gl_table.py \
+ gl_x86-64_asm.py \
+ gl_x86_asm.py \
+ glX_proto_recv.py \
+ glX_proto_send.py \
+ glX_proto_size.py \
+ glX_server_table.py \
+ mesadef.py \
+ remap_helper.py \
+ gl_API.dtd
######################################################################
@@ -88,8 +107,11 @@ XORG_OUTPUTS = \
API_XML = \
gl_API.xml \
+ es_EXT.xml \
+ gl_and_es_API.xml \
ARB_base_instance.xml \
ARB_blend_func_extended.xml \
+ ARB_clear_buffer_object.xml \
ARB_color_buffer_float.xml \
ARB_compute_shader.xml \
ARB_copy_buffer.xml \
@@ -105,6 +127,8 @@ API_XML = \
ARB_ES3_compatibility.xml \
ARB_framebuffer_object.xml \
ARB_geometry_shader4.xml \
+ ARB_get_program_binary.xml \
+ ARB_gpu_shader5.xml \
ARB_instanced_arrays.xml \
ARB_internalformat_query.xml \
ARB_invalidate_subdata.xml \
@@ -129,6 +153,7 @@ API_XML = \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
ARB_texture_view.xml \
+ ARB_uniform_buffer_object.xml \
ARB_vertex_array_object.xml \
ARB_vertex_attrib_binding.xml \
ARB_viewport_array.xml \
@@ -137,7 +162,6 @@ API_XML = \
ARB_vertex_type_2_10_10_10_rev.xml \
APPLE_object_purgeable.xml \
APPLE_vertex_array_object.xml \
- ARB_uniform_buffer_object.xml \
EXT_draw_buffers2.xml \
EXT_framebuffer_object.xml \
EXT_gpu_shader4.xml \
@@ -147,28 +171,22 @@ API_XML = \
EXT_texture_array.xml \
EXT_texture_integer.xml \
EXT_transform_feedback.xml \
+ KHR_debug.xml \
NV_conditional_render.xml \
NV_primitive_restart.xml \
NV_texture_barrier.xml \
NV_vdpau_interop.xml \
OES_EGL_image.xml \
+ OES_fixed_point.xml \
+ OES_single_precision.xml \
GL3x.xml \
GL4x.xml
-
-
COMMON = $(API_XML) \
gl_XML.py \
glX_XML.py \
license.py \
- typeexpr.py \
- gl_and_es_API.xml \
- es_EXT.xml \
- ARB_ES2_compatibility.xml \
- ARB_ES3_compatibility.xml \
- ARB_get_program_binary.xml \
- OES_fixed_point.xml \
- OES_single_precision.xml
+ typeexpr.py
COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
@@ -208,7 +226,7 @@ $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON)
--printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@
$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
+ $(PYTHON_GEN) $< -c -f $(srcdir)/gl_and_es_API.xml > $@
$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
$(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
diff --git a/mesalib/src/mapi/glapi/gen/SConscript b/mesalib/src/mapi/glapi/gen/SConscript
index e4abe906a..b9cdbbf36 100644
--- a/mesalib/src/mapi/glapi/gen/SConscript
+++ b/mesalib/src/mapi/glapi/gen/SConscript
@@ -38,7 +38,7 @@ env.CodeGenerate(
target = '../../../mapi/glapi/glprocs.h',
script = 'gl_procs.py',
source = sources,
- command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
+ command = python_cmd + ' $SCRIPT -c -f $SOURCE > $TARGET'
)
env.CodeGenerate(
diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml
index f412333df..e2dc39021 100644
--- a/mesalib/src/mapi/glapi/gen/es_EXT.xml
+++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml
@@ -343,7 +343,7 @@
<enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/>
<function name="PointSizePointerOES" offset="assign"
- static_dispatch="false" es1="1.0" desktop="false">
+ static_dispatch="true" es1="1.0" desktop="false">
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 6c4fb9506..7cb10b3ae 100755
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -5403,13 +5403,11 @@
<param name="index" type="GLuint"/>
<param name="name" type="const GLchar *"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="CompileShader" es2="2.0" offset="assign">
<param name="shader" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="CreateProgram" offset="assign" es2="2.0">
@@ -5461,7 +5459,6 @@
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetActiveUniform" es2="2.0" offset="assign">
@@ -5473,7 +5470,6 @@
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetAttachedShaders" offset="assign" es2="2.0">
@@ -5489,7 +5485,6 @@
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetProgramiv" offset="assign" es2="2.0">
@@ -5528,7 +5523,6 @@
<param name="length" type="GLsizei *" output="true"/>
<param name="source" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformLocation"
@@ -5537,7 +5531,6 @@
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformfv" es2="2.0" offset="assign">
@@ -5545,7 +5538,6 @@
<param name="location" type="GLint"/>
<param name="params" type="GLfloat *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformiv" es2="2.0" offset="assign">
@@ -5553,7 +5545,6 @@
<param name="location" type="GLint"/>
<param name="params" type="GLint *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetVertexAttribdv" offset="assign">
@@ -5604,7 +5595,6 @@
<function name="LinkProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="ShaderSource" es2="2.0" offset="assign">
@@ -5613,27 +5603,23 @@
<param name="string" type="const GLchar * const *"/>
<param name="length" type="const GLint *"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UseProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<param name="v1" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5641,7 +5627,6 @@
<param name="v1" type="GLfloat"/>
<param name="v2" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5650,21 +5635,18 @@
<param name="v2" type="GLfloat"/>
<param name="v3" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<param name="v1" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5672,7 +5654,6 @@
<param name="v1" type="GLint"/>
<param name="v2" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5681,7 +5662,6 @@
<param name="v2" type="GLint"/>
<param name="v3" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1fv" es2="2.0" offset="assign">
@@ -5689,28 +5669,24 @@
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="2"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="3"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1iv" es2="2.0" offset="assign">
@@ -5718,28 +5694,24 @@
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="2"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="3"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix2fv" es2="2.0" offset="assign">
@@ -5748,7 +5720,6 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix3fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5756,7 +5727,6 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="9"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix4fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5764,13 +5734,11 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="16"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="ValidateProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="VertexAttrib1d" offset="assign">
diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
index 18b0eb4ec..d158a6b31 100644
--- a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
@@ -18,53 +18,45 @@
<type name="fixed" size="4" />
<type name="clampx" size="4" />
- <function name="AlphaFuncx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="AlphaFuncx" es1="1.0" desktop="false" offset="assign">
<param name="func" type="GLenum"/>
<param name="ref" type="GLclampx"/>
</function>
- <function name="ClearColorx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="ClearColorx" es1="1.0" desktop="false" offset="assign">
<param name="red" type="GLclampx"/>
<param name="green" type="GLclampx"/>
<param name="blue" type="GLclampx"/>
<param name="alpha" type="GLclampx"/>
</function>
- <function name="ClearDepthx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="ClearDepthx" es1="1.0" desktop="false" offset="assign">
<param name="depth" type="GLclampx"/>
</function>
- <function name="Color4x" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Color4x" es1="1.0" desktop="false" offset="assign">
<param name="red" type="GLfixed"/>
<param name="green" type="GLfixed"/>
<param name="blue" type="GLfixed"/>
<param name="alpha" type="GLfixed"/>
</function>
- <function name="DepthRangex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="DepthRangex" es1="1.0" desktop="false" offset="assign">
<param name="zNear" type="GLclampx"/>
<param name="zFar" type="GLclampx"/>
</function>
- <function name="Fogx" static_dispatch="false" es1="1.0"
- desktop="false" offset="assign">
+ <function name="Fogx" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Fogxv" static_dispatch="false" es1="1.0"
- desktop="false" offset="assign">
+ <function name="Fogxv" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="Frustumx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Frustumx" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
@@ -73,63 +65,53 @@
<param name="zFar" type="GLfixed"/>
</function>
- <function name="LightModelx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LightModelx" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="LightModelxv"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="LightModelxv" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="Lightx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Lightx" es1="1.0" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Lightxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Lightxv" es1="1.0" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="LineWidthx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LineWidthx" es1="1.0" desktop="false" offset="assign">
<param name="width" type="GLfixed"/>
</function>
- <function name="LoadMatrixx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LoadMatrixx" es1="1.0" desktop="false" offset="assign">
<param name="m" type="const GLfixed *" count="16"/>
</function>
- <function name="Materialx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Materialx" es1="1.0" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Materialxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Materialxv" es1="1.0" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="MultMatrixx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="MultMatrixx" es1="1.0" desktop="false" offset="assign">
<param name="m" type="const GLfixed *" count="16"/>
</function>
- <function name="MultiTexCoord4x"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="MultiTexCoord4x" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="s" type="GLfixed"/>
<param name="t" type="GLfixed"/>
@@ -137,15 +119,13 @@
<param name="q" type="GLfixed"/>
</function>
- <function name="Normal3x" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Normal3x" es1="1.0" desktop="false" offset="assign">
<param name="nx" type="GLfixed"/>
<param name="ny" type="GLfixed"/>
<param name="nz" type="GLfixed"/>
</function>
- <function name="Orthox" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Orthox" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
@@ -154,69 +134,59 @@
<param name="zFar" type="GLfixed"/>
</function>
- <function name="PointSizex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="PointSizex" es1="1.0" desktop="false" offset="assign">
<param name="size" type="GLfixed"/>
</function>
- <function name="PolygonOffsetx"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="PolygonOffsetx" es1="1.0" desktop="false" offset="assign">
<param name="factor" type="GLfixed"/>
<param name="units" type="GLfixed"/>
</function>
- <function name="Rotatex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Rotatex" es1="1.0" desktop="false" offset="assign">
<param name="angle" type="GLfixed"/>
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
- <function name="SampleCoveragex"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="SampleCoveragex" es1="1.0" desktop="false" offset="assign">
<param name="value" type="GLclampx"/>
<param name="invert" type="GLboolean"/>
</function>
- <function name="Scalex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Scalex" es1="1.0" desktop="false" offset="assign">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
- <function name="TexEnvx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="TexEnvx" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="TexEnvxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="TexEnvxv" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="TexParameterx"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="TexParameterx" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Translatex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Translatex" es1="1.0" desktop="false" offset="assign">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
<!-- from GL_OES_single_precision -->
- <function name="Frustumf" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Frustumf" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
@@ -225,8 +195,7 @@
<param name="zFar" type="GLfloat"/>
</function>
- <function name="Orthof" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Orthof" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
@@ -238,80 +207,68 @@
<category name="es1.1">
<!-- from GL_OES_fixed_point -->
- <function name="ClipPlanex" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="ClipPlanex" es1="1.1" desktop="false" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfixed *" count="4"/>
</function>
- <function name="GetClipPlanex"
- static_dispatch="false" es1="1.1" offset="assign">
+ <function name="GetClipPlanex" es1="1.1" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfixed *" output="true" count="4"/>
</function>
- <function name="GetFixedv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetFixedv" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetLightxv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetLightxv" es1="1.1" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetMaterialxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="GetMaterialxv" es1="1.1" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetTexEnvxv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetTexEnvxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetTexParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="GetTexParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="PointParameterx"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="PointParameterx" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="PointParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="PointParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *"/>
</function>
- <function name="TexParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="TexParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<!-- from GL_OES_single_precision -->
- <function name="ClipPlanef" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="ClipPlanef" es1="1.1" desktop="false" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfloat *" count="4"/>
</function>
- <function name="GetClipPlanef"
- static_dispatch="false" es1="1.1" offset="assign">
+ <function name="GetClipPlanef" es1="1.1" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfloat *" output="true" count="4"/>
</function>
diff --git a/mesalib/src/mapi/glapi/gen/gl_procs.py b/mesalib/src/mapi/glapi/gen/gl_procs.py
index f139c58ea..b1fffc4ca 100755
--- a/mesalib/src/mapi/glapi/gen/gl_procs.py
+++ b/mesalib/src/mapi/glapi/gen/gl_procs.py
@@ -30,11 +30,10 @@ import gl_XML, glX_XML
import sys, getopt
class PrintGlProcs(gl_XML.gl_print_base):
- def __init__(self, long_strings, es=False):
+ def __init__(self, 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 % ( \
"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
@@ -74,22 +73,11 @@ typedef struct {
return
def printFunctionString(self, name):
- if self.long_strings:
- print ' "gl%s\\0"' % (name)
- else:
- print " 'g','l',",
- for c in name:
- print "'%s'," % (c),
-
- print "'\\0',"
-
+ print ' "gl%s\\0"' % (name)
def printBody(self, api):
print ''
- if self.long_strings:
- print 'static const char gl_string_table[] ='
- else:
- print 'static const char gl_string_table[] = {'
+ print 'static const char gl_string_table[] ='
base_offset = 0
table = []
@@ -119,11 +107,7 @@ typedef struct {
base_offset += len(n) + 3
- if self.long_strings:
- print ' ;'
- else:
- print '};'
-
+ print ' ;'
print ''
print ''
print "#ifdef USE_MGL_NAMESPACE"
@@ -178,38 +162,25 @@ typedef struct {
def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
print "-c Enable compatibility 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"
- print " ANSI C89 string constants."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:c")
except Exception,e:
show_usage()
- long_string = 1
es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
- elif arg == "-m":
- if val == "short":
- long_string = 0
- elif val == "long":
- 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, es)
+ printer = PrintGlProcs(es)
printer.Print(api)
diff --git a/mesalib/src/mapi/mapi_abi.py b/mesalib/src/mapi/mapi_abi.py
index f5ff8d843..d783ed32f 100755
--- a/mesalib/src/mapi/mapi_abi.py
+++ b/mesalib/src/mapi/mapi_abi.py
@@ -744,8 +744,9 @@ class ES1APIPrinter(GLAPIPrinter):
def _override_for_api(self, ent):
if ent.xml_data is None:
raise Exception('ES2 API printer requires XML input')
- ent.hidden = ent.name not in \
- ent.xml_data.entry_points_for_api_version('es1')
+ ent.hidden = (ent.name not in \
+ ent.xml_data.entry_points_for_api_version('es1')) \
+ or ent.hidden
ent.handcode = False
def _get_c_header(self):
@@ -767,8 +768,17 @@ class ES2APIPrinter(GLAPIPrinter):
def _override_for_api(self, ent):
if ent.xml_data is None:
raise Exception('ES2 API printer requires XML input')
- ent.hidden = ent.name not in \
- ent.xml_data.entry_points_for_api_version('es2')
+ ent.hidden = (ent.name not in \
+ ent.xml_data.entry_points_for_api_version('es2')) \
+ or ent.hidden
+
+ # This is hella ugly. The same-named function in desktop OpenGL is
+ # hidden, but it needs to be exposed by libGLESv2 for OpenGL ES 3.0.
+ # There's no way to express in the XML that a function should be be
+ # hidden in one API but exposed in another.
+ if ent.name == 'GetInternalformativ':
+ ent.hidden = False
+
ent.handcode = False
def _get_c_header(self):
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am
index 17ac76be1..e8076120d 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/Makefile.am
@@ -9,37 +9,37 @@ SUBDIRS+=common
if HAVE_I915_DRI
SUBDIRS += i915
MEGADRIVERS_DEPS += i915/libi915_dri.la
-MEGADRIVERS += i915_dri.@LIB_EXT@
+MEGADRIVERS += i915_dri.so
endif
if HAVE_I965_DRI
SUBDIRS += i965
MEGADRIVERS_DEPS += i965/libi965_dri.la
-MEGADRIVERS += i965_dri.@LIB_EXT@
+MEGADRIVERS += i965_dri.so
endif
if HAVE_NOUVEAU_DRI
SUBDIRS += nouveau
MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la
-MEGADRIVERS += nouveau_vieux_dri.@LIB_EXT@
+MEGADRIVERS += nouveau_vieux_dri.so
endif
if HAVE_R200_DRI
SUBDIRS += r200
MEGADRIVERS_DEPS += r200/libr200_dri.la
-MEGADRIVERS += r200_dri.@LIB_EXT@
+MEGADRIVERS += r200_dri.so
endif
if HAVE_RADEON_DRI
SUBDIRS += radeon
MEGADRIVERS_DEPS += radeon/libradeon_dri.la
-MEGADRIVERS += radeon_dri.@LIB_EXT@
+MEGADRIVERS += radeon_dri.so
endif
if HAVE_SWRAST_DRI
SUBDIRS += swrast
MEGADRIVERS_DEPS += swrast/libswrast_dri.la
-MEGADRIVERS += swrast_dri.@LIB_EXT@
+MEGADRIVERS += swrast_dri.so
endif
pkgconfigdir = $(libdir)/pkgconfig
@@ -51,8 +51,9 @@ driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h
nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
mesa_dri_drivers_la_SOURCES =
mesa_dri_drivers_la_LDFLAGS = \
- -module -avoid-version -shared \
+ -module -avoid-version -shared -shrext .so \
-Wl,-Bsymbolic \
+ $(GC_SECTIONS) \
$()
mesa_dri_drivers_la_LIBADD = \
../../libmesa.la \
@@ -69,22 +70,22 @@ if HAVE_COMPAT_SYMLINKS
# Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
all-local: mesa_dri_drivers.la
$(AM_V_at)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
- $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.@LIB_EXT@ \
- $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@;
+ $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \
+ $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so;
$(AM_V_GEN)for i in $(MEGADRIVERS); do \
- ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@ \
+ ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \
$(top_builddir)/$(LIB_DIR)/$$i; \
done;
endif
# hardlink each megadriver instance, but don't actually have
-# mesa_dri_drivers.@LIB_EXT@ in the set of final installed files.
+# mesa_dri_drivers.so in the set of final installed files.
install-data-hook:
for i in $(MEGADRIVERS); do \
- ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ \
+ ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
$(DESTDIR)$(dridir)/$$i; \
done;
- $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@
+ $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so
$(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la
endif
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index e500bdb30..c98ccf7b8 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -48,7 +48,7 @@ sysconf_DATA = drirc
if DRICOMMON_NEED_LIBDRM
AM_CFLAGS += $(LIBDRM_CFLAGS)
-libdricommon_la_LDFLAGS = $(LIBDRM_LIBS)
+libdricommon_la_LIBADD = $(LIBDRM_LIBS)
else
AM_CFLAGS += -D__NOT_HAVE_DRM_H
endif
diff --git a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
index 5664af4da..4c3cc6776 100644
--- a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
+++ b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
@@ -31,7 +31,7 @@
* Dl_info, and RTLD_DEFAULT are only defined when _GNU_SOURCE is
* defined.)
*/
-#ifdef _GNU_SOURCE
+#ifdef RTLD_DEFAULT
#define MEGADRIVER_STUB_MAX_EXTENSIONS 10
#define LIB_PATH_SUFFIX "_dri.so"
@@ -148,7 +148,7 @@ megadriver_stub_init(void)
}
}
-#endif /* _GNU_SOURCE */
+#endif /* RTLD_DEFAULT */
static const
__DRIconfig **stub_error_init_screen(__DRIscreen *psp)
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 5a626f2f4..c656845df 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -217,7 +217,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head,
{
void *attribute;
- attribute = MALLOC(attr_size);
+ attribute = malloc(attr_size);
if (attribute == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
return false;
@@ -227,7 +227,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head,
memcpy(attribute, attr_data, attr_size);
}
else {
- FREE(attribute);
+ free(attribute);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
return false;
}
@@ -277,7 +277,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i];
}
else {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -374,7 +374,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->FragmentProgram = ctx->FragmentProgram.Enabled;
if (!save_attrib_data(&head, GL_ENABLE_BIT, attr)) {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -440,7 +440,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->ReadBuffer = ctx->ReadBuffer->ColorReadBuffer;
}
else {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -491,7 +491,7 @@ _mesa_PushAttrib(GLbitfield mask)
}
if (!save_attrib_data(&head, GL_TEXTURE_BIT, texstate)) {
- FREE(texstate);
+ free(texstate);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)");
goto end;
}
@@ -1626,7 +1626,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
else {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
- FREE(attr);
+ free(attr);
goto end;
}
@@ -1642,7 +1642,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
else {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
- FREE(attr);
+ free(attr);
goto end;
}
}
@@ -1656,7 +1656,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
if (!init_array_attrib_data(ctx, attr)) {
- FREE(attr);
+ free(attr);
goto end;
}
@@ -1666,7 +1666,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
else {
free_array_attrib_data(ctx, attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
- FREE(attr);
+ free(attr);
/* goto to keep safe from possible later changes */
goto end;
}
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index c4417c922..aed6d4366 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset,
* \sa glClearBufferSubData, glClearBufferData and
* dd_function_table::ClearBufferSubData.
*/
-static void
+void
_mesa_buffer_clear_subdata(struct gl_context *ctx,
GLintptr offset, GLsizeiptr size,
const GLvoid *clearValue,
@@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format,
if (data == NULL) {
/* clear to zeros, per the spec */
ctx->Driver.ClearBufferSubData(ctx, 0, bufObj->Size,
- NULL, 0, bufObj);
+ NULL, clearValueSize, bufObj);
return;
}
@@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
/* clear to zeros, per the spec */
if (size > 0) {
ctx->Driver.ClearBufferSubData(ctx, offset, size,
- NULL, 0, bufObj);
+ NULL, clearValueSize, bufObj);
}
return;
}
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index 9814552eb..c08c4fdf2 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -115,6 +115,13 @@ extern void
_mesa_buffer_unmap_all_mappings(struct gl_context *ctx,
struct gl_buffer_object *bufObj);
+extern void
+_mesa_buffer_clear_subdata(struct gl_context *ctx,
+ GLintptr offset, GLsizeiptr size,
+ const GLvoid *clearValue,
+ GLsizeiptr clearValueSize,
+ struct gl_buffer_object *bufObj);
+
/*
* API functions
*/
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index 63e5870e6..1865a66b9 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -109,7 +109,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
/* these buffers must exist */
if (!_mesa_dest_buffer_exists(ctx, format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawPixels(missing deest buffer)");
+ "glDrawPixels(missing dest buffer)");
goto end;
}
break;
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 9151718ea..d80fda0db 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -980,7 +980,7 @@ _mesa_free_errors_data(struct gl_context *ctx)
for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
free_errors_data(ctx, i);
}
- FREE(ctx->Debug);
+ free(ctx->Debug);
/* set to NULL just in case it is used before context is completely gone. */
ctx->Debug = NULL;
}
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 1d2ad604b..66c18fa16 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -1344,7 +1344,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
const struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
- while (do_common_optimization(p.shader->ir, false, false, 32, options))
+ while (do_common_optimization(p.shader->ir, false, false, options,
+ ctx->Const.NativeIntegers))
;
reparent_ir(p.shader->ir, p.shader->ir);
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 2ef2e31d6..cf96609ea 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -645,7 +645,7 @@ unpack_R10G10B10A2_UINT(const void *src, GLfloat dst[][4], GLuint n)
static void
-unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_S8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -662,7 +662,7 @@ unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z24_UNORM_S8_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -679,7 +679,7 @@ unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_UNORM16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLushort *s = ((const GLushort *) src);
GLuint i;
@@ -692,19 +692,19 @@ unpack_Z16(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_X8_Z24(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z24_UNORM_X8_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_S8_Z24(src, dst, n);
+ unpack_Z24_UNORM_S8_UINT(src, dst, n);
}
static void
-unpack_Z24_X8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_X8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_Z24_S8(src, dst, n);
+ unpack_S8_UINT_Z24_UNORM(src, dst, n);
}
static void
-unpack_Z32(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_UNORM32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
GLuint i;
@@ -717,7 +717,7 @@ unpack_Z32(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z32_FLOAT_S8X24_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
@@ -730,7 +730,7 @@ unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = ((const GLfloat *) src);
GLuint i;
@@ -2391,12 +2391,12 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_B10G10R10A2_UNORM;
table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_B10G10R10A2_UINT;
table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_R10G10B10A2_UINT;
- table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8;
- table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24;
- table[MESA_FORMAT_Z_UNORM16] = unpack_Z16;
- table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24;
- table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_Z24_X8;
- table[MESA_FORMAT_Z_UNORM32] = unpack_Z32;
+ table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_S8_UINT_Z24_UNORM;
+ table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_Z24_UNORM_S8_UINT;
+ table[MESA_FORMAT_Z_UNORM16] = unpack_Z_UNORM16;
+ table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_Z24_UNORM_X8_UINT;
+ table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_X8_UINT_Z24_UNORM;
+ table[MESA_FORMAT_Z_UNORM32] = unpack_Z_UNORM32;
table[MESA_FORMAT_S_UINT8] = unpack_S8;
table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB;
@@ -2533,8 +2533,8 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_R9G9B9E5_FLOAT;
table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11G11B10_FLOAT;
- table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT;
- table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8;
+ table[MESA_FORMAT_Z_FLOAT32] = unpack_Z_FLOAT32;
+ table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_S8X24_UINT;
table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM;
table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
@@ -3935,7 +3935,7 @@ _mesa_unpack_rgba_block(mesa_format format,
typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst);
static void
-unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst)
+unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -3949,7 +3949,7 @@ unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst)
}
static void
-unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst)
+unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -3983,7 +3983,7 @@ unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst)
}
static void
-unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst)
+unpack_float_Z_FLOAT32(GLuint n, const void *src, GLfloat *dst)
{
memcpy(dst, src, n * sizeof(float));
}
@@ -4013,11 +4013,11 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
case MESA_FORMAT_X8_UINT_Z24_UNORM:
- unpack = unpack_float_z_Z24_X8;
+ unpack = unpack_float_z_X8_UINT_Z24_UNORM;
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
case MESA_FORMAT_Z24_UNORM_X8_UINT:
- unpack = unpack_float_z_X8_Z24;
+ unpack = unpack_float_z_Z24_UNORM_X8_UINT;
break;
case MESA_FORMAT_Z_UNORM16:
unpack = unpack_float_Z_UNORM16;
@@ -4026,7 +4026,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
unpack = unpack_float_Z_UNORM32;
break;
case MESA_FORMAT_Z_FLOAT32:
- unpack = unpack_float_z_Z32F;
+ unpack = unpack_float_Z_FLOAT32;
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
unpack = unpack_float_z_Z32X24S8;
@@ -4045,7 +4045,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n);
static void
-unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n)
+unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -4056,7 +4056,7 @@ unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n)
}
static void
-unpack_uint_z_X8_Z24(const void *src, GLuint *dst, GLuint n)
+unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -4118,11 +4118,11 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n,
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
case MESA_FORMAT_X8_UINT_Z24_UNORM:
- unpack = unpack_uint_z_Z24_X8;
+ unpack = unpack_uint_z_X8_UINT_Z24_UNORM;
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
case MESA_FORMAT_Z24_UNORM_X8_UINT:
- unpack = unpack_uint_z_X8_Z24;
+ unpack = unpack_uint_z_Z24_UNORM_X8_UINT;
break;
case MESA_FORMAT_Z_UNORM16:
unpack = unpack_uint_Z_UNORM16;
@@ -4147,13 +4147,13 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n,
static void
-unpack_ubyte_s_S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_S_UINT8(const void *src, GLubyte *dst, GLuint n)
{
memcpy(dst, src, n);
}
static void
-unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const GLuint *src32 = src;
@@ -4163,7 +4163,7 @@ unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n)
}
static void
-unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const GLuint *src32 = src;
@@ -4173,7 +4173,7 @@ unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n)
}
static void
-unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
@@ -4188,16 +4188,16 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n,
{
switch (format) {
case MESA_FORMAT_S_UINT8:
- unpack_ubyte_s_S8(src, dst, n);
+ unpack_ubyte_s_S_UINT8(src, dst, n);
break;
case MESA_FORMAT_S8_UINT_Z24_UNORM:
- unpack_ubyte_s_Z24_S8(src, dst, n);
+ unpack_ubyte_s_S8_UINT_Z24_UNORM(src, dst, n);
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
- unpack_ubyte_s_S8_Z24(src, dst, n);
+ unpack_ubyte_s_Z24_UNORM_S8_UINT(src, dst, n);
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
- unpack_ubyte_s_Z32_FLOAT_X24S8(src, dst, n);
+ unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(src, dst, n);
break;
default:
_mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row",
@@ -4207,7 +4207,7 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n,
}
static void
-unpack_uint_24_8_depth_stencil_S8_Z24(const GLuint *src, GLuint *dst, GLuint n)
+unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const GLuint *src, GLuint *dst, GLuint n)
{
GLuint i;
@@ -4233,7 +4233,7 @@ unpack_uint_24_8_depth_stencil_Z32_S8X24(const GLuint *src,
}
static void
-unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint *src, GLuint *dst, GLuint n)
+unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, GLuint n)
{
memcpy(dst, src, n * 4);
}
@@ -4248,10 +4248,10 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n,
{
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
- unpack_uint_24_8_depth_stencil_Z24_S8(src, dst, n);
+ unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(src, dst, n);
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
- unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n);
+ unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(src, dst, n);
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
unpack_uint_24_8_depth_stencil_Z32_S8X24(src, dst, n);
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 4fb1f116b..fb2501c69 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -3153,9 +3153,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_L_UNORM16:
return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_I_UNORM8:
- return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE;
+ return format == GL_RED && type == GL_UNSIGNED_BYTE;
case MESA_FORMAT_I_UNORM16:
- return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes;
+ return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_YCBCR:
return format == GL_YCBCR_MESA &&
@@ -3247,9 +3247,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT && !swapBytes;
case MESA_FORMAT_I_FLOAT32:
- return format == GL_INTENSITY && type == GL_FLOAT && !swapBytes;
+ return format == GL_RED && type == GL_FLOAT && !swapBytes;
case MESA_FORMAT_I_FLOAT16:
- return format == GL_INTENSITY && type == GL_HALF_FLOAT && !swapBytes;
+ return format == GL_RED && type == GL_HALF_FLOAT && !swapBytes;
case MESA_FORMAT_R_FLOAT32:
return format == GL_RED && type == GL_FLOAT && !swapBytes;
@@ -3277,13 +3277,17 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_ALPHA_INTEGER && type == GL_INT && !swapBytes;
case MESA_FORMAT_I_UINT8:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_BYTE;
case MESA_FORMAT_I_UINT16:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_I_UINT32:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_INT && !swapBytes;
case MESA_FORMAT_I_SINT8:
+ return format == GL_RED_INTEGER && type == GL_BYTE;
case MESA_FORMAT_I_SINT16:
+ return format == GL_RED_INTEGER && type == GL_SHORT && !swapBytes;
case MESA_FORMAT_I_SINT32:
- /* GL_INTENSITY_INTEGER_EXT doesn't exist. */
- return GL_FALSE;
+ return format == GL_RED_INTEGER && type == GL_INT && !swapBytes;
case MESA_FORMAT_L_UINT8:
return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_BYTE;
@@ -3450,7 +3454,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_BYTE &&
littleEndian && !swapBytes;
case MESA_FORMAT_I_SNORM8:
- return format == GL_INTENSITY && type == GL_BYTE;
+ return format == GL_RED && type == GL_BYTE;
case MESA_FORMAT_A_SNORM16:
return format == GL_ALPHA && type == GL_SHORT && !swapBytes;
case MESA_FORMAT_L_SNORM16:
@@ -3459,7 +3463,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_SHORT &&
littleEndian && !swapBytes;
case MESA_FORMAT_I_SNORM16:
- return format == GL_INTENSITY && type == GL_SHORT && littleEndian &&
+ return format == GL_RED && type == GL_SHORT && littleEndian &&
!swapBytes;
case MESA_FORMAT_B10G10R10A2_UINT:
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 29772be6e..db19eda3d 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -49,16 +49,10 @@ extern "C" {
/** Memory macros */
/*@{*/
-/** Allocate \p BYTES bytes */
-#define MALLOC(BYTES) malloc(BYTES)
-/** Allocate and zero \p BYTES bytes */
-#define CALLOC(BYTES) calloc(1, BYTES)
/** Allocate a structure of type \p T */
#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
/** Allocate and zero a structure of type \p T */
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-/** Free memory */
-#define FREE(PTR) free(PTR)
/*@}*/
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index dafeaa372..5228c3a8f 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -685,6 +685,17 @@ minify(unsigned value, unsigned levels)
}
/**
+ * Return true if the given value is a power of two.
+ *
+ * Note that this considers 0 a power of two.
+ */
+static inline bool
+is_power_of_two(unsigned value)
+{
+ return (value & (value - 1)) == 0;
+}
+
+/**
* Align a value up to an alignment value
*
* If \c value is not already aligned to the requested alignment value, it
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 33cb88881..4d014d1ee 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2421,8 +2421,7 @@ struct gl_shader
/**
* This shader's uniform block information.
*
- * The offsets of the variables are assigned only for shaders in a program's
- * _LinkedShaders[].
+ * These fields are only set post-linking.
*/
struct gl_uniform_block *UniformBlocks;
unsigned NumUniformBlocks;
@@ -3472,6 +3471,8 @@ struct gl_constants
/** GL_ARB_gpu_shader5 */
GLfloat MinFragmentInterpolationOffset;
GLfloat MaxFragmentInterpolationOffset;
+
+ GLboolean FakeSWMSAA;
};
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index d976e5aae..1df656832 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -1489,72 +1489,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
switch (dstFormat) {
case GL_RED:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
break;
case GL_GREEN:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
break;
case GL_BLUE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
break;
case GL_ALPHA:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
break;
case GL_LUMINANCE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(luminance[i]);
+ dst[i] = FLOAT_TO_BYTE_TEX(luminance[i]);
break;
case GL_LUMINANCE_ALPHA:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(luminance[i]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_RG:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
}
break;
case GL_RGB:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
+ dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
}
break;
case GL_RGBA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_BGR:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
}
break;
case GL_BGRA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
}
break;
case GL_RED_INTEGER_EXT:
@@ -1631,8 +1631,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
}
break;
default:
@@ -1803,72 +1803,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
switch (dstFormat) {
case GL_RED:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
break;
case GL_GREEN:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
break;
case GL_BLUE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
break;
case GL_ALPHA:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
break;
case GL_LUMINANCE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(luminance[i]);
+ dst[i] = FLOAT_TO_SHORT_TEX(luminance[i]);
break;
case GL_LUMINANCE_ALPHA:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(luminance[i]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_RG:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
}
break;
case GL_RGB:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
+ dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
}
break;
case GL_RGBA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_BGR:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
}
break;
case GL_BGRA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
}
break;
case GL_RED_INTEGER_EXT:
@@ -1945,8 +1945,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
}
break;
default:
diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp
index e1afe5315..f66c11733 100644
--- a/mesalib/src/mesa/main/shader_query.cpp
+++ b/mesalib/src/mesa/main/shader_query.cpp
@@ -76,6 +76,30 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
*/
}
+static bool
+is_active_attrib(const ir_variable *var)
+{
+ if (!var)
+ return false;
+
+ switch (var->data.mode) {
+ case ir_var_shader_in:
+ return var->data.location != -1;
+
+ case ir_var_system_value:
+ /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes):
+ * "For GetActiveAttrib, all active vertex shader input variables
+ * are enumerated, including the special built-in inputs gl_VertexID
+ * and gl_InstanceID."
+ */
+ return !strcmp(var->name, "gl_VertexID") ||
+ !strcmp(var->name, "gl_InstanceID");
+
+ default:
+ return false;
+ }
+}
+
void GLAPIENTRY
_mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
GLsizei maxLength, GLsizei * length, GLint * size,
@@ -105,10 +129,8 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
foreach_list(node, ir) {
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
+ if (!is_active_attrib(var))
+ continue;
if (current_index == desired_index) {
_mesa_copy_string(name, maxLength, length, var->name);
@@ -196,10 +218,8 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
foreach_list(node, ir) {
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
+ if (!is_active_attrib(var))
+ continue;
i++;
}
diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c
index cbda68940..ae973b001 100644
--- a/mesalib/src/mesa/main/texcompress_etc.c
+++ b/mesalib/src/mesa/main/texcompress_etc.c
@@ -678,14 +678,25 @@ etc2_unpack_rgb8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ /*
+ * Destination texture may not be a multiple of four texels in
+ * height. Compute a safe height to avoid writing outside the texture.
+ */
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ /*
+ * Destination texture may not be a multiple of four texels in
+ * width. Compute a safe width to avoid writing outside the texture.
+ */
+ const unsigned w = MIN2(bw, width - x);
+
etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
false /* punchthrough_alpha */);
dst[3] = 255;
@@ -715,14 +726,17 @@ etc2_unpack_srgb8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -759,13 +773,15 @@ etc2_unpack_rgba8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgba8_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
}
@@ -795,14 +811,16 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
uint8_t tmp;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgba8_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -837,14 +855,16 @@ etc2_unpack_r11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -872,16 +892,18 @@ etc2_unpack_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
/* red component */
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -889,10 +911,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
/* green component */
etc2_r11_parse_block(&block, src + 8);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
}
@@ -920,15 +942,17 @@ etc2_unpack_signed_r11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -956,16 +980,18 @@ etc2_unpack_signed_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
/* red component */
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -973,10 +999,10 @@ etc2_unpack_signed_rg11(uint8_t *dst_row,
/* green component */
etc2_r11_parse_block(&block, src + 8);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
}
@@ -1001,14 +1027,16 @@ etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
true /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
true /* punchthrough_alpha */);
dst += comps;
@@ -1036,14 +1064,16 @@ etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row,
uint8_t tmp;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
true /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
true /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 004e7ebac..d43480482 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -76,11 +76,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
} else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM);
}
- RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM);
- RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
- break;
+ /* fallthrough */
case GL_RGBA8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
break;
@@ -97,6 +96,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
/* deep RGBA formats */
case GL_RGB10_A2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R10G10B10A2_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
break;
@@ -116,6 +116,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
}
/* fallthrough */
case GL_RGB8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UNORM8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_UNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
@@ -451,10 +455,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
break;
case GL_RGB_SNORM:
case GL_RGB8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SNORM);
- /* FALLTHROUGH */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM);
+ break;
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
break;
@@ -522,11 +530,17 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
+ /* there is no MESA_FORMAT_RGB_SRGB8 */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
break;
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
break;
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 8bdbb08c8..918dd59ed 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -559,6 +559,13 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
/* 'q' in the GL spec */
maxLevels - 1);
+ if (t->Immutable) {
+ /* Adjust max level for views: the data store may have more levels than
+ * the view exposes.
+ */
+ t->_MaxLevel = MIN2(t->_MaxLevel, t->NumLevels - 1);
+ }
+
/* Compute _MaxLambda = q - p in the spec used during mipmapping */
t->_MaxLambda = (GLfloat) (t->_MaxLevel - baseLevel);
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index bfb2e1b9f..40790ff0e 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -352,7 +352,8 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->MaxLevel == params[0])
return GL_FALSE;
- if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
+ if (params[0] < 0 ||
+ (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] > 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTexParameter(param=%d)", params[0]);
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index b68ba603e..d9096abf3 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -3260,19 +3260,10 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS)
GLboolean k;
ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SRGB ||
- dstFormat == MESA_FORMAT_R8G8B8X8_SRGB);
+ dstFormat == MESA_FORMAT_R8G8B8X8_SRGB ||
+ dstFormat == MESA_FORMAT_R8G8B8A8_SRGB);
- /* reuse normal rgba texstore code */
- if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) {
- newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM;
- }
- else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) {
- newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM;
- }
- else {
- ASSERT(0);
- return GL_TRUE;
- }
+ newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
newDstFormat,
@@ -3290,20 +3281,10 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS)
mesa_format newDstFormat;
GLboolean k;
- switch (dstFormat) {
- case MESA_FORMAT_B8G8R8A8_SRGB:
- newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM;
- break;
- case MESA_FORMAT_R8G8B8A8_SRGB:
- newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM;
- break;
- case MESA_FORMAT_B8G8R8X8_SRGB:
- newDstFormat = MESA_FORMAT_B8G8R8X8_UNORM;
- break;
- default:
- ASSERT(0);
- return GL_FALSE;
- }
+ assert(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB ||
+ dstFormat == MESA_FORMAT_B8G8R8X8_SRGB);
+
+ newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
newDstFormat,
@@ -3852,6 +3833,7 @@ _mesa_get_texstore_func(mesa_format format)
table[MESA_FORMAT_B5G5R5X1_UNORM] = store_ubyte_texture;
table[MESA_FORMAT_R8G8B8X8_SNORM] = _mesa_texstore_signed_rgbx8888;
table[MESA_FORMAT_R8G8B8X8_SRGB] = _mesa_texstore_srgba8;
+ table[MESA_FORMAT_R8G8B8A8_SRGB] = _mesa_texstore_srgba8;
table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8;
table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8;
table[MESA_FORMAT_B10G10R10X2_UNORM] = _mesa_texstore_argb2101010;
diff --git a/mesalib/src/mesa/main/vdpau.c b/mesalib/src/mesa/main/vdpau.c
index c2cf20664..d97459393 100644
--- a/mesalib/src/mesa/main/vdpau.c
+++ b/mesalib/src/mesa/main/vdpau.c
@@ -88,7 +88,7 @@ unregister_surface(struct set_entry *entry)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
- FREE(surf);
+ free(surf);
}
void GLAPIENTRY
@@ -145,7 +145,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
if (tex->Immutable) {
_mesa_unlock_texture(ctx, tex);
- FREE(surf);
+ free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(texture is immutable)");
return (GLintptr)NULL;
@@ -155,7 +155,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
tex->Target = target;
else if (tex->Target != target) {
_mesa_unlock_texture(ctx, tex);
- FREE(surf);
+ free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(target mismatch)");
return (GLintptr)NULL;
@@ -254,7 +254,7 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
- FREE(surf);
+ free(surf);
}
void GLAPIENTRY
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 63cba26da..b3ae3f5e8 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -228,7 +228,7 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_texture_sRGB);
const GLboolean ver_3_0 = (ver_2_1 &&
ctx->Const.GLSLVersion >= 130 &&
- ctx->Const.MaxSamples >= 4 &&
+ (ctx->Const.MaxSamples >= 4 || ctx->Const.FakeSWMSAA) &&
(ctx->API == API_OPENGL_CORE ||
ctx->Extensions.ARB_color_buffer_float) &&
ctx->Extensions.ARB_depth_buffer_float &&
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 0923357b1..59cf1232a 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3007,8 +3007,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations,
- options)
+ options, ctx->Const.NativeIntegers)
|| progress;
progress = lower_quadop_vector(ir, true) || progress;
diff --git a/mesalib/src/mesa/program/prog_noise.c b/mesalib/src/mesa/program/prog_noise.c
index c258c5e2e..ac920c23f 100644
--- a/mesalib/src/mesa/program/prog_noise.c
+++ b/mesalib/src/mesa/program/prog_noise.c
@@ -257,12 +257,12 @@ _mesa_noise2(GLfloat x, GLfloat y)
float y0 = y - Y0;
float x1, y1, x2, y2;
- int ii, jj;
+ unsigned int ii, jj;
float t0, t1, t2;
/* For the 2D case, the simplex shape is an equilateral triangle. */
/* Determine which simplex we are in. */
- int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
+ unsigned int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
if (x0 > y0) {
i1 = 1;
j1 = 0;
@@ -282,8 +282,8 @@ _mesa_noise2(GLfloat x, GLfloat y)
y2 = y0 - 1.0f + 2.0f * G2;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
/* Calculate the contribution from the three corners */
t0 = 0.5f - x0 * x0 - y0 * y0;
@@ -344,13 +344,13 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
float z0 = z - Z0;
float x1, y1, z1, x2, y2, z2, x3, y3, z3;
- int ii, jj, kk;
+ unsigned int ii, jj, kk;
float t0, t1, t2, t3;
/* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
/* Determine which simplex we are in. */
- int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
- int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
+ unsigned int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
+ unsigned int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
/* This code would benefit from a backport from the GLSL version! */
if (x0 >= y0) {
@@ -423,9 +423,9 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
z3 = z0 - 1.0f + 3.0f * G3;
/* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
+ kk = k & 0xff;
/* Calculate the contribution from the four corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0;
@@ -522,12 +522,12 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
int c6 = (z0 > w0) ? 1 : 0;
int c = c1 + c2 + c3 + c4 + c5 + c6;
- int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
- int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
- int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
+ unsigned int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
+ unsigned int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
+ unsigned int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
- int ii, jj, kk, ll;
+ unsigned int ii, jj, kk, ll;
float t0, t1, t2, t3, t4;
/*
@@ -573,10 +573,10 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
w4 = w0 - 1.0f + 4.0f * G4;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
- ll = l % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
+ kk = k & 0xff;
+ ll = l & 0xff;
/* Calculate the contribution from the five corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 6dde69d53..1664740b4 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -2749,6 +2749,11 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
*/
state->prog->Instructions =
_mesa_alloc_instructions(state->prog->NumInstructions + 1);
+
+ if (state->prog->Instructions == NULL) {
+ goto error;
+ }
+
inst = state->inst_head;
for (i = 0; i < state->prog->NumInstructions; i++) {
struct asm_instruction *const temp = inst->next;
diff --git a/mesalib/src/mesa/program/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c
index 2f41322f6..9462978ee 100644
--- a/mesalib/src/mesa/program/symbol_table.c
+++ b/mesalib/src/mesa/program/symbol_table.c
@@ -115,7 +115,7 @@ struct _mesa_symbol_table {
static void
check_symbol_table(struct _mesa_symbol_table *table)
{
-#if 1
+#if !defined(NDEBUG)
struct scope_level *scope;
for (scope = table->current_scope; scope != NULL; scope = scope->next) {
@@ -134,7 +134,9 @@ check_symbol_table(struct _mesa_symbol_table *table)
}
}
}
-#endif
+#else
+ (void) table;
+#endif /* !defined(NDEBUG) */
}
void
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index ec2bab20b..3929251f8 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -182,15 +182,27 @@ convert_sampler(struct st_context *st,
msamp->BorderColor.ui[3]) {
const struct st_texture_object *stobj = st_texture_object_const(texobj);
const GLboolean is_integer = texobj->_IsIntegerFormat;
+ const struct pipe_sampler_view *sv = NULL;
union pipe_color_union border_color;
+ GLuint i;
+
+ /* Just search for the first used view. We can do this because the
+ swizzle is per-texture, not per context. */
+ /* XXX: clean that up to not use the sampler view at all */
+ for (i = 0; i < stobj->num_sampler_views; ++i) {
+ if (stobj->sampler_views[i]) {
+ sv = stobj->sampler_views[i];
+ break;
+ }
+ }
- if (st->apply_texture_swizzle_to_border_color && stobj->sampler_view) {
+ if (st->apply_texture_swizzle_to_border_color && sv) {
const unsigned char swz[4] =
{
- stobj->sampler_view->swizzle_r,
- stobj->sampler_view->swizzle_g,
- stobj->sampler_view->swizzle_b,
- stobj->sampler_view->swizzle_a,
+ sv->swizzle_r,
+ sv->swizzle_g,
+ sv->swizzle_b,
+ sv->swizzle_a,
};
st_translate_color(&msamp->BorderColor,
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index c9bffce4f..afc6d9dab 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -200,9 +200,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj)
* \param stObj the st texture object,
*/
static boolean
-check_sampler_swizzle(const struct st_texture_object *stObj)
+check_sampler_swizzle(const struct st_texture_object *stObj,
+ struct pipe_sampler_view *sv)
{
- const struct pipe_sampler_view *sv = stObj->sampler_view;
unsigned swizzle = get_texture_format_swizzle(stObj);
return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) ||
@@ -258,40 +258,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
static struct pipe_sampler_view *
-st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj,
- struct pipe_context *pipe,
+st_get_texture_sampler_view_from_stobj(struct st_context *st,
+ struct st_texture_object *stObj,
const struct gl_sampler_object *samp,
enum pipe_format format)
{
+ struct pipe_sampler_view **sv;
+
if (!stObj || !stObj->pt) {
return NULL;
}
- if (!stObj->sampler_view) {
- stObj->sampler_view =
- st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format);
+ sv = st_texture_get_sampler_view(st, stObj);
+
+ /* if sampler view has changed dereference it */
+ if (*sv) {
+ if (check_sampler_swizzle(stObj, *sv) ||
+ (format != (*sv)->format) ||
+ stObj->base.BaseLevel != (*sv)->u.tex.first_level) {
+ pipe_sampler_view_reference(sv, NULL);
+ }
+ }
+
+ if (!*sv) {
+ *sv = st_create_texture_sampler_view_from_stobj(st->pipe, stObj, samp, format);
- } else if (stObj->sampler_view->context != pipe) {
+ } else if ((*sv)->context != st->pipe) {
/* Recreate view in correct context, use existing view as template */
- /* XXX: This isn't optimal, we should try to use more than one view.
- Otherwise we create/destroy the view all the time
- */
- struct pipe_sampler_view *sv =
- pipe->create_sampler_view(pipe, stObj->pt, stObj->sampler_view);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
- stObj->sampler_view = sv;
+ struct pipe_sampler_view *new_sv =
+ st->pipe->create_sampler_view(st->pipe, stObj->pt, *sv);
+ pipe_sampler_view_reference(sv, NULL);
+ *sv = new_sv;
}
- return stObj->sampler_view;
+ return *sv;
}
-
static GLboolean
update_single_texture(struct st_context *st,
struct pipe_sampler_view **sampler_view,
GLuint texUnit)
{
- struct pipe_context *pipe = st->pipe;
struct gl_context *ctx = st->ctx;
const struct gl_sampler_object *samp;
struct gl_texture_object *texObj;
@@ -330,17 +337,7 @@ update_single_texture(struct st_context *st,
}
}
- /* if sampler view has changed dereference it */
- if (stObj->sampler_view) {
- if (check_sampler_swizzle(stObj) ||
- (view_format != stObj->sampler_view->format) ||
- stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) {
- pipe_sampler_view_release(pipe, &stObj->sampler_view);
- }
- }
-
- *sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe,
- samp,
+ *sampler_view = st_get_texture_sampler_view_from_stobj(st, stObj, samp,
view_format);
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 49c4b903e..02624617b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx,
srcObj->buffer, 0, &box);
}
+/**
+ * Called via glClearBufferSubData().
+ */
+static void
+st_clear_buffer_subdata(struct gl_context *ctx,
+ GLintptr offset, GLsizeiptr size,
+ const GLvoid *clearValue,
+ GLsizeiptr clearValueSize,
+ struct gl_buffer_object *bufObj)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_buffer_object *buf = st_buffer_object(bufObj);
+ static const char zeros[16] = {0};
+
+ if (!pipe->clear_buffer) {
+ _mesa_buffer_clear_subdata(ctx, offset, size,
+ clearValue, clearValueSize, bufObj);
+ return;
+ }
+
+ if (!clearValue)
+ clearValue = zeros;
+
+ pipe->clear_buffer(pipe, buf->buffer, offset, size,
+ clearValue, clearValueSize);
+}
+
/* TODO: if buffer wasn't created with appropriate usage flags, need
* to recreate it now and copy contents -- or possibly create a
@@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
functions->UnmapBuffer = st_bufferobj_unmap;
functions->CopyBufferSubData = st_copy_buffer_subdata;
+ functions->ClearBufferSubData = st_clear_buffer_subdata;
/* For GL_APPLE_vertex_array_object */
functions->NewArrayObject = _mesa_new_vao;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
index 561967d6c..34eb80959 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
@@ -124,7 +124,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target,
/* FIXME create a non-default sampler view from the pipe_surface? */
pipe_resource_reference(&stObj->pt, ps->texture);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, stObj->pt);
stObj->width0 = ps->width;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index f0bf3745b..97bba8b7d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -151,13 +151,11 @@ static void
st_DeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
- struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
- if (stObj->pt)
- pipe_resource_reference(&stObj->pt, NULL);
- if (stObj->sampler_view) {
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
- }
+
+ pipe_resource_reference(&stObj->pt, NULL);
+ st_texture_release_all_sampler_views(stObj);
+ st_texture_free_sampler_views(stObj);
_mesa_delete_texture_object(ctx, texObj);
}
@@ -177,6 +175,10 @@ st_FreeTextureImageBuffer(struct gl_context *ctx,
_mesa_align_free(stImage->TexData);
stImage->TexData = NULL;
+
+ free(stImage->transfer);
+ stImage->transfer = NULL;
+ stImage->num_transfers = 0;
}
@@ -192,6 +194,7 @@ st_MapTextureImage(struct gl_context *ctx,
struct st_texture_image *stImage = st_texture_image(texImage);
unsigned pipeMode;
GLubyte *map;
+ struct pipe_transfer *transfer;
pipeMode = 0x0;
if (mode & GL_MAP_READ_BIT)
@@ -201,10 +204,11 @@ st_MapTextureImage(struct gl_context *ctx,
if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
pipeMode |= PIPE_TRANSFER_DISCARD_RANGE;
- map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1);
+ map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1,
+ &transfer);
if (map) {
*mapOut = map;
- *rowStrideOut = stImage->transfer->stride;
+ *rowStrideOut = transfer->stride;
}
else {
*mapOut = NULL;
@@ -221,7 +225,7 @@ st_UnmapTextureImage(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
- st_texture_image_unmap(st, stImage);
+ st_texture_image_unmap(st, stImage, slice);
}
@@ -454,7 +458,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
/* The parent texture object does not have space for this image */
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
@@ -1146,6 +1150,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
unsigned dst_width = width;
unsigned dst_height = height;
unsigned dst_depth = 1;
+ struct pipe_transfer *transfer;
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -1171,7 +1176,8 @@ fallback_copy_texsubimage(struct gl_context *ctx,
texDest = st_texture_image_map(st, stImage, transfer_usage,
destX, destY, slice,
- dst_width, dst_height, dst_depth);
+ dst_width, dst_height, dst_depth,
+ &transfer);
if (baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL) {
@@ -1201,13 +1207,11 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
- pipe_put_tile_z(stImage->transfer,
- texDest + row*stImage->transfer->layer_stride,
+ pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride,
0, 0, width, 1, data);
}
else {
- pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
- data);
+ pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data);
}
}
}
@@ -1233,10 +1237,10 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
- dstRowStride = stImage->transfer->layer_stride;
+ dstRowStride = transfer->layer_stride;
}
else {
- dstRowStride = stImage->transfer->stride;
+ dstRowStride = transfer->stride;
}
/* get float/RGBA image from framebuffer */
@@ -1269,7 +1273,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
free(tempSrc);
}
- st_texture_image_unmap(st, stImage);
+ st_texture_image_unmap(st, stImage, slice);
pipe->transfer_unmap(pipe, src_trans);
}
@@ -1487,13 +1491,13 @@ st_finalize_texture(struct gl_context *ctx,
if (!st_obj) {
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
return GL_TRUE;
}
if (st_obj->buffer != stObj->pt) {
pipe_resource_reference(&stObj->pt, st_obj->buffer);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat);
stObj->height0 = 1;
stObj->depth0 = 1;
@@ -1514,7 +1518,7 @@ st_finalize_texture(struct gl_context *ctx,
firstImage->pt != stObj->pt &&
(!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
}
/* If this texture comes from a window system, there is nothing else to do. */
@@ -1561,7 +1565,7 @@ st_finalize_texture(struct gl_context *ctx,
* gallium texture now. We'll make a new one below.
*/
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 807a86fdf..c7f3ec6be 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -152,7 +152,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
st_init_bitmap(st);
st_init_clear(st);
st_init_draw( st );
- st_init_generate_mipmap(st);
/* Choose texture target for glDrawPixels, glBitmap, renderbuffers */
if (pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES))
@@ -254,7 +253,6 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_atoms( st );
st_destroy_draw( st );
- st_destroy_generate_mipmap(st);
st_destroy_clear(st);
st_destroy_bitmap(st);
st_destroy_drawpix(st);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 0e00dd4fa..361a24b1d 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -188,7 +188,6 @@ struct st_context
void *passthrough_fs; /**< simple pass-through frag shader */
enum pipe_texture_target internal_target;
- struct gen_mipmap_state *gen_mipmap;
struct cso_context *cso_context;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 18ddd4e47..059989342 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -275,6 +275,9 @@ void st_init_limits(struct st_context *st)
c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
c->MaxProgramTextureGatherComponents = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS);
+ c->MinProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET);
+ c->MaxProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET);
+
c->UniformBooleanTrue = ~0;
c->MaxTransformFeedbackBuffers =
@@ -421,7 +424,8 @@ void st_init_extensions(struct st_context *st)
{ o(OES_standard_derivatives), PIPE_CAP_SM3 },
{ o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY },
- { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }
+ { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
+ { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD }
};
/* Required: render target and sampler support */
@@ -728,6 +732,13 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
}
+ if (ctx->Const.MaxSamples == 0 && screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) {
+ ctx->Const.FakeSWMSAA = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
+ ctx->Extensions.ARB_texture_multisample = GL_TRUE;
+ }
+
if (ctx->Const.MaxDualSourceDrawBuffers > 0 &&
!st->options.disable_blend_func_extended)
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index cd6b46681..38d4ccfea 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1750,6 +1750,12 @@ st_choose_matching_format(struct pipe_screen *screen, unsigned bind,
if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
continue;
}
+ if (_mesa_get_format_bits(mesa_format, GL_TEXTURE_INTENSITY_SIZE) > 0) {
+ /* If `format` is GL_RED/GL_RED_INTEGER, then we might match some
+ * intensity formats, which we don't want.
+ */
+ continue;
+ }
if (_mesa_format_matches_format_and_type(mesa_format, format, type,
swapBytes)) {
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index b615575b5..18cf504a7 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -44,64 +44,6 @@
/**
- * one-time init for generate mipmap
- * XXX Note: there may be other times we need no-op/simple state like this.
- * In that case, some code refactoring would be good.
- */
-void
-st_init_generate_mipmap(struct st_context *st)
-{
- st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context);
-}
-
-
-void
-st_destroy_generate_mipmap(struct st_context *st)
-{
- util_destroy_gen_mipmap(st->gen_mipmap);
- st->gen_mipmap = NULL;
-}
-
-
-/**
- * Generate mipmap levels using hardware rendering.
- * \return TRUE if successful, FALSE if not possible
- */
-static boolean
-st_render_mipmap(struct st_context *st,
- GLenum target,
- struct st_texture_object *stObj,
- uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_sampler_view *psv;
- const uint face = _mesa_tex_target_to_face(target);
-
-#if 0
- assert(target != GL_TEXTURE_3D); /* implemented but untested */
-#endif
-
- /* check if we can render in the texture's format */
- /* XXX should probably kill this and always use util_gen_mipmap
- since this implements a sw fallback as well */
- if (!screen->is_format_supported(screen, stObj->pt->format,
- stObj->pt->target,
- 0, PIPE_BIND_RENDER_TARGET)) {
- return FALSE;
- }
-
- psv = st_create_texture_sampler_view(pipe, stObj->pt);
-
- util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
- PIPE_TEX_FILTER_LINEAR);
-
- pipe_sampler_view_reference(&psv, NULL);
-
- return TRUE;
-}
-
-/**
* Compute the expected number of mipmap levels in the texture given
* the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/
* GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap
@@ -136,7 +78,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_resource *pt = st_get_texobj_resource(texObj);
const uint baseLevel = texObj->BaseLevel;
- uint lastLevel;
+ uint lastLevel, first_layer, last_layer;
uint dstLevel;
if (!pt)
@@ -182,7 +124,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
/* release the old tex (will likely be freed too) */
pipe_resource_reference(&oldTex, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
}
else {
/* Make sure that the base texture image data is present in the
@@ -195,12 +137,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
assert(pt->last_level >= lastLevel);
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ first_layer = last_layer = _mesa_tex_target_to_face(target);
+ }
+ else {
+ first_layer = 0;
+ last_layer = util_max_layer(pt, baseLevel);
+ }
+
/* Try to generate the mipmap by rendering/texturing. If that fails,
* use the software fallback.
*/
- if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) {
- /* since the util code actually also has a fallback, should
- probably make it never fail and kill this */
+ if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
+ first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
_mesa_generate_mipmap(ctx, target, texObj);
}
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
index 64eb39723..4cc208951 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
@@ -34,14 +34,6 @@
struct gl_context;
struct gl_texture_object;
-struct st_context;
-
-extern void
-st_init_generate_mipmap(struct st_context *st);
-
-
-extern void
-st_destroy_generate_mipmap(struct st_context *st);
extern void
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index f019a55c2..edd0aa765 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2793,7 +2793,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
}
break;
case ir_lod:
- assert(!"Unexpected ir_lod opcode");
+ opcode = TGSI_OPCODE_LODQ;
break;
case ir_query_levels:
assert(!"Unexpected ir_query_levels opcode");
@@ -4513,6 +4513,7 @@ compile_tgsi_instruction(struct st_translate *t,
case TGSI_OPCODE_TXB2:
case TGSI_OPCODE_TXL2:
case TGSI_OPCODE_TG4:
+ case TGSI_OPCODE_LODQ:
src[num_src++] = t->samplers[inst->sampler];
for (i = 0; i < inst->tex_offset_num_offset; i++) {
texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i], i);
@@ -5356,8 +5357,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
- progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations, options)
+ progress = do_common_optimization(ir, true, true, options,
+ ctx->Const.NativeIntegers)
|| progress;
progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress;
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index a3b345356..f664ef5f1 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -40,6 +40,7 @@
#include "util/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#define DBG if(0) printf
@@ -240,11 +241,13 @@ GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
enum pipe_transfer_usage usage,
GLuint x, GLuint y, GLuint z,
- GLuint w, GLuint h, GLuint d)
+ GLuint w, GLuint h, GLuint d,
+ struct pipe_transfer **transfer)
{
struct st_texture_object *stObj =
st_texture_object(stImage->base.TexObject);
GLuint level;
+ void *map;
DBG("%s \n", __FUNCTION__);
@@ -256,22 +259,41 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
- return pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
- x, y, z + stImage->base.Face,
- w, h, d, &stImage->transfer);
+ z += stImage->base.Face;
+
+ map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
+ x, y, z, w, h, d, transfer);
+ if (map) {
+ /* Enlarge the transfer array if it's not large enough. */
+ if (z >= stImage->num_transfers) {
+ unsigned new_size = z + 1;
+
+ stImage->transfer = realloc(stImage->transfer,
+ new_size * sizeof(void*));
+ memset(&stImage->transfer[stImage->num_transfers], 0,
+ (new_size - stImage->num_transfers) * sizeof(void*));
+ stImage->num_transfers = new_size;
+ }
+
+ assert(!stImage->transfer[z]);
+ stImage->transfer[z] = *transfer;
+ }
+ return map;
}
void
st_texture_image_unmap(struct st_context *st,
- struct st_texture_image *stImage)
+ struct st_texture_image *stImage, unsigned slice)
{
struct pipe_context *pipe = st->pipe;
+ struct pipe_transfer **transfer =
+ &stImage->transfer[slice + stImage->base.Face];
DBG("%s\n", __FUNCTION__);
- pipe_transfer_unmap(pipe, stImage->transfer);
- stImage->transfer = NULL;
+ pipe_transfer_unmap(pipe, *transfer);
+ *transfer = NULL;
}
@@ -412,10 +434,85 @@ st_create_color_map_texture(struct gl_context *ctx)
return pt;
}
+/**
+ * Try to find a matching sampler view for the given context.
+ * If none is found an empty slot is initialized with a
+ * template and returned instead.
+ */
+struct pipe_sampler_view **
+st_texture_get_sampler_view(struct st_context *st,
+ struct st_texture_object *stObj)
+{
+ struct pipe_sampler_view **used = NULL, **free = NULL;
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i) {
+ struct pipe_sampler_view **sv = &stObj->sampler_views[i];
+ /* Is the array entry used ? */
+ if (*sv) {
+ /* Yes, check if it's the right one */
+ if ((*sv)->context == st->pipe)
+ return sv;
+
+ /* Wasn't the right one, but remember it as template */
+ used = sv;
+ } else {
+ /* Found a free slot, remember that */
+ free = sv;
+ }
+ }
+
+ /* Couldn't find a slot for our context, create a new one */
+
+ if (!free) {
+ /* Haven't even found a free one, resize the array */
+ GLuint old_size = stObj->num_sampler_views * sizeof(void *);
+ GLuint new_size = old_size + sizeof(void *);
+ stObj->sampler_views = REALLOC(stObj->sampler_views, old_size, new_size);
+ free = &stObj->sampler_views[stObj->num_sampler_views++];
+ *free = NULL;
+ }
+
+ /* Add just any sampler view to be used as a template */
+ if (used)
+ pipe_sampler_view_reference(free, *used);
+
+ return free;
+}
+
void
st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj)
{
- if (stObj->sampler_view && stObj->sampler_view->context == st->pipe)
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i) {
+ struct pipe_sampler_view **sv = &stObj->sampler_views[i];
+
+ if (*sv && (*sv)->context == st->pipe) {
+ pipe_sampler_view_reference(sv, NULL);
+ break;
+ }
+ }
+}
+
+void
+st_texture_release_all_sampler_views(struct st_texture_object *stObj)
+{
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i)
+ pipe_sampler_view_reference(&stObj->sampler_views[i], NULL);
+}
+
+
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj)
+{
+ /* NOTE:
+ * We use FREE() here to match REALLOC() above. Both come from
+ * u_memory.h, not imports.h. If we mis-match MALLOC/FREE from
+ * those two headers we can trash the heap.
+ */
+ FREE(stObj->sampler_views);
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index b4a27a00a..affb56812 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -56,7 +56,11 @@ struct st_texture_image
*/
struct pipe_resource *pt;
- struct pipe_transfer *transfer;
+ /* List of transfers, allocated on demand.
+ * transfer[layer] is a mapping for that layer.
+ */
+ struct pipe_transfer **transfer;
+ unsigned num_transfers;
};
@@ -82,10 +86,13 @@ struct st_texture_object
*/
struct pipe_resource *pt;
- /* Default sampler view attached to this texture object. Created lazily
- * on first binding.
+ /* Number of views in sampler_views array */
+ GLuint num_sampler_views;
+
+ /* Array of sampler views (one per context) attached to this texture
+ * object. Created lazily on first binding in context.
*/
- struct pipe_sampler_view *sampler_view;
+ struct pipe_sampler_view **sampler_views;
/* True if this texture comes from the window system. Such a texture
* cannot be reallocated and the format can only be changed with a sampler
@@ -192,11 +199,12 @@ extern GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
enum pipe_transfer_usage usage,
GLuint x, GLuint y, GLuint z,
- GLuint w, GLuint h, GLuint d);
+ GLuint w, GLuint h, GLuint d,
+ struct pipe_transfer **transfer);
extern void
st_texture_image_unmap(struct st_context *st,
- struct st_texture_image *stImage);
+ struct st_texture_image *stImage, unsigned slice);
/* Return pointers to each 2d slice within an image. Indexed by depth
@@ -227,8 +235,18 @@ st_texture_image_copy(struct pipe_context *pipe,
extern struct pipe_resource *
st_create_color_map_texture(struct gl_context *ctx);
+extern struct pipe_sampler_view **
+st_texture_get_sampler_view(struct st_context *st,
+ struct st_texture_object *stObj);
+
extern void
st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj);
+extern void
+st_texture_release_all_sampler_views(struct st_texture_object *stObj);
+
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj);
+
#endif
diff --git a/mesalib/src/mesa/state_tracker/st_vdpau.c b/mesalib/src/mesa/state_tracker/st_vdpau.c
index c5b4780ce..8c10cdaf3 100644
--- a/mesalib/src/mesa/state_tracker/st_vdpau.c
+++ b/mesalib/src/mesa/state_tracker/st_vdpau.c
@@ -63,7 +63,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_resource *res;
- struct pipe_sampler_view *sv, templ;
+ struct pipe_sampler_view templ, **sampler_view;
mesa_format texFormat;
getProcAddr = ctx->vdpGetProcAddress;
@@ -83,6 +83,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
}
} else {
+ struct pipe_sampler_view *sv;
VdpVideoSurfaceGallium *f;
struct pipe_video_buffer *buffer;
@@ -138,7 +139,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
texFormat);
pipe_resource_reference(&stObj->pt, res);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, res);
u_sampler_view_default_template(&templ, res, res->format);
@@ -148,7 +149,9 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
templ.swizzle_g = GET_SWZ(stObj->base._Swizzle, 1);
templ.swizzle_b = GET_SWZ(stObj->base._Swizzle, 2);
templ.swizzle_a = GET_SWZ(stObj->base._Swizzle, 3);
- stObj->sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
+
+ sampler_view = st_texture_get_sampler_view(st, stObj);
+ *sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
stObj->width0 = res->width0;
stObj->height0 = res->height0;
@@ -169,7 +172,7 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
struct st_texture_image *stImage = st_texture_image(texImage);
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, NULL);
_mesa_dirty_texobj(ctx, texObj);
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index cd0982705..90a514c16 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -129,9 +129,24 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage,
}
+#define FETCH_FUNCS(NAME) \
+ { \
+ MESA_FORMAT_ ## NAME, \
+ fetch_texel_1d_ ## NAME, \
+ fetch_texel_2d_ ## NAME, \
+ fetch_texel_3d_ ## NAME, \
+ }
+
+#define FETCH_NULL(NAME) \
+ { \
+ MESA_FORMAT_ ## NAME, \
+ NULL, \
+ NULL, \
+ NULL \
+ }
+
/**
* Table to map MESA_FORMAT_ to texel fetch/store funcs.
- * XXX this is somewhat temporary.
*/
static struct {
mesa_format Name;
@@ -149,978 +164,198 @@ texfetch_funcs[] =
},
/* Packed unorm formats */
- {
- MESA_FORMAT_A8B8G8R8_UNORM,
- fetch_texel_1d_f_rgba8888,
- fetch_texel_2d_f_rgba8888,
- fetch_texel_3d_f_rgba8888
- },
- {
- MESA_FORMAT_X8B8G8R8_UNORM,
- fetch_texel_1d_f_rgbx8888,
- fetch_texel_2d_f_rgbx8888,
- fetch_texel_3d_f_rgbx8888
- },
- {
- MESA_FORMAT_R8G8B8A8_UNORM,
- fetch_texel_1d_f_rgba8888_rev,
- fetch_texel_2d_f_rgba8888_rev,
- fetch_texel_3d_f_rgba8888_rev
- },
- {
- MESA_FORMAT_R8G8B8X8_UNORM,
- fetch_texel_1d_f_rgbx8888_rev,
- fetch_texel_2d_f_rgbx8888_rev,
- fetch_texel_3d_f_rgbx8888_rev
- },
- {
- MESA_FORMAT_B8G8R8A8_UNORM,
- fetch_texel_1d_f_argb8888,
- fetch_texel_2d_f_argb8888,
- fetch_texel_3d_f_argb8888
- },
- {
- MESA_FORMAT_B8G8R8X8_UNORM,
- fetch_texel_1d_f_xrgb8888,
- fetch_texel_2d_f_xrgb8888,
- fetch_texel_3d_f_xrgb8888
- },
- {
- MESA_FORMAT_A8R8G8B8_UNORM,
- fetch_texel_1d_f_argb8888_rev,
- fetch_texel_2d_f_argb8888_rev,
- fetch_texel_3d_f_argb8888_rev
- },
- {
- MESA_FORMAT_X8R8G8B8_UNORM,
- fetch_texel_1d_f_xrgb8888_rev,
- fetch_texel_2d_f_xrgb8888_rev,
- fetch_texel_3d_f_xrgb8888_rev
- },
- {
- MESA_FORMAT_L16A16_UNORM,
- fetch_texel_1d_f_al1616,
- fetch_texel_2d_f_al1616,
- fetch_texel_3d_f_al1616
- },
- {
- MESA_FORMAT_A16L16_UNORM,
- fetch_texel_1d_f_al1616_rev,
- fetch_texel_2d_f_al1616_rev,
- fetch_texel_3d_f_al1616_rev
- },
- {
- MESA_FORMAT_B5G6R5_UNORM,
- fetch_texel_1d_f_rgb565,
- fetch_texel_2d_f_rgb565,
- fetch_texel_3d_f_rgb565
- },
- {
- MESA_FORMAT_R5G6B5_UNORM,
- fetch_texel_1d_f_rgb565_rev,
- fetch_texel_2d_f_rgb565_rev,
- fetch_texel_3d_f_rgb565_rev
- },
- {
- MESA_FORMAT_B4G4R4A4_UNORM,
- fetch_texel_1d_f_argb4444,
- fetch_texel_2d_f_argb4444,
- fetch_texel_3d_f_argb4444
- },
- {
- MESA_FORMAT_B4G4R4X4_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A4R4G4B4_UNORM,
- fetch_texel_1d_f_argb4444_rev,
- fetch_texel_2d_f_argb4444_rev,
- fetch_texel_3d_f_argb4444_rev
- },
- {
- MESA_FORMAT_A1B5G5R5_UNORM,
- fetch_texel_1d_f_rgba5551,
- fetch_texel_2d_f_rgba5551,
- fetch_texel_3d_f_rgba5551
- },
- {
- MESA_FORMAT_B5G5R5A1_UNORM,
- fetch_texel_1d_f_argb1555,
- fetch_texel_2d_f_argb1555,
- fetch_texel_3d_f_argb1555
- },
- {
- MESA_FORMAT_B5G5R5X1_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A1R5G5B5_UNORM,
- fetch_texel_1d_f_argb1555_rev,
- fetch_texel_2d_f_argb1555_rev,
- fetch_texel_3d_f_argb1555_rev
- },
- {
- MESA_FORMAT_L8A8_UNORM,
- fetch_texel_1d_f_al88,
- fetch_texel_2d_f_al88,
- fetch_texel_3d_f_al88
- },
- {
- MESA_FORMAT_A8L8_UNORM,
- fetch_texel_1d_f_al88_rev,
- fetch_texel_2d_f_al88_rev,
- fetch_texel_3d_f_al88_rev
- },
- {
- MESA_FORMAT_R8G8_UNORM,
- fetch_texel_1d_f_gr88,
- fetch_texel_2d_f_gr88,
- fetch_texel_3d_f_gr88
- },
- {
- MESA_FORMAT_G8R8_UNORM,
- fetch_texel_1d_f_rg88,
- fetch_texel_2d_f_rg88,
- fetch_texel_3d_f_rg88
- },
- {
- MESA_FORMAT_L4A4_UNORM,
- fetch_texel_1d_f_al44,
- fetch_texel_2d_f_al44,
- fetch_texel_3d_f_al44
- },
- {
- MESA_FORMAT_B2G3R3_UNORM,
- fetch_texel_1d_f_rgb332,
- fetch_texel_2d_f_rgb332,
- fetch_texel_3d_f_rgb332
- },
- {
- MESA_FORMAT_R16G16_UNORM,
- fetch_texel_1d_f_rg1616,
- fetch_texel_2d_f_rg1616,
- fetch_texel_3d_f_rg1616
- },
- {
- MESA_FORMAT_G16R16_UNORM,
- fetch_texel_1d_f_rg1616_rev,
- fetch_texel_2d_f_rg1616_rev,
- fetch_texel_3d_f_rg1616_rev
- },
- {
- MESA_FORMAT_B10G10R10A2_UNORM,
- fetch_texel_1d_f_argb2101010,
- fetch_texel_2d_f_argb2101010,
- fetch_texel_3d_f_argb2101010
- },
- {
- MESA_FORMAT_B10G10R10X2_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R10G10B10A2_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_S8_UINT_Z24_UNORM,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8
- },
+ FETCH_FUNCS(A8B8G8R8_UNORM),
+ FETCH_FUNCS(X8B8G8R8_UNORM),
+ FETCH_FUNCS(R8G8B8A8_UNORM),
+ FETCH_FUNCS(R8G8B8X8_UNORM),
+ FETCH_FUNCS(B8G8R8A8_UNORM),
+ FETCH_FUNCS(B8G8R8X8_UNORM),
+ FETCH_FUNCS(A8R8G8B8_UNORM),
+ FETCH_FUNCS(X8R8G8B8_UNORM),
+ FETCH_FUNCS(L16A16_UNORM),
+ FETCH_FUNCS(A16L16_UNORM),
+ FETCH_FUNCS(B5G6R5_UNORM),
+ FETCH_FUNCS(R5G6B5_UNORM),
+ FETCH_FUNCS(B4G4R4A4_UNORM),
+ FETCH_NULL(B4G4R4X4_UNORM),
+ FETCH_FUNCS(A4R4G4B4_UNORM),
+ FETCH_FUNCS(A1B5G5R5_UNORM),
+ FETCH_FUNCS(B5G5R5A1_UNORM),
+ FETCH_NULL(B5G5R5X1_UNORM),
+ FETCH_FUNCS(A1R5G5B5_UNORM),
+ FETCH_FUNCS(L8A8_UNORM),
+ FETCH_FUNCS(A8L8_UNORM),
+ FETCH_FUNCS(R8G8_UNORM),
+ FETCH_FUNCS(G8R8_UNORM),
+ FETCH_FUNCS(L4A4_UNORM),
+ FETCH_FUNCS(B2G3R3_UNORM),
+ FETCH_FUNCS(R16G16_UNORM),
+ FETCH_FUNCS(G16R16_UNORM),
+ FETCH_FUNCS(B10G10R10A2_UNORM),
+ FETCH_NULL(B10G10R10X2_UNORM),
+ FETCH_FUNCS(R10G10B10A2_UNORM),
+ FETCH_FUNCS(S8_UINT_Z24_UNORM),
{
MESA_FORMAT_X8_UINT_Z24_UNORM,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8
- },
- {
- MESA_FORMAT_Z24_UNORM_S8_UINT,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24
+ fetch_texel_1d_S8_UINT_Z24_UNORM,
+ fetch_texel_2d_S8_UINT_Z24_UNORM,
+ fetch_texel_3d_S8_UINT_Z24_UNORM
},
+ FETCH_FUNCS(Z24_UNORM_S8_UINT),
{
MESA_FORMAT_Z24_UNORM_X8_UINT,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24
- },
- {
- MESA_FORMAT_YCBCR,
- fetch_texel_1d_f_ycbcr,
- fetch_texel_2d_f_ycbcr,
- fetch_texel_3d_f_ycbcr
- },
- {
- MESA_FORMAT_YCBCR_REV,
- fetch_texel_1d_f_ycbcr_rev,
- fetch_texel_2d_f_ycbcr_rev,
- fetch_texel_3d_f_ycbcr_rev
- },
- {
- MESA_FORMAT_DUDV8,
- fetch_texel_1d_dudv8,
- fetch_texel_2d_dudv8,
- fetch_texel_3d_dudv8
+ fetch_texel_1d_Z24_UNORM_S8_UINT,
+ fetch_texel_2d_Z24_UNORM_S8_UINT,
+ fetch_texel_3d_Z24_UNORM_S8_UINT
},
+ FETCH_FUNCS(YCBCR),
+ FETCH_FUNCS(YCBCR_REV),
+ FETCH_FUNCS(DUDV8),
/* Array unorm formats */
- {
- MESA_FORMAT_A_UNORM8,
- fetch_texel_1d_f_a8,
- fetch_texel_2d_f_a8,
- fetch_texel_3d_f_a8
- },
- {
- MESA_FORMAT_A_UNORM16,
- fetch_texel_1d_f_a16,
- fetch_texel_2d_f_a16,
- fetch_texel_3d_f_a16
- },
- {
- MESA_FORMAT_L_UNORM8,
- fetch_texel_1d_f_l8,
- fetch_texel_2d_f_l8,
- fetch_texel_3d_f_l8
- },
- {
- MESA_FORMAT_L_UNORM16,
- fetch_texel_1d_f_l16,
- fetch_texel_2d_f_l16,
- fetch_texel_3d_f_l16
- },
- {
- MESA_FORMAT_I_UNORM8,
- fetch_texel_1d_f_i8,
- fetch_texel_2d_f_i8,
- fetch_texel_3d_f_i8
- },
- {
- MESA_FORMAT_I_UNORM16,
- fetch_texel_1d_f_i16,
- fetch_texel_2d_f_i16,
- fetch_texel_3d_f_i16
- },
- {
- MESA_FORMAT_R_UNORM8,
- fetch_texel_1d_f_r8,
- fetch_texel_2d_f_r8,
- fetch_texel_3d_f_r8
- },
- {
- MESA_FORMAT_R_UNORM16,
- fetch_texel_1d_f_r16,
- fetch_texel_2d_f_r16,
- fetch_texel_3d_f_r16
- },
- {
- MESA_FORMAT_BGR_UNORM8,
- fetch_texel_1d_f_rgb888,
- fetch_texel_2d_f_rgb888,
- fetch_texel_3d_f_rgb888
- },
- {
- MESA_FORMAT_RGB_UNORM8,
- fetch_texel_1d_f_bgr888,
- fetch_texel_2d_f_bgr888,
- fetch_texel_3d_f_bgr888
- },
- {
- MESA_FORMAT_RGBA_UNORM16,
- fetch_texel_1d_rgba_16,
- fetch_texel_2d_rgba_16,
- fetch_texel_3d_rgba_16
- },
- {
- MESA_FORMAT_RGBX_UNORM16,
- fetch_texel_1d_xbgr16161616_unorm,
- fetch_texel_2d_xbgr16161616_unorm,
- fetch_texel_3d_xbgr16161616_unorm
- },
- {
- MESA_FORMAT_Z_UNORM16,
- fetch_texel_1d_f_z16,
- fetch_texel_2d_f_z16,
- fetch_texel_3d_f_z16
- },
- {
- MESA_FORMAT_Z_UNORM32,
- fetch_texel_1d_f_z32,
- fetch_texel_2d_f_z32,
- fetch_texel_3d_f_z32
- },
- {
- MESA_FORMAT_S_UINT8,
- NULL,
- NULL,
- NULL
- },
+ FETCH_FUNCS(A_UNORM8),
+ FETCH_FUNCS(A_UNORM16),
+ FETCH_FUNCS(L_UNORM8),
+ FETCH_FUNCS(L_UNORM16),
+ FETCH_FUNCS(I_UNORM8),
+ FETCH_FUNCS(I_UNORM16),
+ FETCH_FUNCS(R_UNORM8),
+ FETCH_FUNCS(R_UNORM16),
+ FETCH_FUNCS(BGR_UNORM8),
+ FETCH_FUNCS(RGB_UNORM8),
+ FETCH_FUNCS(RGBA_UNORM16),
+ FETCH_FUNCS(RGBX_UNORM16),
+ FETCH_FUNCS(Z_UNORM16),
+ FETCH_FUNCS(Z_UNORM32),
+ FETCH_NULL(S_UINT8),
/* Packed signed/normalized formats */
- {
- MESA_FORMAT_A8B8G8R8_SNORM,
- fetch_texel_1d_signed_rgba8888,
- fetch_texel_2d_signed_rgba8888,
- fetch_texel_3d_signed_rgba8888
- },
- {
- MESA_FORMAT_X8B8G8R8_SNORM,
- fetch_texel_1d_signed_rgbx8888,
- fetch_texel_2d_signed_rgbx8888,
- fetch_texel_3d_signed_rgbx8888
- },
- {
- MESA_FORMAT_R8G8B8A8_SNORM,
- fetch_texel_1d_signed_rgba8888_rev,
- fetch_texel_2d_signed_rgba8888_rev,
- fetch_texel_3d_signed_rgba8888_rev
- },
- {
- MESA_FORMAT_R8G8B8X8_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R16G16_SNORM,
- fetch_texel_1d_signed_rg1616,
- fetch_texel_2d_signed_rg1616,
- fetch_texel_3d_signed_rg1616
- },
- {
- MESA_FORMAT_G16R16_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R8G8_SNORM,
- fetch_texel_1d_signed_rg88_rev,
- fetch_texel_2d_signed_rg88_rev,
- fetch_texel_3d_signed_rg88_rev
- },
- {
- MESA_FORMAT_G8R8_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L8A8_SNORM,
- fetch_texel_1d_signed_al88,
- fetch_texel_2d_signed_al88,
- fetch_texel_3d_signed_al88
- },
+ FETCH_FUNCS(A8B8G8R8_SNORM),
+ FETCH_FUNCS(X8B8G8R8_SNORM),
+ FETCH_FUNCS(R8G8B8A8_SNORM),
+ FETCH_NULL(R8G8B8X8_SNORM),
+ FETCH_FUNCS(R16G16_SNORM),
+ FETCH_NULL(G16R16_SNORM),
+ FETCH_FUNCS(R8G8_SNORM),
+ FETCH_NULL(G8R8_SNORM),
+ FETCH_FUNCS(L8A8_SNORM),
/* Array signed/normalized formats */
- {
- MESA_FORMAT_A_SNORM8,
- fetch_texel_1d_signed_a8,
- fetch_texel_2d_signed_a8,
- fetch_texel_3d_signed_a8
- },
- {
- MESA_FORMAT_A_SNORM16,
- fetch_texel_1d_signed_a16,
- fetch_texel_2d_signed_a16,
- fetch_texel_3d_signed_a16
- },
- {
- MESA_FORMAT_L_SNORM8,
- fetch_texel_1d_signed_l8,
- fetch_texel_2d_signed_l8,
- fetch_texel_3d_signed_l8
- },
- {
- MESA_FORMAT_L_SNORM16,
- fetch_texel_1d_signed_l16,
- fetch_texel_2d_signed_l16,
- fetch_texel_3d_signed_l16
- },
- {
- MESA_FORMAT_I_SNORM8,
- fetch_texel_1d_signed_i8,
- fetch_texel_2d_signed_i8,
- fetch_texel_3d_signed_i8
- },
- {
- MESA_FORMAT_I_SNORM16,
- fetch_texel_1d_signed_i16,
- fetch_texel_2d_signed_i16,
- fetch_texel_3d_signed_i16
- },
- {
- MESA_FORMAT_R_SNORM8,
- fetch_texel_1d_signed_r8,
- fetch_texel_2d_signed_r8,
- fetch_texel_3d_signed_r8
- },
- {
- MESA_FORMAT_R_SNORM16,
- fetch_texel_1d_signed_r16,
- fetch_texel_2d_signed_r16,
- fetch_texel_3d_signed_r16
- },
- {
- MESA_FORMAT_LA_SNORM16,
- fetch_texel_1d_signed_al1616,
- fetch_texel_2d_signed_al1616,
- fetch_texel_3d_signed_al1616
- },
- {
- MESA_FORMAT_RGB_SNORM16,
- fetch_texel_1d_signed_rgb_16,
- fetch_texel_2d_signed_rgb_16,
- fetch_texel_3d_signed_rgb_16
- },
- {
- MESA_FORMAT_RGBA_SNORM16,
- fetch_texel_1d_signed_rgba_16,
- fetch_texel_2d_signed_rgba_16,
- fetch_texel_3d_signed_rgba_16
- },
- {
- MESA_FORMAT_RGBX_SNORM16,
- NULL,
- NULL,
- NULL
- },
+ FETCH_FUNCS(A_SNORM8),
+ FETCH_FUNCS(A_SNORM16),
+ FETCH_FUNCS(L_SNORM8),
+ FETCH_FUNCS(L_SNORM16),
+ FETCH_FUNCS(I_SNORM8),
+ FETCH_FUNCS(I_SNORM16),
+ FETCH_FUNCS(R_SNORM8),
+ FETCH_FUNCS(R_SNORM16),
+ FETCH_FUNCS(LA_SNORM16),
+ FETCH_FUNCS(RGB_SNORM16),
+ FETCH_FUNCS(RGBA_SNORM16),
+ FETCH_NULL(RGBX_SNORM16),
/* Packed sRGB formats */
- {
- MESA_FORMAT_A8B8G8R8_SRGB,
- fetch_texel_1d_srgba8,
- fetch_texel_2d_srgba8,
- fetch_texel_3d_srgba8
- },
- {
- MESA_FORMAT_B8G8R8A8_SRGB,
- fetch_texel_1d_sargb8,
- fetch_texel_2d_sargb8,
- fetch_texel_3d_sargb8
- },
- {
- MESA_FORMAT_B8G8R8X8_SRGB,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R8G8B8A8_SRGB,
- fetch_texel_1d_sabgr8,
- fetch_texel_2d_sabgr8,
- fetch_texel_3d_sabgr8
- },
- {
- MESA_FORMAT_R8G8B8X8_SRGB,
- fetch_texel_1d_sxbgr8,
- fetch_texel_2d_sxbgr8,
- fetch_texel_3d_sxbgr8
- },
- {
- MESA_FORMAT_L8A8_SRGB,
- fetch_texel_1d_sla8,
- fetch_texel_2d_sla8,
- fetch_texel_3d_sla8
- },
+ FETCH_FUNCS(A8B8G8R8_SRGB),
+ FETCH_FUNCS(B8G8R8A8_SRGB),
+ FETCH_NULL(B8G8R8X8_SRGB),
+ FETCH_FUNCS(R8G8B8A8_SRGB),
+ FETCH_FUNCS(R8G8B8X8_SRGB),
+ FETCH_FUNCS(L8A8_SRGB),
/* Array sRGB formats */
- {
- MESA_FORMAT_L_SRGB8,
- fetch_texel_1d_sl8,
- fetch_texel_2d_sl8,
- fetch_texel_3d_sl8
- },
- {
- MESA_FORMAT_BGR_SRGB8,
- fetch_texel_1d_srgb8,
- fetch_texel_2d_srgb8,
- fetch_texel_3d_srgb8
- },
+ FETCH_FUNCS(L_SRGB8),
+ FETCH_FUNCS(BGR_SRGB8),
/* Packed float formats */
- {
- MESA_FORMAT_R9G9B9E5_FLOAT,
- fetch_texel_1d_rgb9_e5,
- fetch_texel_2d_rgb9_e5,
- fetch_texel_3d_rgb9_e5
- },
- {
- MESA_FORMAT_R11G11B10_FLOAT,
- fetch_texel_1d_r11_g11_b10f,
- fetch_texel_2d_r11_g11_b10f,
- fetch_texel_3d_r11_g11_b10f
- },
- {
- MESA_FORMAT_Z32_FLOAT_S8X24_UINT,
- fetch_texel_1d_z32f_x24s8,
- fetch_texel_2d_z32f_x24s8,
- fetch_texel_3d_z32f_x24s8
- },
+ FETCH_FUNCS(R9G9B9E5_FLOAT),
+ FETCH_FUNCS(R11G11B10_FLOAT),
+ FETCH_FUNCS(Z32_FLOAT_S8X24_UINT),
/* Array float formats */
- {
- MESA_FORMAT_A_FLOAT16,
- fetch_texel_1d_f_alpha_f16,
- fetch_texel_2d_f_alpha_f16,
- fetch_texel_3d_f_alpha_f16
- },
- {
- MESA_FORMAT_A_FLOAT32,
- fetch_texel_1d_f_alpha_f32,
- fetch_texel_2d_f_alpha_f32,
- fetch_texel_3d_f_alpha_f32
- },
- {
- MESA_FORMAT_L_FLOAT16,
- fetch_texel_1d_f_luminance_f16,
- fetch_texel_2d_f_luminance_f16,
- fetch_texel_3d_f_luminance_f16
- },
- {
- MESA_FORMAT_L_FLOAT32,
- fetch_texel_1d_f_luminance_f32,
- fetch_texel_2d_f_luminance_f32,
- fetch_texel_3d_f_luminance_f32
- },
- {
- MESA_FORMAT_LA_FLOAT16,
- fetch_texel_1d_f_luminance_alpha_f16,
- fetch_texel_2d_f_luminance_alpha_f16,
- fetch_texel_3d_f_luminance_alpha_f16
- },
- {
- MESA_FORMAT_LA_FLOAT32,
- fetch_texel_1d_f_luminance_alpha_f32,
- fetch_texel_2d_f_luminance_alpha_f32,
- fetch_texel_3d_f_luminance_alpha_f32
- },
- {
- MESA_FORMAT_I_FLOAT16,
- fetch_texel_1d_f_intensity_f16,
- fetch_texel_2d_f_intensity_f16,
- fetch_texel_3d_f_intensity_f16
- },
- {
- MESA_FORMAT_I_FLOAT32,
- fetch_texel_1d_f_intensity_f32,
- fetch_texel_2d_f_intensity_f32,
- fetch_texel_3d_f_intensity_f32
- },
- {
- MESA_FORMAT_R_FLOAT16,
- fetch_texel_1d_f_r_f16,
- fetch_texel_2d_f_r_f16,
- fetch_texel_3d_f_r_f16
- },
- {
- MESA_FORMAT_R_FLOAT32,
- fetch_texel_1d_f_r_f32,
- fetch_texel_2d_f_r_f32,
- fetch_texel_3d_f_r_f32
- },
- {
- MESA_FORMAT_RG_FLOAT16,
- fetch_texel_1d_f_rg_f16,
- fetch_texel_2d_f_rg_f16,
- fetch_texel_3d_f_rg_f16
- },
- {
- MESA_FORMAT_RG_FLOAT32,
- fetch_texel_1d_f_rg_f32,
- fetch_texel_2d_f_rg_f32,
- fetch_texel_3d_f_rg_f32
- },
- {
- MESA_FORMAT_RGB_FLOAT16,
- fetch_texel_1d_f_rgb_f16,
- fetch_texel_2d_f_rgb_f16,
- fetch_texel_3d_f_rgb_f16
- },
- {
- MESA_FORMAT_RGB_FLOAT32,
- fetch_texel_1d_f_rgb_f32,
- fetch_texel_2d_f_rgb_f32,
- fetch_texel_3d_f_rgb_f32
- },
- {
- MESA_FORMAT_RGBA_FLOAT16,
- fetch_texel_1d_f_rgba_f16,
- fetch_texel_2d_f_rgba_f16,
- fetch_texel_3d_f_rgba_f16
- },
- {
- MESA_FORMAT_RGBA_FLOAT32,
- fetch_texel_1d_f_rgba_f32,
- fetch_texel_2d_f_rgba_f32,
- fetch_texel_3d_f_rgba_f32
- },
- {
- MESA_FORMAT_RGBX_FLOAT16,
- fetch_texel_1d_xbgr16161616_float,
- fetch_texel_2d_xbgr16161616_float,
- fetch_texel_3d_xbgr16161616_float
- },
- {
- MESA_FORMAT_RGBX_FLOAT32,
- fetch_texel_1d_xbgr32323232_float,
- fetch_texel_2d_xbgr32323232_float,
- fetch_texel_3d_xbgr32323232_float
- },
+ FETCH_FUNCS(A_FLOAT16),
+ FETCH_FUNCS(A_FLOAT32),
+ FETCH_FUNCS(L_FLOAT16),
+ FETCH_FUNCS(L_FLOAT32),
+ FETCH_FUNCS(LA_FLOAT16),
+ FETCH_FUNCS(LA_FLOAT32),
+ FETCH_FUNCS(I_FLOAT16),
+ FETCH_FUNCS(I_FLOAT32),
+ FETCH_FUNCS(R_FLOAT16),
+ FETCH_FUNCS(R_FLOAT32),
+ FETCH_FUNCS(RG_FLOAT16),
+ FETCH_FUNCS(RG_FLOAT32),
+ FETCH_FUNCS(RGB_FLOAT16),
+ FETCH_FUNCS(RGB_FLOAT32),
+ FETCH_FUNCS(RGBA_FLOAT16),
+ FETCH_FUNCS(RGBA_FLOAT32),
+ FETCH_FUNCS(RGBX_FLOAT16),
+ FETCH_FUNCS(RGBX_FLOAT32),
{
MESA_FORMAT_Z_FLOAT32,
- fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */
- fetch_texel_2d_f_r_f32,
- fetch_texel_3d_f_r_f32
+ fetch_texel_1d_R_FLOAT32, /* Reuse the R32F functions. */
+ fetch_texel_2d_R_FLOAT32,
+ fetch_texel_3d_R_FLOAT32
},
/* Packed signed/unsigned non-normalized integer formats */
- {
- MESA_FORMAT_B10G10R10A2_UINT,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R10G10B10A2_UINT,
- NULL,
- NULL,
- NULL
- },
+ FETCH_NULL(B10G10R10A2_UINT),
+ FETCH_NULL(R10G10B10A2_UINT),
/* Array signed/unsigned non-normalized integer formats */
- {
- MESA_FORMAT_A_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBA_UINT8,
- fetch_texel_1d_rgba_uint8,
- fetch_texel_2d_rgba_uint8,
- fetch_texel_3d_rgba_uint8
- },
- {
- MESA_FORMAT_RGBA_UINT16,
- fetch_texel_1d_rgba_uint16,
- fetch_texel_2d_rgba_uint16,
- fetch_texel_3d_rgba_uint16
- },
- {
- MESA_FORMAT_RGBA_UINT32,
- fetch_texel_1d_rgba_uint32,
- fetch_texel_2d_rgba_uint32,
- fetch_texel_3d_rgba_uint32
- },
- {
- MESA_FORMAT_RGBA_SINT8,
- fetch_texel_1d_rgba_int8,
- fetch_texel_2d_rgba_int8,
- fetch_texel_3d_rgba_int8
- },
- {
- MESA_FORMAT_RGBA_SINT16,
- fetch_texel_1d_rgba_int16,
- fetch_texel_2d_rgba_int16,
- fetch_texel_3d_rgba_int16
- },
- {
- MESA_FORMAT_RGBA_SINT32,
- fetch_texel_1d_rgba_int32,
- fetch_texel_2d_rgba_int32,
- fetch_texel_3d_rgba_int32
- },
- {
- MESA_FORMAT_RGBX_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT32,
- NULL,
- NULL,
- NULL
- },
+ FETCH_NULL(A_UINT8),
+ FETCH_NULL(A_UINT16),
+ FETCH_NULL(A_UINT32),
+ FETCH_NULL(A_SINT8),
+ FETCH_NULL(A_SINT16),
+ FETCH_NULL(A_SINT32),
+ FETCH_NULL(I_UINT8),
+ FETCH_NULL(I_UINT16),
+ FETCH_NULL(I_UINT32),
+ FETCH_NULL(I_SINT8),
+ FETCH_NULL(I_SINT16),
+ FETCH_NULL(I_SINT32),
+ FETCH_NULL(L_UINT8),
+ FETCH_NULL(L_UINT16),
+ FETCH_NULL(L_UINT32),
+ FETCH_NULL(L_SINT8),
+ FETCH_NULL(L_SINT16),
+ FETCH_NULL(L_SINT32),
+ FETCH_NULL(LA_UINT8),
+ FETCH_NULL(LA_UINT16),
+ FETCH_NULL(LA_UINT32),
+ FETCH_NULL(LA_SINT8),
+ FETCH_NULL(LA_SINT16),
+ FETCH_NULL(LA_SINT32),
+ FETCH_NULL(R_UINT8),
+ FETCH_NULL(R_UINT16),
+ FETCH_NULL(R_UINT32),
+ FETCH_NULL(R_SINT8),
+ FETCH_NULL(R_SINT16),
+ FETCH_NULL(R_SINT32),
+ FETCH_NULL(RG_UINT8),
+ FETCH_NULL(RG_UINT16),
+ FETCH_NULL(RG_UINT32),
+ FETCH_NULL(RG_SINT8),
+ FETCH_NULL(RG_SINT16),
+ FETCH_NULL(RG_SINT32),
+ FETCH_NULL(RGB_UINT8),
+ FETCH_NULL(RGB_UINT16),
+ FETCH_NULL(RGB_UINT32),
+ FETCH_NULL(RGB_SINT8),
+ FETCH_NULL(RGB_SINT16),
+ FETCH_NULL(RGB_SINT32),
+ FETCH_FUNCS(RGBA_UINT8),
+ FETCH_FUNCS(RGBA_UINT16),
+ FETCH_FUNCS(RGBA_UINT32),
+ FETCH_FUNCS(RGBA_SINT8),
+ FETCH_FUNCS(RGBA_SINT16),
+ FETCH_FUNCS(RGBA_SINT32),
+ FETCH_NULL(RGBX_UINT8),
+ FETCH_NULL(RGBX_UINT16),
+ FETCH_NULL(RGBX_UINT32),
+ FETCH_NULL(RGBX_SINT8),
+ FETCH_NULL(RGBX_SINT16),
+ FETCH_NULL(RGBX_SINT32),
/* DXT compressed formats */
{
diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index f749b491f..d48e39bfd 100644
--- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -27,14 +27,14 @@
/**
* \file texfetch_tmp.h
* Texel fetch functions template.
- *
+ *
* This template file is used by texfetch.c to generate texel fetch functions
- * for 1-D, 2-D and 3-D texture images.
+ * for 1-D, 2-D and 3-D texture images.
*
* It should be expanded by defining \p DIM as the number texture dimensions
* (1, 2 or 3). According to the value of \p DIM a series of macros is defined
* for the texel lookup in the gl_texture_image::Data.
- *
+ *
* \author Gareth Hughes
* \author Brian Paul
*/
@@ -69,41 +69,27 @@
#endif
-/* MESA_FORMAT_Z_UNORM32 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z_UNORM32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[0] = src[0] * (1.0F / 0xffffffff);
}
-/* MESA_FORMAT_Z_UNORM16 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[0] = src[0] * (1.0F / 65535.0F);
}
-
-/* MESA_FORMAT_RGBA_F32 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGBA_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
texel[RCOMP] = src[0];
@@ -113,15 +99,9 @@ static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_F16 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGBA_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -131,14 +111,9 @@ static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_RGB_F32 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
texel[RCOMP] = src[0];
@@ -148,15 +123,9 @@ static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB_F16 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -166,15 +135,9 @@ static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -184,15 +147,9 @@ static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -202,15 +159,9 @@ static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -220,15 +171,9 @@ static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -238,15 +183,9 @@ static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(LA_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -256,15 +195,9 @@ static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *tex
}
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(LA_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -274,15 +207,9 @@ static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *tex
}
-
-
-/* MESA_FORMAT_INTENSITY_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -292,15 +219,9 @@ static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_INTENSITY_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -310,15 +231,9 @@ static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_FLOAT32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D R_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] = src[0];
@@ -328,15 +243,9 @@ static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_FLOAT16 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D R_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -346,15 +255,9 @@ static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RG_FLOAT32 ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RG_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] = src[0];
@@ -364,15 +267,9 @@ static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RG_FLOAT16 ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RG_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -382,17 +279,9 @@ static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/*
- * Begin Hardware formats
- */
-
-/* MESA_FORMAT_A8B8G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
@@ -402,15 +291,9 @@ static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
}
-
-
-
-
-/* MESA_FORMAT_RGBA888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
@@ -420,13 +303,9 @@ static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B8G8R8A8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
@@ -436,13 +315,9 @@ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8R8G8B8_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8R8G8B8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
@@ -452,13 +327,9 @@ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8B8G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */
-static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8B8G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
@@ -468,13 +339,9 @@ static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBX888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */
-static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8X8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
@@ -484,13 +351,9 @@ static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B8G8R8X8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
-static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8X8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
@@ -500,13 +363,9 @@ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8R8G8B8_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8R8G8B8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
@@ -516,13 +375,9 @@ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_BGR_UNORM8 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(BGR_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
@@ -532,13 +387,9 @@ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB_UNORM8 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
@@ -548,16 +399,9 @@ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
}
-
-
-/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
- instead of slow (g << 2) * 255 / 252 (always rounds down) */
-
-/* MESA_FORMAT_B5G6R5_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B5G6R5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -568,13 +412,9 @@ static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R5G6B5_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R5G6B5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
@@ -585,13 +425,9 @@ static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B4G4R4A4_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B4G4R4A4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -602,13 +438,9 @@ static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A4R4G4B4_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A4R4G4B4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
@@ -618,12 +450,9 @@ static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_A1B5G5R5_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A1B5G5R5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -634,12 +463,9 @@ static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_B5G5R5A1_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B5G5R5A1_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -650,13 +476,9 @@ static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A1R5G5B5_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A1R5G5B5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
@@ -667,13 +489,9 @@ static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B10G10R10A2_UNORM ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
-static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B10G10R10A2_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLuint s = *src;
@@ -684,13 +502,22 @@ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
}
+static void
+FETCH(R10G10B10A2_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ const GLuint s = *src;
+ texel[RCOMP] = ((s >> 0) & 0x3ff) * (1.0F / 1023.0F);
+ texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ texel[BCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F);
+}
-/* MESA_FORMAT_R8G8_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_gr88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
@@ -700,13 +527,9 @@ static void FETCH(f_gr88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
-static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( s >> 8 );
@@ -716,13 +539,9 @@ static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L4A4_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */
-static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L4A4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -732,29 +551,21 @@ static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L8A8_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
}
-
-
-/* MESA_FORMAT_R_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(R_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(s);
@@ -764,13 +575,9 @@ static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
-static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(R_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT(s);
@@ -780,29 +587,21 @@ static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8L8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8L8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
}
-
-
-/* MESA_FORMAT_R16G16_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
-static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R16G16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT( s & 0xffff );
@@ -812,13 +611,9 @@ static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G16R16_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
-static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(G16R16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT( s >> 16 );
@@ -828,13 +623,9 @@ static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L16A16_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
-static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L16A16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -844,13 +635,9 @@ static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A16L16_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
-static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A16L16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -860,13 +647,9 @@ static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B2G3R3_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B2G3R3_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
const GLubyte s = *src;
@@ -877,13 +660,9 @@ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -893,13 +672,9 @@ static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_UNORM16 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -909,13 +684,9 @@ static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -925,13 +696,9 @@ static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
-static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -941,13 +708,9 @@ static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -957,13 +720,9 @@ static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
-static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -973,12 +732,9 @@ static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
}
-
-
-/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
-/* Note: component order is same as for MESA_FORMAT_BGR_UNORM8 */
-static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(BGR_SRGB8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = nonlinear_to_linear(src[2]);
@@ -988,10 +744,9 @@ static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
@@ -1001,10 +756,9 @@ static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
@@ -1014,10 +768,9 @@ static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */
-static void FETCH(sabgr8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff );
@@ -1027,9 +780,9 @@ static void FETCH(sabgr8)(const struct swrast_texture_image *texImage,
}
-/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */
-static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff );
@@ -1039,22 +792,21 @@ static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage,
}
-/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_SRGB8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = nonlinear_to_linear(src[0]);
texel[ACOMP] = 1.0F;
}
-
-/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -1064,13 +816,9 @@ static void FETCH(sla8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT8 **************************************************/
-
static void
-FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1080,13 +828,9 @@ FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT16 **************************************************/
-
static void
-FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1096,13 +840,9 @@ FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT32 **************************************************/
-
static void
-FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1112,13 +852,9 @@ FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT8 **************************************************/
-
static void
-FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1128,13 +864,9 @@ FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT16 **************************************************/
-
static void
-FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1144,13 +876,9 @@ FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT32 **************************************************/
-
static void
-FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1160,14 +888,13 @@ FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_DUDV8 ********************************************************/
-
-/* this format by definition produces 0,0,0,1 as rgba values,
- however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/**
+ * This format by definition produces 0,0,0,1 as rgba values,
+ * however we'll return the dudv values as rg and fix up elsewhere.
+ */
+static void
+FETCH(DUDV8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
@@ -1177,10 +904,9 @@ static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
}
-/* MESA_FORMAT_R_SNORM8 ***********************************************/
-
-static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( s );
@@ -1190,12 +916,9 @@ static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_SNORM8 ***********************************************/
-
-static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] = 0.0F;
@@ -1205,12 +928,9 @@ static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_SNORM8 ***********************************************/
-
-static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1220,12 +940,9 @@ static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_SNORM8 ***********************************************/
-
-static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1235,12 +952,9 @@ static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R8G8_SNORM ***********************************************/
-
-static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
@@ -1250,12 +964,9 @@ static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L8A8_SNORM ***********************************************/
-
-static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1265,12 +976,9 @@ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8B8G8R8_SNORM ***********************************************/
-
-static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
@@ -1280,12 +988,9 @@ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8B8G8R8_SNORM ***********************************************/
-
-static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
@@ -1295,9 +1000,9 @@ static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
}
-
-static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
@@ -1307,14 +1012,9 @@ static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texIm
}
-
-
-
-/* MESA_FORMAT_R_SNORM16 ***********************************************/
-
static void
-FETCH(signed_r16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(R_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s );
@@ -1324,13 +1024,9 @@ FETCH(signed_r16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_SNORM16 ***********************************************/
-
static void
-FETCH(signed_a16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(A_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = 0.0F;
@@ -1340,13 +1036,9 @@ FETCH(signed_a16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_SNORM16 ***********************************************/
-
static void
-FETCH(signed_l16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(L_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1356,13 +1048,9 @@ FETCH(signed_l16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_SNORM16 ***********************************************/
-
static void
-FETCH(signed_i16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(I_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1372,12 +1060,8 @@ FETCH(signed_i16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G16R16_SNORM ***********************************************/
-
static void
-FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
+FETCH(R16G16_SNORM)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -1388,13 +1072,9 @@ FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LA_SNORM16 ***********************************************/
-
static void
-FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(LA_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -1404,13 +1084,10 @@ FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
}
+static void
-
-/* MESA_FORMAT_RGB_SNORM16 ***********************************************/
-
-static void
-FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGB_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
@@ -1420,13 +1097,9 @@ FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SNORM16 ***********************************************/
-
static void
-FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBA_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
@@ -1436,14 +1109,9 @@ FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
}
-
-
-
-/* MESA_FORMAT_RGBA_UNORM16 ***********************************************/
-
static void
-FETCH(rgba_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBA_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = USHORT_TO_FLOAT( s[0] );
@@ -1453,12 +1121,9 @@ FETCH(rgba_16)(const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_XBGR.... **********************************************/
-
static void
-FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = USHORT_TO_FLOAT(s[0]);
@@ -1467,9 +1132,10 @@ FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
+
static void
-FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *s = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
texel[RCOMP] = _mesa_half_to_float(s[0]);
@@ -1478,9 +1144,10 @@ FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
+
static void
-FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *s = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
texel[RCOMP] = s[0];
@@ -1489,17 +1156,13 @@ FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
-/* XXX other XBGR formats need to be implemented here */
-
-
-/* MESA_FORMAT_YCBCR *********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
+/**
+ * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA.
*/
-static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(YCBCR)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
const GLushort *src1 = src0 + 1; /* odd */
@@ -1521,15 +1184,12 @@ static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_YCBCR_REV *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
+/**
+ * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA.
*/
-static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(YCBCR_REV)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
const GLushort *src1 = src0 + 1; /* odd */
@@ -1551,12 +1211,9 @@ static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
-
-static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(S8_UINT_Z24_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1569,12 +1226,9 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
-
-static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z24_UNORM_S8_UINT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1587,12 +1241,9 @@ static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB9_E5 ******************************************************/
-
-static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R9G9B9E5_FLOAT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
rgb9e5_to_float3(*src, texel);
@@ -1600,12 +1251,9 @@ static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R11G11B10_FLOAT *********************************************/
-
-static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R11G11B10_FLOAT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
r11g11b10f_to_float3(*src, texel);
@@ -1613,12 +1261,9 @@ static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_Z32_FLOAT_S8X24_UINT ***********************************************/
-
-static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(Z32_FLOAT_S8X24_UINT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] = src[0];
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index 134f699be..eb5bae41d 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -93,7 +93,7 @@ _tnl_CreateContext( struct gl_context *ctx )
}
/* plug in the VBO drawing function */
- vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
+ vbo_set_draw_func(ctx, _tnl_draw_prims);
_math_init_transformation();
_math_init_translate();
diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c
index 2755ae62d..be3f059bb 100644
--- a/mesalib/src/mesa/tnl/t_draw.c
+++ b/mesalib/src/mesa/tnl/t_draw.c
@@ -411,7 +411,11 @@ static void unmap_vbos( struct gl_context *ctx,
}
-void _tnl_vbo_draw_prims(struct gl_context *ctx,
+/* This is the main entrypoint into the slimmed-down software tnl
+ * module. In a regular swtnl driver, this can be plugged straight
+ * into the vbo->Driver.DrawPrims() callback.
+ */
+void _tnl_draw_prims(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
@@ -421,32 +425,16 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
struct gl_transform_feedback_object *tfb_vertcount,
struct gl_buffer_object *indirect)
{
- const struct gl_client_array **arrays = ctx->Array._DrawArrays;
-
- if (!index_bounds_valid)
- vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
-
- _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
-}
-
-/* This is the main entrypoint into the slimmed-down software tnl
- * module. In a regular swtnl driver, this can be plugged straight
- * into the vbo->Driver.DrawPrims() callback.
- */
-void _tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index)
-{
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
const GLuint TEST_SPLIT = 0;
const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
GLint max_basevertex = prim->basevertex;
GLuint i;
+ if (!index_bounds_valid)
+ vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
+
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
@@ -471,7 +459,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib,
min_index, max_index,
- _tnl_vbo_draw_prims );
+ _tnl_draw_prims );
return;
}
else if ((GLint)max_index + max_basevertex > max) {
@@ -489,7 +477,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_split_prims( ctx, arrays, prim, nr_prims, ib,
0, max_index + prim->basevertex,
- _tnl_vbo_draw_prims,
+ _tnl_draw_prims,
&limits );
}
else {
diff --git a/mesalib/src/mesa/tnl/tnl.h b/mesalib/src/mesa/tnl/tnl.h
index 59a0ac380..8c59ff9e5 100644
--- a/mesalib/src/mesa/tnl/tnl.h
+++ b/mesalib/src/mesa/tnl/tnl.h
@@ -77,15 +77,6 @@ struct _mesa_index_buffer;
void
_tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index);
-
-void
-_tnl_vbo_draw_prims( struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
diff --git a/pixman/configure.ac b/pixman/configure.ac
index 632797241..0339494b6 100644
--- a/pixman/configure.ac
+++ b/pixman/configure.ac
@@ -1061,6 +1061,24 @@ fi
AC_MSG_RESULT($support_for_builtin_clz)
+dnl =====================================
+dnl GCC vector extensions
+
+support_for_gcc_vector_extensions=no
+
+AC_MSG_CHECKING(for GCC vector extensions)
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
+unsigned int __attribute__ ((vector_size(16))) e, a, b;
+int main (void) { e = a - ((b << 27) + (b >> (32 - 27))) + 1; return e[0]; }
+]])], support_for_gcc_vector_extensions=yes)
+
+if test x$support_for_gcc_vector_extensions = xyes; then
+ AC_DEFINE([HAVE_GCC_VECTOR_EXTENSIONS], [],
+ [Whether the compiler supports GCC vector extensions])
+fi
+
+AC_MSG_RESULT($support_for_gcc_vector_extensions)
+
dnl ==================
dnl libpng
diff --git a/pixman/pixman/Makefile.am b/pixman/pixman/Makefile.am
index b376d9aeb..581b6f61e 100644
--- a/pixman/pixman/Makefile.am
+++ b/pixman/pixman/Makefile.am
@@ -72,6 +72,7 @@ libpixman_arm_simd_la_SOURCES = \
pixman-arm-common.h \
pixman-arm-simd-asm.S \
pixman-arm-simd-asm-scaled.S \
+ pixman-arm-asm.h \
pixman-arm-simd-asm.h
libpixman_1_la_LIBADD += libpixman-arm-simd.la
@@ -86,6 +87,7 @@ libpixman_arm_neon_la_SOURCES = \
pixman-arm-common.h \
pixman-arm-neon-asm.S \
pixman-arm-neon-asm-bilinear.S \
+ pixman-arm-asm.h \
pixman-arm-neon-asm.h
libpixman_1_la_LIBADD += libpixman-arm-neon.la
diff --git a/pixman/pixman/pixman-arm-asm.h b/pixman/pixman/pixman-arm-asm.h
new file mode 100644
index 000000000..ee7854108
--- /dev/null
+++ b/pixman/pixman/pixman-arm-asm.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2008 Mozilla Corporation
+ * Copyright © 2010 Nokia Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Mozilla Corporation not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Mozilla Corporation makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ * Author: Jeff Muizelaar (jeff@infidigm.net)
+ *
+ */
+
+/* Supplementary macro for setting function attributes */
+.macro pixman_asm_function fname
+ .func fname
+ .global fname
+#ifdef __ELF__
+ .hidden fname
+ .type fname, %function
+#endif
+fname:
+.endm
diff --git a/pixman/pixman/pixman-arm-neon-asm-bilinear.S b/pixman/pixman/pixman-arm-neon-asm-bilinear.S
index e37b5c298..0fd92d61c 100644
--- a/pixman/pixman/pixman-arm-neon-asm-bilinear.S
+++ b/pixman/pixman/pixman-arm-neon-asm-bilinear.S
@@ -65,23 +65,13 @@
.p2align 2
#include "pixman-private.h"
+#include "pixman-arm-asm.h"
#include "pixman-arm-neon-asm.h"
/*
* Bilinear macros from pixman-arm-neon-asm.S
*/
-/* Supplementary macro for setting function attributes */
-.macro pixman_asm_function fname
- .func fname
- .global fname
-#ifdef __ELF__
- .hidden fname
- .type fname, %function
-#endif
-fname:
-.endm
-
/*
* Bilinear scaling support code which tries to provide pixel fetching, color
* format conversion, and interpolation as separate macros which can be used
diff --git a/pixman/pixman/pixman-arm-neon-asm.S b/pixman/pixman/pixman-arm-neon-asm.S
index 187197dc3..7e949a38f 100644
--- a/pixman/pixman/pixman-arm-neon-asm.S
+++ b/pixman/pixman/pixman-arm-neon-asm.S
@@ -50,6 +50,7 @@
.p2align 2
#include "pixman-private.h"
+#include "pixman-arm-asm.h"
#include "pixman-arm-neon-asm.h"
/* Global configuration options and preferences */
@@ -2830,17 +2831,6 @@ generate_composite_function_nearest_scanline \
/******************************************************************************/
-/* Supplementary macro for setting function attributes */
-.macro pixman_asm_function fname
- .func fname
- .global fname
-#ifdef __ELF__
- .hidden fname
- .type fname, %function
-#endif
-fname:
-.endm
-
/*
* Bilinear scaling support code which tries to provide pixel fetching, color
* format conversion, and interpolation as separate macros which can be used
diff --git a/pixman/pixman/pixman-arm-simd-asm-scaled.S b/pixman/pixman/pixman-arm-simd-asm-scaled.S
index 711099548..e050292e0 100644
--- a/pixman/pixman/pixman-arm-simd-asm-scaled.S
+++ b/pixman/pixman/pixman-arm-simd-asm-scaled.S
@@ -37,16 +37,7 @@
.altmacro
.p2align 2
-/* Supplementary macro for setting function attributes */
-.macro pixman_asm_function fname
- .func fname
- .global fname
-#ifdef __ELF__
- .hidden fname
- .type fname, %function
-#endif
-fname:
-.endm
+#include "pixman-arm-asm.h"
/*
* Note: This code is only using armv5te instructions (not even armv6),
diff --git a/pixman/pixman/pixman-arm-simd-asm.S b/pixman/pixman/pixman-arm-simd-asm.S
index c20968879..dd6f78817 100644
--- a/pixman/pixman/pixman-arm-simd-asm.S
+++ b/pixman/pixman/pixman-arm-simd-asm.S
@@ -611,3 +611,81 @@ generate_composite_function \
/******************************************************************************/
+.macro over_reverse_n_8888_init
+ ldr SRC, [sp, #ARGS_STACK_OFFSET]
+ ldr MASK, =0x00800080
+ /* Split source pixel into RB/AG parts */
+ uxtb16 STRIDE_S, SRC
+ uxtb16 STRIDE_M, SRC, ror #8
+ /* Set GE[3:0] to 0101 so SEL instructions do what we want */
+ uadd8 SCRATCH, MASK, MASK
+ line_saved_regs STRIDE_D, ORIG_W
+.endm
+
+.macro over_reverse_n_8888_newline
+ mov STRIDE_D, #0xFF
+.endm
+
+.macro over_reverse_n_8888_process_head cond, numbytes, firstreg, unaligned_src, unaligned_mask, preload
+ pixld , numbytes, firstreg, DST, 0
+.endm
+
+.macro over_reverse_n_8888_1pixel d, is_only
+ teq WK&d, #0
+ beq 8f /* replace with source */
+ bics ORIG_W, STRIDE_D, WK&d, lsr #24
+ .if is_only == 1
+ beq 49f /* skip store */
+ .else
+ beq 9f /* write same value back */
+ .endif
+ mla SCRATCH, STRIDE_S, ORIG_W, MASK /* red/blue */
+ mla ORIG_W, STRIDE_M, ORIG_W, MASK /* alpha/green */
+ uxtab16 SCRATCH, SCRATCH, SCRATCH, ror #8
+ uxtab16 ORIG_W, ORIG_W, ORIG_W, ror #8
+ mov SCRATCH, SCRATCH, ror #8
+ sel ORIG_W, SCRATCH, ORIG_W
+ uqadd8 WK&d, WK&d, ORIG_W
+ b 9f
+8: mov WK&d, SRC
+9:
+.endm
+
+.macro over_reverse_n_8888_tail numbytes, reg1, reg2, reg3, reg4
+ .if numbytes == 4
+ over_reverse_n_8888_1pixel reg1, 1
+ .else
+ and SCRATCH, WK&reg1, WK&reg2
+ .if numbytes == 16
+ and SCRATCH, SCRATCH, WK&reg3
+ and SCRATCH, SCRATCH, WK&reg4
+ .endif
+ mvns SCRATCH, SCRATCH, asr #24
+ beq 49f /* skip store if all opaque */
+ over_reverse_n_8888_1pixel reg1, 0
+ over_reverse_n_8888_1pixel reg2, 0
+ .if numbytes == 16
+ over_reverse_n_8888_1pixel reg3, 0
+ over_reverse_n_8888_1pixel reg4, 0
+ .endif
+ .endif
+ pixst , numbytes, reg1, DST
+49:
+.endm
+
+.macro over_reverse_n_8888_process_tail cond, numbytes, firstreg
+ over_reverse_n_8888_tail numbytes, firstreg, %(firstreg+1), %(firstreg+2), %(firstreg+3)
+.endm
+
+generate_composite_function \
+ pixman_composite_over_reverse_n_8888_asm_armv6, 0, 0, 32 \
+ FLAG_DST_READWRITE | FLAG_BRANCH_OVER | FLAG_PROCESS_CORRUPTS_PSR | FLAG_PROCESS_DOES_STORE | FLAG_SPILL_LINE_VARS | FLAG_PROCESS_CORRUPTS_SCRATCH, \
+ 3, /* prefetch distance */ \
+ over_reverse_n_8888_init, \
+ over_reverse_n_8888_newline, \
+ nop_macro, /* cleanup */ \
+ over_reverse_n_8888_process_head, \
+ over_reverse_n_8888_process_tail
+
+/******************************************************************************/
+
diff --git a/pixman/pixman/pixman-arm-simd.c b/pixman/pixman/pixman-arm-simd.c
index af062e19d..8fbc4397d 100644
--- a/pixman/pixman/pixman-arm-simd.c
+++ b/pixman/pixman/pixman-arm-simd.c
@@ -47,6 +47,9 @@ PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, add_8_8,
PIXMAN_ARM_BIND_FAST_PATH_SRC_DST (armv6, over_8888_8888,
uint32_t, 1, uint32_t, 1)
+PIXMAN_ARM_BIND_FAST_PATH_N_DST (0, armv6, over_reverse_n_8888,
+ uint32_t, 1)
+
PIXMAN_ARM_BIND_FAST_PATH_SRC_N_DST (SKIP_ZERO_MASK, armv6, over_8888_n_8888,
uint32_t, 1, uint32_t, 1)
@@ -225,6 +228,9 @@ static const pixman_fast_path_t arm_simd_fast_paths[] =
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, a8b8g8r8, armv6_composite_over_8888_n_8888),
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, solid, x8b8g8r8, armv6_composite_over_8888_n_8888),
+ PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8r8g8b8, armv6_composite_over_reverse_n_8888),
+ PIXMAN_STD_FAST_PATH (OVER_REVERSE, solid, null, a8b8g8r8, armv6_composite_over_reverse_n_8888),
+
PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, armv6_composite_add_8_8),
PIXMAN_STD_FAST_PATH (OVER, solid, a8, a8r8g8b8, armv6_composite_over_n_8_8888),
diff --git a/pixman/test/tolerance-test.c b/pixman/test/tolerance-test.c
index 562563026..320bb7fe0 100644
--- a/pixman/test/tolerance-test.c
+++ b/pixman/test/tolerance-test.c
@@ -347,12 +347,12 @@ main (int argc, const char *argv[])
else
{
#ifdef USE_OPENMP
-# pragma omp parallel for default(none) shared(i) private (result)
+# pragma omp parallel for default(none) reduction(|:result)
#endif
for (i = 0; i < N_TESTS; ++i)
{
if (!do_check (i))
- result = 1;
+ result |= 1;
}
}
diff --git a/pixman/test/utils-prng.c b/pixman/test/utils-prng.c
index 7b32e3531..c27b5be83 100644
--- a/pixman/test/utils-prng.c
+++ b/pixman/test/utils-prng.c
@@ -27,7 +27,7 @@
#include "utils.h"
#include "utils-prng.h"
-#if defined(GCC_VECTOR_EXTENSIONS_SUPPORTED) && defined(__SSE2__)
+#if defined(HAVE_GCC_VECTOR_EXTENSIONS) && defined(__SSE2__)
#include <xmmintrin.h>
#endif
@@ -52,7 +52,7 @@ void smallprng_srand_r (smallprng_t *x, uint32_t seed)
*/
void prng_srand_r (prng_t *x, uint32_t seed)
{
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
int i;
prng_rand_128_data_t dummy;
smallprng_srand_r (&x->p0, seed);
@@ -75,7 +75,7 @@ void prng_srand_r (prng_t *x, uint32_t seed)
static force_inline void
store_rand_128_data (void *addr, prng_rand_128_data_t *d, int aligned)
{
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
if (aligned)
{
*(uint8x16 *)addr = d->vb;
@@ -120,7 +120,7 @@ randmemset_internal (prng_t *prng,
{
prng_rand_128_r (&local_prng, &t);
prng_rand_128_r (&local_prng, &randdata);
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
if (flags & RANDMEMSET_MORE_FF)
{
const uint8x16 const_C0 =
@@ -199,7 +199,7 @@ randmemset_internal (prng_t *prng,
}
else
{
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
const uint8x16 bswap_shufflemask =
{
3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12
diff --git a/pixman/test/utils-prng.h b/pixman/test/utils-prng.h
index 564ffcef1..f9ae8ddf7 100644
--- a/pixman/test/utils-prng.h
+++ b/pixman/test/utils-prng.h
@@ -79,8 +79,7 @@
/*****************************************************************************/
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
-#define GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
typedef uint32_t uint32x4 __attribute__ ((vector_size(16)));
typedef uint8_t uint8x16 __attribute__ ((vector_size(16)));
#endif
@@ -92,7 +91,7 @@ typedef struct
typedef struct
{
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
uint32x4 a, b, c, d;
#else
smallprng_t p1, p2, p3, p4;
@@ -104,7 +103,7 @@ typedef union
{
uint8_t b[16];
uint32_t w[4];
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
uint8x16 vb;
uint32x4 vw;
#endif
@@ -134,7 +133,7 @@ prng_rand_r (prng_t *x)
static force_inline void
prng_rand_128_r (prng_t *x, prng_rand_128_data_t *data)
{
-#ifdef GCC_VECTOR_EXTENSIONS_SUPPORTED
+#ifdef HAVE_GCC_VECTOR_EXTENSIONS
uint32x4 e = x->a - ((x->b << 27) + (x->b >> (32 - 27)));
x->a = x->b ^ ((x->c << 17) ^ (x->c >> (32 - 17)));
x->b = x->c + x->d;
diff --git a/xorg-server/Xext/Makefile.am b/xorg-server/Xext/Makefile.am
index 8e31f1367..a9a446820 100644
--- a/xorg-server/Xext/Makefile.am
+++ b/xorg-server/Xext/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libXext.la
+noinst_LTLIBRARIES = libXext.la libXextdpmsstubs.la
AM_CFLAGS = $(DIX_CFLAGS)
@@ -96,6 +96,8 @@ endif
libXext_la_SOURCES = $(BUILTIN_SRCS)
libXext_la_LIBADD = $(BUILTIN_LIBS)
+libXextdpmsstubs_la_SOURCES = dpmsstubs.c
+
EXTRA_DIST = \
$(MITSHM_SRCS) \
$(XV_SRCS) \
diff --git a/xorg-server/Xi/Makefile.am b/xorg-server/Xi/Makefile.am
index af85bd049..6c456c4ac 100644
--- a/xorg-server/Xi/Makefile.am
+++ b/xorg-server/Xi/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libXi.la
+noinst_LTLIBRARIES = libXi.la libXistubs.la
AM_CFLAGS = $(DIX_CFLAGS)
@@ -107,4 +107,5 @@ libXi_la_SOURCES = \
xiwarppointer.c \
xiwarppointer.h
-EXTRA_DIST = stubs.c
+libXistubs_la_SOURCES = \
+ stubs.c
diff --git a/xorg-server/composite/compext.c b/xorg-server/composite/compext.c
index 9240f42ab..9896f5d41 100644
--- a/xorg-server/composite/compext.c
+++ b/xorg-server/composite/compext.c
@@ -238,6 +238,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
WindowPtr pWin;
CompWindowPtr cw;
PixmapPtr pPixmap;
+ ScreenPtr pScreen;
int rc;
REQUEST(xCompositeNameWindowPixmapReq);
@@ -245,6 +246,8 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
VERIFY_WINDOW(pWin, stuff->window, client, DixGetAttrAccess);
+ pScreen = pWin->drawable.pScreen;
+
if (!pWin->viewable)
return BadMatch;
@@ -254,7 +257,7 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
if (!cw)
return BadMatch;
- pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
+ pPixmap = (*pScreen->GetWindowPixmap) (pWin);
if (!pPixmap)
return BadMatch;
@@ -269,6 +272,14 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
return BadAlloc;
+ if (pScreen->NameWindowPixmap) {
+ rc = pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap);
+ if (rc != Success) {
+ FreeResource(stuff->pixmap, RT_NONE);
+ return rc;
+ }
+ }
+
return Success;
}
diff --git a/xorg-server/composite/compinit.c b/xorg-server/composite/compinit.c
index 1db9e0bf5..48e938fac 100644
--- a/xorg-server/composite/compinit.c
+++ b/xorg-server/composite/compinit.c
@@ -229,6 +229,28 @@ CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
return compRegisterAlternateVisuals(cs, vids, nVisuals);
}
+Bool
+CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
+ VisualID parentVisual,
+ VisualID winVisual)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompImplicitRedirectException *p;
+
+ p = realloc(cs->implicitRedirectExceptions,
+ sizeof(p[0]) * (cs->numImplicitRedirectExceptions + 1));
+ if (p == NULL)
+ return FALSE;
+
+ p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual;
+ p[cs->numImplicitRedirectExceptions].winVisual = winVisual;
+
+ cs->implicitRedirectExceptions = p;
+ cs->numImplicitRedirectExceptions++;
+
+ return TRUE;
+}
+
typedef struct _alternateVisual {
int depth;
CARD32 format;
@@ -349,6 +371,8 @@ compScreenInit(ScreenPtr pScreen)
cs->numAlternateVisuals = 0;
cs->alternateVisuals = NULL;
+ cs->numImplicitRedirectExceptions = 0;
+ cs->implicitRedirectExceptions = NULL;
if (!compAddAlternateVisuals(pScreen, cs)) {
free(cs);
diff --git a/xorg-server/composite/compint.h b/xorg-server/composite/compint.h
index 12dc8b3f7..56b76c540 100644
--- a/xorg-server/composite/compint.h
+++ b/xorg-server/composite/compint.h
@@ -119,6 +119,11 @@ typedef struct _CompOverlayClientRec {
XID resource;
} CompOverlayClientRec;
+typedef struct _CompImplicitRedirectException {
+ XID parentVisual;
+ XID winVisual;
+} CompImplicitRedirectException;
+
typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
CopyWindowProcPtr CopyWindow;
@@ -155,6 +160,8 @@ typedef struct _CompScreen {
CloseScreenProcPtr CloseScreen;
int numAlternateVisuals;
VisualID *alternateVisuals;
+ int numImplicitRedirectExceptions;
+ CompImplicitRedirectException *implicitRedirectExceptions;
WindowPtr pOverlayWin;
Window overlayWid;
diff --git a/xorg-server/composite/compositeext.h b/xorg-server/composite/compositeext.h
index 0b148f029..b96cb1d68 100644
--- a/xorg-server/composite/compositeext.h
+++ b/xorg-server/composite/compositeext.h
@@ -35,6 +35,10 @@ extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen,
VisualID * vids,
int nVisuals);
+extern _X_EXPORT Bool CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
+ VisualID parentVisual,
+ VisualID winVisual);
+
extern _X_EXPORT RESTYPE CompositeClientWindowType;
#endif /* _COMPOSITEEXT_H_ */
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index 6c2434959..882429414 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/composite/compwindow.c
@@ -336,6 +336,21 @@ compIsAlternateVisual(ScreenPtr pScreen, XID visual)
}
static Bool
+compIsImplicitRedirectException(ScreenPtr pScreen,
+ XID parentVisual, XID winVisual)
+{
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int i;
+
+ for (i = 0; i < cs->numImplicitRedirectExceptions; i++)
+ if (cs->implicitRedirectExceptions[i].parentVisual == parentVisual &&
+ cs->implicitRedirectExceptions[i].winVisual == winVisual)
+ return TRUE;
+
+ return FALSE;
+}
+
+static Bool
compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
{
if (pParent) {
@@ -343,6 +358,9 @@ compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
XID winVisual = wVisual(pWin);
XID parentVisual = wVisual(pParent);
+ if (compIsImplicitRedirectException(pScreen, parentVisual, winVisual))
+ return FALSE;
+
if (winVisual != parentVisual &&
(compIsAlternateVisual(pScreen, winVisual) ||
compIsAlternateVisual(pScreen, parentVisual)))
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index a75ba8f69..695a4819a 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,9 +26,9 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.15.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2014-02-24"
-RELEASE_NAME="Szechuan Hot Pot"
+AC_INIT([xorg-server], 1.15.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2014-04-08"
+RELEASE_NAME="Glacier Blue"
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -624,8 +624,8 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes])
AC_ARG_ENABLE(linux_acpi, AS_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes])
AC_ARG_ENABLE(linux_apm, AS_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes])
-AC_ARG_ENABLE(systemd-logind, AC_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
-AC_ARG_ENABLE(suid-wrapper, AC_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
+AC_ARG_ENABLE(systemd-logind, AS_HELP_STRING([--enable-systemd-logind], [Build systemd-logind support (default: auto)]), [SYSTEMD_LOGIND=$enableval], [SYSTEMD_LOGIND=auto])
+AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid-root wrapper for legacy driver support on rootless xserver systems (default: no)]), [SUID_WRAPPER=$enableval], [SUID_WRAPPER=no])
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@@ -633,6 +633,7 @@ AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (d
AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
+AC_ARG_ENABLE(xwayland, AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto])
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: no)]), [GLAMOR=$enableval], [GLAMOR=no])
@@ -751,6 +752,7 @@ case $host_os in
XQUARTZ=yes
XVFB=no
XNEST=no
+ XWAYLAND=no
COMPOSITE=no
DGA=no
@@ -2042,7 +2044,9 @@ if test "x$XORG" = xyes; then
XF86CONFIGDIR="xorg.conf.d"
AC_SUBST(XF86CONFIGDIR)
CONFIGFILE="$sysconfdir/$XF86CONFIGFILE"
- LOGPREFIX="$logdir/Xorg."
+ LOGPREFIX="Xorg."
+ XDG_DATA_HOME=".local/share"
+ XDG_DATA_HOME_LOGDIR="xorg"
AC_DEFINE(XORG_SERVER, 1, [Building Xorg server])
AC_DEFINE(XORGSERVER, 1, [Building Xorg server])
AC_DEFINE(XFree86Server, 1, [Building XFree86 server])
@@ -2055,7 +2059,10 @@ if test "x$XORG" = xyes; then
AC_DEFINE_DIR(__XCONFIGDIR__, XF86CONFIGDIR, [Name of configuration directory])
AC_DEFINE_DIR(DEFAULT_MODULE_PATH, moduledir, [Default module search path])
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
- AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
+ AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
+ AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default logfile prefix])
+ AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME, XDG_DATA_HOME, [Default XDG_DATA dir under HOME])
+ AC_DEFINE_DIR(DEFAULT_XDG_DATA_HOME_LOGDIR, XDG_DATA_HOME_LOGDIR, [Default log dir under XDG_DATA_HOME])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
if test "x$VGAHW" = xyes; then
AC_DEFINE(WITH_VGAHW, 1, [Building vgahw module])
@@ -2408,8 +2415,7 @@ if test "$KDRIVE" = yes; then
fi
;;
esac
- KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
- KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB $KDRIVE_STUB_LIB"
+ KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS"
KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB"
KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS"
@@ -2433,6 +2439,29 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
+dnl Xwayland DDX
+
+PKG_CHECK_MODULES(XWAYLANDMODULES, [wayland-client libdrm epoxy], [have_xwayland=yes], [have_xwayland=no])
+AC_MSG_CHECKING([whether to build Xwayland DDX])
+if test "x$XWAYLAND" = xauto; then
+ XWAYLAND="$have_xwayland"
+fi
+AC_MSG_RESULT([$XWAYLAND])
+AM_CONDITIONAL(XWAYLAND, [test "x$XWAYLAND" = xyes])
+
+if test "x$XWAYLAND" = xyes; then
+ if test "x$have_xwayland" = xno; then
+ AC_MSG_ERROR([Xwayland build explicitly requested, but required modules not found.])
+ fi
+
+ XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
+ XWAYLAND_SYS_LIBS="$XWAYLANDMODULES_LIBS $GLX_SYS_LIBS"
+ AC_SUBST([XWAYLAND_LIBS])
+ AC_SUBST([XWAYLAND_SYS_LIBS])
+ WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xwayland'])
+fi
+
+
dnl and the rest of these are generic, so they're in config.h
dnl
dnl though, thanks to the passing of some significant amount of time, the
@@ -2575,6 +2604,7 @@ hw/kdrive/fake/Makefile
hw/kdrive/fbdev/Makefile
hw/kdrive/linux/Makefile
hw/kdrive/src/Makefile
+hw/xwayland/Makefile
test/Makefile
test/xi2/Makefile
xserver.ent
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 74d05f95b..d48ef3375 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -2838,7 +2838,7 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count, WindowPtr otherParent)
return deliveries;
}
-static Bool
+Bool
PointInBorderSize(WindowPtr pWin, int x, int y)
{
BoxRec box;
@@ -2879,49 +2879,9 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
WindowPtr
XYToWindow(SpritePtr pSprite, int x, int y)
{
- WindowPtr pWin;
- BoxRec box;
+ ScreenPtr pScreen = RootWindow(pSprite)->drawable.pScreen;
- pSprite->spriteTraceGood = 1; /* root window still there */
- pWin = RootWindow(pSprite)->firstChild;
- while (pWin) {
- if ((pWin->mapped) &&
- (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
- (x < pWin->drawable.x + (int) pWin->drawable.width +
- wBorderWidth(pWin)) &&
- (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
- (y < pWin->drawable.y + (int) pWin->drawable.height +
- wBorderWidth(pWin))
- /* When a window is shaped, a further check
- * is made to see if the point is inside
- * borderSize
- */
- && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
- && (!wInputShape(pWin) ||
- RegionContainsPoint(wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
-#ifdef ROOTLESS
- /* In rootless mode windows may be offscreen, even when
- * they're in X's stack. (E.g. if the native window system
- * implements some form of virtual desktop system).
- */
- && !pWin->rootlessUnhittable
-#endif
- ) {
- if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
- pSprite->spriteTraceSize += 10;
- pSprite->spriteTrace = realloc(pSprite->spriteTrace,
- pSprite->spriteTraceSize *
- sizeof(WindowPtr));
- }
- pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
- pWin = pWin->firstChild;
- }
- else
- pWin = pWin->nextSib;
- }
- return DeepestSpriteWin(pSprite);
+ return (*pScreen->XYToWindow)(pScreen, pSprite, x, y);
}
/**
diff --git a/xorg-server/dix/globals.c b/xorg-server/dix/globals.c
index 9738e9cdf..eaa2afe24 100644
--- a/xorg-server/dix/globals.c
+++ b/xorg-server/dix/globals.c
@@ -127,7 +127,8 @@ int defaultColorVisualClass = -1;
int monitorResolution = 0;
const char *display;
-int displayfd;
+int displayfd = -1;
+Bool explicit_display = FALSE;
char *ConnectionInfo;
CARD32 TimeOutValue = DEFAULT_TIMEOUT * MILLI_PER_SECOND;
diff --git a/xorg-server/dri3/dri3.h b/xorg-server/dri3/dri3.h
index 7c0c33018..edc7fa267 100644
--- a/xorg-server/dri3/dri3.h
+++ b/xorg-server/dri3/dri3.h
@@ -30,12 +30,17 @@
#include <X11/extensions/dri3proto.h>
#include <randrstr.h>
-#define DRI3_SCREEN_INFO_VERSION 0
+#define DRI3_SCREEN_INFO_VERSION 1
typedef int (*dri3_open_proc)(ScreenPtr screen,
RRProviderPtr provider,
int *fd);
+typedef int (*dri3_open_client_proc)(ClientPtr client,
+ ScreenPtr screen,
+ RRProviderPtr provider,
+ int *fd);
+
typedef PixmapPtr (*dri3_pixmap_from_fd_proc) (ScreenPtr screen,
int fd,
CARD16 width,
@@ -55,11 +60,18 @@ typedef struct dri3_screen_info {
dri3_open_proc open;
dri3_pixmap_from_fd_proc pixmap_from_fd;
dri3_fd_from_pixmap_proc fd_from_pixmap;
+
+ /* Version 1 */
+ dri3_open_client_proc open_client;
+
} dri3_screen_info_rec, *dri3_screen_info_ptr;
extern _X_EXPORT Bool
dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
+extern _X_EXPORT int
+dri3_send_open_reply(ClientPtr client, int fd);
+
#endif
#endif /* _DRI3_H_ */
diff --git a/xorg-server/dri3/dri3_request.c b/xorg-server/dri3/dri3_request.c
index 31dce83f6..fe45620c9 100644
--- a/xorg-server/dri3/dri3_request.c
+++ b/xorg-server/dri3/dri3_request.c
@@ -55,16 +55,35 @@ proc_dri3_query_version(ClientPtr client)
return Success;
}
-static int
-proc_dri3_open(ClientPtr client)
+int
+dri3_send_open_reply(ClientPtr client, int fd)
{
- REQUEST(xDRI3OpenReq);
xDRI3OpenReply rep = {
.type = X_Reply,
.nfd = 1,
.sequenceNumber = client->sequence,
.length = 0,
};
+
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ }
+
+ if (WriteFdToClient(client, fd, TRUE) < 0) {
+ close(fd);
+ return BadAlloc;
+ }
+
+ WriteToClient(client, sizeof (rep), &rep);
+
+ return Success;
+}
+
+static int
+proc_dri3_open(ClientPtr client)
+{
+ REQUEST(xDRI3OpenReq);
RRProviderPtr provider;
DrawablePtr drawable;
ScreenPtr screen;
@@ -92,17 +111,8 @@ proc_dri3_open(ClientPtr client)
if (status != Success)
return status;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- }
-
- if (WriteFdToClient(client, fd, TRUE) < 0) {
- close(fd);
- return BadAlloc;
- }
-
- WriteToClient(client, sizeof (rep), &rep);
+ if (client->ignoreCount == 0)
+ return dri3_send_open_reply(client, fd);
return Success;
}
diff --git a/xorg-server/dri3/dri3_screen.c b/xorg-server/dri3/dri3_screen.c
index c88029612..6c0c60cbf 100644
--- a/xorg-server/dri3/dri3_screen.c
+++ b/xorg-server/dri3/dri3_screen.c
@@ -30,6 +30,14 @@
#include <misyncshm.h>
#include <randrstr.h>
+static inline Bool has_open(dri3_screen_info_ptr info) {
+ if (info == NULL)
+ return FALSE;
+
+ return info->open != NULL ||
+ (info->version >= 1 && info->open_client != NULL);
+}
+
int
dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
{
@@ -37,10 +45,14 @@ dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd)
dri3_screen_info_ptr info = ds->info;
int rc;
- if (!info || !info->open)
+ if (!has_open(info))
return BadMatch;
- rc = (*info->open) (screen, provider, fd);
+ if (info->version >= 1 && info->open_client != NULL)
+ rc = (*info->open_client) (client, screen, provider, fd);
+ else
+ rc = (*info->open) (screen, provider, fd);
+
if (rc != Success)
return rc;
diff --git a/xorg-server/fb/Makefile.am b/xorg-server/fb/Makefile.am
index 89f3babb1..752eabeb7 100644
--- a/xorg-server/fb/Makefile.am
+++ b/xorg-server/fb/Makefile.am
@@ -22,6 +22,7 @@ libfb_la_SOURCES = \
fbbits.h \
fbblt.c \
fbbltone.c \
+ fbcmap_mi.c \
fbcopy.c \
fbfill.c \
fbfillrect.c \
@@ -50,5 +51,3 @@ libfb_la_SOURCES = \
fbwindow.c
libwfb_la_SOURCES = $(libfb_la_SOURCES)
-
-EXTRA_DIST = fbcmap_mi.c
diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c
index b50385805..c2ee8a552 100644
--- a/xorg-server/fb/fbpict.c
+++ b/xorg-server/fb/fbpict.c
@@ -82,7 +82,7 @@ fbDestroyGlyphCache(void)
}
}
-static void
+void
fbUnrealizeGlyph(ScreenPtr pScreen,
GlyphPtr pGlyph)
{
@@ -90,7 +90,7 @@ fbUnrealizeGlyph(ScreenPtr pScreen,
pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
}
-static void
+void
fbGlyphs(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
diff --git a/xorg-server/fb/fbpict.h b/xorg-server/fb/fbpict.h
index 110f32dfe..8b0f59f7a 100644
--- a/xorg-server/fb/fbpict.h
+++ b/xorg-server/fb/fbpict.h
@@ -65,11 +65,24 @@ fbTrapezoids(CARD8 op,
INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps);
extern _X_EXPORT void
-
fbTriangles(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
PictFormatPtr maskFormat,
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris);
+extern _X_EXPORT void
+fbUnrealizeGlyph(ScreenPtr pScreen,
+ GlyphPtr pGlyph);
+
+extern _X_EXPORT void
+fbGlyphs(CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc, int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
#endif /* _FBPICT_H_ */
diff --git a/xorg-server/glamor/Makefile.am b/xorg-server/glamor/Makefile.am
index 8555e4087..4d0cc8138 100644
--- a/xorg-server/glamor/Makefile.am
+++ b/xorg-server/glamor/Makefile.am
@@ -12,18 +12,20 @@ libglamor_la_SOURCES = \
glamor_core.c \
glamor_debug.h \
glamor_fill.c \
- glamor_fillspans.c \
- glamor_getspans.c \
+ glamor_font.c \
glamor_glx.c \
glamor_glyphs.c \
- glamor_polyfillrect.c \
glamor_polylines.c \
glamor_putimage.c \
- glamor_setspans.c \
glamor_segment.c \
glamor_render.c \
glamor_gradient.c \
glamor_program.c \
+ glamor_rects.c \
+ glamor_spans.c \
+ glamor_text.c \
+ glamor_transfer.c \
+ glamor_transfer.h \
glamor_transform.c \
glamor_trapezoid.c \
glamor_tile.c \
diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c
index 30944326b..2c2d9760c 100644
--- a/xorg-server/glamor/glamor.c
+++ b/xorg-server/glamor/glamor.c
@@ -182,7 +182,15 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
- if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
+ if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
+ pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
+ pixmap_priv->base.box.x1 = 0;
+ pixmap_priv->base.box.y1 = 0;
+ pixmap_priv->base.box.x2 = w;
+ pixmap_priv->base.box.y2 = h;
+ return pixmap;
+ }
+ else if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
glamor_check_fbo_size(glamor_priv, w, h))
{
pixmap_priv->type = type;
@@ -353,6 +361,15 @@ glamor_init(ScreenPtr screen, unsigned int flags)
gl_version = epoxy_gl_version();
+ /* Would be nice to have a cleaner test for GLSL 1.30 support,
+ * but for now this should suffice
+ */
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP && gl_version >= 30)
+ glamor_priv->glsl_version = 130;
+ else
+ glamor_priv->glsl_version = 120;
+
+
/* We'd like to require GL_ARB_map_buffer_range or
* GL_OES_map_buffer_range, since it offers more information to
* the driver than plain old glMapBuffer() or glBufferSubData().
@@ -415,6 +432,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
screen->CreateScreenResources;
screen->CreateScreenResources = glamor_create_screen_resources;
+ if (!glamor_font_init(screen))
+ goto fail;
+
if (flags & GLAMOR_USE_SCREEN) {
if (!RegisterBlockAndWakeupHandlers(_glamor_block_handler,
_glamor_wakeup_handler,
@@ -475,13 +495,13 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->saved_procs.create_picture = ps->CreatePicture;
ps->CreatePicture = glamor_create_picture;
- glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
- screen->SetWindowPixmap = glamor_set_window_pixmap;
-
glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
ps->DestroyPicture = glamor_destroy_picture;
glamor_init_composite_shaders(screen);
#endif
+ glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
+ screen->SetWindowPixmap = glamor_set_window_pixmap;
+
glamor_init_vbo(screen);
glamor_init_pixmap_fbo(screen);
glamor_init_solid_shader(screen);
@@ -494,9 +514,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
#ifdef GLAMOR_GRADIENT_SHADER
glamor_init_gradient_shader(screen);
#endif
-#ifdef GLAMOR_XV
- glamor_init_xv_shader(screen);
-#endif
glamor_pixmap_init(screen);
glamor_glyphs_init(screen);
@@ -516,9 +533,6 @@ glamor_release_screen_priv(ScreenPtr screen)
glamor_screen_private *glamor_priv;
glamor_priv = glamor_get_screen_private(screen);
-#ifdef GLAMOR_XV
- glamor_fini_xv_shader(screen);
-#endif
#ifdef RENDER
glamor_fini_composite_shaders(screen);
#endif
diff --git a/xorg-server/glamor/glamor.h b/xorg-server/glamor/glamor.h
index 11ec49361..e63762b44 100644
--- a/xorg-server/glamor/glamor.h
+++ b/xorg-server/glamor/glamor.h
@@ -143,12 +143,14 @@ extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage);
+extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
#define GLAMOR_CREATE_PIXMAP_MAP 0x104
#define GLAMOR_CREATE_NO_LARGE 0x105
+#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
*
@@ -310,6 +312,8 @@ extern _X_EXPORT Bool
#endif
+extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
+ struct glamor_context *glamor_ctx);
extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap);
extern _X_EXPORT int glamor_create_gc(GCPtr gc);
@@ -431,12 +435,23 @@ extern _X_EXPORT Bool glamor_poly_point_nf(DrawablePtr pDrawable, GCPtr pGC,
extern _X_EXPORT Bool glamor_poly_segment_nf(DrawablePtr pDrawable, GCPtr pGC,
int nseg, xSegment *pSeg);
-extern _X_EXPORT Bool glamor_poly_line_nf(DrawablePtr pDrawable, GCPtr pGC,
- int mode, int npt, DDXPointPtr ppt);
-
extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
int mode, int n, DDXPointPtr points);
+extern _X_EXPORT Bool glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars, int *final_pos);
+
+extern _X_EXPORT Bool glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars, int *final_pos);
+
+extern _X_EXPORT Bool glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars);
+
+extern _X_EXPORT Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars);
+
+#define HAS_GLAMOR_TEXT 1
+
#ifdef GLAMOR_FOR_XORG
extern _X_EXPORT XF86VideoAdaptorPtr glamor_xv_init(ScreenPtr pScreen,
int num_texture_ports);
diff --git a/xorg-server/glamor/glamor_core.c b/xorg-server/glamor/glamor_core.c
index 5711be72f..7b1615d2d 100644
--- a/xorg-server/glamor/glamor_core.c
+++ b/xorg-server/glamor/glamor_core.c
@@ -426,13 +426,13 @@ GCOps glamor_gc_ops = {
.FillPolygon = miFillPolygon,
.PolyFillRect = glamor_poly_fill_rect,
.PolyFillArc = miPolyFillArc,
- .PolyText8 = miPolyText8,
- .PolyText16 = miPolyText16,
- .ImageText8 = miImageText8,
- .ImageText16 = miImageText16,
- .ImageGlyphBlt = glamor_image_glyph_blt, //miImageGlyphBlt,
- .PolyGlyphBlt = glamor_poly_glyph_blt, //miPolyGlyphBlt,
- .PushPixels = glamor_push_pixels, //miPushPixels,
+ .PolyText8 = glamor_poly_text8,
+ .PolyText16 = glamor_poly_text16,
+ .ImageText8 = glamor_image_text8,
+ .ImageText16 = glamor_image_text16,
+ .ImageGlyphBlt = miImageGlyphBlt,
+ .PolyGlyphBlt = glamor_poly_glyph_blt,
+ .PushPixels = glamor_push_pixels,
};
/**
diff --git a/xorg-server/glamor/glamor_egl.c b/xorg-server/glamor/glamor_egl.c
index 812342129..d37de9b95 100644
--- a/xorg-server/glamor/glamor_egl.c
+++ b/xorg-server/glamor/glamor_egl.c
@@ -608,9 +608,10 @@ glamor_egl_close_screen(ScreenPtr screen)
}
static int
-glamor_dri3_open(ScreenPtr screen,
- RRProviderPtr provider,
- int *fdp)
+glamor_dri3_open_client(ClientPtr client,
+ ScreenPtr screen,
+ RRProviderPtr provider,
+ int *fdp)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_egl_screen_private *glamor_egl =
@@ -657,8 +658,8 @@ glamor_dri3_open(ScreenPtr screen,
}
static dri3_screen_info_rec glamor_dri3_info = {
- .version = 0,
- .open = glamor_dri3_open,
+ .version = 1,
+ .open_client = glamor_dri3_open_client,
.pixmap_from_fd = glamor_pixmap_from_fd,
.fd_from_pixmap = glamor_fd_from_pixmap,
};
diff --git a/xorg-server/glamor/glamor_egl_stubs.c b/xorg-server/glamor/glamor_egl_stubs.c
index 4fd9e8016..028d1cc05 100644
--- a/xorg-server/glamor/glamor_egl_stubs.c
+++ b/xorg-server/glamor/glamor_egl_stubs.c
@@ -26,7 +26,9 @@
* Stubbed out glamor_egl.c functions for servers other than Xorg.
*/
-#include "glamor_priv.h"
+#include "dix-config.h"
+
+#include "glamor.h"
void
glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
diff --git a/xorg-server/glamor/glamor_fillspans.c b/xorg-server/glamor/glamor_fillspans.c
deleted file mode 100644
index 8cbd79f6d..000000000
--- a/xorg-server/glamor/glamor_fillspans.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright © 1998 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/** @file glamor_fillspans.c
- *
- * FillSpans implementation, taken from fb_fillsp.c
- */
-#include "glamor_priv.h"
-
-static Bool
-_glamor_fill_spans(DrawablePtr drawable,
- GCPtr gc,
- int n, DDXPointPtr points, int *widths, int sorted,
- Bool fallback)
-{
- DDXPointPtr ppt;
- int nbox;
- BoxPtr pbox;
- int x1, x2, y;
- RegionPtr pClip = fbGetCompositeClip(gc);
- Bool ret = FALSE;
-
- if (gc->fillStyle != FillSolid && gc->fillStyle != FillTiled)
- goto fail;
-
- ppt = points;
- while (n--) {
- x1 = ppt->x;
- y = ppt->y;
- x2 = x1 + (int) *widths;
- ppt++;
- widths++;
-
- nbox = REGION_NUM_RECTS(pClip);
- pbox = REGION_RECTS(pClip);
- while (nbox--) {
- int real_x1 = x1, real_x2 = x2;
-
- if (real_x1 < pbox->x1)
- real_x1 = pbox->x1;
-
- if (real_x2 > pbox->x2)
- real_x2 = pbox->x2;
-
- if (real_x2 > real_x1 && pbox->y1 <= y && pbox->y2 > y) {
- if (!glamor_fill(drawable, gc, real_x1, y,
- real_x2 - real_x1, 1, fallback))
- goto fail;
- }
- pbox++;
- }
- }
- ret = TRUE;
- goto done;
-
- fail:
- if (!fallback && glamor_ddx_fallback_check_pixmap(drawable)
- && glamor_ddx_fallback_check_gc(gc)) {
- goto done;
- }
- glamor_fallback("to %p (%c)\n", drawable,
- glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
- glamor_prepare_access_gc(gc)) {
- fbFillSpans(drawable, gc, n, points, widths, sorted);
- }
- glamor_finish_access_gc(gc);
- glamor_finish_access(drawable);
- ret = TRUE;
-
- done:
- return ret;
-}
-
-void
-glamor_fill_spans(DrawablePtr drawable,
- GCPtr gc, int n, DDXPointPtr points, int *widths, int sorted)
-{
- _glamor_fill_spans(drawable, gc, n, points, widths, sorted, TRUE);
-}
-
-Bool
-glamor_fill_spans_nf(DrawablePtr drawable,
- GCPtr gc,
- int n, DDXPointPtr points, int *widths, int sorted)
-{
- return _glamor_fill_spans(drawable, gc, n, points, widths, sorted, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_font.c b/xorg-server/glamor/glamor_font.c
new file mode 100644
index 000000000..47dfe2a69
--- /dev/null
+++ b/xorg-server/glamor/glamor_font.c
@@ -0,0 +1,186 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_font.h"
+#include <dixfontstr.h>
+
+static int glamor_font_generation;
+static int glamor_font_private_index;
+static int glamor_font_screen_count;
+
+glamor_font_t *
+glamor_font_get(ScreenPtr screen, FontPtr font)
+{
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+ glamor_font_t *privates;
+ glamor_font_t *glamor_font;
+ int overall_width, overall_height;
+ int num_rows;
+ int num_cols;
+ int glyph_width_pixels;
+ int glyph_width_bytes;
+ int glyph_height;
+ int row, col;
+ unsigned char c[2];
+ CharInfoPtr glyph;
+ unsigned long count;
+
+
+ privates = FontGetPrivate(font, glamor_font_private_index);
+ if (!privates) {
+ privates = calloc(glamor_font_screen_count, sizeof (glamor_font_t));
+ if (!privates)
+ return NULL;
+ FontSetPrivate(font, glamor_font_private_index, privates);
+ }
+
+ glamor_font = &privates[screen->myNum];
+
+ if (glamor_font->realized)
+ return glamor_font;
+
+ glamor_font->realized = TRUE;
+
+ /* Figure out how many glyphs are in the font */
+ num_cols = font->info.lastCol - font->info.firstCol + 1;
+ num_rows = font->info.lastRow - font->info.firstRow + 1;
+
+ /* Figure out the size of each glyph */
+ glyph_width_pixels = font->info.maxbounds.rightSideBearing - font->info.minbounds.leftSideBearing;
+ glyph_height = font->info.maxbounds.ascent + font->info.maxbounds.descent;
+
+ glyph_width_bytes = (glyph_width_pixels + 7) >> 3;
+
+ glamor_font->glyph_width_pixels = glyph_width_pixels;
+ glamor_font->glyph_width_bytes = glyph_width_bytes;
+ glamor_font->glyph_height = glyph_height;
+
+ overall_width = glyph_width_bytes * num_cols;
+ overall_height = glyph_height * num_rows;
+
+ /* Check whether the font has a default character */
+ c[0] = font->info.lastRow + 1;
+ c[1] = font->info.lastCol + 1;
+ (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
+
+ glamor_font->default_char = count ? glyph : NULL;
+ glamor_font->default_row = font->info.defaultCh >> 8;
+ glamor_font->default_col = font->info.defaultCh;
+
+ glamor_priv = glamor_get_screen_private(screen);
+ glamor_get_context(glamor_priv);
+
+ glGenTextures(1, &glamor_font->texture_id);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ /* Allocate storage */
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R8UI, overall_width, overall_height,
+ 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, NULL);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+ /* Paint all of the glyphs */
+ for (row = 0; row < num_rows; row++) {
+ for (col = 0; col < num_cols; col++) {
+ c[0] = row + font->info.firstRow;
+ c[1] = col + font->info.firstCol;
+
+ (*font->get_glyphs)(font, 1, c, TwoD16Bit, &count, &glyph);
+
+ if (count)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, col * glyph_width_bytes, row * glyph_height,
+ GLYPHWIDTHBYTES(glyph), GLYPHHEIGHTPIXELS(glyph),
+ GL_RED_INTEGER, GL_UNSIGNED_BYTE, glyph->bits);
+ }
+ }
+
+ glamor_put_context(glamor_priv);
+
+ return glamor_font;
+}
+
+static Bool
+glamor_realize_font(ScreenPtr screen, FontPtr font)
+{
+ return TRUE;
+}
+
+static Bool
+glamor_unrealize_font(ScreenPtr screen, FontPtr font)
+{
+ glamor_screen_private *glamor_priv;
+ glamor_font_t *privates = FontGetPrivate(font, glamor_font_private_index);
+ glamor_font_t *glamor_font;
+ int s;
+
+ if (!privates)
+ return TRUE;
+
+ glamor_font = &privates[screen->myNum];
+
+ if (!glamor_font->realized)
+ return TRUE;
+
+ /* Unrealize the font, freeing the allocated texture */
+ glamor_font->realized = FALSE;
+
+ glamor_priv = glamor_get_screen_private(screen);
+ glamor_get_context(glamor_priv);
+ glDeleteTextures(1, &glamor_font->texture_id);
+ glamor_put_context(glamor_priv);
+
+ /* Check to see if all of the screens are done with this font
+ * and free the private when that happens
+ */
+ for (s = 0; s < glamor_font_screen_count; s++)
+ if (privates[s].realized)
+ return TRUE;
+
+ free(privates);
+ FontSetPrivate(font, glamor_font_private_index, NULL);
+ return TRUE;
+}
+
+Bool
+glamor_font_init(ScreenPtr screen)
+{
+ if (glamor_font_generation != serverGeneration) {
+ glamor_font_private_index = AllocateFontPrivateIndex();
+ if (glamor_font_private_index == -1)
+ return FALSE;
+ glamor_font_screen_count = 0;
+ glamor_font_generation = serverGeneration;
+ }
+
+ if (screen->myNum >= glamor_font_screen_count)
+ glamor_font_screen_count = screen->myNum + 1;
+
+ screen->RealizeFont = glamor_realize_font;
+ screen->UnrealizeFont = glamor_unrealize_font;
+ return TRUE;
+}
diff --git a/xorg-server/glamor/glamor_font.h b/xorg-server/glamor/glamor_font.h
new file mode 100644
index 000000000..36d20624d
--- /dev/null
+++ b/xorg-server/glamor/glamor_font.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _GLAMOR_FONT_H_
+#define _GLAMOR_FONT_H_
+
+typedef struct {
+ Bool realized;
+ CharInfoPtr default_char;
+ CARD8 default_row;
+ CARD8 default_col;
+
+ GLuint texture_id;
+
+ CARD16 glyph_width_bytes;
+ CARD16 glyph_width_pixels;
+ CARD16 glyph_height;
+
+} glamor_font_t;
+
+glamor_font_t *
+glamor_font_get(ScreenPtr screen, FontPtr font);
+
+Bool
+glamor_font_init(ScreenPtr screen);
+
+void
+glamor_fini_glyph_shader(ScreenPtr screen);
+
+#endif /* _GLAMOR_FONT_H_ */
diff --git a/xorg-server/glamor/glamor_getspans.c b/xorg-server/glamor/glamor_getspans.c
deleted file mode 100644
index 42df87f3d..000000000
--- a/xorg-server/glamor/glamor_getspans.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- *
- * 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- * Zhigang Gong <zhigang.gong@linux.intel.com>
- *
- */
-
-#include "glamor_priv.h"
-
-static Bool
-_glamor_get_spans(DrawablePtr drawable,
- int wmax,
- DDXPointPtr points, int *widths, int count, char *dst,
- Bool fallback)
-{
- PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
- int i;
- uint8_t *readpixels_dst = (uint8_t *) dst;
- void *data;
- int x_off, y_off;
- Bool ret = FALSE;
-
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
- goto fail;
-
- glamor_get_drawable_deltas(drawable, pixmap, &x_off, &y_off);
- for (i = 0; i < count; i++) {
- data = glamor_download_sub_pixmap_to_cpu(pixmap, points[i].x + x_off,
- points[i].y + y_off, widths[i],
- 1, PixmapBytePad(widths[i],
- drawable->
- depth),
- readpixels_dst, 0,
- GLAMOR_ACCESS_RO);
- (void)data;
- assert(data == readpixels_dst);
- readpixels_dst += PixmapBytePad(widths[i], drawable->depth);
- }
-
- ret = TRUE;
- goto done;
- fail:
-
- if (!fallback && glamor_ddx_fallback_check_pixmap(drawable))
- goto done;
-
- ret = TRUE;
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) {
- fbGetSpans(drawable, wmax, points, widths, count, dst);
- }
- glamor_finish_access(drawable);
- done:
- return ret;
-}
-
-void
-glamor_get_spans(DrawablePtr drawable,
- int wmax,
- DDXPointPtr points, int *widths, int count, char *dst)
-{
- _glamor_get_spans(drawable, wmax, points, widths, count, dst, TRUE);
-}
-
-Bool
-glamor_get_spans_nf(DrawablePtr drawable,
- int wmax,
- DDXPointPtr points, int *widths, int count, char *dst)
-{
- return _glamor_get_spans(drawable, wmax, points, widths, count, dst, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_glyphblt.c b/xorg-server/glamor/glamor_glyphblt.c
index a58cef907..c031747f7 100644
--- a/xorg-server/glamor/glamor_glyphblt.c
+++ b/xorg-server/glamor/glamor_glyphblt.c
@@ -28,203 +28,156 @@
#include "glamor_priv.h"
#include <dixfontstr.h>
+#include "glamor_transform.h"
+
+static const glamor_facet glamor_facet_poly_glyph_blt = {
+ .name = "poly_glyph_blt",
+ .vs_vars = "attribute vec2 primitive;\n",
+ .vs_exec = (" vec2 pos = vec2(0,0);\n"
+ GLAMOR_POS(gl_Position, primitive)),
+};
static Bool
-glamor_poly_glyph_blt_pixels(DrawablePtr drawable, GCPtr gc,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci)
+glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
+ int start_x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, void *pglyph_base)
{
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv;
- int off_x, off_y;
- GLfloat xscale, yscale;
- float color[4];
- unsigned long fg_pixel = gc->fgPixel;
- char *vbo_offset;
- RegionPtr clip;
- int num_points, max_points;
- float *points = NULL;
-
- x += drawable->x;
- y += drawable->y;
-
- if (gc->fillStyle != FillSolid) {
- glamor_fallback("gc fillstyle not solid\n");
- return FALSE;
- }
+ glamor_program *prog;
+ RegionPtr clip = gc->pCompositeClip;
+ int box_x, box_y;
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
- return FALSE;
+ goto bail;
glamor_get_context(glamor_priv);
- if (!glamor_set_alu(screen, gc->alu)) {
- if (gc->alu == GXclear)
- fg_pixel = 0;
- else {
- glamor_fallback("unsupported alu %x\n", gc->alu);
- glamor_put_context(glamor_priv);
- return FALSE;
- }
- }
-
- if (!glamor_set_planemask(pixmap, gc->planemask)) {
- glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
- glamor_put_context(glamor_priv);
- return FALSE;
- }
-
- glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
-
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
- pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
-
- glUseProgram(glamor_priv->solid_prog);
- glamor_get_rgba_from_pixel(fg_pixel,
- &color[0], &color[1], &color[2], &color[3],
- format_for_pixmap(pixmap));
- glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
-
- clip = fbGetCompositeClip(gc);
+ prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs,
+ &glamor_facet_poly_glyph_blt);
+ if (!prog)
+ goto bail_ctx;
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
- max_points = 500;
- num_points = 0;
- while (nglyph--) {
- CharInfoPtr charinfo = *ppci++;
- int w = GLYPHWIDTHPIXELS(charinfo);
- int h = GLYPHHEIGHTPIXELS(charinfo);
- uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo);
-
- if (w && h) {
- int glyph_x = x + charinfo->metrics.leftSideBearing;
- int glyph_y = y - charinfo->metrics.ascent;
- int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo);
- int xx, yy;
-
- for (yy = 0; yy < h; yy++) {
- uint8_t *glyph_row = glyphbits + glyph_stride * yy;
- for (xx = 0; xx < w; xx++) {
- int pt_x_i = glyph_x + xx;
- int pt_y_i = glyph_y + yy;
- float pt_x_f, pt_y_f;
- if (!(glyph_row[xx / 8] & (1 << xx % 8)))
- continue;
-
- if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL))
- continue;
-
- if (!num_points) {
- points = glamor_get_vbo_space(screen,
- max_points * 2 * sizeof(float),
- &vbo_offset);
-
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
- GL_FALSE, 2 * sizeof(float),
- vbo_offset);
- }
-
- pt_x_f = v_from_x_coord_x(xscale, pt_x_i + off_x + 0.5);
- if (glamor_priv->yInverted)
- pt_y_f = v_from_x_coord_y_inverted(yscale, pt_y_i + off_y + 0.5);
- else
- pt_y_f = v_from_x_coord_y(yscale, pt_y_i + off_y + 0.5);
-
- points[num_points * 2 + 0] = pt_x_f;
- points[num_points * 2 + 1] = pt_y_f;
- num_points++;
+ start_x += drawable->x;
+ y += drawable->y;
- if (num_points == max_points) {
- glamor_put_vbo_space(screen);
- glDrawArrays(GL_POINTS, 0, num_points);
- num_points = 0;
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ int x;
+ int n;
+ int num_points, max_points;
+ INT16 *points = NULL;
+ int off_x, off_y;
+ char *vbo_offset;
+
+ glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE, prog->matrix_uniform, &off_x, &off_y);
+
+ max_points = 500;
+ num_points = 0;
+ x = start_x;
+ for (n = 0; n < nglyph; n++) {
+ CharInfoPtr charinfo = ppci[n];
+ int w = GLYPHWIDTHPIXELS(charinfo);
+ int h = GLYPHHEIGHTPIXELS(charinfo);
+ uint8_t *glyphbits = FONTGLYPHBITS(NULL, charinfo);
+
+ if (w && h) {
+ int glyph_x = x + charinfo->metrics.leftSideBearing;
+ int glyph_y = y - charinfo->metrics.ascent;
+ int glyph_stride = GLYPHWIDTHBYTESPADDED(charinfo);
+ int xx, yy;
+
+ for (yy = 0; yy < h; yy++) {
+ uint8_t *glyph = glyphbits;
+ for (xx = 0; xx < w; glyph += ((xx&7) == 7), xx++) {
+ int pt_x_i = glyph_x + xx;
+ int pt_y_i = glyph_y + yy;
+
+ if (!(*glyph & (1 << (xx & 7))))
+ continue;
+
+ if (!RegionContainsPoint(clip, pt_x_i, pt_y_i, NULL))
+ continue;
+
+ if (!num_points) {
+ points = glamor_get_vbo_space(screen,
+ max_points * (2 * sizeof (INT16)),
+ &vbo_offset);
+
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT,
+ GL_FALSE, 0, vbo_offset);
+ }
+
+ *points++ = pt_x_i;
+ *points++ = pt_y_i;
+ num_points++;
+
+ if (num_points == max_points) {
+ glamor_put_vbo_space(screen);
+ glDrawArrays(GL_POINTS, 0, num_points);
+ num_points = 0;
+ }
}
+ glyphbits += glyph_stride;
}
}
+ x += charinfo->metrics.characterWidth;
}
- x += charinfo->metrics.characterWidth;
- }
-
- if (num_points) {
- glamor_put_vbo_space(screen);
- glDrawArrays(GL_POINTS, 0, num_points);
+ if (num_points) {
+ glamor_put_vbo_space(screen);
+ glDrawArrays(GL_POINTS, 0, num_points);
+ }
}
+ glDisable(GL_COLOR_LOGIC_OP);
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
glamor_put_context(glamor_priv);
-
- return TRUE;
-}
-
-static Bool
-_glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase, Bool fallback)
-{
- if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
- && glamor_ddx_fallback_check_gc(pGC))
- return FALSE;
-
- miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
return TRUE;
+bail_ctx:
+ glDisable(GL_COLOR_LOGIC_OP);
+ glamor_put_context(glamor_priv);
+bail:
+ return FALSE;
}
void
-glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase)
+glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc,
+ int start_x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, void *pglyph_base)
{
- _glamor_image_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,
- TRUE);
+ if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
+ return;
+ miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
+ ppci, pglyph_base);
}
Bool
-glamor_image_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase)
-{
- return _glamor_image_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci,
- pglyphBase, FALSE);
-}
-
-static Bool
-_glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase, Bool fallback)
+glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
+ int start_x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, void *pglyph_base)
{
- if (glamor_poly_glyph_blt_pixels(pDrawable, pGC, x, y, nglyph, ppci))
+ if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
return TRUE;
-
- if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
- && glamor_ddx_fallback_check_gc(pGC))
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
return FALSE;
-
- miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
+ miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
+ ppci, pglyph_base);
return TRUE;
}
-void
-glamor_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase)
-{
- _glamor_poly_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase,
- TRUE);
-}
-
Bool
-glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
- int x, int y, unsigned int nglyph,
- CharInfoPtr *ppci, void *pglyphBase)
+glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
+ int start_x, int y, unsigned int nglyph,
+ CharInfoPtr *ppci, void *pglyph_base)
{
- return _glamor_poly_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci,
- pglyphBase, FALSE);
+ miImageGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base);
+ return TRUE;
}
static Bool
diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c
index 891ecdd37..a811f6015 100644
--- a/xorg-server/glamor/glamor_pixmap.c
+++ b/xorg-server/glamor/glamor_pixmap.c
@@ -283,8 +283,6 @@ glamor_get_tex_format_type_from_pictformat_gl(PictFormatShort format,
break;
default:
- LogMessageVerb(X_INFO, 0,
- "fail to get matched format for %x \n", format);
return -1;
}
return 0;
@@ -980,7 +978,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
&no_alpha,
&revert, &swap_rb, 1)) {
glamor_fallback("Unknown pixmap depth %d.\n", pixmap->drawable.depth);
- return TRUE;
+ return FALSE;
}
if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, swap_rb))
return FALSE;
diff --git a/xorg-server/glamor/glamor_points.c b/xorg-server/glamor/glamor_points.c
index 5399f96e8..0d58e555f 100644
--- a/xorg-server/glamor/glamor_points.c
+++ b/xorg-server/glamor/glamor_points.c
@@ -35,8 +35,8 @@ static const glamor_facet glamor_facet_point = {
.vs_exec = GLAMOR_POS(gl_Position, primitive),
};
-Bool
-glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt)
+static Bool
+glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPointPtr ppt)
{
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
@@ -123,7 +123,22 @@ void
glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt,
DDXPointPtr ppt)
{
- if (glamor_poly_point_nf(drawable, gc, mode, npt, ppt))
+ if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
return;
miPolyPoint(drawable, gc, mode, npt, ppt);
}
+
+Bool
+glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt,
+ DDXPointPtr ppt)
+{
+ if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+
+ miPolyPoint(drawable, gc, mode, npt, ppt);
+ return TRUE;
+}
+
diff --git a/xorg-server/glamor/glamor_polyfillrect.c b/xorg-server/glamor/glamor_polyfillrect.c
deleted file mode 100644
index 1e361a44f..000000000
--- a/xorg-server/glamor/glamor_polyfillrect.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- * Copyright © 1998 Keith Packard
- *
- * 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include "glamor_priv.h"
-
-/** @file glamor_fillspans.c
- *
- * GC PolyFillRect implementation, taken straight from fb_fill.c
- */
-
-static Bool
-_glamor_poly_fill_rect(DrawablePtr drawable,
- GCPtr gc, int nrect, xRectangle *prect, Bool fallback)
-{
- int fullX1, fullX2, fullY1, fullY2;
- int xorg, yorg;
- int n;
- register BoxPtr pbox;
- RegionPtr pClip = fbGetCompositeClip(gc);
- Bool ret = FALSE;
-
- xorg = drawable->x;
- yorg = drawable->y;
-
- while (nrect--) {
- fullX1 = prect->x + xorg;
- fullY1 = prect->y + yorg;
- fullX2 = fullX1 + (int) prect->width;
- fullY2 = fullY1 + (int) prect->height;
-
- n = REGION_NUM_RECTS(pClip);
- pbox = REGION_RECTS(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect(),
- * but rectangles may overlap each other here.
- */
- while (n--) {
- int x1 = fullX1;
- int x2 = fullX2;
- int y1 = fullY1;
- int y2 = fullY2;
-
- if (pbox->x1 > x1)
- x1 = pbox->x1;
- if (pbox->x2 < x2)
- x2 = pbox->x2;
- if (pbox->y1 > y1)
- y1 = pbox->y1;
- if (pbox->y2 < y2)
- y2 = pbox->y2;
-
- pbox++;
- if (x1 >= x2 || y1 >= y2)
- continue;
- if (!glamor_fill(drawable, gc, x1, y1, x2 - x1, y2 - y1, fallback)) {
- nrect++;
- goto fail;
- }
- }
- prect++;
- }
- ret = TRUE;
- goto done;
-
- fail:
-
- if (!fallback && glamor_ddx_fallback_check_pixmap(drawable)
- && glamor_ddx_fallback_check_gc(gc))
- goto done;
-
- glamor_fallback(" to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
- glamor_prepare_access_gc(gc)) {
- fbPolyFillRect(drawable, gc, nrect, prect);
- }
- glamor_finish_access_gc(gc);
- glamor_finish_access(drawable);
- ret = TRUE;
-
- done:
- return ret;
-}
-
-void
-glamor_poly_fill_rect(DrawablePtr drawable,
- GCPtr gc, int nrect, xRectangle *prect)
-{
- _glamor_poly_fill_rect(drawable, gc, nrect, prect, TRUE);
-}
-
-Bool
-glamor_poly_fill_rect_nf(DrawablePtr drawable,
- GCPtr gc, int nrect, xRectangle *prect)
-{
- return _glamor_poly_fill_rect(drawable, gc, nrect, prect, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h
index 4c305abfc..0cafac4b5 100644
--- a/xorg-server/glamor/glamor_priv.h
+++ b/xorg-server/glamor/glamor_priv.h
@@ -205,6 +205,7 @@ typedef struct glamor_screen_private {
Bool yInverted;
unsigned int tick;
enum glamor_gl_flavor gl_flavor;
+ int glsl_version;
int has_pack_invert;
int has_fbo_blit;
int has_map_buffer_range;
@@ -223,6 +224,20 @@ typedef struct glamor_screen_private {
/* glamor point shader */
glamor_program point_prog;
+ /* glamor spans shaders */
+ glamor_program_fill fill_spans_program;
+
+ /* glamor rect shaders */
+ glamor_program_fill poly_fill_rect_program;
+
+ /* glamor glyphblt shaders */
+ glamor_program_fill poly_glyph_blt_progs;
+
+ /* glamor text shaders */
+ glamor_program_fill poly_text_progs;
+ glamor_program te_text_prog;
+ glamor_program image_text_prog;
+
/* vertext/elment_index buffer object for render */
GLuint vbo, ebo;
/** Next offset within the VBO that glamor_get_vbo_space() will use. */
@@ -584,8 +599,6 @@ extern int glamor_debug_level;
/* glamor.c */
PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
-Bool glamor_destroy_pixmap(PixmapPtr pixmap);
-
glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private *
pixmap_priv);
void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
@@ -674,19 +687,9 @@ Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
Bool glamor_solid_boxes(PixmapPtr pixmap,
BoxPtr box, int nbox, unsigned long fg_pixel);
-/* glamor_fillspans.c */
-void glamor_fill_spans(DrawablePtr drawable,
- GCPtr gc,
- int n, DDXPointPtr points, int *widths, int sorted);
-
void glamor_init_solid_shader(ScreenPtr screen);
void glamor_fini_solid_shader(ScreenPtr screen);
-/* glamor_getspans.c */
-void glamor_get_spans(DrawablePtr drawable,
- int wmax, DDXPointPtr points, int *widths,
- int nspans, char *dst_start);
-
/* glamor_glyphs.c */
Bool glamor_realize_glyph_caches(ScreenPtr screen);
void glamor_glyphs_fini(ScreenPtr screen);
@@ -697,14 +700,6 @@ void glamor_glyphs(CARD8 op,
INT16 xSrc,
INT16 ySrc, int nlist, GlyphListPtr list, GlyphPtr *glyphs);
-/* glamor_setspans.c */
-void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
- DDXPointPtr points, int *widths, int n, int sorted);
-
-/* glamor_polyfillrect.c */
-void glamor_poly_fill_rect(DrawablePtr drawable,
- GCPtr gc, int nrect, xRectangle *prect);
-
/* glamor_polylines.c */
void glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
DDXPointPtr points);
@@ -967,6 +962,39 @@ RegionPtr glamor_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int dstx, int dsty,
unsigned long bitPlane);
+/* glamor_text.c */
+int glamor_poly_text8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+
+int glamor_poly_text16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+
+void glamor_image_text8(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, char *chars);
+
+void glamor_image_text16(DrawablePtr pDrawable, GCPtr pGC,
+ int x, int y, int count, unsigned short *chars);
+
+/* glamor_spans.c */
+void
+glamor_fill_spans(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted);
+
+void
+glamor_get_spans(DrawablePtr drawable, int wmax,
+ DDXPointPtr points, int *widths, int count, char *dst);
+
+void
+glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int numPoints, int sorted);
+
+/* glamor_rects.c */
+void
+glamor_poly_fill_rect(DrawablePtr drawable,
+ GCPtr gc, int nrect, xRectangle *prect);
+
+/* glamor_glyphblt.c */
void glamor_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, void *pglyphBase);
@@ -992,9 +1020,6 @@ void glamor_composite_rectangles(CARD8 op,
xRenderColor *color,
int num_rects, xRectangle *rects);
-extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
- struct glamor_context *glamor_ctx);
-
/* glamor_xv */
typedef struct {
uint32_t transform_index;
@@ -1039,4 +1064,6 @@ void glamor_fini_xv_shader(ScreenPtr screen);
//#define GLYPHS_NO_EDEGEMAP_OVERLAP_CHECK
#define GLYPHS_EDEGE_OVERLAP_LOOSE_CHECK
+#include "glamor_font.h"
+
#endif /* GLAMOR_PRIV_H */
diff --git a/xorg-server/glamor/glamor_program.c b/xorg-server/glamor/glamor_program.c
index e2e1434ee..0f4d0f06a 100644
--- a/xorg-server/glamor/glamor_program.c
+++ b/xorg-server/glamor/glamor_program.c
@@ -45,9 +45,8 @@ use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
static const glamor_facet glamor_fill_tile = {
.name = "tile",
- .version = 130,
- .vs_exec = " fill_pos = fill_offset + primitive.xy + pos;\n",
- .fs_exec = " gl_FragColor = texelFetch(sampler, ivec2(mod(fill_pos,fill_size)), 0);\n",
+ .vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
+ .fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n",
.locations = glamor_program_location_fill,
.use = use_tile,
};
@@ -108,6 +107,7 @@ static glamor_location_var location_vars[] = {
{
.location = glamor_program_location_fill,
.vs_vars = ("uniform vec2 fill_offset;\n"
+ "uniform vec2 fill_size;\n"
"varying vec2 fill_pos;\n"),
.fs_vars = ("uniform sampler2D sampler;\n"
"uniform vec2 fill_size;\n"
@@ -240,16 +240,8 @@ glamor_build_program(ScreenPtr screen,
flags |= fill->flags;
version = MAX(version, fill->version);
- if (version >= 130) {
-
- /* Would be nice to have a cleaner test for GLSL 1.30 support,
- * but for now this should suffice
- */
- if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP ||
- epoxy_gl_version() < 30) {
- goto fail;
- }
- }
+ if (version > glamor_priv->glsl_version)
+ goto fail;
vs_vars = vs_location_vars(locations);
fs_vars = fs_location_vars(locations);
diff --git a/xorg-server/glamor/glamor_rects.c b/xorg-server/glamor/glamor_rects.c
new file mode 100644
index 000000000..7731edec4
--- /dev/null
+++ b/xorg-server/glamor/glamor_rects.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_program.h"
+#include "glamor_transform.h"
+
+static const glamor_facet glamor_facet_polyfillrect_130 = {
+ .name = "poly_fill_rect",
+ .version = 130,
+ .vs_vars = "attribute vec4 primitive;\n",
+ .vs_exec = (" vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+ GLAMOR_POS(gl_Position, (primitive.xy + pos))),
+};
+
+static const glamor_facet glamor_facet_polyfillrect_120 = {
+ .name = "poly_fill_rect",
+ .vs_vars = "attribute vec2 primitive;\n",
+ .vs_exec = (" vec2 pos = vec2(0,0);\n"
+ GLAMOR_POS(gl_Position, primitive.xy)),
+};
+
+static Bool
+glamor_poly_fill_rect_gl(DrawablePtr drawable,
+ GCPtr gc, int nrect, xRectangle *prect)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ glamor_program *prog;
+ int off_x, off_y;
+ GLshort *v;
+ char *vbo_offset;
+ int box_x, box_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ glamor_get_context(glamor_priv);
+
+ if (glamor_priv->glsl_version >= 130) {
+ prog = glamor_use_program_fill(pixmap, gc,
+ &glamor_priv->poly_fill_rect_program,
+ &glamor_facet_polyfillrect_130);
+
+ if (!prog)
+ goto bail_ctx;
+
+ /* Set up the vertex buffers for the points */
+
+ v = glamor_get_vbo_space(drawable->pScreen, nrect * sizeof (xRectangle), &vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE,
+ 4 * sizeof (short), vbo_offset);
+
+ memcpy(v, prect, nrect * sizeof (xRectangle));
+
+ glamor_put_vbo_space(screen);
+ } else {
+ int n;
+
+ prog = glamor_use_program_fill(pixmap, gc,
+ &glamor_priv->poly_fill_rect_program,
+ &glamor_facet_polyfillrect_120);
+
+ if (!prog)
+ goto bail_ctx;
+
+ /* Set up the vertex buffers for the points */
+
+ v = glamor_get_vbo_space(drawable->pScreen, nrect * 8 * sizeof (short), &vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
+ 2 * sizeof (short), vbo_offset);
+
+ for (n = 0; n < nrect; n++) {
+ v[0] = prect->x; v[1] = prect->y;
+ v[2] = prect->x; v[3] = prect->y + prect->height;
+ v[4] = prect->x + prect->width; v[5] = prect->y + prect->height;
+ v[6] = prect->x + prect->width; v[7] = prect->y;
+ prect++;
+ v += 8;
+ }
+
+ glamor_put_vbo_space(screen);
+ }
+
+ glEnable(GL_SCISSOR_TEST);
+
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ int nbox = RegionNumRects(gc->pCompositeClip);
+ BoxPtr box = RegionRects(gc->pCompositeClip);
+
+ glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+ while (nbox--) {
+ glScissor(box->x1 + off_x,
+ box->y1 + off_y,
+ box->x2 - box->x1,
+ box->y2 - box->y1);
+ box++;
+ if (glamor_priv->glsl_version >= 130)
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
+ else {
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ glDrawArrays(GL_QUADS, 0, nrect * 4);
+ } else {
+ int i;
+ for (i = 0; i < nrect; i++) {
+ glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+ }
+ }
+ }
+ }
+ }
+
+ glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_COLOR_LOGIC_OP);
+ if (glamor_priv->glsl_version >= 130)
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ glamor_put_context(glamor_priv);
+ return TRUE;
+bail_ctx:
+ glDisable(GL_COLOR_LOGIC_OP);
+ glamor_put_context(glamor_priv);
+bail:
+ return FALSE;
+}
+
+static void
+glamor_poly_fill_rect_bail(DrawablePtr drawable,
+ GCPtr gc, int nrect, xRectangle *prect)
+{
+ glamor_fallback("to %p (%c)\n", drawable,
+ glamor_get_drawable_location(drawable));
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
+ fbPolyFillRect(drawable, gc, nrect, prect);
+ }
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_poly_fill_rect(DrawablePtr drawable,
+ GCPtr gc, int nrect, xRectangle *prect)
+{
+ if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
+ return;
+ glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
+}
+
+Bool
+glamor_poly_fill_rect_nf(DrawablePtr drawable,
+ GCPtr gc, int nrect, xRectangle *prect)
+{
+ if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
+ return TRUE;
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+ glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
+ return TRUE;
+}
diff --git a/xorg-server/glamor/glamor_setspans.c b/xorg-server/glamor/glamor_setspans.c
deleted file mode 100644
index a51e4c5be..000000000
--- a/xorg-server/glamor/glamor_setspans.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- *
- * 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 (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 NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS 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.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- * Zhigang Gong <zhigang.gong@linux.intel.com>
- *
- */
-
-#include "glamor_priv.h"
-
-static Bool
-_glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
- DDXPointPtr points, int *widths, int numPoints, int sorted,
- Bool fallback)
-{
- PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
- glamor_pixmap_private *dest_pixmap_priv;
- int i;
- uint8_t *drawpixels_src = (uint8_t *) src;
- RegionPtr clip = fbGetCompositeClip(gc);
- BoxRec *pbox;
- int x_off, y_off;
- Bool ret = FALSE;
-
- dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
- if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
- glamor_fallback("pixmap has no fbo.\n");
- goto fail;
- }
-
- if (gc->alu != GXcopy) {
- glamor_fallback("SetSpans with non-copy ALU.\n");
- goto fail;
- }
-
- if (!glamor_set_planemask(dest_pixmap, gc->planemask))
- goto fail;
-
- glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
- for (i = 0; i < numPoints; i++) {
-
- int n = REGION_NUM_RECTS(clip);
-
- pbox = REGION_RECTS(clip);
- while (n--) {
- int x1 = points[i].x;
- int x2 = x1 + widths[i];
- int y1 = points[i].y;
-
- if (pbox->y1 > points[i].y || pbox->y2 < points[i].y)
- break;
- x1 = x1 > pbox->x1 ? x1 : pbox->x1;
- x2 = x2 < pbox->x2 ? x2 : pbox->x2;
- if (x1 >= x2)
- continue;
- glamor_upload_sub_pixmap_to_texture(dest_pixmap, x1 + x_off,
- y1 + y_off, x2 - x1, 1,
- PixmapBytePad(widths[i],
- drawable->depth),
- drawpixels_src, 0);
- }
- drawpixels_src += PixmapBytePad(widths[i], drawable->depth);
- }
- ret = TRUE;
- goto done;
-
- fail:
- if (!fallback && glamor_ddx_fallback_check_pixmap(drawable))
- goto done;
-
- glamor_fallback("to %p (%c)\n",
- drawable, glamor_get_drawable_location(drawable));
- if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
- glamor_prepare_access_gc(gc)) {
- fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
- }
- glamor_finish_access_gc(gc);
- glamor_finish_access(drawable);
- ret = TRUE;
-
- done:
- return ret;
-}
-
-void
-glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
- DDXPointPtr points, int *widths, int n, int sorted)
-{
- _glamor_set_spans(drawable, gc, src, points, widths, n, sorted, TRUE);
-}
-
-Bool
-glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
- DDXPointPtr points, int *widths, int n, int sorted)
-{
- return _glamor_set_spans(drawable, gc, src, points,
- widths, n, sorted, FALSE);
-}
diff --git a/xorg-server/glamor/glamor_spans.c b/xorg-server/glamor/glamor_spans.c
new file mode 100644
index 000000000..98842cdde
--- /dev/null
+++ b/xorg-server/glamor/glamor_spans.c
@@ -0,0 +1,438 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transform.h"
+#include "glamor_transfer.h"
+
+glamor_program fill_spans_progs[4];
+
+static const glamor_facet glamor_facet_fillspans_130 = {
+ .name = "fill_spans",
+ .version = 130,
+ .vs_vars = "attribute vec3 primitive;\n",
+ .vs_exec = (" vec2 pos = vec2(primitive.z,1) * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+ GLAMOR_POS(gl_Position, (primitive.xy + pos))),
+};
+
+static const glamor_facet glamor_facet_fillspans_120 = {
+ .name = "fill_spans",
+ .vs_vars = "attribute vec2 primitive;\n",
+ .vs_exec = (" vec2 pos = vec2(0,0);\n"
+ GLAMOR_POS(gl_Position, primitive.xy)),
+};
+
+static Bool
+glamor_fill_spans_gl(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ glamor_program *prog;
+ int off_x, off_y;
+ GLshort *v;
+ char *vbo_offset;
+ int c;
+ int box_x, box_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ glamor_get_context(glamor_priv);
+
+ if (glamor_priv->glsl_version >= 130) {
+ prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
+ &glamor_facet_fillspans_130);
+
+ if (!prog)
+ goto bail_ctx;
+
+ /* Set up the vertex buffers for the points */
+
+ v = glamor_get_vbo_space(drawable->pScreen, n * (4 * sizeof (GLshort)), &vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 3, GL_SHORT, GL_FALSE,
+ 4 * sizeof (GLshort), vbo_offset);
+
+ for (c = 0; c < n; c++) {
+ v[0] = points->x;
+ v[1] = points->y;
+ v[2] = *widths++;
+ points++;
+ v += 4;
+ }
+
+ glamor_put_vbo_space(screen);
+ } else {
+ prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->fill_spans_program,
+ &glamor_facet_fillspans_120);
+
+ if (!prog)
+ goto bail_ctx;
+
+ /* Set up the vertex buffers for the points */
+
+ v = glamor_get_vbo_space(drawable->pScreen, n * 8 * sizeof (short), &vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT, GL_FALSE,
+ 2 * sizeof (short), vbo_offset);
+
+ for (c = 0; c < n; c++) {
+ v[0] = points->x; v[1] = points->y;
+ v[2] = points->x; v[3] = points->y + 1;
+ v[4] = points->x + *widths; v[5] = points->y + 1;
+ v[6] = points->x + *widths; v[7] = points->y;
+
+ widths++;
+ points++;
+ v += 8;
+ }
+
+ glamor_put_vbo_space(screen);
+ }
+
+ glEnable(GL_SCISSOR_TEST);
+
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ int nbox = RegionNumRects(gc->pCompositeClip);
+ BoxPtr box = RegionRects(gc->pCompositeClip);
+
+ glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+ while (nbox--) {
+ glScissor(box->x1 + off_x,
+ box->y1 + off_y,
+ box->x2 - box->x1,
+ box->y2 - box->y1);
+ box++;
+ if (glamor_priv->glsl_version >= 130)
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n);
+ else {
+ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
+ glDrawArrays(GL_QUADS, 0, 4 * n);
+ } else {
+ int i;
+ for (i = 0; i < n; i++) {
+ glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
+ }
+ }
+ }
+ }
+ }
+
+ glDisable(GL_SCISSOR_TEST);
+ glDisable(GL_COLOR_LOGIC_OP);
+ if (glamor_priv->glsl_version >= 130)
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+
+ glamor_put_context(glamor_priv);
+ return TRUE;
+bail_ctx:
+ glDisable(GL_COLOR_LOGIC_OP);
+ glamor_put_context(glamor_priv);
+bail:
+ return FALSE;
+}
+
+static void
+glamor_fill_spans_bail(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) &&
+ glamor_prepare_access_gc(gc)) {
+ fbFillSpans(drawable, gc, n, points, widths, sorted);
+ }
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_fill_spans(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
+ return;
+ glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
+}
+
+Bool
+glamor_fill_spans_nf(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+
+ glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
+ return TRUE;
+}
+
+static Bool
+glamor_get_spans_gl(DrawablePtr drawable, int wmax,
+ DDXPointPtr points, int *widths, int count, char *dst)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ int box_x, box_y;
+ int n;
+ char *d;
+ GLenum type;
+ GLenum format;
+ int off_x, off_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+ glamor_format_for_pixmap(pixmap, &format, &type);
+
+ glamor_get_context(glamor_priv);
+
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+ glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+ glPixelStorei(GL_PACK_ALIGNMENT, 4);
+
+ d = dst;
+ for (n = 0; n < count; n++) {
+ int x1 = points[n].x + off_x;
+ int y = points[n].y + off_y;
+ int w = widths[n];
+ int x2 = x1 + w;
+ char *l;
+
+ l = d;
+ d += PixmapBytePad(w, drawable->depth);
+
+ /* clip */
+ if (x1 < box->x1) {
+ l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+ x1 = box->x1;
+ }
+ if (x2 > box->x2)
+ x2 = box->x2;
+
+ if (x1 >= x2)
+ continue;
+ if (y < box->y1)
+ continue;
+ if (y >= box->y2)
+ continue;
+
+ glReadPixels(x1 - box->x1, y - box->y1, x2 - x1, 1, format, type, l);
+ }
+ }
+
+ glamor_put_context(glamor_priv);
+ return TRUE;
+bail:
+ return FALSE;
+}
+
+static void
+glamor_get_spans_bail(DrawablePtr drawable, int wmax,
+ DDXPointPtr points, int *widths, int count, char *dst)
+{
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO))
+ fbGetSpans(drawable, wmax, points, widths, count, dst);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_get_spans(DrawablePtr drawable, int wmax,
+ DDXPointPtr points, int *widths, int count, char *dst)
+{
+ if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
+ return;
+ glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
+}
+
+Bool
+glamor_get_spans_nf(DrawablePtr drawable, int wmax,
+ DDXPointPtr points, int *widths, int count, char *dst)
+{
+ if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable))
+ return FALSE;
+
+ glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
+ return TRUE;
+}
+
+static Bool
+glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv;
+ int box_x, box_y;
+ int n;
+ char *s;
+ GLenum type;
+ GLenum format;
+ int off_x, off_y;
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ if (gc->alu != GXcopy)
+ goto bail;
+
+ if (!glamor_pm_is_solid(&pixmap->drawable, gc->planemask))
+ goto bail;
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+ glamor_format_for_pixmap(pixmap, &format, &type);
+
+ glamor_get_context(glamor_priv);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
+ glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, fbo->tex);
+
+ s = src;
+ for (n = 0; n < numPoints; n++) {
+
+ BoxPtr clip_box = RegionRects(gc->pCompositeClip);
+ int nclip_box = RegionNumRects(gc->pCompositeClip);
+ int w = widths[n];
+ int y = points[n].y;
+ int x = points[n].x;
+
+ while (nclip_box--) {
+ int x1 = x;
+ int x2 = x + w;
+ int y1 = y;
+ char *l = s;
+
+ /* clip to composite clip */
+ if (x1 < clip_box->x1) {
+ l += (clip_box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+ x1 = clip_box->x1;
+ }
+ if (x2 > clip_box->x2)
+ x2 = clip_box->x2;
+
+ if (y < clip_box->y1)
+ continue;
+ if (y >= clip_box->y2)
+ continue;
+
+ /* adjust to pixmap coordinates */
+ x1 += off_x;
+ x2 += off_x;
+ y1 += off_y;
+
+ if (x1 < box->x1) {
+ l += (box->x1 - x1) * (drawable->bitsPerPixel >> 3);
+ x1 = box->x1;
+ }
+ if (x2 > box->x2)
+ x2 = box->x2;
+
+ if (x1 >= x2)
+ continue;
+ if (y1 < box->y1)
+ continue;
+ if (y1 >= box->y2)
+ continue;
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ x1 - box->x1, y1 - box->y1, x2 - x1, 1,
+ format, type,
+ l);
+ }
+ s += PixmapBytePad(w, drawable->depth);
+ }
+ }
+
+ glamor_put_context(glamor_priv);
+ return TRUE;
+
+bail:
+ return FALSE;
+}
+
+static void
+glamor_set_spans_bail(DrawablePtr drawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+ if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW) && glamor_prepare_access_gc(gc))
+ fbSetSpans(drawable, gc, src, points, widths, numPoints, sorted);
+ glamor_finish_access_gc(gc);
+ glamor_finish_access(drawable);
+}
+
+void
+glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+ if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
+ return;
+ glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
+}
+
+Bool
+glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int numPoints, int sorted)
+{
+ if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+
+ glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
+ return TRUE;
+}
diff --git a/xorg-server/glamor/glamor_text.c b/xorg-server/glamor/glamor_text.c
new file mode 100644
index 000000000..0e4b74c56
--- /dev/null
+++ b/xorg-server/glamor/glamor_text.c
@@ -0,0 +1,526 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "glamor_priv.h"
+#include <dixfontstr.h>
+#include "glamor_transform.h"
+
+/*
+ * Fill in the array of charinfo pointers for the provided characters. For
+ * missing characters, place a NULL in the array so that the charinfo array
+ * aligns exactly with chars
+ */
+
+static void
+glamor_get_glyphs(FontPtr font, glamor_font_t *glamor_font,
+ int count, char *chars, Bool sixteen, CharInfoPtr *charinfo)
+{
+ unsigned long nglyphs;
+ FontEncoding encoding;
+ int char_step;
+
+ if (sixteen) {
+ char_step = 2;
+ if (FONTLASTROW(font) == 0)
+ encoding = Linear16Bit;
+ else
+ encoding = TwoD16Bit;
+ } else {
+ char_step = 1;
+ encoding = Linear8Bit;
+ }
+
+ /* If the font has a default character, then we don't have to
+ * worry about missing glyphs, so just get the whole string all at
+ * once. Otherwise, we have to fetch chars one at a time to notice
+ * missing ones.
+ */
+ if (glamor_font->default_char) {
+ GetGlyphs(font, (unsigned long) count, (unsigned char *) chars,
+ encoding, &nglyphs, charinfo);
+ } else {
+ int c;
+ for (c = 0; c < count; c++) {
+ GetGlyphs(font, 1, (unsigned char *) chars,
+ encoding, &nglyphs, &charinfo[c]);
+ if (!nglyphs)
+ charinfo[c] = NULL;
+ chars += char_step;
+ }
+ }
+}
+
+/*
+ * Construct quads for the provided list of characters and draw them
+ */
+
+static int
+glamor_text(DrawablePtr drawable, GCPtr gc,
+ glamor_font_t *glamor_font,
+ glamor_program *prog,
+ int x, int y,
+ int count, char *s_chars, CharInfoPtr *charinfo,
+ Bool sixteen)
+{
+ unsigned char *chars = (unsigned char *) s_chars;
+ FontPtr font = gc->font;
+ int off_x, off_y;
+ int c;
+ int nglyph;
+ GLshort *v;
+ char *vbo_offset;
+ CharInfoPtr ci;
+ int firstRow = font->info.firstRow;
+ int firstCol = font->info.firstCol;
+ int glyph_spacing_x = glamor_font->glyph_width_bytes * 8;
+ int glyph_spacing_y = glamor_font->glyph_height;
+ int box_x, box_y;
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+ /* Set the font as texture 1 */
+
+ glActiveTexture(GL_TEXTURE1);
+ glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
+ glUniform1i(prog->font_uniform, 1);
+
+ /* Set up the vertex buffers for the font and destination */
+
+ v = glamor_get_vbo_space(drawable->pScreen, count * (6 * sizeof (GLshort)), &vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 1);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 4, GL_SHORT, GL_FALSE,
+ 6 * sizeof (GLshort), vbo_offset);
+
+ glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+ glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 1);
+ glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_SHORT, GL_FALSE,
+ 6 * sizeof (GLshort), vbo_offset + 4 * sizeof (GLshort));
+
+ /* Set the vertex coordinates */
+ nglyph = 0;
+
+ for (c = 0; c < count; c++) {
+ if ((ci = *charinfo++)) {
+ int x1 = x + ci->metrics.leftSideBearing;
+ int y1 = y - ci->metrics.ascent;
+ int width = GLYPHWIDTHPIXELS(ci);
+ int height = GLYPHHEIGHTPIXELS(ci);
+ int tx, ty = 0;
+ int row = 0, col;
+
+ x += ci->metrics.characterWidth;
+
+ if (sixteen) {
+ if (ci == glamor_font->default_char) {
+ row = glamor_font->default_row;
+ col = glamor_font->default_col;
+ } else {
+ row = chars[0];
+ col = chars[1];
+ }
+ if (FONTLASTROW(font) != 0)
+ ty = (row - firstRow) * glyph_spacing_y;
+ else
+ col += row << 8;
+ } else {
+ if (ci == glamor_font->default_char)
+ col = glamor_font->default_col;
+ else
+ col = chars[0];
+ }
+
+ tx = (col - firstCol) * glyph_spacing_x;
+
+ v[ 0] = x1;
+ v[ 1] = y1;
+ v[ 2] = width;
+ v[ 3] = height;
+ v[ 4] = tx;
+ v[ 5] = ty;
+
+ v += 6;
+ nglyph++;
+ }
+ chars += 1 + sixteen;
+ }
+ glamor_put_vbo_space(drawable->pScreen);
+
+ if (nglyph != 0) {
+
+ glEnable(GL_SCISSOR_TEST);
+
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ BoxPtr box = RegionRects(gc->pCompositeClip);
+ int nbox = RegionNumRects(gc->pCompositeClip);
+
+ glamor_set_destination_drawable(drawable, box_x, box_y, TRUE, FALSE, prog->matrix_uniform, &off_x, &off_y);
+
+ /* Run over the clip list, drawing the glyphs
+ * in each box
+ */
+
+ while (nbox--) {
+ glScissor(box->x1 + off_x,
+ box->y1 + off_y,
+ box->x2 - box->x1,
+ box->y2 - box->y1);
+ box++;
+ glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nglyph);
+ }
+ }
+ glDisable(GL_SCISSOR_TEST);
+ }
+
+ glVertexAttribDivisor(GLAMOR_VERTEX_SOURCE, 0);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
+ glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glDisable(GL_COLOR_LOGIC_OP);
+
+ return x;
+}
+
+static const char vs_vars_text[] =
+ "attribute vec4 primitive;\n"
+ "attribute vec2 source;\n"
+ "varying vec2 glyph_pos;\n";
+
+static const char vs_exec_text[] =
+ " vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
+ GLAMOR_POS(gl_Position, (primitive.xy + pos))
+ " glyph_pos = source + pos;\n";
+
+static const char fs_vars_text[] =
+ "varying vec2 glyph_pos;\n";
+
+static const char fs_exec_text[] =
+ " ivec2 itile_texture = ivec2(glyph_pos);\n"
+ " uint x = uint(itile_texture.x & 7);\n"
+ " itile_texture.x >>= 3;\n"
+ " uint texel = texelFetch(font, itile_texture, 0).x;\n"
+ " uint bit = (texel >> x) & uint(1);\n"
+ " if (bit == uint(0))\n"
+ " discard;\n";
+
+static const char fs_exec_te[] =
+ " ivec2 itile_texture = ivec2(glyph_pos);\n"
+ " uint x = uint(itile_texture.x & 7);\n"
+ " itile_texture.x >>= 3;\n"
+ " uint texel = texelFetch(font, itile_texture, 0).x;\n"
+ " uint bit = (texel >> x) & uint(1);\n"
+ " if (bit == uint(0))\n"
+ " gl_FragColor = bg;\n"
+ " else\n"
+ " gl_FragColor = fg;\n";
+
+static const glamor_facet glamor_facet_poly_text = {
+ .name = "poly_text",
+ .version = 130,
+ .vs_vars = vs_vars_text,
+ .vs_exec = vs_exec_text,
+ .fs_vars = fs_vars_text,
+ .fs_exec = fs_exec_text,
+ .source_name = "source",
+ .locations = glamor_program_location_font,
+};
+
+static Bool
+glamor_poly_text(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars, Bool sixteen, int *final_pos)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_program *prog;
+ glamor_pixmap_private *pixmap_priv;
+ glamor_font_t *glamor_font;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ glamor_font = glamor_font_get(drawable->pScreen, gc->font);
+ if (!glamor_font)
+ goto bail;
+
+ glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ goto bail;
+
+ glamor_get_context(glamor_priv);
+
+ prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
+
+ if (!prog)
+ goto bail_ctx;
+
+ x = glamor_text(drawable, gc, glamor_font, prog,
+ x, y, count, chars, charinfo, sixteen);
+
+ glDisable(GL_COLOR_LOGIC_OP);
+
+ glamor_put_context(glamor_priv);
+
+ glamor_priv->state = RENDER_STATE;
+ glamor_priv->render_idle_cnt = 0;
+
+ *final_pos = x;
+ return TRUE;
+
+bail_ctx:
+ glDisable(GL_COLOR_LOGIC_OP);
+ glamor_put_context(glamor_priv);
+bail:
+ return FALSE;
+}
+
+Bool
+glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars, int *final_pos)
+{
+ if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, final_pos))
+ return TRUE;
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+ *final_pos = miPolyText8(drawable, gc, x, y, count, chars);
+ return TRUE;
+}
+
+int
+glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars)
+{
+ int final_pos;
+
+ if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, &final_pos))
+ return final_pos;
+ return miPolyText8(drawable, gc, x, y, count, chars);
+}
+
+Bool
+glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars, int *final_pos)
+{
+ if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, final_pos))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ return FALSE;
+ *final_pos = miPolyText16(drawable, gc, x, y, count, chars);
+ return TRUE;
+}
+
+int
+glamor_poly_text16(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars)
+{
+ int final_pos;
+
+ if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, &final_pos))
+ return final_pos;
+ return miPolyText16(drawable, gc, x, y, count, chars);
+}
+
+/*
+ * Draw image text, which is always solid in copy mode and has the
+ * background cleared while painting the text. For fonts which have
+ * their bitmap metrics exactly equal to the area to clear, we can use
+ * the accelerated version which paints both fg and bg at the same
+ * time. Otherwise, clear the whole area and then paint the glyphs on
+ * top
+ */
+
+static const glamor_facet glamor_facet_image_text = {
+ .name = "image_text",
+ .version = 130,
+ .vs_vars = vs_vars_text,
+ .vs_exec = vs_exec_text,
+ .fs_vars = fs_vars_text,
+ .fs_exec = fs_exec_text,
+ .source_name = "source",
+ .locations = glamor_program_location_font,
+};
+
+static Bool
+use_image_solid(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+ return glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform);
+}
+
+static const glamor_facet glamor_facet_image_fill = {
+ .name = "solid",
+ .fs_exec = " gl_FragColor = fg;\n",
+ .locations = glamor_program_location_fg,
+ .use = use_image_solid,
+};
+
+static Bool
+glamor_te_text_use(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
+{
+ if (!glamor_set_solid(pixmap, gc, FALSE, prog->fg_uniform))
+ return FALSE;
+ glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
+ return TRUE;
+}
+
+static const glamor_facet glamor_facet_te_text = {
+ .name = "te_text",
+ .version = 130,
+ .vs_vars = vs_vars_text,
+ .vs_exec = vs_exec_text,
+ .fs_vars = fs_vars_text,
+ .fs_exec = fs_exec_te,
+ .locations = glamor_program_location_fg | glamor_program_location_bg | glamor_program_location_font,
+ .source_name = "source",
+ .use = glamor_te_text_use,
+};
+
+static Bool
+glamor_image_text(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars,
+ Bool sixteen)
+{
+ ScreenPtr screen = drawable->pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
+ glamor_program *prog;
+ glamor_pixmap_private *pixmap_priv;
+ glamor_font_t *glamor_font;
+ const glamor_facet *prim_facet;
+ const glamor_facet *fill_facet;
+ CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */
+
+ pixmap_priv = glamor_get_pixmap_private(pixmap);
+ if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
+ return FALSE;
+
+ glamor_font = glamor_font_get(drawable->pScreen, gc->font);
+ if (!glamor_font)
+ return FALSE;
+
+ glamor_get_glyphs(gc->font, glamor_font, count, chars, sixteen, charinfo);
+
+ glamor_get_context(glamor_priv);
+
+ if (TERMINALFONT(gc->font))
+ prog = &glamor_priv->te_text_prog;
+ else
+ prog = &glamor_priv->image_text_prog;
+
+ if (prog->failed)
+ goto bail;
+
+ if (!prog->prog) {
+ if (TERMINALFONT(gc->font)) {
+ prim_facet = &glamor_facet_te_text;
+ fill_facet = NULL;
+ } else {
+ prim_facet = &glamor_facet_image_text;
+ fill_facet = &glamor_facet_image_fill;
+ }
+
+ if (!glamor_build_program(screen, prog, prim_facet, fill_facet))
+ goto bail;
+ }
+
+ if (!TERMINALFONT(gc->font)) {
+ int width = 0;
+ int c;
+ RegionRec region;
+ BoxRec box;
+ int off_x, off_y;
+
+ /* Check planemask before drawing background to
+ * bail early if it's not OK
+ */
+ if (!glamor_set_planemask(pixmap, gc->planemask))
+ goto bail;
+ for (c = 0; c < count; c++)
+ if (charinfo[c])
+ width += charinfo[c]->metrics.characterWidth;
+
+ glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
+
+ if (width >= 0) {
+ box.x1 = off_x + drawable->x + x;
+ box.x2 = off_x + drawable->x + x + width;
+ } else {
+ box.x1 = off_x + drawable->x + x + width;
+ box.x2 = off_x + drawable->x + x;
+ }
+ box.y1 = off_y + drawable->y + y - gc->font->info.fontAscent;
+ box.y2 = off_y + drawable->y + y + gc->font->info.fontDescent;
+ RegionInit(&region, &box, 1);
+ RegionIntersect(&region, &region, gc->pCompositeClip);
+ glamor_solid_boxes(pixmap, RegionRects(&region), RegionNumRects(&region), gc->bgPixel);
+ RegionUninit(&region);
+ }
+
+ if (!glamor_use_program(pixmap, gc, prog, NULL))
+ goto bail;
+
+ (void) glamor_text(drawable, gc, glamor_font, prog,
+ x, y, count, chars, charinfo, sixteen);
+
+ glamor_put_context(glamor_priv);
+
+ glamor_priv->state = RENDER_STATE;
+ glamor_priv->render_idle_cnt = 0;
+
+ return TRUE;
+
+bail:
+ glDisable(GL_COLOR_LOGIC_OP);
+ glamor_put_context(glamor_priv);
+ return FALSE;
+}
+
+Bool
+glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars)
+{
+ return glamor_image_text(drawable, gc, x, y, count, chars, FALSE);
+}
+
+void
+glamor_image_text8(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, char *chars)
+{
+ if (!glamor_image_text(drawable, gc, x, y, count, chars, FALSE))
+ miImageText8(drawable, gc, x, y, count, chars);
+}
+
+Bool
+glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars)
+{
+ return glamor_image_text(drawable, gc, x, y, count, (char *) chars, FALSE);
+}
+
+void
+glamor_image_text16(DrawablePtr drawable, GCPtr gc,
+ int x, int y, int count, unsigned short *chars)
+{
+ if (!glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE))
+ miImageText16(drawable, gc, x, y, count, chars);
+}
diff --git a/xorg-server/glamor/glamor_transfer.c b/xorg-server/glamor/glamor_transfer.c
new file mode 100644
index 000000000..0378bb076
--- /dev/null
+++ b/xorg-server/glamor/glamor_transfer.c
@@ -0,0 +1,264 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "glamor_priv.h"
+#include "glamor_transfer.h"
+
+/* XXX a kludge for now */
+void
+glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type)
+{
+ switch (pixmap->drawable.depth) {
+ case 24:
+ case 32:
+ *format = GL_BGRA;
+ *type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ break;
+ case 16:
+ *format = GL_RGB;
+ *type = GL_UNSIGNED_SHORT_5_6_5;
+ break;
+ case 15:
+ *format = GL_BGRA;
+ *type = GL_UNSIGNED_SHORT_1_5_5_5_REV;
+ break;
+ case 8:
+ *format = GL_ALPHA;
+ *type = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ FatalError("Invalid pixmap depth %d\n", pixmap->drawable.depth);
+ break;
+ }
+}
+
+/*
+ * Write a region of bits into a pixmap
+ */
+void
+glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+ int dx_src, int dy_src,
+ int dx_dst, int dy_dst,
+ uint8_t *bits, uint32_t byte_stride)
+{
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+ int box_x, box_y;
+ int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
+ GLenum type;
+ GLenum format;
+
+ glamor_format_for_pixmap(pixmap, &format, &type);
+
+ glamor_get_context(glamor_priv);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+ glamor_pixmap_loop(priv, box_x, box_y) {
+ BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y);
+ glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+ BoxPtr boxes = in_boxes;
+ int nbox = in_nbox;
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, fbo->tex);
+
+ while (nbox--) {
+
+ /* compute drawable coordinates */
+ int x1 = boxes->x1 + dx_dst;
+ int x2 = boxes->x2 + dx_dst;
+ int y1 = boxes->y1 + dy_dst;
+ int y2 = boxes->y2 + dy_dst;
+
+ boxes++;
+
+ if (x1 < box->x1)
+ x1 = box->x1;
+ if (box->x2 < x2)
+ x2 = box->x2;
+
+ if (x2 <= x1)
+ continue;
+
+ if (y1 < box->y1)
+ y1 = box->y1;
+ if (box->y2 < y2)
+ y2 = box->y2;
+
+ if (y2 <= y1)
+ continue;
+
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
+
+ glTexSubImage2D(GL_TEXTURE_2D, 0,
+ x1 - box->x1, y1 - box->y1,
+ x2 - x1, y2 - y1,
+ format, type,
+ bits);
+ }
+ }
+
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glamor_put_context(glamor_priv);
+}
+
+/*
+ * Upload a region of data
+ */
+
+void
+glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
+ int region_x, int region_y,
+ uint8_t *bits, uint32_t byte_stride)
+{
+ glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region),
+ -region_x, -region_y,
+ 0, 0,
+ bits, byte_stride);
+}
+
+/*
+ * Take the data in the pixmap and stuff it back into the FBO
+ */
+void
+glamor_upload_pixmap(PixmapPtr pixmap)
+{
+ BoxRec box;
+
+ box.x1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y1 = 0;
+ box.y2 = pixmap->drawable.height;
+ glamor_upload_boxes(pixmap, &box, 1, 0, 0, 0, 0,
+ pixmap->devPrivate.ptr, pixmap->devKind);
+}
+
+/*
+ * Read stuff from the pixmap FBOs and write to memory
+ */
+void
+glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+ int dx_src, int dy_src,
+ int dx_dst, int dy_dst,
+ uint8_t *bits, uint32_t byte_stride)
+{
+ ScreenPtr screen = pixmap->drawable.pScreen;
+ glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+ glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
+ int box_x, box_y;
+ int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
+ GLenum type;
+ GLenum format;
+
+ glamor_format_for_pixmap(pixmap, &format, &type);
+
+ glamor_get_context(glamor_priv);
+
+ glPixelStorei(GL_PACK_ALIGNMENT, 4);
+ glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
+
+ glamor_pixmap_loop(priv, box_x, box_y) {
+ BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y);
+ glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(priv, box_x, box_y);
+ BoxPtr boxes = in_boxes;
+ int nbox = in_nbox;
+
+ glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
+
+ while (nbox--) {
+
+ /* compute drawable coordinates */
+ int x1 = boxes->x1 + dx_src;
+ int x2 = boxes->x2 + dx_src;
+ int y1 = boxes->y1 + dy_src;
+ int y2 = boxes->y2 + dy_src;
+
+ boxes++;
+
+ if (x1 < box->x1)
+ x1 = box->x1;
+ if (box->x2 < x2)
+ x2 = box->x2;
+
+ if (y1 < box->y1)
+ y1 = box->y1;
+ if (box->y2 < y2)
+ y2 = box->y2;
+
+ if (x2 <= x1)
+ continue;
+ if (y2 <= y1)
+ continue;
+
+ glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
+ glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
+ glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
+ }
+ }
+ glPixelStorei(GL_PACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_PACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
+ glamor_put_context(glamor_priv);
+}
+
+/*
+ * Read data from the pixmap FBO
+ */
+void
+glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits)
+{
+ BoxRec box;
+
+ box.x1 = x;
+ box.x2 = x + w;
+ box.y1 = y;
+ box.y2 = y + h;
+
+ glamor_download_boxes(pixmap, &box, 1, 0, 0, -x, -y,
+ bits, PixmapBytePad(w, pixmap->drawable.depth));
+}
+
+/*
+ * Pull the data from the FBO down to the pixmap
+ */
+void
+glamor_download_pixmap(PixmapPtr pixmap)
+{
+ BoxRec box;
+
+ box.x1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y1 = 0;
+ box.y2 = pixmap->drawable.height;
+
+ glamor_download_boxes(pixmap, &box, 1, 0, 0, 0, 0,
+ pixmap->devPrivate.ptr, pixmap->devKind);
+}
diff --git a/xorg-server/glamor/glamor_transfer.h b/xorg-server/glamor/glamor_transfer.h
new file mode 100644
index 000000000..de8186a70
--- /dev/null
+++ b/xorg-server/glamor/glamor_transfer.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2014 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef _GLAMOR_TRANSFER_H_
+#define _GLAMOR_TRANSFER_H_
+
+void
+glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type);
+
+void
+glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+ int dx_src, int dy_src,
+ int dx_dst, int dy_dst,
+ uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
+ int region_x, int region_y,
+ uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_upload_pixmap(PixmapPtr pixmap);
+
+void
+glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
+ int dx_src, int dy_src,
+ int dx_dst, int dy_dst,
+ uint8_t *bits, uint32_t byte_stride);
+
+void
+glamor_download_rect(PixmapPtr pixmap, int x, int y, int w, int h, uint8_t *bits);
+
+void
+glamor_download_pixmap(PixmapPtr pixmap);
+
+#endif /* _GLAMOR_TRANSFER_H_ */
diff --git a/xorg-server/glamor/glamor_xv.c b/xorg-server/glamor/glamor_xv.c
index 17745a4e8..4e60fa3a4 100644
--- a/xorg-server/glamor/glamor_xv.c
+++ b/xorg-server/glamor/glamor_xv.c
@@ -114,18 +114,6 @@ glamor_init_xv_shader(ScreenPtr screen)
glamor_put_context(glamor_priv);
}
-void
-glamor_fini_xv_shader(ScreenPtr screen)
-{
- glamor_screen_private *glamor_priv;
-
- glamor_priv = glamor_get_screen_private(screen);
- glamor_get_context(glamor_priv);
-
- glDeleteProgram(glamor_priv->xv_prog);
- glamor_put_context(glamor_priv);
-}
-
#define ClipValue(v,min,max) ((v) < (min) ? (min) : (v) > (max) ? (max) : (v))
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -559,6 +547,8 @@ glamor_xv_init(ScreenPtr screen, int num_texture_ports)
XF86VideoAdaptorPtr adapt;
int i;
+ glamor_init_xv_shader(screen);
+
adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
(sizeof(glamor_port_private) + sizeof(DevUnion)));
if (adapt == NULL)
diff --git a/xorg-server/hw/Makefile.am b/xorg-server/hw/Makefile.am
index 6c2cc6bd4..19895dc77 100644
--- a/xorg-server/hw/Makefile.am
+++ b/xorg-server/hw/Makefile.am
@@ -26,6 +26,10 @@ if XQUARTZ
XQUARTZ_SUBDIRS = xquartz
endif
+if XWAYLAND
+XWAYLAND_SUBDIRS = xwayland
+endif
+
SUBDIRS = \
$(XORG_SUBDIRS) \
$(XWIN_SUBDIRS) \
@@ -33,9 +37,10 @@ SUBDIRS = \
$(XNEST_SUBDIRS) \
$(DMX_SUBDIRS) \
$(KDRIVE_SUBDIRS) \
- $(XQUARTZ_SUBDIRS)
+ $(XQUARTZ_SUBDIRS) \
+ $(XWAYLAND_SUBDIRS)
-DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive
+DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland
relink:
$(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done
diff --git a/xorg-server/hw/dmx/Makefile.am b/xorg-server/hw/dmx/Makefile.am
index a05af139e..eef84cb66 100644
--- a/xorg-server/hw/dmx/Makefile.am
+++ b/xorg-server/hw/dmx/Makefile.am
@@ -65,7 +65,6 @@ Xdmx_SOURCES = dmx.c \
dmxwindow.c \
dmxwindow.h \
$(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/fb/fbcmap_mi.c \
$(GLX_SRCS)
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
index 9903cc772..eaf565496 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -313,7 +313,6 @@ ephyr_glamor_get_visual(void)
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER, 1,
- GLX_VISUAL_ID, DefaultVisual(dpy, DefaultScreen(dpy)),
None
};
int event_base = 0, error_base = 0, nelements;
diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c
index 8aadb2aab..dea6f730c 100755
--- a/xorg-server/hw/kdrive/ephyr/hostx.c
+++ b/xorg-server/hw/kdrive/ephyr/hostx.c
@@ -752,13 +752,16 @@ __asm int 3;
scrpriv->win_width = width;
scrpriv->win_height = height;
+#ifdef GLAMOR
if (ephyr_glamor) {
*bytes_per_line = 0;
*bits_per_pixel = 0;
ephyr_glamor_set_window_size(scrpriv->glamor,
scrpriv->win_width, scrpriv->win_height);
return NULL;
- } else if (host_depth_matches_server(scrpriv)) {
+ } else
+#endif
+ if (host_depth_matches_server(scrpriv)) {
*bytes_per_line = scrpriv->ximg->stride;
*bits_per_pixel = scrpriv->ximg->bpp;
diff --git a/xorg-server/hw/kdrive/src/Makefile.am b/xorg-server/hw/kdrive/src/Makefile.am
index 5799ddbdb..d69f0dd99 100644
--- a/xorg-server/hw/kdrive/src/Makefile.am
+++ b/xorg-server/hw/kdrive/src/Makefile.am
@@ -4,7 +4,7 @@ AM_CPPFLAGS = \
AM_CFLAGS = -DHAVE_DIX_CONFIG_H
-noinst_LTLIBRARIES = libkdrive.la libkdrivestubs.la
+noinst_LTLIBRARIES = libkdrive.la
if XV
KDRIVE_XV_SOURCES = \
@@ -23,6 +23,3 @@ libkdrive_la_SOURCES = \
kshadow.c \
$(KDRIVE_XV_SOURCES) \
$(top_srcdir)/mi/miinitext.c
-
-libkdrivestubs_la_SOURCES = \
- $(top_srcdir)/fb/fbcmap_mi.c
diff --git a/xorg-server/hw/vfb/Makefile.am b/xorg-server/hw/vfb/Makefile.am
index 9f4992c8b..f0f9fee47 100644
--- a/xorg-server/hw/vfb/Makefile.am
+++ b/xorg-server/hw/vfb/Makefile.am
@@ -1,7 +1,6 @@
SUBDIRS = man
bin_PROGRAMS = Xvfb
-noinst_LIBRARIES = libfbcmap.a
AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
$(XVFBMODULES_CFLAGS) \
@@ -9,20 +8,16 @@ AM_CFLAGS = -DHAVE_DIX_CONFIG_H \
SRCS = InitInput.c \
InitOutput.c \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c
-libfbcmap_a_CFLAGS = $(AM_CFLAGS)
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
-
Xvfb_SOURCES = $(SRCS)
XVFB_LIBS = \
@XVFB_LIBS@ \
- libfbcmap.a \
$(MAIN_LIB) \
- $(XSERVER_LIBS)
+ $(XSERVER_LIBS) \
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
+ $(top_builddir)/Xi/libXistubs.la
Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
Xvfb_DEPENDENCIES = $(XVFB_LIBS)
diff --git a/xorg-server/hw/xfree86/.gitignore b/xorg-server/hw/xfree86/.gitignore
index 997a94efe..fb6830b2c 100644
--- a/xorg-server/hw/xfree86/.gitignore
+++ b/xorg-server/hw/xfree86/.gitignore
@@ -1,4 +1,5 @@
Xorg
+Xorg.sh
xorg.conf.example
sdksyms.c
sdksyms.dep
diff --git a/xorg-server/hw/xfree86/Makefile.am b/xorg-server/hw/xfree86/Makefile.am
index 18fa99b08..c5992c372 100644
--- a/xorg-server/hw/xfree86/Makefile.am
+++ b/xorg-server/hw/xfree86/Makefile.am
@@ -89,7 +89,7 @@ endif
BUILT_SOURCES = xorg.conf.example
DISTCLEANFILES = xorg.conf.example
-EXTRA_DIST = xorgconf.cpp Xorg.sh.in
+EXTRA_DIST = xorgconf.cpp
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
@@ -105,6 +105,7 @@ if INSTALL_SETUID
chmod u+s $(DESTDIR)$(bindir)/Xorg
endif
if SUID_WRAPPER
+ $(MKDIR_P) $(DESTDIR)$(SUID_WRAPPER_DIR)
mv $(DESTDIR)$(bindir)/Xorg $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.bin
${INSTALL} -m 755 Xorg.sh $(DESTDIR)$(bindir)/Xorg
-chown root $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap && chmod u+s $(DESTDIR)$(SUID_WRAPPER_DIR)/Xorg.wrap
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index 06af73903..35a673d15 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -56,6 +56,7 @@
#include <X11/X.h>
#include <X11/Xpoll.h>
#include <X11/Xproto.h>
+#include <X11/Xatom.h>
#include "misc.h"
#include "compiler.h"
#include "xf86.h"
@@ -431,6 +432,29 @@ xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
pInfo->flags &= ~XI86_DEVICE_DISABLED;
}
+/*
+ * xf86UpdateHasVTProperty --
+ * Update a flag property on the root window to say whether the server VT
+ * is currently the active one as some clients need to know this.
+ */
+static void
+xf86UpdateHasVTProperty(Bool hasVT)
+{
+ Atom property_name;
+ int32_t value = hasVT ? 1 : 0;
+ int i;
+
+ property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
+ FALSE);
+ if (property_name == BAD_RESOURCE)
+ FatalError("Failed to retrieve \"HAS_VT\" atom\n");
+ for (i = 0; i < xf86NumScreens; i++) {
+ ChangeWindowProperty(xf86ScrnToScreen(xf86Screens[i])->root,
+ property_name, XA_INTEGER, 32,
+ PropModeReplace, 1, &value, TRUE);
+ }
+}
+
void
xf86VTLeave(void)
{
@@ -490,6 +514,8 @@ xf86VTLeave(void)
if (xorgHWAccess)
xf86DisableIO();
+ xf86UpdateHasVTProperty(FALSE);
+
return;
switch_failed:
@@ -574,6 +600,8 @@ xf86VTEnter(void)
xf86platformVTProbe();
#endif
+ xf86UpdateHasVTProperty(TRUE);
+
OsReleaseSIGIO();
}
diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c
index 7df7a80c4..984c39bca 100644
--- a/xorg-server/hw/xfree86/common/xf86Globals.c
+++ b/xorg-server/hw/xfree86/common/xf86Globals.c
@@ -143,7 +143,7 @@ const char *xf86ConfigFile = NULL;
const char *xf86ConfigDir = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH;
MessageType xf86ModPathFrom = X_DEFAULT;
-const char *xf86LogFile = DEFAULT_LOGPREFIX;
+const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE;
serverLayoutRec xf86ConfigLayout = { NULL, };
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index 12a877159..e2b32a074 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1217,16 +1217,45 @@ xf86ErrorF(const char *format, ...)
va_end(ap);
}
+/* Note temporarily modifies the passed in buffer! */
+static void xf86_mkdir_p(char *path)
+{
+ char *sep = path;
+
+ while ((sep = strchr(sep + 1, '/'))) {
+ *sep = 0;
+ (void)mkdir(path, 0777);
+ *sep = '/';
+ }
+ (void)mkdir(path, 0777);
+}
+
void
xf86LogInit(void)
{
- char *lf = NULL;
+ char *env, *lf = NULL;
+ char buf[PATH_MAX];
#define LOGSUFFIX ".log"
#define LOGOLDSUFFIX ".old"
/* Get the log file name */
if (xf86LogFileFrom == X_DEFAULT) {
+ /* When not running as root, we won't be able to write to /var/log */
+ if (geteuid() != 0) {
+ if ((env = getenv("XDG_DATA_HOME")))
+ snprintf(buf, sizeof(buf), "%s/%s", env,
+ DEFAULT_XDG_DATA_HOME_LOGDIR);
+ else if ((env = getenv("HOME")))
+ snprintf(buf, sizeof(buf), "%s/%s/%s", env,
+ DEFAULT_XDG_DATA_HOME, DEFAULT_XDG_DATA_HOME_LOGDIR);
+
+ if (env) {
+ xf86_mkdir_p(buf);
+ strlcat(buf, "/" DEFAULT_LOGPREFIX, sizeof(buf));
+ xf86LogFile = buf;
+ }
+ }
/* Append the display number and ".log" */
if (asprintf(&lf, "%s%%s" LOGSUFFIX, xf86LogFile) == -1)
FatalError("Cannot allocate space for the log file name\n");
diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c
index 4579ff591..5a45004f5 100644
--- a/xorg-server/hw/xfree86/common/xf86Init.c
+++ b/xorg-server/hw/xfree86/common/xf86Init.c
@@ -387,6 +387,11 @@ InstallSignalHandlers(void)
}
}
+/* The memory storing the initial value of the XFree86_has_VT root window
+ * property. This has to remain available until server start-up, so we just
+ * use a global. */
+static CARD32 HasVTValue = 1;
+
/*
* InitOutput --
* Initialize screenInfo for all actually accessible framebuffers.
@@ -731,7 +736,9 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
if (xf86Info.vtno >= 0) {
#define VT_ATOM_NAME "XFree86_VT"
Atom VTAtom = -1;
+ Atom HasVTAtom = -1;
CARD32 *VT = NULL;
+ CARD32 *HasVT = &HasVTValue;
int ret;
/* This memory needs to stay available until the screen has been
@@ -744,6 +751,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
*VT = xf86Info.vtno;
VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
+ HasVTAtom = MakeAtom(HAS_VT_ATOM_NAME,
+ sizeof(HAS_VT_ATOM_NAME) - 1, TRUE);
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success;
i++) {
@@ -751,9 +760,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv)
xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
VTAtom, XA_INTEGER, 32, 1,
VT);
+ if (ret == Success)
+ ret = xf86RegisterRootWindowProperty(xf86Screens[i]
+ ->scrnIndex,
+ HasVTAtom, XA_INTEGER,
+ 32, 1, HasVT);
if (ret != Success)
xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register VT property\n");
+ "Failed to register VT properties\n");
}
}
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index e8c24f26c..62ac95d5a 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(16, 0)
+#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(17, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(21, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(8, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
diff --git a/xorg-server/hw/xfree86/common/xf86Privstr.h b/xorg-server/hw/xfree86/common/xf86Privstr.h
index f7a9c9f1c..410ef17ac 100644
--- a/xorg-server/hw/xfree86/common/xf86Privstr.h
+++ b/xorg-server/hw/xfree86/common/xf86Privstr.h
@@ -163,4 +163,8 @@ typedef struct _RootWinProp {
#define WSCONS 32
#endif
+/* Root window property to tell clients whether our VT is currently active.
+ * Name chosen to match the "XFree86_VT" property. */
+#define HAS_VT_ATOM_NAME "XFree86_has_VT"
+
#endif /* _XF86PRIVSTR_H */
diff --git a/xorg-server/hw/xfree86/dixmods/Makefile.am b/xorg-server/hw/xfree86/dixmods/Makefile.am
index 3c43640ec..dd076e421 100644
--- a/xorg-server/hw/xfree86/dixmods/Makefile.am
+++ b/xorg-server/hw/xfree86/dixmods/Makefile.am
@@ -19,12 +19,12 @@ AM_CPPFLAGS = @XORG_INCS@ \
libfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libfb_la_LIBADD = $(top_builddir)/fb/libfb.la
-libfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libfb_la_SOURCES = fbmodule.c
libfb_la_CFLAGS = $(AM_CFLAGS)
libwfb_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
-libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap_mi.c fbmodule.c
+libwfb_la_SOURCES = fbmodule.c
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
libglx_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG)
diff --git a/xorg-server/hw/xfree86/man/Xorg.man b/xorg-server/hw/xfree86/man/Xorg.man
index 0cd5a1068..3ff6aef89 100644
--- a/xorg-server/hw/xfree86/man/Xorg.man
+++ b/xorg-server/hw/xfree86/man/Xorg.man
@@ -301,9 +301,11 @@ Use the file called
.I filename
as the
.B Xorg
-server log file. The default log file is
+server log file. The default log file when running as root is
.BI __logdir__/Xorg. n .log
-on most platforms, where
+and for non root it is
+.BI $XDG_DATA_HOME/xorg/Xorg. n .log
+where
.I n
is the display number of the
.B Xorg
diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man
index 85f9f2ee1..6d2652e84 100644
--- a/xorg-server/hw/xfree86/man/xorg.conf.man
+++ b/xorg-server/hw/xfree86/man/xorg.conf.man
@@ -442,11 +442,15 @@ __modulepath__
.TP 7
.BI "LogFile \*q" path \*q
sets the name of the Xorg server log file.
-The default log file name is
+The default log file name when running as root is
.PP
.RS 11
.RI __logdir__/Xorg. <n> .log
.RE
+and for non root it is
+.RS 11
+.RI $XDG_DATA_HOME/xorg/Xorg. <n> .log
+.RE
.PP
.RS 7
where
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.h b/xorg-server/hw/xfree86/modes/xf86Crtc.h
index c127d78af..5407deb0e 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.h
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.h
@@ -186,13 +186,13 @@ typedef struct _xf86CrtcFuncs {
/**
* Load monochrome image
*/
- void
+ Bool
(*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
/**
* Load ARGB image
*/
- void
+ Bool
(*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
/**
diff --git a/xorg-server/hw/xfree86/modes/xf86Cursors.c b/xorg-server/hw/xfree86/modes/xf86Cursors.c
index 2b0db3492..10ef6f6d4 100644
--- a/xorg-server/hw/xfree86/modes/xf86Cursors.c
+++ b/xorg-server/hw/xfree86/modes/xf86Cursors.c
@@ -211,7 +211,7 @@ set_bit(CARD8 *image, xf86CursorInfoPtr cursor_info, int x, int y, Bool mask)
/*
* Load a two color cursor into a driver that supports only ARGB cursors
*/
-static void
+static Bool
xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
{
ScrnInfoPtr scrn = crtc->scrn;
@@ -244,7 +244,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
bits = 0;
cursor_image[y * cursor_info->MaxWidth + x] = bits;
}
- crtc->funcs->load_cursor_argb(crtc, cursor_image);
+ return crtc->funcs->load_cursor_argb(crtc, cursor_image);
}
/*
@@ -415,7 +415,7 @@ xf86_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
/*
* Load a two-color cursor into a crtc, performing rotation as needed
*/
-static void
+static Bool
xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
{
ScrnInfoPtr scrn = crtc->scrn;
@@ -450,13 +450,13 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
set_bit(cursor_image, cursor_info, x, y, TRUE);
}
}
- crtc->funcs->load_cursor_image(crtc, cursor_image);
+ return crtc->funcs->load_cursor_image(crtc, cursor_image);
}
/*
* Load a cursor image into all active CRTCs
*/
-static void
+static Bool
xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -466,12 +466,17 @@ xf86_load_cursor_image(ScrnInfoPtr scrn, unsigned char *src)
xf86CrtcPtr crtc = xf86_config->crtc[c];
if (crtc->enabled) {
- if (crtc->funcs->load_cursor_image)
- xf86_crtc_load_cursor_image(crtc, src);
- else if (crtc->funcs->load_cursor_argb)
- xf86_crtc_convert_cursor_to_argb(crtc, src);
+ if (crtc->funcs->load_cursor_image) {
+ if (!xf86_crtc_load_cursor_image(crtc, src))
+ return FALSE;
+ } else if (crtc->funcs->load_cursor_argb) {
+ if (!xf86_crtc_convert_cursor_to_argb(crtc, src))
+ return FALSE;
+ } else
+ return FALSE;
}
}
+ return TRUE;
}
static Bool
@@ -516,7 +521,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
return TRUE;
}
-static void
+static Bool
xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor)
{
ScrnInfoPtr scrn = crtc->scrn;
@@ -544,10 +549,10 @@ xf86_crtc_load_cursor_argb(xf86CrtcPtr crtc, CursorPtr cursor)
cursor_image[y * image_width + x] = bits;
}
- crtc->funcs->load_cursor_argb(crtc, cursor_image);
+ return crtc->funcs->load_cursor_argb(crtc, cursor_image);
}
-static void
+static Bool
xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -557,8 +562,10 @@ xf86_load_cursor_argb(ScrnInfoPtr scrn, CursorPtr cursor)
xf86CrtcPtr crtc = xf86_config->crtc[c];
if (crtc->enabled)
- xf86_crtc_load_cursor_argb(crtc, cursor);
+ if (!xf86_crtc_load_cursor_argb(crtc, cursor))
+ return FALSE;
}
+ return TRUE;
}
Bool
@@ -608,6 +615,8 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
* Called when anything on the screen is reconfigured.
*
* Reloads cursor images as needed, then adjusts cursor positions
+ * @note We assume that all hardware cursors to be loaded have already been
+ * found to be usable by the hardware.
*/
void
diff --git a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
index 62858b062..ed670a88c 100644
--- a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c
@@ -310,10 +310,31 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
dbus_int32_t major, minor;
char *pause_str;
- if (strcmp(dbus_message_get_path(message), info->session) != 0)
+ dbus_error_init(&error);
+
+ if (dbus_message_is_signal(message,
+ "org.freedesktop.DBus", "NameOwnerChanged")) {
+ char *name, *old_owner, *new_owner;
+
+ dbus_message_get_args(message, &error,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &old_owner,
+ DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
+ if (dbus_error_is_set(&error)) {
+ LogMessage(X_ERROR, "systemd-logind: NameOwnerChanged: %s\n",
+ error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (name && strcmp(name, "org.freedesktop.login1") == 0)
+ FatalError("systemd-logind disappeared (stopped/restarted?)\n");
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
- dbus_error_init(&error);
+ if (strcmp(dbus_message_get_path(message), info->session) != 0)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_signal(message, "org.freedesktop.login1.Session",
"PauseDevice")) {
@@ -472,6 +493,15 @@ connect_hook(DBusConnection *connection, void *data)
goto cleanup;
}
+ dbus_bus_add_match(connection,
+ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',path='/org/freedesktop/DBus'",
+ &error);
+ if (dbus_error_is_set(&error)) {
+ LogMessage(X_ERROR, "systemd-logind: could not add match: %s\n",
+ error.message);
+ goto cleanup;
+ }
+
/*
* HdG: This is not useful with systemd <= 208 since the signal only
* contains invalidated property names there, rather than property, val
diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c
index ad053f746..6be32d7ea 100644
--- a/xorg-server/hw/xfree86/parser/DRI.c
+++ b/xorg-server/hw/xfree86/parser/DRI.c
@@ -31,6 +31,7 @@
#include <xorg-config.h>
#endif
+#include "os.h"
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
diff --git a/xorg-server/hw/xfree86/parser/Extensions.c b/xorg-server/hw/xfree86/parser/Extensions.c
index b5ba72e5f..a6fcb56f0 100644
--- a/xorg-server/hw/xfree86/parser/Extensions.c
+++ b/xorg-server/hw/xfree86/parser/Extensions.c
@@ -35,6 +35,7 @@
#include <xorg-config.h>
#endif
+#include "os.h"
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
diff --git a/xorg-server/hw/xfree86/ramdac/IBM.c b/xorg-server/hw/xfree86/ramdac/IBM.c
index bc716231a..872d3d4e7 100644
--- a/xorg-server/hw/xfree86/ramdac/IBM.c
+++ b/xorg-server/hw/xfree86/ramdac/IBM.c
@@ -570,7 +570,7 @@ IBMramdac640SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
(*ramdacPtr->WriteData) (pScrn, bg);
}
-static void
+static Bool
IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -582,9 +582,10 @@ IBMramdac526LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
*/
for (i = 0; i < 1024; i++)
(*ramdacPtr->WriteDAC) (pScrn, IBMRGB_curs_array + i, 0x00, (*src++));
+ return TRUE;
}
-static void
+static Bool
IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -596,6 +597,7 @@ IBMramdac640LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
*/
for (i = 0; i < 1024; i++)
(*ramdacPtr->WriteDAC) (pScrn, RGB640_CURS_WRITE + i, 0x00, (*src++));
+ return TRUE;
}
static Bool
diff --git a/xorg-server/hw/xfree86/ramdac/TI.c b/xorg-server/hw/xfree86/ramdac/TI.c
index 393b774d4..7d4e0d796 100644
--- a/xorg-server/hw/xfree86/ramdac/TI.c
+++ b/xorg-server/hw/xfree86/ramdac/TI.c
@@ -642,7 +642,7 @@ TIramdacSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
(*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_COLOR, 0, (fg & 0x000000ff));
}
-static void
+static Bool
TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
RamDacRecPtr ramdacPtr = RAMDACSCRPTR(pScrn);
@@ -657,6 +657,7 @@ TIramdacLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
/* NOT_DONE: might need a delay here */
(*ramdacPtr->WriteDAC) (pScrn, TIDAC_CURS_RAM_DATA, 0, *(src++));
}
+ return TRUE;
}
static Bool
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
index 860704e1c..fac682210 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c
@@ -352,12 +352,13 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
(*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
NullCursor, x, y);
- xf86SetCursor(pScreen, cursor, x, y);
- ScreenPriv->SWCursor = FALSE;
- ScreenPriv->isUp = TRUE;
+ if (xf86SetCursor(pScreen, cursor, x, y)) {
+ ScreenPriv->SWCursor = FALSE;
+ ScreenPriv->isUp = TRUE;
- miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
- return;
+ miPointerSetWaitForUpdate(pScreen, !infoPtr->pScrn->silkenMouse);
+ return;
+ }
}
miPointerSetWaitForUpdate(pScreen, TRUE);
diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.h b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
index 5658e7b30..1ecbdcd8d 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
+++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.h
@@ -12,7 +12,7 @@ typedef struct _xf86CursorInfoRec {
int MaxHeight;
void (*SetCursorColors) (ScrnInfoPtr pScrn, int bg, int fg);
void (*SetCursorPosition) (ScrnInfoPtr pScrn, int x, int y);
- void (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
+ Bool (*LoadCursorImage) (ScrnInfoPtr pScrn, unsigned char *bits);
void (*HideCursor) (ScrnInfoPtr pScrn);
void (*ShowCursor) (ScrnInfoPtr pScrn);
unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
@@ -20,7 +20,7 @@ typedef struct _xf86CursorInfoRec {
#ifdef ARGB_CURSOR
Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
- void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
+ Bool (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
#endif
} xf86CursorInfoRec, *xf86CursorInfoPtr;
diff --git a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
index a5d2aabc3..f34c1c7fc 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -37,7 +37,7 @@ typedef struct {
void *transparentData;
} xf86CursorScreenRec, *xf86CursorScreenPtr;
-void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
+Bool xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y);
void xf86SetTransparentCursor(ScreenPtr pScreen);
void xf86MoveCursor(ScreenPtr pScreen, int x, int y);
void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed);
diff --git a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
index 3b69698db..0b5caa20a 100644
--- a/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/xorg-server/hw/xfree86/ramdac/xf86HWCurs.c
@@ -119,7 +119,7 @@ xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
return TRUE;
}
-void
+Bool
xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
{
xf86CursorScreenPtr ScreenPriv =
@@ -130,7 +130,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
if (pCurs == NullCursor) {
(*infoPtr->HideCursor) (infoPtr->pScrn);
- return;
+ return TRUE;
}
bits =
@@ -152,18 +152,21 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
(*infoPtr->HideCursor) (infoPtr->pScrn);
#ifdef ARGB_CURSOR
- if (pCurs->bits->argb && infoPtr->LoadCursorARGB)
- (*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs);
- else
+ if (pCurs->bits->argb && infoPtr->LoadCursorARGB) {
+ if (!(*infoPtr->LoadCursorARGB) (infoPtr->pScrn, pCurs))
+ return FALSE;
+ } else
#endif
if (bits)
- (*infoPtr->LoadCursorImage) (infoPtr->pScrn, bits);
+ if (!(*infoPtr->LoadCursorImage) (infoPtr->pScrn, bits))
+ return FALSE;
xf86RecolorCursor(pScreen, pCurs, 1);
(*infoPtr->SetCursorPosition) (infoPtr->pScrn, x, y);
(*infoPtr->ShowCursor) (infoPtr->pScrn);
+ return TRUE;
}
void
diff --git a/xorg-server/hw/xnest/Makefile.am b/xorg-server/hw/xnest/Makefile.am
index 3c099cd6b..eb550c0f7 100644
--- a/xorg-server/hw/xnest/Makefile.am
+++ b/xorg-server/hw/xnest/Makefile.am
@@ -1,7 +1,6 @@
SUBDIRS = man
bin_PROGRAMS = Xnest
-noinst_LIBRARIES = libfbcmap.a
AM_CFLAGS = -DHAVE_XNEST_CONFIG_H \
$(DIX_CFLAGS) \
@@ -42,16 +41,12 @@ SRCS = Args.c \
XNPixmap.h \
XNWindow.h \
xnest-config.h \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c
-libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c
-libfbcmap_a_CFLAGS = $(AM_CFLAGS)
-
XNEST_LIBS = \
@XNEST_LIBS@ \
- libfbcmap.a
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
+ $(top_builddir)/Xi/libXistubs.la
Xnest_SOURCES = $(SRCS)
diff --git a/xorg-server/hw/xquartz/Makefile.am b/xorg-server/hw/xquartz/Makefile.am
index 2ca953cf9..4da896d76 100644
--- a/xorg-server/hw/xquartz/Makefile.am
+++ b/xorg-server/hw/xquartz/Makefile.am
@@ -20,7 +20,6 @@ SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man
DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man
libXquartz_la_SOURCES = \
- $(top_srcdir)/fb/fbcmap_mi.c \
$(top_srcdir)/mi/miinitext.c \
X11Application.m \
X11Controller.m \
diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m
index 5445c6f3a..022e83258 100644
--- a/xorg-server/hw/xquartz/X11Controller.m
+++ b/xorg-server/hw/xquartz/X11Controller.m
@@ -942,9 +942,8 @@ extern char *bundle_id_prefix;
/* shutdown the X server, it will exit () for us. */
DarwinSendDDXEvent(kXquartzQuit, 0);
- /* In case it doesn't, exit anyway after a while. */
- remain = 10000000;
- while ((remain = usleep(remain)) > 0) ;
+ /* In case it doesn't, exit anyway after 5s. */
+ [NSThread sleepForTimeInterval:5.0];
exit(1);
}
diff --git a/xorg-server/hw/xwayland/.gitignore b/xorg-server/hw/xwayland/.gitignore
new file mode 100644
index 000000000..c54ba2de9
--- /dev/null
+++ b/xorg-server/hw/xwayland/.gitignore
@@ -0,0 +1,3 @@
+Xwayland
+drm-client-protocol.h
+drm-protocol.c
diff --git a/xorg-server/hw/xwayland/Makefile.am b/xorg-server/hw/xwayland/Makefile.am
new file mode 100644
index 000000000..36e6127df
--- /dev/null
+++ b/xorg-server/hw/xwayland/Makefile.am
@@ -0,0 +1,30 @@
+bin_PROGRAMS = Xwayland
+
+Xwayland_CFLAGS = \
+ -I$(top_srcdir)/dri3 \
+ -DHAVE_DIX_CONFIG_H \
+ $(XWAYLANDMODULES_CFLAGS) \
+ $(DIX_CFLAGS)
+
+Xwayland_SOURCES = \
+ xwayland.c \
+ xwayland-input.c \
+ xwayland-cursor.c \
+ xwayland-shm.c \
+ xwayland-output.c \
+ xwayland-cvt.c \
+ xwayland.h \
+ $(top_srcdir)/Xext/dpmsstubs.c \
+ $(top_srcdir)/Xi/stubs.c \
+ $(top_srcdir)/mi/miinitext.c
+
+Xwayland_LDADD = \
+ $(XWAYLAND_LIBS) \
+ $(XWAYLAND_SYS_LIBS) \
+ $(XSERVER_SYS_LIBS)
+Xwayland_DEPENDENCIES = $(XWAYLAND_LIBS)
+Xwayland_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
+
+
+relink:
+ $(AM_V_at)rm -f Xwayland$(EXEEXT) && $(MAKE) Xwayland$(EXEEXT)
diff --git a/xorg-server/hw/xwayland/xwayland-cursor.c b/xorg-server/hw/xwayland/xwayland-cursor.c
new file mode 100644
index 000000000..5a9d1fe70
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland-cursor.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2011 Kristian Høgsberg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "xwayland.h"
+
+#include <mipointer.h>
+
+static DevPrivateKeyRec xwl_cursor_private_key;
+
+static void
+expand_source_and_mask(CursorPtr cursor, CARD32 *data)
+{
+ CARD32 *p, d, fg, bg;
+ CursorBitsPtr bits = cursor->bits;
+ int x, y, stride, i, bit;
+
+ p = data;
+ fg = ((cursor->foreRed & 0xff00) << 8) |
+ (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8);
+ bg = ((cursor->backRed & 0xff00) << 8) |
+ (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8);
+ stride = (bits->width / 8 + 3) & ~3;
+ for (y = 0; y < bits->height; y++)
+ for (x = 0; x < bits->width; x++) {
+ i = y * stride + x / 8;
+ bit = 1 << (x & 7);
+ if (bits->source[i] & bit)
+ d = fg;
+ else
+ d = bg;
+ if (bits->mask[i] & bit)
+ d |= 0xff000000;
+ else
+ d = 0x00000000;
+
+ *p++ = d;
+ }
+}
+
+static Bool
+xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
+ PixmapPtr pixmap;
+
+ pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width,
+ cursor->bits->height, 32, 0);
+ dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, pixmap);
+
+ return TRUE;
+}
+
+static Bool
+xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
+{
+ PixmapPtr pixmap;
+
+ pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+
+ return xwl_shm_destroy_pixmap(pixmap);
+}
+
+void
+xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
+{
+ PixmapPtr pixmap;
+ CursorPtr cursor;
+ int stride;
+
+ if (!xwl_seat->wl_pointer)
+ return;
+
+ if (!xwl_seat->x_cursor) {
+ wl_pointer_set_cursor(xwl_seat->wl_pointer,
+ xwl_seat->pointer_enter_serial, NULL, 0, 0);
+ return;
+ }
+
+ cursor = xwl_seat->x_cursor;
+ pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key);
+ stride = cursor->bits->width * 4;
+ if (cursor->bits->argb)
+ memcpy(pixmap->devPrivate.ptr,
+ cursor->bits->argb, cursor->bits->height * stride);
+ else
+ expand_source_and_mask(cursor, pixmap->devPrivate.ptr);
+
+ wl_pointer_set_cursor(xwl_seat->wl_pointer,
+ xwl_seat->pointer_enter_serial,
+ xwl_seat->cursor,
+ xwl_seat->x_cursor->bits->xhot,
+ xwl_seat->x_cursor->bits->yhot);
+ wl_surface_attach(xwl_seat->cursor,
+ xwl_shm_pixmap_get_wl_buffer(pixmap), 0, 0);
+ wl_surface_damage(xwl_seat->cursor, 0, 0,
+ xwl_seat->x_cursor->bits->width,
+ xwl_seat->x_cursor->bits->height);
+ wl_surface_commit(xwl_seat->cursor);
+}
+
+static void
+xwl_set_cursor(DeviceIntPtr device,
+ ScreenPtr screen, CursorPtr cursor, int x, int y)
+{
+ struct xwl_seat *xwl_seat;
+
+ xwl_seat = device->public.devicePrivate;
+ if (xwl_seat == NULL)
+ return;
+
+ xwl_seat->x_cursor = cursor;
+ xwl_seat_set_cursor(xwl_seat);
+}
+
+static void
+xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y)
+{
+}
+
+static Bool
+xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen)
+{
+ return TRUE;
+}
+
+static void
+xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen)
+{
+}
+
+static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = {
+ xwl_realize_cursor,
+ xwl_unrealize_cursor,
+ xwl_set_cursor,
+ xwl_move_cursor,
+ xwl_device_cursor_initialize,
+ xwl_device_cursor_cleanup
+};
+
+static Bool
+xwl_cursor_off_screen(ScreenPtr *ppScreen, int *x, int *y)
+{
+ return FALSE;
+}
+
+static void
+xwl_cross_screen(ScreenPtr pScreen, Bool entering)
+{
+}
+
+static void
+xwl_pointer_warp_cursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
+{
+}
+
+static miPointerScreenFuncRec xwl_pointer_screen_funcs = {
+ xwl_cursor_off_screen,
+ xwl_cross_screen,
+ xwl_pointer_warp_cursor
+};
+
+Bool
+xwl_screen_init_cursor(struct xwl_screen *xwl_screen)
+{
+ if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR_BITS, 0))
+ return FALSE;
+
+ return miPointerInitialize(xwl_screen->screen,
+ &xwl_pointer_sprite_funcs,
+ &xwl_pointer_screen_funcs, TRUE);
+}
diff --git a/xorg-server/hw/xwayland/xwayland-cvt.c b/xorg-server/hw/xwayland/xwayland-cvt.c
new file mode 100644
index 000000000..35665597f
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland-cvt.c
@@ -0,0 +1,304 @@
+/* Copied from hw/xfree86/modes/xf86cvt.c into xwayland DDX and
+ * changed to generate an RRMode */
+
+/*
+ * Copyright 2005-2006 Luc Verhaegen.
+ *
+ * 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
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+/*
+ * The reason for having this function in a file of its own is
+ * so that ../utils/cvt/cvt can link to it, and that xf86CVTMode
+ * code is shared directly.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <string.h>
+#include <randrstr.h>
+#include "xwayland.h"
+
+/*
+ * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh.
+ *
+ * These calculations are stolen from the CVT calculation spreadsheet written
+ * by Graham Loveridge. He seems to be claiming no copyright and there seems to
+ * be no license attached to this. He apparently just wants to see his name
+ * mentioned.
+ *
+ * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls
+ *
+ * Comments and structure corresponds to the comments and structure of the xls.
+ * This should ease importing of future changes to the standard (not very
+ * likely though).
+ *
+ * About margins; i'm sure that they are to be the bit between HDisplay and
+ * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
+ * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking
+ * outside sync "margin" for some reason. Since we prefer seeing proper
+ * blanking instead of the overscan colour, and since the Crtc* values will
+ * probably get altered after us, we will disable margins altogether. With
+ * these calculations, Margins will plainly expand H/VDisplay, and we don't
+ * want that. -- libv
+ *
+ */
+RRModePtr
+xwayland_cvt(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
+ Bool Interlaced)
+{
+ /* 1) top/bottom margin size (% of height) - default: 1.8 */
+#define CVT_MARGIN_PERCENTAGE 1.8
+
+ /* 2) character cell horizontal granularity (pixels) - default 8 */
+#define CVT_H_GRANULARITY 8
+
+ /* 4) Minimum vertical porch (lines) - default 3 */
+#define CVT_MIN_V_PORCH 3
+
+ /* 4) Minimum number of vertical back porch lines - default 6 */
+#define CVT_MIN_V_BPORCH 6
+
+ /* Pixel Clock step (kHz) */
+#define CVT_CLOCK_STEP 250
+
+ Bool Margins = FALSE;
+ float VFieldRate, HPeriod;
+ int HDisplayRnd, HMargin;
+ int VDisplayRnd, VMargin, VSync;
+ float Interlace; /* Please rename this */
+ char name[128];
+ xRRModeInfo modeinfo;
+
+ memset(&modeinfo, 0, sizeof modeinfo);
+
+ /* CVT default is 60.0Hz */
+ if (!VRefresh)
+ VRefresh = 60.0;
+
+ /* 1. Required field rate */
+ if (Interlaced)
+ VFieldRate = VRefresh * 2;
+ else
+ VFieldRate = VRefresh;
+
+ /* 2. Horizontal pixels */
+ HDisplayRnd = HDisplay - (HDisplay % CVT_H_GRANULARITY);
+
+ /* 3. Determine left and right borders */
+ if (Margins) {
+ /* right margin is actually exactly the same as left */
+ HMargin = (((float) HDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ HMargin -= HMargin % CVT_H_GRANULARITY;
+ }
+ else
+ HMargin = 0;
+
+ /* 4. Find total active pixels */
+ modeinfo.width = HDisplayRnd + 2 * HMargin;
+
+ /* 5. Find number of lines per field */
+ if (Interlaced)
+ VDisplayRnd = VDisplay / 2;
+ else
+ VDisplayRnd = VDisplay;
+
+ /* 6. Find top and bottom margins */
+ /* nope. */
+ if (Margins)
+ /* top and bottom margins are equal again. */
+ VMargin = (((float) VDisplayRnd) * CVT_MARGIN_PERCENTAGE / 100.0);
+ else
+ VMargin = 0;
+
+ modeinfo.height = VDisplay + 2 * VMargin;
+
+ /* 7. Interlace */
+ if (Interlaced)
+ Interlace = 0.5;
+ else
+ Interlace = 0.0;
+
+ /* Determine VSync Width from aspect ratio */
+ if (!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay))
+ VSync = 4;
+ else if (!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay))
+ VSync = 5;
+ else if (!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay))
+ VSync = 6;
+ else if (!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay))
+ VSync = 7;
+ else if (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay))
+ VSync = 7;
+ else /* Custom */
+ VSync = 10;
+
+ if (!Reduced) { /* simplified GTF calculation */
+
+ /* 4) Minimum time of vertical sync + back porch interval (µs)
+ * default 550.0 */
+#define CVT_MIN_VSYNC_BP 550.0
+
+ /* 3) Nominal HSync width (% of line period) - default 8 */
+#define CVT_HSYNC_PERCENTAGE 8
+
+ float HBlankPercentage;
+ int VSyncAndBackPorch, VBackPorch;
+ int HBlank;
+
+ /* 8. Estimated Horizontal period */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_MIN_VSYNC_BP)) /
+ (VDisplayRnd + 2 * VMargin + CVT_MIN_V_PORCH + Interlace);
+
+ /* 9. Find number of lines in sync + backporch */
+ if (((int) (CVT_MIN_VSYNC_BP / HPeriod) + 1) <
+ (VSync + CVT_MIN_V_PORCH))
+ VSyncAndBackPorch = VSync + CVT_MIN_V_PORCH;
+ else
+ VSyncAndBackPorch = (int) (CVT_MIN_VSYNC_BP / HPeriod) + 1;
+
+ /* 10. Find number of lines in back porch */
+ VBackPorch = VSyncAndBackPorch - VSync;
+ (void) VBackPorch;
+
+ /* 11. Find total number of lines in vertical field */
+ modeinfo.vTotal =
+ VDisplayRnd + 2 * VMargin + VSyncAndBackPorch + Interlace +
+ CVT_MIN_V_PORCH;
+
+ /* 5) Definition of Horizontal blanking time limitation */
+ /* Gradient (%/kHz) - default 600 */
+#define CVT_M_FACTOR 600
+
+ /* Offset (%) - default 40 */
+#define CVT_C_FACTOR 40
+
+ /* Blanking time scaling factor - default 128 */
+#define CVT_K_FACTOR 128
+
+ /* Scaling factor weighting - default 20 */
+#define CVT_J_FACTOR 20
+
+#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256
+#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \
+ CVT_J_FACTOR
+
+ /* 12. Find ideal blanking duty cycle from formula */
+ HBlankPercentage = CVT_C_PRIME - CVT_M_PRIME * HPeriod / 1000.0;
+
+ /* 13. Blanking time */
+ if (HBlankPercentage < 20)
+ HBlankPercentage = 20;
+
+ HBlank = modeinfo.width * HBlankPercentage / (100.0 - HBlankPercentage);
+ HBlank -= HBlank % (2 * CVT_H_GRANULARITY);
+
+ /* 14. Find total number of pixels in a line. */
+ modeinfo.hTotal = modeinfo.width + HBlank;
+
+ /* Fill in HSync values */
+ modeinfo.hSyncEnd = modeinfo.width + HBlank / 2;
+
+ modeinfo.hSyncStart = modeinfo.hSyncEnd -
+ (modeinfo.hTotal * CVT_HSYNC_PERCENTAGE) / 100;
+ modeinfo.hSyncStart += CVT_H_GRANULARITY -
+ modeinfo.hSyncStart % CVT_H_GRANULARITY;
+
+ /* Fill in VSync values */
+ modeinfo.vSyncStart = modeinfo.height + CVT_MIN_V_PORCH;
+ modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync;
+
+ }
+ else { /* Reduced blanking */
+ /* Minimum vertical blanking interval time (µs) - default 460 */
+#define CVT_RB_MIN_VBLANK 460.0
+
+ /* Fixed number of clocks for horizontal sync */
+#define CVT_RB_H_SYNC 32.0
+
+ /* Fixed number of clocks for horizontal blanking */
+#define CVT_RB_H_BLANK 160.0
+
+ /* Fixed number of lines for vertical front porch - default 3 */
+#define CVT_RB_VFPORCH 3
+
+ int VBILines;
+
+ /* 8. Estimate Horizontal period. */
+ HPeriod = ((float) (1000000.0 / VFieldRate - CVT_RB_MIN_VBLANK)) /
+ (VDisplayRnd + 2 * VMargin);
+
+ /* 9. Find number of lines in vertical blanking */
+ VBILines = ((float) CVT_RB_MIN_VBLANK) / HPeriod + 1;
+
+ /* 10. Check if vertical blanking is sufficient */
+ if (VBILines < (CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH))
+ VBILines = CVT_RB_VFPORCH + VSync + CVT_MIN_V_BPORCH;
+
+ /* 11. Find total number of lines in vertical field */
+ modeinfo.vTotal = VDisplayRnd + 2 * VMargin + Interlace + VBILines;
+
+ /* 12. Find total number of pixels in a line */
+ modeinfo.hTotal = modeinfo.width + CVT_RB_H_BLANK;
+
+ /* Fill in HSync values */
+ modeinfo.hSyncEnd = modeinfo.width + CVT_RB_H_BLANK / 2;
+ modeinfo.hSyncStart = modeinfo.hSyncEnd - CVT_RB_H_SYNC;
+
+ /* Fill in VSync values */
+ modeinfo.vSyncStart = modeinfo.height + CVT_RB_VFPORCH;
+ modeinfo.vSyncEnd = modeinfo.vSyncStart + VSync;
+ }
+
+ /* 15/13. Find pixel clock frequency (kHz for xf86) */
+ modeinfo.dotClock = modeinfo.hTotal * 1000.0 / HPeriod;
+ modeinfo.dotClock -= modeinfo.dotClock % CVT_CLOCK_STEP;
+ modeinfo.dotClock *= 1000.0;
+#if 0
+ /* 16/14. Find actual Horizontal Frequency (kHz) */
+ modeinfo.hSync = ((float) modeinfo.dotClock) / ((float) modeinfo.hTotal);
+#endif
+
+#if 0
+ /* 17/15. Find actual Field rate */
+ modeinfo.vRefresh = (1000.0 * ((float) modeinfo.dotClock)) /
+ ((float) (modeinfo.hTotal * modeinfo.vTotal));
+#endif
+
+ /* 18/16. Find actual vertical frame frequency */
+ /* ignore - just set the mode flag for interlaced */
+ if (Interlaced)
+ modeinfo.vTotal *= 2;
+
+ if (Reduced)
+ modeinfo.modeFlags |= RR_HSyncPositive | RR_VSyncNegative;
+ else
+ modeinfo.modeFlags |= RR_HSyncNegative | RR_VSyncPositive;
+
+ if (Interlaced)
+ modeinfo.modeFlags |= RR_Interlace;
+
+ snprintf(name, sizeof name, "%dx%d@%.1fHz",
+ modeinfo.width, modeinfo.height, VRefresh);
+ modeinfo.nameLength = strlen(name);
+
+ return RRModeGet(&modeinfo, name);
+}
diff --git a/xorg-server/hw/xwayland/xwayland-input.c b/xorg-server/hw/xwayland/xwayland-input.c
new file mode 100644
index 000000000..990cb82d8
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland-input.c
@@ -0,0 +1,666 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2008 Kristian Høgsberg
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "xwayland.h"
+
+#include <linux/input.h>
+
+#include <sys/mman.h>
+#include <xkbsrv.h>
+#include <xserver-properties.h>
+#include <inpututils.h>
+
+static void
+xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl)
+{
+ /* Nothing to do, dix handles all settings */
+}
+
+static int
+xwl_pointer_proc(DeviceIntPtr device, int what)
+{
+#define NBUTTONS 10
+#define NAXES 2
+ BYTE map[NBUTTONS + 1];
+ int i = 0;
+ Atom btn_labels[NBUTTONS] = { 0 };
+ Atom axes_labels[NAXES] = { 0 };
+
+ switch (what) {
+ case DEVICE_INIT:
+ device->public.on = FALSE;
+
+ for (i = 1; i <= NBUTTONS; i++)
+ map[i] = i;
+
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /* don't know about the rest */
+
+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
+
+ if (!InitValuatorClassDeviceStruct(device, 2, btn_labels,
+ GetMotionHistorySize(), Absolute))
+ return BadValue;
+
+ /* Valuators */
+ InitValuatorAxisStruct(device, 0, axes_labels[0],
+ 0, 0xFFFF, 10000, 0, 10000, Absolute);
+ InitValuatorAxisStruct(device, 1, axes_labels[1],
+ 0, 0xFFFF, 10000, 0, 10000, Absolute);
+
+ if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control))
+ return BadValue;
+
+ if (!InitButtonClassDeviceStruct(device, 3, btn_labels, map))
+ return BadValue;
+
+ return Success;
+
+ case DEVICE_ON:
+ device->public.on = TRUE;
+ return Success;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ device->public.on = FALSE;
+ return Success;
+ }
+
+ return BadMatch;
+
+#undef NBUTTONS
+#undef NAXES
+}
+
+static void
+xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl)
+{
+}
+
+static int
+xwl_keyboard_proc(DeviceIntPtr device, int what)
+{
+ struct xwl_seat *xwl_seat = device->public.devicePrivate;
+ int len;
+
+ switch (what) {
+ case DEVICE_INIT:
+ device->public.on = FALSE;
+ if (xwl_seat->keymap)
+ len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size);
+ else
+ len = 0;
+ if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap,
+ len,
+ NULL, xwl_keyboard_control))
+ return BadValue;
+
+ return Success;
+ case DEVICE_ON:
+ device->public.on = TRUE;
+ return Success;
+
+ case DEVICE_OFF:
+ case DEVICE_CLOSE:
+ device->public.on = FALSE;
+ return Success;
+ }
+
+ return BadMatch;
+}
+
+static void
+pointer_handle_enter(void *data, struct wl_pointer *pointer,
+ uint32_t serial, struct wl_surface *surface,
+ wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+ struct xwl_seat *xwl_seat = data;
+ DeviceIntPtr dev = xwl_seat->pointer;
+ int i;
+ int sx = wl_fixed_to_int(sx_w);
+ int sy = wl_fixed_to_int(sy_w);
+ ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
+ ValuatorMask mask;
+
+ xwl_seat->xwl_screen->serial = serial;
+ xwl_seat->pointer_enter_serial = serial;
+
+ xwl_seat->focus_window = wl_surface_get_user_data(surface);
+
+ (*pScreen->SetCursorPosition) (dev, pScreen, sx, sy, TRUE);
+ CheckMotion(NULL, GetMaster(dev, MASTER_POINTER));
+
+ /* Ideally, X clients shouldn't see these button releases. When
+ * the pointer leaves a window with buttons down, it means that
+ * the wayland compositor has grabbed the pointer. The button
+ * release event is consumed by whatever grab in the compositor
+ * and won't be sent to clients (the X server is a client).
+ * However, we need to reset X's idea of which buttons are up and
+ * down, and they're all up (by definition) when the pointer
+ * enters a window. We should figure out a way to swallow these
+ * events, perhaps using an X grab whenever the pointer is not in
+ * any X window, but for now just send the events. */
+ valuator_mask_zero(&mask);
+ for (i = 0; i < dev->button->numButtons; i++)
+ if (BitIsOn(dev->button->down, i))
+ QueuePointerEvents(xwl_seat->pointer, ButtonRelease, i, 0, &mask);
+}
+
+static void
+pointer_handle_leave(void *data, struct wl_pointer *pointer,
+ uint32_t serial, struct wl_surface *surface)
+{
+ struct xwl_seat *xwl_seat = data;
+ DeviceIntPtr dev = xwl_seat->pointer;
+
+ xwl_seat->xwl_screen->serial = serial;
+
+ xwl_seat->focus_window = NULL;
+ CheckMotion(NULL, GetMaster(dev, MASTER_POINTER));
+}
+
+static void
+pointer_handle_motion(void *data, struct wl_pointer *pointer,
+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
+{
+ struct xwl_seat *xwl_seat = data;
+ int32_t dx, dy;
+ int sx = wl_fixed_to_int(sx_w);
+ int sy = wl_fixed_to_int(sy_w);
+ ValuatorMask mask;
+
+ if (!xwl_seat->focus_window)
+ return;
+
+ dx = xwl_seat->focus_window->window->drawable.x;
+ dy = xwl_seat->focus_window->window->drawable.y;
+
+ valuator_mask_zero(&mask);
+ valuator_mask_set(&mask, 0, dx + sx);
+ valuator_mask_set(&mask, 1, dy + sy);
+
+ QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0,
+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
+}
+
+static void
+pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
+ uint32_t time, uint32_t button, uint32_t state)
+{
+ struct xwl_seat *xwl_seat = data;
+ int index;
+ ValuatorMask mask;
+
+ xwl_seat->xwl_screen->serial = serial;
+
+ switch (button) {
+ case BTN_MIDDLE:
+ index = 2;
+ break;
+ case BTN_RIGHT:
+ index = 3;
+ break;
+ default:
+ index = button - BTN_LEFT + 1;
+ break;
+ }
+
+ valuator_mask_zero(&mask);
+ QueuePointerEvents(xwl_seat->pointer,
+ state ? ButtonPress : ButtonRelease, index, 0, &mask);
+}
+
+static void
+pointer_handle_axis(void *data, struct wl_pointer *pointer,
+ uint32_t time, uint32_t axis, wl_fixed_t value)
+{
+ struct xwl_seat *xwl_seat = data;
+ int index, count;
+ int i, val;
+ const int divisor = 10;
+ ValuatorMask mask;
+
+ if (time - xwl_seat->scroll_time > 2000) {
+ xwl_seat->vertical_scroll = 0;
+ xwl_seat->horizontal_scroll = 0;
+ }
+ xwl_seat->scroll_time = time;
+
+ /* FIXME: Need to do proper smooth scrolling here! */
+ switch (axis) {
+ case WL_POINTER_AXIS_VERTICAL_SCROLL:
+ xwl_seat->vertical_scroll += value / divisor;
+ val = wl_fixed_to_int(xwl_seat->vertical_scroll);
+ xwl_seat->vertical_scroll -= wl_fixed_from_int(val);
+
+ if (val <= -1)
+ index = 4;
+ else if (val >= 1)
+ index = 5;
+ else
+ return;
+ break;
+ case WL_POINTER_AXIS_HORIZONTAL_SCROLL:
+ xwl_seat->horizontal_scroll += value / divisor;
+ val = wl_fixed_to_int(xwl_seat->horizontal_scroll);
+ xwl_seat->horizontal_scroll -= wl_fixed_from_int(val);
+
+ if (val <= -1)
+ index = 6;
+ else if (val >= 1)
+ index = 7;
+ else
+ return;
+ break;
+ default:
+ return;
+ }
+
+ valuator_mask_zero(&mask);
+
+ count = abs(val);
+ for (i = 0; i < count; i++) {
+ QueuePointerEvents(xwl_seat->pointer, ButtonPress, index, 0, &mask);
+ QueuePointerEvents(xwl_seat->pointer, ButtonRelease, index, 0, &mask);
+ }
+}
+
+static const struct wl_pointer_listener pointer_listener = {
+ pointer_handle_enter,
+ pointer_handle_leave,
+ pointer_handle_motion,
+ pointer_handle_button,
+ pointer_handle_axis,
+};
+
+static void
+keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial,
+ uint32_t time, uint32_t key, uint32_t state)
+{
+ struct xwl_seat *xwl_seat = data;
+ uint32_t *k, *end;
+ ValuatorMask mask;
+
+ xwl_seat->xwl_screen->serial = serial;
+
+ end = (uint32_t *) ((char *) xwl_seat->keys.data + xwl_seat->keys.size);
+ for (k = xwl_seat->keys.data; k < end; k++) {
+ if (*k == key)
+ *k = *--end;
+ }
+ xwl_seat->keys.size = (char *) end - (char *) xwl_seat->keys.data;
+ if (state) {
+ k = wl_array_add(&xwl_seat->keys, sizeof *k);
+ *k = key;
+ }
+
+ valuator_mask_zero(&mask);
+ QueueKeyboardEvents(xwl_seat->keyboard,
+ state ? KeyPress : KeyRelease, key + 8, &mask);
+}
+
+static void
+keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard,
+ uint32_t format, int fd, uint32_t size)
+{
+ struct xwl_seat *xwl_seat = data;
+ DeviceIntPtr master;
+ XkbDescPtr xkb;
+ XkbChangesRec changes = { 0 };
+
+ if (xwl_seat->keymap)
+ munmap(xwl_seat->keymap, xwl_seat->keymap_size);
+
+ xwl_seat->keymap_size = size;
+ xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
+ if (xwl_seat->keymap == MAP_FAILED) {
+ xwl_seat->keymap_size = 0;
+ xwl_seat->keymap = NULL;
+ goto out;
+ }
+
+ xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap,
+ strnlen(xwl_seat->keymap,
+ xwl_seat->keymap_size));
+ if (!xkb)
+ goto out;
+
+ XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes);
+
+ if (xwl_seat->keyboard->key)
+ /* Keep the current controls */
+ XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc);
+
+ XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb);
+
+ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD);
+ if (master && master->lastSlave == xwl_seat->keyboard)
+ XkbDeviceApplyKeymap(master, xkb);
+
+ XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE);
+
+ out:
+ close(fd);
+}
+
+static void
+keyboard_handle_enter(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial,
+ struct wl_surface *surface, struct wl_array *keys)
+{
+ struct xwl_seat *xwl_seat = data;
+ ValuatorMask mask;
+ uint32_t *k;
+
+ xwl_seat->xwl_screen->serial = serial;
+ xwl_seat->keyboard_focus = surface;
+
+ wl_array_copy(&xwl_seat->keys, keys);
+ valuator_mask_zero(&mask);
+ wl_array_for_each(k, &xwl_seat->keys)
+ QueueKeyboardEvents(xwl_seat->keyboard, KeyPress, *k + 8, &mask);
+}
+
+static void
+keyboard_handle_leave(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, struct wl_surface *surface)
+{
+ struct xwl_seat *xwl_seat = data;
+ ValuatorMask mask;
+ uint32_t *k;
+
+ xwl_seat->xwl_screen->serial = serial;
+
+ valuator_mask_zero(&mask);
+ wl_array_for_each(k, &xwl_seat->keys)
+ QueueKeyboardEvents(xwl_seat->keyboard, KeyRelease, *k + 8, &mask);
+
+ xwl_seat->keyboard_focus = NULL;
+}
+
+static void
+keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard,
+ uint32_t serial, uint32_t mods_depressed,
+ uint32_t mods_latched, uint32_t mods_locked,
+ uint32_t group)
+{
+ struct xwl_seat *xwl_seat = data;
+ DeviceIntPtr dev;
+ XkbStateRec old_state, *new_state;
+ xkbStateNotify sn;
+ CARD16 changed;
+
+ /* We don't need any of this while we have keyboard focus since
+ the regular key event processing already takes care of setting
+ our internal state correctly. */
+ if (xwl_seat->keyboard_focus)
+ return;
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (dev != xwl_seat->keyboard &&
+ dev != GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD))
+ continue;
+
+ old_state = dev->key->xkbInfo->state;
+ new_state = &dev->key->xkbInfo->state;
+
+ new_state->locked_group = group & XkbAllGroupsMask;
+ new_state->locked_mods = mods_locked & XkbAllModifiersMask;
+ XkbLatchModifiers(dev, XkbAllModifiersMask,
+ mods_latched & XkbAllModifiersMask);
+
+ XkbComputeDerivedState(dev->key->xkbInfo);
+
+ changed = XkbStateChangedFlags(&old_state, new_state);
+ if (!changed)
+ continue;
+
+ sn.keycode = 0;
+ sn.eventType = 0;
+ sn.requestMajor = XkbReqCode;
+ sn.requestMinor = X_kbLatchLockState; /* close enough */
+ sn.changed = changed;
+ XkbSendStateNotify(dev, &sn);
+ }
+}
+
+static const struct wl_keyboard_listener keyboard_listener = {
+ keyboard_handle_keymap,
+ keyboard_handle_enter,
+ keyboard_handle_leave,
+ keyboard_handle_key,
+ keyboard_handle_modifiers,
+};
+
+static DeviceIntPtr
+add_device(struct xwl_seat *xwl_seat,
+ const char *driver, DeviceProc device_proc)
+{
+ DeviceIntPtr dev = NULL;
+ static Atom type_atom;
+ char name[32];
+
+ dev = AddInputDevice(serverClient, device_proc, TRUE);
+ if (dev == NULL)
+ return NULL;
+
+ if (type_atom == None)
+ type_atom = MakeAtom(driver, strlen(driver), TRUE);
+ snprintf(name, sizeof name, "%s:%d", driver, xwl_seat->id);
+ AssignTypeAndName(dev, type_atom, name);
+ dev->public.devicePrivate = xwl_seat;
+ dev->type = SLAVE;
+ dev->spriteInfo->spriteOwner = FALSE;
+
+ return dev;
+}
+
+static void
+seat_handle_capabilities(void *data, struct wl_seat *seat,
+ enum wl_seat_capability caps)
+{
+ struct xwl_seat *xwl_seat = data;
+
+ if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->pointer == NULL) {
+ xwl_seat->wl_pointer = wl_seat_get_pointer(seat);
+ wl_pointer_add_listener(xwl_seat->wl_pointer,
+ &pointer_listener, xwl_seat);
+ xwl_seat_set_cursor(xwl_seat);
+ xwl_seat->pointer =
+ add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc);
+ }
+ else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->pointer) {
+ wl_pointer_release(xwl_seat->wl_pointer);
+ RemoveDevice(xwl_seat->pointer, FALSE);
+ xwl_seat->pointer = NULL;
+ }
+
+ if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->keyboard == NULL) {
+ xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat);
+ wl_keyboard_add_listener(xwl_seat->wl_keyboard,
+ &keyboard_listener, xwl_seat);
+ xwl_seat->keyboard =
+ add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc);
+ }
+ else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->keyboard) {
+ wl_keyboard_release(xwl_seat->wl_keyboard);
+ RemoveDevice(xwl_seat->keyboard, FALSE);
+ xwl_seat->keyboard = NULL;
+ }
+
+ xwl_seat->xwl_screen->expecting_event--;
+ /* FIXME: Touch ... */
+}
+
+static void
+seat_handle_name(void *data, struct wl_seat *seat,
+ const char *name)
+{
+
+}
+
+static const struct wl_seat_listener seat_listener = {
+ seat_handle_capabilities,
+ seat_handle_name
+};
+
+static void
+create_input_device(struct xwl_screen *xwl_screen, uint32_t id)
+{
+ struct xwl_seat *xwl_seat;
+
+ xwl_seat = calloc(sizeof *xwl_seat, 1);
+ if (xwl_seat == NULL) {
+ ErrorF("create_input ENOMEM");
+ return;
+ }
+
+ xwl_seat->xwl_screen = xwl_screen;
+ xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list);
+
+ xwl_seat->seat =
+ wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, 3);
+ xwl_seat->id = id;
+
+ xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor);
+ wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat);
+ wl_array_init(&xwl_seat->keys);
+}
+
+void
+xwl_seat_destroy(struct xwl_seat *xwl_seat)
+{
+ RemoveDevice(xwl_seat->pointer, FALSE);
+ RemoveDevice(xwl_seat->keyboard, FALSE);
+ wl_seat_destroy(xwl_seat->seat);
+ wl_surface_destroy(xwl_seat->cursor);
+ wl_array_release(&xwl_seat->keys);
+ free(xwl_seat);
+}
+
+static void
+input_handler(void *data, struct wl_registry *registry, uint32_t id,
+ const char *interface, uint32_t version)
+{
+ struct xwl_screen *xwl_screen = data;
+
+ if (strcmp(interface, "wl_seat") == 0 && version >= 3) {
+ create_input_device(xwl_screen, id);
+ xwl_screen->expecting_event++;
+ }
+}
+
+static void
+global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+}
+
+static const struct wl_registry_listener input_listener = {
+ input_handler,
+ global_remove,
+};
+
+Bool
+LegalModifier(unsigned int key, DeviceIntPtr pDev)
+{
+ return TRUE;
+}
+
+void
+ProcessInputEvents(void)
+{
+ mieqProcessInputEvents();
+}
+
+void
+DDXRingBell(int volume, int pitch, int duration)
+{
+}
+
+static WindowPtr
+xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
+{
+ struct xwl_seat *xwl_seat = NULL;
+ DeviceIntPtr device;
+
+ for (device = inputInfo.devices; device; device = device->next) {
+ if (device->deviceProc == xwl_pointer_proc &&
+ device->spriteInfo->sprite == sprite) {
+ xwl_seat = device->public.devicePrivate;
+ break;
+ }
+ }
+
+ if (xwl_seat == NULL) {
+ /* XTEST device */
+ sprite->spriteTraceGood = 1;
+ return sprite->spriteTrace[0];
+ }
+
+ if (xwl_seat->focus_window) {
+ sprite->spriteTraceGood = 2;
+ sprite->spriteTrace[1] = xwl_seat->focus_window->window;
+ return miSpriteTrace(sprite, x, y);
+ }
+ else {
+ sprite->spriteTraceGood = 1;
+ return sprite->spriteTrace[0];
+ }
+}
+
+void
+InitInput(int argc, char *argv[])
+{
+ ScreenPtr pScreen = screenInfo.screens[0];
+ struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
+
+ mieqInit();
+
+ xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display);
+ wl_registry_add_listener(xwl_screen->input_registry, &input_listener,
+ xwl_screen);
+
+ xwl_screen->XYToWindow = pScreen->XYToWindow;
+ pScreen->XYToWindow = xwl_xy_to_window;
+
+ xwl_screen->expecting_event = 0;
+ wl_display_roundtrip(xwl_screen->display);
+ while (xwl_screen->expecting_event)
+ wl_display_roundtrip(xwl_screen->display);
+}
+
+void
+CloseInput(void)
+{
+ mieqFini();
+}
diff --git a/xorg-server/hw/xwayland/xwayland-output.c b/xorg-server/hw/xwayland/xwayland-output.c
new file mode 100644
index 000000000..778914c61
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland-output.c
@@ -0,0 +1,226 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "xwayland.h"
+#include <randrstr.h>
+
+static Rotation
+wl_transform_to_xrandr(enum wl_output_transform transform)
+{
+ switch (transform) {
+ default:
+ case WL_OUTPUT_TRANSFORM_NORMAL:
+ return RR_Rotate_0;
+ case WL_OUTPUT_TRANSFORM_90:
+ return RR_Rotate_90;
+ case WL_OUTPUT_TRANSFORM_180:
+ return RR_Rotate_180;
+ case WL_OUTPUT_TRANSFORM_270:
+ return RR_Rotate_270;
+ case WL_OUTPUT_TRANSFORM_FLIPPED:
+ return RR_Reflect_X | RR_Rotate_0;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+ return RR_Reflect_X | RR_Rotate_90;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+ return RR_Reflect_X | RR_Rotate_180;
+ case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+ return RR_Reflect_X | RR_Rotate_270;
+ }
+}
+
+static int
+wl_subpixel_to_xrandr(int subpixel)
+{
+ switch (subpixel) {
+ default:
+ case WL_OUTPUT_SUBPIXEL_UNKNOWN:
+ return SubPixelUnknown;
+ case WL_OUTPUT_SUBPIXEL_NONE:
+ return SubPixelNone;
+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB:
+ return SubPixelHorizontalRGB;
+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR:
+ return SubPixelHorizontalBGR;
+ case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB:
+ return SubPixelVerticalRGB;
+ case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR:
+ return SubPixelVerticalBGR;
+ }
+}
+
+static void
+output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
+ int physical_width, int physical_height, int subpixel,
+ const char *make, const char *model, int transform)
+{
+ struct xwl_output *xwl_output = data;
+
+ RROutputSetPhysicalSize(xwl_output->randr_output,
+ physical_width, physical_height);
+ RROutputSetSubpixelOrder(xwl_output->randr_output,
+ wl_subpixel_to_xrandr(subpixel));
+ xwl_output->x = x;
+ xwl_output->y = y;
+
+ xwl_output->rotation = wl_transform_to_xrandr(transform);
+}
+
+static void
+output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
+ int width, int height, int refresh)
+{
+ struct xwl_output *xwl_output = data;
+ RRModePtr randr_mode;
+
+ if (!(flags & WL_OUTPUT_MODE_CURRENT))
+ return;
+
+ xwl_output->width = width;
+ xwl_output->height = height;
+
+ randr_mode = xwayland_cvt(width, height, refresh / 1000.0, 0, 0);
+
+ RROutputSetModes(xwl_output->randr_output, &randr_mode, 1, 1);
+
+ RRCrtcNotify(xwl_output->randr_crtc, randr_mode,
+ xwl_output->x, xwl_output->y,
+ xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
+}
+
+static void
+output_handle_done(void *data, struct wl_output *wl_output)
+{
+ struct xwl_output *xwl_output = data;
+ struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+ int width, height;
+
+ xorg_list_append(&xwl_output->link, &xwl_screen->output_list);
+
+ width = 0;
+ height = 0;
+ xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+ if (width < xwl_output->x + xwl_output->width)
+ width = xwl_output->x + xwl_output->width;
+ if (height < xwl_output->y + xwl_output->height)
+ height = xwl_output->y + xwl_output->height;
+ }
+
+ xwl_screen->width = width;
+ xwl_screen->height = height;
+ RRScreenSizeNotify(xwl_screen->screen);
+
+ xwl_screen->expecting_event--;
+}
+
+static void
+output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor)
+{
+}
+
+static const struct wl_output_listener output_listener = {
+ output_handle_geometry,
+ output_handle_mode,
+ output_handle_done,
+ output_handle_scale
+};
+
+struct xwl_output *
+xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
+{
+ struct xwl_output *xwl_output;
+ static int serial;
+ char name[256];
+
+ xwl_output = calloc(sizeof *xwl_output, 1);
+ if (xwl_output == NULL) {
+ ErrorF("create_output ENOMEM");
+ return NULL;
+ }
+
+ xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
+ &wl_output_interface, 2);
+ wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
+
+ if (snprintf(name, sizeof name, "XWAYLAND%d", serial++) < 0) {
+ ErrorF("create_output ENOMEM");
+ free(xwl_output);
+ return NULL;
+ }
+
+ xwl_output->xwl_screen = xwl_screen;
+ xwl_output->randr_crtc = RRCrtcCreate(xwl_screen->screen, xwl_output);
+ xwl_output->randr_output = RROutputCreate(xwl_screen->screen, name,
+ strlen(name), xwl_output);
+ RRCrtcGammaSetSize(xwl_output->randr_crtc, 256);
+ RROutputSetCrtcs(xwl_output->randr_output, &xwl_output->randr_crtc, 1);
+ RROutputSetConnection(xwl_output->randr_output, RR_Connected);
+
+ return xwl_output;
+}
+
+void
+xwl_output_destroy(struct xwl_output *xwl_output)
+{
+ wl_output_destroy(xwl_output->output);
+ RRCrtcDestroy(xwl_output->randr_crtc);
+ RROutputDestroy(xwl_output->randr_output);
+ free(xwl_output);
+}
+
+static Bool
+xwl_randr_get_info(ScreenPtr pScreen, Rotation * rotations)
+{
+ *rotations = 0;
+
+ return TRUE;
+}
+
+static Bool
+xwl_randr_set_config(ScreenPtr pScreen,
+ Rotation rotation, int rate, RRScreenSizePtr pSize)
+{
+ return FALSE;
+}
+
+Bool
+xwl_screen_init_output(struct xwl_screen *xwl_screen)
+{
+ rrScrPrivPtr rp;
+
+ if (!RRScreenInit(xwl_screen->screen))
+ return FALSE;
+
+ RRScreenSetSizeRange(xwl_screen->screen, 320, 200, 8192, 8192);
+
+ rp = rrGetScrPriv(xwl_screen->screen);
+ rp->rrGetInfo = xwl_randr_get_info;
+ rp->rrSetConfig = xwl_randr_set_config;
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xwayland/xwayland-shm.c b/xorg-server/hw/xwayland/xwayland-shm.c
new file mode 100644
index 000000000..2d0ce3eb6
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland-shm.c
@@ -0,0 +1,292 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "xwayland.h"
+
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+struct xwl_pixmap {
+ struct wl_buffer *buffer;
+ int fd;
+ void *data;
+ size_t size;
+};
+
+#ifndef HAVE_MKOSTEMP
+static int
+set_cloexec_or_close(int fd)
+{
+ long flags;
+
+ if (fd == -1)
+ return -1;
+
+ flags = fcntl(fd, F_GETFD);
+ if (flags == -1)
+ goto err;
+
+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
+ goto err;
+
+ return fd;
+
+ err:
+ close(fd);
+ return -1;
+}
+#endif
+
+static int
+create_tmpfile_cloexec(char *tmpname)
+{
+ int fd;
+
+#ifdef HAVE_MKOSTEMP
+ fd = mkostemp(tmpname, O_CLOEXEC);
+ if (fd >= 0)
+ unlink(tmpname);
+#else
+ fd = mkstemp(tmpname);
+ if (fd >= 0) {
+ fd = set_cloexec_or_close(fd);
+ unlink(tmpname);
+ }
+#endif
+
+ return fd;
+}
+
+/*
+ * Create a new, unique, anonymous file of the given size, and
+ * return the file descriptor for it. The file descriptor is set
+ * CLOEXEC. The file is immediately suitable for mmap()'ing
+ * the given size at offset zero.
+ *
+ * The file should not have a permanent backing store like a disk,
+ * but may have if XDG_RUNTIME_DIR is not properly implemented in OS.
+ *
+ * The file name is deleted from the file system.
+ *
+ * The file is suitable for buffer sharing between processes by
+ * transmitting the file descriptor over Unix sockets using the
+ * SCM_RIGHTS methods.
+ *
+ * If the C library implements posix_fallocate(), it is used to
+ * guarantee that disk space is available for the file at the
+ * given size. If disk space is insufficent, errno is set to ENOSPC.
+ * If posix_fallocate() is not supported, program may receive
+ * SIGBUS on accessing mmap()'ed file contents instead.
+ */
+static int
+os_create_anonymous_file(off_t size)
+{
+ static const char template[] = "/weston-shared-XXXXXX";
+ const char *path;
+ char *name;
+ int fd;
+ int ret;
+
+ path = getenv("XDG_RUNTIME_DIR");
+ if (!path) {
+ errno = ENOENT;
+ return -1;
+ }
+
+ name = malloc(strlen(path) + sizeof(template));
+ if (!name)
+ return -1;
+
+ strcpy(name, path);
+ strcat(name, template);
+
+ fd = create_tmpfile_cloexec(name);
+
+ free(name);
+
+ if (fd < 0)
+ return -1;
+
+#ifdef HAVE_POSIX_FALLOCATE
+ ret = posix_fallocate(fd, 0, size);
+ if (ret != 0) {
+ close(fd);
+ errno = ret;
+ return -1;
+ }
+#else
+ ret = ftruncate(fd, size);
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
+#endif
+
+ return fd;
+}
+
+static uint32_t
+shm_format_for_depth(int depth)
+{
+ switch (depth) {
+ case 32:
+ return WL_SHM_FORMAT_ARGB8888;
+ case 24:
+ default:
+ return WL_SHM_FORMAT_XRGB8888;
+#ifdef WL_SHM_FORMAT_RGB565
+ case 16:
+ /* XXX: Check run-time protocol version too */
+ return WL_SHM_FORMAT_RGB565;
+#endif
+ }
+}
+
+PixmapPtr
+xwl_shm_create_pixmap(ScreenPtr screen,
+ int width, int height, int depth, unsigned int hint)
+{
+ PixmapPtr pixmap;
+ struct xwl_pixmap *xwl_pixmap;
+ size_t size, stride;
+
+ if (hint == CREATE_PIXMAP_USAGE_GLYPH_PICTURE ||
+ (width == 0 && height == 0) || depth < 15)
+ return fbCreatePixmap(screen, width, height, depth, hint);
+
+ pixmap = fbCreatePixmap(screen, 0, 0, depth, hint);
+ if (!pixmap)
+ return NULL;
+
+ xwl_pixmap = malloc(sizeof *xwl_pixmap);
+ if (xwl_pixmap == NULL)
+ goto err_destroy_pixmap;
+
+ stride = PixmapBytePad(width, depth);
+ size = stride * height;
+ xwl_pixmap->buffer = NULL;
+ xwl_pixmap->size = size;
+ xwl_pixmap->fd = os_create_anonymous_file(size);
+ if (xwl_pixmap->fd < 0)
+ goto err_free_xwl_pixmap;
+
+ xwl_pixmap->data = mmap(NULL, size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, xwl_pixmap->fd, 0);
+ if (xwl_pixmap->data == MAP_FAILED)
+ goto err_close_fd;
+
+ if (!(*screen->ModifyPixmapHeader) (pixmap, width, height, depth,
+ BitsPerPixel(depth),
+ stride, xwl_pixmap->data))
+ goto err_munmap;
+
+ xwl_pixmap_set_private(pixmap, xwl_pixmap);
+
+ return pixmap;
+
+ err_munmap:
+ munmap(xwl_pixmap->data, size);
+ err_close_fd:
+ close(xwl_pixmap->fd);
+ err_free_xwl_pixmap:
+ free(xwl_pixmap);
+ err_destroy_pixmap:
+ fbDestroyPixmap(pixmap);
+
+ return NULL;
+}
+
+Bool
+xwl_shm_destroy_pixmap(PixmapPtr pixmap)
+{
+ struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+
+ if (xwl_pixmap && pixmap->refcnt == 1) {
+ if (xwl_pixmap->buffer)
+ wl_buffer_destroy(xwl_pixmap->buffer);
+ munmap(xwl_pixmap->data, xwl_pixmap->size);
+ close(xwl_pixmap->fd);
+ free(xwl_pixmap);
+ }
+
+ return fbDestroyPixmap(pixmap);
+}
+
+struct wl_buffer *
+xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen);
+ struct xwl_pixmap *xwl_pixmap = xwl_pixmap_get(pixmap);
+ struct wl_shm_pool *pool;
+ uint32_t format;
+
+ if (xwl_pixmap->buffer)
+ return xwl_pixmap->buffer;
+
+ pool = wl_shm_create_pool(xwl_screen->shm,
+ xwl_pixmap->fd, xwl_pixmap->size);
+
+ format = shm_format_for_depth(pixmap->drawable.depth);
+ xwl_pixmap->buffer = wl_shm_pool_create_buffer(pool, 0,
+ pixmap->drawable.width,
+ pixmap->drawable.height,
+ pixmap->devKind, format);
+
+ wl_shm_pool_destroy(pool);
+
+ return xwl_pixmap->buffer;
+}
+
+Bool
+xwl_shm_create_screen_resources(ScreenPtr screen)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ int ret;
+
+ screen->CreateScreenResources = xwl_screen->CreateScreenResources;
+ ret = (*screen->CreateScreenResources) (screen);
+ xwl_screen->CreateScreenResources = screen->CreateScreenResources;
+ screen->CreateScreenResources = xwl_shm_create_screen_resources;
+
+ if (!ret)
+ return ret;
+
+ if (xwl_screen->rootless)
+ screen->devPrivate =
+ fbCreatePixmap(screen, 0, 0, screen->rootDepth, 0);
+ else
+ screen->devPrivate =
+ xwl_shm_create_pixmap(screen, screen->width, screen->height,
+ screen->rootDepth,
+ CREATE_PIXMAP_USAGE_BACKING_PIXMAP);
+
+ return screen->devPrivate != NULL;
+}
diff --git a/xorg-server/hw/xwayland/xwayland.c b/xorg-server/hw/xwayland/xwayland.c
new file mode 100644
index 000000000..c2c6481af
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland.c
@@ -0,0 +1,652 @@
+/*
+ * Copyright © 2011-2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include "xwayland.h"
+
+#include <stdio.h>
+
+#include <selection.h>
+#include <micmap.h>
+#include <misyncshm.h>
+#include <compositeext.h>
+#include <glx_extinit.h>
+
+void
+ddxGiveUp(enum ExitCode error)
+{
+}
+
+void
+AbortDDX(enum ExitCode error)
+{
+ ddxGiveUp(error);
+}
+
+void
+OsVendorInit(void)
+{
+}
+
+void
+OsVendorFatalError(const char *f, va_list args)
+{
+}
+
+#if defined(DDXBEFORERESET)
+void
+ddxBeforeReset(void)
+{
+ return;
+}
+#endif
+
+void
+ddxUseMsg(void)
+{
+ ErrorF("-rootless run rootless, requires wm support\n");
+ ErrorF("-wm fd create X client for wm on given fd\n");
+ ErrorF("-listen fd add give fd as a listen socket\n");
+}
+
+int
+ddxProcessArgument(int argc, char *argv[], int i)
+{
+ if (strcmp(argv[i], "-rootless") == 0) {
+ return 1;
+ }
+ else if (strcmp(argv[i], "-listen") == 0) {
+ NoListenAll = TRUE;
+ return 2;
+ }
+ else if (strcmp(argv[i], "-wm") == 0) {
+ return 2;
+ }
+ else if (strcmp(argv[i], "-shm") == 0) {
+ return 1;
+ }
+
+ return 0;
+}
+
+static DevPrivateKeyRec xwl_window_private_key;
+static DevPrivateKeyRec xwl_screen_private_key;
+static DevPrivateKeyRec xwl_pixmap_private_key;
+
+struct xwl_screen *
+xwl_screen_get(ScreenPtr screen)
+{
+ return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
+}
+
+static Bool
+xwl_close_screen(ScreenPtr screen)
+{
+ struct xwl_screen *xwl_screen = xwl_screen_get(screen);
+ struct xwl_output *xwl_output, *next_xwl_output;
+ struct xwl_seat *xwl_seat, *next_xwl_seat;
+
+ xorg_list_for_each_entry_safe(xwl_output, next_xwl_output,
+ &xwl_screen->output_list, link)
+ xwl_output_destroy(xwl_output);
+
+ xorg_list_for_each_entry_safe(xwl_seat, next_xwl_seat,
+ &xwl_screen->seat_list, link)
+ xwl_seat_destroy(xwl_seat);
+
+ wl_display_disconnect(xwl_screen->display);
+
+ screen->CloseScreen = xwl_screen->CloseScreen;
+ free(xwl_screen);
+
+ return screen->CloseScreen(screen);
+}
+
+static void
+damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
+{
+ struct xwl_window *xwl_window = data;
+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen;
+
+ xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
+}
+
+static void
+damage_destroy(DamagePtr pDamage, void *data)
+{
+}
+
+static void
+shell_surface_ping(void *data,
+ struct wl_shell_surface *shell_surface, uint32_t serial)
+{
+ wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void
+shell_surface_configure(void *data,
+ struct wl_shell_surface *wl_shell_surface,
+ uint32_t edges, int32_t width, int32_t height)
+{
+}
+
+static void
+shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface)
+{
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener = {
+ shell_surface_ping,
+ shell_surface_configure,
+ shell_surface_popup_done
+};
+
+void
+xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap)
+{
+ dixSetPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key, xwl_pixmap);
+}
+
+struct xwl_pixmap *
+xwl_pixmap_get(PixmapPtr pixmap)
+{
+ return dixLookupPrivate(&pixmap->devPrivates, &xwl_pixmap_private_key);
+}
+
+static void
+send_surface_id_event(struct xwl_window *xwl_window)
+{
+ static const char atom_name[] = "WL_SURFACE_ID";
+ static Atom type_atom;
+ DeviceIntPtr dev;
+ xEvent e;
+
+ if (type_atom == None)
+ type_atom = MakeAtom(atom_name, strlen(atom_name), TRUE);
+
+ e.u.u.type = ClientMessage;
+ e.u.u.detail = 32;
+ e.u.clientMessage.window = xwl_window->window->drawable.id;
+ e.u.clientMessage.u.l.type = type_atom;
+ e.u.clientMessage.u.l.longs0 =
+ wl_proxy_get_id((struct wl_proxy *) xwl_window->surface);
+ e.u.clientMessage.u.l.longs1 = 0;
+ e.u.clientMessage.u.l.longs2 = 0;
+ e.u.clientMessage.u.l.longs3 = 0;
+ e.u.clientMessage.u.l.longs4 = 0;
+
+ dev = PickPointer(serverClient);
+ DeliverEventsToWindow(dev, xwl_window->xwl_screen->screen->root,
+ &e, 1, SubstructureRedirectMask, NullGrab);
+}
+
+static Bool
+xwl_realize_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+ struct wl_region *region;
+ Bool ret;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ screen->RealizeWindow = xwl_screen->RealizeWindow;
+ ret = (*screen->RealizeWindow) (window);
+ xwl_screen->RealizeWindow = screen->RealizeWindow;
+ screen->RealizeWindow = xwl_realize_window;
+
+ if (xwl_screen->rootless && !window->parent) {
+ ErrorF("Clearing root clip\n");
+ RegionNull(&window->clipList);
+ RegionNull(&window->borderClip);
+ RegionNull(&window->winSize);
+ }
+
+ if (xwl_screen->rootless) {
+ if (window->redirectDraw != RedirectDrawManual)
+ return ret;
+ }
+ else {
+ if (window->parent)
+ return ret;
+ }
+
+ xwl_window = calloc(sizeof *xwl_window, 1);
+ xwl_window->xwl_screen = xwl_screen;
+ xwl_window->window = window;
+ xwl_window->surface = wl_compositor_create_surface(xwl_screen->compositor);
+ if (xwl_window->surface == NULL) {
+ ErrorF("wl_display_create_surface failed\n");
+ return FALSE;
+ }
+
+ if (!xwl_screen->rootless) {
+ xwl_window->shell_surface =
+ wl_shell_get_shell_surface(xwl_screen->shell, xwl_window->surface);
+ wl_shell_surface_add_listener(xwl_window->shell_surface,
+ &shell_surface_listener, xwl_window);
+
+ wl_shell_surface_set_toplevel(xwl_window->shell_surface);
+
+ region = wl_compositor_create_region(xwl_screen->compositor);
+ wl_region_add(region, 0, 0,
+ window->drawable.width, window->drawable.height);
+ wl_surface_set_opaque_region(xwl_window->surface, region);
+ wl_region_destroy(region);
+ }
+
+ wl_display_flush(xwl_screen->display);
+
+ send_surface_id_event(xwl_window);
+
+ wl_surface_set_user_data(xwl_window->surface, xwl_window);
+
+ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, xwl_window);
+
+ xwl_window->damage =
+ DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty,
+ FALSE, screen, xwl_window);
+ DamageRegister(&window->drawable, xwl_window->damage);
+ DamageSetReportAfterOp(xwl_window->damage, TRUE);
+
+ xorg_list_init(&xwl_window->link_damage);
+
+ return ret;
+}
+
+static Bool
+xwl_unrealize_window(WindowPtr window)
+{
+ ScreenPtr screen = window->drawable.pScreen;
+ struct xwl_screen *xwl_screen;
+ struct xwl_window *xwl_window;
+ struct xwl_seat *xwl_seat;
+ Bool ret;
+
+ xwl_screen = xwl_screen_get(screen);
+
+ xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
+ if (!xwl_seat->focus_window)
+ continue;
+ if (xwl_seat->focus_window->window == window)
+ xwl_seat->focus_window = NULL;
+ }
+
+ screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
+ ret = (*screen->UnrealizeWindow) (window);
+ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
+ screen->UnrealizeWindow = xwl_unrealize_window;
+
+ xwl_window =
+ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key);
+ if (!xwl_window)
+ return ret;
+
+ wl_surface_destroy(xwl_window->surface);
+ if (RegionNotEmpty(DamageRegion(xwl_window->damage)))
+ xorg_list_del(&xwl_window->link_damage);
+ DamageUnregister(xwl_window->damage);
+ DamageDestroy(xwl_window->damage);
+ free(xwl_window);
+ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL);
+
+ return ret;
+}
+
+static Bool
+xwl_save_screen(ScreenPtr pScreen, int on)
+{
+ return TRUE;
+}
+
+static void
+xwl_screen_post_damage(struct xwl_screen *xwl_screen)
+{
+ struct xwl_window *xwl_window;
+ RegionPtr region;
+ BoxPtr box;
+ int count, i;
+ struct wl_buffer *buffer;
+ PixmapPtr pixmap;
+
+ xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list,
+ link_damage) {
+ region = DamageRegion(xwl_window->damage);
+ count = RegionNumRects(region);
+
+ pixmap = (*xwl_screen->screen->GetWindowPixmap) (xwl_window->window);
+
+ buffer = xwl_shm_pixmap_get_wl_buffer(pixmap);
+ wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+ for (i = 0; i < count; i++) {
+ box = &RegionRects(region)[i];
+ wl_surface_damage(xwl_window->surface,
+ box->x1, box->y1,
+ box->x2 - box->x1, box->y2 - box->y1);
+ }
+ wl_surface_commit(xwl_window->surface);
+ DamageEmpty(xwl_window->damage);
+ }
+
+ xorg_list_init(&xwl_screen->damage_window_list);
+}
+
+static void
+registry_global(void *data, struct wl_registry *registry, uint32_t id,
+ const char *interface, uint32_t version)
+{
+ struct xwl_screen *xwl_screen = data;
+
+ if (strcmp(interface, "wl_compositor") == 0) {
+ xwl_screen->compositor =
+ wl_registry_bind(registry, id, &wl_compositor_interface, 1);
+ }
+ else if (strcmp(interface, "wl_shm") == 0) {
+ xwl_screen->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
+ }
+ else if (strcmp(interface, "wl_shell") == 0) {
+ xwl_screen->shell =
+ wl_registry_bind(registry, id, &wl_shell_interface, 1);
+ }
+ else if (strcmp(interface, "wl_output") == 0 && version >= 2) {
+ xwl_output_create(xwl_screen, id);
+ xwl_screen->expecting_event++;
+ }
+}
+
+static void
+global_remove(void *data, struct wl_registry *registry, uint32_t name)
+{
+ /* Nothing to do here, wl_compositor and wl_shm should not be removed */
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_global,
+ global_remove
+};
+
+static void
+wakeup_handler(void *data, int err, void *read_mask)
+{
+ struct xwl_screen *xwl_screen = data;
+ int ret;
+
+ if (err < 0)
+ return;
+
+ if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask))
+ return;
+
+ ret = wl_display_read_events(xwl_screen->display);
+ if (ret == -1)
+ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
+
+ xwl_screen->prepare_read = 0;
+
+ ret = wl_display_dispatch_pending(xwl_screen->display);
+ if (ret == -1)
+ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
+}
+
+static void
+block_handler(void *data, struct timeval **tv, void *read_mask)
+{
+ struct xwl_screen *xwl_screen = data;
+ int ret;
+
+ xwl_screen_post_damage(xwl_screen);
+
+ while (xwl_screen->prepare_read == 0 &&
+ wl_display_prepare_read(xwl_screen->display) == -1) {
+ ret = wl_display_dispatch_pending(xwl_screen->display);
+ if (ret == -1)
+ FatalError("failed to dispatch Wayland events: %s\n",
+ strerror(errno));
+ }
+
+ xwl_screen->prepare_read = 1;
+
+ ret = wl_display_flush(xwl_screen->display);
+ if (ret == -1)
+ FatalError("failed to write to XWayland fd: %s\n", strerror(errno));
+}
+
+static CARD32
+add_client_fd(OsTimerPtr timer, CARD32 time, void *arg)
+{
+ struct xwl_screen *xwl_screen = arg;
+
+ if (!AddClientOnOpenFD(xwl_screen->wm_fd))
+ FatalError("Failed to add wm client\n");
+
+ TimerFree(timer);
+
+ return 0;
+}
+
+static void
+listen_on_fds(struct xwl_screen *xwl_screen)
+{
+ int i;
+
+ for (i = 0; i < xwl_screen->listen_fd_count; i++)
+ ListenOnOpenFD(xwl_screen->listen_fds[i], TRUE);
+}
+
+static void
+wm_selection_callback(CallbackListPtr *p, void *data, void *arg)
+{
+ SelectionInfoRec *info = arg;
+ struct xwl_screen *xwl_screen = data;
+ static const char atom_name[] = "WM_S0";
+ static Atom atom_wm_s0;
+
+ if (atom_wm_s0 == None)
+ atom_wm_s0 = MakeAtom(atom_name, strlen(atom_name), TRUE);
+ if (info->selection->selection != atom_wm_s0 ||
+ info->kind != SelectionSetOwner)
+ return;
+
+ listen_on_fds(xwl_screen);
+
+ DeleteCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
+}
+
+static Bool
+xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
+{
+ struct xwl_screen *xwl_screen;
+ Pixel red_mask, blue_mask, green_mask;
+ int ret, bpc, green_bpc, i;
+
+ xwl_screen = calloc(sizeof *xwl_screen, 1);
+ xwl_screen->wm_fd = -1;
+ if (xwl_screen == NULL)
+ return FALSE;
+
+ if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0))
+ return FALSE;
+ if (!dixRegisterPrivateKey(&xwl_pixmap_private_key, PRIVATE_PIXMAP, 0))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, &xwl_screen_private_key, xwl_screen);
+ xwl_screen->screen = pScreen;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-rootless") == 0) {
+ xwl_screen->rootless = 1;
+ }
+ else if (strcmp(argv[i], "-wm") == 0) {
+ xwl_screen->wm_fd = atoi(argv[i + 1]);
+ i++;
+ TimerSet(NULL, 0, 1, add_client_fd, xwl_screen);
+ }
+ else if (strcmp(argv[i], "-listen") == 0) {
+ if (xwl_screen->listen_fd_count ==
+ ARRAY_SIZE(xwl_screen->listen_fds))
+ FatalError("Too many -listen arguments given, max is %ld\n",
+ ARRAY_SIZE(xwl_screen->listen_fds));
+
+ xwl_screen->listen_fds[xwl_screen->listen_fd_count++] =
+ atoi(argv[i + 1]);
+ i++;
+ }
+ }
+
+ if (xwl_screen->listen_fd_count > 0) {
+ if (xwl_screen->wm_fd >= 0)
+ AddCallback(&SelectionCallback, wm_selection_callback, xwl_screen);
+ else
+ listen_on_fds(xwl_screen);
+ }
+
+ xorg_list_init(&xwl_screen->output_list);
+ xorg_list_init(&xwl_screen->seat_list);
+ xorg_list_init(&xwl_screen->damage_window_list);
+ xwl_screen->depth = 24;
+
+ xwl_screen->display = wl_display_connect(NULL);
+ if (xwl_screen->display == NULL) {
+ ErrorF("could not connect to wayland server\n");
+ return FALSE;
+ }
+
+ if (!xwl_screen_init_output(xwl_screen))
+ return FALSE;
+
+ xwl_screen->expecting_event = 0;
+ xwl_screen->registry = wl_display_get_registry(xwl_screen->display);
+ wl_registry_add_listener(xwl_screen->registry,
+ &registry_listener, xwl_screen);
+ ret = wl_display_roundtrip(xwl_screen->display);
+ if (ret == -1) {
+ ErrorF("could not connect to wayland server\n");
+ return FALSE;
+ }
+
+ while (xwl_screen->expecting_event > 0)
+ wl_display_roundtrip(xwl_screen->display);
+
+ bpc = xwl_screen->depth / 3;
+ green_bpc = xwl_screen->depth - 2 * bpc;
+ blue_mask = (1 << bpc) - 1;
+ green_mask = ((1 << green_bpc) - 1) << bpc;
+ red_mask = blue_mask << (green_bpc + bpc);
+
+ miSetVisualTypesAndMasks(xwl_screen->depth,
+ ((1 << TrueColor) | (1 << DirectColor)),
+ green_bpc, TrueColor,
+ red_mask, green_mask, blue_mask);
+
+ miSetPixmapDepths();
+
+ ret = fbScreenInit(pScreen, NULL,
+ xwl_screen->width, xwl_screen->height,
+ 96, 96, 0,
+ BitsPerPixel(xwl_screen->depth));
+ if (!ret)
+ return FALSE;
+
+ fbPictureInit(pScreen, 0, 0);
+
+ if (!miSyncShmScreenInit(pScreen))
+ return FALSE;
+
+ xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display);
+ AddGeneralSocket(xwl_screen->wayland_fd);
+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen);
+
+ pScreen->SaveScreen = xwl_save_screen;
+
+ pScreen->blackPixel = 0;
+ pScreen->whitePixel = 1;
+
+ ret = fbCreateDefColormap(pScreen);
+
+ if (!xwl_screen_init_cursor(xwl_screen))
+ return FALSE;
+
+ xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
+ pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
+ pScreen->CreatePixmap = xwl_shm_create_pixmap;
+ pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
+
+ xwl_screen->RealizeWindow = pScreen->RealizeWindow;
+ pScreen->RealizeWindow = xwl_realize_window;
+
+ xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
+ pScreen->UnrealizeWindow = xwl_unrealize_window;
+
+ xwl_screen->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = xwl_close_screen;
+
+ return ret;
+}
+
+static void _X_ATTRIBUTE_PRINTF(1, 0)
+xwl_log_handler(const char *format, va_list args)
+{
+ char msg[256];
+
+ vsnprintf(msg, sizeof msg, format, args);
+ FatalError("%s", msg);
+}
+
+static const ExtensionModule glx_extension[] = {
+ { GlxExtensionInit, "GLX", &noGlxExtension },
+};
+
+void
+InitOutput(ScreenInfo * screen_info, int argc, char **argv)
+{
+ int depths[] = { 1, 4, 8, 15, 16, 24, 32 };
+ int bpp[] = { 1, 8, 8, 16, 16, 32, 32 };
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(depths); i++) {
+ screen_info->formats[i].depth = depths[i];
+ screen_info->formats[i].bitsPerPixel = bpp[i];
+ screen_info->formats[i].scanlinePad = BITMAP_SCANLINE_PAD;
+ }
+
+ screen_info->imageByteOrder = IMAGE_BYTE_ORDER;
+ screen_info->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
+ screen_info->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
+ screen_info->bitmapBitOrder = BITMAP_BIT_ORDER;
+ screen_info->numPixmapFormats = ARRAY_SIZE(depths);
+
+ LoadExtensionList(glx_extension, ARRAY_SIZE(glx_extension), FALSE);
+
+ /* Cast away warning from missing printf annotation for
+ * wl_log_func_t. Wayland 1.5 will have the annotation, so we can
+ * remove the cast and require that when it's released. */
+ wl_log_set_handler_client((void *) xwl_log_handler);
+
+ if (AddScreen(xwl_screen_init, argc, argv) == -1) {
+ FatalError("Couldn't add screen\n");
+ }
+}
diff --git a/xorg-server/hw/xwayland/xwayland.h b/xorg-server/hw/xwayland/xwayland.h
new file mode 100644
index 000000000..8157e71ff
--- /dev/null
+++ b/xorg-server/hw/xwayland/xwayland.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of the
+ * copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifndef XWAYLAND_H
+#define XWAYLAND_H
+
+#include <dix-config.h>
+#include <xorg-server.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <wayland-client.h>
+
+#include <X11/X.h>
+
+#include <fb.h>
+#include <input.h>
+#include <dix.h>
+#include <randrstr.h>
+#include <exevents.h>
+
+struct xwl_screen {
+ int width;
+ int height;
+ int depth;
+ ScreenPtr screen;
+ WindowPtr pointer_limbo_window;
+ int expecting_event;
+
+ int wm_fd;
+ int listen_fds[5];
+ int listen_fd_count;
+ int rootless;
+
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CloseScreenProcPtr CloseScreen;
+ CreateWindowProcPtr CreateWindow;
+ DestroyWindowProcPtr DestroyWindow;
+ RealizeWindowProcPtr RealizeWindow;
+ UnrealizeWindowProcPtr UnrealizeWindow;
+ XYToWindowProcPtr XYToWindow;
+
+ struct xorg_list output_list;
+ struct xorg_list seat_list;
+ struct xorg_list damage_window_list;
+
+ int wayland_fd;
+ struct wl_display *display;
+ struct wl_registry *registry;
+ struct wl_registry *input_registry;
+ struct wl_compositor *compositor;
+ struct wl_shm *shm;
+ struct wl_shell *shell;
+
+ uint32_t serial;
+
+#define XWL_FORMAT_ARGB8888 (1 << 0)
+#define XWL_FORMAT_XRGB8888 (1 << 1)
+#define XWL_FORMAT_RGB565 (1 << 2)
+
+ int prepare_read;
+};
+
+struct xwl_window {
+ struct xwl_screen *xwl_screen;
+ struct wl_surface *surface;
+ struct wl_shell_surface *shell_surface;
+ WindowPtr window;
+ DamagePtr damage;
+ struct xorg_list link_damage;
+};
+
+#define MODIFIER_META 0x01
+
+struct xwl_seat {
+ DeviceIntPtr pointer;
+ DeviceIntPtr keyboard;
+ struct xwl_screen *xwl_screen;
+ struct wl_seat *seat;
+ struct wl_pointer *wl_pointer;
+ struct wl_keyboard *wl_keyboard;
+ struct wl_array keys;
+ struct wl_surface *cursor;
+ struct xwl_window *focus_window;
+ uint32_t id;
+ uint32_t pointer_enter_serial;
+ struct xorg_list link;
+ CursorPtr x_cursor;
+
+ wl_fixed_t horizontal_scroll;
+ wl_fixed_t vertical_scroll;
+ uint32_t scroll_time;
+
+ size_t keymap_size;
+ char *keymap;
+ struct wl_surface *keyboard_focus;
+};
+
+struct xwl_output {
+ struct xorg_list link;
+ struct wl_output *output;
+ struct xwl_screen *xwl_screen;
+ RROutputPtr randr_output;
+ RRCrtcPtr randr_crtc;
+ int32_t x, y, width, height;
+ Rotation rotation;
+};
+
+struct xwl_pixmap;
+
+Bool xwl_screen_init_cursor(struct xwl_screen *xwl_screen);
+
+struct xwl_screen *xwl_screen_get(ScreenPtr screen);
+
+void xwl_seat_set_cursor(struct xwl_seat *xwl_seat);
+
+void xwl_seat_destroy(struct xwl_seat *xwl_seat);
+
+Bool xwl_screen_init_output(struct xwl_screen *xwl_screen);
+
+struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen,
+ uint32_t id);
+
+void xwl_output_destroy(struct xwl_output *xwl_output);
+
+RRModePtr xwayland_cvt(int HDisplay, int VDisplay,
+ float VRefresh, Bool Reduced, Bool Interlaced);
+
+void xwl_pixmap_set_private(PixmapPtr pixmap, struct xwl_pixmap *xwl_pixmap);
+struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
+
+
+Bool xwl_shm_create_screen_resources(ScreenPtr screen);
+PixmapPtr xwl_shm_create_pixmap(ScreenPtr screen, int width, int height,
+ int depth, unsigned int hint);
+Bool xwl_shm_destroy_pixmap(PixmapPtr pixmap);
+struct wl_buffer *xwl_shm_pixmap_get_wl_buffer(PixmapPtr pixmap);
+
+
+#endif
diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am
index 532120a57..5b97dcabd 100644
--- a/xorg-server/hw/xwin/Makefile.am
+++ b/xorg-server/hw/xwin/Makefile.am
@@ -128,10 +128,7 @@ SRCS = InitInput.c \
winwindow.h \
windisplay.c \
XWin.rc \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/fb/fbcmap_mi.c \
$(SRCS_CLIPBOARD) \
$(SRCS_MULTIWINDOW) \
$(SRCS_MULTIWINDOWEXTWM) \
@@ -154,12 +151,14 @@ XWin_SOURCES = $(SRCS)
AM_CPPFLAGS = -I$(top_srcdir)/miext/rootless
XWIN_SYS_LIBS += -ldxguid
-XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la
-
+XWIN_LIBS += $(top_builddir)/pseudoramiX/libPseudoramiX.la \
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
+ $(top_builddir)/Xi/libXistubs.la
XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(XSERVER_LIBS)
XWin_LDADD = $(MULTIWINDOW_LIBS) $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
XWin_LDFLAGS = -mwindows -static -Wl,--disable-stdcall-fixup
+
.rc.o:
$(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index 5b37ad8d8..af1bfd05e 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -607,6 +607,7 @@ extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type);
void FixUpEventFromWindow(SpritePtr pSprite,
xEvent *xE,
WindowPtr pWin, Window child, Bool calcChild);
+extern Bool PointInBorderSize(WindowPtr pWin, int x, int y);
extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
diff --git a/xorg-server/include/opaque.h b/xorg-server/include/opaque.h
index 7ec1d850f..6b8071c5b 100644
--- a/xorg-server/include/opaque.h
+++ b/xorg-server/include/opaque.h
@@ -51,6 +51,7 @@ extern _X_EXPORT int defaultScreenSaverBlanking;
extern _X_EXPORT int defaultScreenSaverAllowExposures;
extern _X_EXPORT const char *display;
extern _X_EXPORT int displayfd;
+extern _X_EXPORT Bool explicit_display;
extern _X_EXPORT int defaultBackingStore;
extern _X_EXPORT Bool disableBackingStore;
diff --git a/xorg-server/include/scrnintstr.h b/xorg-server/include/scrnintstr.h
index 2ad029599..f6a5ef3aa 100644
--- a/xorg-server/include/scrnintstr.h
+++ b/xorg-server/include/scrnintstr.h
@@ -357,6 +357,11 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
+typedef WindowPtr (*XYToWindowProcPtr)(ScreenPtr pScreen,
+ SpritePtr pSprite, int x, int y);
+
+typedef int (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
+
typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */
ATOM id;
@@ -467,6 +472,7 @@ typedef struct _Screen {
SetWindowPixmapProcPtr SetWindowPixmap;
GetScreenPixmapProcPtr GetScreenPixmap;
SetScreenPixmapProcPtr SetScreenPixmap;
+ NameWindowPixmapProcPtr NameWindowPixmap;
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
@@ -517,6 +523,7 @@ typedef struct _Screen {
struct xorg_list offload_head;
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
+ XYToWindowProcPtr XYToWindow;
} ScreenRec;
static inline RegionPtr
diff --git a/xorg-server/include/xorg-config.h.in b/xorg-server/include/xorg-config.h.in
index 77a1aae55..629ae4057 100644
--- a/xorg-server/include/xorg-config.h.in
+++ b/xorg-server/include/xorg-config.h.in
@@ -45,9 +45,18 @@
/* Path to installed libraries. */
#undef DEFAULT_LIBRARY_PATH
-/* Path to server log file. */
+/* Default log location */
+#undef DEFAULT_LOGDIR
+
+/* Default logfile prefix */
#undef DEFAULT_LOGPREFIX
+/* Default XDG_DATA dir under HOME */
+#undef DEFAULT_XDG_DATA_HOME
+
+/* Default log dir under XDG_DATA_HOME */
+#undef DEFAULT_XDG_DATA_HOME_LOGDIR
+
/* Building DRI-capable DDX. */
#undef XF86DRI
diff --git a/xorg-server/include/xwin-config.h.in b/xorg-server/include/xwin-config.h.in
index 176c01980..a5e6b17b3 100644
--- a/xorg-server/include/xwin-config.h.in
+++ b/xorg-server/include/xwin-config.h.in
@@ -26,8 +26,5 @@
/* Vendor web address for support */
#undef __VENDORDWEBSUPPORT__
-/* Default log location */
-#undef DEFAULT_LOGDIR
-
/* Whether we should re-locate the root to where the executable lives */
#undef RELOCATE_PROJECTROOT
diff --git a/xorg-server/mi/mi.h b/xorg-server/mi/mi.h
index cf95cd79e..788f5dd54 100644
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
@@ -507,6 +507,10 @@ extern _X_EXPORT void miMarkUnrealizedWindow(WindowPtr /*pChild */ ,
extern _X_EXPORT void miSegregateChildren(WindowPtr pWin, RegionPtr pReg,
int depth);
+extern _X_EXPORT WindowPtr miSpriteTrace(SpritePtr pSprite, int x, int y);
+
+extern _X_EXPORT WindowPtr miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y);
+
/* mizerarc.c */
extern _X_EXPORT void miZeroPolyArc(DrawablePtr /*pDraw */ ,
diff --git a/xorg-server/mi/miscrinit.c b/xorg-server/mi/miscrinit.c
index 6aed52f51..00c15f713 100644
--- a/xorg-server/mi/miscrinit.c
+++ b/xorg-server/mi/miscrinit.c
@@ -272,6 +272,7 @@ miScreenInit(ScreenPtr pScreen, void *pbits, /* pointer to screen bits */
pScreen->ChangeBorderWidth = miChangeBorderWidth;
pScreen->SetShape = miSetShape;
pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
+ pScreen->XYToWindow = miXYToWindow;
miSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS);
diff --git a/xorg-server/mi/miwindow.c b/xorg-server/mi/miwindow.c
index d9c46fd90..c6f0e5315 100644
--- a/xorg-server/mi/miwindow.c
+++ b/xorg-server/mi/miwindow.c
@@ -57,6 +57,7 @@ SOFTWARE.
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "mivalidate.h"
+#include "inputstr.h"
void
miClearToBackground(WindowPtr pWin,
@@ -758,3 +759,68 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
miSegregateChildren(pChild, pReg, depth);
}
}
+
+WindowPtr
+miSpriteTrace(SpritePtr pSprite, int x, int y)
+{
+ WindowPtr pWin;
+ BoxRec box;
+
+ pWin = DeepestSpriteWin(pSprite);
+ while (pWin) {
+ if ((pWin->mapped) &&
+ (x >= pWin->drawable.x - wBorderWidth(pWin)) &&
+ (x < pWin->drawable.x + (int) pWin->drawable.width +
+ wBorderWidth(pWin)) &&
+ (y >= pWin->drawable.y - wBorderWidth(pWin)) &&
+ (y < pWin->drawable.y + (int) pWin->drawable.height +
+ wBorderWidth(pWin))
+ /* When a window is shaped, a further check
+ * is made to see if the point is inside
+ * borderSize
+ */
+ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
+ && (!wInputShape(pWin) ||
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
+#ifdef ROOTLESS
+ /* In rootless mode windows may be offscreen, even when
+ * they're in X's stack. (E.g. if the native window system
+ * implements some form of virtual desktop system).
+ */
+ && !pWin->rootlessUnhittable
+#endif
+ ) {
+ if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize) {
+ pSprite->spriteTraceSize += 10;
+ pSprite->spriteTrace = realloc(pSprite->spriteTrace,
+ pSprite->spriteTraceSize *
+ sizeof(WindowPtr));
+ }
+ pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
+ pWin = pWin->firstChild;
+ }
+ else
+ pWin = pWin->nextSib;
+ }
+ return DeepestSpriteWin(pSprite);
+}
+
+/**
+ * Traversed from the root window to the window at the position x/y. While
+ * traversing, it sets up the traversal history in the spriteTrace array.
+ * After completing, the spriteTrace history is set in the following way:
+ * spriteTrace[0] ... root window
+ * spriteTrace[1] ... top level window that encloses x/y
+ * ...
+ * spriteTrace[spriteTraceGood - 1] ... window at x/y
+ *
+ * @returns the window at the given coordinates.
+ */
+WindowPtr
+miXYToWindow(ScreenPtr pScreen, SpritePtr pSprite, int x, int y)
+{
+ pSprite->spriteTraceGood = 1; /* root window still there */
+ return miSpriteTrace(pSprite, x, y);
+}
diff --git a/xorg-server/os/connection.c b/xorg-server/os/connection.c
index 80489f0e2..b39969dcd 100644
--- a/xorg-server/os/connection.c
+++ b/xorg-server/os/connection.c
@@ -379,8 +379,8 @@ void
NotifyParentProcess(void)
{
#if !defined(WIN32)
- if (dynamic_display[0]) {
- write(displayfd, dynamic_display, strlen(dynamic_display));
+ if (displayfd >= 0) {
+ write(displayfd, display, strlen(display));
write(displayfd, "\n", 1);
close(displayfd);
}
@@ -437,18 +437,18 @@ CreateWellKnownSockets(void)
FD_ZERO(&WellKnownConnections);
/* display is initialized to "0" by main(). It is then set to the display
- * number if specified on the command line, or to NULL when the -displayfd
- * option is used. */
+ * number if specified on the command line. */
+
if (NoListenAll) {
ListenTransCount = 0;
}
- else if (display) {
+ else if ((displayfd < 0) || explicit_display) {
if (TryCreateSocket(atoi(display), &partial) &&
ListenTransCount >= 1)
if (!PartialNetwork && partial)
FatalError ("Failed to establish all listening sockets");
}
- else { /* -displayfd */
+ else { /* -displayfd and no explicit display number */
Bool found = 0;
for (i = 0; i < 65535 - X_TCP_PORT; i++) {
if (TryCreateSocket(i, &partial) && ListenTransCount >= 1 && (PartialNetwork || !partial)) {
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index c514ae11a..9e5eefddb 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -685,6 +685,7 @@ ProcessCommandLine(int argc, char *argv[])
else if (argv[i][0] == ':') {
/* initialize display */
display = argv[i];
+ explicit_display = TRUE;
display++;
if (!VerifyDisplayName(display)) {
ErrorF("Bad display name: %s\n", display);
@@ -763,7 +764,6 @@ ProcessCommandLine(int argc, char *argv[])
else if (strcmp(argv[i], "-displayfd") == 0) {
if (++i < argc) {
displayfd = atoi(argv[i]);
- display = NULL;
#ifdef LOCK_SERVER
nolock = TRUE;
#endif
diff --git a/xorg-server/test/Makefile.am b/xorg-server/test/Makefile.am
index 88fb6aa96..3ad24d9ec 100644
--- a/xorg-server/test/Makefile.am
+++ b/xorg-server/test/Makefile.am
@@ -70,9 +70,7 @@ endif
else
nodist_libxservertest_la_SOURCES = \
ddxstubs.c \
- $(top_srcdir)/mi/miinitext.c \
- $(top_srcdir)/Xext/dpmsstubs.c \
- $(top_srcdir)/Xi/stubs.c
+ $(top_srcdir)/mi/miinitext.c
libxservertest_la_LIBADD += \
$(top_builddir)/damageext/libdamageext.la \
@@ -83,7 +81,9 @@ libxservertest_la_LIBADD += \
$(top_builddir)/randr/librandr.la \
$(top_builddir)/render/librender.la \
$(top_builddir)/Xext/libXext.la \
+ $(top_builddir)/Xext/libXextdpmsstubs.la \
$(top_builddir)/Xi/libXi.la \
+ $(top_builddir)/Xi/libXistubs.la \
$(top_builddir)/xfixes/libxfixes.la \
$(top_builddir)/xkb/libxkb.la \
$(top_builddir)/xkb/libxkbstubs.la
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index cb4bca008..5f3de0d9e 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -711,7 +711,7 @@ ProcessPointerEvent(InternalEvent *ev, DeviceIntPtr mouse)
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event;
- dev = (IsMaster(mouse) || IsFloating(mouse)) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
+ dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
if (dev && dev->key) {
xkbi = dev->key->xkbInfo;