aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-26 10:35:11 +0100
committermarha <marha@users.sourceforge.net>2012-01-26 10:35:11 +0100
commiteb4c088eb71f93b9639f4ff651523d794f1433f7 (patch)
tree5e95635c1768d7d8e640b298f6c6fbe38cd3c395
parente6432710d8a586386b3c7025e845cf4f80830da3 (diff)
downloadvcxsrv-eb4c088eb71f93b9639f4ff651523d794f1433f7.tar.gz
vcxsrv-eb4c088eb71f93b9639f4ff651523d794f1433f7.tar.bz2
vcxsrv-eb4c088eb71f93b9639f4ff651523d794f1433f7.zip
xwininfo xcb-proto mesa xserver git update 26 12 2012
-rw-r--r--apps/xwininfo/configure.ac21
-rw-r--r--libxcb/xcb-proto/src/import.py66
-rw-r--r--libxcb/xcb-proto/src/size.py76
-rw-r--r--libxcb/xcb-proto/src/type.py74
-rw-r--r--mesalib/configure.ac2
-rw-r--r--mesalib/src/mesa/main/fbobject.c27
-rw-r--r--mesalib/src/mesa/main/framebuffer.c2
-rw-r--r--mesalib/src/mesa/main/image.c12
-rw-r--r--mesalib/src/mesa/main/mtypes.h3
-rw-r--r--mesalib/src/mesa/main/texformat.c10
-rw-r--r--mesalib/src/mesa/main/teximage.c14
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_shader.c403
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_program.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h2
-rw-r--r--mesalib/src/mesa/state_tracker/st_debug.c204
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c68
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp35
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c35
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c445
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.h10
-rw-r--r--xorg-server/hw/xfree86/int10/helper_exec.c2
30 files changed, 717 insertions, 844 deletions
diff --git a/apps/xwininfo/configure.ac b/apps/xwininfo/configure.ac
index f722390b3..ae0c3df22 100644
--- a/apps/xwininfo/configure.ac
+++ b/apps/xwininfo/configure.ac
@@ -21,34 +21,35 @@ dnl PERFORMANCE OF THIS SOFTWARE.
dnl
dnl Process this file with autoconf to create configure.
+# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xwininfo], [1.1.2],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xwininfo])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+AC_USE_SYSTEM_EXTENSIONS
+
+# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
+AM_ICONV
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION],
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
XORG_MACROS_VERSION(1.8)
-
-AC_CONFIG_HEADERS([config.h])
-
-AC_USE_SYSTEM_EXTENSIONS
-
XORG_DEFAULT_OPTIONS
+# Checks for library functions
AC_CHECK_FUNCS([strlcat])
+# Use POSIX strnlen or the implementation supplied in this module
AC_FUNC_STRNLEN
if test "x$ac_cv_func_strnlen_working" = xyes; then
AC_DEFINE(HAVE_STRNLEN, 1, [Define to 1 if you have a working strnlen function.])
fi
-AM_ICONV
-
-# Allow using xcb-icccm, but don't make it the default while the API is
-# still being changed.
+# Define a configure option for using the XCB ICCCM helper functions
AC_MSG_CHECKING([whether to use xcb-icccm library])
AC_ARG_WITH([xcb-icccm],
[AS_HELP_STRING([--with-xcb-icccm],
@@ -61,7 +62,7 @@ if test "x$with_xcb_icccm" != xno ; then
xcb_icccm_pc='xcb-icccm >= 0.3.8'
fi
-# Checks for pkg-config packages
+# Obtain compiler/linker options for xwininfo dependencies
PKG_CHECK_MODULES(XWININFO, [xcb >= 1.6] xcb-shape ${xcb_icccm_pc})
# Even when using xcb, xproto is still required for Xfuncproto.h
diff --git a/libxcb/xcb-proto/src/import.py b/libxcb/xcb-proto/src/import.py
deleted file mode 100644
index eb58f5561..000000000
--- a/libxcb/xcb-proto/src/import.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax import make_parser
-import sys, os
-
-path = [os.path.curdir, 'extensions']
-def find_file_on_path(name):
- for d in path:
- test = os.path.join(d, name)
- if os.path.isfile(test):
- return test
- raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), name)
-
-seen = {}
-
-class ProcessImports(XMLFilterBase):
- def setContentHandler(self, handler):
- self.handler = handler
- XMLFilterBase.setContentHandler(self, handler)
-
- def ensure(self, name):
- if not seen.has_key(name):
- child = ProcessImports(make_parser())
- child.setContentHandler(self.handler)
- child.parse(find_file_on_path(name + '.xml'))
-
- def startDocument(self):
- pass
- def endDocument(self):
- pass
-
- inimport = None
-
- def startElement(self, name, attrs):
- assert self.inimport is None
- if name == 'import':
- self.inimport = ""
- return
- XMLFilterBase.startElement(self, name, attrs)
- if name == 'xcb':
- seen[attrs['header']] = True
- self.ensure('xproto')
-
- def characters(self, content):
- if self.inimport is not None:
- self.inimport += content
- else:
- XMLFilterBase.characters(self, content)
-
- def endElement(self, name):
- if name == 'import':
- self.ensure(self.inimport)
- self.inimport = None
- return
- XMLFilterBase.endElement(self, name)
-
-out = XMLGenerator()
-importer = ProcessImports(make_parser())
-importer.setContentHandler(out)
-out.startDocument()
-if len(sys.argv) > 1:
- importer.parse(sys.argv[1])
-else:
- importer.parse(sys.stdin)
-out.endDocument()
diff --git a/libxcb/xcb-proto/src/size.py b/libxcb/xcb-proto/src/size.py
deleted file mode 100644
index 5ead8b238..000000000
--- a/libxcb/xcb-proto/src/size.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax.xmlreader import AttributesImpl
-from xml.sax import make_parser
-import sys
-
-def AttributesUnion(base, **values):
- baseitems = dict(base)
- baseitems.update(values)
- return AttributesImpl(baseitems)
-
-class AnnotateSize(XMLFilterBase):
- types = {
- 'BYTE': 1, 'BOOL': 1,
- 'CARD8': 1, 'CARD16': 2, 'CARD32': 4,
- 'INT8': 1, 'INT16': 2, 'INT32': 4,
- 'char': 1, 'void': 1,
- 'float': 4, 'double': 8,
- 'XID': 4,
- }
- header = []
- def setTypeSize(self, name, size):
- assert not self.types.has_key(name), "size of " + name + " declared as both " + str(size) + " and " + str(self.types[name])
- self.types[name] = size
-
- struct = None
- union = None
- def startElement(self, name, attrs):
- if name == 'xcb':
- self.header.insert(0, attrs['header'])
- elif name == 'field':
- size = self.types.get(attrs['type'], 0)
- if self.struct is not None:
- self.totalsize += size
- elif self.union is not None:
- self.totalsize = max(self.totalsize, size)
- attrs = AttributesUnion(attrs, bytes=str(size))
- elif name == 'pad':
- assert self.union is None
- if self.struct is not None:
- self.totalsize += int(attrs['bytes'])
- elif name == 'xidtype':
- self.setTypeSize(attrs['name'], 4)
- elif name == 'typedef':
- self.setTypeSize(attrs['newname'], self.types[attrs['oldname']])
- elif name == 'struct' or name == 'union':
- assert self.struct is None and self.union is None
- setattr(self, name, attrs['name'])
- self.totalsize = 0
-
- if len(self.header) == 1 or name == 'xcb':
- XMLFilterBase.startElement(self, name, attrs)
-
- def characters(self, content):
- if len(self.header) == 1:
- XMLFilterBase.characters(self, content)
-
- def endElement(self, name):
- if len(self.header) == 1 or name == 'xcb':
- XMLFilterBase.endElement(self, name)
-
- if name == 'xcb':
- self.header.pop(0)
- elif name == 'struct' or name == 'union':
- assert getattr(self, name) is not None
- self.setTypeSize(getattr(self, name), self.totalsize)
- setattr(self, name, None)
- del self.totalsize
-
-annotator = AnnotateSize(make_parser())
-annotator.setContentHandler(XMLGenerator())
-if len(sys.argv) > 1:
- annotator.parse(sys.argv[1])
-else:
- annotator.parse(sys.stdin)
diff --git a/libxcb/xcb-proto/src/type.py b/libxcb/xcb-proto/src/type.py
deleted file mode 100644
index 83382325d..000000000
--- a/libxcb/xcb-proto/src/type.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-
-from xml.sax.saxutils import XMLFilterBase, XMLGenerator
-from xml.sax.xmlreader import AttributesImpl
-from xml.sax import make_parser
-import sys
-
-def AttributesUnion(base, **values):
- baseitems = dict(base)
- baseitems.update(values)
- return AttributesImpl(baseitems)
-
-class AnnotateType(XMLFilterBase):
- scopes = []
- map = dict([(name, [name]) for name in [
- 'BOOL', 'BYTE',
- 'CARD8', 'CARD16', 'CARD32',
- 'INT8', 'INT16', 'INT32',
- 'char', 'void',
- 'float', 'double',
- 'XID',
- ]])
- def startScope(self, name):
- self.scopes.insert(0, name)
- def declareType(self, name):
- assert ':' not in name
- qname = self.scopes[0] + ':' + name
- self.map.setdefault(name, []).insert(0, qname)
- def getQualifiedType(self, name):
- if ':' in name:
- return name
- names = self.map.get(name, [])
- return names[0]
- def endScope(self):
- self.scopes.pop(0)
-
- def startElement(self, name, attrs):
- attnames = []
- if name == 'xcb':
- self.startScope(attrs['header'])
- elif name in ['struct', 'union', 'xidtype', 'enum', 'event', 'eventcopy', 'error', 'errorcopy']:
- self.declareType(attrs['name'])
- attnames = ['name']
- if name.endswith('copy'):
- attnames.append('ref')
- elif name == 'typedef':
- self.declareType(attrs['newname'])
- attnames = ['oldname', 'newname']
- elif name == 'valueparam':
- attnames = ['value-mask-type']
- elif attrs.has_key('type'):
- attnames = ['type']
- newattrs = {}
- for attname in attnames:
- newattrs[attname] = self.getQualifiedType(attrs[attname])
- if newattrs:
- attrs = AttributesUnion(attrs, **newattrs)
- XMLFilterBase.startElement(self, name, attrs)
-
- def endElement(self, name):
- XMLFilterBase.endElement(self, name)
- if name == 'xcb':
- self.endScope()
-
-annotator = AnnotateType(make_parser())
-annotator.setContentHandler(XMLGenerator())
-if len(sys.argv) > 1:
- annotator.parse(sys.argv[1])
-else:
- annotator.parse(sys.stdin)
-
-for name,names in annotator.map.iteritems():
- if len(names) != 1:
- print "<!-- warning:", name, "has the following definitions:", names, "-->"
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 18a40fcea..2472cc141 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1586,7 +1586,7 @@ if test "x$enable_gallium_g3dvl" = xyes; then
fi
if test "x$enable_xvmc" = xyes; then
- PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 xorg-server])
+ PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg/xvmc"
HAVE_ST_XVMC="yes"
fi
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 2b3ac2e25..987d687b9 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1225,7 +1225,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGBA8I_EXT:
case GL_RGBA16I_EXT:
case GL_RGBA32I_EXT:
- return ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
case GL_RGB8UI_EXT:
case GL_RGB16UI_EXT:
@@ -1233,7 +1234,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
- return ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
case GL_R8UI:
case GL_R8I:
@@ -1241,8 +1243,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_R16I:
case GL_R32UI:
case GL_R32I:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer ? GL_RED : 0;
+ return ctx->VersionMajor >= 3 ||
+ (ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
case GL_RG8UI:
case GL_RG8I:
@@ -1250,8 +1253,9 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer ? GL_RG : 0;
+ return ctx->VersionMajor >= 3 ||
+ (ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
case GL_INTENSITY8I_EXT:
case GL_INTENSITY8UI_EXT:
@@ -1280,6 +1284,15 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
return ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
+ case GL_ALPHA8I_EXT:
+ case GL_ALPHA8UI_EXT:
+ case GL_ALPHA16I_EXT:
+ case GL_ALPHA16UI_EXT:
+ case GL_ALPHA32I_EXT:
+ case GL_ALPHA32UI_EXT:
+ return ctx->Extensions.EXT_texture_integer &&
+ ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
+
case GL_RGB10_A2UI:
return ctx->Extensions.ARB_texture_rgb10_a2ui ? GL_RGBA : 0;
default:
@@ -2392,7 +2405,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
"glGetFramebufferAttachmentParameterivEXT(pname)");
}
else {
- if (ctx->Extensions.EXT_framebuffer_sRGB && ctx->Const.sRGBCapable) {
+ if (ctx->Extensions.EXT_framebuffer_sRGB) {
*params = _mesa_get_format_color_encoding(att->Renderbuffer->Format);
}
else {
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index 7c3c4e345..ea14148de 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -527,7 +527,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx,
fb->Visual.samples = rb->NumSamples;
fb->Visual.sampleBuffers = rb->NumSamples > 0 ? 1 : 0;
if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
- fb->Visual.sRGBCapable = ctx->Const.sRGBCapable;
+ fb->Visual.sRGBCapable = ctx->Extensions.EXT_framebuffer_sRGB;
break;
}
}
diff --git a/mesalib/src/mesa/main/image.c b/mesalib/src/mesa/main/image.c
index 8b65cf0f0..3491704f8 100644
--- a/mesalib/src/mesa/main/image.c
+++ b/mesalib/src/mesa/main/image.c
@@ -536,7 +536,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return ctx->Extensions.EXT_texture_integer;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer;
default:
return GL_FALSE;
}
@@ -549,7 +550,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return ctx->Extensions.EXT_texture_integer;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer;
case GL_UNSIGNED_BYTE_3_3_2:
case GL_UNSIGNED_BYTE_2_3_3_REV:
case GL_UNSIGNED_SHORT_5_6_5:
@@ -568,7 +570,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
/* NOTE: no packed formats w/ BGR format */
- return ctx->Extensions.EXT_texture_integer;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer;
default:
return GL_FALSE;
}
@@ -582,7 +585,8 @@ _mesa_is_legal_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return ctx->Extensions.EXT_texture_integer;
+ return ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL_UNSIGNED_SHORT_5_5_5_1:
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 760113172..a2b01d05d 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2808,9 +2808,6 @@ struct gl_constants
/** GL_EXT_gpu_shader4 */
GLint MinProgramTexelOffset, MaxProgramTexelOffset;
- /* GL_EXT_framebuffer_sRGB */
- GLboolean sRGBCapable; /* can enable sRGB blend/update on FBOs */
-
/* GL_ARB_robustness */
GLenum ResetStrategy;
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 259eb9044..5fdc2ab1f 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -706,6 +706,12 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
break;
+ }
+ }
+
+ if (ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer) {
+ switch (internalFormat) {
case GL_RGB8UI_EXT:
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8);
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
@@ -822,7 +828,9 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
}
}
- if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.EXT_texture_integer) {
+ if (ctx->VersionMajor >= 3 ||
+ (ctx->Extensions.ARB_texture_rg &&
+ ctx->Extensions.EXT_texture_integer)) {
switch (internalFormat) {
case GL_R8UI:
RETURN_IF_SUPPORTED(MESA_FORMAT_R_UINT8);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index c64b10b04..d11425d5e 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -323,7 +323,8 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
#endif /* FEATURE_EXT_texture_sRGB */
- if (ctx->Extensions.EXT_texture_integer) {
+ if (ctx->VersionMajor >= 3 ||
+ ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
case GL_RGBA8UI_EXT:
case GL_RGBA16UI_EXT:
@@ -340,6 +341,11 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
return GL_RGB;
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_integer) {
+ switch (internalFormat) {
case GL_ALPHA8UI_EXT:
case GL_ALPHA16UI_EXT:
case GL_ALPHA32UI_EXT:
@@ -391,7 +397,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- if (!ctx->Extensions.EXT_texture_integer)
+ if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_R8:
@@ -416,7 +422,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
- if (!ctx->Extensions.EXT_texture_integer)
+ if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_RG:
@@ -1680,7 +1686,7 @@ texture_error_check( struct gl_context *ctx,
}
/* additional checks for integer textures */
- if (ctx->Extensions.EXT_texture_integer &&
+ if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) &&
(_mesa_is_integer_format(format) !=
_mesa_is_integer_format(internalFormat))) {
if (!isProxy) {
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 38ae1ce85..82cc54b44 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -77,7 +77,6 @@ _mesa_override_glsl_version(struct gl_context *ctx)
/**
* Examine enabled GL extensions to determine GL version.
- * Return major and minor version numbers.
*/
static void
compute_version(struct gl_context *ctx)
@@ -140,7 +139,6 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_framebuffer_sRGB &&
ctx->Extensions.EXT_packed_float &&
ctx->Extensions.EXT_texture_array &&
- ctx->Extensions.EXT_texture_integer &&
ctx->Extensions.EXT_texture_shared_exponent &&
ctx->Extensions.EXT_transform_feedback &&
ctx->Extensions.NV_conditional_render);
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index f3d28e675..25799bf2b 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -112,7 +112,8 @@ static void update_raster_state( struct st_context *st )
raster->light_twoside = 1;
}
- raster->clamp_vertex_color = ctx->Light._ClampVertexColor;
+ raster->clamp_vertex_color = !st->clamp_vert_color_in_shader &&
+ ctx->Light._ClampVertexColor;
/* _NEW_POLYGON
*/
@@ -255,7 +256,8 @@ static void update_raster_state( struct st_context *st )
raster->scissor = 1;
/* _NEW_FRAG_CLAMP */
- raster->clamp_fragment_color = ctx->Color._ClampFragmentColor;
+ raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
+ ctx->Color._ClampFragmentColor;
raster->gl_rasterization_rules = 1;
/* _NEW_RASTERIZER_DISCARD */
diff --git a/mesalib/src/mesa/state_tracker/st_atom_shader.c b/mesalib/src/mesa/state_tracker/st_atom_shader.c
index 383bb2a1b..ae3491097 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_shader.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c
@@ -1,198 +1,205 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-/**
- * State validation for vertex/fragment shaders.
- * Note that we have to delay most vertex/fragment shader translation
- * until rendering time since the linkage between the vertex outputs and
- * fragment inputs can vary depending on the pairing of shaders.
- *
- * Authors:
- * Brian Paul
- */
-
-#include "main/imports.h"
-#include "main/mtypes.h"
-#include "program/program.h"
-
-#include "pipe/p_context.h"
-
-#include "util/u_simple_shaders.h"
-
-#include "cso_cache/cso_context.h"
-
-#include "st_context.h"
-#include "st_atom.h"
-#include "st_program.h"
-
-
-/**
- * Return pointer to a pass-through fragment shader.
- * This shader is used when a texture is missing/incomplete.
- */
-static void *
-get_passthrough_fs(struct st_context *st)
-{
- if (!st->passthrough_fs) {
- st->passthrough_fs =
- util_make_fragment_passthrough_shader(st->pipe);
- }
-
- return st->passthrough_fs;
-}
-
-
-/**
- * Update fragment program state/atom. This involves translating the
- * Mesa fragment program into a gallium fragment program and binding it.
- */
-static void
-update_fp( struct st_context *st )
-{
- struct st_fragment_program *stfp;
- struct st_fp_variant_key key;
-
- assert(st->ctx->FragmentProgram._Current);
- stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
- assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
-
- memset(&key, 0, sizeof(key));
- key.st = st;
-
- st->fp_variant = st_get_fp_variant(st, stfp, &key);
-
- st_reference_fragprog(st, &st->fp, stfp);
-
- if (st->missing_textures) {
- /* use a pass-through frag shader that uses no textures */
- void *fs = get_passthrough_fs(st);
- cso_set_fragment_shader_handle(st->cso_context, fs);
- }
- else {
- cso_set_fragment_shader_handle(st->cso_context,
- st->fp_variant->driver_shader);
- }
-}
-
-
-const struct st_tracked_state st_update_fp = {
- "st_update_fp", /* name */
- { /* dirty */
- 0, /* mesa */
- ST_NEW_FRAGMENT_PROGRAM /* st */
- },
- update_fp /* update */
-};
-
-
-
-/**
- * Update vertex program state/atom. This involves translating the
- * Mesa vertex program into a gallium fragment program and binding it.
- */
-static void
-update_vp( struct st_context *st )
-{
- struct st_vertex_program *stvp;
- struct st_vp_variant_key key;
-
- /* find active shader and params -- Should be covered by
- * ST_NEW_VERTEX_PROGRAM
- */
- assert(st->ctx->VertexProgram._Current);
- stvp = st_vertex_program(st->ctx->VertexProgram._Current);
- assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
-
- memset(&key, 0, sizeof key);
- key.st = st; /* variants are per-context */
-
- /* When this is true, we will add an extra input to the vertex
- * shader translation (for edgeflags), an extra output with
- * edgeflag semantics, and extend the vertex shader to pass through
- * the input to the output. We'll need to use similar logic to set
- * up the extra vertex_element input for edgeflags.
- * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
- */
- key.passthrough_edgeflags = (st->vertdata_edgeflags && (
- st->ctx->Polygon.FrontMode != GL_FILL ||
- st->ctx->Polygon.BackMode != GL_FILL));
-
- st->vp_variant = st_get_vp_variant(st, stvp, &key);
-
- st_reference_vertprog(st, &st->vp, stvp);
-
- cso_set_vertex_shader_handle(st->cso_context,
- st->vp_variant->driver_shader);
-
- st->vertex_result_to_slot = stvp->result_to_output;
-}
-
-
-const struct st_tracked_state st_update_vp = {
- "st_update_vp", /* name */
- { /* dirty */
- _NEW_POLYGON, /* mesa */
- ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA /* st */
- },
- update_vp /* update */
-};
-
-
-
-static void
-update_gp( struct st_context *st )
-{
- struct st_geometry_program *stgp;
- struct st_gp_variant_key key;
-
- if (!st->ctx->GeometryProgram._Current) {
- cso_set_geometry_shader_handle(st->cso_context, NULL);
- return;
- }
-
- stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
- assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);
-
- memset(&key, 0, sizeof(key));
- key.st = st;
-
- st->gp_variant = st_get_gp_variant(st, stgp, &key);
-
- st_reference_geomprog(st, &st->gp, stgp);
-
- cso_set_geometry_shader_handle(st->cso_context,
- st->gp_variant->driver_shader);
-}
-
-const struct st_tracked_state st_update_gp = {
- "st_update_gp", /* name */
- { /* dirty */
- 0, /* mesa */
- ST_NEW_GEOMETRY_PROGRAM /* st */
- },
- update_gp /* update */
-};
+/**************************************************************************
+ *
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+/**
+ * State validation for vertex/fragment shaders.
+ * Note that we have to delay most vertex/fragment shader translation
+ * until rendering time since the linkage between the vertex outputs and
+ * fragment inputs can vary depending on the pairing of shaders.
+ *
+ * Authors:
+ * Brian Paul
+ */
+
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "program/program.h"
+
+#include "pipe/p_context.h"
+
+#include "util/u_simple_shaders.h"
+
+#include "cso_cache/cso_context.h"
+
+#include "st_context.h"
+#include "st_atom.h"
+#include "st_program.h"
+
+
+/**
+ * Return pointer to a pass-through fragment shader.
+ * This shader is used when a texture is missing/incomplete.
+ */
+static void *
+get_passthrough_fs(struct st_context *st)
+{
+ if (!st->passthrough_fs) {
+ st->passthrough_fs =
+ util_make_fragment_passthrough_shader(st->pipe);
+ }
+
+ return st->passthrough_fs;
+}
+
+
+/**
+ * Update fragment program state/atom. This involves translating the
+ * Mesa fragment program into a gallium fragment program and binding it.
+ */
+static void
+update_fp( struct st_context *st )
+{
+ struct st_fragment_program *stfp;
+ struct st_fp_variant_key key;
+
+ assert(st->ctx->FragmentProgram._Current);
+ stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
+ assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB);
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+
+ /* _NEW_FRAG_CLAMP */
+ key.clamp_color = st->clamp_frag_color_in_shader &&
+ st->ctx->Color._ClampFragmentColor;
+
+ st->fp_variant = st_get_fp_variant(st, stfp, &key);
+
+ st_reference_fragprog(st, &st->fp, stfp);
+
+ if (st->missing_textures) {
+ /* use a pass-through frag shader that uses no textures */
+ void *fs = get_passthrough_fs(st);
+ cso_set_fragment_shader_handle(st->cso_context, fs);
+ }
+ else {
+ cso_set_fragment_shader_handle(st->cso_context,
+ st->fp_variant->driver_shader);
+ }
+}
+
+
+const struct st_tracked_state st_update_fp = {
+ "st_update_fp", /* name */
+ { /* dirty */
+ 0, /* mesa */
+ ST_NEW_FRAGMENT_PROGRAM /* st */
+ },
+ update_fp /* update */
+};
+
+
+
+/**
+ * Update vertex program state/atom. This involves translating the
+ * Mesa vertex program into a gallium fragment program and binding it.
+ */
+static void
+update_vp( struct st_context *st )
+{
+ struct st_vertex_program *stvp;
+ struct st_vp_variant_key key;
+
+ /* find active shader and params -- Should be covered by
+ * ST_NEW_VERTEX_PROGRAM
+ */
+ assert(st->ctx->VertexProgram._Current);
+ stvp = st_vertex_program(st->ctx->VertexProgram._Current);
+ assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
+
+ memset(&key, 0, sizeof key);
+ key.st = st; /* variants are per-context */
+
+ /* When this is true, we will add an extra input to the vertex
+ * shader translation (for edgeflags), an extra output with
+ * edgeflag semantics, and extend the vertex shader to pass through
+ * the input to the output. We'll need to use similar logic to set
+ * up the extra vertex_element input for edgeflags.
+ * _NEW_POLYGON, ST_NEW_EDGEFLAGS_DATA
+ */
+ key.passthrough_edgeflags = (st->vertdata_edgeflags && (
+ st->ctx->Polygon.FrontMode != GL_FILL ||
+ st->ctx->Polygon.BackMode != GL_FILL));
+
+ key.clamp_color = st->clamp_vert_color_in_shader &&
+ st->ctx->Light._ClampVertexColor;
+
+ st->vp_variant = st_get_vp_variant(st, stvp, &key);
+
+ st_reference_vertprog(st, &st->vp, stvp);
+
+ cso_set_vertex_shader_handle(st->cso_context,
+ st->vp_variant->driver_shader);
+
+ st->vertex_result_to_slot = stvp->result_to_output;
+}
+
+
+const struct st_tracked_state st_update_vp = {
+ "st_update_vp", /* name */
+ { /* dirty */
+ _NEW_POLYGON, /* mesa */
+ ST_NEW_VERTEX_PROGRAM | ST_NEW_EDGEFLAGS_DATA /* st */
+ },
+ update_vp /* update */
+};
+
+
+
+static void
+update_gp( struct st_context *st )
+{
+ struct st_geometry_program *stgp;
+ struct st_gp_variant_key key;
+
+ if (!st->ctx->GeometryProgram._Current) {
+ cso_set_geometry_shader_handle(st->cso_context, NULL);
+ return;
+ }
+
+ stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
+ assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+
+ st->gp_variant = st_get_gp_variant(st, stgp, &key);
+
+ st_reference_geomprog(st, &st->gp, stgp);
+
+ cso_set_geometry_shader_handle(st->cso_context,
+ st->gp_variant->driver_shader);
+}
+
+const struct st_tracked_state st_update_gp = {
+ "st_update_gp", /* name */
+ { /* dirty */
+ 0, /* mesa */
+ ST_NEW_GEOMETRY_PROGRAM /* st */
+ },
+ update_gp /* update */
+};
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index a97096802..7c0254d8d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -450,6 +450,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
memset(&key, 0, sizeof(key));
key.st = st;
key.bitmap = GL_TRUE;
+ key.clamp_color = st->clamp_frag_color_in_shader &&
+ st->ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index 13c4f3369..386eed290 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -684,7 +684,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
{
struct pipe_rasterizer_state rasterizer;
memset(&rasterizer, 0, sizeof(rasterizer));
- rasterizer.clamp_fragment_color = ctx->Color._ClampFragmentColor;
+ rasterizer.clamp_fragment_color = !st->clamp_frag_color_in_shader &&
+ ctx->Color._ClampFragmentColor;
rasterizer.gl_rasterization_rules = 1;
rasterizer.depth_clip = !ctx->Transform.DepthClamp;
rasterizer.scissor = ctx->Scissor.Enabled;
@@ -1007,6 +1008,8 @@ get_color_fp_variant(struct st_context *st)
ctx->Pixel.AlphaBias != 0.0 ||
ctx->Pixel.AlphaScale != 1.0);
key.pixelMaps = ctx->Pixel.MapColorFlag;
+ key.clamp_color = st->clamp_frag_color_in_shader &&
+ st->ctx->Color._ClampFragmentColor;
fpv = st_get_fp_variant(st, st->fp, &key);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index fefd93a4b..1cbc0d606 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -471,7 +471,7 @@ st_validate_attachment(struct gl_context *ctx,
/* If the encoding is sRGB and sRGB rendering cannot be enabled,
* check for linear format support instead.
* Later when we create a surface, we change the format to a linear one. */
- if (!ctx->Const.sRGBCapable &&
+ if (!ctx->Extensions.EXT_framebuffer_sRGB &&
_mesa_get_format_color_encoding(texFormat) == GL_SRGB) {
const gl_format linearFormat = _mesa_get_srgb_format_linear(texFormat);
format = st_mesa_format_to_pipe_format(linearFormat);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_program.c b/mesalib/src/mesa/state_tracker/st_cb_program.c
index 2abb4d8f0..617e7ce64 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_program.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_program.c
@@ -160,11 +160,6 @@ st_delete_program(struct gl_context *ctx, struct gl_program *prog)
if (stfp->glsl_to_tgsi)
free_glsl_to_tgsi_visitor(stfp->glsl_to_tgsi);
-
- if (stfp->tgsi.tokens) {
- st_free_tokens(stfp->tgsi.tokens);
- stfp->tgsi.tokens = NULL;
- }
}
break;
default:
@@ -205,11 +200,6 @@ st_program_string_notify( struct gl_context *ctx,
st_release_fp_variants(st, stfp);
- if (stfp->tgsi.tokens) {
- st_free_tokens(stfp->tgsi.tokens);
- stfp->tgsi.tokens = NULL;
- }
-
if (st->fp == stfp)
st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index dc1d33f1d..a3fd4dbcb 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -76,6 +76,17 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state)
{
struct st_context *st = st_context(ctx);
+ /* Replace _NEW_FRAG_CLAMP with ST_NEW_FRAGMENT_PROGRAM for the fallback. */
+ if (st->clamp_frag_color_in_shader && (new_state & _NEW_FRAG_CLAMP)) {
+ new_state &= ~_NEW_FRAG_CLAMP;
+ st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+ }
+
+ /* Update the vertex shader if ctx->Light._ClampVertexColor was changed. */
+ if (st->clamp_vert_color_in_shader && (new_state & _NEW_LIGHT)) {
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+ }
+
st->dirty.mesa |= new_state;
st->dirty.st |= ST_NEW_MESA;
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 9db50b3f4..da03719fd 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -76,6 +76,8 @@ struct st_context
struct draw_stage *selection_stage; /**< For GL_SELECT rendermode */
struct draw_stage *rastpos_stage; /**< For glRasterPos */
GLboolean sw_primitive_restart;
+ GLboolean clamp_frag_color_in_shader;
+ GLboolean clamp_vert_color_in_shader;
/* On old libGL's for linux we need to invalidate the drawables
diff --git a/mesalib/src/mesa/state_tracker/st_debug.c b/mesalib/src/mesa/state_tracker/st_debug.c
index ee7d78a4f..850fab925 100644
--- a/mesalib/src/mesa/state_tracker/st_debug.c
+++ b/mesalib/src/mesa/state_tracker/st_debug.c
@@ -1,102 +1,102 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/context.h"
-#include "program/prog_print.h"
-
-#include "pipe/p_state.h"
-#include "pipe/p_shader_tokens.h"
-#include "tgsi/tgsi_dump.h"
-
-#include "cso_cache/cso_cache.h"
-
-#include "st_context.h"
-#include "st_debug.h"
-#include "st_program.h"
-
-
-
-#ifdef DEBUG
-int ST_DEBUG = 0;
-
-static const struct debug_named_value st_debug_flags[] = {
- { "mesa", DEBUG_MESA, NULL },
- { "tgsi", DEBUG_TGSI, NULL },
- { "constants",DEBUG_CONSTANTS, NULL },
- { "pipe", DEBUG_PIPE, NULL },
- { "tex", DEBUG_TEX, NULL },
- { "fallback", DEBUG_FALLBACK, NULL },
- { "screen", DEBUG_SCREEN, NULL },
- { "query", DEBUG_QUERY, NULL },
- DEBUG_NAMED_VALUE_END
-};
-
-DEBUG_GET_ONCE_FLAGS_OPTION(st_debug, "ST_DEBUG", st_debug_flags, 0)
-#endif
-
-
-void
-st_debug_init(void)
-{
-#ifdef DEBUG
- ST_DEBUG = debug_get_option_st_debug();
-#endif
-}
-
-
-
-/**
- * Print current state. May be called from inside gdb to see currently
- * bound vertex/fragment shaders and associated constants.
- */
-void
-st_print_current(void)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct st_context *st = st_context(ctx);
-
-#if 0
- int i;
-
- printf("Vertex Transform Inputs:\n");
- for (i = 0; i < st->vp->state.num_inputs; i++) {
- printf(" Slot %d: VERT_ATTRIB_%d\n", i, st->vp->index_to_input[i]);
- }
-#endif
-
- if (st->vp->variants)
- tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
- if (st->vp->Base.Base.Parameters)
- _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
-
- tgsi_dump( st->fp->tgsi.tokens, 0 );
- if (st->fp->Base.Base.Parameters)
- _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
-}
-
-
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "main/context.h"
+#include "program/prog_print.h"
+
+#include "pipe/p_state.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_dump.h"
+
+#include "cso_cache/cso_cache.h"
+
+#include "st_context.h"
+#include "st_debug.h"
+#include "st_program.h"
+
+
+
+#ifdef DEBUG
+int ST_DEBUG = 0;
+
+static const struct debug_named_value st_debug_flags[] = {
+ { "mesa", DEBUG_MESA, NULL },
+ { "tgsi", DEBUG_TGSI, NULL },
+ { "constants",DEBUG_CONSTANTS, NULL },
+ { "pipe", DEBUG_PIPE, NULL },
+ { "tex", DEBUG_TEX, NULL },
+ { "fallback", DEBUG_FALLBACK, NULL },
+ { "screen", DEBUG_SCREEN, NULL },
+ { "query", DEBUG_QUERY, NULL },
+ DEBUG_NAMED_VALUE_END
+};
+
+DEBUG_GET_ONCE_FLAGS_OPTION(st_debug, "ST_DEBUG", st_debug_flags, 0)
+#endif
+
+
+void
+st_debug_init(void)
+{
+#ifdef DEBUG
+ ST_DEBUG = debug_get_option_st_debug();
+#endif
+}
+
+
+
+/**
+ * Print current state. May be called from inside gdb to see currently
+ * bound vertex/fragment shaders and associated constants.
+ */
+void
+st_print_current(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct st_context *st = st_context(ctx);
+
+#if 0
+ int i;
+
+ printf("Vertex Transform Inputs:\n");
+ for (i = 0; i < st->vp->state.num_inputs; i++) {
+ printf(" Slot %d: VERT_ATTRIB_%d\n", i, st->vp->index_to_input[i]);
+ }
+#endif
+
+ if (st->vp->variants)
+ tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
+ if (st->vp->Base.Base.Parameters)
+ _mesa_print_parameter_list(st->vp->Base.Base.Parameters);
+
+ tgsi_dump( st->fp->variants[0].tgsi.tokens, 0 );
+ if (st->fp->Base.Base.Parameters)
+ _mesa_print_parameter_list(st->fp->Base.Base.Parameters);
+}
+
+
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 49c874710..49709d342 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -387,19 +387,14 @@ void st_init_extensions(struct st_context *st)
*/
if (screen->is_format_supported(screen, PIPE_FORMAT_S8_UINT_Z24_UNORM,
PIPE_TEXTURE_2D, 0,
- PIPE_BIND_DEPTH_STENCIL) &&
- screen->is_format_supported(screen, PIPE_FORMAT_S8_UINT_Z24_UNORM,
+ PIPE_BIND_DEPTH_STENCIL |
+ PIPE_BIND_SAMPLER_VIEW) ||
+ screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT,
PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_DEPTH_STENCIL |
PIPE_BIND_SAMPLER_VIEW)) {
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
- }
- else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_DEPTH_STENCIL) &&
- screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_SAMPLER_VIEW)) {
- ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
+ ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
}
/* float support - assume nothing exclusively supports 64-bit floats */
@@ -430,7 +425,6 @@ void st_init_extensions(struct st_context *st)
PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET)) {
ctx->Extensions.EXT_framebuffer_sRGB = GL_TRUE;
- ctx->Const.sRGBCapable = GL_TRUE;
}
}
@@ -441,7 +435,16 @@ void st_init_extensions(struct st_context *st)
}
/* s3tc support */
- if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
+ if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW) &&
+ screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW) &&
(ctx->Mesa_DXTn || st_get_s3tc_override())) {
@@ -516,12 +519,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.MESA_texture_array = GL_TRUE;
}
- /* GL_ARB_framebuffer_object */
- if (ctx->Extensions.EXT_packed_depth_stencil) {
- /* we support always support GL_EXT_framebuffer_blit */
- ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
- }
-
if (screen->get_param(screen, PIPE_CAP_CONDITIONAL_RENDER)) {
ctx->Extensions.NV_conditional_render = GL_TRUE;
}
@@ -607,33 +604,16 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_depth_clamp = GL_TRUE;
}
- /* This extension does not actually require support of floating point
- * render targets, just clamping controls.
- * Advertise this extension if either fragment color clamping is supported
- * or no render targets having color values outside of the range [0, 1]
- * are supported, in which case the fragment color clamping has no effect
- * on rendering.
- */
- if (screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL) ||
- (!screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SNORM,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET) &&
- !screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_SNORM,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET) &&
- !screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_FLOAT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET) &&
- !screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_FLOAT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET) &&
- !screen->is_format_supported(screen, PIPE_FORMAT_R11G11B10_FLOAT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET) &&
- !screen->is_format_supported(screen, PIPE_FORMAT_R9G9B9E5_FLOAT,
- PIPE_TEXTURE_2D, 0,
- PIPE_BIND_RENDER_TARGET))) {
+ if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
ctx->Extensions.ARB_color_buffer_float = GL_TRUE;
+
+ if (!screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_CLAMPED)) {
+ st->clamp_vert_color_in_shader = TRUE;
+ }
+
+ if (!screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMPED)) {
+ st->clamp_frag_color_in_shader = TRUE;
+ }
}
if (screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 92dffe258..188e8d9d5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4055,7 +4055,7 @@ src_register(struct st_translate *t,
static struct ureg_dst
translate_dst(struct st_translate *t,
const st_dst_reg *dst_reg,
- bool saturate)
+ bool saturate, bool clamp_color)
{
struct ureg_dst dst = dst_register(t,
dst_reg->file,
@@ -4065,6 +4065,27 @@ translate_dst(struct st_translate *t,
if (saturate)
dst = ureg_saturate(dst);
+ else if (clamp_color && dst_reg->file == PROGRAM_OUTPUT) {
+ /* Clamp colors for ARB_color_buffer_float. */
+ switch (t->procType) {
+ case TGSI_PROCESSOR_VERTEX:
+ /* XXX if the geometry shader is present, this must be done there
+ * instead of here. */
+ if (dst_reg->index == VERT_RESULT_COL0 ||
+ dst_reg->index == VERT_RESULT_COL1 ||
+ dst_reg->index == VERT_RESULT_BFC0 ||
+ dst_reg->index == VERT_RESULT_BFC1) {
+ dst = ureg_saturate(dst);
+ }
+ break;
+
+ case TGSI_PROCESSOR_FRAGMENT:
+ if (dst_reg->index >= FRAG_RESULT_COLOR) {
+ dst = ureg_saturate(dst);
+ }
+ break;
+ }
+ }
if (dst_reg->reladdr != NULL)
dst = ureg_dst_indirect(dst, ureg_src(t->address[0]));
@@ -4134,7 +4155,8 @@ translate_tex_offset(struct st_translate *t,
static void
compile_tgsi_instruction(struct st_translate *t,
- const glsl_to_tgsi_instruction *inst)
+ const glsl_to_tgsi_instruction *inst,
+ bool clamp_dst_color_output)
{
struct ureg_program *ureg = t->ureg;
GLuint i;
@@ -4151,7 +4173,8 @@ compile_tgsi_instruction(struct st_translate *t,
if (num_dst)
dst[0] = translate_dst(t,
&inst->dst,
- inst->saturate);
+ inst->saturate,
+ clamp_dst_color_output);
for (i = 0; i < num_src; i++)
src[i] = translate_src(t, &inst->src[i]);
@@ -4457,7 +4480,8 @@ st_translate_program(
const GLuint outputMapping[],
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[],
- boolean passthrough_edgeflags)
+ boolean passthrough_edgeflags,
+ boolean clamp_color)
{
struct st_translate *t;
unsigned i;
@@ -4697,7 +4721,8 @@ st_translate_program(
*/
foreach_iter(exec_list_iterator, iter, program->instructions) {
set_insn_start(t, ureg_get_instruction_number(ureg));
- compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *)iter.get());
+ compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *)iter.get(),
+ clamp_color);
if (t->prevInstWrotePointSize && proginfo->Id) {
/* The previous instruction wrote to the (fake) vertex point size
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
index 1f71f33fd..55d59d571 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.h
@@ -49,7 +49,8 @@ enum pipe_error st_translate_program(
const GLuint outputMapping[],
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[],
- boolean passthrough_edgeflags);
+ boolean passthrough_edgeflags,
+ boolean clamp_color);
void free_glsl_to_tgsi_visitor(struct glsl_to_tgsi_visitor *v);
void get_pixel_transfer_visitor(struct st_fragment_program *fp,
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 63920a39e..7efc17305 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -688,7 +688,9 @@ st_framebuffer_reuse_or_create(struct gl_framebuffer *fb,
{
struct st_framebuffer *cur = st_ws_framebuffer(fb), *stfb = NULL;
- if (cur && cur->iface == stfbi) {
+ /* dummy framebuffers cant be used as st_framebuffer */
+ if (cur && &cur->Base != _mesa_get_incomplete_framebuffer() &&
+ cur->iface == stfbi) {
/* reuse the current stfb */
st_framebuffer_reference(&stfb, cur);
}
@@ -779,7 +781,7 @@ st_manager_flush_frontbuffer(struct st_context *st)
return;
/* never a dummy fb */
- assert(stfb->iface);
+ assert(&stfb->Base != _mesa_get_incomplete_framebuffer());
stfb->iface->flush_front(stfb->iface, ST_ATTACHMENT_FRONT_LEFT);
}
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 0764234bd..fc77089e7 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -306,7 +306,8 @@ st_translate_texture_target( GLuint textarget,
static struct ureg_dst
translate_dst( struct st_translate *t,
const struct prog_dst_register *DstReg,
- boolean saturate )
+ boolean saturate,
+ boolean clamp_color)
{
struct ureg_dst dst = dst_register( t,
DstReg->File,
@@ -317,6 +318,27 @@ translate_dst( struct st_translate *t,
if (saturate)
dst = ureg_saturate( dst );
+ else if (clamp_color && DstReg->File == PROGRAM_OUTPUT) {
+ /* Clamp colors for ARB_color_buffer_float. */
+ switch (t->procType) {
+ case TGSI_PROCESSOR_VERTEX:
+ /* XXX if the geometry shader is present, this must be done there
+ * instead of here. */
+ if (DstReg->Index == VERT_RESULT_COL0 ||
+ DstReg->Index == VERT_RESULT_COL1 ||
+ DstReg->Index == VERT_RESULT_BFC0 ||
+ DstReg->Index == VERT_RESULT_BFC1) {
+ dst = ureg_saturate(dst);
+ }
+ break;
+
+ case TGSI_PROCESSOR_FRAGMENT:
+ if (DstReg->Index >= FRAG_RESULT_COLOR) {
+ dst = ureg_saturate(dst);
+ }
+ break;
+ }
+ }
if (DstReg->RelAddr)
dst = ureg_dst_indirect( dst, ureg_src(t->address[0]) );
@@ -662,7 +684,8 @@ translate_opcode( unsigned op )
static void
compile_instruction(
struct st_translate *t,
- const struct prog_instruction *inst )
+ const struct prog_instruction *inst,
+ boolean clamp_dst_color_output)
{
struct ureg_program *ureg = t->ureg;
GLuint i;
@@ -677,7 +700,8 @@ compile_instruction(
if (num_dst)
dst[0] = translate_dst( t,
&inst->DstReg,
- inst->SaturateMode );
+ inst->SaturateMode,
+ clamp_dst_color_output);
for (i = 0; i < num_src; i++)
src[i] = translate_src( t, &inst->SrcReg[i] );
@@ -1016,7 +1040,8 @@ st_translate_mesa_program(
const GLuint outputMapping[],
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[],
- boolean passthrough_edgeflags )
+ boolean passthrough_edgeflags,
+ boolean clamp_color)
{
struct st_translate translate, *t;
unsigned i;
@@ -1233,7 +1258,7 @@ st_translate_mesa_program(
*/
for (i = 0; i < program->NumInstructions; i++) {
set_insn_start( t, ureg_get_instruction_number( ureg ));
- compile_instruction( t, &program->Instructions[i] );
+ compile_instruction( t, &program->Instructions[i], clamp_color );
if (t->prevInstWrotePointSize && program->Id) {
/* The previous instruction wrote to the (fake) vertex point size
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
index 7563c8050..7e1a5abdc 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.h
@@ -59,7 +59,8 @@ st_translate_mesa_program(
const GLuint outputMapping[],
const ubyte outputSemanticName[],
const ubyte outputSemanticIndex[],
- boolean passthrough_edgeflags );
+ boolean passthrough_edgeflags,
+ boolean clamp_color);
void
st_free_tokens(const struct tgsi_token *tokens);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index 8d08b2b0f..deee722cf 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -110,7 +110,8 @@ delete_fp_variant(struct st_context *st, struct st_fp_variant *fpv)
cso_delete_fragment_shader(st->cso_context, fpv->driver_shader);
if (fpv->parameters)
_mesa_free_parameter_list(fpv->parameters);
-
+ if (fpv->tgsi.tokens)
+ st_free_tokens(fpv->tgsi.tokens);
FREE(fpv);
}
@@ -351,7 +352,8 @@ st_translate_vertex_program(struct st_context *st,
stvp->result_to_output,
stvp->output_semantic_name,
stvp->output_semantic_index,
- key->passthrough_edgeflags );
+ key->passthrough_edgeflags,
+ key->clamp_color);
else
error = st_translate_mesa_program(st->ctx,
TGSI_PROCESSOR_VERTEX,
@@ -368,7 +370,8 @@ st_translate_vertex_program(struct st_context *st,
stvp->result_to_output,
stvp->output_semantic_name,
stvp->output_semantic_index,
- key->passthrough_edgeflags );
+ key->passthrough_edgeflags,
+ key->clamp_color);
if (error)
goto fail;
@@ -470,6 +473,23 @@ st_translate_fragment_program(struct st_context *st,
struct st_fp_variant *variant = CALLOC_STRUCT(st_fp_variant);
GLboolean deleteFP = GL_FALSE;
+ GLuint outputMapping[FRAG_RESULT_MAX];
+ GLuint inputMapping[FRAG_ATTRIB_MAX];
+ GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
+ GLuint attr;
+ GLbitfield64 inputsRead;
+ struct ureg_program *ureg;
+
+ GLboolean write_all = GL_FALSE;
+
+ ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
+ ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
+ uint fs_num_inputs = 0;
+
+ ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
+ ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
+ uint fs_num_outputs = 0;
+
if (!variant)
return NULL;
@@ -505,247 +525,230 @@ st_translate_fragment_program(struct st_context *st,
}
#endif
- if (!stfp->tgsi.tokens) {
- /* need to translate Mesa instructions to TGSI now */
- GLuint outputMapping[FRAG_RESULT_MAX];
- GLuint inputMapping[FRAG_ATTRIB_MAX];
- GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
- GLuint attr;
- const GLbitfield64 inputsRead = stfp->Base.Base.InputsRead;
- struct ureg_program *ureg;
+ if (!stfp->glsl_to_tgsi)
+ _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
- GLboolean write_all = GL_FALSE;
+ /*
+ * Convert Mesa program inputs to TGSI input register semantics.
+ */
+ inputsRead = stfp->Base.Base.InputsRead;
+ for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
+ if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
+ const GLuint slot = fs_num_inputs++;
- ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
- ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
- uint fs_num_inputs = 0;
+ inputMapping[attr] = slot;
- ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
- ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
- uint fs_num_outputs = 0;
-
- if (!stfp->glsl_to_tgsi)
- _mesa_remove_output_reads(&stfp->Base.Base, PROGRAM_OUTPUT);
+ switch (attr) {
+ case FRAG_ATTRIB_WPOS:
+ input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ case FRAG_ATTRIB_COL0:
+ input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ TRUE);
+ break;
+ case FRAG_ATTRIB_COL1:
+ input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
+ input_semantic_index[slot] = 1;
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ TRUE);
+ break;
+ case FRAG_ATTRIB_FOGC:
+ input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ break;
+ case FRAG_ATTRIB_FACE:
+ input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
+ break;
+ case FRAG_ATTRIB_CLIP_DIST0:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ case FRAG_ATTRIB_CLIP_DIST1:
+ input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
+ input_semantic_index[slot] = 1;
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ break;
+ /* In most cases, there is nothing special about these
+ * inputs, so adopt a convention to use the generic
+ * semantic name and the mesa FRAG_ATTRIB_ number as the
+ * index.
+ *
+ * All that is required is that the vertex shader labels
+ * its own outputs similarly, and that the vertex shader
+ * generates at least every output required by the
+ * fragment shader plus fixed-function hardware (such as
+ * BFC).
+ *
+ * There is no requirement that semantic indexes start at
+ * zero or be restricted to a particular range -- nobody
+ * should be building tables based on semantic index.
+ */
+ case FRAG_ATTRIB_PNTC:
+ case FRAG_ATTRIB_TEX0:
+ case FRAG_ATTRIB_TEX1:
+ case FRAG_ATTRIB_TEX2:
+ case FRAG_ATTRIB_TEX3:
+ case FRAG_ATTRIB_TEX4:
+ case FRAG_ATTRIB_TEX5:
+ case FRAG_ATTRIB_TEX6:
+ case FRAG_ATTRIB_TEX7:
+ case FRAG_ATTRIB_VAR0:
+ default:
+ /* Actually, let's try and zero-base this just for
+ * readability of the generated TGSI.
+ */
+ assert(attr >= FRAG_ATTRIB_TEX0);
+ input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
+ input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
+ if (attr == FRAG_ATTRIB_PNTC)
+ interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
+ else
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+ FALSE);
+ break;
+ }
+ }
+ else {
+ inputMapping[attr] = -1;
+ }
+ }
- /*
- * Convert Mesa program inputs to TGSI input register semantics.
- */
- for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
- if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
- const GLuint slot = fs_num_inputs++;
+ /*
+ * Semantics and mapping for outputs
+ */
+ {
+ uint numColors = 0;
+ GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
+
+ /* if z is written, emit that first */
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
+ fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
+ fs_output_semantic_index[fs_num_outputs] = 0;
+ outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
+ fs_num_outputs++;
+ outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
+ }
- inputMapping[attr] = slot;
+ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
+ fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
+ fs_output_semantic_index[fs_num_outputs] = 0;
+ outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
+ fs_num_outputs++;
+ outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
+ }
+ /* handle remaining outputs (color) */
+ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
+ if (outputsWritten & BITFIELD64_BIT(attr)) {
switch (attr) {
- case FRAG_ATTRIB_WPOS:
- input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
- input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
- break;
- case FRAG_ATTRIB_COL0:
- input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- input_semantic_index[slot] = 0;
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
- TRUE);
- break;
- case FRAG_ATTRIB_COL1:
- input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
- input_semantic_index[slot] = 1;
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
- TRUE);
- break;
- case FRAG_ATTRIB_FOGC:
- input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
- input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
- break;
- case FRAG_ATTRIB_FACE:
- input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
- input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
+ case FRAG_RESULT_DEPTH:
+ case FRAG_RESULT_STENCIL:
+ /* handled above */
+ assert(0);
break;
- case FRAG_ATTRIB_CLIP_DIST0:
- input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- input_semantic_index[slot] = 0;
- interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
- break;
- case FRAG_ATTRIB_CLIP_DIST1:
- input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST;
- input_semantic_index[slot] = 1;
- interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
- break;
- /* In most cases, there is nothing special about these
- * inputs, so adopt a convention to use the generic
- * semantic name and the mesa FRAG_ATTRIB_ number as the
- * index.
- *
- * All that is required is that the vertex shader labels
- * its own outputs similarly, and that the vertex shader
- * generates at least every output required by the
- * fragment shader plus fixed-function hardware (such as
- * BFC).
- *
- * There is no requirement that semantic indexes start at
- * zero or be restricted to a particular range -- nobody
- * should be building tables based on semantic index.
- */
- case FRAG_ATTRIB_PNTC:
- case FRAG_ATTRIB_TEX0:
- case FRAG_ATTRIB_TEX1:
- case FRAG_ATTRIB_TEX2:
- case FRAG_ATTRIB_TEX3:
- case FRAG_ATTRIB_TEX4:
- case FRAG_ATTRIB_TEX5:
- case FRAG_ATTRIB_TEX6:
- case FRAG_ATTRIB_TEX7:
- case FRAG_ATTRIB_VAR0:
+ case FRAG_RESULT_COLOR:
+ write_all = GL_TRUE; /* fallthrough */
default:
- /* Actually, let's try and zero-base this just for
- * readability of the generated TGSI.
- */
- assert(attr >= FRAG_ATTRIB_TEX0);
- input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
- input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- if (attr == FRAG_ATTRIB_PNTC)
- interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
- else
- interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
- FALSE);
+ assert(attr == FRAG_RESULT_COLOR ||
+ (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
+ fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
+ fs_output_semantic_index[fs_num_outputs] = numColors;
+ outputMapping[attr] = fs_num_outputs;
+ numColors++;
break;
}
- }
- else {
- inputMapping[attr] = -1;
- }
- }
-
- /*
- * Semantics and mapping for outputs
- */
- {
- uint numColors = 0;
- GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten;
-
- /* if z is written, emit that first */
- if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
- fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_POSITION;
- fs_output_semantic_index[fs_num_outputs] = 0;
- outputMapping[FRAG_RESULT_DEPTH] = fs_num_outputs;
- fs_num_outputs++;
- outputsWritten &= ~(1 << FRAG_RESULT_DEPTH);
- }
- if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
- fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_STENCIL;
- fs_output_semantic_index[fs_num_outputs] = 0;
- outputMapping[FRAG_RESULT_STENCIL] = fs_num_outputs;
fs_num_outputs++;
- outputsWritten &= ~(1 << FRAG_RESULT_STENCIL);
- }
-
- /* handle remaning outputs (color) */
- for (attr = 0; attr < FRAG_RESULT_MAX; attr++) {
- if (outputsWritten & BITFIELD64_BIT(attr)) {
- switch (attr) {
- case FRAG_RESULT_DEPTH:
- case FRAG_RESULT_STENCIL:
- /* handled above */
- assert(0);
- break;
- case FRAG_RESULT_COLOR:
- write_all = GL_TRUE; /* fallthrough */
- default:
- assert(attr == FRAG_RESULT_COLOR ||
- (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX));
- fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR;
- fs_output_semantic_index[fs_num_outputs] = numColors;
- outputMapping[attr] = fs_num_outputs;
- numColors++;
- break;
- }
-
- fs_num_outputs++;
- }
}
}
+ }
- ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
- if (ureg == NULL) {
- FREE(variant);
- return NULL;
- }
+ ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
+ if (ureg == NULL) {
+ FREE(variant);
+ return NULL;
+ }
- if (ST_DEBUG & DEBUG_MESA) {
- _mesa_print_program(&stfp->Base.Base);
- _mesa_print_program_parameters(st->ctx, &stfp->Base.Base);
- debug_printf("\n");
- }
- if (write_all == GL_TRUE)
- ureg_property_fs_color0_writes_all_cbufs(ureg, 1);
+ if (ST_DEBUG & DEBUG_MESA) {
+ _mesa_print_program(&stfp->Base.Base);
+ _mesa_print_program_parameters(st->ctx, &stfp->Base.Base);
+ debug_printf("\n");
+ }
+ if (write_all == GL_TRUE)
+ ureg_property_fs_color0_writes_all_cbufs(ureg, 1);
- if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) {
- switch (stfp->Base.FragDepthLayout) {
- case FRAG_DEPTH_LAYOUT_ANY:
- ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY);
- break;
- case FRAG_DEPTH_LAYOUT_GREATER:
- ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER);
- break;
- case FRAG_DEPTH_LAYOUT_LESS:
- ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS);
- break;
- case FRAG_DEPTH_LAYOUT_UNCHANGED:
- ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED);
- break;
- default:
- assert(0);
- }
+ if (stfp->Base.FragDepthLayout != FRAG_DEPTH_LAYOUT_NONE) {
+ switch (stfp->Base.FragDepthLayout) {
+ case FRAG_DEPTH_LAYOUT_ANY:
+ ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_ANY);
+ break;
+ case FRAG_DEPTH_LAYOUT_GREATER:
+ ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_GREATER);
+ break;
+ case FRAG_DEPTH_LAYOUT_LESS:
+ ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_LESS);
+ break;
+ case FRAG_DEPTH_LAYOUT_UNCHANGED:
+ ureg_property_fs_depth_layout(ureg, TGSI_FS_DEPTH_LAYOUT_UNCHANGED);
+ break;
+ default:
+ assert(0);
}
-
- if (stfp->glsl_to_tgsi)
- st_translate_program(st->ctx,
- TGSI_PROCESSOR_FRAGMENT,
- ureg,
- stfp->glsl_to_tgsi,
- &stfp->Base.Base,
- /* inputs */
- fs_num_inputs,
- inputMapping,
- input_semantic_name,
- input_semantic_index,
- interpMode,
- /* outputs */
- fs_num_outputs,
- outputMapping,
- fs_output_semantic_name,
- fs_output_semantic_index, FALSE );
- else
- st_translate_mesa_program(st->ctx,
- TGSI_PROCESSOR_FRAGMENT,
- ureg,
- &stfp->Base.Base,
- /* inputs */
- fs_num_inputs,
- inputMapping,
- input_semantic_name,
- input_semantic_index,
- interpMode,
- /* outputs */
- fs_num_outputs,
- outputMapping,
- fs_output_semantic_name,
- fs_output_semantic_index, FALSE );
-
- stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL );
- ureg_destroy( ureg );
}
+ if (stfp->glsl_to_tgsi)
+ st_translate_program(st->ctx,
+ TGSI_PROCESSOR_FRAGMENT,
+ ureg,
+ stfp->glsl_to_tgsi,
+ &stfp->Base.Base,
+ /* inputs */
+ fs_num_inputs,
+ inputMapping,
+ input_semantic_name,
+ input_semantic_index,
+ interpMode,
+ /* outputs */
+ fs_num_outputs,
+ outputMapping,
+ fs_output_semantic_name,
+ fs_output_semantic_index, FALSE,
+ key->clamp_color );
+ else
+ st_translate_mesa_program(st->ctx,
+ TGSI_PROCESSOR_FRAGMENT,
+ ureg,
+ &stfp->Base.Base,
+ /* inputs */
+ fs_num_inputs,
+ inputMapping,
+ input_semantic_name,
+ input_semantic_index,
+ interpMode,
+ /* outputs */
+ fs_num_outputs,
+ outputMapping,
+ fs_output_semantic_name,
+ fs_output_semantic_index, FALSE,
+ key->clamp_color);
+
+ variant->tgsi.tokens = ureg_get_tokens( ureg, NULL );
+ ureg_destroy( ureg );
+
/* fill in variant */
- variant->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi);
+ variant->driver_shader = pipe->create_fs_state(pipe, &variant->tgsi);
variant->key = *key;
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
+ tgsi_dump( variant->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ );
debug_printf("\n");
}
@@ -802,7 +805,7 @@ st_translate_geometry_program(struct st_context *st,
GLuint outputMapping[GEOM_RESULT_MAX];
struct pipe_context *pipe = st->pipe;
GLuint attr;
- const GLbitfield64 inputsRead = stgp->Base.Base.InputsRead;
+ GLbitfield64 inputsRead;
GLuint vslot = 0;
GLuint num_generic = 0;
@@ -842,6 +845,7 @@ st_translate_geometry_program(struct st_context *st,
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
+ inputsRead = stgp->Base.Base.InputsRead;
for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) {
if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = gs_num_inputs;
@@ -1022,6 +1026,7 @@ st_translate_geometry_program(struct st_context *st,
outputMapping,
gs_output_semantic_name,
gs_output_semantic_index,
+ FALSE,
FALSE);
stgp->num_inputs = gs_num_inputs;
diff --git a/mesalib/src/mesa/state_tracker/st_program.h b/mesalib/src/mesa/state_tracker/st_program.h
index 699b6e8cc..6c4b4f6c3 100644
--- a/mesalib/src/mesa/state_tracker/st_program.h
+++ b/mesalib/src/mesa/state_tracker/st_program.h
@@ -55,6 +55,9 @@ struct st_fp_variant_key
GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */
GLuint drawpixels_z:1; /**< glDrawPixels(GL_DEPTH) */
GLuint drawpixels_stencil:1; /**< glDrawPixels(GL_STENCIL) */
+
+ /** for ARB_color_buffer_float */
+ GLuint clamp_color:1;
};
@@ -66,6 +69,8 @@ struct st_fp_variant
/** Parameters which generated this version of fragment program */
struct st_fp_variant_key key;
+ struct pipe_shader_state tgsi;
+
/** Driver's compiled shader */
void *driver_shader;
@@ -86,8 +91,6 @@ struct st_fragment_program
struct gl_fragment_program Base;
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
- struct pipe_shader_state tgsi;
-
struct st_fp_variant *variants;
};
@@ -98,6 +101,9 @@ struct st_vp_variant_key
{
struct st_context *st; /**< variants are per-context */
boolean passthrough_edgeflags;
+
+ /** for ARB_color_buffer_float */
+ boolean clamp_color;
};
diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c
index 638f5668b..03f9f7da6 100644
--- a/xorg-server/hw/xfree86/int10/helper_exec.c
+++ b/xorg-server/hw/xfree86/int10/helper_exec.c
@@ -726,7 +726,7 @@ xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
}
}
- pci_device_unmap_legacy(pInt->dev, base, pagesize);
+ pci_device_unmap_legacy(pInt->dev, base - BIOS_SCRATCH_OFF, pagesize);
}
#endif