aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-25 09:22:25 +0200
committermarha <marha@users.sourceforge.net>2013-10-25 09:22:25 +0200
commit5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0 (patch)
treec532fb2a693321cc9960fd554654e60351d63249 /mesalib/src/mesa
parent42cd4a1fab6d183e218bd8c6bd65f65211af4d7c (diff)
parent270d3a1aa4137dc15d7b7e5a0958cc8c0bef9a1a (diff)
downloadvcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.tar.gz
vcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.tar.bz2
vcxsrv-5b4c4c77b012ceac7b0f4d3ef2f33d91f01084d0.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig mesa git update 25 oct 2013 Conflicts: mesalib/src/mesa/drivers/dri/common/dri_util.c mesalib/src/mesa/drivers/dri/swrast/swrast.c
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/Makefile.am6
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.am67
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am11
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/drivers/dri/common/dri_util.c82
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.h2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/megadriver_stub.c41
-rw-r--r--mesalib/src/mesa/drivers/dri/gen-symbol-redefs.py68
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile.am18
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile.sources6
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/drivers/dri/swrast/swrast.c19
-rw-r--r--mesalib/src/mesa/main/mtypes.h14
-rw-r--r--mesalib/src/mesa/main/shaderapi.c108
-rw-r--r--mesalib/src/mesa/program/Makefile.am14
-rw-r--r--mesalib/src/mesa/x86/read_rgba_span_x86.S8
14 files changed, 323 insertions, 141 deletions
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index e9c16e78e..f86caee35 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -19,11 +19,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-if NEED_LIBDRICORE
-DRICORE_SUBDIR = libdricore
-endif
-
-SUBDIRS = program x86 x86-64 . $(DRICORE_SUBDIR) main/tests
+SUBDIRS = program x86 x86-64 . main/tests
if HAVE_X11_DRIVER
SUBDIRS += drivers/x11
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am
index 7fa0ad73d..a85a5aa91 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/Makefile.am
@@ -1,29 +1,45 @@
+dridir = $(DRI_DRIVER_INSTALL_DIR)
+
SUBDIRS =
+MEGADRIVERS =
+MEGADRIVERS_DEPS =
SUBDIRS+=common
if HAVE_I915_DRI
-SUBDIRS+=i915
+SUBDIRS += i915
+MEGADRIVERS_DEPS += i915/libi915_dri.la
+MEGADRIVERS += i915_dri.so
endif
if HAVE_I965_DRI
-SUBDIRS+=i965
+SUBDIRS += i965
+MEGADRIVERS_DEPS += i965/libi965_dri.la
+MEGADRIVERS += i965_dri.so
endif
if HAVE_NOUVEAU_DRI
-SUBDIRS+=nouveau
+SUBDIRS += nouveau
+MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la
+MEGADRIVERS += nouveau_vieux_dri.so
endif
if HAVE_R200_DRI
-SUBDIRS+=r200
+SUBDIRS += r200
+MEGADRIVERS_DEPS += r200/libr200_dri.la
+MEGADRIVERS += r200_dri.so
endif
if HAVE_RADEON_DRI
-SUBDIRS+=radeon
+SUBDIRS += radeon
+MEGADRIVERS_DEPS += radeon/libradeon_dri.la
+MEGADRIVERS += radeon_dri.so
endif
if HAVE_SWRAST_DRI
-SUBDIRS+=swrast
+SUBDIRS += swrast
+MEGADRIVERS_DEPS += swrast/libswrast_dri.la
+MEGADRIVERS += swrast_dri.so
endif
pkgconfigdir = $(libdir)/pkgconfig
@@ -31,3 +47,42 @@ pkgconfig_DATA = dri.pc
driincludedir = $(includedir)/GL/internal
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 \
+ -Wl,-Bsymbolic \
+ $()
+mesa_dri_drivers_la_LIBADD = \
+ ../../libmesa.la \
+ common/libmegadriver_stub.la \
+ common/libdricommon.la \
+ $(MEGADRIVERS_DEPS) \
+ $(DRI_LIB_DEPS) \
+ $()
+
+if NEED_MEGADRIVER
+dri_LTLIBRARIES = mesa_dri_drivers.la
+
+# Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
+all-local: mesa_dri_drivers.la
+ $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
+ $(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.so \
+ $(top_builddir)/$(LIB_DIR)/$$i; \
+ done;
+
+# hardlink each megadriver instance, but don't actually have
+# 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.so \
+ $(DESTDIR)$(dridir)/$$i; \
+ done;
+ $(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 ce4119d0f..9f49ff3ae 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -27,11 +27,11 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
$(DEFINES) \
- $(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
noinst_LTLIBRARIES = \
libdricommon.la \
+ libmegadriver_stub.la \
libdri_test_stubs.la
libdricommon_la_SOURCES = \
@@ -43,4 +43,13 @@ libdri_test_stubs_la_SOURCES = \
dri_test.c
libdri_test_stubs_la_CFLAGS = $(AM_CFLAGS) -DNO_MAIN
+libmegadriver_stub_la_SOURCES = megadriver_stub.c
+
sysconf_DATA = drirc
+
+if DRICOMMON_NEED_LIBDRM
+AM_CFLAGS += $(LIBDRM_CFLAGS)
+libdricommon_la_LDFLAGS = $(LIBDRM_LIBS)
+else
+AM_CFLAGS += -D__NOT_HAVE_DRM_H
+endif
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 74f3a5d99..7f84e6496 100644..100755
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -82,6 +82,23 @@ setupLoaderExtensions(__DRIscreen *psp,
}
/**
+ * This pointer determines which driver API we'll use in the case of the
+ * loader not passing us an explicit driver extensions list (that would,
+ * itself, contain a pointer to a driver API.)
+ *
+ * A driver's driDriverGetExtensions_drivername() can update this pointer to
+ * what it's returning, and a loader that is ignorant of createNewScreen2()
+ * will get the correct driver screen created, as long as no other
+ * driDriverGetExtensions() happened in between the first one and the
+ * createNewScreen().
+ *
+ * This allows the X Server to not require the significant dri_interface.h
+ * updates for doing createNewScreen2(), which would discourage backporting of
+ * the X Server patches to support the new loader interface.
+ */
+const struct __DriverAPIRec *globalDriverAPI = &driDriverAPI;
+
+/**
* This is the first entrypoint in the driver called by the DRI driver loader
* after dlopen()ing it.
*
@@ -89,19 +106,33 @@ setupLoaderExtensions(__DRIscreen *psp,
* Display.
*/
static __DRIscreen *
-dri2CreateNewScreen(int scrn, int fd,
- const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+dri2CreateNewScreen2(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- int gl_version_override;
+ int gl_version_override;
psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
- psp->driver = &driDriverAPI;
+ /* By default, use the global driDriverAPI symbol (non-megadrivers). */
+ psp->driver = globalDriverAPI;
+
+ /* If the driver exposes its vtable through its extensions list
+ * (megadrivers), use that instead.
+ */
+ if (driver_extensions) {
+ for (int i = 0; driver_extensions[i]; i++) {
+ if (strcmp(driver_extensions[i]->name, __DRI_DRIVER_VTABLE) == 0) {
+ psp->driver =
+ ((__DRIDriverVtableExtension *)driver_extensions[i])->vtable;
+ }
+ }
+ }
setupLoaderExtensions(psp, extensions);
@@ -155,12 +186,31 @@ dri2CreateNewScreen(int scrn, int fd,
return psp;
}
+static __DRIscreen *
+dri2CreateNewScreen(int scrn, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, fd, extensions, NULL,
+ driver_configs, data);
+}
+
/** swrast driver createNewScreen entrypoint. */
static __DRIscreen *
-driCreateNewScreen(int scrn, const __DRIextension **extensions,
- const __DRIconfig ***driver_configs, void *data)
+driSWRastCreateNewScreen(int scrn, const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs, void *data)
+{
+ return dri2CreateNewScreen2(scrn, -1, extensions, NULL,
+ driver_configs, data);
+}
+
+static __DRIscreen *
+driSWRastCreateNewScreen2(int scrn, const __DRIextension **extensions,
+ const __DRIextension **driver_extensions,
+ const __DRIconfig ***driver_configs, void *data)
{
- return dri2CreateNewScreen(scrn, -1, extensions, driver_configs, data);
+ return dri2CreateNewScreen2(scrn, -1, extensions, driver_extensions,
+ driver_configs, data);
}
/**
@@ -257,8 +307,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
unsigned major_version = 1;
unsigned minor_version = 0;
uint32_t flags = 0;
- unsigned i;
- struct gl_context *ctx;
+ unsigned i;
+ struct gl_context *ctx;
assert((num_attribs == 0) || (attribs != NULL));
@@ -691,7 +741,7 @@ const __DRIcoreExtension driCoreExtension = {
/** DRI2 interface */
const __DRIdri2Extension driDRI2Extension = {
- /*.base =*/ { __DRI_DRI2, 3 },
+ /*.base =*/ { __DRI_DRI2, 4 },
/*.createNewScreen =*/ dri2CreateNewScreen,
/*.createNewDrawable =*/ dri2CreateNewDrawable,
@@ -700,15 +750,17 @@ const __DRIdri2Extension driDRI2Extension = {
/*.createNewContextForAPI =*/ dri2CreateNewContextForAPI,
/*.allocateBuffer =*/ dri2AllocateBuffer,
/*.releaseBuffer =*/ dri2ReleaseBuffer,
- /*.createContextAttribs =*/ dri2CreateContextAttribs
+ /*.createContextAttribs =*/ dri2CreateContextAttribs,
+ /*.createNewScreen2 =*/ dri2CreateNewScreen2,
};
const __DRIswrastExtension driSWRastExtension = {
- { __DRI_SWRAST, __DRI_SWRAST_VERSION },
- driCreateNewScreen,
+ { __DRI_SWRAST, 4 },
+ driSWRastCreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContextForAPI,
- dri2CreateContextAttribs
+ dri2CreateContextAttribs,
+ driSWRastCreateNewScreen2,
};
const __DRI2configQueryExtension dri2ConfigQueryExtension = {
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h
index 61c80bc45..5b56061e2 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.h
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h
@@ -116,7 +116,7 @@ struct __DriverAPIRec {
};
extern const struct __DriverAPIRec driDriverAPI;
-
+extern const struct __DriverAPIRec *globalDriverAPI;
/**
* Per-screen private driver information.
diff --git a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
new file mode 100644
index 000000000..6bf5d7327
--- /dev/null
+++ b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+#include <stdio.h>
+#include "dri_util.h"
+
+static const
+__DRIconfig **stub_error_init_screen(__DRIscreen *psp)
+{
+ fprintf(stderr, "An updated DRI driver loader (libGL.so or X Server) is "
+ "required for this Mesa driver.\n");
+ return NULL;
+}
+
+/**
+ * This is a stub driDriverAPI that is referenced by dri_util.c but should
+ * never be used.
+ */
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = stub_error_init_screen,
+};
diff --git a/mesalib/src/mesa/drivers/dri/gen-symbol-redefs.py b/mesalib/src/mesa/drivers/dri/gen-symbol-redefs.py
new file mode 100644
index 000000000..ebe4aaa65
--- /dev/null
+++ b/mesalib/src/mesa/drivers/dri/gen-symbol-redefs.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright © 2013 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.
+
+import sys
+import argparse
+import re
+import subprocess
+
+# Example usages:
+# ./gen-symbol-redefs.py i915/.libs/libi915_dri.a old_ i915 i830
+# ./gen-symbol-redefs.py r200/.libs/libr200_dri.a r200_ r200
+
+argparser = argparse.ArgumentParser(description="Generates #defines to hide driver global symbols outside of a driver's namespace.")
+argparser.add_argument("file",
+ metavar = 'file',
+ help='libdrivername.a file to read')
+argparser.add_argument("newprefix",
+ metavar = 'newprefix',
+ help='New prefix to give non-driver global symbols')
+argparser.add_argument('prefixes',
+ metavar='prefix',
+ nargs='*',
+ help='driver-specific prefixes')
+args = argparser.parse_args()
+
+stdout = subprocess.check_output(['nm', args.file])
+
+for line in stdout.splitlines():
+ m = re.match("[0-9a-z]+ [BT] (.*)", line)
+ if not m:
+ continue
+
+ symbol = m.group(1)
+
+ has_good_prefix = re.match(args.newprefix, symbol) != None
+ for prefix in args.prefixes:
+ if re.match(prefix, symbol):
+ has_good_prefix = True
+ break
+ if has_good_prefix:
+ continue
+
+ # This is the single public entrypoint.
+ if re.match("__driDriverGetExtensions", symbol):
+ continue
+
+ print '#define {0:35} {1}{0}'.format(symbol, args.newprefix)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
index c51ad2d87..0837b4518 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
@@ -34,19 +34,5 @@ AM_CFLAGS = \
$(DEFINES) \
$(VISIBILITY_CFLAGS)
-dridir = $(DRI_DRIVER_INSTALL_DIR)
-dri_LTLIBRARIES = swrast_dri.la
-
-swrast_dri_la_SOURCES = \
- $(SWRAST_C_FILES)
-
-swrast_dri_la_LDFLAGS = $(DRI_DRIVER_LDFLAGS)
-
-swrast_dri_la_LIBADD = \
- $(DRI_LIB_DEPS)
-
-# 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.
-all-local: swrast_dri.la
- $(MKDIR_P) $(top_builddir)/$(LIB_DIR);
- ln -f .libs/swrast_dri.so $(top_builddir)/$(LIB_DIR)/swrast_dri.so;
+noinst_LTLIBRARIES = libswrast_dri.la
+libswrast_dri_la_SOURCES = $(SWRAST_C_FILES)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
index fc7ef32db..70e432feb 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
+++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.sources
@@ -1,11 +1,5 @@
SWRAST_DRIVER_FILES = \
swrast.c
-SWRAST_COMMON_FILES = \
- ../common/utils.c \
- ../common/dri_util.c \
- ../common/xmlconfig.c
-
SWRAST_C_FILES = \
- $(SWRAST_COMMON_FILES) \
$(SWRAST_DRIVER_FILES)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index dde868864..fa7d695ab 100644..100755
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -64,6 +64,7 @@
#include "swrast_priv.h"
#include "swrast/s_context.h"
+const __DRIextension **__driDriverGetExtensions_swrast(void);
/**
* Screen and config-related functions
@@ -824,7 +825,7 @@ dri_unbind_context(__DRIcontext * cPriv)
}
-const struct __DriverAPIRec driDriverAPI = {
+static const struct __DriverAPIRec swrast_driver_api = {
/*.InitScreen = */dri_init_screen,
/*.DestroyScreen = */dri_destroy_screen,
/*.CreateContext = */dri_create_context,
@@ -836,9 +837,21 @@ const struct __DriverAPIRec driDriverAPI = {
/*.UnbindContext = */dri_unbind_context,
};
-/* This is the table of extensions that the loader will dlsym() for. */
-PUBLIC const __DRIextension *__driDriverExtensions[] = {
+static const struct __DRIDriverVtableExtensionRec swrast_vtable = {
+ .base = { __DRI_DRIVER_VTABLE, 1 },
+ .vtable = &swrast_driver_api,
+};
+
+static const __DRIextension *swrast_driver_extensions[] = {
&driCoreExtension.base,
&driSWRastExtension.base,
+ &swrast_vtable.base,
NULL
};
+
+PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void)
+{
+ globalDriverAPI = &swrast_driver_api;
+
+ return swrast_driver_extensions;
+}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 6374e8c0d..97ed1bd6a 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1965,6 +1965,12 @@ struct gl_program
GLboolean UsesGather; /**< Does this program use gather4 at all? */
+ /**
+ * For vertex and geometry shaders, true if the program uses the
+ * gl_ClipDistance output. Ignored for fragment shaders.
+ */
+ GLboolean UsesClipDistanceOut;
+
/** Named parameters, constants, etc. from program text */
struct gl_program_parameter_list *Parameters;
@@ -2009,7 +2015,6 @@ struct gl_vertex_program
{
struct gl_program Base; /**< base class */
GLboolean IsPositionInvariant;
- GLboolean UsesClipDistance;
};
@@ -2023,7 +2028,6 @@ struct gl_geometry_program
GLenum InputType; /**< GL_POINTS, GL_LINES, GL_LINES_ADJACENCY_ARB,
GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
- GLboolean UsesClipDistance;
GLboolean UsesEndPrimitive;
};
@@ -2476,6 +2480,12 @@ struct gl_shader_program
unsigned NumUserUniformStorage;
struct gl_uniform_storage *UniformStorage;
+ /**
+ * Size of the gl_ClipDistance array that is output from the last pipeline
+ * stage before the fragment shader.
+ */
+ unsigned LastClipDistanceArraySize;
+
struct gl_uniform_block *UniformBlocks;
unsigned NumUniformBlocks;
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index d3677c851..f5c04b9f3 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -460,6 +460,31 @@ get_handle(struct gl_context *ctx, GLenum pname)
/**
+ * Check if a geometry shader query is valid at this time. If not, report an
+ * error and return false.
+ *
+ * From GL 3.2 section 6.1.16 (Shader and Program Queries):
+ *
+ * "If GEOMETRY_VERTICES_OUT, GEOMETRY_INPUT_TYPE, or GEOMETRY_OUTPUT_TYPE
+ * are queried for a program which has not been linked successfully, or
+ * which does not contain objects to form a geometry shader, then an
+ * INVALID_OPERATION error is generated."
+ */
+static bool
+check_gs_query(struct gl_context *ctx, const struct gl_shader_program *shProg)
+{
+ if (shProg->LinkStatus &&
+ shProg->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
+ return true;
+ }
+
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetProgramv(linked geometry shader required)");
+ return false;
+}
+
+
+/**
* glGetProgramiv() - get shader program state.
* Note that this is for GLSL shader programs, not ARB vertex/fragment
* programs (see glGetProgramivARB).
@@ -477,9 +502,10 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
|| ctx->API == API_OPENGL_CORE
|| _mesa_is_gles3(ctx);
- /* Are geometry shaders available in this context?
+ /* True if geometry shaders (of the form that was adopted into GLSL 1.50
+ * and GL 3.2) are available in this context
*/
- const bool has_gs = _mesa_has_geometry_shaders(ctx);
+ const bool has_core_gs = _mesa_is_desktop_gl(ctx) && ctx->Version >= 32;
/* Are uniform buffer objects available in this context?
*/
@@ -564,20 +590,23 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
break;
*params = shProg->TransformFeedback.BufferMode;
return;
- case GL_GEOMETRY_VERTICES_OUT_ARB:
- if (!has_gs)
+ case GL_GEOMETRY_VERTICES_OUT:
+ if (!has_core_gs)
break;
- *params = shProg->Geom.VerticesOut;
+ if (check_gs_query(ctx, shProg))
+ *params = shProg->Geom.VerticesOut;
return;
- case GL_GEOMETRY_INPUT_TYPE_ARB:
- if (!has_gs)
+ case GL_GEOMETRY_INPUT_TYPE:
+ if (!has_core_gs)
break;
- *params = shProg->Geom.InputType;
+ if (check_gs_query(ctx, shProg))
+ *params = shProg->Geom.InputType;
return;
- case GL_GEOMETRY_OUTPUT_TYPE_ARB:
- if (!has_gs)
+ case GL_GEOMETRY_OUTPUT_TYPE:
+ if (!has_core_gs)
break;
- *params = shProg->Geom.OutputType;
+ if (check_gs_query(ctx, shProg))
+ *params = shProg->Geom.OutputType;
return;
case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
unsigned i;
@@ -1631,55 +1660,6 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
return;
switch (pname) {
- case GL_GEOMETRY_VERTICES_OUT_ARB:
- if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
- break;
-
- if (value < 0 ||
- (unsigned) value > ctx->Const.MaxGeometryOutputVertices) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d)",
- value);
- return;
- }
- shProg->Geom.VerticesOut = value;
- return;
- case GL_GEOMETRY_INPUT_TYPE_ARB:
- if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
- break;
-
- switch (value) {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINES_ADJACENCY_ARB:
- case GL_TRIANGLES:
- case GL_TRIANGLES_ADJACENCY_ARB:
- shProg->Geom.InputType = value;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glProgramParameteri(geometry input type = %s)",
- _mesa_lookup_enum_by_nr(value));
- return;
- }
- return;
- case GL_GEOMETRY_OUTPUT_TYPE_ARB:
- if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
- break;
-
- switch (value) {
- case GL_POINTS:
- case GL_LINE_STRIP:
- case GL_TRIANGLE_STRIP:
- shProg->Geom.OutputType = value;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glProgramParameteri(geometry output type = %s)",
- _mesa_lookup_enum_by_nr(value));
- return;
- }
- return;
case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
/* This enum isn't part of the OES extension for OpenGL ES 2.0, but it
* is part of OpenGL ES 3.0. For the ES2 case, this function shouldn't
@@ -1855,10 +1835,8 @@ _mesa_copy_linked_program_data(gl_shader_type type,
struct gl_program *dst)
{
switch (type) {
- case MESA_SHADER_VERTEX: {
- struct gl_vertex_program *dst_vp = (struct gl_vertex_program *) dst;
- dst_vp->UsesClipDistance = src->Vert.UsesClipDistance;
- }
+ case MESA_SHADER_VERTEX:
+ dst->UsesClipDistanceOut = src->Vert.UsesClipDistance;
break;
case MESA_SHADER_GEOMETRY: {
struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst;
@@ -1866,7 +1844,7 @@ _mesa_copy_linked_program_data(gl_shader_type type,
dst_gp->VerticesOut = src->Geom.VerticesOut;
dst_gp->InputType = src->Geom.InputType;
dst_gp->OutputType = src->Geom.OutputType;
- dst_gp->UsesClipDistance = src->Geom.UsesClipDistance;
+ dst->UsesClipDistanceOut = src->Geom.UsesClipDistance;
dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
}
break;
diff --git a/mesalib/src/mesa/program/Makefile.am b/mesalib/src/mesa/program/Makefile.am
index ab565e251..5e05782fb 100644
--- a/mesalib/src/mesa/program/Makefile.am
+++ b/mesalib/src/mesa/program/Makefile.am
@@ -24,25 +24,13 @@ include ../Makefile.sources
AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
AM_CFLAGS = $(VISIBILITY_CFLAGS)
AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
-libdricore_program_la_CFLAGS = $(NOVISIBILITY_CFLAGS)
-libdricore_program_la_CXXFLAGS = $(NOVISIBILITY_CXXFLAGS)
SRCDIR = $(top_srcdir)/src/mesa/
BUILDDIR = $(top_builddir)/src/mesa/
-if NEED_LIBDRICORE
-DRICORE_LIB = libdricore_program.la
-endif
-
-noinst_LTLIBRARIES = $(DRICORE_LIB)
-if NEED_LIBPROGRAM
-noinst_LTLIBRARIES += libprogram.la
-else
-check_LTLIBRARIES = libprogram.la
-endif
+noinst_LTLIBRARIES = libprogram.la
libprogram_la_SOURCES = $(PROGRAM_FILES)
-libdricore_program_la_SOURCES = $(PROGRAM_FILES)
lex.yy.c: program_lexer.l
$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
diff --git a/mesalib/src/mesa/x86/read_rgba_span_x86.S b/mesalib/src/mesa/x86/read_rgba_span_x86.S
index 3be4515b1..817729973 100644
--- a/mesalib/src/mesa/x86/read_rgba_span_x86.S
+++ b/mesalib/src/mesa/x86/read_rgba_span_x86.S
@@ -77,9 +77,7 @@
*/
.globl _generic_read_RGBA_span_BGRA8888_REV_MMX
-#ifndef USE_DRICORE
.hidden _generic_read_RGBA_span_BGRA8888_REV_MMX
-#endif
.type _generic_read_RGBA_span_BGRA8888_REV_MMX, @function
_generic_read_RGBA_span_BGRA8888_REV_MMX:
pushl %ebx
@@ -174,9 +172,7 @@ _generic_read_RGBA_span_BGRA8888_REV_MMX:
*/
.globl _generic_read_RGBA_span_BGRA8888_REV_SSE
-#ifndef USE_DRICORE
.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE
-#endif
.type _generic_read_RGBA_span_BGRA8888_REV_SSE, @function
_generic_read_RGBA_span_BGRA8888_REV_SSE:
pushl %esi
@@ -339,9 +335,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE:
.text
.globl _generic_read_RGBA_span_BGRA8888_REV_SSE2
-#ifndef USE_DRICORE
.hidden _generic_read_RGBA_span_BGRA8888_REV_SSE2
-#endif
.type _generic_read_RGBA_span_BGRA8888_REV_SSE2, @function
_generic_read_RGBA_span_BGRA8888_REV_SSE2:
pushl %esi
@@ -500,9 +494,7 @@ _generic_read_RGBA_span_BGRA8888_REV_SSE2:
.text
.globl _generic_read_RGBA_span_RGB565_MMX
-#ifndef USE_DRICORE
.hidden _generic_read_RGBA_span_RGB565_MMX
-#endif
.type _generic_read_RGBA_span_RGB565_MMX, @function
_generic_read_RGBA_span_RGB565_MMX: