aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-22 08:35:52 +0200
committermarha <marha@users.sourceforge.net>2012-06-22 08:35:52 +0200
commit2cb91952f6e94907b3614535edbfc3f979085694 (patch)
tree6d11e620b1c10564f344d469a5d730e1df7fbb90 /mesalib/src/mesa
parent7ec34a94883810e9f4a8e417f00300c2c31808b0 (diff)
parente1a407256a5c1571d8f4871fd981a51cfbd46e37 (diff)
downloadvcxsrv-2cb91952f6e94907b3614535edbfc3f979085694.tar.gz
vcxsrv-2cb91952f6e94907b3614535edbfc3f979085694.tar.bz2
vcxsrv-2cb91952f6e94907b3614535edbfc3f979085694.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/gen/.gitignore
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/.gitignore6
-rw-r--r--mesalib/src/mesa/Makefile238
-rw-r--r--mesalib/src/mesa/Makefile.am107
-rw-r--r--mesalib/src/mesa/Makefile.old82
-rw-r--r--mesalib/src/mesa/drivers/.gitignore1
-rw-r--r--mesalib/src/mesa/drivers/Makefile29
-rw-r--r--mesalib/src/mesa/drivers/Makefile.am22
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am1
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile.am1
-rw-r--r--mesalib/src/mesa/gl.pc.in8
-rw-r--r--mesalib/src/mesa/main/api_exec.c12
-rw-r--r--mesalib/src/mesa/main/bufferobj.c240
-rw-r--r--mesalib/src/mesa/main/bufferobj.h10
-rw-r--r--mesalib/src/mesa/main/context.c9
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/get.c60
-rw-r--r--mesalib/src/mesa/main/mtypes.h41
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c66
-rw-r--r--mesalib/src/mesa/main/transformfeedback.h15
-rw-r--r--mesalib/src/mesa/osmesa.pc.in8
-rw-r--r--mesalib/src/mesa/x86/.gitignore3
-rw-r--r--mesalib/src/mesa/x86/Makefile46
-rw-r--r--mesalib/src/mesa/x86/Makefile.am39
23 files changed, 647 insertions, 399 deletions
diff --git a/mesalib/src/mesa/.gitignore b/mesalib/src/mesa/.gitignore
index ce83eaf47..5fc607b9e 100644
--- a/mesalib/src/mesa/.gitignore
+++ b/mesalib/src/mesa/.gitignore
@@ -1,5 +1 @@
-*/gen_matypes
-*/matypes.h
-depend.es*
-depend.es*
-objs-es*
+/Makefile
diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile
deleted file mode 100644
index b0b461fdd..000000000
--- a/mesalib/src/mesa/Makefile
+++ /dev/null
@@ -1,238 +0,0 @@
-# src/mesa/Makefile
-
-TOP = ../..
-include $(TOP)/configs/current
-
-MESA_LIBS := libmesa.a libmesagallium.a
-DEPENDS := depend
-
-SRCDIR = .
-include sources.mak
-
-# define preprocessor flags
-MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
-
-# append include dirs
-MESA_CPPFLAGS += $(INCLUDE_DIRS)
-
-# tidy compiler flags
-CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
-CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
-
-# LLVM is needed for the state tracker
-MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS)
-MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)
-
-%.o: %.c
- $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
-
-%.o: %.cpp
- $(CXX) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CXXFLAGS)
-
-%.o: %.S
- $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
-
-# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
-# then convenience libs (.a) and finally the device drivers:
-default: $(DEPENDS) asm_subdirs $(MESA_LIBS) driver_subdirs
-
-.PHONY: main/git_sha1.h.tmp
-main/git_sha1.h.tmp:
- @touch main/git_sha1.h.tmp
- @if test -d ../../.git; then \
- if which git > /dev/null; then \
- git log -n 1 --oneline | \
- sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
- > main/git_sha1.h.tmp ; \
- fi \
- fi
-
-main/git_sha1.h: main/git_sha1.h.tmp
- @echo "updating main/git_sha1.h"
- @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
- mv main/git_sha1.h.tmp main/git_sha1.h ;\
- fi
-
-# include glapi_gen.mk for generating glapi headers for GLES
-GLAPI := $(TOP)/src/mapi/glapi/gen
-include $(GLAPI)/glapi_gen.mk
-
-BUILT_SOURCES = \
- main/api_exec_es1_dispatch.h \
- main/api_exec_es1_remap_helper.h \
- main/api_exec_es2_dispatch.h \
- main/api_exec_es2_remap_helper.h \
- main/api_exec_es1.c \
- main/api_exec_es2.c \
- program/program_parse.tab.c \
- program/program_parse.tab.h \
- program/lex.yy.c
-
-main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
- $(call glapi_gen_dispatch,$<,es1)
-
-main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
- $(call glapi_gen_remap,$<,es1)
-
-main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
-
-main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
- $(call glapi_gen_dispatch,$<,es2)
-
-main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
- $(call glapi_gen_remap,$<,es2)
-
-main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
-
-main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
- $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
-
-main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
- $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
-
-program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
- $(BISON) -v -d --output=program/program_parse.tab.c $<
-
-program/lex.yy.c: program/program_lexer.l
- $(FLEX) --never-interactive --outfile=$@ $<
-
-ifneq (,$(DRICORE_LIBS))
-DRICORE_TARGET = dricore
-DRICORE_INSTALL_TARGET = install-dricore
-endif
-
-######################################################################
-# Helper libraries used by many drivers:
-
-# Make archive of core mesa object files
-libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
- @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
-
-# Make archive of subset of core mesa object files for gallium
-libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
- @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
-
-dricore: $(BUILT_SOURCES)
- @ (cd libdricore && $(MAKE))
-
-######################################################################
-# Device drivers
-driver_subdirs: $(MESA_LIBS) $(DRICORE_TARGET)
- @ (cd drivers && $(MAKE))
-
-
-######################################################################
-# Assembly subdirs
-asm_subdirs:
- @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
- (cd x86 && $(MAKE)) || exit 1 ; \
- fi
- @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
- (cd x86 && $(MAKE)) || exit 1 ; \
- (cd x86-64 && $(MAKE)) || exit 1 ; \
- fi
-
-######################################################################
-# Dependency generation
-
-depend: $(ALL_FILES) main/git_sha1.h
- @ echo "running $(MKDEP)"
- @ touch depend
- @$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \
- $(ALL_FILES) > /dev/null 2>/dev/null
-
-######################################################################
-# Installation rules
-
-# this isn't fleshed out yet but is probably the way to go in the future
-new_install:
- (cd drivers && $(MAKE) install)
-
-# XXX replace this with new_install above someday
-install: default $(DRICORE_INSTALL_TARGET)
- @for driver in $(DRIVER_DIRS) ; do \
- case "$$driver" in \
- osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
- $(MAKE) install-headers install-osmesa || exit 1 ; \
- else \
- $(MAKE) install-osmesa || exit 1 ; \
- fi ;; \
- dri) $(MAKE) install-libgl-pc install-dri || exit 1 ;; \
- *) $(MAKE) install-libgl-pc install-libgl || exit 1 ;; \
- esac ; \
- done
-
-pcedit = \
- -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
- -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
- -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
- -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-
-
-gl_pcedit = sed \
- $(pcedit) \
- -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
- -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
- -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
- -e 's,@GLX_TLS@,$(GLX_TLS),' \
- -e 's,@GL_LIB@,$(GL_LIB),'
-
-gl.pc: gl.pc.in
- $(gl_pcedit) $< > $@
-
-osmesa_pcedit = sed \
- $(pcedit) \
- -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
- -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
- -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
-
-osmesa.pc: osmesa.pc.in
- $(osmesa_pcedit) $< > $@
-
-install-headers:
- $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
- $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
- $(DESTDIR)$(INSTALL_INC_DIR)/GL
-
-install-libgl: default
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
- $(DESTDIR)$(INSTALL_LIB_DIR)
-
-install-libgl-pc: gl.pc install-headers
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
- $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-
-install-osmesa: default osmesa.pc
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
- $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
- $(DESTDIR)$(INSTALL_LIB_DIR)
- $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
-
-install-dri: default
- cd drivers/dri && $(MAKE) install
-
-install-dricore: default
- @ (cd libdricore && $(MAKE) install)
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
-
-clean:
- -rm -f */*.o
- -rm -f */*/*.o
- -rm -f depend depend.bak libmesa.a libmesagallium.a
- -rm -f drivers/*/*.o
- -rm -f *.pc
- -rm -f $(BUILT_SOURCES)
- -@cd drivers/dri && $(MAKE) clean
- -@cd drivers/x11 && $(MAKE) clean
- -@cd drivers/osmesa && $(MAKE) clean
- -@cd x86 && $(MAKE) clean
- -@cd x86-64 && $(MAKE) clean
- -@cd libdricore && $(MAKE) clean
-
-
--include $(DEPENDS)
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
new file mode 100644
index 000000000..e52678d58
--- /dev/null
+++ b/mesalib/src/mesa/Makefile.am
@@ -0,0 +1,107 @@
+# Copyright © 2012 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.
+
+SUBDIRS = x86 x86-64 . libdricore drivers
+
+gldir = $(includedir)/GL
+gl_HEADERS = $(top_srcdir)/include/GL/*.h
+
+.PHONY: main/git_sha1.h.tmp
+main/git_sha1.h.tmp:
+ @touch main/git_sha1.h.tmp
+ @if test -d ../../.git; then \
+ if which git > /dev/null; then \
+ git log -n 1 --oneline | \
+ sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
+ > main/git_sha1.h.tmp ; \
+ fi \
+ fi
+
+main/git_sha1.h: main/git_sha1.h.tmp
+ @echo "updating main/git_sha1.h"
+ @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
+ mv main/git_sha1.h.tmp main/git_sha1.h ;\
+ fi
+
+# include glapi_gen.mk for generating glapi headers for GLES
+TOP = $(top_srcdir)
+GLAPI = $(TOP)/src/mapi/glapi/gen
+include $(GLAPI)/glapi_gen.mk
+
+BUILT_SOURCES = \
+ main/git_sha1.h \
+ main/api_exec_es1_dispatch.h \
+ main/api_exec_es1_remap_helper.h \
+ main/api_exec_es2_dispatch.h \
+ main/api_exec_es2_remap_helper.h \
+ main/api_exec_es1.c \
+ main/api_exec_es2.c \
+ program/program_parse.tab.c \
+ program/program_parse.tab.h \
+ program/lex.yy.c
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ git_sha1.h.tmp
+
+main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
+ $(call glapi_gen_dispatch,$<,es1)
+
+main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
+ $(call glapi_gen_remap,$<,es1)
+
+main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
+
+main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
+ $(call glapi_gen_dispatch,$<,es2)
+
+main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
+ $(call glapi_gen_remap,$<,es2)
+
+main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
+
+main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+ $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
+
+main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+ $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
+
+program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
+ $(YACC) -v -d --output=program/program_parse.tab.c $<
+
+program/lex.yy.c: program/program_lexer.l
+ $(LEX) --never-interactive --outfile=$@ $<
+
+all-local:
+ $(MAKE) -f Makefile.old
+
+install-exec-local:
+ $(MAKE) -f Makefile.old install
+
+clean-local:
+ $(MAKE) -f Makefile.old clean
+
+pkgconfigdir = $(libdir)/pkgconfig
+
+if HAVE_OSMESA_DRIVER
+pkgconfig_DATA = osmesa.pc
+else
+pkgconfig_DATA = gl.pc
+endif
diff --git a/mesalib/src/mesa/Makefile.old b/mesalib/src/mesa/Makefile.old
new file mode 100644
index 000000000..4ea70d43d
--- /dev/null
+++ b/mesalib/src/mesa/Makefile.old
@@ -0,0 +1,82 @@
+# src/mesa/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+MESA_LIBS := libmesa.a libmesagallium.a
+DEPENDS := depend
+
+SRCDIR = .
+include sources.mak
+
+# define preprocessor flags
+MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
+
+# append include dirs
+MESA_CPPFLAGS += $(INCLUDE_DIRS)
+
+# tidy compiler flags
+CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
+CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
+
+# LLVM is needed for the state tracker
+MESA_CFLAGS := $(LLVM_CFLAGS) $(CFLAGS)
+MESA_CXXFLAGS := $(LLVM_CFLAGS) $(CXXFLAGS)
+
+%.o: %.c
+ $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
+
+%.o: %.cpp
+ $(CXX) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CXXFLAGS)
+
+%.o: %.S
+ $(CC) -c -o $@ $< $(MESA_CPPFLAGS) $(MESA_CFLAGS)
+
+# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
+# then convenience libs (.a) and finally the device drivers:
+default: $(DEPENDS) $(MESA_LIBS)
+
+######################################################################
+# Helper libraries used by many drivers:
+
+# Make archive of core mesa object files
+libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
+ @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
+
+# Make archive of subset of core mesa object files for gallium
+libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
+ @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
+
+######################################################################
+# Dependency generation
+
+depend: $(ALL_FILES) main/git_sha1.h
+ @ echo "running $(MKDEP)"
+ @ touch depend
+ @$(MKDEP) $(MKDEP_OPTIONS) $(MESA_CPPFLAGS) \
+ $(ALL_FILES) > /dev/null 2>/dev/null
+
+######################################################################
+# Installation rules
+
+install: default $(DRICORE_INSTALL_TARGET)
+ @for driver in $(DRIVER_DIRS) ; do \
+ case "$$driver" in \
+ osmesa) $(MAKE) -f Makefile.old install-osmesa || exit 1 ;; \
+ esac ; \
+ done
+
+install-osmesa: default
+ $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
+ $(DESTDIR)$(INSTALL_LIB_DIR)
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
+
+clean:
+ -rm -f */*.o
+ -rm -f */*/*.o
+ -rm -f depend depend.bak libmesa.a libmesagallium.a
+
+-include $(DEPENDS)
diff --git a/mesalib/src/mesa/drivers/.gitignore b/mesalib/src/mesa/drivers/.gitignore
new file mode 100644
index 000000000..5fc607b9e
--- /dev/null
+++ b/mesalib/src/mesa/drivers/.gitignore
@@ -0,0 +1 @@
+/Makefile
diff --git a/mesalib/src/mesa/drivers/Makefile b/mesalib/src/mesa/drivers/Makefile
deleted file mode 100644
index c5998413e..000000000
--- a/mesalib/src/mesa/drivers/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-# src/mesa/drivers/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-default:
- @for dir in $(DRIVER_DIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE)) || exit 1; \
- fi \
- done
-
-
-clean:
- @for dir in $(DRIVER_DIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) clean) || exit 1; \
- fi \
- done
-
-
-install:
- @for dir in $(DRIVER_DIRS) ; do \
- if [ -d $$dir ] ; then \
- (cd $$dir && $(MAKE) install) || exit 1; \
- fi \
- done
-
diff --git a/mesalib/src/mesa/drivers/Makefile.am b/mesalib/src/mesa/drivers/Makefile.am
new file mode 100644
index 000000000..1bc74eadf
--- /dev/null
+++ b/mesalib/src/mesa/drivers/Makefile.am
@@ -0,0 +1,22 @@
+# Copyright © 2012 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.
+
+SUBDIRS = $(DRIVER_DIRS)
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index 27c3e3d42..d81bc0e3f 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -25,7 +25,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mapi \
-I$(top_srcdir)/src/mesa/ \
$(DEFINES) \
- $(ASM_FLAGS) \
$(API_DEFINES) \
$(LIBDRM_CFLAGS)
diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
index 3dc7c1044..16a34413b 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am
@@ -34,7 +34,6 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/mesa/ \
-I$(top_srcdir)/src/mesa/drivers/dri/common \
$(DEFINES) \
- $(ASM_FLAGS) \
$(API_DEFINES)
dridir = $(DRI_DRIVER_INSTALL_DIR)
diff --git a/mesalib/src/mesa/gl.pc.in b/mesalib/src/mesa/gl.pc.in
index 2d3bc917e..181724b97 100644
--- a/mesalib/src/mesa/gl.pc.in
+++ b/mesalib/src/mesa/gl.pc.in
@@ -1,12 +1,12 @@
-prefix=@INSTALL_DIR@
+prefix=@prefix@
exec_prefix=${prefix}
-libdir=@INSTALL_LIB_DIR@
-includedir=@INSTALL_INC_DIR@
+libdir=@libdir@
+includedir=@includedir@
Name: gl
Description: Mesa OpenGL library
Requires.private: @GL_PC_REQ_PRIV@
-Version: @VERSION@
+Version: @PACKAGE_VERSION@
Libs: -L${libdir} -l@GL_LIB@
Libs.private: @GL_PC_LIB_PRIV@
Cflags: -I${includedir} @GL_PC_CFLAGS@
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 15b9f6974..19e7f9807 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -579,17 +579,7 @@ _mesa_create_exec_table(void)
#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
- SET_BindBufferARB(exec, _mesa_BindBufferARB);
- SET_BufferDataARB(exec, _mesa_BufferDataARB);
- SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
- SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
- SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
- SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
- SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
- SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
- SET_IsBufferARB(exec, _mesa_IsBufferARB);
- SET_MapBufferARB(exec, _mesa_MapBufferARB);
- SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
+ _mesa_init_bufferobj_dispatch(exec);
/* ARB 29. GL_ARB_occlusion_query */
_mesa_init_queryobj_dispatch(exec);
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 3f7db8605..8b69ca3a1 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -43,6 +43,7 @@
#include "mtypes.h"
#include "texobj.h"
#include "transformfeedback.h"
+#include "dispatch.h"
/* Debug flags */
@@ -92,6 +93,11 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
return &ctx->Texture.BufferObject;
}
break;
+ case GL_UNIFORM_BUFFER:
+ if (ctx->Extensions.ARB_uniform_buffer_object) {
+ return &ctx->UniformBuffer;
+ }
+ break;
default:
return NULL;
}
@@ -598,6 +604,8 @@ _mesa_copy_buffer_subdata(struct gl_context *ctx,
void
_mesa_init_buffer_objects( struct gl_context *ctx )
{
+ GLuint i;
+
memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
_glthread_INIT_MUTEX(DummyBufferObject.Mutex);
DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
@@ -609,16 +617,43 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
ctx->Shared->NullBufferObj);
_mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer,
ctx->Shared->NullBufferObj);
+
+ ctx->UniformBufferBindings = calloc(ctx->Const.MaxUniformBufferBindings,
+ sizeof(*ctx->UniformBufferBindings));
+
+ _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer,
+ ctx->Shared->NullBufferObj);
+
+ for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) {
+ _mesa_reference_buffer_object(ctx,
+ &ctx->UniformBufferBindings[i].BufferObject,
+ ctx->Shared->NullBufferObj);
+ ctx->UniformBufferBindings[i].Offset = -1;
+ ctx->UniformBufferBindings[i].Size = -1;
+ }
}
void
_mesa_free_buffer_objects( struct gl_context *ctx )
{
+ GLuint i;
+
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
_mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL);
_mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL);
+
+ _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, NULL);
+
+ for (i = 0; i < ctx->Const.MaxUniformBufferBindings; i++) {
+ _mesa_reference_buffer_object(ctx,
+ &ctx->UniformBufferBindings[i].BufferObject,
+ NULL);
+ }
+
+ free(ctx->UniformBufferBindings);
+ ctx->UniformBufferBindings = NULL;
}
@@ -840,6 +875,10 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
}
}
+ if (ctx->UniformBuffer == bufObj) {
+ _mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 );
+ }
+
/* unbind any pixel pack/unpack pointers bound to this buffer */
if (ctx->Pack.BufferObj == bufObj) {
_mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
@@ -1954,3 +1993,204 @@ _mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname,
}
#endif /* FEATURE_APPLE_object_purgeable */
+
+static void
+set_ubo_binding(struct gl_context *ctx,
+ int index,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset,
+ GLsizeiptr size,
+ GLboolean autoSize)
+{
+ struct gl_uniform_buffer_binding *binding;
+
+ binding = &ctx->UniformBufferBindings[index];
+ if (binding->BufferObject == bufObj &&
+ binding->Offset == offset &&
+ binding->Size == size &&
+ binding->AutomaticSize == autoSize) {
+ return;
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
+
+ _mesa_reference_buffer_object(ctx, &binding->BufferObject, bufObj);
+ binding->Offset = offset;
+ binding->Size = size;
+ binding->AutomaticSize = autoSize;
+}
+
+/**
+ * Specify a buffer object to receive vertex shader results. Plus,
+ * specify the starting offset to place the results, and max size.
+ */
+static void
+bind_buffer_range_uniform_buffer(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ if (index >= ctx->Const.MaxUniformBufferBindings) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d)", index);
+ return;
+ }
+
+ if (offset & (ctx->Const.UniformBufferOffsetAlignment - 1)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferRange(offset misalgned %d/%d)", (int) offset,
+ ctx->Const.UniformBufferOffsetAlignment);
+ return;
+ }
+
+ if (bufObj == ctx->Shared->NullBufferObj) {
+ offset = -1;
+ size = -1;
+ }
+
+ _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
+ set_ubo_binding(ctx, index, bufObj, offset, size, GL_FALSE);
+}
+
+
+/**
+ * Specify a buffer object to receive vertex shader results.
+ * As above, but start at offset = 0.
+ */
+static void
+bind_buffer_base_uniform_buffer(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj)
+{
+ if (index >= ctx->Const.MaxUniformBufferBindings) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferBase(index=%d)", index);
+ return;
+ }
+
+ _mesa_reference_buffer_object(ctx, &ctx->UniformBuffer, bufObj);
+ if (bufObj == ctx->Shared->NullBufferObj)
+ set_ubo_binding(ctx, index, bufObj, -1, -1, GL_TRUE);
+ else
+ set_ubo_binding(ctx, index, bufObj, 0, 0, GL_TRUE);
+}
+
+void GLAPIENTRY
+_mesa_BindBufferRange(GLenum target, GLuint index,
+ GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ if (buffer == 0) {
+ bufObj = ctx->Shared->NullBufferObj;
+ } else {
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ }
+
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferRange(invalid buffer=%u)", buffer);
+ return;
+ }
+
+ if (size <= 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)",
+ (int) size);
+ return;
+ }
+
+ if (offset + size > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glBindBufferRange(offset + size %d > buffer size %d)",
+ (int) (offset + size), (int) (bufObj->Size));
+ return;
+ }
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ _mesa_bind_buffer_range_transform_feedback(ctx, index, bufObj,
+ offset, size);
+ return;
+ case GL_UNIFORM_BUFFER:
+ bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size);
+ return;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)");
+ return;
+ }
+}
+
+void GLAPIENTRY
+_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ if (buffer == 0) {
+ bufObj = ctx->Shared->NullBufferObj;
+ } else {
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ }
+
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindBufferBase(invalid buffer=%u)", buffer);
+ return;
+ }
+
+ /* Note that there's some oddness in the GL 3.1-GL 3.3 specifications with
+ * regards to BindBufferBase. It says (GL 3.1 core spec, page 63):
+ *
+ * "BindBufferBase is equivalent to calling BindBufferRange with offset
+ * zero and size equal to the size of buffer."
+ *
+ * but it says for glGetIntegeri_v (GL 3.1 core spec, page 230):
+ *
+ * "If the parameter (starting offset or size) was not specified when the
+ * buffer object was bound, zero is returned."
+ *
+ * What happens if the size of the buffer changes? Does the size of the
+ * buffer at the moment glBindBufferBase was called still play a role, like
+ * the first quote would imply, or is the size meaningless in the
+ * glBindBufferBase case like the second quote would suggest? The GL 4.1
+ * core spec page 45 says:
+ *
+ * "It is equivalent to calling BindBufferRange with offset zero, while
+ * size is determined by the size of the bound buffer at the time the
+ * binding is used."
+ *
+ * My interpretation is that the GL 4.1 spec was a clarification of the
+ * behavior, not a change. In particular, this choice will only make
+ * rendering work in cases where it would have had undefined results.
+ */
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ _mesa_bind_buffer_base_transform_feedback(ctx, index, bufObj);
+ return;
+ case GL_UNIFORM_BUFFER:
+ bind_buffer_base_uniform_buffer(ctx, index, bufObj);
+ return;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)");
+ return;
+ }
+}
+
+void
+_mesa_init_bufferobj_dispatch(struct _glapi_table *disp)
+{
+ SET_BindBufferARB(disp, _mesa_BindBufferARB);
+ SET_BufferDataARB(disp, _mesa_BufferDataARB);
+ SET_BufferSubDataARB(disp, _mesa_BufferSubDataARB);
+ SET_DeleteBuffersARB(disp, _mesa_DeleteBuffersARB);
+ SET_GenBuffersARB(disp, _mesa_GenBuffersARB);
+ SET_GetBufferParameterivARB(disp, _mesa_GetBufferParameterivARB);
+ SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB);
+ SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
+ SET_IsBufferARB(disp, _mesa_IsBufferARB);
+ SET_MapBufferARB(disp, _mesa_MapBufferARB);
+ SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB);
+ SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
+ SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+}
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index 66343c3cd..e1d0f7a97 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -159,4 +159,14 @@ extern void GLAPIENTRY
_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint* params);
#endif
+void GLAPIENTRY
+_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer);
+
+void GLAPIENTRY
+_mesa_BindBufferRange(GLenum target, GLuint index,
+ GLuint buffer, GLintptr offset, GLsizeiptr size);
+
+extern void
+_mesa_init_bufferobj_dispatch(struct _glapi_table *disp);
+
#endif
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 3bcedecd9..643476b94 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -542,6 +542,9 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->MediumInt.RangeMax = 24;
prog->MediumInt.Precision = 0;
prog->LowInt = prog->HighInt = prog->MediumInt;
+
+ prog->MaxUniformBlocks = 12;
+ prog->MaxCombinedUniformComponents = prog->MaxUniformComponents;
}
@@ -653,6 +656,12 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxTransformFeedbackSeparateComponents = 4 * MAX_FEEDBACK_ATTRIBS;
ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS;
+ /** GL_ARB_uniform_buffer_object */
+ ctx->Const.MaxCombinedUniformBlocks = 36;
+ ctx->Const.MaxUniformBufferBindings = 36;
+ ctx->Const.MaxUniformBlockSize = 16384;
+ ctx->Const.UniformBufferOffsetAlignment = 1;
+
/* GL 3.2: hard-coded for now: */
ctx->Const.ProfileMask = GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 079316145..e4fe73307 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -141,7 +141,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), GL, 2008 },
{ "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 },
{ "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 },
- { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2002 },
+ { "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 },
{ "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 },
{ "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), GL, 2006 },
{ "GL_ARB_vertex_buffer_object", o(dummy_true), GL, 2003 },
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 8dc47306f..67732521c 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -289,6 +289,12 @@ static const int extra_ARB_sampler_objects[] = {
EXTRA_END
};
+static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
+ EXT(ARB_uniform_buffer_object),
+ EXT(ARB_geometry_shader4),
+ EXTRA_END
+};
+
EXTRA_EXT(ARB_ES2_compatibility);
EXTRA_EXT(ARB_texture_cube_map);
@@ -335,6 +341,7 @@ EXTRA_EXT(EXT_framebuffer_sRGB);
EXTRA_EXT(ARB_texture_buffer_object);
EXTRA_EXT(OES_EGL_image_external);
EXTRA_EXT(ARB_blend_func_extended);
+EXTRA_EXT(ARB_uniform_buffer_object);
static const int
extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
@@ -1321,6 +1328,31 @@ static const struct value_desc values[] = {
{ GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended },
+ /* GL_ARB_uniform_buffer_object */
+ { GL_MAX_VERTEX_UNIFORM_BLOCKS, CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_FRAGMENT_UNIFORM_BLOCKS, CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_GEOMETRY_UNIFORM_BLOCKS, CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks),
+ extra_ARB_uniform_buffer_object_and_geometry_shader },
+ { GL_MAX_COMBINED_UNIFORM_BLOCKS, CONTEXT_INT(Const.MaxCombinedUniformBlocks),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_UNIFORM_BLOCK_SIZE, CONTEXT_INT(Const.MaxUniformBlockSize),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_UNIFORM_BUFFER_BINDINGS, CONTEXT_INT(Const.MaxUniformBufferBindings),
+ extra_ARB_uniform_buffer_object },
+
+ { GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents),
+ extra_ARB_uniform_buffer_object },
+ { GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents),
+ extra_ARB_uniform_buffer_object_and_geometry_shader },
+ { GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, CONTEXT_INT(Const.UniformBufferOffsetAlignment),
+ extra_ARB_uniform_buffer_object },
+
+ { GL_UNIFORM_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object },
+
#endif /* FEATURE_GL */
};
@@ -1771,6 +1803,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_int = samp ? samp->Name : 0;
}
break;
+ /* GL_ARB_uniform_buffer_object */
+ case GL_UNIFORM_BUFFER_BINDING:
+ v->value_int = ctx->UniformBuffer->Name;
+ break;
}
}
@@ -2530,6 +2566,30 @@ find_value_indexed(const char *func, GLenum pname, int index, union value *v)
goto invalid_enum;
v->value_int = ctx->TransformFeedback.CurrentObject->BufferNames[index];
return TYPE_INT;
+
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= ctx->Const.MaxUniformBufferBindings)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_uniform_buffer_object)
+ goto invalid_enum;
+ v->value_int = ctx->UniformBufferBindings[index].BufferObject->Name;
+ return TYPE_INT;
+
+ case GL_UNIFORM_BUFFER_START:
+ if (index >= ctx->Const.MaxUniformBufferBindings)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_uniform_buffer_object)
+ goto invalid_enum;
+ v->value_int = ctx->UniformBufferBindings[index].Offset;
+ return TYPE_INT;
+
+ case GL_UNIFORM_BUFFER_SIZE:
+ if (index >= ctx->Const.MaxUniformBufferBindings)
+ goto invalid_value;
+ if (!ctx->Extensions.ARB_uniform_buffer_object)
+ goto invalid_enum;
+ v->value_int = ctx->UniformBufferBindings[index].Size;
+ return TYPE_INT;
}
invalid_enum:
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index d52ab151a..def0db1aa 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2709,6 +2709,9 @@ struct gl_program_constants
/* ES 2.0 and GL_ARB_ES2_compatibility */
struct gl_precision LowFloat, MediumFloat, HighFloat;
struct gl_precision LowInt, MediumInt, HighInt;
+ /* GL_ARB_uniform_buffer_object */
+ GLuint MaxUniformBlocks;
+ GLuint MaxCombinedUniformComponents;
};
@@ -2774,6 +2777,15 @@ struct gl_constants
GLuint MaxVertexVaryingComponents; /**< Between vert and geom shader */
GLuint MaxGeometryVaryingComponents; /**< Between geom and frag shader */
+ /** @{
+ * GL_ARB_uniform_buffer_object
+ */
+ GLuint MaxCombinedUniformBlocks;
+ GLuint MaxUniformBufferBindings;
+ GLuint MaxUniformBlockSize;
+ GLuint UniformBufferOffsetAlignment;
+ /** @} */
+
/** GL_ARB_geometry_shader4 */
GLuint MaxGeometryOutputVertices;
GLuint MaxGeometryTotalOutputComponents;
@@ -3283,6 +3295,20 @@ struct gl_driver_flags
GLbitfield NewArray; /**< Vertex array state */
};
+struct gl_uniform_buffer_binding
+{
+ struct gl_buffer_object *BufferObject;
+ /** Start of uniform block data in the buffer */
+ GLintptr Offset;
+ /** Size of data allowed to be referenced from the buffer (in bytes) */
+ GLsizeiptr Size;
+ /**
+ * glBindBufferBase() indicates that the Size should be ignored and only
+ * limited by the current size of the BufferObject.
+ */
+ GLboolean AutomaticSize;
+};
+
/**
* Mesa rendering context.
*
@@ -3418,6 +3444,21 @@ struct gl_context
struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */
struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */
+
+ /**
+ * Current GL_ARB_uniform_buffer_object binding referenced by
+ * GL_UNIFORM_BUFFER target for glBufferData, glMapBuffer, etc.
+ */
+ struct gl_buffer_object *UniformBuffer;
+
+ /**
+ * Array of uniform buffers for GL_ARB_uniform_buffer_object and GL 3.1.
+ * This is set up using glBindBufferRange() or glBindBufferBase(). They are
+ * associated with uniform blocks by glUniformBlockBinding()'s state in the
+ * shader program.
+ */
+ struct gl_uniform_buffer_binding *UniformBufferBindings;
+
/*@}*/
struct gl_meta_state *Meta; /**< for "meta" operations */
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index 1bd76d130..84c409185 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -291,8 +291,6 @@ _mesa_init_transform_feedback_dispatch(struct _glapi_table *disp)
/* EXT_transform_feedback */
SET_BeginTransformFeedbackEXT(disp, _mesa_BeginTransformFeedback);
SET_EndTransformFeedbackEXT(disp, _mesa_EndTransformFeedback);
- SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
- SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
SET_BindBufferOffsetEXT(disp, _mesa_BindBufferOffsetEXT);
SET_TransformFeedbackVaryingsEXT(disp, _mesa_TransformFeedbackVaryings);
SET_GetTransformFeedbackVaryingEXT(disp, _mesa_GetTransformFeedbackVarying);
@@ -431,18 +429,14 @@ bind_buffer_range(struct gl_context *ctx, GLuint index,
* Specify a buffer object to receive vertex shader results. Plus,
* specify the starting offset to place the results, and max size.
*/
-void GLAPIENTRY
-_mesa_BindBufferRange(GLenum target, GLuint index,
- GLuint buffer, GLintptr offset, GLsizeiptr size)
+void
+_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset,
+ GLsizeiptr size)
{
struct gl_transform_feedback_object *obj;
- struct gl_buffer_object *bufObj;
- GET_CURRENT_CONTEXT(ctx);
-
- if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferRange(target)");
- return;
- }
obj = ctx->TransformFeedback.CurrentObject;
@@ -457,8 +451,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
return;
}
- if ((size <= 0) || (size & 0x3)) {
- /* must be positive and multiple of four */
+ if (size & 0x3) {
+ /* must a multiple of four */
_mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)", (int) size);
return;
}
@@ -470,25 +464,6 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
return;
}
- if (buffer == 0) {
- bufObj = ctx->Shared->NullBufferObj;
- } else {
- bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- }
-
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferRange(invalid buffer=%u)", buffer);
- return;
- }
-
- if (offset + size > bufObj->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glBindBufferRange(offset + size %d > buffer size %d)",
- (int) (offset + size), (int) (bufObj->Size));
- return;
- }
-
bind_buffer_range(ctx, index, bufObj, offset, size);
}
@@ -497,18 +472,13 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
* Specify a buffer object to receive vertex shader results.
* As above, but start at offset = 0.
*/
-void GLAPIENTRY
-_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+void
+_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj)
{
struct gl_transform_feedback_object *obj;
- struct gl_buffer_object *bufObj;
GLsizeiptr size;
- GET_CURRENT_CONTEXT(ctx);
-
- if (target != GL_TRANSFORM_FEEDBACK_BUFFER) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferBase(target)");
- return;
- }
obj = ctx->TransformFeedback.CurrentObject;
@@ -523,18 +493,6 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
return;
}
- if (buffer == 0) {
- bufObj = ctx->Shared->NullBufferObj;
- } else {
- bufObj = _mesa_lookup_bufferobj(ctx, buffer);
- }
-
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindBufferBase(invalid buffer=%u)", buffer);
- return;
- }
-
/* default size is the buffer size rounded down to nearest
* multiple of four.
*/
diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h
index 7d63de017..85f4cbc77 100644
--- a/mesalib/src/mesa/main/transformfeedback.h
+++ b/mesalib/src/mesa/main/transformfeedback.h
@@ -60,12 +60,17 @@ _mesa_BeginTransformFeedback(GLenum mode);
extern void GLAPIENTRY
_mesa_EndTransformFeedback(void);
-extern void GLAPIENTRY
-_mesa_BindBufferRange(GLenum target, GLuint index,
- GLuint buffer, GLintptr offset, GLsizeiptr size);
+extern void
+_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj,
+ GLintptr offset,
+ GLsizeiptr size);
-extern void GLAPIENTRY
-_mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer);
+extern void
+_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,
+ GLuint index,
+ struct gl_buffer_object *bufObj);
extern void GLAPIENTRY
_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer,
diff --git a/mesalib/src/mesa/osmesa.pc.in b/mesalib/src/mesa/osmesa.pc.in
index 05327f40a..307255ffc 100644
--- a/mesalib/src/mesa/osmesa.pc.in
+++ b/mesalib/src/mesa/osmesa.pc.in
@@ -1,12 +1,12 @@
-prefix=@INSTALL_DIR@
+prefix=@prefix@
exec_prefix=${prefix}
-libdir=@INSTALL_LIB_DIR@
-includedir=@INSTALL_INC_DIR@
+libdir=@libdir@
+includedir=@includedir@
Name: osmesa
Description: Mesa Off-screen Rendering library
Requires: @OSMESA_PC_REQ@
-Version: @VERSION@
+Version: @PACKAGE_VERSION@
Libs: -L${libdir} -l@OSMESA_LIB@
Libs.private: @OSMESA_PC_LIB_PRIV@
Cflags: -I${includedir}
diff --git a/mesalib/src/mesa/x86/.gitignore b/mesalib/src/mesa/x86/.gitignore
new file mode 100644
index 000000000..ba7486c0b
--- /dev/null
+++ b/mesalib/src/mesa/x86/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+gen_matypes
+matypes.h
diff --git a/mesalib/src/mesa/x86/Makefile b/mesalib/src/mesa/x86/Makefile
deleted file mode 100644
index 9716dc27f..000000000
--- a/mesalib/src/mesa/x86/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-# src/mesa/x86/Makefile
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include/GL \
- -I$(TOP)/include \
- -I$(TOP)/src/mapi \
- -I.. \
- -I../main \
- -I../math \
- -I../tnl
-
-
-default: gen_matypes matypes.h
-
-clean:
- -rm -f matypes.h gen_matypes
-
-
-gen_matypes: gen_matypes.c
- $(HOST_CC) $(ARCH_FLAGS) $(INCLUDE_DIRS) $(HOST_CFLAGS) gen_matypes.c -o gen_matypes
-
-# need some special rules here, unfortunately
-matypes.h: ../main/mtypes.h ../tnl/t_context.h gen_matypes
- ./gen_matypes > matypes.h
-
-common_x86_asm.o: matypes.h
-3dnow_normal.o: matypes.h
-3dnow_xform1.o: matypes.h
-3dnow_xform2.o: matypes.h
-3dnow_xform3.o: matypes.h
-3dnow_xform4.o: matypes.h
-mmx_blend.o: matypes.h
-sse_normal.o: matypes.h
-sse_xform1.o: matypes.h
-sse_xform2.o: matypes.h
-sse_xform3.o: matypes.h
-sse_xform4.o: matypes.h
-x86_cliptest.o: matypes.h
-x86_xform2.o: matypes.h
-x86_xform3.o: matypes.h
-x86_xform4.o: matypes.h
-
diff --git a/mesalib/src/mesa/x86/Makefile.am b/mesalib/src/mesa/x86/Makefile.am
new file mode 100644
index 000000000..f241de505
--- /dev/null
+++ b/mesalib/src/mesa/x86/Makefile.am
@@ -0,0 +1,39 @@
+# Copyright © 2012 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.
+
+if HAVE_X86_ASM
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir)/src/mesa \
+ -I$(top_srcdir)/src/mapi \
+ $(API_DEFINES) \
+ $(DEFINES)
+
+noinst_PROGRAMS = gen_matypes
+
+gen_matypes_SOURCES = gen_matypes.c
+BUILT_SOURCES = matypes.h
+CLEANFILES = matypes.h
+
+matypes.h: gen_matypes
+ $(AM_V_GEN)./gen_matypes > $@
+
+endif