Compare commits

..

7 Commits

Author SHA1 Message Date
Jordan Justen
85e97b18e0 mesa: don't enable legacy GL functions when using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
f2c8a8f550 intel: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
631566bd77 meta: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
7027b53956 glsl: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
b0396f5d7b mesa: add support for using API_OPENGL_CORE
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
cbc6974330 mesa: add api check macros
These macros make it easier to check for multiple API types.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:59 -07:00
Jordan Justen
f7a395f970 mesa: add API_OPENGL_CORE api
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2012-07-24 15:41:58 -07:00
946 changed files with 81575 additions and 30539 deletions

View File

@@ -40,16 +40,14 @@ LOCAL_CFLAGS += \
-DANDROID_VERSION=0x0$(major)0$(minor)
LOCAL_CFLAGS += \
-DHAVE_PTHREAD=1 \
-DPTHREADS \
-fvisibility=hidden \
-Wno-sign-compare
ifeq ($(strip $(MESA_ENABLE_ASM)),true)
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += \
-DUSE_X86_ASM \
-DHAVE_DLOPEN \
-DUSE_X86_ASM
endif
endif

View File

@@ -21,14 +21,11 @@
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
doxygen:
cd doxygen && $(MAKE)
check-local:
$(MAKE) -C src/mapi/glapi/tests check
$(MAKE) -C src/mapi/shared-glapi/tests check
$(MAKE) -C src/mesa/main/tests check
$(MAKE) -C src/glsl/tests check
$(MAKE) -C src/glx/tests check
@@ -54,22 +51,13 @@ distclean-local:
# Rules for making release tarballs
PACKAGE_VERSION=9.0.1
PACKAGE_VERSION=8.1-devel
PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
EXTRA_FILES = \
aclocal.m4 \
configure \
bin/ar-lib \
bin/compile \
bin/config.sub \
bin/config.guess \
bin/depcomp \
bin/install-sh \
bin/ltmain.sh \
bin/missing \
bin/ylwrap \
src/glsl/glsl_parser.cc \
src/glsl/glsl_parser.h \
src/glsl/glsl_lexer.cc \
@@ -84,56 +72,7 @@ EXTRA_FILES = \
src/mesa/main/api_exec_es2_remap_helper.h \
src/mesa/program/lex.yy.c \
src/mesa/program/program_parse.tab.c \
src/mesa/program/program_parse.tab.h \
src/gallium/drivers/r600/Makefile.in \
src/gallium/drivers/r300/Makefile.in \
src/gallium/drivers/Makefile.in \
src/gallium/Makefile.in \
src/gallium/auxiliary/pipe-loader/Makefile.in \
src/gallium/targets/opencl/Makefile.in \
src/gallium/state_trackers/clover/Makefile.in \
src/mapi/glapi/tests/Makefile.in \
src/mapi/glapi/Makefile.in \
src/mapi/glapi/gen/Makefile.in \
src/mapi/es1api/Makefile.in \
src/mapi/shared-glapi/tests/Makefile.in \
src/mapi/shared-glapi/Makefile.in \
src/mapi/vgapi/Makefile.in \
src/mapi/es2api/Makefile.in \
src/glsl/tests/Makefile.in \
src/glsl/glcpp/Makefile.in \
src/glsl/Makefile.in \
src/gtest/Makefile.in \
src/egl/drivers/Makefile.in \
src/egl/drivers/glx/Makefile.in \
src/egl/drivers/dri2/Makefile.in \
src/egl/Makefile.in \
src/egl/main/Makefile.in \
src/egl/wayland/Makefile.in \
src/egl/wayland/wayland-drm/Makefile.in \
src/egl/wayland/wayland-egl/Makefile.in \
src/Makefile.in \
src/glx/tests/Makefile.in \
src/glx/Makefile.in \
src/gbm/Makefile.in \
src/mesa/drivers/Makefile.in \
src/mesa/drivers/dri/common/Makefile.in \
src/mesa/drivers/dri/i965/Makefile.in \
src/mesa/drivers/dri/r200/Makefile.in \
src/mesa/drivers/dri/Makefile.in \
src/mesa/drivers/dri/radeon/Makefile.in \
src/mesa/drivers/dri/swrast/Makefile.in \
src/mesa/drivers/dri/nouveau/Makefile.in \
src/mesa/drivers/dri/i915/Makefile.in \
src/mesa/drivers/osmesa/Makefile.in \
src/mesa/drivers/x11/Makefile.in \
src/mesa/Makefile.in \
src/mesa/libdricore/Makefile.in \
src/mesa/x86-64/Makefile.in \
src/mesa/main/tests/Makefile.in \
src/mesa/x86/Makefile.in \
Makefile.in
src/mesa/program/program_parse.tab.h
IGNORE_FILES = \
-x autogen.sh

View File

@@ -3,11 +3,17 @@
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
SRCDIR=`(cd "$srcdir" && pwd)`
ORIGDIR=`pwd`
cd "$srcdir"
if test "x$SRCDIR" != "x$ORIGDIR"; then
echo "Mesa cannot be built when srcdir != builddir" 1>&2
exit 1
fi
MAKEFLAGS=""
autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?
if test -z "$NOCONFIGURE"; then
"$srcdir"/configure "$@"

View File

@@ -1,10 +0,0 @@
# These commits were cherry picked without using -x.
# TBD
# Causes too many regressions...
413c4914129cd26ca87960852d8c0264c0fb29e7 intel: Improve teximage perf for Google Chrome paint rects (v3)
b1d0fe022dc4826dadce014ab8fe062a82f75a16 intel: Fix segfault in intel_texsubimage_tiled_memcpy
b5891286202987dfc2606ac716050c0ee426de11 intel: Fix yet-another-bug in intel_texsubimage_tiled_memcpy
# Introduces performance regressions for other games... don't cherry-pick for now
fa58644855e44830e0b91dc627703c236fa6712a r600g: fix abysmal performance in Reaction Quake

View File

@@ -1,29 +0,0 @@
#!/bin/sh
# Script for generating a list of candidates for cherry-picking to a stable branch
# Grep for commits with "cherry picked from commit" in the commit message.
git log --reverse --grep="cherry picked from commit" origin/master..HEAD |\
grep "cherry picked from commit" |\
sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 's/)//' > already_picked
# Grep for commits that were marked as a candidate for the stable tree.
git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: This is a candidate' HEAD..origin/master |\
while read sha
do
# Check to see whether the patch is on the ignore list.
if [ -f bin/.cherry-ignore ] ; then
if grep -q ^$sha bin/.cherry-ignore ; then
continue
fi
fi
# Check to see if it has already been picked over.
if grep -q ^$sha already_picked ; then
continue
fi
git log -n1 --pretty=oneline $sha | cat
done
rm -f already_picked

View File

@@ -319,25 +319,6 @@ case $ARCH in
fi
fi
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
add_abi_flag_to_opts() {
case $(file $1) in
*32-bit*x86-64*)
# x86_64 x32 ABI.
OPTS="-mx32 ${OPTS}"
;;
*64-bit*x86-64*)
# x86_64 64-bit ABI.
OPTS="-m64 ${OPTS}"
;;
*32-bit*Intel*)
# x86 32-bit ABI.
OPTS="-m32 ${OPTS}"
;;
esac
}
if [ $NOPREFIX = 1 ] ; then
# No "lib" or ".so" part
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}
@@ -349,8 +330,15 @@ case $ARCH in
;;
esac
# Check to see if we are building for a different ABI.
add_abi_flag_to_opts ${OBJECTS}
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
@@ -401,9 +389,15 @@ case $ARCH in
# exptmp is removed below
fi
# Check to see if we are building for a different ABI.
add_abi_flag_to_opts ${OBJECTS}
# Check if objects are 32-bit and we're running in 64-bit
# environment. If so, pass -m32 flag to linker.
set ${OBJECTS}
ABI32=`file $1 | grep 32-bit`
ARM=`file $1 | grep ARM`
# Do not add "-m32" option for arm.
if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
OPTS="-m32 ${OPTS}"
fi
if [ "${ALTOPTS}" ] ; then
OPTS=${ALTOPTS}
fi

View File

@@ -98,6 +98,5 @@ def AddOptions(opts):
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
opts.Add(BoolOption('quiet', 'DEPRECATED: profile build', 'yes'))
opts.Add(BoolOption('texture_float', 'enable floating-point textures and renderbuffers', 'no'))
if host_platform == 'windows':
opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))

View File

@@ -9,17 +9,20 @@ CONFIG_NAME = autoconf
# Compiler and flags
CC = @CC@
CXX = @CXX@
OPT_FLAGS = @OPT_FLAGS@
ARCH_FLAGS = @ARCH_FLAGS@
PIC_FLAGS = @PIC_FLAGS@
DEFINES = @DEFINES@
API_DEFINES = @API_DEFINES@
SHARED_GLAPI = @SHARED_GLAPI@
CFLAGS_NOVISIBILITY = @CPPFLAGS@ @CFLAGS@ \
$(PIC_FLAGS) $(DEFINES)
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
CXXFLAGS_NOVISIBILITY = @CPPFLAGS@ @CXXFLAGS@ \
$(PIC_FLAGS) $(DEFINES)
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
CFLAGS = $(CFLAGS_NOVISIBILITY) @VISIBILITY_CFLAGS@
CXXFLAGS = $(CXXFLAGS_NOVISIBILITY) @VISIBILITY_CXXFLAGS@
LDFLAGS = @LDFLAGS@
EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
RADEON_CFLAGS = @RADEON_CFLAGS@
RADEON_LIBS = @RADEON_LIBS@
NOUVEAU_CFLAGS = @NOUVEAU_CFLAGS@
@@ -96,6 +99,7 @@ GLAPI_LIB_NAME = @GLAPI_LIB_NAME@
GL_LIB_GLOB = @GL_LIB_GLOB@
GLU_LIB_GLOB = @GLU_LIB_GLOB@
GLW_LIB_GLOB = @GLW_LIB_GLOB@
OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@
EGL_LIB_GLOB = @EGL_LIB_GLOB@
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
@@ -105,6 +109,7 @@ GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
# Directories to build
LIB_DIR = @LIB_DIR@
SRC_DIRS = @SRC_DIRS@
GLU_DIRS = @GLU_DIRS@
DRIVER_DIRS = @DRIVER_DIRS@
GALLIUM_DIRS = @GALLIUM_DIRS@
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
@@ -127,22 +132,22 @@ GLW_SOURCES = @GLW_SOURCES@
MOTIF_CFLAGS = @MOTIF_CFLAGS@
# Library/program dependencies
GL_LIB_DEPS = @GL_LIB_DEPS@
GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
@OSMESA_LIB_DEPS@
EGL_LIB_DEPS = @EGL_LIB_DEPS@
$(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
@GLU_LIB_DEPS@
$(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
@GLW_LIB_DEPS@
GLESv1_CM_LIB_DEPS = @GLESv1_CM_LIB_DEPS@
GLESv2_LIB_DEPS = @GLESv2_LIB_DEPS@
VG_LIB_DEPS = @VG_LIB_DEPS@
GLAPI_LIB_DEPS = @GLAPI_LIB_DEPS@
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_CM_LIB_DEPS@
GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
VG_LIB_DEPS = $(EXTRA_LIB_PATH) @VG_LIB_DEPS@
GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) @GLAPI_LIB_DEPS@
# DRI dependencies
DRI_LIB_DEPS = @DRI_LIB_DEPS@
GALLIUM_DRI_LIB_DEPS = @GALLIUM_DRI_LIB_DEPS@
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
GALLIUM_DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @GALLIUM_DRI_LIB_DEPS@
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
LIBDRM_LIB = @LIBDRM_LIBS@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@

View File

@@ -8,9 +8,9 @@
CONFIG_NAME = default
# Version info
MESA_MAJOR=9
MESA_MINOR=0
MESA_TINY=1
MESA_MAJOR=8
MESA_MINOR=1
MESA_TINY=0
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
# external projects. This should be useless now that we use libdrm.
@@ -76,6 +76,7 @@ GLAPI_LIB_NAME = lib$(GLAPI_LIB).so
GL_LIB_GLOB = $(GL_LIB_NAME)*
GLU_LIB_GLOB = $(GLU_LIB_NAME)*
GLW_LIB_GLOB = $(GLW_LIB_NAME)*
OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)*
EGL_LIB_GLOB = $(EGL_LIB_NAME)*
GLESv1_CM_LIB_GLOB = $(GLESv1_CM_LIB_NAME)*
GLESv2_LIB_GLOB = $(GLESv2_LIB_NAME)*
@@ -94,7 +95,8 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
# Directories to build
LIB_DIR = lib
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
gallium egl gallium/winsys gallium/targets
gallium egl gallium/winsys gallium/targets glu
GLU_DIRS = sgi
DRIVER_DIRS = x11 osmesa
# Gallium directories and
@@ -112,15 +114,15 @@ EGL_CLIENT_APIS = $(GL_LIB)
# Library dependencies
#EXTRA_LIB_PATH ?=
GL_LIB_DEPS = -lX11 -lXext -lm -lpthread
EGL_LIB_DEPS = -ldl -lpthread
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
GLESv1_CM_LIB_DEPS = -lpthread
GLESv2_LIB_DEPS = -lpthread
VG_LIB_DEPS = -lpthread
GLAPI_LIB_DEPS = -lpthread
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
VG_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
# Program dependencies - specific GL libraries added in Makefiles
X11_LIBS = -lX11

View File

@@ -6,10 +6,9 @@ dnl Tell the user about autoconf.html in the --help output
m4_divert_once([HELP_END], [
See docs/autoconf.html for more details on the options for Mesa.])
AC_INIT([Mesa], [9.0.1],
AC_INIT([Mesa], [8.1.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign])
@@ -27,14 +26,14 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_PREREQ([2.2])
LT_INIT([disable-static])
dnl Set internal versions
OSMESA_VERSION=8
AC_SUBST([OSMESA_VERSION])
dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
USER_CFLAGS="$CFLAGS"
USER_CXXFLAGS="$CXXFLAGS"
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.39
LIBDRM_INTEL_REQUIRED=2.4.38
LIBDRM_RADEON_REQUIRED=2.4.31
LIBDRM_INTEL_REQUIRED=2.4.37
LIBDRM_NVVIEUX_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED=2.4.33
DRI2PROTO_REQUIRED=2.6
@@ -60,7 +59,7 @@ fi
AC_PROG_YACC
AC_PATH_PROG([YACC_INST], $YACC)
if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"; then
if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
if test -z "$YACC_INST"; then
AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
fi
@@ -151,22 +150,28 @@ dnl LIB_DIR - library basename
LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
AC_SUBST([LIB_DIR])
dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
_SAVE_LDFLAGS="$LDFLAGS"
AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
AC_SUBST([EXTRA_LIB_PATH])
dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
_SAVE_CPPFLAGS="$CPPFLAGS"
AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
AC_SUBST([X11_INCLUDES])
dnl Compiler macros
DEFINES=""
AC_SUBST([DEFINES])
case "$host_os" in
linux*|*-gnu*|gnu*)
DEFINES="$DEFINES -D_GNU_SOURCE -DHAVE_PTHREAD"
DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS"
;;
solaris*)
DEFINES="$DEFINES -DHAVE_PTHREAD -DSVR4"
DEFINES="$DEFINES -DPTHREADS -DSVR4"
;;
cygwin*)
DEFINES="$DEFINES -DHAVE_PTHREAD"
DEFINES="$DEFINES -DPTHREADS"
;;
esac
@@ -241,6 +246,14 @@ esac
AC_SUBST([VISIBILITY_CFLAGS])
AC_SUBST([VISIBILITY_CXXFLAGS])
dnl These should be unnecessary, but let the user set them if they want
AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
Default is to use CFLAGS.])
AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
compiler. Default is to use CFLAGS.])
AC_SUBST([OPT_FLAGS])
AC_SUBST([ARCH_FLAGS])
dnl
dnl Hacks to enable 32 or 64 bit build
dnl
@@ -253,6 +266,7 @@ AC_ARG_ENABLE([32-bit],
if test "x$enable_32bit" = xyes; then
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -m32"
ARCH_FLAGS="$ARCH_FLAGS -m32"
CCASFLAGS="$CCASFLAGS -m32"
fi
if test "x$GXX" = xyes; then
@@ -279,17 +293,15 @@ dnl explicitly requested. If both disabled, set to static since shared
dnl was explicitly requested.
case "x$enable_static$enable_shared" in
xyesyes )
AC_MSG_WARN([Cannot build static and shared libraries, disabling shared])
AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
enable_shared=no
;;
xnono )
AC_MSG_WARN([Cannot disable both static and shared libraries, enabling static])
AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
enable_static=yes
;;
esac
AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
dnl
dnl mklib options
dnl
@@ -345,12 +357,18 @@ AC_ARG_WITH([gl-lib-name],
[specify GL library name @<:@default=GL@:>@])],
[GL_LIB=$withval],
[GL_LIB=GL])
AC_ARG_WITH([glu-lib-name],
[AS_HELP_STRING([--with-glu-lib-name@<:@=NAME@:>@],
[specify GLU library name @<:@default=GLU@:>@])],
[GLU_LIB=$withval],
[GLU_LIB=GLU])
AC_ARG_WITH([osmesa-lib-name],
[AS_HELP_STRING([--with-osmesa-lib-name@<:@=NAME@:>@],
[specify OSMesa library name @<:@default=OSMesa@:>@])],
[OSMESA_LIB=$withval],
[OSMESA_LIB=OSMesa])
AS_IF([test "x$GL_LIB" = xyes], [GL_LIB=GL])
AS_IF([test "x$GLU_LIB" = xyes], [GLU_LIB=GLU])
AS_IF([test "x$OSMESA_LIB" = xyes], [OSMESA_LIB=OSMesa])
dnl
@@ -365,9 +383,11 @@ AC_ARG_ENABLE([mangling],
if test "x${enable_mangling}" = "xyes" ; then
DEFINES="${DEFINES} -DUSE_MGL_NAMESPACE"
GL_LIB="Mangled${GL_LIB}"
GLU_LIB="Mangled${GLU_LIB}"
OSMESA_LIB="Mangled${OSMESA_LIB}"
fi
AC_SUBST([GL_LIB])
AC_SUBST([GLU_LIB])
AC_SUBST([OSMESA_LIB])
dnl
@@ -386,6 +406,7 @@ if test "x$enable_texture_float" = xyes; then
fi
GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION}
GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION}
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
@@ -394,6 +415,8 @@ VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION}
GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION}
GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
GLU_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLU_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
OSMESA_LIB_GLOB=${LIB_PREFIX_GLOB}'$(OSMESA_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
@@ -402,6 +425,7 @@ VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENS
GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*'
AC_SUBST([GL_LIB_NAME])
AC_SUBST([GLU_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
AC_SUBST([EGL_LIB_NAME])
AC_SUBST([GLESv1_CM_LIB_NAME])
@@ -410,6 +434,8 @@ AC_SUBST([VG_LIB_NAME])
AC_SUBST([GLAPI_LIB_NAME])
AC_SUBST([GL_LIB_GLOB])
AC_SUBST([GLU_LIB_GLOB])
AC_SUBST([OSMESA_LIB_GLOB])
AC_SUBST([EGL_LIB_GLOB])
AC_SUBST([GLESv1_CM_LIB_GLOB])
AC_SUBST([GLESv2_LIB_GLOB])
@@ -455,6 +481,13 @@ if test "x$enable_asm" = xyes; then
;;
esac
;;
powerpc)
case "$host_os" in
linux*)
asm_arch=ppc
;;
esac
;;
sparc*)
case "$host_os" in
linux*)
@@ -492,21 +525,13 @@ MESA_PIC_FLAGS
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
[AC_CHECK_LIB([dl], [dlopen],
[DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
AC_CHECK_FUNC([dlopen], [],
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
AC_SUBST([DLOPEN_LIBS])
dnl See if posix_memalign is available
AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
dnl Check for pthreads
AX_PTHREAD
dnl AX_PTHREADS leaves PTHREAD_LIBS empty for gcc and sets PTHREAD_CFLAGS
dnl to -pthread, which causes problems if we need -lpthread to appear in
dnl pkgconfig files.
test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
dnl SELinux awareness.
AC_ARG_ENABLE([selinux],
[AS_HELP_STRING([--enable-selinux],
@@ -521,7 +546,6 @@ if test "x$enable_selinux" = "xyes"; then
SELINUX_LIBS="-lselinux"
DEFINES="$DEFINES -DMESA_SELINUX"
fi
AC_SUBST([SELINUX_LIBS])
dnl Options for APIs
AC_ARG_ENABLE([opengl],
@@ -547,19 +571,19 @@ AC_ARG_ENABLE([openvg],
AC_ARG_ENABLE([dri],
[AS_HELP_STRING([--enable-dri],
[enable DRI modules @<:@default=enabled@:>@])],
[enable DRI modules @<:@default=auto@:>@])],
[enable_dri="$enableval"],
[enable_dri=yes])
[enable_dri=auto])
AC_ARG_ENABLE([glx],
[AS_HELP_STRING([--enable-glx],
[enable GLX library @<:@default=enabled@:>@])],
[enable GLX library @<:@default=auto@:>@])],
[enable_glx="$enableval"],
[enable_glx=yes])
[enable_glx=auto])
AC_ARG_ENABLE([osmesa],
[AS_HELP_STRING([--enable-osmesa],
[enable OSMesa library @<:@default=disabled@:>@])],
[enable OSMesa library @<:@default=auto@:>@])],
[enable_osmesa="$enableval"],
[enable_osmesa=no])
[enable_osmesa=auto])
AC_ARG_ENABLE([egl],
[AS_HELP_STRING([--disable-egl],
[disable EGL library @<:@default=enabled@:>@])],
@@ -609,9 +633,9 @@ AC_ARG_ENABLE([opencl],
[enable_opencl=no])
AC_ARG_ENABLE([xlib_glx],
[AS_HELP_STRING([--enable-xlib-glx],
[make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
[make GLX library Xlib-based instead of DRI-based @<:@default=disable@:>@])],
[enable_xlib_glx="$enableval"],
[enable_xlib_glx=no])
[enable_xlib_glx=auto])
AC_ARG_ENABLE([gallium_egl],
[AS_HELP_STRING([--enable-gallium-egl],
[enable optional EGL state tracker (not required
@@ -645,7 +669,7 @@ GALLIUM_DRIVERS_DEFAULT="r300,r600,svga,swrast"
AC_ARG_WITH([gallium-drivers],
[AS_HELP_STRING([--with-gallium-drivers@<:@=DIRS...@:>@],
[comma delimited Gallium drivers list, e.g.
"i915,nouveau,r300,r600,radeonsi,svga,swrast"
"i915,nouveau,r300,r600,svga,swrast"
@<:@default=r300,r600,swrast@:>@])],
[with_gallium_drivers="$withval"],
[with_gallium_drivers="$GALLIUM_DRIVERS_DEFAULT"])
@@ -685,61 +709,125 @@ if test "x$enable_gles2" = xyes; then
fi
AC_SUBST([API_DEFINES])
if test "x$enable_glx" = xno; then
AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
enable_xlib_glx=no
fi
if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
fi
# Disable GLX if DRI and Xlib-GLX are not enabled
if test "x$enable_glx" = xyes -a \
"x$enable_dri" = xno -a \
"x$enable_xlib_glx" = xno; then
AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
enable_glx=no
fi
AM_CONDITIONAL(HAVE_DRI, test "x$enable_dri" = xyes)
AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
"x$enable_osmesa" = xyes)
AC_ARG_ENABLE([shared-glapi],
[AS_HELP_STRING([--enable-shared-glapi],
[Enable shared glapi for OpenGL @<:@default=yes@:>@])],
[EXPERIMENTAL. Enable shared glapi for OpenGL @<:@default=no@:>@])],
[enable_shared_glapi="$enableval"],
[enable_shared_glapi="$enable_dri"])
[enable_shared_glapi=no])
# Shared GLAPI is only useful for DRI
if test "x$enable_dri" = xno; then
AC_MSG_NOTICE([Shared GLAPI is only useful for DRI, disabling])
enable_shared_glapi=no
fi
# TODO: Get rid of SHARED_GLAPI variable
SHARED_GLAPI="0"
if test "x$enable_shared_glapi" = xyes; then
SHARED_GLAPI="1"
# libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
# the remap table)
DEFINES="$DEFINES -DIN_DRI_DRIVER"
CORE_DIRS="mapi/shared-glapi"
SRC_DIRS="$SRC_DIRS mapi/shared-glapi"
fi
AC_SUBST([SHARED_GLAPI])
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
dnl More later: fbdev, ...
dnl
default_driver="xlib"
case "$host_os" in
linux*)
case "$host_cpu" in
i*86|x86_64|powerpc*|sparc*|ia64*) default_driver="dri";;
esac
;;
*freebsd* | dragonfly* | *netbsd*)
case "$host_cpu" in
i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
esac
;;
esac
if test "x$enable_opengl" = xno; then
default_driver="no"
fi
AC_ARG_WITH([driver],
[AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
[mesa_driver="$withval"],
[mesa_driver=auto])
dnl Check for valid option
case "x$mesa_driver" in
xxlib|xdri|xosmesa|xno)
if test "x$enable_dri" != xauto -o \
"x$enable_glx" != xauto -o \
"x$enable_osmesa" != xauto -o \
"x$enable_xlib_glx" != xauto; then
AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
fi
;;
xauto)
mesa_driver="$default_driver"
;;
*)
AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
;;
esac
# map $mesa_driver to APIs
if test "x$enable_dri" = xauto; then
case "x$mesa_driver" in
xdri) enable_dri=yes ;;
*) enable_dri=no ;;
esac
fi
if test "x$enable_glx" = xauto; then
case "x$mesa_driver" in
xdri|xxlib) enable_glx=yes ;;
*) enable_glx=no ;;
esac
fi
if test "x$enable_osmesa" = xauto; then
case "x$mesa_driver" in
xxlib|xosmesa) enable_osmesa=yes ;;
*) enable_osmesa=no ;;
esac
fi
if test "x$enable_xlib_glx" = xauto; then
case "x$mesa_driver" in
xxlib) enable_xlib_glx=yes ;;
*) enable_xlib_glx=no ;;
esac
fi
if test "x$enable_glx" = xno; then
enable_xlib_glx=no
fi
AM_CONDITIONAL(HAVE_DRI, test x"$enable_dri" = xyes)
dnl
dnl Driver specific build directories
dnl
dnl this variable will be prepended to SRC_DIRS and is not exported
CORE_DIRS=""
SRC_DIRS="gtest"
GLU_DIRS="sgi"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
GALLIUM_STATE_TRACKERS_DIRS=""
# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
x*yes*)
CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
;;
esac
# build glapi if OpenGL is enabled
if test "x$enable_opengl" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/glapi"
@@ -789,6 +877,7 @@ if test "x$enable_osmesa" = xyes; then
fi
AC_SUBST([SRC_DIRS])
AC_SUBST([GLU_DIRS])
AC_SUBST([DRIVER_DIRS])
AC_SUBST([GALLIUM_DIRS])
AC_SUBST([GALLIUM_TARGET_DIRS])
@@ -804,7 +893,7 @@ PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED],
if test "x$enable_dri" = xyes; then
# DRI must be shared, I think
if test "$enable_static" = yes; then
AC_MSG_ERROR([Cannot use static libraries for DRI drivers])
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
fi
# not a hard requirement as swrast does not depend on it
@@ -813,8 +902,32 @@ if test "x$enable_dri" = xyes; then
fi
fi
dnl Find out if X is available.
PKG_CHECK_MODULES([X11], [x11])
dnl
dnl Find out if X is available. The variable have_x is set if libX11 is
dnl found to mimic AC_PATH_XTRA.
dnl
if test -n "$PKG_CONFIG"; then
AC_MSG_CHECKING([pkg-config files for X11 are available])
PKG_CHECK_EXISTS([x11],[
x11_pkgconfig=yes
have_x=yes
],[
x11_pkgconfig=no
])
AC_MSG_RESULT([$x11_pkgconfig])
else
x11_pkgconfig=no
fi
dnl Use the autoconf macro if no pkg-config files
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES([X11], [x11])
else
AC_PATH_XTRA
test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
AC_SUBST([X11_CFLAGS])
AC_SUBST([X11_LIBS])
fi
dnl Try to tell the user that the --x-* options are only used when
dnl pkg-config is not available. This must be right after AC_PATH_XTRA.
@@ -858,41 +971,68 @@ dnl
case "x$enable_glx$enable_xlib_glx" in
xyesyes)
# Xlib-based GLX
PKG_CHECK_MODULES([XLIBGL], [x11 xext])
GL_PC_REQ_PRIV="x11 xext"
X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
GL_LIB_DEPS="$XLIBGL_LIBS"
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm $PTHREAD_LIBS"
if test "$x11_pkgconfig" = yes; then
PKG_CHECK_MODULES([XLIBGL], [x11 xext])
GL_PC_REQ_PRIV="x11 xext"
X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
GL_LIB_DEPS="$XLIBGL_LIBS"
else
# should check these...
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
GL_PC_LIB_PRIV="$GL_LIB_DEPS"
GL_PC_CFLAGS="$X11_INCLUDES"
fi
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
;;
xyesno)
# DRI-based GLX
PKG_CHECK_MODULES([GLPROTO], [glproto >= $GLPROTO_REQUIRED])
GL_PC_REQ_PRIV="glproto >= $GLPROTO_REQUIRED"
if test x"$driglx_direct" = xyes; then
if test "x$have_libdrm" != xyes; then
AC_MSG_ERROR([Direct rendering requires libdrm >= $LIBDRM_REQUIRED])
fi
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED"
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED"
fi
# find the DRI deps for libGL
dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx >= 1.8.1"
if test "$x11_pkgconfig" = yes; then
dri_modules="x11 xext xdamage xfixes x11-xcb xcb-glx"
# add xf86vidmode if available
PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
if test "$HAVE_XF86VIDMODE" = yes ; then
dri_modules="$dri_modules xxf86vm"
# add xf86vidmode if available
PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no)
if test "$HAVE_XF86VIDMODE" = yes ; then
dri_modules="$dri_modules xxf86vm"
fi
PKG_CHECK_MODULES([DRIGL], [$dri_modules])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
GL_LIB_DEPS="$DRIGL_LIBS"
else
# should check these...
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
if test "x$HAVE_XF86VIDMODE" == xyes; then
GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
else
GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXdamage -lXfixes"
fi
GL_PC_LIB_PRIV="$GL_LIB_DEPS"
GL_PC_CFLAGS="$X11_INCLUDES"
# XCB can only be used from pkg-config
PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx >= 1.8.1])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx"
X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
fi
PKG_CHECK_MODULES([DRIGL], [$dri_modules])
GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules"
X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
GL_LIB_DEPS="$DRIGL_LIBS"
# need DRM libs, $PTHREAD_LIBS, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
;;
esac
@@ -900,10 +1040,10 @@ esac
# builds.
AM_CONDITIONAL(HAVE_XF86VIDMODE, test "x$HAVE_XF86VIDMODE" = xyes)
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv1_CM_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv2_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
AC_SUBST([GL_LIB_DEPS])
AC_SUBST([GL_PC_REQ_PRIV])
@@ -915,7 +1055,21 @@ AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
AC_SUBST([GLESv2_LIB_DEPS])
AC_SUBST([GLESv2_PC_LIB_PRIV])
DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS"
AC_SUBST([GLAPI_LIB_DEPS])
dnl dri libraries are linking with mesa
DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.la'
GALLIUM_DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
dnl ... or dricore?
if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then
DRI_LIB_DEPS="\$(TOP)/src/mesa/libdricore/libdricore${VERSION}.la"
GALLIUM_DRI_LIB_DEPS="\$(TOP)/\$(LIB_DIR)/libdricore${VERSION}.so"
HAVE_DRICORE=yes
fi
AM_CONDITIONAL(HAVE_DRICORE, test x$HAVE_DRICORE = xyes)
AC_SUBST([HAVE_XF86VIDMODE])
@@ -945,8 +1099,8 @@ AC_ARG_ENABLE([glx-tls],
[GLX_USE_TLS=no])
AC_SUBST(GLX_TLS, ${GLX_USE_TLS})
AS_IF([test "x$GLX_USE_TLS" = xyes -a "x$ax_pthread_ok" = xyes],
[DEFINES="${DEFINES} -DGLX_USE_TLS -DHAVE_PTHREAD"])
AS_IF([test "x$GLX_USE_TLS" = xyes],
[DEFINES="${DEFINES} -DGLX_USE_TLS -DPTHREADS"])
dnl
dnl More DRI setup
@@ -992,7 +1146,7 @@ yes)
dri_drivers=`IFS=', '; echo $with_dri_drivers`
for driver in $dri_drivers; do
test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
AC_MSG_ERROR([DRI driver directory '$driver' does not exist])
AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
done
DRI_DIRS="$dri_drivers"
if test -n "$DRI_DIRS" -a "x$enable_opengl" != xyes; then
@@ -1030,7 +1184,7 @@ if test "x$enable_dri" = xyes; then
esac
;;
freebsd* | dragonfly* | *netbsd*)
DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
if test "x$DRI_DIRS" = "xyes"; then
@@ -1089,10 +1243,9 @@ if test "x$enable_dri" = xyes; then
fi
# put all the necessary libs together
DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm $PTHREAD_LIBS $DLOPEN_LIBS"
DRI_LIB_DEPS="$DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
GALLIUM_DRI_LIB_DEPS="$GALLIUM_DRI_LIB_DEPS $SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
fi
AM_CONDITIONAL(NEED_LIBDRICORE, test -n "$DRI_DIRS")
AC_SUBST([DRI_DIRS])
AC_SUBST([EXPAT_INCLUDES])
AC_SUBST([DRI_LIB_DEPS])
@@ -1187,18 +1340,21 @@ esac
if test "x$enable_osmesa" = xyes; then
# only link libraries with osmesa if shared
if test "$enable_static" = no; then
OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
else
OSMESA_LIB_DEPS=""
fi
OSMESA_MESA_DEPS=""
OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS"
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
fi
OSMESA_VERSION=`echo "$VERSION" | $SED 's/\./:/g'`
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
AC_SUBST([OSMESA_PC_REQ])
AC_SUBST([OSMESA_PC_LIB_PRIV])
AC_SUBST([OSMESA_VERSION])
dnl
dnl gbm configuration
@@ -1219,7 +1375,7 @@ if test "x$enable_gbm" = xyes; then
if test "x$enable_dri" = xyes; then
GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
if test "x$enable_shared_glapi" = xno; then
if test "$SHARED_GLAPI" -eq 0; then
AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
fi
fi
@@ -1236,7 +1392,7 @@ EGL_CLIENT_APIS=""
if test "x$enable_egl" = xyes; then
SRC_DIRS="$SRC_DIRS egl"
EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS $PTHREAD_LIBS"
EGL_LIB_DEPS="$DLOPEN_LIBS $SELINUX_LIBS -lpthread"
AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"])
@@ -1359,12 +1515,10 @@ if test "x$enable_openvg" = xyes; then
fi
EGL_CLIENT_APIS="$EGL_CLIENT_APIS "'$(VG_LIB)'
VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS"
VG_LIB_DEPS="$VG_LIB_DEPS $SELINUX_LIBS -lpthread"
CORE_DIRS="$CORE_DIRS mapi/vgapi"
GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
HAVE_ST_VEGA=yes
VG_PC_LIB_PRIV="-lm $PTHREAD_LIBS $DLOPEN_LIBS"
AC_SUBST([VG_PC_LIB_PRIV])
fi
dnl
@@ -1459,13 +1613,66 @@ if test "x$enable_opencl" = xyes; then
enable_gallium_loader=yes
fi
dnl
dnl GLU configuration
dnl
AC_ARG_ENABLE([glu],
[AS_HELP_STRING([--disable-glu],
[enable OpenGL Utility library @<:@default=enabled@:>@])],
[enable_glu="$enableval"],
[enable_glu=yes])
if test "x$enable_glu" = xyes; then
if test "x$enable_glx" = xno -a "x$enable_osmesa" = xno; then
AC_MSG_NOTICE([Disabling GLU since there is no OpenGL driver])
enable_glu=no
fi
fi
if test "x$enable_glu" = xyes; then
SRC_DIRS="$SRC_DIRS glu"
if test "x$enable_glx" = xno; then
# Link libGLU to libOSMesa instead of libGL
GLU_LIB_DEPS=""
GLU_PC_REQ="osmesa"
if test "$enable_static" = no; then
GLU_MESA_DEPS='-l$(OSMESA_LIB)'
else
GLU_MESA_DEPS=""
fi
else
# If static, empty GLU_LIB_DEPS and add libs for programs to link
GLU_PC_REQ="gl"
GLU_PC_LIB_PRIV="-lm"
if test "$enable_static" = no; then
GLU_LIB_DEPS="-lm"
GLU_MESA_DEPS='-l$(GL_LIB)'
else
GLU_LIB_DEPS=""
GLU_MESA_DEPS=""
fi
fi
fi
if test "$enable_static" = no; then
GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS"
fi
GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS"
AC_SUBST([GLU_LIB_DEPS])
AC_SUBST([GLU_MESA_DEPS])
AC_SUBST([GLU_PC_REQ])
AC_SUBST([GLU_PC_REQ_PRIV])
AC_SUBST([GLU_PC_LIB_PRIV])
AC_SUBST([GLU_PC_CFLAGS])
AC_SUBST([PROGRAM_DIRS])
dnl
dnl Gallium configuration
dnl
if test "x$with_gallium_drivers" != x; then
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
fi
AM_CONDITIONAL(HAVE_GALLIUM, test "x$with_gallium_drivers" != x)
AC_SUBST([LLVM_BINDIR])
AC_SUBST([LLVM_CFLAGS])
@@ -1516,7 +1723,7 @@ for plat in $egl_platforms; do
;;
wayland)
PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 0.99.0 wayland-server >= 0.99.0],, \
PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
[AC_MSG_ERROR([cannot find libwayland-client])])
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
@@ -1826,7 +2033,7 @@ if test "x$with_gallium_drivers" != x; then
AC_MSG_ERROR([LLVM 3.1 is required to build the radeonsi driver.])
fi
NEED_RADEON_GALLIUM=yes;
gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi" "" "" "vdpau-radeonsi" ""
gallium_check_st "radeon/drm" "dri-radeonsi" "xorg-radeonsi"
;;
xnouveau)
PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
@@ -1921,6 +2128,8 @@ AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
AC_SUBST([GALLIUM_MAKE_DIRS])
AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_DRI_DRIVER, echo "$DRIVER_DIRS" | grep 'dri' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_OSMESA_DRIVER, echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
@@ -1940,62 +2149,55 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([configs/current
Makefile
src/egl/Makefile
src/egl/drivers/Makefile
src/egl/drivers/dri2/Makefile
src/egl/drivers/glx/Makefile
src/egl/main/Makefile
src/egl/main/egl.pc
src/egl/wayland/Makefile
src/egl/wayland/wayland-drm/Makefile
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
src/Makefile
src/gallium/Makefile
src/gallium/auxiliary/pipe-loader/Makefile
src/gallium/state_trackers/clover/Makefile
src/gallium/drivers/Makefile
src/gallium/drivers/r300/Makefile
src/gallium/drivers/r600/Makefile
src/gallium/state_trackers/clover/Makefile
src/gallium/targets/opencl/Makefile
src/gbm/Makefile
src/gbm/main/gbm.pc
src/egl/drivers/Makefile
src/egl/drivers/dri2/Makefile
src/egl/drivers/glx/Makefile
src/egl/Makefile
src/egl/main/Makefile
src/egl/main/egl.pc
src/egl/wayland/Makefile
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
src/egl/wayland/wayland-drm/Makefile
src/glsl/Makefile
src/glsl/glcpp/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
src/gtest/Makefile
src/Makefile
src/mapi/es1api/Makefile
src/mapi/es1api/glesv1_cm.pc
src/mapi/es2api/Makefile
src/mapi/es2api/glesv2.pc
src/mapi/glapi/Makefile
src/mapi/glapi/gen/Makefile
src/mapi/glapi/tests/Makefile
src/mapi/shared-glapi/Makefile
src/mapi/shared-glapi/tests/Makefile
src/mapi/vgapi/Makefile
src/mapi/vgapi/vg.pc
src/mapi/glapi/tests/Makefile
src/gtest/Makefile
src/mesa/Makefile
src/mesa/gl.pc
src/mesa/libdricore/Makefile
src/mesa/main/tests/Makefile
src/mesa/x86/Makefile
src/mesa/x86-64/Makefile
src/mesa/drivers/Makefile
src/mesa/drivers/dri/dri.pc
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/common/Makefile
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i965/Makefile
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/nouveau/Makefile
src/mesa/drivers/dri/r200/Makefile
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
src/mesa/drivers/osmesa/Makefile
src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
src/mesa/libdricore/Makefile
src/mesa/main/tests/Makefile
src/mesa/x86-64/Makefile
src/mesa/x86/Makefile])
src/mesa/gl.pc
src/mesa/osmesa.pc])
dnl Sort the dirs alphabetically
GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
@@ -2051,6 +2253,9 @@ xyesno)
;;
esac
echo ""
echo " GLU: $enable_glu"
dnl EGL
echo ""
echo " EGL: $enable_egl"
@@ -2099,13 +2304,12 @@ dnl Libraries
echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
echo " Shared-glapi: $enable_shared_glapi"
dnl Compiler options
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
cflags=`echo $CFLAGS $PIC_FLAGS | \
cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
$SED 's/^ *//;s/ */ /;s/ *$//'`
cxxflags=`echo $CXXFLAGS $PIC_FLAGS | \
cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
$SED 's/^ *//;s/ */ /;s/ *$//'`
defines=`echo $DEFINES | $SED 's/^ *//;s/ */ /;s/ *$//'`
echo ""

View File

@@ -42,21 +42,21 @@ GLX_ARB_create_context (GLX 1.4 is required) DONE
GL 3.1:
GLSL 1.40 DONE (i965)
Forward compatibile context support/deprecations DONE (i965)
GLSL 1.40 needs UBOs (in progress)
Forward compatibile context support/deprecations not started
Instanced drawing (GL_ARB_draw_instanced) DONE (i965, gallium, swrast)
Buffer copying (GL_ARB_copy_buffer) DONE (i965, r300, r600, swrast)
Primitive restart (GL_NV_primitive_restart) DONE (i965, r600)
16 vertex texture image units DONE
Texture buffer objs (GL_ARB_texture_buffer_object) DONE for OpenGL 3.1 contexts (i965)
Texture buffer objs (GL_ARB_texture_buffer_object) needs GL3.1 enabling (i965)
Rectangular textures (GL_ARB_texture_rectangle) DONE (i965, r300, r600, swrast)
Uniform buffer objs (GL_ARB_uniform_buffer_object) DONE (i965)
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
Signed normalized textures (GL_EXT_texture_snorm) DONE (i965, r300, r600)
GL 3.2:
Core/compatibility profiles DONE
Core/compatibility profiles not started
GLSL 1.50 not started
Geometry shaders (GL_ARB_geometry_shader4) partially done (Zack)
BGRA vertex order (GL_ARB_vertex_array_bgra) DONE (i965, r300, r600, swrast)
@@ -75,12 +75,12 @@ GL 3.3:
GLSL 3.30 new features in this version pretty much done
GL_ARB_blend_func_extended DONE (i965, r600, softpipe)
GL_ARB_explicit_attrib_location DONE (i915, i965, r300, r600, swrast)
GL_ARB_occlusion_query2 DONE (i965, r300, r600, swrast)
GL_ARB_occlusion_query2 DONE (r300, r600, swrast)
GL_ARB_sampler_objects DONE (i965, r300, r600)
GL_ARB_shader_bit_encoding DONE
GL_ARB_texture_rgb10_a2ui DONE (i965, r600)
GL_ARB_texture_rgb10_a2ui DONE (r600)
GL_ARB_texture_swizzle DONE (same as EXT version) (i965, r300, r600, swrast)
GL_ARB_timer_query DONE (i965)
GL_ARB_timer_query DONE
GL_ARB_instanced_arrays DONE (i965, r300, r600)
GL_ARB_vertex_type_2_10_10_10_rev DONE (r600)
@@ -130,35 +130,5 @@ GL_ARB_internalformat_query not started
GL_ARB_map_buffer_alignment not started
GL 4.3:
GLSL 4.3 not started
ARB_arrays_of_arrays not started
ARB_ES3_compatibility not started
ARB_clear_buffer_object not started
ARB_compute_shader started (gallium)
ARB_copy_image not started
ARB_debug_group not started
ARB_debug_label not started
ARB_debug_output DONE
ARB_debug_output2 not started
ARB_explicit_uniform_location not started
ARB_fragment_layer_viewport not started
ARB_framebuffer_no_attachments not started
ARB_internalformat_query2 not started
ARB_invalidate_subdata not started
ARB_multi_draw_indirect not started
ARB_program_interface_query not started
ARB_robust_buffer_access_behavior not started
ARB_shader_image_size not started
ARB_shader_storage_buffer_object not started
ARB_stencil_texturing not started
ARB_texture_buffer_range not started
ARB_texture_query_levels not started
ARB_texture_storage_multisample not started
ARB_texture_view not started
ARB_vertex_attrib_binding not started
More info about these features and the work involved can be found at
http://dri.freedesktop.org/wiki/MissingFunctionality

View File

@@ -17,6 +17,10 @@
<li><a href="#dri">DRI Driver Options</a></li>
<li><a href="#osmesa">OSMesa Driver Options</a></li>
</ul>
<li><p><a href="#library">Library Options</a>
<ul>
<li><a href="#glu">GLU</a></li>
</ul>
<li><p><a href="#demos">Demo Program Options</a>
</ol>
@@ -215,6 +219,12 @@ libraries that will be built. More details on the specific GL libraries
can be found in the <a href="install.html">basic installation
instructions</a>.
<dl>
<dt id="glu">GLU <dd><p> The libGLU library will be built by default
on all drivers. This can be disable with the option
<code>--disable-glu</code>.
</dl>
<h2 id="demos">4. Demo Program Options</h2>

View File

@@ -74,6 +74,7 @@
<li><a href="http://sourceforge.net/projects/mesa3d" target="_parent">SourceForge homepage</a>
<li><a href="repository.html" target="MainFrame">Source Code Repository</a>
<li><a href="sourcetree.html" target="MainFrame">Source Code Tree</a>
<li><a href="glu.html" target="MainFrame">SGI's GLU</a>
<li><a href="utilities.html" target="MainFrame">Utilities</a>
<li><a href="helpwanted.html" target="MainFrame">Help Wanted</a>
<li><a href="devinfo.html" target="MainFrame">Development Notes</a>

View File

@@ -169,7 +169,7 @@ branch is relevant.
<dd>MESA_MAJOR, MESA_MINOR and MESA_TINY</dd>
<dt>Makefile.am</dt>
<dd>PACKAGE_VERSION</dd>
<dt>configure.ac</dt>
<dt>autoconf.ac</dt>
<dd>AC_INIT</dd>
<dt>src/mesa/main/version.h</dt>
<dd>MESA_MAJOR, MESA_MINOR, MESA_PATCH and MESA_VERSION_STRING</dd>

View File

@@ -197,7 +197,7 @@ few preprocessor defines.</p>
<ul>
<li>If <tt>GLX_USE_TLS</tt> is defined, method #4 is used.</li>
<li>If <tt>HAVE_PTHREAD</tt> is defined, method #3 is used.</li>
<li>If <tt>PTHREADS</tt> is defined, method #3 is used.</li>
<li>If <tt>WIN32_THREADS</tt> is defined, method #2 is used.</li>
<li>If none of the preceeding are defined, method #1 is used.</li>
</ul>

View File

@@ -69,6 +69,7 @@ docs/ - documentation
src/ - source code for libraries
src/mesa - sources for the main Mesa library and device drivers
src/gallium - sources for Gallium and Gallium drivers
src/glu - libGLU source code
src/glx - sources for building libGL with full GLX and DRI support
</pre>
@@ -79,12 +80,7 @@ instructions</a>.
</p>
<h1>Demos, GLUT, and GLU</h1>
<p>
A package of SGI's GLU library is available
<a href="ftp://ftp.freedesktop.org/pub/mesa/glu/" target="_parent">here</a>
</p>
<h1>Demos and GLUT</h1>
<p>
A package of Mark Kilgard's GLUT library is available
@@ -97,13 +93,9 @@ The Mesa demos collection is available
</p>
<p>
In the past, GLUT, GLU and the Mesa demos were released in conjunction with
Mesa releases. But since GLUT, GLU and the demos change infrequently, they
were split off into their own git repositories:
<a href="http://cgit.freedesktop.org/mesa/glut/">GLUT</a>,
<a href="http://cgit.freedesktop.org/mesa/glu/">GLU</a> and
<a href="http://cgit.freedesktop.org/mesa/demos/">Demos</a>,
In the past, GLUT and the Mesa demos were released in conjunction with
Mesa releases. But since GLUT and the demos change infrequently, they
were split off some time ago.
</p>

View File

@@ -226,6 +226,10 @@ Basically you'll want the following:
</li><li>/usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz
</li><li>/usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library. xyz denotes the
Mesa version number.
</li><li>/usr/lib/libGLU.so - a symlink to libGLU.so.1
</li><li>/usr/lib/libGLU.so.1 - a symlink to libGLU.so.1.3.xyz
</li><li>/usr/lib/libGLU.so.xyz - the OpenGL Utility library. xyz denotes the Mesa
version number.
</li></ul>
<p>
After installing XFree86/X.org and the DRI drivers, some of these files

46
docs/glu.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>SGI GLU</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>SGI SI GLU</h1>
(Silicon Graphics, Inc. Sample Implementation of the OpenGL Utility library)
<p>
SGI open-sourced their OpenGL Sample Implementation (SI) in January, 2000.
This includes the GLU library.
</p>
<p>
The SI GLU library implements GLU version 1.3 whereas the original
Mesa GLU library only implemented version 1.2.
We recommend using the SI GLU library instead of Mesa's GLU library
since it's more up-to-date, complete and reliable.
We're no longer developing the original Mesa GLU library.
</p>
<p>
The SI GLU library code is included in the Mesa distribution.
You don't have to download it separately.
</p>
<p>
<b>Olivier Michel</b> has made Linux RPMs of GLU for i386 and PowerPC.
You can download them from the
<a href="http://www.sourceforge.net/project/showfiles.php?group_id=3"
target="_parent">download area</a> under <b>Miscellaneous</b>.
</p>
<p>
Visit the <a href="http://oss.sgi.com/projects/ogl-sample/" target="_parent">
OpenGL Sample Implementation home page</a> for more information about the SI.
</p>
</body>
</html>

View File

@@ -31,8 +31,13 @@ issues in the code.
<b>Windows driver building, testing and maintenance.</b>
Fixing MSVC builds.
<li>
<b>Maintenance and testing of lesser-used drivers.</b>
Drivers such as i810, mach64, mga, r128, savage, sis, tdfx, unichrome, etc that aren't being maintained are being
deprecated starting in Mesa 8.0.<br>
They have to be ported to DRI2 to be accepted in mesa master again.
<li>
<b>Contribute more tests to
<a href="http://piglit.freedesktop.org/" target="_parent">Piglit</a>.</b>
<a href="http://people.freedesktop.org/~nh/piglit/" target="_parent">Piglit</a>.</b>
<li>
<b>Automatic testing.
</b>
@@ -51,14 +56,8 @@ You can find some further To-do lists here:
target="_parent"><b>LLVMpipe - todo</b></a></li>
<li><a href="http://dri.freedesktop.org/wiki/MissingFunctionality"
target="_parent"><b>MissingFunctionality</b></a></li>
<li><a href="http://dri.freedesktop.org/wiki/RadeonsiToDo"
target="_parent"><b>RadeonsiToDo</b></a></li>
<li><a href="http://dri.freedesktop.org/wiki/R600ToDo"
target="_parent"><b>R600ToDo</b></a></li>
<li><a href="http://dri.freedesktop.org/wiki/R300ToDo"
target="_parent"><b>R300ToDo</b></a></li>
<li><a href="http://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/i915/TODO"
target="_parent"><b>i915g TODO</b></a></li>
</ul>
<p>

View File

@@ -151,6 +151,9 @@ You'll see a set of library files similar to this:
lrwxrwxrwx 1 brian users 10 Mar 26 07:53 libGL.so -> libGL.so.1*
lrwxrwxrwx 1 brian users 19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
-rwxr-xr-x 1 brian users 3375861 Mar 26 07:53 libGL.so.1.5.060100*
lrwxrwxrwx 1 brian users 11 Mar 26 07:53 libGLU.so -> libGLU.so.1*
lrwxrwxrwx 1 brian users 20 Mar 26 07:53 libGLU.so.1 -> libGLU.so.1.3.060100*
-rwxr-xr-x 1 brian users 549269 Mar 26 07:53 libGLU.so.1.3.060100*
lrwxrwxrwx 1 brian users 14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
-rwxr-xr-x 1 brian users 23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
@@ -159,6 +162,8 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM
<p>
<b>libGL</b> is the main OpenGL library (i.e. Mesa).
<br>
<b>libGLU</b> is the OpenGL Utility library.
<br>
<b>libOSMesa</b> is the OSMesa (Off-Screen) interface library.
</p>

View File

@@ -166,17 +166,6 @@ of the OpenGL specification is implemented.
</p>
<h2>Version 9.x features</h2>
<p>
Version 9.x of Mesa implements the OpenGL 3.1 API.
While the driver for Intel Sandy Bridge and Ivy Bridge is the only
driver to support OpenGL 3.1, many developers across the open-source
community contributed features required for OpenGL 3.1. The primary
features added since the Mesa 8.0 release are
GL_ARB_texture_buffer_object and GL_ARB_uniform_buffer_object.
</p>
<h2>Version 8.x features</h2>
<p>
Version 8.x of Mesa implements the OpenGL 3.0 API.

View File

@@ -95,6 +95,8 @@ Device drivers src/mesa/drivers/* MIT, generally
Ext headers include/GL/glext.h Khronos
include/GL/glxext.h
SGI GLU library src/glu/sgi/ SGI Free B
</pre>
<p>

View File

@@ -9,16 +9,6 @@
<h1>News</h1>
<h2>October 8, 2012</h2>
<p>
<a href="relnotes-9.0.html">Mesa 9.0</a> is released.
This is the first version of Mesa to support OpenGL 3.1 and GLSL 1.40
(with the i965 driver).
See the release notes for more information about the release.
</p>
<h2>July 10, 2012</h2>
<p>

63
docs/relnotes-8.1.html Normal file
View File

@@ -0,0 +1,63 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Mesa Release Notes</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>Mesa 8.1 Release Notes / date TBD</h1>
<p>
Mesa 8.1 is a new development release.
</p>
<p>
Mesa 8.1 implements the OpenGL 3.0 API, but the version reported by
glGetString(GL_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.0.
</p>
<h2>MD5 checksums</h2>
<pre>
tbd
</pre>
<h2>New features</h2>
<p>
Note: some of the new features are only available with certain drivers.
</p>
<ul>
<li>GL_ARB_base_instance</li>
<li>GL_ARB_blend_func_extended</li>
<li>GL_ARB_debug_output</li>
<li>GL_ARB_shader_bit_encoding</li>
<li>GL_ARB_timer_query</li>
<li>GL_ARB_transform_feedback3</li>
<li>GL_ARB_transform_feedback_instanced</li>
<li>GL_EXT_unpack_subimage for ES 2.0</li>
<li>GL_EXT_read_format_bgra for ES 1.1 and 2.0</li>
<li>GL_EXT_texture_rg for ES 2.x</li>
<li>GL_NV_read_buffer for ES 2.0</li>
</ul>
<h2>Bug fixes</h2>
<p>TBD -- This list is likely incomplete.</p>
<h2>Changes</h2>
<p>
The legacy/static Makefile system (ex: 'make linux-dri') has been removed.
The two supported build methods are now autoconf/automake and SCons.
</p>
</body>
</html>

View File

@@ -1,157 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Mesa Release Notes</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>Mesa 9.0.1 Release Notes / November 14th, 2012</h1>
<p>
Mesa 9.0.1 is a bug fix release which fixes bugs found since the 9.0 release.
</p>
<p>
Mesa 9.0 implements the OpenGL 3.1 API, but the version reported by
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.1. OpenGL
3.1 is <strong>only</strong> available if requested at context creation
because GL_ARB_compatibility is not supported.
</p>
<h2>MD5 checksums</h2>
<pre>
TBD.
</pre>
<h2>New features</h2>
<p>None.</p>
<h2>Bug fixes</h2>
<p>This list is likely incomplete.</p>
<ul>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44912">Bug 44912</a> - [bisected] WebGL conformance/textures/texture-mips tests fails</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=55856">Bug 55856</a> - kwin with gles window content is not updating (gen4)</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56057">Bug 56057</a> - INTEL_swap_event not correctly listed</li>
<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=56211">Bug 56211</a> - src/mesa/state_tracker/st_cb_texture.c:1123:copy_image_data_to_texture: Assertion `u_minify(stImage-&gt;pt-&gt;height0, src_level) == stImage-&gt;base.Height' failed.</li>
<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=">Bug </a> - </li> -->
</ul>
<h2>Changes</h2>
<p>The full set of changes can be viewed by using the following GIT command:</p>
<pre>
git log mesa-9.0..mesa-9.0.1
</pre>
<p>Adam Jackson (1):</p>
<ul>
<li>glx: Add GLXBadProfileARB to the error string list</li>
</ul>
<p>Andreas Boll (7):</p>
<ul>
<li>docs: add news item for 9.0 release</li>
<li>mesa: add get-pick-list.sh script into bin/</li>
<li>mesa: add initial .cherry-ignore file for the 9.0 branch</li>
<li>mesa: use .cherry-ignore in the get-pick-list.sh script</li>
<li>build: add config.sub and config.guess to tarballs target</li>
<li>build: add missing Makefile.in files to tarballs target</li>
<li>build: add missing files to tarballs target</li>
</ul>
<p>Brian Paul (2):</p>
<ul>
<li>mesa: don't call TexImage driver hooks for zero-sized images</li>
<li>mesa: fix error check for zero-sized compressed subtexture</li>
</ul>
<p>Fredrik Höglund (1):</p>
<ul>
<li>egl_dri2/x11: Fix eglPostSubBufferNV()</li>
</ul>
<p>Ian Romanick (5):</p>
<ul>
<li>docs: Add 9.0 release md5sums</li>
<li>i965: Fix regression in depth texture rendering on pre-SNB</li>
<li>glx: Set sRGBCapable to a default value</li>
<li>docs: Add 9.0.1 release notes</li>
<li>mesa: Bump version to 9.0.1</li>
</ul>
<p>Imre Deak (7):</p>
<ul>
<li>mesa: glGet: fix indentation of _mesa_init_get_hash</li>
<li>mesa: glGet: fix indentation of find_value</li>
<li>mesa: glGet: fix indentation of print_table_stats</li>
<li>mesa: glGet: fix API check for EGL_image_external enums</li>
<li>glapi: rename/move GL_POLYGON_OFFSET_BIAS to its extension section</li>
<li>mesa: glGet: fix parameter lookup for apps using multiple APIs</li>
<li>glget: fix make check for glGet GL_POLYGON_OFFSET_BIAS</li>
</ul>
<p>Jonas Ådahl (1):</p>
<ul>
<li>wayland: Destroy frame callback when destroying surface</li>
</ul>
<p>Kenneth Graunke (1):</p>
<ul>
<li>glsl: Allow ir_if in the linker's move_non_declarations function.</li>
</ul>
<p>Kristian Høgsberg (5):</p>
<ul>
<li>gbm: Reject buffers that are not wl_drm buffers in gbm_bo_import()</li>
<li>gbm: Use the kms dumb ioctls for cursor instead of libkms</li>
<li>egl/wayland: Update to Wayland 0.99 API</li>
<li>wayland: Remove 0.85 compatibility #ifdefs</li>
<li>wayland: Drop support for ill-defined, unused wl_egl_pixmap</li>
</ul>
<p>Marcin Slusarz (1):</p>
<ul>
<li>nouveau: use pre-calculated stride for resource_get_handle</li>
</ul>
<p>Matt Turner (4):</p>
<ul>
<li>egl: Return EGL_BAD_MATCH for invalid profile attributes</li>
<li>Re-add HAVE_PTHREADS preprocessor macro</li>
<li>build: Ship install-sh in the tarball</li>
<li>ralloc: Annotate printf functions with PRINTFLIKE(...)</li>
</ul>
<p>Michel Dänzer (2):</p>
<ul>
<li>st/mesa: Fix source miptree level for copying data to finalized miptree.</li>
<li>st/mesa: Fix assertions for copying texture image to finalized miptree.</li>
</ul>
<p>Owen W. Taylor (1):</p>
<ul>
<li>glx: Fix listing of INTEL_swap_event in glXQueryExtensionsString()</li>
</ul>
<p>Quentin Glidic (1):</p>
<ul>
<li>intel: Add missing #include &lt;time.h&gt;</li>
</ul>
<p>Tomeu Vizoso (1):</p>
<ul>
<li>mesa/es: Define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT enum for all GLs</li>
</ul>
</body>
</html>

View File

@@ -1,92 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Mesa Release Notes</title>
<link rel="stylesheet" type="text/css" href="mesa.css">
</head>
<body>
<h1>Mesa 9.0 Release Notes / October 8th, 2012</h1>
<p>
Mesa 9.0 is a new development release.
People who are concerned with stability and reliability should stick
with a previous release or wait for Mesa 9.0.1.
</p>
<p>
Mesa 9.0 implements the OpenGL 3.1 API, but the version reported by
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
Some drivers don't support all the features required in OpenGL 3.1. OpenGL
3.1 is <strong>only</strong> available if requested at context creation
because GL_ARB_compatibility is not supported.
</p>
<h2>MD5 checksums</h2>
<pre>
be4cd34c6599a7cb9d254b05c48bdb1f MesaLib-9.0.tar.gz
60e557ce407be3732711da484ab3db6c MesaLib-9.0.tar.bz2
16b128544cd3f7e237927bb9f8aab7ce MesaLib-9.0.zip
</pre>
<h2>New features</h2>
<p>
Note: some of the new features are only available with certain drivers.
</p>
<ul>
<li>Added new Gallium3D - nv30 driver</li>
<li>Added new Gallium3D - radeonsi driver</li>
<li>Added OpenCL state tracker Clover</li>
<li>Completed VDPAU state tracker (video decoding support is currently limited to MPEG1 and MPEG2)</li>
<li>GL_ARB_base_instance</li>
<li>GL_ARB_blend_func_extended</li>
<li>GL_ARB_debug_output</li>
<li>GL_ARB_invalidate_subdata - Currently a "no-op" implementation. This
extension is always enabled in all drivers.</li>
<li>GL_ARB_shader_bit_encoding</li>
<li>GL_ARB_texture_buffer_object</li>
<li>GL_ARB_timer_query</li>
<li>GL_ARB_transform_feedback3</li>
<li>GL_ARB_transform_feedback_instanced</li>
<li>GL_ARB_uniform_buffer_object</li>
<li>GL_EXT_unpack_subimage for ES 2.0</li>
<li>GL_EXT_read_format_bgra for ES 1.1 and 2.0</li>
<li>GL_EXT_texture_rg for ES 2.x</li>
<li>GL_NV_read_buffer for ES 2.0</li>
<li>GLX_ARB_create_context_robustness</li>
<li>EGL_KHR_create_context</li>
<li>EGL_KHR_surfaceless_context - This replaces the
EGL_KHR_surfaceless_{gles1,gles2,opengl} extensions that were never approved
by Khronos.</li>
<li>EGL_EXT_create_context_robustness</li>
</ul>
<h2>Bug fixes</h2>
<p>TBD -- This list is likely incomplete.</p>
<h2>Changes</h2>
<ul>
<li>
The legacy/static Makefile system (ex: 'make linux-dri') has been removed.
<br>
The two supported build methods are now autoconf/automake and SCons.
</li>
<li>Removed support for GL_ARB_shadow_ambient extension</li>
<li>Removed Gallium3D - nvfx driver (use nv30 instead)</li>
<li>
libGLU has been moved into its own repository, found at <a href="http://cgit.freedesktop.org/mesa/glu/">http://cgit.freedesktop.org/mesa/glu/</a>
</li>
</ul>
</body>
</html>

View File

@@ -14,15 +14,12 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<ul>
<li><a href="relnotes-9.0.1.html">9.0.1 release notes</a>
<li><a href="relnotes-9.0.html">9.0 release notes</a>
<li><a href="relnotes-8.1.html">8.1 release notes</a>
<li><a href="relnotes-8.0.4.html">8.0.4 release notes</a>
<li><a href="relnotes-8.0.3.html">8.0.3 release notes</a>
<li><a href="relnotes-8.0.2.html">8.0.2 release notes</a>
<li><a href="relnotes-8.0.1.html">8.0.1 release notes</a>
<li><a href="relnotes-8.0.html">8.0 release notes</a>
<li><a href="relnotes-7.11.2.html">7.11.2 release notes</a>
<li><a href="relnotes-7.11.1.html">7.11.1 release notes</a>
<li><a href="relnotes-7.11.html">7.11 release notes</a>
<li><a href="relnotes-7.10.3.html">7.10.3 release notes</a>
<li><a href="relnotes-7.10.2.html">7.10.2 release notes</a>

View File

@@ -243,7 +243,7 @@ regressions.
</p>
<p>
The <a href="http://piglit.freedesktop.org/" target="_parent">Piglit</a> project
The <a href="http://people.freedesktop.org/~nh/piglit/" target="_parent">Piglit</a> project
has many GLSL tests and the
<a href="http://glean.sf.net" target="_parent">Glean</a> glsl1 test
tests GLSL features.

View File

@@ -146,6 +146,11 @@ each directory.
</ul>
</ul>
<ul>
<li><b>glu</b> - The OpenGL Utility library
<ul>
<li><b>sgi</b> - GLU from SGI
<li><b>mesa</b> - Mesa version of GLU (deprecated)
</ul>
<li><b>glx</b> - The GLX library code for building libGL. This is used for
direct rendering drivers. It will dynamically load one of the
xxx_dri.so drivers.

View File

@@ -9,25 +9,19 @@
<h1>Development Utilities</h1>
<dl>
<dt><a href="http://cgit.freedesktop.org/mesa/demos"
target="_parent">Mesa demos collection</a></dt>
<dd>includes several utility routines in the <code>src/util/</code>
directory.</dd>
<ul>
<dt><a href="http://piglit.freedesktop.org"
target="_parent">Piglit</a></dt>
<dd>is an open-source test suite for OpenGL implementations.</dd>
<li>The Mesa distribution includes several utility routines in the
progs/util/ directory
<dt><a href="https://github.com/apitrace/apitrace"
target="_parent">ApiTrace</a></dt>
<dd>is a project to trace, analyze and debug graphics api's.</dd>
<li>Allen Akin's <a href="http://glean.sourceforge.net/"
target="_parent">glean</a> is a framework for OpenGL testing.
<dt><a href="http://www.valgrind.org"
target="_parent">Valgrind</a></dt>
<dd>is a very useful tool for tracking down
memory-related problems in your code.</dd>
</dl>
<li><a href="http://www.valgrind.org"
target="_parent">Valgrind</a> is a very useful tool for tracking down
memory-related problems in your code.
</ul>
</body>
</html>

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2007-2012 The Khronos Group Inc.
** Copyright (c) 2007-2010 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
@@ -34,8 +34,8 @@ extern "C" {
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
/* $Revision: 18699 $ on $Date: 2012-07-31 03:04:59 -0700 (Tue, 31 Jul 2012) $ */
#define EGL_EGLEXT_VERSION 14
/* $Revision: 15052 $ on $Date: 2011-07-06 17:43:46 -0700 (Wed, 06 Jul 2011) $ */
#define EGL_EGLEXT_VERSION 10
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
@@ -178,15 +178,15 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
#ifndef EGL_NV_coverage_sample
#define EGL_NV_coverage_sample 1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#endif
#ifndef EGL_NV_depth_nonlinear
#define EGL_NV_depth_nonlinear 1
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NONE_NV 0
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
@@ -208,12 +208,12 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
typedef void* EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLBoolean eglDestroySyncNV (EGLSyncNV sync);
EGLBoolean eglFenceNV (EGLSyncNV sync);
EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
@@ -313,7 +313,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
@@ -328,134 +328,6 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
#ifndef EGL_KHR_stream
#define EGL_KHR_stream 1
typedef void* EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
#define EGL_PRODUCER_FRAME_KHR 0x3212
#define EGL_CONSUMER_FRAME_KHR 0x3213
#define EGL_STREAM_STATE_KHR 0x3214
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
#define EGL_BAD_STREAM_KHR 0x321B
#define EGL_BAD_STATE_KHR 0x321C
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_consumer_gltexture
#define EGL_KHR_stream_consumer_gltexture 1
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_KHR_stream_producer_eglsurface 1
#define EGL_STREAM_BIT_KHR 0x0800
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_aldatalocator
#define EGL_KHR_stream_producer_aldatalocator 1
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_fifo
#define EGL_KHR_stream_fifo 1
/* reuse EGLTimeKHR */
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#endif
#endif
#ifndef EGL_EXT_create_context_robustness
#define EGL_EXT_create_context_robustness 1
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
#endif
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
#endif
#ifndef EGL_KHR_create_context
#define EGL_KHR_create_context 1
#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
#endif
#ifndef EGL_KHR_surfaceless_context
#define EGL_KHR_surfaceless_context 1
/* No tokens/entry points, just relaxes an error condition */
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_cross_process_fd
#define EGL_KHR_stream_cross_process_fd 1
typedef int EGLNativeFileDescriptorKHR;
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
#endif
#endif
#include <EGL/eglmesaext.h>
#ifdef __cplusplus

File diff suppressed because it is too large Load Diff

353
include/GL/glu.h Normal file
View File

@@ -0,0 +1,353 @@
/*
* SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
* Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice including the dates of first publication and
* either this permission notice or a reference to
* http://oss.sgi.com/projects/FreeB/
* 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
* SILICON GRAPHICS, INC. 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.
*
* Except as contained in this notice, the name of Silicon Graphics, Inc.
* shall not be used in advertising or otherwise to promote the sale, use or
* other dealings in this Software without prior written authorization from
* Silicon Graphics, Inc.
*/
#ifndef __glu_h__
#define __glu_h__
#if defined(USE_MGL_NAMESPACE)
#include "glu_mangle.h"
#endif
#include <GL/gl.h>
#ifndef GLAPIENTRY
#if defined(_MSC_VER) || defined(__MINGW32__)
#define GLAPIENTRY __stdcall
#else
#define GLAPIENTRY
#endif
#endif
#ifndef GLAPIENTRYP
#define GLAPIENTRYP GLAPIENTRY *
#endif
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
# undef GLAPI
# define GLAPI __declspec(dllexport)
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
/* tag specifying we're building for DLL runtime support */
# undef GLAPI
# define GLAPI __declspec(dllimport)
#elif !defined(GLAPI)
/* for use with static link lib build of Win32 edition only */
# define GLAPI extern
#endif /* _STATIC_MESA support */
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************/
/* Extensions */
#define GLU_EXT_object_space_tess 1
#define GLU_EXT_nurbs_tessellator 1
/* Boolean */
#define GLU_FALSE 0
#define GLU_TRUE 1
/* Version */
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#define GLU_VERSION_1_3 1
/* StringName */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* ErrorCode */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
#define GLU_INVALID_OPERATION 100904
/* NurbsDisplay */
/* GLU_FILL */
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* NurbsCallback */
#define GLU_NURBS_ERROR 100103
#define GLU_ERROR 100103
#define GLU_NURBS_BEGIN 100164
#define GLU_NURBS_BEGIN_EXT 100164
#define GLU_NURBS_VERTEX 100165
#define GLU_NURBS_VERTEX_EXT 100165
#define GLU_NURBS_NORMAL 100166
#define GLU_NURBS_NORMAL_EXT 100166
#define GLU_NURBS_COLOR 100167
#define GLU_NURBS_COLOR_EXT 100167
#define GLU_NURBS_TEXTURE_COORD 100168
#define GLU_NURBS_TEX_COORD_EXT 100168
#define GLU_NURBS_END 100169
#define GLU_NURBS_END_EXT 100169
#define GLU_NURBS_BEGIN_DATA 100170
#define GLU_NURBS_BEGIN_DATA_EXT 100170
#define GLU_NURBS_VERTEX_DATA 100171
#define GLU_NURBS_VERTEX_DATA_EXT 100171
#define GLU_NURBS_NORMAL_DATA 100172
#define GLU_NURBS_NORMAL_DATA_EXT 100172
#define GLU_NURBS_COLOR_DATA 100173
#define GLU_NURBS_COLOR_DATA_EXT 100173
#define GLU_NURBS_TEXTURE_COORD_DATA 100174
#define GLU_NURBS_TEX_COORD_DATA_EXT 100174
#define GLU_NURBS_END_DATA 100175
#define GLU_NURBS_END_DATA_EXT 100175
/* NurbsError */
#define GLU_NURBS_ERROR1 100251
#define GLU_NURBS_ERROR2 100252
#define GLU_NURBS_ERROR3 100253
#define GLU_NURBS_ERROR4 100254
#define GLU_NURBS_ERROR5 100255
#define GLU_NURBS_ERROR6 100256
#define GLU_NURBS_ERROR7 100257
#define GLU_NURBS_ERROR8 100258
#define GLU_NURBS_ERROR9 100259
#define GLU_NURBS_ERROR10 100260
#define GLU_NURBS_ERROR11 100261
#define GLU_NURBS_ERROR12 100262
#define GLU_NURBS_ERROR13 100263
#define GLU_NURBS_ERROR14 100264
#define GLU_NURBS_ERROR15 100265
#define GLU_NURBS_ERROR16 100266
#define GLU_NURBS_ERROR17 100267
#define GLU_NURBS_ERROR18 100268
#define GLU_NURBS_ERROR19 100269
#define GLU_NURBS_ERROR20 100270
#define GLU_NURBS_ERROR21 100271
#define GLU_NURBS_ERROR22 100272
#define GLU_NURBS_ERROR23 100273
#define GLU_NURBS_ERROR24 100274
#define GLU_NURBS_ERROR25 100275
#define GLU_NURBS_ERROR26 100276
#define GLU_NURBS_ERROR27 100277
#define GLU_NURBS_ERROR28 100278
#define GLU_NURBS_ERROR29 100279
#define GLU_NURBS_ERROR30 100280
#define GLU_NURBS_ERROR31 100281
#define GLU_NURBS_ERROR32 100282
#define GLU_NURBS_ERROR33 100283
#define GLU_NURBS_ERROR34 100284
#define GLU_NURBS_ERROR35 100285
#define GLU_NURBS_ERROR36 100286
#define GLU_NURBS_ERROR37 100287
/* NurbsProperty */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
#define GLU_NURBS_MODE 100160
#define GLU_NURBS_MODE_EXT 100160
#define GLU_NURBS_TESSELLATOR 100161
#define GLU_NURBS_TESSELLATOR_EXT 100161
#define GLU_NURBS_RENDERER 100162
#define GLU_NURBS_RENDERER_EXT 100162
/* NurbsSampling */
#define GLU_OBJECT_PARAMETRIC_ERROR 100208
#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
#define GLU_OBJECT_PATH_LENGTH 100209
#define GLU_OBJECT_PATH_LENGTH_EXT 100209
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
/* NurbsTrim */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* QuadricDrawStyle */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* QuadricCallback */
/* GLU_ERROR */
/* QuadricNormal */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* QuadricOrientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* TessCallback */
#define GLU_TESS_BEGIN 100100
#define GLU_BEGIN 100100
#define GLU_TESS_VERTEX 100101
#define GLU_VERTEX 100101
#define GLU_TESS_END 100102
#define GLU_END 100102
#define GLU_TESS_ERROR 100103
#define GLU_TESS_EDGE_FLAG 100104
#define GLU_EDGE_FLAG 100104
#define GLU_TESS_COMBINE 100105
#define GLU_TESS_BEGIN_DATA 100106
#define GLU_TESS_VERTEX_DATA 100107
#define GLU_TESS_END_DATA 100108
#define GLU_TESS_ERROR_DATA 100109
#define GLU_TESS_EDGE_FLAG_DATA 100110
#define GLU_TESS_COMBINE_DATA 100111
/* TessContour */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
#define GLU_TESS_MISSING_END_POLYGON 100153
#define GLU_TESS_MISSING_END_CONTOUR 100154
#define GLU_TESS_COORD_TOO_LARGE 100155
#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/*************************************************************/
#ifdef __cplusplus
class GLUnurbs;
class GLUquadric;
class GLUtesselator;
#else
typedef struct GLUnurbs GLUnurbs;
typedef struct GLUquadric GLUquadric;
typedef struct GLUtesselator GLUtesselator;
#endif
typedef GLUnurbs GLUnurbsObj;
typedef GLUquadric GLUquadricObj;
typedef GLUtesselator GLUtesselatorObj;
typedef GLUtesselator GLUtriangulatorObj;
#define GLU_TESS_MAX_COORD 1.0e150
/* Internal convenience typedefs */
typedef void (GLAPIENTRYP _GLUfuncptr)(void);
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
#ifdef __cplusplus
}
#endif
#endif /* __glu_h__ */

86
include/GL/glu_mangle.h Normal file
View File

@@ -0,0 +1,86 @@
/*
* Mesa 3-D graphics library
* Version: 3.0
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef GLU_MANGLE_H
#define GLU_MANGLE_H
#define gluLookAt mgluLookAt
#define gluOrtho2D mgluOrtho2D
#define gluPerspective mgluPerspective
#define gluPickMatrix mgluPickMatrix
#define gluProject mgluProject
#define gluUnProject mgluUnProject
#define gluErrorString mgluErrorString
#define gluScaleImage mgluScaleImage
#define gluBuild1DMipmaps mgluBuild1DMipmaps
#define gluBuild2DMipmaps mgluBuild2DMipmaps
#define gluNewQuadric mgluNewQuadric
#define gluDeleteQuadric mgluDeleteQuadric
#define gluQuadricDrawStyle mgluQuadricDrawStyle
#define gluQuadricOrientation mgluQuadricOrientation
#define gluQuadricNormals mgluQuadricNormals
#define gluQuadricTexture mgluQuadricTexture
#define gluQuadricCallback mgluQuadricCallback
#define gluCylinder mgluCylinder
#define gluSphere mgluSphere
#define gluDisk mgluDisk
#define gluPartialDisk mgluPartialDisk
#define gluNewNurbsRenderer mgluNewNurbsRenderer
#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer
#define gluLoadSamplingMatrices mgluLoadSamplingMatrices
#define gluNurbsProperty mgluNurbsProperty
#define gluGetNurbsProperty mgluGetNurbsProperty
#define gluBeginCurve mgluBeginCurve
#define gluEndCurve mgluEndCurve
#define gluNurbsCurve mgluNurbsCurve
#define gluBeginSurface mgluBeginSurface
#define gluEndSurface mgluEndSurface
#define gluNurbsSurface mgluNurbsSurface
#define gluBeginTrim mgluBeginTrim
#define gluEndTrim mgluEndTrim
#define gluPwlCurve mgluPwlCurve
#define gluNurbsCallback mgluNurbsCallback
#define gluNewTess mgluNewTess
#define gluDeleteTess mgluDeleteTess
#define gluTessBeginPolygon mgluTessBeginPolygon
#define gluTessBeginContour mgluTessBeginContour
#define gluTessVertex mgluTessVertex
#define gluTessEndPolygon mgluTessEndPolygon
#define gluTessEndContour mgluTessEndContour
#define gluTessProperty mgluTessProperty
#define gluTessNormal mgluTessNormal
#define gluTessCallback mgluTessCallback
#define gluGetTessProperty mgluGetTessProperty
#define gluBeginPolygon mgluBeginPolygon
#define gluNextContour mgluNextContour
#define gluEndPolygon mgluEndPolygon
#define gluGetString mgluGetString
#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels
#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels
#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels
#define gluBuild3DMipmaps mgluBuild3DMipmaps
#define gluCheckExtension mgluCheckExtension
#define gluUnProject4 mgluUnProject4
#define gluNurbsCallbackData mgluNurbsCallbackData
#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT
#endif

View File

@@ -800,8 +800,8 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_DRI2_VERSION 3
#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
#define __DRI_API_GLES2 2 /**< OpenGL ES 2.0 or 3.0 */
#define __DRI_API_GLES 1
#define __DRI_API_GLES2 2
#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
@@ -923,10 +923,6 @@ struct __DRIdri2ExtensionRec {
* __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
* by the driver (YUV planar formats) but serve as a base image for
* creating sub-images for the different planes within the image.
*
* R8, GR88 and NONE should not be used with createImageFormName or
* createImage, and are returned by query from sub images created with
* createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
*/
#define __DRI_IMAGE_FORMAT_RGB565 0x1001
#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
@@ -939,50 +935,8 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
/**
* Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
* and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
*
* \since 5
*/
#define __DRI_IMAGE_FOURCC_RGB565 0x36314752
#define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
#define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
#define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
#define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
#define __DRI_IMAGE_FOURCC_YUV410 0x39565559
#define __DRI_IMAGE_FOURCC_YUV411 0x31315559
#define __DRI_IMAGE_FOURCC_YUV420 0x32315559
#define __DRI_IMAGE_FOURCC_YUV422 0x36315559
#define __DRI_IMAGE_FOURCC_YUV444 0x34325559
#define __DRI_IMAGE_FOURCC_NV12 0x3231564e
#define __DRI_IMAGE_FOURCC_NV16 0x3631564e
#define __DRI_IMAGE_FOURCC_YUYV 0x56595559
/**
* Queryable on images created by createImageFromNames.
*
* RGB and RGBA are may be usable directly as images but its still
* recommended to call fromPlanar with plane == 0.
*
* Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
* usable sub-images, sampling from images return raw YUV data and
* color conversion needs to be done in the shader.
*
* \since 5
*/
#define __DRI_IMAGE_COMPONENTS_RGB 0x3001
#define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
#define __DRI_IMAGE_USE_CURSOR 0x0004
#define __DRI_IMAGE_USE_WRITE 0x0008
/**
* queryImage attributes
@@ -992,9 +946,8 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
#define __DRI_IMAGE_ATTRIB_NAME 0x2002
#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 5+ */
#define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
#define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
@@ -1032,17 +985,11 @@ struct __DRIimageExtensionRec {
GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
/**
* Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
* __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
* also per block and not per pixel (for non-RGB, see gallium blocks).
* Write data into image.
*
* \since 5
* \since 4
*/
__DRIimage *(*createImageFromNames)(__DRIscreen *screen,
int width, int height, int fourcc,
int *names, int num_names,
int *strides, int *offsets,
void *loaderPrivate);
int (*write)(__DRIimage *image, const void *buf, size_t count);
/**
* Create an image out of a sub-region of a parent image. This
@@ -1059,8 +1006,10 @@ struct __DRIimageExtensionRec {
*
* \since 5
*/
__DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
void *loaderPrivate);
__DRIimage *(*createSubImage)(__DRIimage *image,
int width, int height, int format,
int offset, int pitch,
void *loaderPrivate);
};

View File

@@ -28,37 +28,6 @@ CHIPSET(0x015a, IVYBRIDGE_S_GT1, ivb_gt1)
CHIPSET(0x016a, IVYBRIDGE_S_GT2, ivb_gt2)
CHIPSET(0x0402, HASWELL_GT1, hsw_gt1)
CHIPSET(0x0412, HASWELL_GT2, hsw_gt2)
CHIPSET(0x0422, HASWELL_GT2_PLUS, hsw_gt2)
CHIPSET(0x0406, HASWELL_M_GT1, hsw_gt1)
CHIPSET(0x0416, HASWELL_M_GT2, hsw_gt2)
CHIPSET(0x0426, HASWELL_M_GT2_PLUS, hsw_gt2)
CHIPSET(0x040A, HASWELL_S_GT1, hsw_gt1)
CHIPSET(0x041A, HASWELL_S_GT2, hsw_gt2)
CHIPSET(0x042A, HASWELL_S_GT2_PLUS, hsw_gt2)
CHIPSET(0x0C02, HASWELL_SDV_GT1, hsw_gt1)
CHIPSET(0x0C12, HASWELL_SDV_GT2, hsw_gt2)
CHIPSET(0x0C22, HASWELL_SDV_GT2_PLUS, hsw_gt2)
CHIPSET(0x0C06, HASWELL_SDV_M_GT1, hsw_gt1)
CHIPSET(0x0C16, HASWELL_SDV_M_GT2, hsw_gt2)
CHIPSET(0x0C26, HASWELL_SDV_M_GT2_PLUS, hsw_gt2)
CHIPSET(0x0C0A, HASWELL_SDV_S_GT1, hsw_gt1)
CHIPSET(0x0C1A, HASWELL_SDV_S_GT2, hsw_gt2)
CHIPSET(0x0C2A, HASWELL_SDV_S_GT2_PLUS, hsw_gt2)
CHIPSET(0x0A02, HASWELL_ULT_GT1, hsw_gt1)
CHIPSET(0x0A12, HASWELL_ULT_GT2, hsw_gt2)
CHIPSET(0x0A22, HASWELL_ULT_GT2_PLUS, hsw_gt2)
CHIPSET(0x0A06, HASWELL_ULT_M_GT1, hsw_gt1)
CHIPSET(0x0A16, HASWELL_ULT_M_GT2, hsw_gt2)
CHIPSET(0x0A26, HASWELL_ULT_M_GT2_PLUS, hsw_gt2)
CHIPSET(0x0A0A, HASWELL_ULT_S_GT1, hsw_gt1)
CHIPSET(0x0A1A, HASWELL_ULT_S_GT2, hsw_gt2)
CHIPSET(0x0A2A, HASWELL_ULT_S_GT2_PLUS, hsw_gt2)
CHIPSET(0x0D12, HASWELL_CRW_GT1, hsw_gt1)
CHIPSET(0x0D22, HASWELL_CRW_GT2, hsw_gt2)
CHIPSET(0x0D32, HASWELL_CRW_GT2_PLUS, hsw_gt2)
CHIPSET(0x0D16, HASWELL_CRW_M_GT1, hsw_gt1)
CHIPSET(0x0D26, HASWELL_CRW_M_GT2, hsw_gt2)
CHIPSET(0x0D36, HASWELL_CRW_M_GT2_PLUS, hsw_gt2)
CHIPSET(0x0D1A, HASWELL_CRW_S_GT1, hsw_gt1)
CHIPSET(0x0D2A, HASWELL_CRW_S_GT2, hsw_gt2)
CHIPSET(0x0D3A, HASWELL_CRW_S_GT2_PLUS, hsw_gt2)
CHIPSET(0x0A16, HASWELL_M_ULT_GT2, hsw_gt2)

View File

@@ -157,7 +157,6 @@ CHIPSET(0x68FE, CEDAR_68FE, CEDAR)
CHIPSET(0x68C0, REDWOOD_68C0, REDWOOD)
CHIPSET(0x68C1, REDWOOD_68C1, REDWOOD)
CHIPSET(0x68C7, REDWOOD_68C7, REDWOOD)
CHIPSET(0x68C8, REDWOOD_68C8, REDWOOD)
CHIPSET(0x68C9, REDWOOD_68C9, REDWOOD)
CHIPSET(0x68D8, REDWOOD_68D8, REDWOOD)
@@ -180,8 +179,6 @@ CHIPSET(0x6880, CYPRESS_6880, CYPRESS)
CHIPSET(0x6888, CYPRESS_6888, CYPRESS)
CHIPSET(0x6889, CYPRESS_6889, CYPRESS)
CHIPSET(0x688A, CYPRESS_688A, CYPRESS)
CHIPSET(0x688C, CYPRESS_688C, CYPRESS)
CHIPSET(0x688D, CYPRESS_688D, CYPRESS)
CHIPSET(0x6898, CYPRESS_6898, CYPRESS)
CHIPSET(0x6899, CYPRESS_6899, CYPRESS)
CHIPSET(0x689B, CYPRESS_689B, CYPRESS)

View File

@@ -12,12 +12,9 @@ CHIPSET(0x679F, TAHITI_679F, TAHITI)
CHIPSET(0x6800, PITCAIRN_6800, PITCAIRN)
CHIPSET(0x6801, PITCAIRN_6801, PITCAIRN)
CHIPSET(0x6802, PITCAIRN_6802, PITCAIRN)
CHIPSET(0x6806, PITCAIRN_6806, PITCAIRN)
CHIPSET(0x6808, PITCAIRN_6808, PITCAIRN)
CHIPSET(0x6809, PITCAIRN_6809, PITCAIRN)
CHIPSET(0x6810, PITCAIRN_6810, PITCAIRN)
CHIPSET(0x6816, PITCAIRN_6816, PITCAIRN)
CHIPSET(0x6817, PITCAIRN_6817, PITCAIRN)
CHIPSET(0x6818, PITCAIRN_6818, PITCAIRN)
CHIPSET(0x6819, PITCAIRN_6819, PITCAIRN)
CHIPSET(0x684C, PITCAIRN_684C, PITCAIRN)

5
m4/.gitignore vendored
View File

@@ -1,5 +0,0 @@
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4

View File

@@ -1,309 +0,0 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 18
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
AC_MSG_RESULT($ax_pthread_ok)
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($ax_pthread_ok)
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
ax_cv_PTHREAD_PRIO_INHERIT, [
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <pthread.h>]], [[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], 1, [Have PTHREAD_PRIO_INHERIT.]))
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

View File

@@ -235,15 +235,6 @@ def parse_source_list(env, filename, names=None):
# parse the source list file
parser = source_list.SourceListParser()
src = env.File(filename).srcnode()
cur_srcdir = env.Dir('.').srcnode().abspath
top_srcdir = env.Dir('#').abspath
top_builddir = os.path.join(top_srcdir, env['build_dir'])
# Populate the symbol table of the Makefile parser.
parser.add_symbol('top_srcdir', top_srcdir)
parser.add_symbol('top_builddir', top_builddir)
sym_table = parser.parse(src.abspath)
if names:
@@ -258,21 +249,7 @@ def parse_source_list(env, filename, names=None):
src_lists = {}
for sym in symbols:
val = sym_table[sym]
srcs = []
for f in val.split():
if f:
# Process source paths
if f.startswith(top_builddir + '/src'):
# Automake puts build output on a `src` subdirectory, bue
# SCons does no, so strip it here.
f = top_builddir + f[len(top_builddir + '/src'):]
if f.startswith(cur_srcdir + '/'):
# Prefer relative source paths, as absolute files tend to
# cause duplicate actions.
f = f[len(cur_srcdir + '/'):]
srcs.append(f)
src_lists[sym] = srcs
src_lists[sym] = [f for f in val.split(' ') if f]
# if names are given, concatenate the lists
if names:

View File

@@ -140,8 +140,6 @@ def generate(env):
env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
env['msvc'] = env['CC'] == 'cl'
env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
env['clang'] = env['CC'] == 'clang'
env['icc'] = 'icc' == os.path.basename(env['CC'])
if env['msvc'] and env['toolchain'] == 'default' and env['machine'] == 'x86_64':
# MSVC x64 support is broken in earlier versions of scons
@@ -155,7 +153,6 @@ def generate(env):
gcc = env['gcc']
msvc = env['msvc']
suncc = env['suncc']
icc = env['icc']
# Determine whether we are cross compiling; in particular, whether we need
# to compile code generators with a different compiler as the target code.
@@ -251,7 +248,7 @@ def generate(env):
'_SVID_SOURCE',
'_BSD_SOURCE',
'_GNU_SOURCE',
'HAVE_PTHREAD',
'PTHREADS',
'HAVE_POSIX_MEMALIGN',
]
if env['platform'] == 'darwin':
@@ -298,10 +295,6 @@ def generate(env):
cppdefines += ['BEOS_THREADS']
if env['embedded']:
cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
if env['texture_float']:
print 'warning: Floating-point textures enabled.'
print 'warning: Please consult docs/patents.txt with your lawyer before building Mesa.'
cppdefines += ['TEXTURE_FLOAT_ENABLED']
env.Append(CPPDEFINES = cppdefines)
# C compiler options
@@ -388,10 +381,6 @@ def generate(env):
cflags += [
'-Wdeclaration-after-statement',
]
if icc:
cflags += [
'-std=gnu99',
]
if msvc:
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
@@ -493,12 +482,12 @@ def generate(env):
env.Append(SHLINKFLAGS = shlinkflags)
# We have C++ in several libraries, so always link with the C++ compiler
if env['gcc'] or env['clang']:
if env['gcc']:
env['LINK'] = env['CXX']
# Default libs
libs = []
if env['platform'] in ('darwin', 'freebsd', 'linux', 'posix', 'sunos'):
if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
libs += ['m', 'pthread', 'dl']
env.Append(LIBS = libs)

View File

@@ -180,6 +180,9 @@ def generate(env):
components = ['engine', 'bitwriter', 'x86asmprinter']
if llvm_version >= distutils.version.LooseVersion('3.2'):
components.append('instrumentation')
if llvm_version >= distutils.version.LooseVersion('3.1'):
components.append('mcjit')

View File

@@ -13,7 +13,6 @@ The goal is to allow Makefile's and SConscript's to share source listing.
class SourceListParser(object):
def __init__(self):
self.symbol_table = {}
self._reset()
def _reset(self, filename=None):
@@ -21,6 +20,7 @@ class SourceListParser(object):
self.line_no = 1
self.line_cont = ''
self.symbol_table = {}
def _error(self, msg):
raise RuntimeError('%s:%d: %s' % (self.filename, self.line_no, msg))
@@ -125,6 +125,3 @@ class SourceListParser(object):
raise
return self.symbol_table
def add_symbol(self, name, value):
self.symbol_table[name] = value

View File

@@ -27,6 +27,8 @@ if not env['embedded']:
SConscript('glx/SConscript')
if env['platform'] not in ['darwin', 'haiku', 'sunos']:
SConscript('egl/main/SConscript')
if env['platform'] not in ['darwin']:
SConscript('glu/sgi/SConscript')
if env['gles']:
SConscript('mapi/shared-glapi/SConscript')

View File

@@ -30,7 +30,6 @@ AM_CFLAGS = \
$(DEFINES) \
$(LIBDRM_CFLAGS) \
$(LIBUDEV_CFLAGS) \
$(LIBKMS_CFLAGS) \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
noinst_LTLIBRARIES = libegl_dri2.la

View File

@@ -308,7 +308,7 @@ struct dri2_extension_match {
static struct dri2_extension_match dri2_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
{ __DRI_DRI2, 2, offsetof(struct dri2_egl_display, dri2) },
{ __DRI_DRI2, 1, offsetof(struct dri2_egl_display, dri2) },
{ NULL, 0, 0 }
};
@@ -322,12 +322,12 @@ static struct dri2_extension_match dri2_core_extensions[] = {
static struct dri2_extension_match swrast_driver_extensions[] = {
{ __DRI_CORE, 1, offsetof(struct dri2_egl_display, core) },
{ __DRI_SWRAST, 2, offsetof(struct dri2_egl_display, swrast) },
{ NULL, 0, 0 }
{ NULL }
};
static struct dri2_extension_match swrast_core_extensions[] = {
{ __DRI_TEX_BUFFER, 2, offsetof(struct dri2_egl_display, tex_buffer) },
{ NULL, 0, 0 }
{ NULL }
};
static EGLBoolean
@@ -464,10 +464,16 @@ dri2_setup_screen(_EGLDisplay *disp)
unsigned int api_mask;
if (dri2_dpy->dri2) {
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
if (dri2_dpy->dri2->base.version >= 2)
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
else
api_mask = 1 << __DRI_API_OPENGL;
} else {
assert(dri2_dpy->swrast);
api_mask = 1 << __DRI_API_OPENGL | 1 << __DRI_API_GLES | 1 << __DRI_API_GLES2;
if (dri2_dpy->swrast->base.version >= 2)
api_mask = 1 << __DRI_API_OPENGL | 1 << __DRI_API_GLES | 1 << __DRI_API_GLES2;
else
api_mask = 1 << __DRI_API_OPENGL;
}
disp->ClientAPIs = 0;
@@ -478,14 +484,19 @@ dri2_setup_screen(_EGLDisplay *disp)
if (api_mask & (1 << __DRI_API_GLES2))
disp->ClientAPIs |= EGL_OPENGL_ES2_BIT;
assert(dri2_dpy->dri2 || dri2_dpy->swrast);
disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) {
disp->Extensions.KHR_create_context = EGL_TRUE;
if (dri2_dpy->robustness)
disp->Extensions.EXT_create_context_robustness = EGL_TRUE;
if (dri2_dpy->dri2) {
if (dri2_dpy->dri2->base.version >= 2) {
disp->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
disp->Extensions.KHR_surfaceless_gles2 = EGL_TRUE;
disp->Extensions.KHR_surfaceless_opengl = EGL_TRUE;
}
} else {
assert(dri2_dpy->swrast);
if (dri2_dpy->swrast->base.version >= 2) {
disp->Extensions.KHR_surfaceless_gles1 = EGL_TRUE;
disp->Extensions.KHR_surfaceless_gles2 = EGL_TRUE;
disp->Extensions.KHR_surfaceless_opengl = EGL_TRUE;
}
}
if (dri2_dpy->image) {
@@ -524,16 +535,8 @@ dri2_create_screen(_EGLDisplay *disp)
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen);
if (dri2_dpy->dri2) {
unsigned i;
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
goto cleanup_dri_screen;
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
dri2_dpy->robustness = (__DRIrobustnessExtension *) extensions[i];
}
}
} else {
assert(dri2_dpy->swrast);
if (!dri2_bind_extensions(dri2_dpy, swrast_core_extensions, extensions))
@@ -650,8 +653,6 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
struct dri2_egl_context *dri2_ctx;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx_shared = dri2_egl_context(share_list);
__DRIcontext *shared =
dri2_ctx_shared ? dri2_ctx_shared->dri_context : NULL;
struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
const __DRIconfig *dri_config;
int api;
@@ -669,12 +670,11 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
switch (dri2_ctx->base.ClientAPI) {
case EGL_OPENGL_ES_API:
switch (dri2_ctx->base.ClientMajorVersion) {
switch (dri2_ctx->base.ClientVersion) {
case 1:
api = __DRI_API_GLES;
break;
case 2:
case 3:
api = __DRI_API_GLES2;
break;
default:
@@ -683,13 +683,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
}
break;
case EGL_OPENGL_API:
if ((dri2_ctx->base.ClientMajorVersion >= 4
|| (dri2_ctx->base.ClientMajorVersion == 3
&& dri2_ctx->base.ClientMinorVersion >= 2))
&& dri2_ctx->base.Profile == EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR)
api = __DRI_API_OPENGL_CORE;
else
api = __DRI_API_OPENGL;
api = __DRI_API_OPENGL;
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
@@ -719,72 +713,44 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
dri_config = NULL;
if (dri2_dpy->dri2) {
if (dri2_dpy->dri2->base.version >= 3) {
unsigned error;
unsigned num_attribs = 0;
uint32_t ctx_attribs[8];
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMajorVersion;
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_MINOR_VERSION;
ctx_attribs[num_attribs++] = dri2_ctx->base.ClientMinorVersion;
if (dri2_ctx->base.Flags != 0) {
/* If the implementation doesn't support the __DRI2_ROBUSTNESS
* extension, don't even try to send it the robust-access flag.
* It may explode. Instead, generate the required EGL error here.
*/
if ((dri2_ctx->base.Flags & EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR) != 0
&& !dri2_dpy->robustness) {
_eglError(EGL_BAD_MATCH, "eglCreateContext");
goto cleanup;
}
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_FLAGS;
ctx_attribs[num_attribs++] = dri2_ctx->base.Flags;
}
if (dri2_ctx->base.ResetNotificationStrategy != EGL_NO_RESET_NOTIFICATION_KHR) {
/* If the implementation doesn't support the __DRI2_ROBUSTNESS
* extension, don't even try to send it a reset strategy. It may
* explode. Instead, generate the required EGL error here.
*/
if (!dri2_dpy->robustness) {
_eglError(EGL_BAD_CONFIG, "eglCreateContext");
goto cleanup;
}
ctx_attribs[num_attribs++] = __DRI_CTX_ATTRIB_RESET_STRATEGY;
ctx_attribs[num_attribs++] = __DRI_CTX_RESET_LOSE_CONTEXT;
}
assert(num_attribs <= ARRAY_SIZE(ctx_attribs));
dri2_ctx->dri_context =
dri2_dpy->dri2->createContextAttribs(dri2_dpy->dri_screen,
api,
dri_config,
shared,
num_attribs / 2,
ctx_attribs,
& error,
dri2_ctx);
} else {
if (dri2_dpy->dri2->base.version >= 2) {
dri2_ctx->dri_context =
dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen,
api,
dri_config,
shared,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else if (api == __DRI_API_OPENGL) {
dri2_ctx->dri_context =
dri2_dpy->dri2->createNewContext(dri2_dpy->dri_screen,
dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else {
/* fail */
}
} else {
assert(dri2_dpy->swrast);
dri2_ctx->dri_context =
dri2_dpy->swrast->createNewContextForAPI(dri2_dpy->dri_screen,
api,
dri_config,
shared,
dri2_ctx);
if (dri2_dpy->swrast->base.version >= 2) {
dri2_ctx->dri_context =
dri2_dpy->swrast->createNewContextForAPI(dri2_dpy->dri_screen,
api,
dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else if (api == __DRI_API_OPENGL) {
dri2_ctx->dri_context =
dri2_dpy->core->createNewContext(dri2_dpy->dri_screen,
dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else {
/* fail */
}
}
if (!dri2_ctx->dri_context)
@@ -1093,16 +1059,68 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
* wl_drm format code to a description of the planes in the buffer
* that lets us create a __DRIimage for each of the planes. */
static const struct wl_drm_components_descriptor {
uint32_t dri_components;
static const struct wl_drm_format_descriptor {
uint32_t wl_format;
EGLint components;
int nplanes;
} wl_drm_components[] = {
{ __DRI_IMAGE_COMPONENTS_RGB, EGL_TEXTURE_RGB, 1 },
{ __DRI_IMAGE_COMPONENTS_RGBA, EGL_TEXTURE_RGBA, 1 },
{ __DRI_IMAGE_COMPONENTS_Y_U_V, EGL_TEXTURE_Y_U_V_WL, 3 },
{ __DRI_IMAGE_COMPONENTS_Y_UV, EGL_TEXTURE_Y_UV_WL, 2 },
{ __DRI_IMAGE_COMPONENTS_Y_XUXV, EGL_TEXTURE_Y_XUXV_WL, 2 },
struct {
int buffer_index;
int width_shift;
int height_shift;
uint32_t dri_format;
int cpp;
} planes[3];
} wl_drm_formats[] = {
{ WL_DRM_FORMAT_ARGB8888, EGL_TEXTURE_RGBA, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 }, } },
{ WL_DRM_FORMAT_XRGB8888, EGL_TEXTURE_RGB, 1,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_XRGB8888, 4 }, } },
{ WL_DRM_FORMAT_YUV410, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 2, 2, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV411, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 2, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV420, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 1, 1, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV422, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 1, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_YUV444, EGL_TEXTURE_Y_U_V_WL, 3,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 2, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 } } },
{ WL_DRM_FORMAT_NV12, EGL_TEXTURE_Y_UV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 1, __DRI_IMAGE_FORMAT_GR88, 2 } } },
{ WL_DRM_FORMAT_NV16, EGL_TEXTURE_Y_UV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_R8, 1 },
{ 1, 1, 0, __DRI_IMAGE_FORMAT_GR88, 2 } } },
/* For YUYV buffers, we set up two overlapping DRI images and treat
* them as planar buffers in the compositors. Plane 0 is GR88 and
* samples YU or YV pairs and places Y into the R component, while
* plane 1 is ARGB and samples YUYV clusters and places pairs and
* places U into the G component and V into A. This lets the
* texture sampler interpolate the Y components correctly when
* sampling from plane 0, and interpolate U and V correctly when
* sampling from plane 1. */
{ WL_DRM_FORMAT_YUYV, EGL_TEXTURE_Y_XUXV_WL, 2,
{ { 0, 0, 0, __DRI_IMAGE_FORMAT_GR88, 2 },
{ 0, 1, 0, __DRI_IMAGE_FORMAT_ARGB8888, 4 } } }
};
static _EGLImage *
@@ -1112,11 +1130,13 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
{
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
const struct wl_drm_components_descriptor *f;
__DRIimage *dri_image;
_EGLImageAttribs attrs;
EGLint err;
int32_t plane;
uint32_t format;
int32_t offset, stride, plane, width, height;
int cpp, index;
const struct wl_drm_format_descriptor *f;
if (!wayland_buffer_is_drm(&buffer->buffer))
return NULL;
@@ -1135,12 +1155,17 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
return NULL;
}
dri_image = dri2_dpy->image->fromPlanar(buffer->driver_buffer, plane, NULL);
width = buffer->buffer.width >> f->planes[plane].width_shift;
height = buffer->buffer.height >> f->planes[plane].height_shift;
format = f->planes[plane].dri_format;
cpp = f->planes[plane].cpp;
index = f->planes[plane].buffer_index;
offset = buffer->offset[index];
stride = buffer->stride[index];
if (dri_image == NULL) {
_eglError(EGL_BAD_PARAMETER, "dri2_create_image_wayland_wl_buffer");
return NULL;
}
dri_image = dri2_dpy->image->createSubImage(buffer->driver_buffer,
width, height, format,
offset, stride / cpp, NULL);
return dri2_create_image(disp, dri_image);
}
@@ -1301,31 +1326,24 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
{
_EGLDisplay *disp = user_data;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
__DRIimage *img;
int i, dri_components = 0;
int i;
img = dri2_dpy->image->createImageFromNames(dri2_dpy->dri_screen,
buffer->buffer.width,
buffer->buffer.height,
buffer->format, (int*)&name, 1,
buffer->stride,
buffer->offset,
NULL);
if (img == NULL)
return;
dri2_dpy->image->queryImage(img, __DRI_IMAGE_ATTRIB_COMPONENTS, &dri_components);
buffer->driver_format = NULL;
for (i = 0; i < ARRAY_SIZE(wl_drm_components); i++)
if (wl_drm_components[i].dri_components == dri_components)
buffer->driver_format = &wl_drm_components[i];
for (i = 0; i < ARRAY_SIZE(wl_drm_formats); i++)
if (wl_drm_formats[i].wl_format == buffer->format) {
buffer->driver_format = &wl_drm_formats[i];
break;
}
if (buffer->driver_format == NULL)
dri2_dpy->image->destroyImage(img);
else
buffer->driver_buffer = img;
return;
buffer->driver_buffer =
dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
buffer->buffer.width,
buffer->buffer.height,
__DRI_IMAGE_FORMAT_NONE, name,
buffer->stride[0] / 4,
NULL);
}
static void
@@ -1390,7 +1408,7 @@ dri2_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *disp,
EGLint attribute, EGLint *value)
{
struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer;
const struct wl_drm_components_descriptor *format;
const struct wl_drm_format_descriptor *format;
if (!wayland_buffer_is_drm(&buffer->buffer))
return EGL_FALSE;

View File

@@ -99,7 +99,6 @@ struct dri2_egl_display
__DRI2flushExtension *flush;
__DRItexBufferExtension *tex_buffer;
__DRIimageExtension *image;
__DRIrobustnessExtension *robustness;
int fd;
int own_device;
@@ -122,10 +121,8 @@ struct dri2_egl_display
#ifdef HAVE_WAYLAND_PLATFORM
struct wl_display *wl_dpy;
struct wl_registry *wl_registry;
struct wl_drm *wl_server_drm;
struct wl_drm *wl_drm;
struct wl_event_queue *wl_queue;
int authenticated;
int formats;
#endif
@@ -176,7 +173,7 @@ struct dri2_egl_surface
__DRIbuffer *dri_buffers[__DRI_BUFFER_COUNT];
__DRIbuffer *third_buffer;
__DRIbuffer *pending_buffer;
struct wl_callback *frame_callback;
EGLBoolean block_swap_buffers;
int format;
#endif

View File

@@ -500,14 +500,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
for (j = 0; dri2_dpy->driver_configs[j]; j++) {
const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
struct dri2_egl_config *dri2_conf;
unsigned int double_buffered = 0;
dri2_dpy->core->getConfigAttrib(dri2_dpy->driver_configs[j],
__DRI_ATTRIB_DOUBLE_BUFFER, &double_buffered);
/* support only double buffered configs */
if (!double_buffered)
continue;
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
count + 1, visuals[i].size, surface_type, NULL,
@@ -533,6 +525,17 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
/* there is no front buffer so no OpenGL */
dri2_conf->base.RenderableType &= ~EGL_OPENGL_BIT;
dri2_conf->base.Conformant &= ~EGL_OPENGL_BIT;
/*
* We want to make sure GL_DRAW_BUFFER for windows or pbuffers is always
* GL_BACK. For EGL configs that do not have a double DRI config, clear
* the surface type.
*
* This is just to be on the safe side. dri2_add_config never sets
* EGL_WINDOW_BIT or EGL_PBUFFER_BIT for such configs.
*/
if (!dri2_conf->dri_double_config)
dri2_conf->base.SurfaceType = 0;
}
return (count != 0);
@@ -657,29 +660,18 @@ droid_open_device(void)
return (fd >= 0) ? dup(fd) : -1;
}
/* support versions < JellyBean */
#ifndef ALOGW
#define ALOGW LOGW
#endif
#ifndef ALOGD
#define ALOGD LOGD
#endif
#ifndef ALOGI
#define ALOGI LOGI
#endif
static void
droid_log(EGLint level, const char *msg)
{
switch (level) {
case _EGL_DEBUG:
ALOGD("%s", msg);
LOGD("%s", msg);
break;
case _EGL_INFO:
ALOGI("%s", msg);
LOGI("%s", msg);
break;
case _EGL_WARNING:
ALOGW("%s", msg);
LOGW("%s", msg);
break;
case _EGL_FATAL:
LOG_FATAL("%s", msg);

View File

@@ -45,34 +45,6 @@ enum wl_drm_format_flags {
HAS_XRGB8888 = 2
};
static void
sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
{
int *done = data;
*done = 1;
wl_callback_destroy(callback);
}
static const struct wl_callback_listener sync_listener = {
sync_callback
};
static int
roundtrip(struct dri2_egl_display *dri2_dpy)
{
struct wl_callback *callback;
int done = 0, ret = 0;
callback = wl_display_sync(dri2_dpy->wl_dpy);
wl_callback_add_listener(callback, &sync_listener, &done);
wl_proxy_set_queue((struct wl_proxy *) callback, dri2_dpy->wl_queue);
while (ret != -1 && !done)
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
return ret;
}
static void
wl_buffer_release(void *data, struct wl_buffer *buffer)
{
@@ -108,6 +80,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
struct dri2_egl_surface *dri2_surf;
struct dri2_egl_buffer *dri2_buf;
int i;
(void) drv;
@@ -131,7 +104,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
dri2_surf->pending_buffer = NULL;
dri2_surf->third_buffer = NULL;
dri2_surf->frame_callback = NULL;
dri2_surf->block_swap_buffers = EGL_FALSE;
if (conf->AlphaSize == 0)
dri2_surf->format = WL_DRM_FORMAT_XRGB8888;
@@ -145,6 +118,17 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
dri2_surf->base.Width = -1;
dri2_surf->base.Height = -1;
break;
case EGL_PIXMAP_BIT:
dri2_surf->wl_pix = (struct wl_egl_pixmap *) window;
dri2_surf->base.Width = dri2_surf->wl_pix->width;
dri2_surf->base.Height = dri2_surf->wl_pix->height;
if (dri2_surf->wl_pix->driver_private) {
dri2_buf = dri2_surf->wl_pix->driver_private;
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = dri2_buf->dri_buffer;
}
break;
default:
goto cleanup_surf;
}
@@ -182,6 +166,15 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
window, attrib_list);
}
static _EGLSurface *
dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
return dri2_create_surface(drv, disp, EGL_PIXMAP_BIT, conf,
pixmap, attrib_list);
}
/**
* Called via eglDestroySurface(), drv->API.DestroySurface().
*/
@@ -204,7 +197,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
if (dri2_surf->dri_buffers[i])
if (dri2_surf->dri_buffers[i] && !(i == __DRI_BUFFER_FRONT_LEFT &&
dri2_surf->base.Type == EGL_PIXMAP_BIT))
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
dri2_surf->dri_buffers[i]);
@@ -213,14 +207,27 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
dri2_surf->third_buffer);
}
if (dri2_surf->frame_callback)
wl_callback_destroy(dri2_surf->frame_callback);
free(surf);
return EGL_TRUE;
}
static void
dri2_wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
{
struct dri2_egl_buffer *dri2_buf = egl_pixmap->driver_private;
assert(dri2_buf);
dri2_buf->dri2_dpy->dri2->releaseBuffer(dri2_buf->dri2_dpy->dri_screen,
dri2_buf->dri_buffer);
free(dri2_buf);
egl_pixmap->driver_private = NULL;
egl_pixmap->destroy = NULL;
}
static struct wl_buffer *
wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
__DRIbuffer *buffer)
@@ -260,6 +267,30 @@ dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
}
}
static void
dri2_process_front_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
struct dri2_egl_buffer *dri2_buf;
switch (dri2_surf->base.Type) {
case EGL_PIXMAP_BIT:
dri2_buf = malloc(sizeof *dri2_buf);
if (!dri2_buf)
return;
dri2_buf->dri_buffer = dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT];
dri2_buf->dri2_dpy = dri2_dpy;
dri2_surf->wl_pix->driver_private = dri2_buf;
dri2_surf->wl_pix->destroy = dri2_wl_egl_pixmap_destroy;
break;
default:
break;
}
}
static void
dri2_release_pending_buffer(void *data,
struct wl_callback *callback, uint32_t time)
@@ -302,13 +333,11 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
switch (i) {
case __DRI_BUFFER_FRONT_LEFT:
if (dri2_surf->pending_buffer)
roundtrip(dri2_dpy);
wl_display_roundtrip(dri2_dpy->wl_dpy);
dri2_surf->pending_buffer = dri2_surf->dri_buffers[i];
callback = wl_display_sync(dri2_dpy->wl_dpy);
wl_callback_add_listener(callback,
&release_buffer_listener, dri2_surf);
wl_proxy_set_queue((struct wl_proxy *) callback,
dri2_dpy->wl_queue);
break;
default:
dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
@@ -437,7 +466,9 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
if (!dri2_surf->dri_buffers[attachments[i]])
continue;
if (attachments[i] == __DRI_BUFFER_BACK_LEFT)
if (attachments[i] == __DRI_BUFFER_FRONT_LEFT)
dri2_process_front_buffer(dri2_surf, attachments[i+1]);
else if (attachments[i] == __DRI_BUFFER_BACK_LEFT)
dri2_process_back_buffer(dri2_surf, attachments[i+1]);
}
@@ -448,7 +479,13 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
dri2_surf->buffer_count++;
}
assert(dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
assert(dri2_surf->base.Type == EGL_PIXMAP_BIT ||
dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
if (dri2_surf->base.Type == EGL_PIXMAP_BIT && !dri2_surf->wl_pix->buffer)
dri2_surf->wl_pix->buffer =
wayland_create_buffer(dri2_surf,
dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
*out_count = dri2_surf->buffer_count;
if (dri2_surf->buffer_count == 0)
@@ -515,7 +552,7 @@ wayland_frame_callback(void *data, struct wl_callback *callback, uint32_t time)
{
struct dri2_egl_surface *dri2_surf = data;
dri2_surf->frame_callback = NULL;
dri2_surf->block_swap_buffers = EGL_FALSE;
wl_callback_destroy(callback);
}
@@ -532,18 +569,17 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
int ret = 0;
struct wl_callback *callback;
while (dri2_surf->frame_callback && ret != -1)
ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
if (ret < 0)
return EGL_FALSE;
if (dri2_surf->block_swap_buffers) {
wl_display_flush(dri2_dpy->wl_dpy);
while (dri2_surf->block_swap_buffers)
wl_display_iterate(dri2_dpy->wl_dpy, WL_DISPLAY_READABLE);
}
dri2_surf->frame_callback = wl_surface_frame(dri2_surf->wl_win->surface);
wl_callback_add_listener(dri2_surf->frame_callback,
&frame_listener, dri2_surf);
wl_proxy_set_queue((struct wl_proxy *) dri2_surf->frame_callback,
dri2_dpy->wl_queue);
dri2_surf->block_swap_buffers = EGL_TRUE;
callback = wl_surface_frame(dri2_surf->wl_win->surface);
wl_callback_add_listener(callback, &frame_listener, dri2_surf);
if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
pointer_swap(
@@ -575,8 +611,6 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
dri2_surf->base.Width, dri2_surf->base.Height);
wl_surface_commit(dri2_surf->wl_win->surface);
}
_EGLContext *ctx;
@@ -592,6 +626,71 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
return EGL_TRUE;
}
/**
* Called via eglCreateImageKHR(), drv->API.CreateImageKHR().
*/
static _EGLImage *
dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
EGLClientBuffer buffer, const EGLint *attr_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct wl_egl_pixmap *wl_egl_pixmap = (struct wl_egl_pixmap *) buffer;
struct dri2_egl_buffer *dri2_buf;
EGLint wl_attr_list[] = {
EGL_WIDTH, 0,
EGL_HEIGHT, 0,
EGL_DRM_BUFFER_STRIDE_MESA, 0,
EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
EGL_NONE
};
dri2_buf = malloc(sizeof *dri2_buf);
if (!dri2_buf)
return NULL;
dri2_buf->dri2_dpy = dri2_dpy;
dri2_buf->dri_buffer =
dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
__DRI_BUFFER_FRONT_LEFT, 32,
wl_egl_pixmap->width,
wl_egl_pixmap->height);
wl_egl_pixmap->destroy = dri2_wl_egl_pixmap_destroy;
wl_egl_pixmap->driver_private = dri2_buf;
/* FIXME: Get buffer format from attr_list somehow... or from the
wl_egl_piaxmap. */
wl_egl_pixmap->buffer =
wl_drm_create_buffer(dri2_dpy->wl_drm,
dri2_buf->dri_buffer->name,
wl_egl_pixmap->width,
wl_egl_pixmap->height,
dri2_buf->dri_buffer->pitch,
WL_DRM_FORMAT_ARGB8888);
wl_attr_list[1] = wl_egl_pixmap->width;
wl_attr_list[3] = wl_egl_pixmap->height;
wl_attr_list[5] = dri2_buf->dri_buffer->pitch / 4;
return dri2_create_image_khr(disp->Driver, disp, ctx, EGL_DRM_BUFFER_MESA,
(EGLClientBuffer)(intptr_t) dri2_buf->dri_buffer->name, wl_attr_list);
}
static _EGLImage *
dri2_wayland_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
_EGLContext *ctx, EGLenum target,
EGLClientBuffer buffer, const EGLint *attr_list)
{
(void) drv;
switch (target) {
case EGL_NATIVE_PIXMAP_KHR:
return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
default:
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);
}
}
static int
dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
{
@@ -601,8 +700,7 @@ dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
dri2_dpy->authenticated = 0;
wl_drm_authenticate(dri2_dpy->wl_drm, id);
if (roundtrip(dri2_dpy) < 0)
ret = -1;
wl_display_roundtrip(dri2_dpy->wl_dpy);
if (!dri2_dpy->authenticated)
ret = -1;
@@ -697,37 +795,22 @@ static const struct wl_drm_listener drm_listener = {
drm_handle_authenticated
};
static void
registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
const char *interface, uint32_t version)
{
struct dri2_egl_display *dri2_dpy = data;
if (strcmp(interface, "wl_drm") == 0) {
dri2_dpy->wl_drm =
wl_registry_bind(registry, name, &wl_drm_interface, 1);
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
}
}
static const struct wl_registry_listener registry_listener = {
registry_handle_global
};
EGLBoolean
dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
const __DRIconfig *config;
uint32_t types;
uint32_t id, types;
int i;
static const unsigned int argb_masks[4] =
{ 0xff0000, 0xff00, 0xff, 0xff000000 };
static const unsigned int rgb_masks[4] = { 0xff0000, 0xff00, 0xff, 0 };
drv->API.CreateWindowSurface = dri2_create_window_surface;
drv->API.CreatePixmapSurface = dri2_create_pixmap_surface;
drv->API.DestroySurface = dri2_destroy_surface;
drv->API.SwapBuffers = dri2_swap_buffers;
drv->API.CreateImageKHR = dri2_wayland_create_image_khr;
drv->API.Terminate = dri2_terminate;
dri2_dpy = malloc(sizeof *dri2_dpy);
@@ -746,19 +829,22 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
dri2_dpy->wl_dpy = disp->PlatformDisplay;
}
dri2_dpy->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
dri2_dpy->wl_registry = wl_display_get_registry(dri2_dpy->wl_dpy);
wl_proxy_set_queue((struct wl_proxy *) dri2_dpy->wl_registry,
dri2_dpy->wl_queue);
wl_registry_add_listener(dri2_dpy->wl_registry,
&registry_listener, dri2_dpy);
if (roundtrip(dri2_dpy) < 0 || dri2_dpy->wl_drm == NULL)
id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
if (id == 0)
wl_display_roundtrip(dri2_dpy->wl_dpy);
id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
if (id == 0)
goto cleanup_dpy;
if (roundtrip(dri2_dpy) < 0 || dri2_dpy->fd == -1)
dri2_dpy->wl_drm = wl_display_bind(dri2_dpy->wl_dpy, id, &wl_drm_interface);
if (!dri2_dpy->wl_drm)
goto cleanup_dpy;
wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
wl_display_roundtrip(dri2_dpy->wl_dpy);
if (dri2_dpy->fd == -1)
goto cleanup_drm;
if (roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated)
wl_display_roundtrip(dri2_dpy->wl_dpy);
if (!dri2_dpy->authenticated)
goto cleanup_fd;
dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
@@ -785,7 +871,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_create_screen(disp))
goto cleanup_driver;
types = EGL_WINDOW_BIT;
types = EGL_WINDOW_BIT | EGL_PIXMAP_BIT;
for (i = 0; dri2_dpy->driver_configs[i]; i++) {
config = dri2_dpy->driver_configs[i];
if (dri2_dpy->formats & HAS_XRGB8888)
@@ -794,6 +880,8 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
}
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
dri2_dpy->authenticate = dri2_wayland_authenticate;

View File

@@ -778,9 +778,10 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
if (numRects > (int)ARRAY_SIZE(rectangles))
return dri2_copy_region(drv, disp, draw, dri2_surf->region);
/* FIXME: Invert y here? */
for (i = 0; i < numRects; i++) {
rectangles[i].x = rects[i * 4];
rectangles[i].y = dri2_surf->base.Height - rects[i * 4 + 1] - rects[i * 4 + 3];
rectangles[i].y = rects[i * 4 + 1];
rectangles[i].width = rects[i * 4 + 2];
rectangles[i].height = rects[i * 4 + 3];
}
@@ -797,7 +798,7 @@ static EGLBoolean
dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
EGLint x, EGLint y, EGLint width, EGLint height)
{
const EGLint rect[4] = { x, y, width, height };
const EGLint rect[4] = { x, draw->Height - y - height, width, height };
if (x < 0 || y < 0 || width < 0 || height < 0)
_eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV");

View File

@@ -427,7 +427,9 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
if (!config) {
/* config may be NULL if surfaceless */
if (!disp->Extensions.KHR_surfaceless_context)
if (!disp->Extensions.KHR_surfaceless_gles1 &&
!disp->Extensions.KHR_surfaceless_gles2 &&
!disp->Extensions.KHR_surfaceless_opengl)
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
}
@@ -485,7 +487,9 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read,
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
if (!draw_surf || !read_surf) {
/* surfaces may be NULL if surfaceless */
if (!disp->Extensions.KHR_surfaceless_context)
if (!disp->Extensions.KHR_surfaceless_gles1 &&
!disp->Extensions.KHR_surfaceless_gles2 &&
!disp->Extensions.KHR_surfaceless_opengl)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
if ((!draw_surf && draw != EGL_NO_SURFACE) ||

View File

@@ -49,12 +49,11 @@ _eglGetContextAPIBit(_EGLContext *ctx)
switch (ctx->ClientAPI) {
case EGL_OPENGL_ES_API:
switch (ctx->ClientMajorVersion) {
switch (ctx->ClientVersion) {
case 1:
bit = EGL_OPENGL_ES_BIT;
break;
case 2:
case 3:
bit = EGL_OPENGL_ES2_BIT;
break;
default:
@@ -79,8 +78,7 @@ _eglGetContextAPIBit(_EGLContext *ctx)
* Parse the list of context attributes and return the proper error code.
*/
static EGLint
_eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
const EGLint *attrib_list)
_eglParseContextAttribList(_EGLContext *ctx, const EGLint *attrib_list)
{
EGLenum api = ctx->ClientAPI;
EGLint i, err = EGL_SUCCESS;
@@ -88,113 +86,22 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
if (!attrib_list)
return EGL_SUCCESS;
if (api == EGL_OPENVG_API && attrib_list[0] != EGL_NONE) {
_eglLog(_EGL_DEBUG, "bad context attribute 0x%04x", attrib_list[0]);
return EGL_BAD_ATTRIBUTE;
}
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
EGLint attr = attrib_list[i++];
EGLint val = attrib_list[i];
switch (attr) {
case EGL_CONTEXT_CLIENT_VERSION:
ctx->ClientMajorVersion = val;
if (api != EGL_OPENGL_ES_API) {
err = EGL_BAD_ATTRIBUTE;
break;
}
if (val != 1 && val != 2) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->ClientVersion = val;
break;
case EGL_CONTEXT_MINOR_VERSION_KHR:
if (!dpy->Extensions.KHR_create_context) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->ClientMinorVersion = val;
break;
case EGL_CONTEXT_FLAGS_KHR:
if (!dpy->Extensions.KHR_create_context) {
err = EGL_BAD_ATTRIBUTE;
break;
}
/* The EGL_KHR_create_context spec says:
*
* "Flags are only defined for OpenGL context creation, and
* specifying a flags value other than zero for other types of
* contexts, including OpenGL ES contexts, will generate an
* error."
*/
if (api != EGL_OPENGL_API && val != 0) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->Flags = val;
break;
case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
if (!dpy->Extensions.KHR_create_context) {
err = EGL_BAD_ATTRIBUTE;
break;
}
/* The EGL_KHR_create_context spec says:
*
* "[EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR] is only meaningful for
* OpenGL contexts, and specifying it for other types of
* contexts, including OpenGL ES contexts, will generate an
* error."
*/
if (api != EGL_OPENGL_API) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->Profile = val;
break;
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
/* The EGL_KHR_create_context spec says:
*
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR] is only
* meaningful for OpenGL contexts, and specifying it for other
* types of contexts, including OpenGL ES contexts, will generate
* an error."
*/
if (!dpy->Extensions.KHR_create_context
|| api != EGL_OPENGL_API) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->ResetNotificationStrategy = val;
break;
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
/* The EGL_EXT_create_context_robustness spec says:
*
* "[EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT] is only
* meaningful for OpenGL ES contexts, and specifying it for other
* types of contexts will generate an EGL_BAD_ATTRIBUTE error."
*/
if (!dpy->Extensions.EXT_create_context_robustness
|| api != EGL_OPENGL_ES_API) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->ResetNotificationStrategy = val;
break;
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
if (!dpy->Extensions.EXT_create_context_robustness) {
err = EGL_BAD_ATTRIBUTE;
break;
}
ctx->Flags = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR;
break;
default:
err = EGL_BAD_ATTRIBUTE;
break;
@@ -206,144 +113,6 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy,
}
}
if (api == EGL_OPENGL_API) {
/* The EGL_KHR_create_context spec says:
*
* "If the requested OpenGL version is less than 3.2,
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR is ignored and the
* functionality of the context is determined solely by the
* requested version."
*
* Since the value is ignored, only validate the setting if the version
* is >= 3.2.
*/
if (ctx->ClientMajorVersion >= 4
|| (ctx->ClientMajorVersion == 3 && ctx->ClientMinorVersion >= 2)) {
switch (ctx->Profile) {
case EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR:
case EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR:
break;
default:
/* The EGL_KHR_create_context spec says:
*
* "* If an OpenGL context is requested, the requested version
* is greater than 3.2, and the value for attribute
* EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR has no bits set; has
* any bits set other than EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
* and EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR; has
* more than one of these bits set; or if the implementation does
* not support the requested profile, then an EGL_BAD_MATCH error
* is generated."
*/
err = EGL_BAD_MATCH;
break;
}
}
/* The EGL_KHR_create_context spec says:
*
* "* If an OpenGL context is requested and the values for
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and
* EGL_CONTEXT_MINOR_VERSION_KHR, when considered together with
* the value for attribute
* EGL_CONTEXT_FORWARD_COMPATIBLE_BIT_KHR, specify an OpenGL
* version and feature set that are not defined, than an
* EGL_BAD_MATCH error is generated.
*
* ... Thus, examples of invalid combinations of attributes
* include:
*
* - Major version < 1 or > 4
* - Major version == 1 and minor version < 0 or > 5
* - Major version == 2 and minor version < 0 or > 1
* - Major version == 3 and minor version < 0 or > 2
* - Major version == 4 and minor version < 0 or > 2
* - Forward-compatible flag set and major version < 3"
*/
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0)
err = EGL_BAD_MATCH;
switch (ctx->ClientMajorVersion) {
case 1:
if (ctx->ClientMinorVersion > 5
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0)
err = EGL_BAD_MATCH;
break;
case 2:
if (ctx->ClientMinorVersion > 1
|| (ctx->Flags & EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR) != 0)
err = EGL_BAD_MATCH;
break;
case 3:
/* Note: The text above is incorrect. There *is* an OpenGL 3.3!
*/
if (ctx->ClientMinorVersion > 3)
err = EGL_BAD_MATCH;
break;
case 4:
default:
/* Don't put additional version checks here. We don't know that
* there won't be versions > 4.2.
*/
break;
}
} else if (api == EGL_OPENGL_ES_API) {
/* The EGL_KHR_create_context spec says:
*
* "* If an OpenGL ES context is requested and the values for
* attributes EGL_CONTEXT_MAJOR_VERSION_KHR and
* EGL_CONTEXT_MINOR_VERSION_KHR specify an OpenGL ES version that
* is not defined, than an EGL_BAD_MATCH error is generated.
*
* ... Examples of invalid combinations of attributes include:
*
* - Major version < 1 or > 2
* - Major version == 1 and minor version < 0 or > 1
* - Major version == 2 and minor version != 0
*/
if (ctx->ClientMajorVersion < 1 || ctx->ClientMinorVersion < 0)
err = EGL_BAD_MATCH;
switch (ctx->ClientMajorVersion) {
case 1:
if (ctx->ClientMinorVersion > 1)
err = EGL_BAD_MATCH;
break;
case 2:
if (ctx->ClientMinorVersion > 0)
err = EGL_BAD_MATCH;
break;
case 3:
default:
/* Don't put additional version checks here. We don't know that
* there won't be versions > 3.0.
*/
break;
}
}
switch (ctx->ResetNotificationStrategy) {
case EGL_NO_RESET_NOTIFICATION_KHR:
case EGL_LOSE_CONTEXT_ON_RESET_KHR:
break;
default:
err = EGL_BAD_ATTRIBUTE;
break;
}
if ((ctx->Flags & ~(EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
| EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
| EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR)) != 0) {
err = EGL_BAD_ATTRIBUTE;
}
return err;
}
@@ -368,15 +137,10 @@ _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf,
ctx->ClientAPI = api;
ctx->Config = conf;
ctx->WindowRenderBuffer = EGL_NONE;
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
ctx->ClientMajorVersion = 1; /* the default, per EGL spec */
ctx->ClientMinorVersion = 0;
ctx->Flags = 0;
ctx->Profile = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
ctx->ResetNotificationStrategy = EGL_NO_RESET_NOTIFICATION_KHR;
ctx->ClientVersion = 1; /* the default, per EGL spec */
err = _eglParseContextAttribList(ctx, dpy, attrib_list);
err = _eglParseContextAttribList(ctx, attrib_list);
if (err == EGL_SUCCESS && ctx->Config) {
EGLint api_bit;
@@ -427,7 +191,7 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
*value = c->Config->ConfigID;
break;
case EGL_CONTEXT_CLIENT_VERSION:
*value = c->ClientMajorVersion;
*value = c->ClientVersion;
break;
case EGL_CONTEXT_CLIENT_TYPE:
*value = c->ClientAPI;
@@ -480,6 +244,7 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
_EGLThreadInfo *t = _eglGetCurrentThread();
_EGLDisplay *dpy;
EGLint conflict_api;
EGLBoolean surfaceless;
if (_eglIsCurrentThreadDummy())
return _eglError(EGL_BAD_ALLOC, "eglMakeCurrent");
@@ -492,8 +257,22 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
}
dpy = ctx->Resource.Display;
if (!dpy->Extensions.KHR_surfaceless_context
&& (draw == NULL || read == NULL))
switch (_eglGetContextAPIBit(ctx)) {
case EGL_OPENGL_ES_BIT:
surfaceless = dpy->Extensions.KHR_surfaceless_gles1;
break;
case EGL_OPENGL_ES2_BIT:
surfaceless = dpy->Extensions.KHR_surfaceless_gles2;
break;
case EGL_OPENGL_BIT:
surfaceless = dpy->Extensions.KHR_surfaceless_opengl;
break;
default:
surfaceless = EGL_FALSE;
break;
}
if (!surfaceless && (draw == NULL || read == NULL))
return _eglError(EGL_BAD_MATCH, "eglMakeCurrent");
/*

View File

@@ -52,11 +52,7 @@ struct _egl_context
_EGLConfig *Config;
EGLint ClientAPI; /**< EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */
EGLint ClientMajorVersion;
EGLint ClientMinorVersion;
EGLint Flags;
EGLint Profile;
EGLint ResetNotificationStrategy;
EGLint ClientVersion; /**< 1 = OpenGLES 1.x, 2 = OpenGLES 2.x */
/* The real render buffer when a window surface is bound */
EGLint WindowRenderBuffer;

View File

@@ -42,7 +42,7 @@
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;
#if HAVE_PTHREAD
#if PTHREADS
#include <pthread.h>
static _EGL_DECLARE_MUTEX(_egl_TSDMutex);
@@ -108,7 +108,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE;
}
#else /* HAVE_PTHREAD */
#else /* PTHREADS */
static const _EGLThreadInfo *_egl_TSD;
static void (*_egl_FreeTSD)(_EGLThreadInfo *);
@@ -137,7 +137,7 @@ static INLINE EGLBoolean _eglInitTSD(void (*dtor)(_EGLThreadInfo *))
return EGL_TRUE;
}
#endif /* !HAVE_PTHREAD */
#endif /* !PTHREADS */
static void

View File

@@ -103,8 +103,9 @@ struct _egl_extensions
EGLBoolean KHR_reusable_sync;
EGLBoolean KHR_fence_sync;
EGLBoolean KHR_surfaceless_context;
EGLBoolean KHR_create_context;
EGLBoolean KHR_surfaceless_gles1;
EGLBoolean KHR_surfaceless_gles2;
EGLBoolean KHR_surfaceless_opengl;
EGLBoolean NOK_swap_region;
EGLBoolean NOK_texture_from_pixmap;
@@ -112,8 +113,6 @@ struct _egl_extensions
EGLBoolean ANDROID_image_native_buffer;
EGLBoolean NV_post_sub_buffer;
EGLBoolean EXT_create_context_robustness;
};

View File

@@ -107,16 +107,15 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
_EGL_CHECK_EXTENSION(KHR_reusable_sync);
_EGL_CHECK_EXTENSION(KHR_fence_sync);
_EGL_CHECK_EXTENSION(KHR_surfaceless_context);
_EGL_CHECK_EXTENSION(KHR_create_context);
_EGL_CHECK_EXTENSION(KHR_surfaceless_gles1);
_EGL_CHECK_EXTENSION(KHR_surfaceless_gles2);
_EGL_CHECK_EXTENSION(KHR_surfaceless_opengl);
_EGL_CHECK_EXTENSION(NOK_swap_region);
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
_EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
_EGL_CHECK_EXTENSION(EXT_create_context_robustness);
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);
#undef _EGL_CHECK_EXTENSION
}

View File

@@ -31,7 +31,7 @@
#include "eglcompiler.h"
#ifdef HAVE_PTHREAD
#ifdef PTHREADS
#include <pthread.h>
typedef pthread_mutex_t _EGLMutex;

View File

@@ -36,6 +36,17 @@
#include "wayland-drm.h"
#include "wayland-drm-server-protocol.h"
/* Git master of Wayland is moving towards a stable version of the
* protocol, but breaking from 0.85 in the process. For the time
* being, it's convenient to be able to build Mesa against both master
* and 0.85.x of Wayland. To make this work we'll do a compile-time
* version check and work around the difference in API and protocol */
#if defined (WAYLAND_VERSION_MAJOR) && \
WAYLAND_VERSION_MAJOR == 0 && \
WAYLAND_VERSION_MINOR == 85
#define HAS_WAYLAND_0_85
#endif
struct wl_drm {
struct wl_display *display;
@@ -58,10 +69,25 @@ destroy_buffer(struct wl_resource *resource)
static void
buffer_destroy(struct wl_client *client, struct wl_resource *resource)
{
#ifdef HAS_WAYLAND_0_85
wl_resource_destroy(resource, 0);
#else
wl_resource_destroy(resource);
#endif
}
#ifdef HAS_WAYLAND_0_85
static void
buffer_damage(struct wl_client *client, struct wl_resource *buffer,
int32_t x, int32_t y, int32_t width, int32_t height)
{
}
#endif
const static struct wl_buffer_interface drm_buffer_interface = {
#ifdef HAS_WAYLAND_0_85
buffer_damage,
#endif
buffer_destroy
};

View File

@@ -26,6 +26,17 @@ struct wl_egl_window {
int attached_height;
};
struct wl_egl_pixmap {
struct wl_buffer *buffer;
int width;
int height;
void (*destroy) (struct wl_egl_pixmap *egl_pixmap);
void *driver_private;
};
#ifdef __cplusplus
}
#endif

View File

@@ -48,3 +48,36 @@ wl_egl_window_get_attached_size(struct wl_egl_window *egl_window,
if (height)
*height = egl_window->attached_height;
}
WL_EGL_EXPORT struct wl_egl_pixmap *
wl_egl_pixmap_create(int width, int height, uint32_t flags)
{
struct wl_egl_pixmap *egl_pixmap;
egl_pixmap = malloc(sizeof *egl_pixmap);
if (egl_pixmap == NULL)
return NULL;
egl_pixmap->width = width;
egl_pixmap->height = height;
egl_pixmap->destroy = NULL;
egl_pixmap->buffer = NULL;
egl_pixmap->driver_private = NULL;
return egl_pixmap;
}
WL_EGL_EXPORT void
wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
{
if (egl_pixmap->destroy)
egl_pixmap->destroy(egl_pixmap);
free(egl_pixmap);
}
WL_EGL_EXPORT struct wl_buffer *
wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
{
return egl_pixmap->buffer;
}

View File

@@ -27,7 +27,7 @@
/**
* @file
*
*
* Wrap the cso cache & hash mechanisms in a simplified
* pipe-driver-specific interface.
*
@@ -84,7 +84,8 @@ struct cso_context {
boolean has_geometry_shader;
boolean has_streamout;
struct sampler_info samplers[PIPE_SHADER_TYPES];
struct sampler_info fragment_samplers;
struct sampler_info vertex_samplers;
uint nr_vertex_buffers;
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
@@ -104,9 +105,8 @@ struct cso_context {
void *blend, *blend_saved;
void *depth_stencil, *depth_stencil_saved;
void *rasterizer, *rasterizer_saved;
void *fragment_shader, *fragment_shader_saved;
void *vertex_shader, *vertex_shader_saved;
void *geometry_shader, *geometry_shader_saved;
void *fragment_shader, *fragment_shader_saved, *geometry_shader;
void *vertex_shader, *vertex_shader_saved, *geometry_shader_saved;
void *velements, *velements_saved;
struct pipe_clip_state clip;
@@ -115,7 +115,7 @@ struct cso_context {
struct pipe_framebuffer_state fb, fb_saved;
struct pipe_viewport_state vp, vp_saved;
struct pipe_blend_color blend_color;
unsigned sample_mask, sample_mask_saved;
unsigned sample_mask;
struct pipe_stencil_ref stencil_ref, stencil_ref_saved;
};
@@ -135,8 +135,7 @@ static boolean delete_blend_state(struct cso_context *ctx, void *state)
static boolean delete_depth_stencil_state(struct cso_context *ctx, void *state)
{
struct cso_depth_stencil_alpha *cso =
(struct cso_depth_stencil_alpha *)state;
struct cso_depth_stencil_alpha *cso = (struct cso_depth_stencil_alpha *)state;
if (ctx->depth_stencil == cso->data)
return FALSE;
@@ -190,14 +189,19 @@ static INLINE boolean delete_cso(struct cso_context *ctx,
switch (type) {
case CSO_BLEND:
return delete_blend_state(ctx, state);
break;
case CSO_SAMPLER:
return delete_sampler_state(ctx, state);
break;
case CSO_DEPTH_STENCIL_ALPHA:
return delete_depth_stencil_state(ctx, state);
break;
case CSO_RASTERIZER:
return delete_rasterizer_state(ctx, state);
break;
case CSO_VELEMENTS:
return delete_vertex_elements(ctx, state);
break;
default:
assert(0);
FREE(state);
@@ -205,9 +209,8 @@ static INLINE boolean delete_cso(struct cso_context *ctx,
return FALSE;
}
static INLINE void
sanitize_hash(struct cso_hash *hash, enum cso_cache_type type,
int max_size, void *user_data)
static INLINE void sanitize_hash(struct cso_hash *hash, enum cso_cache_type type,
int max_size, void *user_data)
{
struct cso_context *ctx = (struct cso_context *)user_data;
/* if we're approach the maximum size, remove fourth of the entries
@@ -256,6 +259,8 @@ struct cso_context *cso_create_context( struct pipe_context *pipe )
if (ctx == NULL)
goto out;
assert(PIPE_MAX_SAMPLERS == PIPE_MAX_VERTEX_SAMPLERS);
ctx->cache = cso_cache_create();
if (ctx->cache == NULL)
goto out;
@@ -264,7 +269,6 @@ struct cso_context *cso_create_context( struct pipe_context *pipe )
ctx);
ctx->pipe = pipe;
ctx->sample_mask_saved = ~0;
cso_init_vbuf(ctx);
@@ -283,7 +287,7 @@ struct cso_context *cso_create_context( struct pipe_context *pipe )
return ctx;
out:
cso_destroy_context( ctx );
cso_destroy_context( ctx );
return NULL;
}
@@ -292,7 +296,8 @@ out:
*/
void cso_release_all( struct cso_context *ctx )
{
unsigned i, shader;
unsigned i;
struct sampler_info *info;
if (ctx->pipe) {
ctx->pipe->bind_blend_state( ctx->pipe, NULL );
@@ -312,12 +317,17 @@ void cso_release_all( struct cso_context *ctx )
}
/* free fragment samplers, views */
for (shader = 0; shader < Elements(ctx->samplers); shader++) {
struct sampler_info *info = &ctx->samplers[shader];
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
pipe_sampler_view_reference(&info->views_saved[i], NULL);
}
info = &ctx->fragment_samplers;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
pipe_sampler_view_reference(&info->views_saved[i], NULL);
}
/* free vertex samplers, views */
info = &ctx->vertex_samplers;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
pipe_sampler_view_reference(&info->views_saved[i], NULL);
}
util_unreference_framebuffer_state(&ctx->fb);
@@ -373,12 +383,10 @@ enum pipe_error cso_set_blend(struct cso_context *ctx,
struct cso_hash_iter iter;
void *handle;
key_size = templ->independent_blend_enable ?
sizeof(struct pipe_blend_state) :
(char *)&(templ->rt[1]) - (char *)templ;
key_size = templ->independent_blend_enable ? sizeof(struct pipe_blend_state) :
(char *)&(templ->rt[1]) - (char *)templ;
hash_key = cso_construct_key((void*)templ, key_size);
iter = cso_find_state_template(ctx->cache, hash_key, CSO_BLEND,
(void*)templ, key_size);
iter = cso_find_state_template(ctx->cache, hash_key, CSO_BLEND, (void*)templ, key_size);
if (cso_hash_iter_is_null(iter)) {
struct cso_blend *cso = MALLOC(sizeof(struct cso_blend));
@@ -427,33 +435,28 @@ void cso_restore_blend(struct cso_context *ctx)
enum pipe_error
cso_set_depth_stencil_alpha(struct cso_context *ctx,
const struct pipe_depth_stencil_alpha_state *templ)
enum pipe_error cso_set_depth_stencil_alpha(struct cso_context *ctx,
const struct pipe_depth_stencil_alpha_state *templ)
{
unsigned key_size = sizeof(struct pipe_depth_stencil_alpha_state);
unsigned hash_key = cso_construct_key((void*)templ, key_size);
struct cso_hash_iter iter = cso_find_state_template(ctx->cache,
hash_key,
hash_key,
CSO_DEPTH_STENCIL_ALPHA,
(void*)templ, key_size);
void *handle;
if (cso_hash_iter_is_null(iter)) {
struct cso_depth_stencil_alpha *cso =
MALLOC(sizeof(struct cso_depth_stencil_alpha));
struct cso_depth_stencil_alpha *cso = MALLOC(sizeof(struct cso_depth_stencil_alpha));
if (!cso)
return PIPE_ERROR_OUT_OF_MEMORY;
memcpy(&cso->state, templ, sizeof(*templ));
cso->data = ctx->pipe->create_depth_stencil_alpha_state(ctx->pipe,
&cso->state);
cso->delete_state =
(cso_state_callback)ctx->pipe->delete_depth_stencil_alpha_state;
cso->data = ctx->pipe->create_depth_stencil_alpha_state(ctx->pipe, &cso->state);
cso->delete_state = (cso_state_callback)ctx->pipe->delete_depth_stencil_alpha_state;
cso->context = ctx->pipe;
iter = cso_insert_state(ctx->cache, hash_key,
CSO_DEPTH_STENCIL_ALPHA, cso);
iter = cso_insert_state(ctx->cache, hash_key, CSO_DEPTH_STENCIL_ALPHA, cso);
if (cso_hash_iter_is_null(iter)) {
FREE(cso);
return PIPE_ERROR_OUT_OF_MEMORY;
@@ -462,8 +465,7 @@ cso_set_depth_stencil_alpha(struct cso_context *ctx,
handle = cso->data;
}
else {
handle = ((struct cso_depth_stencil_alpha *)
cso_hash_iter_data(iter))->data;
handle = ((struct cso_depth_stencil_alpha *)cso_hash_iter_data(iter))->data;
}
if (ctx->depth_stencil != handle) {
@@ -483,8 +485,7 @@ void cso_restore_depth_stencil_alpha(struct cso_context *ctx)
{
if (ctx->depth_stencil != ctx->depth_stencil_saved) {
ctx->depth_stencil = ctx->depth_stencil_saved;
ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe,
ctx->depth_stencil_saved);
ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe, ctx->depth_stencil_saved);
}
ctx->depth_stencil_saved = NULL;
}
@@ -497,8 +498,7 @@ enum pipe_error cso_set_rasterizer(struct cso_context *ctx,
unsigned key_size = sizeof(struct pipe_rasterizer_state);
unsigned hash_key = cso_construct_key((void*)templ, key_size);
struct cso_hash_iter iter = cso_find_state_template(ctx->cache,
hash_key,
CSO_RASTERIZER,
hash_key, CSO_RASTERIZER,
(void*)templ, key_size);
void *handle = NULL;
@@ -509,8 +509,7 @@ enum pipe_error cso_set_rasterizer(struct cso_context *ctx,
memcpy(&cso->state, templ, sizeof(*templ));
cso->data = ctx->pipe->create_rasterizer_state(ctx->pipe, &cso->state);
cso->delete_state =
(cso_state_callback)ctx->pipe->delete_rasterizer_state;
cso->delete_state = (cso_state_callback)ctx->pipe->delete_rasterizer_state;
cso->context = ctx->pipe;
iter = cso_insert_state(ctx->cache, hash_key, CSO_RASTERIZER, cso);
@@ -691,16 +690,6 @@ enum pipe_error cso_set_sample_mask(struct cso_context *ctx,
return PIPE_OK;
}
void cso_save_sample_mask(struct cso_context *ctx)
{
ctx->sample_mask_saved = ctx->sample_mask;
}
void cso_restore_sample_mask(struct cso_context *ctx)
{
cso_set_sample_mask(ctx, ctx->sample_mask_saved);
}
enum pipe_error cso_set_stencil_ref(struct cso_context *ctx,
const struct pipe_stencil_ref *sr)
{
@@ -719,8 +708,7 @@ void cso_save_stencil_ref(struct cso_context *ctx)
void cso_restore_stencil_ref(struct cso_context *ctx)
{
if (memcmp(&ctx->stencil_ref, &ctx->stencil_ref_saved,
sizeof(ctx->stencil_ref))) {
if (memcmp(&ctx->stencil_ref, &ctx->stencil_ref_saved, sizeof(ctx->stencil_ref))) {
ctx->stencil_ref = ctx->stencil_ref_saved;
ctx->pipe->set_stencil_ref(ctx->pipe, &ctx->stencil_ref);
}
@@ -812,10 +800,9 @@ cso_restore_clip(struct cso_context *ctx)
}
}
enum pipe_error
cso_set_vertex_elements(struct cso_context *ctx,
unsigned count,
const struct pipe_vertex_element *states)
enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
unsigned count,
const struct pipe_vertex_element *states)
{
struct u_vbuf *vbuf = ctx->vbuf;
unsigned key_size, hash_key;
@@ -828,18 +815,15 @@ cso_set_vertex_elements(struct cso_context *ctx,
return PIPE_OK;
}
/* Need to include the count into the stored state data too.
* Otherwise first few count pipe_vertex_elements could be identical
* even if count is different, and there's no guarantee the hash would
* be different in that case neither.
*/
/* need to include the count into the stored state data too.
Otherwise first few count pipe_vertex_elements could be identical even if count
is different, and there's no guarantee the hash would be different in that
case neither */
key_size = sizeof(struct pipe_vertex_element) * count + sizeof(unsigned);
velems_state.count = count;
memcpy(velems_state.velems, states,
sizeof(struct pipe_vertex_element) * count);
memcpy(velems_state.velems, states, sizeof(struct pipe_vertex_element) * count);
hash_key = cso_construct_key((void*)&velems_state, key_size);
iter = cso_find_state_template(ctx->cache, hash_key, CSO_VELEMENTS,
(void*)&velems_state, key_size);
iter = cso_find_state_template(ctx->cache, hash_key, CSO_VELEMENTS, (void*)&velems_state, key_size);
if (cso_hash_iter_is_null(iter)) {
struct cso_velements *cso = MALLOC(sizeof(struct cso_velements));
@@ -847,10 +831,8 @@ cso_set_vertex_elements(struct cso_context *ctx,
return PIPE_ERROR_OUT_OF_MEMORY;
memcpy(&cso->state, &velems_state, key_size);
cso->data = ctx->pipe->create_vertex_elements_state(ctx->pipe, count,
&cso->state.velems[0]);
cso->delete_state =
(cso_state_callback) ctx->pipe->delete_vertex_elements_state;
cso->data = ctx->pipe->create_vertex_elements_state(ctx->pipe, count, &cso->state.velems[0]);
cso->delete_state = (cso_state_callback)ctx->pipe->delete_vertex_elements_state;
cso->context = ctx->pipe;
iter = cso_insert_state(ctx->cache, hash_key, CSO_VELEMENTS, cso);
@@ -988,8 +970,7 @@ single_sampler(struct cso_context *ctx,
memcpy(&cso->state, templ, sizeof(*templ));
cso->data = ctx->pipe->create_sampler_state(ctx->pipe, &cso->state);
cso->delete_state =
(cso_state_callback) ctx->pipe->delete_sampler_state;
cso->delete_state = (cso_state_callback)ctx->pipe->delete_sampler_state;
cso->context = ctx->pipe;
iter = cso_insert_state(ctx->cache, hash_key, CSO_SAMPLER, cso);
@@ -1012,19 +993,26 @@ single_sampler(struct cso_context *ctx,
enum pipe_error
cso_single_sampler(struct cso_context *ctx,
unsigned shader_stage,
unsigned idx,
const struct pipe_sampler_state *templ)
{
return single_sampler(ctx, &ctx->samplers[shader_stage], idx, templ);
return single_sampler(ctx, &ctx->fragment_samplers, idx, templ);
}
enum pipe_error
cso_single_vertex_sampler(struct cso_context *ctx,
unsigned idx,
const struct pipe_sampler_state *templ)
{
return single_sampler(ctx, &ctx->vertex_samplers, idx, templ);
}
static void
single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
single_sampler_done(struct cso_context *ctx,
struct sampler_info *info)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
/* find highest non-null sampler */
@@ -1038,39 +1026,39 @@ single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
if (info->hw.nr_samplers != info->nr_samplers ||
memcmp(info->hw.samplers,
info->samplers,
info->nr_samplers * sizeof(void *)) != 0)
info->nr_samplers * sizeof(void *)) != 0)
{
memcpy(info->hw.samplers,
info->samplers,
info->nr_samplers * sizeof(void *));
info->hw.nr_samplers = info->nr_samplers;
switch (shader_stage) {
case PIPE_SHADER_FRAGMENT:
if (info == &ctx->fragment_samplers) {
ctx->pipe->bind_fragment_sampler_states(ctx->pipe,
info->nr_samplers,
info->samplers);
break;
case PIPE_SHADER_VERTEX:
}
else if (info == &ctx->vertex_samplers) {
ctx->pipe->bind_vertex_sampler_states(ctx->pipe,
info->nr_samplers,
info->samplers);
break;
case PIPE_SHADER_GEOMETRY:
ctx->pipe->bind_geometry_sampler_states(ctx->pipe,
info->nr_samplers,
info->samplers);
break;
default:
assert(!"bad shader type in single_sampler_done()");
}
else {
assert(0);
}
}
}
void
cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
cso_single_sampler_done( struct cso_context *ctx )
{
single_sampler_done(ctx, shader_stage);
single_sampler_done(ctx, &ctx->fragment_samplers);
}
void
cso_single_vertex_sampler_done(struct cso_context *ctx)
{
single_sampler_done(ctx, &ctx->vertex_samplers);
}
@@ -1079,13 +1067,12 @@ cso_single_sampler_done(struct cso_context *ctx, unsigned shader_stage)
* last one. Done to always try to set as many samplers
* as possible.
*/
enum pipe_error
cso_set_samplers(struct cso_context *ctx,
unsigned shader_stage,
unsigned nr,
const struct pipe_sampler_state **templates)
static enum pipe_error
set_samplers(struct cso_context *ctx,
struct sampler_info *info,
unsigned nr,
const struct pipe_sampler_state **templates)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
enum pipe_error temp, error = PIPE_OK;
@@ -1104,38 +1091,82 @@ cso_set_samplers(struct cso_context *ctx,
error = temp;
}
single_sampler_done(ctx, shader_stage);
single_sampler_done(ctx, info);
return error;
}
void
cso_save_samplers(struct cso_context *ctx, unsigned shader_stage)
enum pipe_error
cso_set_samplers(struct cso_context *ctx,
unsigned nr,
const struct pipe_sampler_state **templates)
{
return set_samplers(ctx, &ctx->fragment_samplers, nr, templates);
}
enum pipe_error
cso_set_vertex_samplers(struct cso_context *ctx,
unsigned nr,
const struct pipe_sampler_state **templates)
{
return set_samplers(ctx, &ctx->vertex_samplers, nr, templates);
}
static void
save_samplers(struct cso_context *ctx, struct sampler_info *info)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
info->nr_samplers_saved = info->nr_samplers;
memcpy(info->samplers_saved, info->samplers, sizeof(info->samplers));
}
void
cso_save_samplers(struct cso_context *ctx)
{
save_samplers(ctx, &ctx->fragment_samplers);
}
void
cso_restore_samplers(struct cso_context *ctx, unsigned shader_stage)
cso_save_vertex_samplers(struct cso_context *ctx)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
info->nr_samplers = info->nr_samplers_saved;
memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers));
single_sampler_done(ctx, shader_stage);
save_samplers(ctx, &ctx->vertex_samplers);
}
void
cso_set_sampler_views(struct cso_context *ctx,
unsigned shader_stage,
unsigned count,
struct pipe_sampler_view **views)
static void
restore_samplers(struct cso_context *ctx, struct sampler_info *info)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
info->nr_samplers = info->nr_samplers_saved;
memcpy(info->samplers, info->samplers_saved, sizeof(info->samplers));
single_sampler_done(ctx, info);
}
void
cso_restore_samplers(struct cso_context *ctx)
{
restore_samplers(ctx, &ctx->fragment_samplers);
}
void
cso_restore_vertex_samplers(struct cso_context *ctx)
{
restore_samplers(ctx, &ctx->vertex_samplers);
}
static void
set_sampler_views(struct cso_context *ctx,
struct sampler_info *info,
void (*set_views)(struct pipe_context *,
unsigned num_views,
struct pipe_sampler_view **),
uint count,
struct pipe_sampler_view **views)
{
uint i;
/* reference new views */
for (i = 0; i < count; i++) {
@@ -1149,27 +1180,36 @@ cso_set_sampler_views(struct cso_context *ctx,
info->nr_views = count;
/* bind the new sampler views */
switch (shader_stage) {
case PIPE_SHADER_FRAGMENT:
ctx->pipe->set_fragment_sampler_views(ctx->pipe, count, info->views);
break;
case PIPE_SHADER_VERTEX:
ctx->pipe->set_vertex_sampler_views(ctx->pipe, count, info->views);
break;
case PIPE_SHADER_GEOMETRY:
ctx->pipe->set_geometry_sampler_views(ctx->pipe, count, info->views);
break;
default:
assert(!"bad shader type in cso_set_sampler_views()");
}
set_views(ctx->pipe, count, info->views);
}
void
cso_set_fragment_sampler_views(struct cso_context *ctx,
uint count,
struct pipe_sampler_view **views)
{
set_sampler_views(ctx, &ctx->fragment_samplers,
ctx->pipe->set_fragment_sampler_views,
count, views);
}
void
cso_set_vertex_sampler_views(struct cso_context *ctx,
uint count,
struct pipe_sampler_view **views)
{
set_sampler_views(ctx, &ctx->vertex_samplers,
ctx->pipe->set_vertex_sampler_views,
count, views);
}
void
cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
static void
save_sampler_views(struct cso_context *ctx,
struct sampler_info *info)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i;
uint i;
info->nr_views_saved = info->nr_views;
@@ -1179,14 +1219,29 @@ cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage)
}
}
void
cso_save_fragment_sampler_views(struct cso_context *ctx)
{
save_sampler_views(ctx, &ctx->fragment_samplers);
}
void
cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
cso_save_vertex_sampler_views(struct cso_context *ctx)
{
struct sampler_info *info = &ctx->samplers[shader_stage];
unsigned i, nr_saved = info->nr_views_saved;
save_sampler_views(ctx, &ctx->vertex_samplers);
}
for (i = 0; i < nr_saved; i++) {
static void
restore_sampler_views(struct cso_context *ctx,
struct sampler_info *info,
void (*set_views)(struct pipe_context *,
unsigned num_views,
struct pipe_sampler_view **))
{
uint i;
for (i = 0; i < info->nr_views_saved; i++) {
pipe_sampler_view_reference(&info->views[i], NULL);
/* move the reference from one pointer to another */
info->views[i] = info->views_saved[i];
@@ -1197,24 +1252,26 @@ cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage)
}
/* bind the old/saved sampler views */
switch (shader_stage) {
case PIPE_SHADER_FRAGMENT:
ctx->pipe->set_fragment_sampler_views(ctx->pipe, nr_saved, info->views);
break;
case PIPE_SHADER_VERTEX:
ctx->pipe->set_vertex_sampler_views(ctx->pipe, nr_saved, info->views);
break;
case PIPE_SHADER_GEOMETRY:
ctx->pipe->set_geometry_sampler_views(ctx->pipe, nr_saved, info->views);
break;
default:
assert(!"bad shader type in cso_restore_sampler_views()");
}
set_views(ctx->pipe, info->nr_views_saved, info->views);
info->nr_views = nr_saved;
info->nr_views = info->nr_views_saved;
info->nr_views_saved = 0;
}
void
cso_restore_fragment_sampler_views(struct cso_context *ctx)
{
restore_sampler_views(ctx, &ctx->fragment_samplers,
ctx->pipe->set_fragment_sampler_views);
}
void
cso_restore_vertex_sampler_views(struct cso_context *ctx)
{
restore_sampler_views(ctx, &ctx->vertex_samplers,
ctx->pipe->set_vertex_sampler_views);
}
void
cso_set_stream_outputs(struct cso_context *ctx,

View File

@@ -69,29 +69,39 @@ void cso_save_rasterizer(struct cso_context *cso);
void cso_restore_rasterizer(struct cso_context *cso);
enum pipe_error
cso_set_samplers(struct cso_context *cso,
unsigned shader_stage,
unsigned count,
const struct pipe_sampler_state **states);
void
cso_save_samplers(struct cso_context *cso, unsigned shader_stage);
void
cso_restore_samplers(struct cso_context *cso, unsigned shader_stage);
enum pipe_error cso_set_samplers( struct cso_context *cso,
unsigned count,
const struct pipe_sampler_state **states );
void cso_save_samplers(struct cso_context *cso);
void cso_restore_samplers(struct cso_context *cso);
/* Alternate interface to support state trackers that like to modify
* samplers one at a time:
*/
enum pipe_error
cso_single_sampler(struct cso_context *cso,
unsigned shader_stage,
unsigned count,
const struct pipe_sampler_state *states);
enum pipe_error cso_single_sampler( struct cso_context *cso,
unsigned nr,
const struct pipe_sampler_state *states );
void cso_single_sampler_done( struct cso_context *cso );
enum pipe_error cso_set_vertex_samplers(struct cso_context *cso,
unsigned count,
const struct pipe_sampler_state **states);
void
cso_single_sampler_done(struct cso_context *cso, unsigned shader_stage);
cso_save_vertex_samplers(struct cso_context *cso);
void
cso_restore_vertex_samplers(struct cso_context *cso);
enum pipe_error
cso_single_vertex_sampler(struct cso_context *cso,
unsigned nr,
const struct pipe_sampler_state *states);
void
cso_single_vertex_sampler_done(struct cso_context *cso);
enum pipe_error cso_set_vertex_elements(struct cso_context *ctx,
@@ -116,13 +126,6 @@ void cso_save_stream_outputs(struct cso_context *ctx);
void cso_restore_stream_outputs(struct cso_context *ctx);
/*
* We don't provide shader caching in CSO. Most of the time the api provides
* object semantics for shaders anyway, and the cases where it doesn't
* (eg mesa's internally-generated texenv programs), it will be up to
* the state tracker to implement their own specialized caching.
*/
enum pipe_error cso_set_fragment_shader_handle(struct cso_context *ctx,
void *handle );
void cso_delete_fragment_shader(struct cso_context *ctx, void *handle );
@@ -161,8 +164,6 @@ enum pipe_error cso_set_blend_color(struct cso_context *cso,
enum pipe_error cso_set_sample_mask(struct cso_context *cso,
unsigned stencil_mask);
void cso_save_sample_mask(struct cso_context *ctx);
void cso_restore_sample_mask(struct cso_context *ctx);
enum pipe_error cso_set_stencil_ref(struct cso_context *cso,
const struct pipe_stencil_ref *sr);
@@ -183,21 +184,39 @@ void
cso_restore_clip(struct cso_context *cso);
/* sampler view state */
/* fragment sampler view state */
/*
* We don't provide shader caching in CSO. Most of the time the api provides
* object semantics for shaders anyway, and the cases where it doesn't
* (eg mesa's internally-generated texenv programs), it will be up to
* the state tracker to implement their own specialized caching.
*/
void
cso_set_sampler_views(struct cso_context *cso,
unsigned shader_stage,
unsigned count,
struct pipe_sampler_view **views);
cso_set_fragment_sampler_views(struct cso_context *cso,
uint count,
struct pipe_sampler_view **views);
void
cso_save_sampler_views(struct cso_context *cso, unsigned shader_stage);
cso_save_fragment_sampler_views(struct cso_context *cso);
void
cso_restore_sampler_views(struct cso_context *cso, unsigned shader_stage);
cso_restore_fragment_sampler_views(struct cso_context *cso);
/* vertex sampler view state */
void
cso_set_vertex_sampler_views(struct cso_context *cso,
uint count,
struct pipe_sampler_view **views);
void
cso_save_vertex_sampler_views(struct cso_context *cso);
void
cso_restore_vertex_sampler_views(struct cso_context *cso);
/* drawing */

View File

@@ -576,7 +576,7 @@ draw_num_shader_outputs(const struct draw_context *draw)
/**
* Provide TGSI sampler objects for vertex/geometry shaders that use
* texture fetches. This state only needs to be set once per context.
* texture fetches.
* This might only be used by software drivers for the time being.
*/
void
@@ -586,12 +586,12 @@ draw_texture_samplers(struct draw_context *draw,
struct tgsi_sampler **samplers)
{
if (shader == PIPE_SHADER_VERTEX) {
draw->vs.tgsi.num_samplers = num_samplers;
draw->vs.tgsi.samplers = samplers;
draw->vs.num_samplers = num_samplers;
draw->vs.samplers = samplers;
} else {
debug_assert(shader == PIPE_SHADER_GEOMETRY);
draw->gs.tgsi.num_samplers = num_samplers;
draw->gs.tgsi.samplers = samplers;
draw->gs.num_samplers = num_samplers;
draw->gs.samplers = samplers;
}
}
@@ -621,7 +621,7 @@ draw_set_indexes(struct draw_context *draw,
elem_size == 2 ||
elem_size == 4);
draw->pt.user.elts = elements;
draw->pt.user.eltSizeIB = elem_size;
draw->pt.user.eltSize = elem_size;
}
@@ -754,50 +754,45 @@ draw_set_so_state(struct draw_context *draw,
void
draw_set_sampler_views(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_view **views,
unsigned num)
{
unsigned i;
debug_assert(shader_stage < PIPE_SHADER_TYPES);
debug_assert(num <= PIPE_MAX_SAMPLERS);
debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
for (i = 0; i < num; ++i)
draw->sampler_views[shader_stage][i] = views[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
draw->sampler_views[shader_stage][i] = NULL;
draw->sampler_views[i] = views[i];
for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
draw->sampler_views[i] = NULL;
draw->num_sampler_views[shader_stage] = num;
draw->num_sampler_views = num;
}
void
draw_set_samplers(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_state **samplers,
unsigned num)
{
unsigned i;
debug_assert(shader_stage < PIPE_SHADER_TYPES);
debug_assert(num <= PIPE_MAX_SAMPLERS);
debug_assert(num <= PIPE_MAX_VERTEX_SAMPLERS);
for (i = 0; i < num; ++i)
draw->samplers[shader_stage][i] = samplers[i];
for (i = num; i < PIPE_MAX_SAMPLERS; ++i)
draw->samplers[shader_stage][i] = NULL;
draw->samplers[i] = samplers[i];
for (i = num; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
draw->samplers[i] = NULL;
draw->num_samplers[shader_stage] = num;
draw->num_samplers = num;
#ifdef HAVE_LLVM
if (draw->llvm && shader_stage == PIPE_SHADER_VERTEX)
if (draw->llvm)
draw_llvm_set_sampler_state(draw);
#endif
}
void
draw_set_mapped_texture(struct draw_context *draw,
unsigned shader_stage,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
@@ -805,15 +800,13 @@ draw_set_mapped_texture(struct draw_context *draw,
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
const void *data[PIPE_MAX_TEXTURE_LEVELS])
{
if (shader_stage == PIPE_SHADER_VERTEX) {
#ifdef HAVE_LLVM
if (draw->llvm)
draw_llvm_set_mapped_texture(draw,
sampler_idx,
width, height, depth, first_level, last_level,
row_stride, img_stride, data);
if(draw->llvm)
draw_llvm_set_mapped_texture(draw,
sampler_idx,
width, height, depth, first_level, last_level,
row_stride, img_stride, data);
#endif
}
}
/**

View File

@@ -139,18 +139,15 @@ draw_texture_samplers(struct draw_context *draw,
void
draw_set_sampler_views(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_view **views,
unsigned num);
void
draw_set_samplers(struct draw_context *draw,
unsigned shader_stage,
struct pipe_sampler_state **samplers,
unsigned num);
void
draw_set_mapped_texture(struct draw_context *draw,
unsigned shader_stage,
unsigned sampler_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,

View File

@@ -45,15 +45,15 @@
boolean
draw_gs_init( struct draw_context *draw )
{
draw->gs.tgsi.machine = tgsi_exec_machine_create();
if (!draw->gs.tgsi.machine)
draw->gs.machine = tgsi_exec_machine_create();
if (!draw->gs.machine)
return FALSE;
draw->gs.tgsi.machine->Primitives = align_malloc(
draw->gs.machine->Primitives = align_malloc(
MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector), 16);
if (!draw->gs.tgsi.machine->Primitives)
if (!draw->gs.machine->Primitives)
return FALSE;
memset(draw->gs.tgsi.machine->Primitives, 0,
memset(draw->gs.machine->Primitives, 0,
MAX_PRIMITIVES * sizeof(struct tgsi_exec_vector));
return TRUE;
@@ -61,12 +61,12 @@ draw_gs_init( struct draw_context *draw )
void draw_gs_destroy( struct draw_context *draw )
{
if (!draw->gs.tgsi.machine)
if (!draw->gs.machine)
return;
align_free(draw->gs.tgsi.machine->Primitives);
align_free(draw->gs.machine->Primitives);
tgsi_exec_machine_destroy(draw->gs.tgsi.machine);
tgsi_exec_machine_destroy(draw->gs.machine);
}
void
@@ -121,7 +121,7 @@ draw_create_geometry_shader(struct draw_context *draw,
gs->max_output_vertices = gs->info.properties[i].data[0];
}
gs->machine = draw->gs.tgsi.machine;
gs->machine = draw->gs.machine;
if (gs)
{
@@ -483,7 +483,7 @@ void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
if (shader && shader->machine->Tokens != shader->state.tokens) {
tgsi_exec_machine_bind_shader(shader->machine,
shader->state.tokens,
draw->gs.tgsi.num_samplers,
draw->gs.tgsi.samplers);
draw->gs.num_samplers,
draw->gs.samplers);
}
}

View File

@@ -164,7 +164,7 @@ create_jit_context_type(struct gallivm_state *gallivm,
DRAW_TOTAL_CLIP_PLANES), 0);
elem_types[3] = LLVMPointerType(float_type, 0); /* viewport */
elem_types[4] = LLVMArrayType(texture_type,
PIPE_MAX_SAMPLERS); /* textures */
PIPE_MAX_VERTEX_SAMPLERS); /* textures */
context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
Elements(elem_types), 0);
#if HAVE_LLVM < 0x0300
@@ -559,7 +559,7 @@ convert_to_soa(struct gallivm_state *gallivm,
unsigned pixels_per_channel = soa_type.length / TGSI_NUM_CHANNELS;
for (j = 0; j < TGSI_NUM_CHANNELS; ++j) {
LLVMValueRef channel[LP_MAX_VECTOR_LENGTH] = { 0 };
LLVMValueRef channel[LP_MAX_VECTOR_LENGTH];
assert(pixels_per_channel <= LP_MAX_VECTOR_LENGTH);
@@ -1351,8 +1351,8 @@ draw_llvm_make_variant_key(struct draw_llvm *llvm, char *store)
for (i = 0 ; i < key->nr_samplers; i++) {
lp_sampler_static_state(&sampler[i],
llvm->draw->sampler_views[PIPE_SHADER_VERTEX][i],
llvm->draw->samplers[PIPE_SHADER_VERTEX][i]);
llvm->draw->sampler_views[i],
llvm->draw->samplers[i]);
}
return key;
@@ -1371,7 +1371,7 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned j;
struct draw_jit_texture *jit_tex;
assert(sampler_idx < Elements(draw->llvm->jit_context.textures));
assert(sampler_idx < PIPE_MAX_VERTEX_SAMPLERS);
jit_tex = &draw->llvm->jit_context.textures[sampler_idx];
@@ -1394,16 +1394,14 @@ draw_llvm_set_sampler_state(struct draw_context *draw)
{
unsigned i;
for (i = 0; i < draw->num_samplers[PIPE_SHADER_VERTEX]; i++) {
for (i = 0; i < draw->num_samplers; i++) {
struct draw_jit_texture *jit_tex = &draw->llvm->jit_context.textures[i];
if (draw->samplers[i]) {
const struct pipe_sampler_state *s
= draw->samplers[PIPE_SHADER_VERTEX][i];
jit_tex->min_lod = s->min_lod;
jit_tex->max_lod = s->max_lod;
jit_tex->lod_bias = s->lod_bias;
COPY_4V(jit_tex->border_color, s->border_color.f);
jit_tex->min_lod = draw->samplers[i]->min_lod;
jit_tex->max_lod = draw->samplers[i]->max_lod;
jit_tex->lod_bias = draw->samplers[i]->lod_bias;
COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color.f);
}
}
}

View File

@@ -97,7 +97,7 @@ struct draw_jit_context
float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
float *viewport;
struct draw_jit_texture textures[PIPE_MAX_SAMPLERS];
struct draw_jit_texture textures[PIPE_MAX_VERTEX_SAMPLERS];
};
@@ -184,7 +184,7 @@ struct draw_llvm_variant_key
#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_llvm_variant_key) + \
PIPE_MAX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \
PIPE_MAX_VERTEX_SAMPLERS * sizeof(struct lp_sampler_static_state) + \
(PIPE_MAX_ATTRIBS-1) * sizeof(struct pipe_vertex_element))

View File

@@ -98,7 +98,7 @@ draw_llvm_texture_member(const struct lp_sampler_dynamic_state *base,
LLVMValueRef ptr;
LLVMValueRef res;
debug_assert(unit < PIPE_MAX_SAMPLERS);
debug_assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
/* context[0] */
indices[0] = lp_build_const_int32(gallivm, 0);
@@ -180,7 +180,7 @@ draw_llvm_sampler_soa_emit_fetch_texel(const struct lp_build_sampler_soa *base,
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
lp_build_sample_soa(gallivm,
&sampler->dynamic_state.static_state[unit],
@@ -207,7 +207,7 @@ draw_llvm_sampler_soa_emit_size_query(const struct lp_build_sampler_soa *base,
{
struct draw_llvm_sampler_soa *sampler = (struct draw_llvm_sampler_soa *)base;
assert(unit < PIPE_MAX_SAMPLERS);
assert(unit < PIPE_MAX_VERTEX_SAMPLERS);
lp_build_size_query_soa(gallivm,
&sampler->dynamic_state.static_state[unit],

View File

@@ -174,7 +174,6 @@ struct draw_context
/** vertex element/index buffer (ex: glDrawElements) */
const void *elts;
/** bytes per index (0, 1, 2 or 4) */
unsigned eltSizeIB;
unsigned eltSize;
int eltBias;
unsigned min_index;
@@ -241,14 +240,12 @@ struct draw_context
uint edgeflag_output;
uint clipvertex_output;
uint clipdistance_output[2];
/** TGSI program interpreter runtime state */
struct tgsi_exec_machine *machine;
/** Fields for TGSI interpreter / execution */
struct {
struct tgsi_exec_machine *machine;
uint num_samplers;
struct tgsi_sampler **samplers;
struct tgsi_sampler **samplers;
uint num_samplers;
} tgsi;
const void *aligned_constants[PIPE_MAX_CONSTANT_BUFFERS];
@@ -268,14 +265,11 @@ struct draw_context
uint num_gs_outputs; /**< convenience, from geometry_shader */
uint position_output;
/** Fields for TGSI interpreter / execution */
struct {
struct tgsi_exec_machine *machine;
struct tgsi_sampler **samplers;
uint num_samplers;
} tgsi;
/** TGSI program interpreter runtime state */
struct tgsi_exec_machine *machine;
uint num_samplers;
struct tgsi_sampler **samplers;
} gs;
/** Fragment shader state */
@@ -309,15 +303,10 @@ struct draw_context
struct draw_llvm *llvm;
#endif
/** Texture sampler and sampler view state.
* Note that we have arrays indexed by shader type. At this time
* we only handle vertex and geometry shaders in the draw module, but
* there may be more in the future (ex: hull and tessellation).
*/
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
unsigned num_sampler_views[PIPE_SHADER_TYPES];
const struct pipe_sampler_state *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
unsigned num_samplers[PIPE_SHADER_TYPES];
struct pipe_sampler_view *sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
unsigned num_sampler_views;
const struct pipe_sampler_state *samplers[PIPE_MAX_VERTEX_SAMPLERS];
unsigned num_samplers;
void *driver_private;
};

View File

@@ -362,7 +362,7 @@ draw_pt_arrays_restart(struct draw_context *draw,
assert(info->primitive_restart);
if (draw->pt.user.eltSize) {
if (draw->pt.user.elts) {
/* indexed prims (draw_elements) */
cur_start = start;
cur_count = 0;
@@ -433,8 +433,12 @@ draw_arrays_instanced(struct draw_context *draw,
info.count = count;
info.start_instance = startInstance;
info.instance_count = instanceCount;
info.min_index = start;
info.max_index = start + count - 1;
info.indexed = (draw->pt.user.elts != NULL);
if (!info.indexed) {
info.min_index = start;
info.max_index = start + count - 1;
}
draw_vbo(draw, &info);
}
@@ -461,7 +465,6 @@ draw_vbo(struct draw_context *draw,
draw->pt.user.eltBias = info->index_bias;
draw->pt.user.min_index = info->min_index;
draw->pt.user.max_index = info->max_index;
draw->pt.user.eltSize = info->indexed ? draw->pt.user.eltSizeIB : 0;
if (0)
debug_printf("draw_vbo(mode=%u start=%u count=%u):\n",

View File

@@ -193,8 +193,8 @@ draw_vs_init( struct draw_context *draw )
{
draw->dump_vs = debug_get_option_gallium_dump_vs();
draw->vs.tgsi.machine = tgsi_exec_machine_create();
if (!draw->vs.tgsi.machine)
draw->vs.machine = tgsi_exec_machine_create();
if (!draw->vs.machine)
return FALSE;
draw->vs.emit_cache = translate_cache_create();
@@ -225,7 +225,7 @@ draw_vs_destroy( struct draw_context *draw )
}
}
tgsi_exec_machine_destroy(draw->vs.tgsi.machine);
tgsi_exec_machine_destroy(draw->vs.machine);
}

View File

@@ -69,8 +69,8 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
if (evs->machine->Tokens != shader->state.tokens) {
tgsi_exec_machine_bind_shader(evs->machine,
shader->state.tokens,
draw->vs.tgsi.num_samplers,
draw->vs.tgsi.samplers);
draw->vs.num_samplers,
draw->vs.samplers);
}
}
@@ -235,7 +235,7 @@ draw_create_vs_exec(struct draw_context *draw,
vs->base.run_linear = vs_exec_run_linear;
vs->base.delete = vs_exec_delete;
vs->base.create_variant = draw_vs_create_variant_generic;
vs->machine = draw->vs.tgsi.machine;
vs->machine = draw->vs.machine;
return &vs->base;
}

View File

@@ -81,12 +81,8 @@ lp_check_alignment(const void *ptr, unsigned alignment)
class raw_debug_ostream :
public llvm::raw_ostream
{
private:
uint64_t pos;
public:
raw_debug_ostream() : pos(0) { }
void write_impl(const char *Ptr, size_t Size);
#if HAVE_LLVM >= 0x207

View File

@@ -54,7 +54,7 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
{
struct lp_build_context bld;
LLVMBuilderRef builder = gallivm->builder;
LLVMTypeRef src_vec_type;
LLVMTypeRef src_elem_type, src_vec_type;
LLVMValueRef ptr, res = NULL;
struct lp_type src_type;
@@ -68,6 +68,7 @@ lp_build_fetch_rgba_aos_array(struct gallivm_state *gallivm,
assert(src_type.length <= dst_type.length);
src_elem_type = lp_build_elem_type(gallivm, src_type);
src_vec_type = lp_build_vec_type(gallivm, src_type);
/* Read whole vector from memory, unaligned */

View File

@@ -96,14 +96,15 @@ lp_sampler_static_state(struct lp_sampler_static_state *state,
const struct pipe_sampler_view *view,
const struct pipe_sampler_state *sampler)
{
const struct pipe_resource *texture;
const struct pipe_resource *texture = view->texture;
memset(state, 0, sizeof *state);
if (!sampler || !view || !view->texture)
if(!texture)
return;
texture = view->texture;
if(!sampler)
return;
/*
* We don't copy sampler state over unless it is actually enabled, to avoid

View File

@@ -43,9 +43,9 @@ pp_nocolor(struct pp_queue_t *ppq, struct pipe_resource *in,
pp_filter_set_fb(p);
pp_filter_misc_state(p);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
cso_single_sampler(p->cso, 0, &p->sampler_point);
cso_single_sampler_done(p->cso);
cso_set_fragment_sampler_views(p->cso, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]);
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]);

View File

@@ -152,7 +152,7 @@ pp_free(struct pp_queue_t *ppq)
util_destroy_blit(ppq->p->blitctx);
cso_set_sampler_views(ppq->p->cso, PIPE_SHADER_FRAGMENT, 0, NULL);
cso_set_fragment_sampler_views(ppq->p->cso, 0, NULL);
cso_release_all(ppq->p->cso);
for (i = 0; i < ppq->n_filters; i++) {

View File

@@ -125,9 +125,9 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR,
&p->clear_color, 0, 0);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
cso_single_sampler(p->cso, 0, &p->sampler_point);
cso_single_sampler_done(p->cso);
cso_set_fragment_sampler_views(p->cso, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]);
@@ -152,13 +152,13 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
pp_filter_set_clear_fb(p);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->sampler_point);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 2, &p->sampler);
cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
cso_single_sampler(p->cso, 0, &p->sampler_point);
cso_single_sampler(p->cso, 1, &p->sampler_point);
cso_single_sampler(p->cso, 2, &p->sampler);
cso_single_sampler_done(p->cso);
arr[0] = p->view;
cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 3, arr);
cso_set_fragment_sampler_views(p->cso, 3, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]);
@@ -184,12 +184,12 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
u_sampler_view_default_template(&v_tmp, in, in->format);
arr[0] = p->pipe->create_sampler_view(p->pipe, in, &v_tmp);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 0, &p->sampler_point);
cso_single_sampler(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->sampler_point);
cso_single_sampler_done(p->cso, PIPE_SHADER_FRAGMENT);
cso_single_sampler(p->cso, 0, &p->sampler_point);
cso_single_sampler(p->cso, 1, &p->sampler_point);
cso_single_sampler_done(p->cso);
arr[1] = p->view;
cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 2, arr);
cso_set_fragment_sampler_views(p->cso, 2, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]);

View File

@@ -140,7 +140,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 0, 0, 0, 0, 0, 1, NONE, "BGNSUB", TGSI_OPCODE_BGNSUB },
{ 0, 0, 0, 1, 1, 0, NONE, "ENDLOOP", TGSI_OPCODE_ENDLOOP },
{ 0, 0, 0, 0, 1, 0, NONE, "ENDSUB", TGSI_OPCODE_ENDSUB },
{ 1, 1, 1, 0, 0, 0, OTHR, "TXQ_LZ", TGSI_OPCODE_TXQ_LZ },
{ 0, 0, 0, 0, 0, 0, NONE, "", 103 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "", 104 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "", 105 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "", 106 }, /* removed */
@@ -338,7 +338,6 @@ tgsi_opcode_infer_dst_type( uint opcode )
case TGSI_OPCODE_USHR:
case TGSI_OPCODE_SHL:
case TGSI_OPCODE_TXQ:
case TGSI_OPCODE_TXQ_LZ:
return TGSI_TYPE_UNSIGNED;
case TGSI_OPCODE_F2I:
case TGSI_OPCODE_IDIV:

View File

@@ -92,13 +92,11 @@ const char *tgsi_texture_names[TGSI_TEXTURE_COUNT] =
"SHADOW1D",
"SHADOW2D",
"SHADOWRECT",
"1D_ARRAY",
"2D_ARRAY",
"SHADOW1D_ARRAY",
"SHADOW2D_ARRAY",
"1DARRAY",
"2DARRAY",
"SHADOW1DARRAY",
"SHADOW2DARRAY",
"SHADOWCUBE",
"2D_MSAA",
"2D_ARRAY_MSAA",
"UNKNOWN"
};

View File

@@ -81,11 +81,6 @@ streq_nocase_uprcase(const char *str1,
return *str1 == 0 && *str2 == 0;
}
/* Return TRUE if both strings match.
* The second string is terminated by zero.
* The pointer to the first string is moved at end of the read word
* on success.
*/
static boolean str_match_no_case( const char **pcur, const char *str )
{
const char *cur = *pcur;
@@ -101,24 +96,6 @@ static boolean str_match_no_case( const char **pcur, const char *str )
return FALSE;
}
/* Return TRUE if both strings match.
* The first string is be terminated by a non-digit non-letter non-underscore
* character, the second string is terminated by zero.
* The pointer to the first string is moved at end of the read word
* on success.
*/
static boolean str_match_nocase_whole( const char **pcur, const char *str )
{
const char *cur = *pcur;
if (str_match_no_case(&cur, str) &&
!is_digit_alpha_underscore(cur)) {
*pcur = cur;
return TRUE;
}
return FALSE;
}
/* Eat zero or more whitespaces.
*/
static void eat_opt_white( const char **pcur )
@@ -272,13 +249,13 @@ static boolean parse_header( struct translate_ctx *ctx )
{
uint processor;
if (str_match_nocase_whole( &ctx->cur, "FRAG" ))
if (str_match_no_case( &ctx->cur, "FRAG" ))
processor = TGSI_PROCESSOR_FRAGMENT;
else if (str_match_nocase_whole( &ctx->cur, "VERT" ))
else if (str_match_no_case( &ctx->cur, "VERT" ))
processor = TGSI_PROCESSOR_VERTEX;
else if (str_match_nocase_whole( &ctx->cur, "GEOM" ))
else if (str_match_no_case( &ctx->cur, "GEOM" ))
processor = TGSI_PROCESSOR_GEOMETRY;
else if (str_match_nocase_whole( &ctx->cur, "COMP" ))
else if (str_match_no_case( &ctx->cur, "COMP" ))
processor = TGSI_PROCESSOR_COMPUTE;
else {
report_error( ctx, "Unknown header" );
@@ -321,10 +298,12 @@ parse_file( const char **pcur, uint *file )
for (i = 0; i < TGSI_FILE_COUNT; i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_file_names[i] )) {
*pcur = cur;
*file = i;
return TRUE;
if (str_match_no_case( &cur, tgsi_file_names[i] )) {
if (!is_digit_alpha_underscore( cur )) {
*pcur = cur;
*file = i;
return TRUE;
}
}
}
return FALSE;
@@ -827,34 +806,12 @@ parse_src_operand(
}
static boolean
match_inst(const char **pcur,
unsigned *saturate,
const struct tgsi_opcode_info *info)
match_inst_mnemonic(const char **pcur,
const struct tgsi_opcode_info *info)
{
const char *cur = *pcur;
/* simple case: the whole string matches the instruction name */
if (str_match_nocase_whole(&cur, info->mnemonic)) {
*pcur = cur;
*saturate = TGSI_SAT_NONE;
if (str_match_no_case(pcur, info->mnemonic)) {
return TRUE;
}
if (str_match_no_case(&cur, info->mnemonic)) {
/* the instruction has a suffix, figure it out */
if (str_match_nocase_whole(&cur, "_SAT")) {
*pcur = cur;
*saturate = TGSI_SAT_ZERO_ONE;
return TRUE;
}
if (str_match_nocase_whole(&cur, "_SATNV")) {
*pcur = cur;
*saturate = TGSI_SAT_MINUS_PLUS_ONE;
return TRUE;
}
}
return FALSE;
}
@@ -916,10 +873,17 @@ parse_instruction(
cur = ctx->cur;
info = tgsi_get_opcode_info( i );
if (match_inst(&cur, &saturate, info)) {
if (match_inst_mnemonic(&cur, info)) {
if (str_match_no_case( &cur, "_SATNV" ))
saturate = TGSI_SAT_MINUS_PLUS_ONE;
else if (str_match_no_case( &cur, "_SAT" ))
saturate = TGSI_SAT_ZERO_ONE;
if (info->num_dst + info->num_src + info->is_tex == 0) {
ctx->cur = cur;
break;
if (!is_digit_alpha_underscore( cur )) {
ctx->cur = cur;
break;
}
}
else if (*cur == '\0' || eat_white( &cur )) {
ctx->cur = cur;
@@ -965,10 +929,12 @@ parse_instruction(
uint j;
for (j = 0; j < TGSI_TEXTURE_COUNT; j++) {
if (str_match_nocase_whole( &ctx->cur, tgsi_texture_names[j] )) {
inst.Instruction.Texture = 1;
inst.Texture.Texture = j;
break;
if (str_match_no_case( &ctx->cur, tgsi_texture_names[j] )) {
if (!is_digit_alpha_underscore( ctx->cur )) {
inst.Instruction.Texture = 1;
inst.Texture.Texture = j;
break;
}
}
}
if (j == TGSI_TEXTURE_COUNT) {
@@ -1111,9 +1077,11 @@ static boolean parse_declaration( struct translate_ctx *ctx )
eat_opt_white( &cur );
if (file == TGSI_FILE_RESOURCE) {
for (i = 0; i < TGSI_TEXTURE_COUNT; i++) {
if (str_match_nocase_whole(&cur, tgsi_texture_names[i])) {
decl.Resource.Resource = i;
break;
if (str_match_no_case(&cur, tgsi_texture_names[i])) {
if (!is_digit_alpha_underscore(cur)) {
decl.Resource.Resource = i;
break;
}
}
}
if (i == TGSI_TEXTURE_COUNT) {
@@ -1126,10 +1094,12 @@ static boolean parse_declaration( struct translate_ctx *ctx )
while (*cur2 == ',') {
cur2++;
eat_opt_white(&cur2);
if (str_match_nocase_whole(&cur2, "RAW")) {
if (str_match_no_case(&cur2, "RAW") &&
!is_digit_alpha_underscore(cur2)) {
decl.Resource.Raw = 1;
} else if (str_match_nocase_whole(&cur2, "WR")) {
} else if (str_match_no_case(&cur2, "WR") &&
!is_digit_alpha_underscore(cur2)) {
decl.Resource.Writable = 1;
} else {
@@ -1143,9 +1113,11 @@ static boolean parse_declaration( struct translate_ctx *ctx )
} else if (file == TGSI_FILE_SAMPLER_VIEW) {
for (i = 0; i < TGSI_TEXTURE_COUNT; i++) {
if (str_match_nocase_whole(&cur, tgsi_texture_names[i])) {
decl.SamplerView.Resource = i;
break;
if (str_match_no_case(&cur, tgsi_texture_names[i])) {
if (!is_digit_alpha_underscore(cur)) {
decl.SamplerView.Resource = i;
break;
}
}
}
if (i == TGSI_TEXTURE_COUNT) {
@@ -1161,24 +1133,26 @@ static boolean parse_declaration( struct translate_ctx *ctx )
eat_opt_white( &cur );
for (j = 0; j < 4; ++j) {
for (i = 0; i < PIPE_TYPE_COUNT; ++i) {
if (str_match_nocase_whole(&cur, tgsi_type_names[i])) {
switch (j) {
case 0:
decl.SamplerView.ReturnTypeX = i;
if (str_match_no_case(&cur, tgsi_type_names[i])) {
if (!is_digit_alpha_underscore(cur)) {
switch (j) {
case 0:
decl.SamplerView.ReturnTypeX = i;
break;
case 1:
decl.SamplerView.ReturnTypeY = i;
break;
case 2:
decl.SamplerView.ReturnTypeZ = i;
break;
case 3:
decl.SamplerView.ReturnTypeW = i;
break;
default:
assert(0);
}
break;
case 1:
decl.SamplerView.ReturnTypeY = i;
break;
case 2:
decl.SamplerView.ReturnTypeZ = i;
break;
case 3:
decl.SamplerView.ReturnTypeW = i;
break;
default:
assert(0);
}
break;
}
}
if (i == PIPE_TYPE_COUNT) {
@@ -1207,7 +1181,8 @@ static boolean parse_declaration( struct translate_ctx *ctx )
}
ctx->cur = cur;
} else {
if (str_match_nocase_whole(&cur, "LOCAL")) {
if (str_match_no_case(&cur, "LOCAL") &&
!is_digit_alpha_underscore(cur)) {
decl.Declaration.Local = 1;
ctx->cur = cur;
}
@@ -1219,9 +1194,11 @@ static boolean parse_declaration( struct translate_ctx *ctx )
eat_opt_white( &cur );
for (i = 0; i < TGSI_SEMANTIC_COUNT; i++) {
if (str_match_nocase_whole(&cur, tgsi_semantic_names[i])) {
if (str_match_no_case( &cur, tgsi_semantic_names[i] )) {
uint index;
if (is_digit_alpha_underscore( cur ))
continue;
cur2 = cur;
eat_opt_white( &cur2 );
if (*cur2 == '[') {
@@ -1300,7 +1277,9 @@ static boolean parse_declaration( struct translate_ctx *ctx )
cur++;
eat_opt_white( &cur );
for (i = 0; i < TGSI_INTERPOLATE_COUNT; i++) {
if (str_match_nocase_whole( &cur, tgsi_interpolate_names[i] )) {
if (str_match_no_case( &cur, tgsi_interpolate_names[i] )) {
if (is_digit_alpha_underscore( cur ))
continue;
decl.Declaration.Interpolate = 1;
decl.Interp.Interpolate = i;
@@ -1341,7 +1320,8 @@ static boolean parse_immediate( struct translate_ctx *ctx )
return FALSE;
}
for (type = 0; type < Elements(tgsi_immediate_type_names); ++type) {
if (str_match_nocase_whole(&ctx->cur, tgsi_immediate_type_names[type]))
if (str_match_no_case(&ctx->cur, tgsi_immediate_type_names[type]) &&
!is_digit_alpha_underscore(ctx->cur))
break;
}
if (type == Elements(tgsi_immediate_type_names)) {
@@ -1374,7 +1354,7 @@ parse_primitive( const char **pcur, uint *primitive )
for (i = 0; i < PIPE_PRIM_MAX; i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_primitive_names[i])) {
if (str_match_no_case( &cur, tgsi_primitive_names[i])) {
*primitive = i;
*pcur = cur;
return TRUE;
@@ -1391,7 +1371,7 @@ parse_fs_coord_origin( const char **pcur, uint *fs_coord_origin )
for (i = 0; i < Elements(tgsi_fs_coord_origin_names); i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_fs_coord_origin_names[i])) {
if (str_match_no_case( &cur, tgsi_fs_coord_origin_names[i])) {
*fs_coord_origin = i;
*pcur = cur;
return TRUE;
@@ -1408,7 +1388,7 @@ parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center )
for (i = 0; i < Elements(tgsi_fs_coord_pixel_center_names); i++) {
const char *cur = *pcur;
if (str_match_nocase_whole( &cur, tgsi_fs_coord_pixel_center_names[i])) {
if (str_match_no_case( &cur, tgsi_fs_coord_pixel_center_names[i])) {
*fs_coord_pixel_center = i;
*pcur = cur;
return TRUE;
@@ -1515,15 +1495,15 @@ static boolean translate( struct translate_ctx *ctx )
if (!parse_instruction( ctx, TRUE ))
return FALSE;
}
else if (str_match_nocase_whole( &ctx->cur, "DCL" )) {
else if (str_match_no_case( &ctx->cur, "DCL" )) {
if (!parse_declaration( ctx ))
return FALSE;
}
else if (str_match_nocase_whole( &ctx->cur, "IMM" )) {
else if (str_match_no_case( &ctx->cur, "IMM" )) {
if (!parse_immediate( ctx ))
return FALSE;
}
else if (str_match_nocase_whole( &ctx->cur, "PROPERTY" )) {
else if (str_match_no_case( &ctx->cur, "PROPERTY" )) {
if (!parse_property( ctx ))
return FALSE;
}

View File

@@ -281,12 +281,10 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_CUBE:
case TGSI_TEXTURE_2D_MSAA:
read_mask = TGSI_WRITEMASK_XYZ;
break;
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE:
case TGSI_TEXTURE_2D_ARRAY_MSAA:
read_mask = TGSI_WRITEMASK_XYZW;
break;
default:

View File

@@ -773,7 +773,7 @@ is_legal_int_format_combo( const struct util_format_description *src,
for (i = 0; i < nr; i++) {
/* The signs must match. */
if (src->channel[i].type != dst->channel[i].type) {
if (src->channel[i].type != src->channel[i].type) {
return FALSE;
}

View File

@@ -203,7 +203,7 @@ set_fragment_shader(struct blit_state *ctx, uint writemask,
enum pipe_texture_target pipe_tex)
{
if (!ctx->fs[pipe_tex][writemask]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex);
ctx->fs[pipe_tex][writemask] =
util_make_fragment_tex_shader_writemask(ctx->pipe, tgsi_tex,
@@ -223,7 +223,7 @@ set_depthstencil_fragment_shader(struct blit_state *ctx,
enum pipe_texture_target pipe_tex)
{
if (!ctx->fs_depthstencil[pipe_tex]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex);
ctx->fs_depthstencil[pipe_tex] =
util_make_fragment_tex_shader_writedepthstencil(ctx->pipe, tgsi_tex,
@@ -242,7 +242,7 @@ set_depth_fragment_shader(struct blit_state *ctx,
enum pipe_texture_target pipe_tex)
{
if (!ctx->fs_depth[pipe_tex]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex);
ctx->fs_depth[pipe_tex] =
util_make_fragment_tex_shader_writedepth(ctx->pipe, tgsi_tex,
@@ -261,7 +261,7 @@ set_stencil_fragment_shader(struct blit_state *ctx,
enum pipe_texture_target pipe_tex)
{
if (!ctx->fs_stencil[pipe_tex]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex);
ctx->fs_stencil[pipe_tex] =
util_make_fragment_tex_shader_writestencil(ctx->pipe, tgsi_tex,
@@ -464,7 +464,7 @@ util_blit_pixels(struct blit_state *ctx,
dstX0, dstY0, dstX1, dstY1);
src_format = util_format_linear(src_tex->format);
dst_format = util_format_linear(dst->texture->format);
dst_format = util_format_linear(dst->format);
/* See whether we will blit depth or stencil. */
is_depth = util_format_has_depth(src_desc);
@@ -478,11 +478,10 @@ util_blit_pixels(struct blit_state *ctx,
/*
* Check for simple case: no format conversion, no flipping, no stretching,
* no overlapping, same number of samples.
* no overlapping.
* Filter mode should not matter since there's no stretching.
*/
if (formats_compatible(src_format, dst_format) &&
src_tex->nr_samples == dst->texture->nr_samples &&
is_stencil == blit_stencil &&
is_depth == blit_depth &&
srcX0 < srcX1 &&
@@ -507,12 +506,6 @@ util_blit_pixels(struct blit_state *ctx,
return;
}
/* XXX Reading multisample textures is unimplemented. */
assert(src_tex->nr_samples <= 1);
if (src_tex->nr_samples > 1) {
return;
}
/* It's a mistake to call this function with a stencil format and
* without shader stencil export. We don't do software fallbacks here.
* Ignore stencil and only copy depth.
@@ -655,9 +648,8 @@ util_blit_pixels(struct blit_state *ctx,
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_samplers(ctx->cso);
cso_save_fragment_sampler_views(ctx->cso);
cso_save_stream_outputs(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_framebuffer(ctx->cso);
@@ -673,7 +665,6 @@ util_blit_pixels(struct blit_state *ctx,
else
cso_set_blend(ctx->cso, &ctx->blend_keep_color);
cso_set_sample_mask(ctx->cso, ~0);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
@@ -689,17 +680,17 @@ util_blit_pixels(struct blit_state *ctx,
* we blit.
*/
if (blit_depth && blit_stencil) {
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
/* don't filter stencil */
ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &ctx->sampler);
cso_single_sampler(ctx->cso, 1, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depthstencil);
set_depthstencil_fragment_shader(ctx, sampler_view->texture->target);
}
else if (blit_depth) {
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_depth);
set_depth_fragment_shader(ctx, sampler_view->texture->target);
}
@@ -707,17 +698,17 @@ util_blit_pixels(struct blit_state *ctx,
/* don't filter stencil */
ctx->sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
ctx->sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_write_stencil);
set_stencil_fragment_shader(ctx, sampler_view->texture->target);
}
else { /* color */
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil);
set_fragment_shader(ctx, writemask, sampler_view->texture->target);
}
cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_single_sampler_done(ctx->cso);
/* textures */
if (blit_depth && blit_stencil) {
@@ -731,12 +722,12 @@ util_blit_pixels(struct blit_state *ctx,
views[0] = sampler_view;
views[1] = pipe->create_sampler_view(pipe, views[0]->texture, &templ);
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 2, views);
cso_set_fragment_sampler_views(ctx->cso, 2, views);
pipe_sampler_view_reference(&views[1], NULL);
}
else {
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &sampler_view);
cso_set_fragment_sampler_views(ctx->cso, 1, &sampler_view);
}
/* viewport */
@@ -786,9 +777,8 @@ util_blit_pixels(struct blit_state *ctx,
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_samplers(ctx->cso);
cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_viewport(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
@@ -859,9 +849,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
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_samplers(ctx->cso);
cso_save_fragment_sampler_views(ctx->cso);
cso_save_stream_outputs(ctx->cso);
cso_save_viewport(ctx->cso);
cso_save_framebuffer(ctx->cso);
@@ -874,7 +863,6 @@ util_blit_pixels_tex(struct blit_state *ctx,
/* set misc state we care about */
cso_set_blend(ctx->cso, &ctx->blend_write_color);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->dsa_keep_depthstencil);
cso_set_sample_mask(ctx->cso, ~0);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
@@ -883,8 +871,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
ctx->sampler.normalized_coords = normalized;
ctx->sampler.min_img_filter = filter;
ctx->sampler.mag_img_filter = filter;
cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_single_sampler_done(ctx->cso);
/* viewport */
ctx->viewport.scale[0] = 0.5f * dst->width;
@@ -898,7 +886,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_set_viewport(ctx->cso, &ctx->viewport);
/* texture */
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &src_sampler_view);
cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view);
/* shaders */
set_fragment_shader(ctx, TGSI_WRITEMASK_XYZW,
@@ -933,9 +921,8 @@ util_blit_pixels_tex(struct blit_state *ctx,
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_samplers(ctx->cso);
cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_viewport(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);

View File

@@ -81,12 +81,6 @@ struct blitter_context_priv
void *fs_texfetch_depthstencil[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_stencil[PIPE_MAX_TEXTURE_TYPES];
/* FS which outputs one sample from a multisample texture. */
void *fs_texfetch_col_msaa[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_depth_msaa[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_depthstencil_msaa[PIPE_MAX_TEXTURE_TYPES];
void *fs_texfetch_stencil_msaa[PIPE_MAX_TEXTURE_TYPES];
/* Blend state. */
void *blend_write_color; /**< blend state with writemask of RGBA */
void *blend_keep_color; /**< blend state with writemask of 0 */
@@ -123,6 +117,13 @@ struct blitter_context_priv
boolean has_stencil_export;
};
static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x, unsigned y,
unsigned width, unsigned height,
float depth,
enum blitter_attrib_type type,
const union pipe_color_union *attrib);
struct blitter_context *util_blitter_create(struct pipe_context *pipe)
{
@@ -139,7 +140,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
return NULL;
ctx->base.pipe = pipe;
ctx->base.draw_rectangle = util_blitter_draw_rectangle;
ctx->base.draw_rectangle = blitter_draw_rectangle;
/* init state objects for them to be considered invalid */
ctx->base.saved_blend_state = INVALID_PTR;
@@ -438,12 +439,6 @@ static void blitter_restore_fragment_states(struct blitter_context_priv *ctx)
pipe->bind_blend_state(pipe, ctx->base.saved_blend_state);
ctx->base.saved_blend_state = INVALID_PTR;
/* Sample mask. */
if (ctx->base.is_sample_mask_saved) {
pipe->set_sample_mask(pipe, ctx->base.saved_sample_mask);
ctx->base.is_sample_mask_saved = FALSE;
}
/* Miscellaneous states. */
/* XXX check whether these are saved and whether they need to be restored
* (depending on the operation) */
@@ -558,8 +553,7 @@ static void get_texcoords(struct pipe_sampler_view *src,
{
struct pipe_resource *tex = src->texture;
unsigned level = src->u.tex.first_level;
boolean normalized = tex->target != PIPE_TEXTURE_RECT &&
tex->nr_samples <= 1;
boolean normalized = tex->target != PIPE_TEXTURE_RECT;
if (normalized) {
out[0] = x1 / (float)u_minify(src_width0, level);
@@ -593,7 +587,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,
unsigned layer,
unsigned x1, unsigned y1,
unsigned x2, unsigned y2)
{
@@ -630,16 +624,8 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
break;
case PIPE_TEXTURE_2D_ARRAY:
for (i = 0; i < 4; i++) {
ctx->vertices[i][1][2] = layer; /*r*/
ctx->vertices[i][1][3] = sample; /*q*/
}
break;
case PIPE_TEXTURE_2D:
for (i = 0; i < 4; i++) {
ctx->vertices[i][1][2] = sample; /*r*/
}
for (i = 0; i < 4; i++)
ctx->vertices[i][1][2] = layer; /*r*/
break;
default:;
@@ -680,149 +666,81 @@ void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs,
static INLINE
void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx,
struct pipe_resource *tex)
unsigned tex_target)
{
struct pipe_context *pipe = ctx->base.pipe;
assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
if (tex->nr_samples > 1) {
void **shader = &ctx->fs_texfetch_col_msaa[tex->target];
/* Create the fragment shader on-demand. */
if (!ctx->fs_texfetch_col[tex_target]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target,
tex->nr_samples);
*shader = util_make_fs_blit_msaa_color(pipe, tgsi_tex);
}
return *shader;
} else {
void **shader = &ctx->fs_texfetch_col[tex->target];
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0);
*shader =
util_make_fragment_tex_shader(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return *shader;
ctx->fs_texfetch_col[tex_target] =
util_make_fragment_tex_shader(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR);
}
return ctx->fs_texfetch_col[tex_target];
}
static INLINE
void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
struct pipe_resource *tex)
unsigned tex_target)
{
struct pipe_context *pipe = ctx->base.pipe;
assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
if (tex->nr_samples > 1) {
void **shader = &ctx->fs_texfetch_depth_msaa[tex->target];
/* Create the fragment shader on-demand. */
if (!ctx->fs_texfetch_depth[tex_target]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target,
tex->nr_samples);
*shader =
util_make_fs_blit_msaa_depth(pipe, tgsi_tex);
}
return *shader;
} else {
void **shader = &ctx->fs_texfetch_depth[tex->target];
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0);
*shader =
util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return *shader;
ctx->fs_texfetch_depth[tex_target] =
util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return ctx->fs_texfetch_depth[tex_target];
}
static INLINE
void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
struct pipe_resource *tex)
unsigned tex_target)
{
struct pipe_context *pipe = ctx->base.pipe;
assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
if (tex->nr_samples > 1) {
void **shader = &ctx->fs_texfetch_depthstencil_msaa[tex->target];
/* Create the fragment shader on-demand. */
if (!ctx->fs_texfetch_depthstencil[tex_target]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target,
tex->nr_samples);
*shader =
util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex);
}
return *shader;
} else {
void **shader = &ctx->fs_texfetch_depthstencil[tex->target];
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0);
*shader =
util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return *shader;
ctx->fs_texfetch_depthstencil[tex_target] =
util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return ctx->fs_texfetch_depthstencil[tex_target];
}
static INLINE
void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
struct pipe_resource *tex)
unsigned tex_target)
{
struct pipe_context *pipe = ctx->base.pipe;
assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
if (tex->nr_samples > 1) {
void **shader = &ctx->fs_texfetch_stencil_msaa[tex->target];
/* Create the fragment shader on-demand. */
if (!ctx->fs_texfetch_stencil[tex_target]) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target,
tex->nr_samples);
*shader =
util_make_fs_blit_msaa_stencil(pipe, tgsi_tex);
}
return *shader;
} else {
void **shader = &ctx->fs_texfetch_stencil[tex->target];
/* Create the fragment shader on-demand. */
if (!*shader) {
unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex->target, 0);
*shader =
util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return *shader;
ctx->fs_texfetch_stencil[tex_target] =
util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
TGSI_INTERPOLATE_LINEAR);
}
return ctx->fs_texfetch_stencil[tex_target];
}
static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx)
@@ -855,12 +773,12 @@ static void blitter_draw(struct blitter_context_priv *ctx,
pipe_resource_reference(&buf, NULL);
}
void util_blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x1, unsigned y1,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
const union pipe_color_union *attrib)
static void blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x1, unsigned y1,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
const union pipe_color_union *attrib)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -930,7 +848,6 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
}
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs, int_format));
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, width, height);
@@ -955,7 +872,7 @@ void util_blitter_clear(struct blitter_context *blitter,
NULL, NULL);
}
void util_blitter_custom_clear_depth(struct blitter_context *blitter,
void util_blitter_clear_depth_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa)
{
@@ -965,26 +882,10 @@ void util_blitter_custom_clear_depth(struct blitter_context *blitter,
}
static
boolean is_overlap(unsigned dstx, unsigned dsty, unsigned dstz,
const struct pipe_box *srcbox)
boolean is_overlap(unsigned sx1, unsigned sx2, unsigned sy1, unsigned sy2,
unsigned dx1, unsigned dx2, unsigned dy1, unsigned dy2)
{
struct pipe_box src = *srcbox;
if (src.width < 0) {
src.x += src.width;
src.width = -src.width;
}
if (src.height < 0) {
src.y += src.height;
src.height = -src.height;
}
if (src.depth < 0) {
src.z += src.depth;
src.depth = -src.depth;
}
return src.x < dstx+src.width && src.x+src.width > dstx &&
src.y < dsty+src.height && src.y+src.height > dsty &&
src.z < dstz+src.depth && src.z+src.depth > dstz;
return sx1 < dx2 && sx2 > dx1 && sy1 < dy2 && sy2 > dy1;
}
void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
@@ -1024,89 +925,66 @@ void util_blitter_default_src_texture(struct pipe_sampler_view *src_templ,
src_templ->swizzle_a = PIPE_SWIZZLE_ALPHA;
}
boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
const struct pipe_resource *dst,
const struct pipe_resource *src,
unsigned mask)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_screen *screen = ctx->base.pipe->screen;
if (dst) {
unsigned bind;
boolean is_stencil;
const struct util_format_description *desc =
util_format_description(dst->format);
is_stencil = util_format_has_stencil(desc);
/* Stencil export must be supported for stencil copy. */
if ((mask & PIPE_MASK_S) && is_stencil && !ctx->has_stencil_export) {
return FALSE;
}
if (is_stencil || util_format_has_depth(desc))
bind = PIPE_BIND_DEPTH_STENCIL;
else
bind = PIPE_BIND_RENDER_TARGET;
if (!screen->is_format_supported(screen, dst->format, dst->target,
dst->nr_samples, bind)) {
return FALSE;
}
}
if (src) {
if (!screen->is_format_supported(screen, src->format, src->target,
src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) {
return FALSE;
}
/* Check stencil sampler support for stencil copy. */
if (util_format_has_stencil(util_format_description(src->format))) {
enum pipe_format stencil_format =
util_format_stencil_only(src->format);
assert(stencil_format != PIPE_FORMAT_NONE);
if (stencil_format != src->format &&
!screen->is_format_supported(screen, stencil_format, src->target,
src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) {
return FALSE;
}
}
}
return TRUE;
}
void util_blitter_copy_texture(struct blitter_context *blitter,
struct pipe_resource *dst,
unsigned dst_level, unsigned dst_sample_mask,
unsigned dstlevel,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
unsigned src_level, unsigned src_sample,
const struct pipe_box *srcbox)
unsigned srclevel,
const struct pipe_box *srcbox,
boolean ignore_stencil)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_screen *screen = pipe->screen;
struct pipe_surface *dst_view, dst_templ;
struct pipe_sampler_view src_templ, *src_view;
unsigned bind;
boolean is_stencil, is_depth;
const struct util_format_description *src_desc =
util_format_description(src->format);
/* Give up if textures are not set. */
assert(dst && src);
if (!dst || !src)
return;
assert(src->target < PIPE_MAX_TEXTURE_TYPES);
/* Is this a ZS format? */
is_depth = util_format_has_depth(src_desc);
is_stencil = util_format_has_stencil(src_desc);
if (is_depth || is_stencil)
bind = PIPE_BIND_DEPTH_STENCIL;
else
bind = PIPE_BIND_RENDER_TARGET;
/* Check if we can sample from and render to the surfaces. */
/* (assuming copying a stencil buffer is not possible) */
if ((!ignore_stencil && is_stencil && !ctx->has_stencil_export) ||
!screen->is_format_supported(screen, dst->format, dst->target,
dst->nr_samples, bind) ||
!screen->is_format_supported(screen, src->format, src->target,
src->nr_samples, PIPE_BIND_SAMPLER_VIEW)) {
blitter_set_running_flag(ctx);
util_resource_copy_region(pipe, dst, dstlevel, dstx, dsty, dstz,
src, srclevel, srcbox);
blitter_unset_running_flag(ctx);
return;
}
/* Initialize the surface. */
util_blitter_default_dst_texture(&dst_templ, dst, dst_level, dstz, srcbox);
util_blitter_default_dst_texture(&dst_templ, dst, dstlevel, dstz, srcbox);
dst_view = pipe->create_surface(pipe, dst, &dst_templ);
/* Initialize the sampler view. */
util_blitter_default_src_texture(&src_templ, src, src_level);
util_blitter_default_src_texture(&src_templ, src, srclevel);
src_view = pipe->create_sampler_view(pipe, src, &src_templ);
/* Copy. */
util_blitter_copy_texture_view(blitter, dst_view, dst_sample_mask, dstx,
dsty, src_view, src_sample, srcbox,
src->width0, src->height0, PIPE_MASK_RGBAZS);
util_blitter_copy_texture_view(blitter, dst_view, dstx, dsty, src_view,
srcbox, src->width0, src->height0);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
@@ -1114,40 +992,38 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
void util_blitter_copy_texture_view(struct blitter_context *blitter,
struct pipe_surface *dst,
unsigned dst_sample_mask,
unsigned dstx, unsigned dsty,
struct pipe_sampler_view *src,
unsigned src_sample,
const struct pipe_box *srcbox,
unsigned src_width0, unsigned src_height0,
unsigned mask)
unsigned src_width0, unsigned src_height0)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
enum pipe_texture_target src_target = src->texture->target;
int abs_width = abs(srcbox->width);
int abs_height = abs(srcbox->height);
boolean blit_stencil, blit_depth;
unsigned width = srcbox->width;
unsigned height = srcbox->height;
boolean is_stencil, is_depth;
const struct util_format_description *src_desc =
util_format_description(src->format);
blit_depth = util_format_has_depth(src_desc) && (mask & PIPE_MASK_Z);
blit_stencil = util_format_has_stencil(src_desc) && (mask & PIPE_MASK_S);
is_depth = util_format_has_depth(src_desc);
is_stencil = util_format_has_stencil(src_desc);
/* If you want a fallback for stencil copies,
* use util_blitter_copy_texture. */
if (blit_stencil && !ctx->has_stencil_export) {
blit_stencil = FALSE;
if (is_stencil && !ctx->has_stencil_export) {
is_stencil = FALSE;
if (!blit_depth)
if (!is_depth)
return;
}
/* Sanity checks. */
if (dst->texture == src->texture &&
dst->u.tex.level == src->u.tex.first_level) {
assert(!is_overlap(dstx, dsty, 0, srcbox));
assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height,
dstx, dstx + width, dsty, dsty + height));
}
/* XXX should handle 3d regions */
assert(srcbox->depth == 1);
@@ -1163,24 +1039,24 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
fb_state.width = dst->width;
fb_state.height = dst->height;
if (blit_depth || blit_stencil) {
if (is_depth || is_stencil) {
pipe->bind_blend_state(pipe, ctx->blend_keep_color);
if (blit_depth && blit_stencil) {
if (is_depth && is_stencil) {
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_write_depth_stencil);
pipe->bind_fs_state(pipe,
blitter_get_fs_texfetch_depthstencil(ctx, src->texture));
} else if (blit_depth) {
blitter_get_fs_texfetch_depthstencil(ctx, src_target));
} else if (is_depth) {
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_write_depth_keep_stencil);
pipe->bind_fs_state(pipe,
blitter_get_fs_texfetch_depth(ctx, src->texture));
blitter_get_fs_texfetch_depth(ctx, src_target));
} else { /* is_stencil */
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_keep_depth_write_stencil);
pipe->bind_fs_state(pipe,
blitter_get_fs_texfetch_stencil(ctx, src->texture));
blitter_get_fs_texfetch_stencil(ctx, src_target));
}
fb_state.nr_cbufs = 0;
@@ -1189,14 +1065,14 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_blend_state(pipe, ctx->blend_write_color);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
pipe->bind_fs_state(pipe,
blitter_get_fs_texfetch_col(ctx, src->texture));
blitter_get_fs_texfetch_col(ctx, src_target));
fb_state.nr_cbufs = 1;
fb_state.cbufs[0] = dst;
fb_state.zsbuf = 0;
}
if (blit_depth && blit_stencil) {
if (is_depth && is_stencil) {
/* Setup two samplers, one for depth and the other one for stencil. */
struct pipe_sampler_view templ;
struct pipe_sampler_view *views[2];
@@ -1213,21 +1089,6 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_fragment_sampler_states(pipe, 2, samplers);
pipe_sampler_view_reference(&views[1], NULL);
} else if (blit_stencil) {
/* Set a stencil-only sampler view for it not to sample depth instead. */
struct pipe_sampler_view templ;
struct pipe_sampler_view *view;
templ = *src;
templ.format = util_format_stencil_only(templ.format);
assert(templ.format != PIPE_FORMAT_NONE);
view = pipe->create_sampler_view(pipe, src->texture, &templ);
pipe->set_fragment_sampler_views(pipe, 1, &view);
pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);
pipe_sampler_view_reference(&view, NULL);
} else {
pipe->set_fragment_sampler_views(pipe, 1, &src);
pipe->bind_fragment_sampler_states(pipe, 1, &ctx->sampler_state);
@@ -1235,36 +1096,50 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, dst_sample_mask);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, dst->width, dst->height);
if ((src_target == PIPE_TEXTURE_1D ||
src_target == PIPE_TEXTURE_2D ||
src_target == PIPE_TEXTURE_RECT) &&
src->texture->nr_samples <= 1) {
switch (src_target) {
/* Draw the quad with the draw_rectangle callback. */
case PIPE_TEXTURE_1D:
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
{
/* Set texture coordinates. - use a pipe color union
* for interface purposes.
* XXX pipe_color_union is a wrong name since we use that to set
* texture coordinates too.
*/
union pipe_color_union coord;
get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y,
srcbox->x+width, srcbox->y+height, coord.f);
/* Set texture coordinates. - use a pipe color union
* for interface purposes.
* XXX pipe_color_union is a wrong name since we use that to set
* texture coordinates too.
*/
union pipe_color_union coord;
get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y,
srcbox->x+srcbox->width, srcbox->y+srcbox->height, coord.f);
/* Draw. */
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
}
break;
/* Draw. */
blitter->draw_rectangle(blitter, dstx, dsty, dstx+abs_width, dsty+abs_height, 0,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z,
src_sample,
srcbox->x, srcbox->y,
srcbox->x + srcbox->width, srcbox->y + srcbox->height);
blitter_draw(ctx, dstx, dsty, dstx+abs_width, dsty+abs_height, 0);
default:
/* Set texture coordinates. */
switch (src_target) {
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
case PIPE_TEXTURE_3D:
case PIPE_TEXTURE_CUBE:
blitter_set_texcoords(ctx, src, src_width0, src_height0, srcbox->z,
srcbox->y, srcbox->x,
srcbox->x + width, srcbox->y + height);
break;
default:
assert(0);
}
blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, 0);
break;
}
blitter_restore_vertex_states(ctx);
@@ -1308,7 +1183,6 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
fb_state.cbufs[0] = dstsurf;
fb_state.zsbuf = 0;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
@@ -1374,7 +1248,6 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
fb_state.cbufs[0] = 0;
fb_state.zsbuf = dstsurf;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
@@ -1391,7 +1264,6 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
struct pipe_surface *zsurf,
struct pipe_surface *cbsurf,
unsigned sample_mask,
void *dsa_stage, float depth)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -1427,7 +1299,6 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
}
fb_state.zsbuf = zsurf;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, sample_mask);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height);
@@ -1499,111 +1370,3 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
blitter_unset_running_flag(ctx);
pipe_so_target_reference(&so_target, NULL);
}
/* probably radeon specific */
void util_blitter_custom_resolve_color(struct blitter_context *blitter,
struct pipe_resource *dst,
unsigned dst_level,
unsigned dst_layer,
struct pipe_resource *src,
unsigned src_layer,
unsigned sample_mask,
void *custom_blend)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
struct pipe_surface *srcsurf, *dstsurf, surf_tmpl;
blitter_set_running_flag(ctx);
blitter_check_saved_vertex_states(ctx);
blitter_check_saved_fragment_states(ctx);
/* bind states */
pipe->bind_blend_state(pipe, custom_blend);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE));
pipe->set_sample_mask(pipe, sample_mask);
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = dst->format;
surf_tmpl.u.tex.level = dst_level;
surf_tmpl.u.tex.first_layer = dst_layer;
surf_tmpl.u.tex.last_layer = dst_layer;
surf_tmpl.usage = PIPE_BIND_RENDER_TARGET;
dstsurf = pipe->create_surface(pipe, dst, &surf_tmpl);
surf_tmpl.u.tex.level = 0;
surf_tmpl.u.tex.first_layer = src_layer;
surf_tmpl.u.tex.last_layer = src_layer;
srcsurf = pipe->create_surface(pipe, src, &surf_tmpl);
/* set a framebuffer state */
fb_state.width = src->width0;
fb_state.height = src->height0;
fb_state.nr_cbufs = 2;
fb_state.cbufs[0] = srcsurf;
fb_state.cbufs[1] = dstsurf;
fb_state.zsbuf = NULL;
pipe->set_framebuffer_state(pipe, &fb_state);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, src->width0, src->height0);
blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0,
0, 0, NULL);
blitter_restore_fb_state(ctx);
blitter_restore_vertex_states(ctx);
blitter_restore_fragment_states(ctx);
blitter_unset_running_flag(ctx);
pipe_surface_reference(&srcsurf, NULL);
pipe_surface_reference(&dstsurf, NULL);
}
void util_blitter_custom_color(struct blitter_context *blitter,
struct pipe_surface *dstsurf,
void *custom_blend)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
assert(dstsurf->texture);
if (!dstsurf->texture)
return;
/* check the saved state */
blitter_set_running_flag(ctx);
blitter_check_saved_vertex_states(ctx);
blitter_check_saved_fragment_states(ctx);
blitter_check_saved_fb_state(ctx);
/* bind states */
pipe->bind_blend_state(pipe, custom_blend);
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1, FALSE));
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
pipe->set_sample_mask(pipe, (1ull << MAX2(1, dstsurf->texture->nr_samples)) - 1);
/* set a framebuffer state */
fb_state.width = dstsurf->width;
fb_state.height = dstsurf->height;
fb_state.nr_cbufs = 1;
fb_state.cbufs[0] = dstsurf;
fb_state.zsbuf = 0;
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height,
0, 0, NULL);
blitter_restore_vertex_states(ctx);
blitter_restore_fragment_states(ctx);
blitter_restore_fb_state(ctx);
blitter_unset_running_flag(ctx);
}

View File

@@ -94,8 +94,6 @@ struct blitter_context
struct pipe_framebuffer_state saved_fb_state; /**< framebuffer state */
struct pipe_stencil_ref saved_stencil_ref; /**< stencil ref */
struct pipe_viewport_state saved_viewport;
boolean is_sample_mask_saved;
unsigned saved_sample_mask;
int saved_num_sampler_states;
void *saved_sampler_states[PIPE_MAX_SAMPLERS];
@@ -129,15 +127,6 @@ struct pipe_context *util_blitter_get_pipe(struct blitter_context *blitter)
return blitter->pipe;
}
/* The default function to draw a rectangle. This can only be used
* inside of the draw_rectangle callback if the driver overrides it. */
void util_blitter_draw_rectangle(struct blitter_context *blitter,
unsigned x1, unsigned y1,
unsigned x2, unsigned y2,
float depth,
enum blitter_attrib_type type,
const union pipe_color_union *attrib);
/*
* These states must be saved before any of the following functions are called:
* - vertex buffers
@@ -165,16 +154,10 @@ void util_blitter_clear(struct blitter_context *blitter,
const union pipe_color_union *color,
double depth, unsigned stencil);
/**
* Check if the blitter (with the help of the driver) can blit between
* the two resources.
* The mask is a combination of the PIPE_MASK_* flags.
* Set to PIPE_MASK_RGBAZS if unsure.
*/
boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
const struct pipe_resource *dst,
const struct pipe_resource *src,
unsigned mask);
void util_blitter_clear_depth_custom(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa);
/**
* Copy a block of pixels from one surface to another.
*
@@ -183,10 +166,13 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
* a software fallback path is taken and both surfaces must be of the same
* format.
*
* Only one sample of a multisample texture can be copied and is specified by
* src_sample. If the destination is a multisample resource, dst_sample_mask
* specifies the sample mask. For single-sample resources, set dst_sample_mask
* to ~0.
* The same holds for depth-stencil formats with the exception that stencil
* cannot be copied unless you set ignore_stencil to FALSE. In that case,
* a software fallback path is taken and both surfaces must be of the same
* format. If the shader stencil export is supported, stencil copy is always
* accelerated.
*
* Use pipe_screen->is_format_supported to know your options.
*
* These states must be saved in the blitter in addition to the state objects
* already required to be saved:
@@ -199,11 +185,12 @@ boolean util_blitter_is_copy_supported(struct blitter_context *blitter,
*/
void util_blitter_copy_texture(struct blitter_context *blitter,
struct pipe_resource *dst,
unsigned dst_level, unsigned dst_sample_mask,
unsigned dstlevel,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
unsigned src_level, unsigned src_sample,
const struct pipe_box *srcbox);
unsigned srclevel,
const struct pipe_box *srcbox,
boolean ignore_stencil);
/**
* Same as util_blitter_copy_texture, but dst and src are pipe_surface and
@@ -220,20 +207,14 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
* coordinates. The dst dimensions are supplied through pipe_surface::width
* and height.
*
* The mask is a combination of the PIPE_MASK_* flags.
* Set to PIPE_MASK_RGBAZS if unsure.
*
* NOTE: There are no checks whether the blit is actually supported.
*/
void util_blitter_copy_texture_view(struct blitter_context *blitter,
struct pipe_surface *dst,
unsigned dst_sample_mask,
unsigned dstx, unsigned dsty,
struct pipe_sampler_view *src,
unsigned src_sample,
const struct pipe_box *srcbox,
unsigned src_width0, unsigned src_height0,
unsigned mask);
unsigned src_width0, unsigned src_height0);
/**
* Helper function to initialize a view for copy_texture_view.
@@ -299,39 +280,11 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height);
/* The following functions are customized variants of the clear functions.
* Some drivers use them internally to do things like MSAA resolve
* and resource decompression. It usually consists of rendering a full-screen
* quad with a special blend or DSA state.
*/
/* Used by r300g for depth decompression. */
void util_blitter_custom_clear_depth(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa);
/* Used by r600g for depth decompression. */
void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
struct pipe_surface *zsurf,
struct pipe_surface *cbsurf,
unsigned sample_mask,
void *dsa_stage, float depth);
/* Used by r600g for color decompression. */
void util_blitter_custom_color(struct blitter_context *blitter,
struct pipe_surface *dstsurf,
void *custom_blend);
/* Used by r600g for MSAA color resolve. */
void util_blitter_custom_resolve_color(struct blitter_context *blitter,
struct pipe_resource *dst,
unsigned dst_level,
unsigned dst_layer,
struct pipe_resource *src,
unsigned src_layer,
unsigned sampled_mask,
void *custom_blend);
/* The functions below should be used to save currently bound constant state
* objects inside a driver. The objects are automatically restored at the end
* of the util_blitter_{clear, copy_region, fill_region} functions and then
@@ -465,14 +418,6 @@ util_blitter_save_so_targets(struct blitter_context *blitter,
targets[i]);
}
static INLINE void
util_blitter_save_sample_mask(struct blitter_context *blitter,
unsigned sample_mask)
{
blitter->is_sample_mask_saved = TRUE;
blitter->saved_sample_mask = sample_mask;
}
#ifdef __cplusplus
}
#endif

View File

@@ -26,7 +26,6 @@
**************************************************************************/
#include <math.h>
#include <float.h>
#include "pipe/p_config.h"
@@ -67,6 +66,9 @@
{{ 0, 0, 0, 0}, { 0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}}
#define NAN (0.0 / 0.0)
#define INF (1.0 / 0.0)
/**
* Test cases.
*
@@ -904,8 +906,8 @@ util_format_test_cases[] =
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xffff), UNPACKED_1x1( -NAN, 0.0, 0.0, 1.0)},
/* Inf */
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1( INFINITY, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( -INFINITY, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c00), UNPACKED_1x1( INF, 0.0, 0.0, 1.0)},
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0xfc00), UNPACKED_1x1( -INF, 0.0, 0.0, 1.0)},
#endif

View File

@@ -1573,9 +1573,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
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_samplers(ctx->cso);
cso_save_fragment_sampler_views(ctx->cso);
cso_save_stream_outputs(ctx->cso);
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
@@ -1591,7 +1590,6 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
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, 0);
@@ -1677,10 +1675,10 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
*/
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_single_sampler(ctx->cso, 0, &ctx->sampler);
cso_single_sampler_done(ctx->cso);
cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv);
cso_set_fragment_sampler_views(ctx->cso, 1, &psv);
/* quad coords in clip coords */
offset = set_vertex_data(ctx,
@@ -1705,9 +1703,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
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_samplers(ctx->cso);
cso_restore_fragment_sampler_views(ctx->cso);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);

View File

@@ -548,37 +548,23 @@ util_query_clear_result(union pipe_query_result *result, unsigned type)
/** Convert PIPE_TEXTURE_x to TGSI_TEXTURE_x */
static INLINE unsigned
util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target,
unsigned nr_samples)
util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target)
{
switch (pipe_tex_target) {
case PIPE_TEXTURE_1D:
assert(nr_samples <= 1);
return TGSI_TEXTURE_1D;
case PIPE_TEXTURE_2D:
return nr_samples > 1 ? TGSI_TEXTURE_2D_MSAA : TGSI_TEXTURE_2D;
return TGSI_TEXTURE_2D;
case PIPE_TEXTURE_RECT:
assert(nr_samples <= 1);
return TGSI_TEXTURE_RECT;
case PIPE_TEXTURE_3D:
assert(nr_samples <= 1);
return TGSI_TEXTURE_3D;
case PIPE_TEXTURE_CUBE:
assert(nr_samples <= 1);
return TGSI_TEXTURE_CUBE;
case PIPE_TEXTURE_1D_ARRAY:
assert(nr_samples <= 1);
return TGSI_TEXTURE_1D_ARRAY;
case PIPE_TEXTURE_2D_ARRAY:
return nr_samples > 1 ? TGSI_TEXTURE_2D_ARRAY_MSAA :
TGSI_TEXTURE_2D_ARRAY;
return TGSI_TEXTURE_2D_ARRAY;
default:
assert(0 && "unexpected texture target");
return TGSI_TEXTURE_UNKNOWN;

View File

@@ -40,12 +40,7 @@
#include "pipe/p_state.h"
#include "util/u_simple_shaders.h"
#include "util/u_debug.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_strings.h"
#include "tgsi/tgsi_ureg.h"
#include "tgsi/tgsi_text.h"
#include <stdio.h> /* include last */
@@ -358,131 +353,3 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
return ureg_create_shader_and_destroy( ureg, pipe );
}
static void *
util_make_fs_blit_msaa_gen(struct pipe_context *pipe,
unsigned tgsi_tex,
const char *output_semantic,
const char *output_mask)
{
static const char shader_templ[] =
"FRAG\n"
"DCL IN[0], GENERIC[0], LINEAR\n"
"DCL SAMP[0]\n"
"DCL OUT[0], %s\n"
"DCL TEMP[0]\n"
"F2U TEMP[0], IN[0]\n"
"TXF OUT[0]%s, TEMP[0].xyzz, SAMP[0], %s\n"
"END\n";
const char *type = tgsi_texture_names[tgsi_tex];
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
struct pipe_shader_state state = {tokens};
assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
sprintf(text, shader_templ, output_semantic, output_mask, type);
if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
puts(text);
assert(0);
return NULL;
}
#if 0
tgsi_dump(state.tokens, 0);
#endif
return pipe->create_fs_state(pipe, &state);
}
/**
* Make a fragment shader that sets the output color to a color
* fetched from a multisample texture.
* \param tex_target one of PIPE_TEXTURE_x
*/
void *
util_make_fs_blit_msaa_color(struct pipe_context *pipe,
unsigned tgsi_tex)
{
return util_make_fs_blit_msaa_gen(pipe, tgsi_tex,
"COLOR[0]", "");
}
/**
* Make a fragment shader that sets the output depth to a depth value
* fetched from a multisample texture.
* \param tex_target one of PIPE_TEXTURE_x
*/
void *
util_make_fs_blit_msaa_depth(struct pipe_context *pipe,
unsigned tgsi_tex)
{
return util_make_fs_blit_msaa_gen(pipe, tgsi_tex,
"POSITION", ".z");
}
/**
* Make a fragment shader that sets the output stencil to a stencil value
* fetched from a multisample texture.
* \param tex_target one of PIPE_TEXTURE_x
*/
void *
util_make_fs_blit_msaa_stencil(struct pipe_context *pipe,
unsigned tgsi_tex)
{
return util_make_fs_blit_msaa_gen(pipe, tgsi_tex,
"STENCIL", ".y");
}
/**
* Make a fragment shader that sets the output depth and stencil to depth
* and stencil values fetched from two multisample textures / samplers.
* The sizes of both textures should match (it should be one depth-stencil
* texture).
* \param tex_target one of PIPE_TEXTURE_x
*/
void *
util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
unsigned tgsi_tex)
{
static const char shader_templ[] =
"FRAG\n"
"DCL IN[0], GENERIC[0], LINEAR\n"
"DCL SAMP[0..1]\n"
"DCL OUT[0], POSITION\n"
"DCL OUT[1], STENCIL\n"
"DCL TEMP[0]\n"
"F2U TEMP[0], IN[0]\n"
"TXF OUT[0].z, TEMP[0], SAMP[0], %s\n"
"TXF OUT[1].y, TEMP[0], SAMP[1], %s\n"
"END\n";
const char *type = tgsi_texture_names[tgsi_tex];
char text[sizeof(shader_templ)+100];
struct tgsi_token tokens[1000];
struct pipe_shader_state state = {tokens};
assert(tgsi_tex == TGSI_TEXTURE_2D_MSAA ||
tgsi_tex == TGSI_TEXTURE_2D_ARRAY_MSAA);
sprintf(text, shader_templ, type, type);
if (!tgsi_text_translate(text, tokens, Elements(tokens))) {
assert(0);
return NULL;
}
#if 0
tgsi_dump(state.tokens, 0);
#endif
return pipe->create_fs_state(pipe, &state);
}

View File

@@ -95,26 +95,6 @@ util_make_fragment_cloneinput_shader(struct pipe_context *pipe, int num_cbufs,
int input_semantic,
int input_interpolate);
extern void *
util_make_fs_blit_msaa_color(struct pipe_context *pipe,
unsigned tgsi_tex);
extern void *
util_make_fs_blit_msaa_depth(struct pipe_context *pipe,
unsigned tgsi_tex);
extern void *
util_make_fs_blit_msaa_depthstencil(struct pipe_context *pipe,
unsigned tgsi_tex);
void *
util_make_fs_blit_msaa_stencil(struct pipe_context *pipe,
unsigned tgsi_tex);
#ifdef __cplusplus
}
#endif

View File

@@ -160,12 +160,12 @@ util_resource_copy_region(struct pipe_context *pipe,
unsigned h = src_box->height;
assert(src && dst);
if (!src || !dst)
return;
assert((src->target == PIPE_BUFFER && dst->target == PIPE_BUFFER) ||
(src->target != PIPE_BUFFER && dst->target != PIPE_BUFFER));
if (!src || !dst)
return;
src_format = src->format;
dst_format = dst->format;

View File

@@ -679,28 +679,6 @@ pipe_get_tile_z(struct pipe_context *pipe,
}
}
break;
case PIPE_FORMAT_Z32_FLOAT:
{
const float *ptrc = (const float *)(map + y * pt->stride + x*4);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert float Z to 32-bit Z */
if (ptrc[j] <= 0.0) {
pDest[j] = 0;
}
else if (ptrc[j] >= 1.0) {
pDest[j] = 0xffffffff;
}
else {
double z = ptrc[j] * 0xffffffff;
pDest[j] = (uint) z;
}
}
pDest += dstStride;
ptrc += pt->stride/4;
}
}
break;
default:
assert(0);
}
@@ -808,20 +786,6 @@ pipe_put_tile_z(struct pipe_context *pipe,
}
}
break;
case PIPE_FORMAT_Z32_FLOAT:
{
float *pDest = (float *) (map + y * pt->stride + x*2);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
/* convert 32-bit integer Z to float Z */
const double scale = 1.0 / 0xffffffffU;
pDest[j] = ptrc[j] * scale;
}
pDest += pt->stride/4;
ptrc += srcStride;
}
}
break;
default:
assert(0);
}

View File

@@ -56,14 +56,14 @@ struct u_upload_mgr *u_upload_create( struct pipe_context *pipe,
*/
void u_upload_destroy( struct u_upload_mgr *upload );
/**
* Unmap and release old upload buffer.
/* Unmap and release old upload buffer.
*
* This is like u_upload_unmap() except the upload buffer is released for
* recycling. This should be called on real hardware flushes on systems
* that don't support the PIPE_TRANSFER_UNSYNCHRONIZED flag, as otherwise
* the next u_upload_buffer will cause a sync on the buffer.
*/
void u_upload_flush( struct u_upload_mgr *upload );
/**
@@ -86,6 +86,7 @@ void u_upload_unmap( struct u_upload_mgr *upload );
* \param size Size of the allocation.
* \param out_offset Pointer to where the new buffer offset will be returned.
* \param outbuf Pointer to where the upload buffer will be returned.
* \param flushed Whether the upload buffer was flushed.
* \param ptr Pointer to the allocated memory that is returned.
*/
enum pipe_error u_upload_alloc( struct u_upload_mgr *upload,
@@ -111,7 +112,7 @@ enum pipe_error u_upload_data( struct u_upload_mgr *upload,
/**
* Allocate space in an upload buffer and copy an input buffer to it.
* Allocate and copy an input buffer to the upload buffer.
*
* Same as u_upload_data, except that the input data comes from a buffer
* instead of a user pointer.

View File

@@ -225,9 +225,7 @@ u_vbuf_set_vertex_elements_internal(struct u_vbuf *mgr, unsigned count,
}
assert(ve);
if (ve != mgr->ve)
pipe->bind_vertex_elements_state(pipe, ve->driver_cso);
pipe->bind_vertex_elements_state(pipe, ve->driver_cso);
return ve;
}

View File

@@ -182,52 +182,43 @@ galahad_context_create_sampler_state(struct pipe_context *_pipe,
}
static void
galahad_context_bind_sampler_states(struct pipe_context *_pipe,
unsigned shader,
unsigned start,
galahad_context_bind_fragment_sampler_states(struct pipe_context *_pipe,
unsigned num_samplers,
void **samplers)
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
if (num_samplers > PIPE_MAX_SAMPLERS) {
glhd_error("%u fragment samplers requested, "
"but only %u are permitted by API",
num_samplers, PIPE_MAX_SAMPLERS);
}
pipe->bind_fragment_sampler_states(pipe,
num_samplers,
samplers);
}
static void
galahad_context_bind_vertex_sampler_states(struct pipe_context *_pipe,
unsigned num_samplers,
void **samplers)
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
if (num_samplers > PIPE_MAX_SAMPLERS) {
glhd_error("%u samplers requested, "
if (num_samplers > PIPE_MAX_VERTEX_SAMPLERS) {
glhd_error("%u vertex samplers requested, "
"but only %u are permitted by API",
num_samplers, PIPE_MAX_SAMPLERS);
num_samplers, PIPE_MAX_VERTEX_SAMPLERS);
}
switch (shader) {
case PIPE_SHADER_VERTEX:
pipe->bind_vertex_sampler_states(pipe, num_samplers, samplers);
break;
case PIPE_SHADER_FRAGMENT:
pipe->bind_fragment_sampler_states(pipe, num_samplers, samplers);
break;
default:
assert(0);
}
pipe->bind_vertex_sampler_states(pipe,
num_samplers,
samplers);
}
static void
galahad_context_bind_vertex_sampler_states(struct pipe_context *_pipe,
unsigned num_samplers,
void **samplers)
{
galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_VERTEX,
0, num_samplers, samplers);
}
static void
galahad_context_bind_fragment_sampler_states(struct pipe_context *_pipe,
unsigned num_samplers,
void **samplers)
{
galahad_context_bind_sampler_states(_pipe, PIPE_SHADER_FRAGMENT,
0, num_samplers, samplers);
}
static void
galahad_context_delete_sampler_state(struct pipe_context *_pipe,
void *sampler)
@@ -567,11 +558,9 @@ galahad_context_set_viewport_state(struct pipe_context *_pipe,
}
static void
galahad_context_set_sampler_views(struct pipe_context *_pipe,
unsigned shader,
unsigned start,
unsigned num,
struct pipe_sampler_view **_views)
galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe,
unsigned num,
struct pipe_sampler_view **_views)
{
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
@@ -588,36 +577,31 @@ galahad_context_set_sampler_views(struct pipe_context *_pipe,
views = unwrapped_views;
}
switch (shader) {
case PIPE_SHADER_VERTEX:
pipe->set_vertex_sampler_views(pipe, num, views);
break;
case PIPE_SHADER_FRAGMENT:
pipe->set_fragment_sampler_views(pipe, num, views);
break;
default:
assert(0);
}
pipe->set_fragment_sampler_views(pipe, num, views);
}
static void
galahad_context_set_vertex_sampler_views(struct pipe_context *_pipe,
unsigned num,
struct pipe_sampler_view **_views)
unsigned num,
struct pipe_sampler_view **_views)
{
galahad_context_set_sampler_views(_pipe, PIPE_SHADER_VERTEX,
0, num, _views);
}
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
struct pipe_sampler_view *unwrapped_views[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_sampler_view **views = NULL;
unsigned i;
static void
galahad_context_set_fragment_sampler_views(struct pipe_context *_pipe,
unsigned num,
struct pipe_sampler_view **_views)
{
galahad_context_set_sampler_views(_pipe, PIPE_SHADER_FRAGMENT,
0, num, _views);
}
if (_views) {
for (i = 0; i < num; i++)
unwrapped_views[i] = galahad_sampler_view_unwrap(_views[i]);
for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++)
unwrapped_views[i] = NULL;
views = unwrapped_views;
}
pipe->set_vertex_sampler_views(pipe, num, views);
}
static void
galahad_context_set_vertex_buffers(struct pipe_context *_pipe,

View File

@@ -230,7 +230,7 @@ struct i915_context {
*/
const struct i915_blend_state *blend;
const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state *vertex_samplers[PIPE_MAX_SAMPLERS];
struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
const struct i915_depth_stencil_state *depth_stencil;
const struct i915_rasterizer_state *rasterizer;
@@ -250,8 +250,8 @@ struct i915_context {
unsigned dirty;
struct pipe_resource *mapped_vs_tex[PIPE_MAX_SAMPLERS];
struct i915_winsys_buffer* mapped_vs_tex_buffer[PIPE_MAX_SAMPLERS];
struct pipe_resource *mapped_vs_tex[PIPE_MAX_VERTEX_SAMPLERS];
struct i915_winsys_buffer* mapped_vs_tex_buffer[PIPE_MAX_VERTEX_SAMPLERS];
unsigned num_samplers;
unsigned num_fragment_sampler_views;

View File

@@ -739,8 +739,11 @@ i915_texture_get_transfer(struct pipe_context *pipe,
/* if we use staging transfers, only support textures we can render to,
* because we need that for u_blitter */
if (i915->blitter &&
util_blitter_is_copy_supported(i915->blitter, resource, resource,
PIPE_MASK_RGBAZS) &&
i915_is_format_supported(NULL, /* screen */
transfer->b.resource->format,
0, /* target */
1, /* sample count */
PIPE_BIND_RENDER_TARGET) &&
(usage & PIPE_TRANSFER_WRITE) &&
!(usage & (PIPE_TRANSFER_READ | PIPE_TRANSFER_DONTBLOCK | PIPE_TRANSFER_UNSYNCHRONIZED)))
use_staging_texture = TRUE;

View File

@@ -107,7 +107,7 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
switch (cap) {
case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
if (debug_get_bool_option("DRAW_USE_LLVM", TRUE))
return PIPE_MAX_SAMPLERS;
return PIPE_MAX_VERTEX_SAMPLERS;
else
return 0;
default:

Some files were not shown because too many files have changed in this diff Show More