aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-16 14:52:47 +0200
committermarha <marha@users.sourceforge.net>2012-08-16 14:52:47 +0200
commite12a88a1a4897365d47e428bceda547a4e02fbd0 (patch)
tree116944397f595fd9b72d8de3b0a3783ccf3937ef
parentf5a4fa87e844b3ea2658a2355a4c4ac3393a65a1 (diff)
parent4aac32998c2b173b84aec0b020aa086fef4b1423 (diff)
downloadvcxsrv-e12a88a1a4897365d47e428bceda547a4e02fbd0.tar.gz
vcxsrv-e12a88a1a4897365d47e428bceda547a4e02fbd0.tar.bz2
vcxsrv-e12a88a1a4897365d47e428bceda547a4e02fbd0.zip
Merge remote-tracking branch 'origin/released'
-rw-r--r--libxcb/src/c_client.py6
-rw-r--r--mesalib/autogen.sh10
-rw-r--r--mesalib/common.py1
-rw-r--r--mesalib/configure.ac2
-rw-r--r--mesalib/docs/GL3.txt2
-rw-r--r--mesalib/docs/relnotes-8.1.html7
-rw-r--r--mesalib/include/GL/internal/dri_interface.h4
-rw-r--r--mesalib/scons/custom.py4
-rw-r--r--mesalib/scons/gallium.py4
-rw-r--r--mesalib/scons/source_list.py5
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blit.c10
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c344
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.h36
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h20
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_simple_shaders.c133
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_simple_shaders.h20
-rw-r--r--mesalib/src/glsl/Makefile.am8
-rw-r--r--mesalib/src/glsl/Makefile.sources15
-rw-r--r--mesalib/src/glsl/glcpp/Makefile.am4
-rw-r--r--mesalib/src/mapi/glapi/Makefile.am1
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml48
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am2
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_API.xml2
-rw-r--r--mesalib/src/mapi/glapi/gen/glapi_gen.mk14
-rw-r--r--mesalib/src/mesa/Makefile.am25
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c16
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c20
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c19
-rw-r--r--mesalib/src/mesa/main/api_exec.c217
-rw-r--r--mesalib/src/mesa/main/attrib.c4
-rw-r--r--mesalib/src/mesa/main/bufferobj.c106
-rw-r--r--mesalib/src/mesa/main/bufferobj.h3
-rw-r--r--mesalib/src/mesa/main/context.h10
-rw-r--r--mesalib/src/mesa/main/extensions.c163
-rw-r--r--mesalib/src/mesa/main/fbobject.c144
-rw-r--r--mesalib/src/mesa/main/fbobject.h9
-rw-r--r--mesalib/src/mesa/main/format_unpack.c5
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/pack.c725
-rw-r--r--mesalib/src/mesa/main/pack.h12
-rw-r--r--mesalib/src/mesa/main/readpix.c13
-rw-r--r--mesalib/src/mesa/main/samplerobj.c1
-rw-r--r--mesalib/src/mesa/main/texgetimage.c16
-rw-r--r--mesalib/src/mesa/main/texobj.c213
-rw-r--r--mesalib/src/mesa/main/texobj.h8
-rw-r--r--mesalib/src/mesa/main/texparam.c24
-rw-r--r--mesalib/src/mesa/main/texstore.c95
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c20
-rw-r--r--mesalib/src/mesa/program/prog_statevars.h1
-rw-r--r--mesalib/src/mesa/sources.mak36
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_rasterizer.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_shader.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c6
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c36
-rw-r--r--xorg-server/dix/main.c18
-rw-r--r--xorg-server/fb/fbseg.c18
-rw-r--r--xorg-server/glx/glxscreens.c3
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Crtc.c11
-rw-r--r--xorg-server/hw/xquartz/quartz.c1
-rw-r--r--xorg-server/render/filter.c5
61 files changed, 2207 insertions, 511 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py
index a936b098f..9b93a9067 100644
--- a/libxcb/src/c_client.py
+++ b/libxcb/src/c_client.py
@@ -5,6 +5,7 @@ from functools import reduce
import getopt
import os
import sys
+import errno
import time
import re
@@ -2903,8 +2904,11 @@ Refer to the README file in xcb/proto for more info.
raise
# Ensure the man subdirectory exists
-if not os.path.exists('man'):
+try:
os.mkdir('man')
+except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
today = time.strftime('%Y-%m-%d', time.gmtime(os.path.getmtime(args[0])))
diff --git a/mesalib/autogen.sh b/mesalib/autogen.sh
index b5f6ec4a9..626d21334 100644
--- a/mesalib/autogen.sh
+++ b/mesalib/autogen.sh
@@ -3,17 +3,11 @@
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
-SRCDIR=`(cd "$srcdir" && pwd)`
ORIGDIR=`pwd`
-
-if test "x$SRCDIR" != "x$ORIGDIR"; then
- echo "Mesa cannot be built when srcdir != builddir" 1>&2
- exit 1
-fi
-
-MAKEFLAGS=""
+cd "$srcdir"
autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
if test -z "$NOCONFIGURE"; then
"$srcdir"/configure "$@"
diff --git a/mesalib/common.py b/mesalib/common.py
index 6121a4114..6ff9608c4 100644
--- a/mesalib/common.py
+++ b/mesalib/common.py
@@ -98,5 +98,6 @@ 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')))
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 2ecedaf0b..0329bad80 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -28,7 +28,7 @@ LT_INIT([disable-static])
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
-LIBDRM_RADEON_REQUIRED=2.4.31
+LIBDRM_RADEON_REQUIRED=2.4.38
LIBDRM_INTEL_REQUIRED=2.4.37
LIBDRM_NVVIEUX_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED=2.4.33
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index d41c052c2..246eb30a9 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -78,7 +78,7 @@ GL_ARB_explicit_attrib_location DONE (i915, i965, r300, r6
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 (r600)
+GL_ARB_texture_rgb10_a2ui DONE (i965, r600)
GL_ARB_texture_swizzle DONE (same as EXT version) (i965, r300, r600, swrast)
GL_ARB_timer_query DONE
GL_ARB_instanced_arrays DONE (i965, r300, r600)
diff --git a/mesalib/docs/relnotes-8.1.html b/mesalib/docs/relnotes-8.1.html
index 4c4d48715..8d27c6663 100644
--- a/mesalib/docs/relnotes-8.1.html
+++ b/mesalib/docs/relnotes-8.1.html
@@ -35,6 +35,8 @@ Note: some of the new features are only available with certain drivers.
<li>GL_ARB_base_instance</li>
<li>GL_ARB_blend_func_extended</li>
<li>GL_ARB_debug_output</li>
+<li>GL_ARB_invalidate_subdate - Currently a "no-op" implementation. This
+extension is always enabled in all drivers.</li>
<li>GL_ARB_shader_bit_encoding</li>
<li>GL_ARB_timer_query</li>
<li>GL_ARB_transform_feedback3</li>
@@ -43,6 +45,11 @@ Note: some of the new features are only available with certain drivers.
<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>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>
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index 9aef95860..865164306 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -804,8 +804,8 @@ struct __DRIdri2LoaderExtensionRec {
#define __DRI_DRI2_VERSION 3
#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
-#define __DRI_API_GLES 1
-#define __DRI_API_GLES2 2
+#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
+#define __DRI_API_GLES2 2 /**< OpenGL ES 2.0 or 3.0 */
#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
diff --git a/mesalib/scons/custom.py b/mesalib/scons/custom.py
index cc953bd99..43e7727aa 100644
--- a/mesalib/scons/custom.py
+++ b/mesalib/scons/custom.py
@@ -235,6 +235,10 @@ def parse_source_list(env, filename, names=None):
# parse the source list file
parser = source_list.SourceListParser()
src = env.File(filename).srcnode()
+
+ parser.add_symbol('top_srcdir', env.Dir('#').abspath)
+ parser.add_symbol('top_builddir', env['build_dir'])
+
sym_table = parser.parse(src.abspath)
if names:
diff --git a/mesalib/scons/gallium.py b/mesalib/scons/gallium.py
index f4776d83d..8fc17b3fa 100644
--- a/mesalib/scons/gallium.py
+++ b/mesalib/scons/gallium.py
@@ -298,6 +298,10 @@ 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
diff --git a/mesalib/scons/source_list.py b/mesalib/scons/source_list.py
index 8111f4318..e16d1f9b6 100644
--- a/mesalib/scons/source_list.py
+++ b/mesalib/scons/source_list.py
@@ -13,6 +13,7 @@ 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):
@@ -20,7 +21,6 @@ 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,3 +125,6 @@ class SourceListParser(object):
raise
return self.symbol_table
+
+ def add_symbol(self, name, value):
+ self.symbol_table[name] = value
diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c
index 3887e65fb..bf1c392cd 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blit.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blit.c
@@ -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);
+ unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
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);
+ unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
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);
+ unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
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);
+ unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0);
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->format);
+ dst_format = util_format_linear(dst->texture->format);
/* See whether we will blit depth or stencil. */
is_depth = util_format_has_depth(src_desc);
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index fa71f25ea..a95e1b535 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -81,6 +81,12 @@ 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 */
@@ -559,7 +565,8 @@ 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;
+ boolean normalized = tex->target != PIPE_TEXTURE_RECT &&
+ tex->nr_samples <= 1;
if (normalized) {
out[0] = x1 / (float)u_minify(src_width0, level);
@@ -593,7 +600,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 layer, unsigned sample,
unsigned x1, unsigned y1,
unsigned x2, unsigned y2)
{
@@ -630,8 +637,16 @@ 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*/
+ 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*/
+ }
break;
default:;
@@ -672,81 +687,149 @@ 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,
- unsigned tex_target)
+ struct pipe_resource *tex)
{
struct pipe_context *pipe = ctx->base.pipe;
- assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
+ assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
- /* Create the fragment shader on-demand. */
- if (!ctx->fs_texfetch_col[tex_target]) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
+ if (tex->nr_samples > 1) {
+ void **shader = &ctx->fs_texfetch_col_msaa[tex->target];
- ctx->fs_texfetch_col[tex_target] =
- util_make_fragment_tex_shader(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR);
- }
+ /* 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 ctx->fs_texfetch_col[tex_target];
+ 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;
+ }
}
static INLINE
void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx,
- unsigned tex_target)
+ struct pipe_resource *tex)
{
struct pipe_context *pipe = ctx->base.pipe;
- assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
+ assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
- /* Create the fragment shader on-demand. */
- if (!ctx->fs_texfetch_depth[tex_target]) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
+ if (tex->nr_samples > 1) {
+ void **shader = &ctx->fs_texfetch_depth_msaa[tex->target];
- ctx->fs_texfetch_depth[tex_target] =
- util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex,
- TGSI_INTERPOLATE_LINEAR);
- }
+ /* 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 ctx->fs_texfetch_depth[tex_target];
+ return *shader;
+ }
}
static INLINE
void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx,
- unsigned tex_target)
+ struct pipe_resource *tex)
{
struct pipe_context *pipe = ctx->base.pipe;
- assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
+ assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
- /* Create the fragment shader on-demand. */
- if (!ctx->fs_texfetch_depthstencil[tex_target]) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
+ if (tex->nr_samples > 1) {
+ void **shader = &ctx->fs_texfetch_depthstencil_msaa[tex->target];
- ctx->fs_texfetch_depthstencil[tex_target] =
- util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
- TGSI_INTERPOLATE_LINEAR);
- }
+ /* 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);
- return ctx->fs_texfetch_depthstencil[tex_target];
+ *shader =
+ util_make_fragment_tex_shader_writedepthstencil(pipe, tgsi_tex,
+ TGSI_INTERPOLATE_LINEAR);
+ }
+
+ return *shader;
+ }
}
static INLINE
void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx,
- unsigned tex_target)
+ struct pipe_resource *tex)
{
struct pipe_context *pipe = ctx->base.pipe;
- assert(tex_target < PIPE_MAX_TEXTURE_TYPES);
+ assert(tex->target < PIPE_MAX_TEXTURE_TYPES);
- /* Create the fragment shader on-demand. */
- if (!ctx->fs_texfetch_stencil[tex_target]) {
- unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(tex_target);
+ if (tex->nr_samples > 1) {
+ void **shader = &ctx->fs_texfetch_stencil_msaa[tex->target];
- ctx->fs_texfetch_stencil[tex_target] =
- util_make_fragment_tex_shader_writestencil(pipe, tgsi_tex,
- TGSI_INTERPOLATE_LINEAR);
- }
+ /* 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 ctx->fs_texfetch_stencil[tex_target];
+ return *shader;
+ }
}
static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx)
@@ -879,7 +962,7 @@ void util_blitter_clear(struct blitter_context *blitter,
NULL, NULL);
}
-void util_blitter_clear_depth_custom(struct blitter_context *blitter,
+void util_blitter_custom_clear_depth(struct blitter_context *blitter,
unsigned width, unsigned height,
double depth, void *custom_dsa)
{
@@ -889,10 +972,26 @@ void util_blitter_clear_depth_custom(struct blitter_context *blitter,
}
static
-boolean is_overlap(unsigned sx1, unsigned sx2, unsigned sy1, unsigned sy2,
- unsigned dx1, unsigned dx2, unsigned dy1, unsigned dy2)
+boolean is_overlap(unsigned dstx, unsigned dsty, unsigned dstz,
+ const struct pipe_box *srcbox)
{
- return sx1 < dx2 && sx2 > dx1 && sy1 < dy2 && sy2 > dy1;
+ 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;
}
void util_blitter_default_dst_texture(struct pipe_surface *dst_templ,
@@ -989,10 +1088,10 @@ 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_level, unsigned dst_sample_mask,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
- unsigned src_level,
+ unsigned src_level, unsigned src_sample,
const struct pipe_box *srcbox)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
@@ -1012,9 +1111,9 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
src_view = pipe->create_sampler_view(pipe, src, &src_templ);
/* Copy. */
- util_blitter_copy_texture_view(blitter, dst_view, dstx, dsty, src_view,
- srcbox, src->width0, src->height0,
- PIPE_MASK_RGBAZS);
+ 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);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
@@ -1022,8 +1121,10 @@ 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)
@@ -1032,8 +1133,8 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
struct pipe_context *pipe = ctx->base.pipe;
struct pipe_framebuffer_state fb_state;
enum pipe_texture_target src_target = src->texture->target;
- unsigned width = srcbox->width;
- unsigned height = srcbox->height;
+ int abs_width = abs(srcbox->width);
+ int abs_height = abs(srcbox->height);
boolean blit_stencil, blit_depth;
const struct util_format_description *src_desc =
util_format_description(src->format);
@@ -1053,8 +1154,7 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
/* Sanity checks. */
if (dst->texture == src->texture &&
dst->u.tex.level == src->u.tex.first_level) {
- assert(!is_overlap(srcbox->x, srcbox->x + width, srcbox->y, srcbox->y + height,
- dstx, dstx + width, dsty, dsty + height));
+ assert(!is_overlap(dstx, dsty, 0, srcbox));
}
/* XXX should handle 3d regions */
assert(srcbox->depth == 1);
@@ -1077,17 +1177,17 @@ void util_blitter_copy_texture_view(struct blitter_context *blitter,
pipe->bind_depth_stencil_alpha_state(pipe,
ctx->dsa_write_depth_stencil);
pipe->bind_fs_state(pipe,
- blitter_get_fs_texfetch_depthstencil(ctx, src_target));
+ blitter_get_fs_texfetch_depthstencil(ctx, src->texture));
} else if (blit_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_target));
+ blitter_get_fs_texfetch_depth(ctx, src->texture));
} 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_target));
+ blitter_get_fs_texfetch_stencil(ctx, src->texture));
}
fb_state.nr_cbufs = 0;
@@ -1096,7 +1196,7 @@ 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_target));
+ blitter_get_fs_texfetch_col(ctx, src->texture));
fb_state.nr_cbufs = 1;
fb_state.cbufs[0] = dst;
@@ -1127,51 +1227,36 @@ 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, ~0);
+ pipe->set_sample_mask(pipe, dst_sample_mask);
blitter_set_common_draw_rect_state(ctx);
blitter_set_dst_dimensions(ctx, dst->width, dst->height);
- switch (src_target) {
+ if ((src_target == PIPE_TEXTURE_1D ||
+ src_target == PIPE_TEXTURE_2D ||
+ src_target == PIPE_TEXTURE_RECT) &&
+ src->texture->nr_samples <= 1) {
/* 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);
-
- /* Draw. */
- blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
- }
- break;
+ /* 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+abs_width, dsty+abs_height, 0,
+ UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
+ } else {
/* Draw the quad with the generic codepath. */
- 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_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);
}
blitter_restore_vertex_states(ctx);
@@ -1298,6 +1383,7 @@ 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;
@@ -1333,6 +1419,7 @@ 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);
@@ -1404,3 +1491,64 @@ 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,
+ 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));
+
+ 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);
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.h b/mesalib/src/gallium/auxiliary/util/u_blitter.h
index 7600391c5..f227902c1 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.h
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.h
@@ -156,10 +156,6 @@ void util_blitter_clear(struct blitter_context *blitter,
const union pipe_color_union *color,
double depth, unsigned stencil);
-void util_blitter_clear_depth_custom(struct blitter_context *blitter,
- unsigned width, unsigned height,
- double depth, void *custom_dsa);
-
/**
* Check if the blitter (with the help of the driver) can blit between
* the two resources.
@@ -178,6 +174,10 @@ 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.
*
* These states must be saved in the blitter in addition to the state objects
* already required to be saved:
@@ -190,10 +190,10 @@ 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_level, unsigned dst_sample_mask,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
- unsigned src_level,
+ unsigned src_level, unsigned src_sample,
const struct pipe_box *srcbox);
/**
@@ -218,8 +218,10 @@ 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);
@@ -288,11 +290,33 @@ 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 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,
+ 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
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index 2d603e4dd..a1ece415f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -548,23 +548,37 @@ 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)
+util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target,
+ unsigned nr_samples)
{
switch (pipe_tex_target) {
case PIPE_TEXTURE_1D:
+ assert(nr_samples <= 1);
return TGSI_TEXTURE_1D;
+
case PIPE_TEXTURE_2D:
- return TGSI_TEXTURE_2D;
+ return nr_samples > 1 ? TGSI_TEXTURE_2D_MSAA : 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 TGSI_TEXTURE_2D_ARRAY;
+ return nr_samples > 1 ? TGSI_TEXTURE_2D_ARRAY_MSAA :
+ TGSI_TEXTURE_2D_ARRAY;
+
default:
assert(0 && "unexpected texture target");
return TGSI_TEXTURE_UNKNOWN;
diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c
index 3476b6ce0..5f0134d70 100644
--- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -40,7 +40,12 @@
#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 */
@@ -353,3 +358,131 @@ 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);
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h
index 0764998a3..e4ffde652 100644
--- a/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h
+++ b/mesalib/src/gallium/auxiliary/util/u_simple_shaders.h
@@ -95,6 +95,26 @@ 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
diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am
index d86153c48..20639c93d 100644
--- a/mesalib/src/glsl/Makefile.am
+++ b/mesalib/src/glsl/Makefile.am
@@ -23,9 +23,6 @@
# builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
# For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
@@ -39,7 +36,6 @@ AM_CXXFLAGS = $(AM_CFLAGS)
AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
include Makefile.sources
noinst_LTLIBRARIES = libglslcommon.la libglsl.la
@@ -96,8 +92,8 @@ glsl_parser.cc glsl_parser.h: glsl_parser.yy
BUILT_SOURCES = glsl_parser.h builtin_function.cpp
CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
-builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
+builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
+ $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
glcpp/libglcpp.la:
cd glcpp ; $(MAKE) $(AM_MAKEFLAGS)
diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources
index 765f06a27..aafb53eae 100644
--- a/mesalib/src/glsl/Makefile.sources
+++ b/mesalib/src/glsl/Makefile.sources
@@ -1,6 +1,7 @@
# shared source lists for Makefile, SConscript, and Android.mk
-GLSL_SRCDIR ?= .
+GLSL_SRCDIR = $(top_srcdir)/src/glsl
+GLSL_BUILDDIR = $(top_builddir)/src/glsl
# libglcpp
@@ -8,8 +9,8 @@ LIBGLCPP_FILES = \
$(GLSL_SRCDIR)/glcpp/pp.c
LIBGLCPP_GENERATED_FILES = \
- $(GLSL_SRCDIR)/glcpp/glcpp-lex.c \
- $(GLSL_SRCDIR)/glcpp/glcpp-parse.c
+ $(GLSL_BUILDDIR)/glcpp/glcpp-lex.c \
+ $(GLSL_BUILDDIR)/glcpp/glcpp-parse.c
# libglsl
@@ -102,10 +103,10 @@ BUILTIN_COMPILER_CXX_FILES = \
$(GLSL_SRCDIR)/builtin_stubs.cpp
BUILTIN_COMPILER_GENERATED_CXX_FILES = \
- $(GLSL_SRCDIR)/glsl_lexer.cc \
- $(GLSL_SRCDIR)/glsl_parser.cc
+ $(GLSL_BUILDDIR)/glsl_lexer.cc \
+ $(GLSL_BUILDDIR)/glsl_parser.cc
# libglsl generated sources
LIBGLSL_GENERATED_CXX_FILES = \
- $(GLSL_SRCDIR)/$(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
- $(GLSL_SRCDIR)/builtin_function.cpp
+ $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \
+ $(GLSL_BUILDDIR)/builtin_function.cpp
diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am
index e7d5d2ca3..7a95b6848 100644
--- a/mesalib/src/glsl/glcpp/Makefile.am
+++ b/mesalib/src/glsl/glcpp/Makefile.am
@@ -20,10 +20,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-# Hack to make some of the non-automake variables work.
-TOP=$(top_builddir)
-
-GLSL_SRCDIR=$(top_srcdir)/src/glsl
include ../Makefile.sources
AM_CFLAGS = \
diff --git a/mesalib/src/mapi/glapi/Makefile.am b/mesalib/src/mapi/glapi/Makefile.am
index 668d7faa9..181a28a7c 100644
--- a/mesalib/src/mapi/glapi/Makefile.am
+++ b/mesalib/src/mapi/glapi/Makefile.am
@@ -27,6 +27,7 @@ AM_CPPFLAGS = \
$(DEFINES) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/mapi \
+ -I$(top_builddir)/src/mapi \
-I$(top_srcdir)/src/mesa
if HAVE_X86_ASM
diff --git a/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml b/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml
new file mode 100644
index 000000000..3e4ffc300
--- /dev/null
+++ b/mesalib/src/mapi/glapi/gen/ARB_invalidate_subdata.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+<category name="GL_ARB_invalidate_subdata" number="666">
+ <function name="InvalidateTexSubImage" offset="assign">
+ <param name="texture" type="GLuint"/>
+ <param name="level" type="GLint"/>
+ <param name="xoffset" type="GLint"/>
+ <param name="yoffset" type="GLint"/>
+ <param name="zoffset" type="GLint"/>
+ <param name="width" type="GLsizei"/>
+ <param name="height" type="GLsizei"/>
+ <param name="depth" type="GLsizei"/>
+ </function>
+
+ <function name="InvalidateTexImage" offset="assign">
+ <param name="texture" type="GLuint"/>
+ <param name="level" type="GLint"/>
+ </function>
+
+ <function name="InvalidateBufferSubData" offset="assign">
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ <param name="length" type="GLsizeiptr"/>
+ </function>
+
+ <function name="InvalidateBufferData" offset="assign">
+ <param name="buffer" type="GLuint"/>
+ </function>
+
+ <function name="InvalidateSubFramebuffer" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="numAttachments" type="GLsizei" counter="true"/>
+ <param name="attachments" type="const GLenum *" count="numAttachments"/>
+ <param name="x" type="GLint"/>
+ <param name="y" type="GLint"/>
+ <param name="width" type="GLsizei"/>
+ <param name="height" type="GLsizei"/>
+ </function>
+
+ <function name="InvalidateFramebuffer" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="numAttachments" type="GLsizei" counter="true"/>
+ <param name="attachments" type="const GLenum *" count="numAttachments"/>
+ </function>
+</category>
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 52aeb3a6d..499ec09a8 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -176,7 +176,7 @@ $(XORG_GLAPI_DIR)/%.h: $(MESA_GLAPI_DIR)/%.h
$(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON_ES)
$(PYTHON_GEN) $< \
- --printer glapi --mode lib gl_and_es_API.xml > $@
+ --printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@
$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
$(PYTHON_GEN) $< -f $(srcdir)/gl_API.xml > $@
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 8bdc47908..3c13591ca 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -8067,6 +8067,8 @@
<xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+<xi:include href="ARB_invalidate_subdata.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
<!-- Non-ARB extensions sorted by extension number. -->
<category name="GL_EXT_blend_color" number="2">
diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
index 1b05a405b..eab8eb40c 100644
--- a/mesalib/src/mapi/glapi/gen/glapi_gen.mk
+++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
@@ -1,14 +1,14 @@
# Helpers for glapi header generation
-ifndef TOP
-$(error TOP must be defined.)
+ifndef top_srcdir
+$(error top_srcdir must be defined.)
endif
glapi_gen_common_deps := \
- $(wildcard $(TOP)/src/mapi/glapi/gen/*.xml) \
- $(wildcard $(TOP)/src/mapi/glapi/gen/*.py)
+ $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
+ $(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
-glapi_gen_mapi_script := $(TOP)/src/mapi/mapi/mapi_abi.py
+glapi_gen_mapi_script := $(top_srcdir)/src/mapi/mapi/mapi_abi.py
glapi_gen_mapi_deps := \
$(glapi_gen_mapi_script) \
$(glapi_gen_common_deps)
@@ -21,7 +21,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \
--mode lib --printer $(2) $(1) > $@
endef
-glapi_gen_dispatch_script := $(TOP)/src/mapi/glapi/gen/gl_table.py
+glapi_gen_dispatch_script := $(top_srcdir)/src/mapi/glapi/gen/gl_table.py
glapi_gen_dispatch_deps := $(glapi_gen_common_deps)
# $(1): path to an XML file
@@ -32,7 +32,7 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \
-f $(1) -m remap_table $(if $(2),-c $(2),) > $@
endef
-glapi_gen_remap_script := $(TOP)/src/mapi/glapi/gen/remap_helper.py
+glapi_gen_remap_script := $(top_srcdir)/src/mapi/glapi/gen/remap_helper.py
glapi_gen_remap_deps := $(glapi_gen_common_deps)
# $(1): path to an XML file
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index bb70ed6ea..f1cd6d67c 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -42,8 +42,7 @@ main/git_sha1.h: main/git_sha1.h.tmp
fi
# include glapi_gen.mk for generating glapi headers for GLES
-TOP = $(top_srcdir)
-GLAPI = $(TOP)/src/mapi/glapi/gen
+GLAPI = $(top_srcdir)/src/mapi/glapi/gen
include $(GLAPI)/glapi_gen.mk
BUILT_SOURCES = \
@@ -78,24 +77,25 @@ main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_d
main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
- $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \
+ $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
-S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
- $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \
+ $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
-S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@
program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
- mkdir -p program
- $(YACC) -v -d --output=program/program_parse.tab.c $<
+ $(MKDIR_P) program
+ $(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
program/lex.yy.c: program/program_lexer.l
- mkdir -p program
- $(LEX) --never-interactive --outfile=$@ $<
+ $(MKDIR_P) program
+ $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
noinst_LTLIBRARIES = libmesa.la libmesagallium.la
SRCDIR = $(top_srcdir)/src/mesa/
+BUILDDIR = $(top_builddir)/src/mesa/
include sources.mak
AM_CPPFLAGS = $(API_DEFINES) $(DEFINES) $(INCLUDE_DIRS)
@@ -107,12 +107,21 @@ MESA_ASM_FILES_FOR_ARCH =
if HAVE_X86_ASM
MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += \
+ -I$(top_builddir)/src/mesa/x86 \
+ -I$(top_srcdir)/src/mesa/x86
endif
if HAVE_X86_64_ASM
MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
+AM_CPPFLAGS += \
+ -I$(top_builddir)/src/mesa/x86-64 \
+ -I$(top_srcdir)/src/mesa/x86-64
endif
if HAVE_SPARC_ASM
MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
+AM_CPPFLAGS += \
+ -I$(top_builddir)/src/mesa/sparc \
+ -I$(top_srcdir)/src/mesa/sparc
endif
libmesa_la_SOURCES = \
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index d36b1a3b8..ca01a3301 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -74,6 +74,8 @@
#include "program/program.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
+#include "main/enums.h"
+#include "main/glformats.h"
/** Return offset in bytes of the field within a vertex struct */
@@ -3158,8 +3160,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
* ReadPixels() and passed to Tex[Sub]Image().
*/
static GLenum
-get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
+get_temp_image_type(struct gl_context *ctx, gl_format format)
{
+ GLenum baseFormat, type;
+
+ baseFormat = _mesa_get_format_base_format(format);
+
switch (baseFormat) {
case GL_RGBA:
case GL_RGB:
@@ -3174,7 +3180,7 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
else if (ctx->DrawBuffer->Visual.redBits <= 16)
return GL_UNSIGNED_SHORT;
else
- return GL_FLOAT;
+ return _mesa_get_format_datatype(format);
case GL_DEPTH_COMPONENT:
return GL_UNSIGNED_INT;
case GL_DEPTH_STENCIL:
@@ -3216,12 +3222,10 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
format = GL_RGBA;
}
+ type = get_temp_image_type(ctx, texImage->TexFormat);
if (_mesa_is_format_integer_color(texImage->TexFormat)) {
- _mesa_problem(ctx, "unsupported integer color copyteximage");
- return;
+ format = _mesa_base_format_to_integer_format(format);
}
-
- type = get_temp_image_type(ctx, format);
bpp = _mesa_bytes_per_pixel(format, type);
if (bpp <= 0) {
_mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()");
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 91ae186fe..86409dd06 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -192,6 +192,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
mesa_api = API_OPENGLES2;
break;
case __DRI_API_OPENGL_CORE:
+ mesa_api = API_OPENGL_CORE;
+ break;
default:
*error = __DRI_CTX_ERROR_BAD_API;
return NULL;
@@ -218,6 +220,20 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
}
+ /* Mesa does not support the GL_ARB_compatibilty extension or the
+ * compatibility profile. This means that we treat a API_OPENGL 3.1 as
+ * API_OPENGL_CORE and reject API_OPENGL 3.2+.
+ */
+ if (mesa_api == API_OPENGL && major_version == 3 && minor_version == 1)
+ mesa_api = API_OPENGL_CORE;
+
+ if (mesa_api == API_OPENGL
+ && ((major_version > 3)
+ || (major_version == 3 && minor_version >= 2))) {
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return NULL;
+ }
+
/* The EGL_KHR_create_context spec says:
*
* "Flags are only defined for OpenGL context creation, and specifying
@@ -228,8 +244,8 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
* anything specific about this case. However, none of the known flags
* have any meaning in an ES context, so this seems safe.
*/
- if (mesa_api != __DRI_API_OPENGL
- && mesa_api != __DRI_API_OPENGL_CORE
+ if (mesa_api != API_OPENGL
+ && mesa_api != API_OPENGL_CORE
&& flags != 0) {
*error = __DRI_CTX_ERROR_BAD_FLAG;
return NULL;
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 61cbb6add..28177cbe0 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -724,11 +724,20 @@ dri_create_context(gl_api api,
*/
(void) flags;
- if (api == API_OPENGL
- && (major_version > 2
- || (major_version == 2 && minor_version > 1))) {
- *error = __DRI_CTX_ERROR_BAD_VERSION;
- goto context_fail;
+ switch (api) {
+ case API_OPENGL:
+ if (major_version > 2
+ || (major_version == 2 && minor_version > 1)) {
+ *error = __DRI_CTX_ERROR_BAD_VERSION;
+ return GL_FALSE;
+ }
+ break;
+ case API_OPENGLES:
+ case API_OPENGLES2:
+ break;
+ case API_OPENGL_CORE:
+ *error = __DRI_CTX_ERROR_BAD_API;
+ return GL_FALSE;
}
ctx = CALLOC_STRUCT(dri_context);
diff --git a/mesalib/src/mesa/main/api_exec.c b/mesalib/src/mesa/main/api_exec.c
index 81be46d5f..6b1499f4f 100644
--- a/mesalib/src/mesa/main/api_exec.c
+++ b/mesalib/src/mesa/main/api_exec.c
@@ -158,7 +158,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetError(exec, _mesa_GetError);
SET_GetFloatv(exec, _mesa_GetFloatv);
SET_GetString(exec, _mesa_GetString);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_LineStipple(exec, _mesa_LineStipple);
}
SET_LineWidth(exec, _mesa_LineWidth);
@@ -197,13 +197,13 @@ _mesa_create_exec_table(struct gl_context *ctx)
}
SET_Viewport(exec, _mesa_Viewport);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
_mesa_init_accum_dispatch(exec);
_mesa_init_dlist_dispatch(exec);
}
SET_ClearDepth(exec, _mesa_ClearDepth);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_ClearIndex(exec, _mesa_ClearIndex);
SET_ClipPlane(exec, _mesa_ClipPlane);
SET_ColorMaterial(exec, _mesa_ColorMaterial);
@@ -213,9 +213,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DepthRange(exec, _mesa_DepthRange);
_mesa_init_drawpix_dispatch(exec);
- _mesa_init_feedback_dispatch(exec);
+ if (ctx->API == API_OPENGL) {
+ _mesa_init_feedback_dispatch(exec);
+ }
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
SET_Fogf(exec, _mesa_Fogf);
SET_Fogfv(exec, _mesa_Fogfv);
@@ -241,7 +243,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
SET_GetTexImage(exec, _mesa_GetTexImage);
SET_Hint(exec, _mesa_Hint);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_IndexMask(exec, _mesa_IndexMask);
}
SET_IsEnabled(exec, _mesa_IsEnabled);
@@ -257,24 +259,22 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
}
- _mesa_init_eval_dispatch(exec);
-
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
+ _mesa_init_eval_dispatch(exec);
SET_MultMatrixd(exec, _mesa_MultMatrixd);
+ _mesa_init_pixel_dispatch(exec);
}
- _mesa_init_pixel_dispatch(exec);
-
SET_PixelStoref(exec, _mesa_PixelStoref);
SET_PointSize(exec, _mesa_PointSize);
SET_PolygonMode(exec, _mesa_PolygonMode);
SET_PolygonOffset(exec, _mesa_PolygonOffset);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_PolygonStipple(exec, _mesa_PolygonStipple);
- }
- _mesa_init_attrib_dispatch(exec);
- _mesa_init_rastpos_dispatch(exec);
+ _mesa_init_attrib_dispatch(exec);
+ _mesa_init_rastpos_dispatch(exec);
+ }
SET_ReadPixels(exec, _mesa_ReadPixels);
if (ctx->API != API_OPENGL_CORE) {
@@ -285,13 +285,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_TexEnviv(exec, _mesa_TexEnviv);
}
- _mesa_init_texgen_dispatch(exec);
+ if (ctx->API != API_OPENGL_CORE) {
+ _mesa_init_texgen_dispatch(exec);
+ }
SET_TexImage1D(exec, _mesa_TexImage1D);
SET_TexParameterf(exec, _mesa_TexParameterf);
SET_TexParameterfv(exec, _mesa_TexParameterfv);
SET_TexParameteriv(exec, _mesa_TexParameteriv);
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_Translated(exec, _mesa_Translated);
}
@@ -300,7 +302,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_DeleteTextures(exec, _mesa_DeleteTextures);
SET_GenTextures(exec, _mesa_GenTextures);
#if _HAVE_FULL_GL
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
SET_ColorPointer(exec, _mesa_ColorPointer);
}
@@ -341,9 +343,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_BlendEquation(exec, _mesa_BlendEquation);
SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
- _mesa_init_colortable_dispatch(exec);
- _mesa_init_convolve_dispatch(exec);
- _mesa_init_histogram_dispatch(exec);
+ if (ctx->API == API_OPENGL) {
+ _mesa_init_colortable_dispatch(exec);
+ _mesa_init_convolve_dispatch(exec);
+ _mesa_init_histogram_dispatch(exec);
+ }
/* OpenGL 2.0 */
SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
@@ -362,7 +366,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 3. GL_EXT_polygon_offset */
#if _HAVE_FULL_GL
- SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
+ if (ctx->API == API_OPENGL) {
+ SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
+ }
#endif
/* 6. GL_EXT_texture3d */
@@ -374,7 +380,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 11. GL_EXT_histogram */
#if 0
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_GetHistogramEXT(exec, _mesa_GetHistogram);
SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
@@ -397,7 +403,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 30. GL_EXT_vertex_array */
#if _HAVE_FULL_GL
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
@@ -424,8 +430,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 97. GL_EXT_compiled_vertex_array */
#if _HAVE_FULL_GL
- SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
- SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
+ if (ctx->API == API_OPENGL) {
+ SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
+ SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
+ }
#endif
/* 148. GL_EXT_multi_draw_arrays */
@@ -454,54 +462,61 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 233. GL_NV_vertex_program */
#if FEATURE_NV_vertex_program
- SET_BindProgramNV(exec, _mesa_BindProgram);
- SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
- SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
- SET_GenProgramsNV(exec, _mesa_GenPrograms);
- SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
- SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
- SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
- SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
- SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
- SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
- SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
- SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
- SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
- SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
- SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
- SET_IsProgramNV(exec, _mesa_IsProgramARB);
- SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
- SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
- SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
- SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
- SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
- SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
- SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
- SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
- SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
- /* glVertexAttrib*NV functions handled in api_loopback.c */
+ if (ctx->API == API_OPENGL) {
+ SET_BindProgramNV(exec, _mesa_BindProgram);
+ SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
+ SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
+ SET_GenProgramsNV(exec, _mesa_GenPrograms);
+ SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
+ SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
+ SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
+ SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
+ SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
+ SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
+ SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
+ SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
+ SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
+ SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
+ SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
+ SET_IsProgramNV(exec, _mesa_IsProgramARB);
+ SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
+ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
+ SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */
+ SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */
+ SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */
+ SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
+ SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
+ SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
+ SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
+ /* glVertexAttrib*NV functions handled in api_loopback.c */
+ }
#endif
/* 273. GL_APPLE_vertex_array_object */
- SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
+ if (ctx->API == API_OPENGL) {
+ SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
+ SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
+ }
+ /* Reused by ARB_vertex_array_object */
SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
- SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
/* 282. GL_NV_fragment_program */
#if FEATURE_NV_fragment_program
- SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
- SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
- SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
- SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
- SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
- SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
- SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
- SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+ if (ctx->API == API_OPENGL) {
+ SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
+ SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
+ SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
+ SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
+ SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
+ SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
+ SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
+ SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+ }
#endif
/* 262. GL_NV_point_sprite */
@@ -512,7 +527,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* 268. GL_EXT_stencil_two_side */
#if _HAVE_FULL_GL
- SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
+ if (ctx->API == API_OPENGL) {
+ SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
+ }
#endif
/* 285. GL_NV_primitive_restart */
@@ -536,7 +553,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* ARB 3. GL_ARB_transpose_matrix */
#if _HAVE_FULL_GL
- if (ctx->API != API_OPENGL_CORE) {
+ if (ctx->API == API_OPENGL) {
SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
@@ -617,24 +634,26 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
/* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
- SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
- SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
- SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
- SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
- SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
- SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
- SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
- SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
- SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
- SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
- SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
- SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+ if (ctx->API == API_OPENGL) {
+ SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
+ SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
+ SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
+ SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
+ SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
+ SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
+ SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
+ SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
+ SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
+ SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
+ SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
+ SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
+ SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
+ }
SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
- SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
#endif
/* ARB 28. GL_ARB_vertex_buffer_object */
- _mesa_init_bufferobj_dispatch(exec);
+ _mesa_init_bufferobj_dispatch(ctx, exec);
/* ARB 29. GL_ARB_occlusion_query */
_mesa_init_queryobj_dispatch(exec);
@@ -657,13 +676,17 @@ _mesa_create_exec_table(struct gl_context *ctx)
SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
/* GL_ATI_fragment_shader */
- _mesa_init_ati_fragment_shader_dispatch(exec);
+ if (ctx->API == API_OPENGL) {
+ _mesa_init_ati_fragment_shader_dispatch(exec);
+ }
/* GL_ATI_envmap_bumpmap */
- SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI);
- SET_GetTexBumpParameterfvATI(exec, _mesa_GetTexBumpParameterfvATI);
- SET_TexBumpParameterivATI(exec, _mesa_TexBumpParameterivATI);
- SET_TexBumpParameterfvATI(exec, _mesa_TexBumpParameterfvATI);
+ if (ctx->API == API_OPENGL) {
+ SET_GetTexBumpParameterivATI(exec, _mesa_GetTexBumpParameterivATI);
+ SET_GetTexBumpParameterfvATI(exec, _mesa_GetTexBumpParameterfvATI);
+ SET_TexBumpParameterivATI(exec, _mesa_TexBumpParameterivATI);
+ SET_TexBumpParameterfvATI(exec, _mesa_TexBumpParameterfvATI);
+ }
#if FEATURE_EXT_framebuffer_object
SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
@@ -691,8 +714,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
/* GL_EXT_gpu_program_parameters */
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
- SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
+ if (ctx->API == API_OPENGL) {
+ SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
+ SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
+ }
#endif
/* GL_MESA_texture_array / GL_EXT_texture_array */
@@ -701,7 +726,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
#endif
/* GL_ATI_separate_stencil */
- SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
+ if (ctx->API == API_OPENGL) {
+ SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
+ }
#if FEATURE_ARB_framebuffer_object
/* The ARB_fbo functions are the union of
@@ -800,6 +827,16 @@ _mesa_create_exec_table(struct gl_context *ctx)
_mesa_init_sampler_object_dispatch(exec);
#endif
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_InvalidateTexSubImage(exec, _mesa_InvalidateTexSubImage);
+ SET_InvalidateTexImage(exec, _mesa_InvalidateTexImage);
+ }
+
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_InvalidateSubFramebuffer(exec, _mesa_InvalidateSubFramebuffer);
+ SET_InvalidateFramebuffer(exec, _mesa_InvalidateFramebuffer);
+ }
+
return exec;
}
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 9cab35b0c..1a04eebdd 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -805,10 +805,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
samp->MaxAnisotropy);
}
- if (ctx->Extensions.ARB_shadow_ambient) {
- _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB,
- samp->CompareFailValue);
- }
if (ctx->Extensions.ARB_shadow) {
_mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE,
samp->CompareMode);
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 3bc0cd478..90f8b8bf2 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -2200,8 +2200,100 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
}
}
+static void GLAPIENTRY
+_mesa_InvalidateBufferSubData(GLuint buffer, GLintptr offset,
+ GLsizeiptr length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ const GLintptr end = offset + length;
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateBufferSubData(name = 0x%x) invalid object",
+ buffer);
+ return;
+ }
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "An INVALID_VALUE error is generated if <offset> or <length> is
+ * negative, or if <offset> + <length> is greater than the value of
+ * BUFFER_SIZE."
+ */
+ if (end < 0 || end > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateBufferSubData(invalid offset or length)");
+ return;
+ }
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "An INVALID_OPERATION error is generated if the buffer is currently
+ * mapped by MapBuffer, or if the invalidate range intersects the range
+ * currently mapped by MapBufferRange."
+ */
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ const GLintptr mapEnd = bufObj->Offset + bufObj->Length;
+
+ /* The regions do not overlap if and only if the end of the discard
+ * region is before the mapped region or the start of the discard region
+ * is after the mapped region.
+ *
+ * Note that 'end' and 'mapEnd' are the first byte *after* the discard
+ * region and the mapped region, repsectively. It is okay for that byte
+ * to be mapped (for 'end') or discarded (for 'mapEnd').
+ */
+ if (!(end <= bufObj->Offset || offset >= mapEnd)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glInvalidateBufferSubData(intersection with mapped "
+ "range)");
+ return;
+ }
+ }
+
+ /* We don't actually do anything for this yet. Just return after
+ * validating the parameters and generating the required errors.
+ */
+ return;
+}
+
+static void GLAPIENTRY
+_mesa_InvalidateBufferData(GLuint buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+
+ bufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateBufferData(name = 0x%x) invalid object",
+ buffer);
+ return;
+ }
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "An INVALID_OPERATION error is generated if the buffer is currently
+ * mapped by MapBuffer, or if the invalidate range intersects the range
+ * currently mapped by MapBufferRange."
+ */
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glInvalidateBufferData(intersection with mapped "
+ "range)");
+ return;
+ }
+
+ /* We don't actually do anything for this yet. Just return after
+ * validating the parameters and generating the required errors.
+ */
+ return;
+}
+
void
-_mesa_init_bufferobj_dispatch(struct _glapi_table *disp)
+_mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
{
SET_BindBufferARB(disp, _mesa_BindBufferARB);
SET_BufferDataARB(disp, _mesa_BufferDataARB);
@@ -2214,6 +2306,14 @@ _mesa_init_bufferobj_dispatch(struct _glapi_table *disp)
SET_IsBufferARB(disp, _mesa_IsBufferARB);
SET_MapBufferARB(disp, _mesa_MapBufferARB);
SET_UnmapBufferARB(disp, _mesa_UnmapBufferARB);
- SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
- SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+
+ if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+ SET_BindBufferRangeEXT(disp, _mesa_BindBufferRange);
+ SET_BindBufferBaseEXT(disp, _mesa_BindBufferBase);
+ }
+
+ if (_mesa_is_desktop_gl(ctx)) {
+ SET_InvalidateBufferData(disp, _mesa_InvalidateBufferData);
+ SET_InvalidateBufferSubData(disp, _mesa_InvalidateBufferSubData);
+ }
}
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index e1d0f7a97..15fdb9c30 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -167,6 +167,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
GLuint buffer, GLintptr offset, GLsizeiptr size);
extern void
-_mesa_init_bufferobj_dispatch(struct _glapi_table *disp);
+_mesa_init_bufferobj_dispatch(struct gl_context *ctx,
+ struct _glapi_table *disp);
#endif
diff --git a/mesalib/src/mesa/main/context.h b/mesalib/src/mesa/main/context.h
index 6b7dafa78..e2387521f 100644
--- a/mesalib/src/mesa/main/context.h
+++ b/mesalib/src/mesa/main/context.h
@@ -310,6 +310,16 @@ _mesa_is_gles(const struct gl_context *ctx)
}
+/**
+ * Checks if the context is for GLES 3.x
+ */
+static inline GLboolean
+_mesa_is_gles3(const struct gl_context *ctx)
+{
+ return ctx->API == API_OPENGLES2 && ctx->Version >= 30;
+}
+
+
#ifdef __cplusplus
}
#endif
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 5e13a9357..9e357cd09 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -88,28 +88,29 @@ static const struct extension extension_table[] = {
{ "GL_ARB_debug_output", o(dummy_true), GL, 2009 },
{ "GL_ARB_depth_buffer_float", o(ARB_depth_buffer_float), GL, 2008 },
{ "GL_ARB_depth_clamp", o(ARB_depth_clamp), GL, 2003 },
- { "GL_ARB_depth_texture", o(ARB_depth_texture), GL, 2001 },
+ { "GL_ARB_depth_texture", o(ARB_depth_texture), GLL, 2001 },
{ "GL_ARB_draw_buffers", o(dummy_true), GL, 2002 },
{ "GL_ARB_draw_buffers_blend", o(ARB_draw_buffers_blend), GL, 2009 },
{ "GL_ARB_draw_elements_base_vertex", o(ARB_draw_elements_base_vertex), GL, 2009 },
{ "GL_ARB_draw_instanced", o(ARB_draw_instanced), GL, 2008 },
{ "GL_ARB_explicit_attrib_location", o(ARB_explicit_attrib_location), GL, 2009 },
{ "GL_ARB_fragment_coord_conventions", o(ARB_fragment_coord_conventions), GL, 2009 },
- { "GL_ARB_fragment_program", o(ARB_fragment_program), GL, 2002 },
- { "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), GL, 2003 },
+ { "GL_ARB_fragment_program", o(ARB_fragment_program), GLL, 2002 },
+ { "GL_ARB_fragment_program_shadow", o(ARB_fragment_program_shadow), GLL, 2003 },
{ "GL_ARB_fragment_shader", o(ARB_fragment_shader), GL, 2002 },
{ "GL_ARB_framebuffer_object", o(ARB_framebuffer_object), GL, 2005 },
{ "GL_ARB_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },
{ "GL_ARB_half_float_pixel", o(ARB_half_float_pixel), GL, 2003 },
{ "GL_ARB_half_float_vertex", o(ARB_half_float_vertex), GL, 2008 },
{ "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 },
+ { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 },
{ "GL_ARB_map_buffer_range", o(ARB_map_buffer_range), GL, 2008 },
- { "GL_ARB_multisample", o(dummy_true), GL, 1994 },
- { "GL_ARB_multitexture", o(dummy_true), GL, 1998 },
+ { "GL_ARB_multisample", o(dummy_true), GLL, 1994 },
+ { "GL_ARB_multitexture", o(dummy_true), GLL, 1998 },
{ "GL_ARB_occlusion_query2", o(ARB_occlusion_query2), GL, 2003 },
- { "GL_ARB_occlusion_query", o(ARB_occlusion_query), GL, 2001 },
+ { "GL_ARB_occlusion_query", o(ARB_occlusion_query), GLL, 2001 },
{ "GL_ARB_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 },
- { "GL_ARB_point_parameters", o(EXT_point_parameters), GL, 1997 },
+ { "GL_ARB_point_parameters", o(EXT_point_parameters), GLL, 1997 },
{ "GL_ARB_point_sprite", o(ARB_point_sprite), GL, 2003 },
{ "GL_ARB_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 },
{ "GL_ARB_robustness", o(dummy_true), GL, 2010 },
@@ -119,21 +120,20 @@ static const struct extension extension_table[] = {
{ "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 },
{ "GL_ARB_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
{ "GL_ARB_shader_texture_lod", o(ARB_shader_texture_lod), GL, 2009 },
- { "GL_ARB_shading_language_100", o(ARB_shading_language_100), GL, 2003 },
- { "GL_ARB_shadow_ambient", o(ARB_shadow_ambient), GL, 2001 },
- { "GL_ARB_shadow", o(ARB_shadow), GL, 2001 },
+ { "GL_ARB_shading_language_100", o(ARB_shading_language_100), GLL, 2003 },
+ { "GL_ARB_shadow", o(ARB_shadow), GLL, 2001 },
{ "GL_ARB_sync", o(ARB_sync), GL, 2003 },
- { "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), GL, 2000 },
+ { "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 2000 },
{ "GL_ARB_texture_buffer_object", o(ARB_texture_buffer_object), GL, 2008 },
- { "GL_ARB_texture_compression", o(dummy_true), GL, 2000 },
+ { "GL_ARB_texture_compression", o(dummy_true), GLL, 2000 },
{ "GL_ARB_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 },
- { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GL, 1999 },
- { "GL_ARB_texture_env_add", o(dummy_true), GL, 1999 },
- { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GL, 2001 },
- { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GL, 2001 },
- { "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), GL, 2001 },
+ { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GLL, 1999 },
+ { "GL_ARB_texture_env_add", o(dummy_true), GLL, 1999 },
+ { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GLL, 2001 },
+ { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GLL, 2001 },
+ { "GL_ARB_texture_env_dot3", o(ARB_texture_env_dot3), GLL, 2001 },
{ "GL_ARB_texture_float", o(ARB_texture_float), GL, 2004 },
- { "GL_ARB_texture_mirrored_repeat", o(dummy_true), GL, 2001 },
+ { "GL_ARB_texture_mirrored_repeat", o(dummy_true), GLL, 2001 },
{ "GL_ARB_texture_multisample", o(ARB_texture_multisample), GL, 2009 },
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), GL, 2003 },
{ "GL_ARB_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
@@ -145,74 +145,74 @@ static const struct extension extension_table[] = {
{ "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), GL, 2010 },
{ "GL_ARB_transform_feedback3", o(ARB_transform_feedback3), GL, 2010 },
{ "GL_ARB_transform_feedback_instanced", o(ARB_transform_feedback_instanced), GL, 2011 },
- { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GL, 1999 },
+ { "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), GLL, 1999 },
{ "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), GL, 2009 },
{ "GL_ARB_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 },
{ "GL_ARB_vertex_array_object", o(ARB_vertex_array_object), GL, 2006 },
- { "GL_ARB_vertex_buffer_object", o(dummy_true), GL, 2003 },
- { "GL_ARB_vertex_program", o(ARB_vertex_program), GL, 2002 },
+ { "GL_ARB_vertex_buffer_object", o(dummy_true), GLL, 2003 },
+ { "GL_ARB_vertex_program", o(ARB_vertex_program), GLL, 2002 },
{ "GL_ARB_vertex_shader", o(ARB_vertex_shader), GL, 2002 },
{ "GL_ARB_vertex_type_2_10_10_10_rev", o(ARB_vertex_type_2_10_10_10_rev), GL, 2009 },
- { "GL_ARB_window_pos", o(ARB_window_pos), GL, 2001 },
+ { "GL_ARB_window_pos", o(ARB_window_pos), GLL, 2001 },
/* EXT extensions */
{ "GL_EXT_abgr", o(dummy_true), GL, 1995 },
- { "GL_EXT_bgra", o(dummy_true), GL, 1995 },
- { "GL_EXT_blend_color", o(EXT_blend_color), GL, 1995 },
+ { "GL_EXT_bgra", o(dummy_true), GLL, 1995 },
+ { "GL_EXT_blend_color", o(EXT_blend_color), GLL, 1995 },
{ "GL_EXT_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
- { "GL_EXT_blend_func_separate", o(EXT_blend_func_separate), GL, 1999 },
- { "GL_EXT_blend_minmax", o(EXT_blend_minmax), GL | ES1 | ES2, 1995 },
- { "GL_EXT_blend_subtract", o(dummy_true), GL, 1995 },
+ { "GL_EXT_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 },
+ { "GL_EXT_blend_minmax", o(EXT_blend_minmax), GLL | ES1 | ES2, 1995 },
+ { "GL_EXT_blend_subtract", o(dummy_true), GLL, 1995 },
{ "GL_EXT_clip_volume_hint", o(EXT_clip_volume_hint), GL, 1996 },
- { "GL_EXT_compiled_vertex_array", o(EXT_compiled_vertex_array), GL, 1996 },
- { "GL_EXT_copy_texture", o(dummy_true), GL, 1995 },
+ { "GL_EXT_compiled_vertex_array", o(EXT_compiled_vertex_array), GLL, 1996 },
+ { "GL_EXT_copy_texture", o(dummy_true), GLL, 1995 },
{ "GL_EXT_depth_bounds_test", o(EXT_depth_bounds_test), GL, 2002 },
{ "GL_EXT_draw_buffers2", o(EXT_draw_buffers2), GL, 2006 },
{ "GL_EXT_draw_instanced", o(ARB_draw_instanced), GL, 2006 },
- { "GL_EXT_draw_range_elements", o(EXT_draw_range_elements), GL, 1997 },
- { "GL_EXT_fog_coord", o(EXT_fog_coord), GL, 1999 },
+ { "GL_EXT_draw_range_elements", o(EXT_draw_range_elements), GLL, 1997 },
+ { "GL_EXT_fog_coord", o(EXT_fog_coord), GLL, 1999 },
{ "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 },
{ "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 },
{ "GL_EXT_framebuffer_object", o(EXT_framebuffer_object), GL, 2000 },
{ "GL_EXT_framebuffer_sRGB", o(EXT_framebuffer_sRGB), GL, 1998 },
- { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GL, 2006 },
+ { "GL_EXT_gpu_program_parameters", o(EXT_gpu_program_parameters), GLL, 2006 },
{ "GL_EXT_gpu_shader4", o(EXT_gpu_shader4), GL, 2006 },
- { "GL_EXT_multi_draw_arrays", o(dummy_true), GL | ES1 | ES2, 1999 },
+ { "GL_EXT_multi_draw_arrays", o(dummy_true), GLL | ES1 | ES2, 1999 },
{ "GL_EXT_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2005 },
{ "GL_EXT_packed_float", o(EXT_packed_float), GL, 2004 },
- { "GL_EXT_packed_pixels", o(EXT_packed_pixels), GL, 1997 },
+ { "GL_EXT_packed_pixels", o(EXT_packed_pixels), GLL, 1997 },
{ "GL_EXT_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 },
- { "GL_EXT_point_parameters", o(EXT_point_parameters), GL, 1997 },
- { "GL_EXT_polygon_offset", o(dummy_true), GL, 1995 },
+ { "GL_EXT_point_parameters", o(EXT_point_parameters), GLL, 1997 },
+ { "GL_EXT_polygon_offset", o(dummy_true), GLL, 1995 },
{ "GL_EXT_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 },
- { "GL_EXT_rescale_normal", o(EXT_rescale_normal), GL, 1997 },
- { "GL_EXT_secondary_color", o(EXT_secondary_color), GL, 1999 },
- { "GL_EXT_separate_shader_objects", o(EXT_separate_shader_objects), GL, 2008 },
- { "GL_EXT_separate_specular_color", o(EXT_separate_specular_color), GL, 1997 },
- { "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), GL, 2002 },
- { "GL_EXT_stencil_two_side", o(EXT_stencil_two_side), GL, 2001 },
- { "GL_EXT_stencil_wrap", o(dummy_true), GL, 2002 },
- { "GL_EXT_subtexture", o(dummy_true), GL, 1995 },
- { "GL_EXT_texture3D", o(EXT_texture3D), GL, 1996 },
+ { "GL_EXT_rescale_normal", o(EXT_rescale_normal), GLL, 1997 },
+ { "GL_EXT_secondary_color", o(EXT_secondary_color), GLL, 1999 },
+ { "GL_EXT_separate_shader_objects", o(EXT_separate_shader_objects), GLL, 2008 },
+ { "GL_EXT_separate_specular_color", o(EXT_separate_specular_color), GLL, 1997 },
+ { "GL_EXT_shadow_funcs", o(EXT_shadow_funcs), GLL, 2002 },
+ { "GL_EXT_stencil_two_side", o(EXT_stencil_two_side), GLL, 2001 },
+ { "GL_EXT_stencil_wrap", o(dummy_true), GLL, 2002 },
+ { "GL_EXT_subtexture", o(dummy_true), GLL, 1995 },
+ { "GL_EXT_texture3D", o(EXT_texture3D), GLL, 1996 },
{ "GL_EXT_texture_array", o(EXT_texture_array), GL, 2006 },
{ "GL_EXT_texture_compression_dxt1", o(EXT_texture_compression_s3tc), GL | ES1 | ES2, 2004 },
{ "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), GL, 2006 },
{ "GL_EXT_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 },
{ "GL_EXT_texture_compression_s3tc", o(EXT_texture_compression_s3tc), GL, 2000 },
- { "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GL, 2001 },
- { "GL_EXT_texture_edge_clamp", o(dummy_true), GL, 1997 },
- { "GL_EXT_texture_env_add", o(dummy_true), GL, 1999 },
- { "GL_EXT_texture_env_combine", o(dummy_true), GL, 2000 },
- { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GL, 2000 },
+ { "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), GLL, 2001 },
+ { "GL_EXT_texture_edge_clamp", o(dummy_true), GLL, 1997 },
+ { "GL_EXT_texture_env_add", o(dummy_true), GLL, 1999 },
+ { "GL_EXT_texture_env_combine", o(dummy_true), GLL, 2000 },
+ { "GL_EXT_texture_env_dot3", o(EXT_texture_env_dot3), GLL, 2000 },
{ "GL_EXT_texture_filter_anisotropic", o(EXT_texture_filter_anisotropic), GL | ES1 | ES2, 1999 },
{ "GL_EXT_texture_format_BGRA8888", o(dummy_true), ES1 | ES2, 2005 },
{ "GL_EXT_texture_rg", o(ARB_texture_rg), ES2, 2011 },
{ "GL_EXT_read_format_bgra", o(dummy_true), ES1 | ES2, 2009 },
{ "GL_EXT_texture_integer", o(EXT_texture_integer), GL, 2006 },
- { "GL_EXT_texture_lod_bias", o(dummy_true), GL | ES1, 1999 },
+ { "GL_EXT_texture_lod_bias", o(dummy_true), GLL | ES1, 1999 },
{ "GL_EXT_texture_mirror_clamp", o(EXT_texture_mirror_clamp), GL, 2004 },
- { "GL_EXT_texture_object", o(dummy_true), GL, 1995 },
- { "GL_EXT_texture", o(dummy_true), GL, 1996 },
- { "GL_EXT_texture_rectangle", o(NV_texture_rectangle), GL, 2004 },
+ { "GL_EXT_texture_object", o(dummy_true), GLL, 1995 },
+ { "GL_EXT_texture", o(dummy_true), GLL, 1996 },
+ { "GL_EXT_texture_rectangle", o(NV_texture_rectangle), GLL, 2004 },
{ "GL_EXT_texture_shared_exponent", o(EXT_texture_shared_exponent), GL, 2004 },
{ "GL_EXT_texture_snorm", o(EXT_texture_snorm), GL, 2009 },
{ "GL_EXT_texture_sRGB", o(EXT_texture_sRGB), GL, 2004 },
@@ -223,7 +223,7 @@ static const struct extension extension_table[] = {
{ "GL_EXT_transform_feedback", o(EXT_transform_feedback), GL, 2011 },
{ "GL_EXT_unpack_subimage", o(dummy_true), ES2, 2011 },
{ "GL_EXT_vertex_array_bgra", o(EXT_vertex_array_bgra), GL, 2008 },
- { "GL_EXT_vertex_array", o(dummy_true), GL, 1995 },
+ { "GL_EXT_vertex_array", o(dummy_true), GLL, 1995 },
/* OES extensions */
{ "GL_OES_blend_equation_separate", o(EXT_blend_equation_separate), ES1, 2009 },
@@ -274,52 +274,52 @@ static const struct extension extension_table[] = {
{ "GL_AMD_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2009 },
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
{ "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 },
- { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GL, 2002 },
- { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GL, 2002 },
+ { "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GLL, 2002 },
+ { "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GLL, 2002 },
{ "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
- { "GL_ATI_draw_buffers", o(dummy_true), GL, 2002 },
- { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GL, 2001 },
- { "GL_ATI_fragment_shader", o(ATI_fragment_shader), GL, 2001 },
- { "GL_ATI_separate_stencil", o(ATI_separate_stencil), GL, 2006 },
+ { "GL_ATI_draw_buffers", o(dummy_true), GLL, 2002 },
+ { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GLL, 2001 },
+ { "GL_ATI_fragment_shader", o(ATI_fragment_shader), GLL, 2001 },
+ { "GL_ATI_separate_stencil", o(ATI_separate_stencil), GLL, 2006 },
{ "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL, 2004 },
- { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GL, 2002 },
+ { "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), GLL, 2002 },
{ "GL_ATI_texture_float", o(ARB_texture_float), GL, 2002 },
{ "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), GL, 2006 },
{ "GL_IBM_multimode_draw_arrays", o(IBM_multimode_draw_arrays), GL, 1998 },
{ "GL_IBM_rasterpos_clip", o(IBM_rasterpos_clip), GL, 1996 },
- { "GL_IBM_texture_mirrored_repeat", o(dummy_true), GL, 1998 },
- { "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GL, 1999 },
+ { "GL_IBM_texture_mirrored_repeat", o(dummy_true), GLL, 1998 },
+ { "GL_INGR_blend_func_separate", o(EXT_blend_func_separate), GLL, 1999 },
{ "GL_MESA_pack_invert", o(MESA_pack_invert), GL, 2002 },
{ "GL_MESA_resize_buffers", o(MESA_resize_buffers), GL, 1999 },
- { "GL_MESA_texture_array", o(MESA_texture_array), GL, 2007 },
+ { "GL_MESA_texture_array", o(MESA_texture_array), GLL, 2007 },
{ "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), GL, 2009 },
- { "GL_MESA_window_pos", o(ARB_window_pos), GL, 2000 },
+ { "GL_MESA_window_pos", o(ARB_window_pos), GLL, 2000 },
{ "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), GL, 2002 },
- { "GL_NV_blend_square", o(NV_blend_square), GL, 1999 },
+ { "GL_NV_blend_square", o(NV_blend_square), GLL, 1999 },
{ "GL_NV_conditional_render", o(NV_conditional_render), GL, 2008 },
{ "GL_NV_depth_clamp", o(ARB_depth_clamp), GL, 2001 },
{ "GL_NV_draw_buffers", o(dummy_true), ES2, 2011 },
{ "GL_NV_fbo_color_attachments", o(EXT_framebuffer_object), ES2, 2010 },
- { "GL_NV_fog_distance", o(NV_fog_distance), GL, 2001 },
- { "GL_NV_fragment_program", o(NV_fragment_program), GL, 2001 },
- { "GL_NV_fragment_program_option", o(NV_fragment_program_option), GL, 2005 },
- { "GL_NV_light_max_exponent", o(NV_light_max_exponent), GL, 1999 },
+ { "GL_NV_fog_distance", o(NV_fog_distance), GLL, 2001 },
+ { "GL_NV_fragment_program", o(NV_fragment_program), GLL, 2001 },
+ { "GL_NV_fragment_program_option", o(NV_fragment_program_option), GLL, 2005 },
+ { "GL_NV_light_max_exponent", o(NV_light_max_exponent), GLL, 1999 },
{ "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), GL, 2000 },
{ "GL_NV_point_sprite", o(NV_point_sprite), GL, 2001 },
{ "GL_NV_primitive_restart", o(NV_primitive_restart), GL, 2002 },
{ "GL_NV_read_buffer", o(dummy_true), ES2, 2011 },
- { "GL_NV_texgen_reflection", o(NV_texgen_reflection), GL, 1999 },
+ { "GL_NV_texgen_reflection", o(NV_texgen_reflection), GLL, 1999 },
{ "GL_NV_texture_barrier", o(NV_texture_barrier), GL, 2009 },
- { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GL, 1999 },
- { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GL, 2000 },
- { "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), GL, 2001 },
- { "GL_NV_vertex_program", o(NV_vertex_program), GL, 2000 },
+ { "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), GLL, 1999 },
+ { "GL_NV_texture_rectangle", o(NV_texture_rectangle), GLL, 2000 },
+ { "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), GLL, 2001 },
+ { "GL_NV_vertex_program", o(NV_vertex_program), GLL, 2000 },
{ "GL_S3_s3tc", o(S3_s3tc), GL, 1999 },
- { "GL_SGIS_generate_mipmap", o(dummy_true), GL, 1997 },
- { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GL, 1997 },
- { "GL_SGIS_texture_edge_clamp", o(dummy_true), GL, 1997 },
- { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GL, 1997 },
- { "GL_SUN_multi_draw_arrays", o(dummy_true), GL, 1999 },
+ { "GL_SGIS_generate_mipmap", o(dummy_true), GLL, 1997 },
+ { "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), GLL, 1997 },
+ { "GL_SGIS_texture_edge_clamp", o(dummy_true), GLL, 1997 },
+ { "GL_SGIS_texture_lod", o(SGIS_texture_lod), GLL, 1997 },
+ { "GL_SUN_multi_draw_arrays", o(dummy_true), GLL, 1999 },
{ 0, 0, 0, 0 },
};
@@ -427,7 +427,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
#endif
ctx->Extensions.ARB_shadow = GL_TRUE;
- ctx->Extensions.ARB_shadow_ambient = GL_TRUE;
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index d558d7f87..aa8ba1882 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -685,6 +685,9 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
assert(_mesa_is_user_fbo(fb));
+ /* we're changing framebuffer fields here */
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
numImages = 0;
fb->Width = 0;
fb->Height = 0;
@@ -3006,3 +3009,144 @@ _mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment,
"not implemented!");
}
#endif /* FEATURE_ARB_geometry_shader4 */
+
+static void
+invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments, GLint x, GLint y,
+ GLsizei width, GLsizei height, const char *name)
+{
+ int i;
+ struct gl_framebuffer *fb;
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ fb = get_framebuffer_target(ctx, target);
+ if (!fb) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", name);
+ return;
+ }
+
+ if (numAttachments < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(numAttachments < 0)", name);
+ return;
+ }
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "If an attachment is specified that does not exist in the
+ * framebuffer bound to <target>, it is ignored."
+ *
+ * It also says:
+ *
+ * "If <attachments> contains COLOR_ATTACHMENTm and m is greater than
+ * or equal to the value of MAX_COLOR_ATTACHMENTS, then the error
+ * INVALID_OPERATION is generated."
+ *
+ * No mention is made of GL_AUXi being out of range. Therefore, we allow
+ * any enum that can be allowed by the API (OpenGL ES 3.0 has a different
+ * set of retrictions).
+ */
+ for (i = 0; i < numAttachments; i++) {
+ if (_mesa_is_winsys_fbo(fb)) {
+ switch (attachments[i]) {
+ case GL_ACCUM:
+ case GL_AUX0:
+ case GL_AUX1:
+ case GL_AUX2:
+ case GL_AUX3:
+ /* Accumulation buffers and auxilary buffers were removed in
+ * OpenGL 3.1, and they never existed in OpenGL ES.
+ */
+ if (ctx->API != API_OPENGL)
+ goto invalid_enum;
+ break;
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ break;
+ case GL_BACK_LEFT:
+ case GL_BACK_RIGHT:
+ case GL_FRONT_LEFT:
+ case GL_FRONT_RIGHT:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_enum;
+ break;
+ default:
+ goto invalid_enum;
+ }
+ } else {
+ switch (attachments[i]) {
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ break;
+ case GL_COLOR_ATTACHMENT0:
+ case GL_COLOR_ATTACHMENT1:
+ case GL_COLOR_ATTACHMENT2:
+ case GL_COLOR_ATTACHMENT3:
+ case GL_COLOR_ATTACHMENT4:
+ case GL_COLOR_ATTACHMENT5:
+ case GL_COLOR_ATTACHMENT6:
+ case GL_COLOR_ATTACHMENT7:
+ case GL_COLOR_ATTACHMENT8:
+ case GL_COLOR_ATTACHMENT9:
+ case GL_COLOR_ATTACHMENT10:
+ case GL_COLOR_ATTACHMENT11:
+ case GL_COLOR_ATTACHMENT12:
+ case GL_COLOR_ATTACHMENT13:
+ case GL_COLOR_ATTACHMENT14:
+ case GL_COLOR_ATTACHMENT15: {
+ const int k = attachments[i] - GL_COLOR_ATTACHMENT0;
+ if (k >= ctx->Const.MaxColorAttachments) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(attachment >= max. color attachments)", name);
+ return;
+ }
+ }
+ default:
+ goto invalid_enum;
+ }
+ }
+ }
+
+ /* We don't actually do anything for this yet. Just return after
+ * validating the parameters and generating the required errors.
+ */
+ return;
+
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(attachment)", name);
+ return;
+}
+
+void GLAPIENTRY
+_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments, GLint x, GLint y,
+ GLsizei width, GLsizei height)
+{
+ invalidate_framebuffer_storage(target, numAttachments, attachments,
+ x, y, width, height,
+ "glInvalidateSubFramebuffer");
+}
+
+void GLAPIENTRY
+_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "The command
+ *
+ * void InvalidateFramebuffer(enum target,
+ * sizei numAttachments,
+ * const enum *attachments);
+ *
+ * is equivalent to the command InvalidateSubFramebuffer with <x>, <y>,
+ * <width>, <height> equal to 0, 0, <MAX_VIEWPORT_DIMS[0]>,
+ * <MAX_VIEWPORT_DIMS[1]> respectively."
+ */
+ invalidate_framebuffer_storage(target, numAttachments, attachments,
+ 0, 0, MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT,
+ "glInvalidateFramebuffer");
+}
diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h
index 3aee842f5..9cded3cfa 100644
--- a/mesalib/src/mesa/main/fbobject.h
+++ b/mesalib/src/mesa/main/fbobject.h
@@ -214,4 +214,13 @@ _mesa_FramebufferTextureFaceARB(GLenum target, GLenum attachment,
GLuint texture, GLint level, GLenum face);
+extern void GLAPIENTRY
+_mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments, GLint x, GLint y,
+ GLsizei width, GLsizei height);
+
+extern void GLAPIENTRY
+_mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments);
+
#endif /* FBOBJECT_H */
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 529c416a8..bd218520f 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -1604,6 +1604,11 @@ get_unpack_rgba_function(gl_format format)
initialized = GL_TRUE;
}
+ if (table[format] == NULL) {
+ _mesa_problem(NULL, "unsupported unpack for format %s",
+ _mesa_get_format_name(format));
+ }
+
return table[format];
}
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 8fcb6b456..552c1cf69 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1250,7 +1250,6 @@ struct gl_sampler_object
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLenum CompareMode; /**< GL_ARB_shadow */
GLenum CompareFunc; /**< GL_ARB_shadow */
- GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */
GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
};
@@ -2972,7 +2971,6 @@ struct gl_extensions
GLboolean ARB_shader_texture_lod;
GLboolean ARB_shading_language_100;
GLboolean ARB_shadow;
- GLboolean ARB_shadow_ambient;
GLboolean ARB_sync;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_buffer_object;
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 83192c157..7aebd45ea 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -462,8 +462,7 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
}
}
-/* Customization of integer packing. We always treat src as uint, and can pack dst
- * as any integer type/format combo.
+/* Customization of unsigned integer packing.
*/
#define SRC_TYPE GLuint
@@ -475,6 +474,14 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
#undef SRC_CONVERT
#undef FN_NAME
+#define DST_TYPE GLint
+#define SRC_CONVERT(x) MIN2(x, 0x7fffffff)
+#define FN_NAME pack_int_from_uint_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
#define DST_TYPE GLushort
#define SRC_CONVERT(x) MIN2(x, 0xffff)
#define FN_NAME pack_ushort_from_uint_rgba
@@ -507,18 +514,32 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
#undef SRC_CONVERT
#undef FN_NAME
+#undef SRC_TYPE
+
+static void
+_pack_rgba_span_from_uints_problem(struct gl_context *ctx,
+ GLenum dstFormat, GLenum dstType)
+{
+ _mesa_problem(ctx,
+ "Unsupported type (%s) / format (%s) "
+ "in _mesa_pack_rgba_span_from_uints",
+ _mesa_lookup_enum_by_nr(dstType),
+ _mesa_lookup_enum_by_nr(dstFormat));
+}
+
void
-_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr)
+_mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr)
{
+ GLuint i;
+
switch(dstType) {
case GL_UNSIGNED_INT:
pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
break;
case GL_INT:
- /* No conversion necessary. */
- pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ pack_int_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
break;
case GL_UNSIGNED_SHORT:
pack_ushort_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
@@ -532,11 +553,691 @@ _mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
case GL_BYTE:
pack_byte_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) << 5)
+ | (CLAMP(rgba[i][GCOMP], 0, 7) << 2)
+ | (CLAMP(rgba[i][BCOMP], 0, 3) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) )
+ | (CLAMP(rgba[i][GCOMP], 0, 7) << 3)
+ | (CLAMP(rgba[i][BCOMP], 0, 3) << 6);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 63) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 63) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 11);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) )
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) << 12);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) )
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) << 12);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) )
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 12);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][RCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][RCOMP], 0, 1) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) << 15);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][RCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) << 15);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) )
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][RCOMP], 0, 1) << 15);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) )
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) << 24);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) )
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) << 24);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) )
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 24);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_10_10_10_2:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][RCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][RCOMP], 0, 3) );
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) )
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) << 30);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) )
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][RCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) << 30);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) )
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][RCOMP], 0, 3) << 30);
+ }
+ } else {
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ default:
+ _pack_rgba_span_from_uints_problem(ctx, dstFormat, dstType);
+ return;
+ }
+}
+
+
+/* Customization of signed integer packing.
+ */
+#define SRC_TYPE GLint
+
+#define DST_TYPE GLuint
+#define SRC_CONVERT(x) MAX2(x, 0)
+#define FN_NAME pack_uint_from_int_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLushort
+#define SRC_CONVERT(x) MAX2(x, 0)
+#define FN_NAME pack_ushort_from_int_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLshort
+#define SRC_CONVERT(x) CLAMP(x, -0x8000, 0x7fff)
+#define FN_NAME pack_short_from_int_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLubyte
+#define SRC_CONVERT(x) MAX2(x, 0)
+#define FN_NAME pack_ubyte_from_int_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#define DST_TYPE GLbyte
+#define SRC_CONVERT(x) CLAMP(x, -0x80, 0x7f)
+#define FN_NAME pack_byte_from_int_rgba
+#include "pack_tmp.h"
+#undef DST_TYPE
+#undef SRC_CONVERT
+#undef FN_NAME
+
+#undef SRC_TYPE
+
+static void
+_pack_rgba_span_from_ints_problem(struct gl_context *ctx,
+ GLenum dstFormat, GLenum dstType)
+{
+ _mesa_problem(ctx,
+ "Unsupported type (%s) / format (%s) "
+ "in _mesa_pack_rgba_span_from_ints",
+ _mesa_lookup_enum_by_nr(dstType),
+ _mesa_lookup_enum_by_nr(dstFormat));
+}
+
+void
+_mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr)
+{
+ GLuint i;
+
+ switch(dstType) {
+ case GL_UNSIGNED_INT:
+ pack_uint_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_INT:
+ /* No conversion necessary. */
+ pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_UNSIGNED_SHORT:
+ pack_ushort_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_SHORT:
+ pack_short_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_UNSIGNED_BYTE:
+ pack_ubyte_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_BYTE:
+ pack_byte_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n);
+ break;
+ case GL_UNSIGNED_BYTE_3_3_2:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) << 5)
+ | (CLAMP(rgba[i][GCOMP], 0, 7) << 2)
+ | (CLAMP(rgba[i][BCOMP], 0, 3) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_BYTE_2_3_3_REV:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLubyte *dst = (GLubyte *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 7) )
+ | (CLAMP(rgba[i][GCOMP], 0, 7) << 3)
+ | (CLAMP(rgba[i][BCOMP], 0, 3) << 6);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 63) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5_REV:
+ if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 63) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 11);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) << 12)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_4_4_4_4_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 15) )
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) << 12);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 15) )
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 15) << 12);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 15) )
+ | (CLAMP(rgba[i][BCOMP], 0, 15) << 4)
+ | (CLAMP(rgba[i][GCOMP], 0, 15) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 15) << 12);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][RCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) << 11)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 6)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 1)
+ | (CLAMP(rgba[i][RCOMP], 0, 1) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) << 15);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 31) )
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][RCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][ACOMP], 0, 1) << 15);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLushort *dst = (GLushort *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 31) )
+ | (CLAMP(rgba[i][BCOMP], 0, 31) << 5)
+ | (CLAMP(rgba[i][GCOMP], 0, 31) << 10)
+ | (CLAMP(rgba[i][RCOMP], 0, 1) << 15);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) << 24)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_8_8_8_8_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 255) )
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) << 24);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 255) )
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][ACOMP], 0, 255) << 24);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 255) )
+ | (CLAMP(rgba[i][BCOMP], 0, 255) << 8)
+ | (CLAMP(rgba[i][GCOMP], 0, 255) << 16)
+ | (CLAMP(rgba[i][RCOMP], 0, 255) << 24);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_10_10_10_2:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) );
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][RCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) );
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) << 22)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 12)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 2)
+ | (CLAMP(rgba[i][RCOMP], 0, 3) );
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if ((dstFormat == GL_RGBA) || (dstFormat == GL_RGBA_INTEGER_EXT)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][RCOMP], 0, 1023) )
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) << 30);
+ }
+ }
+ else if ((dstFormat == GL_BGRA) || (dstFormat == GL_BGRA_INTEGER)) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][BCOMP], 0, 1023) )
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][RCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][ACOMP], 0, 3) << 30);
+ }
+ }
+ else if (dstFormat == GL_ABGR_EXT) {
+ GLuint *dst = (GLuint *) dstAddr;
+ for (i=0;i<n;i++) {
+ dst[i] = (CLAMP(rgba[i][ACOMP], 0, 1023) )
+ | (CLAMP(rgba[i][BCOMP], 0, 1023) << 10)
+ | (CLAMP(rgba[i][GCOMP], 0, 1023) << 20)
+ | (CLAMP(rgba[i][RCOMP], 0, 3) << 30);
+ }
+ } else {
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
+ }
+ break;
default:
- _mesa_problem(ctx,
- "Unsupported type (%s) for format (%s)",
- _mesa_lookup_enum_by_nr(dstType),
- _mesa_lookup_enum_by_nr(dstFormat));
+ _pack_rgba_span_from_ints_problem(ctx, dstFormat, dstType);
return;
}
}
@@ -4913,7 +5614,7 @@ _mesa_unpack_depth_span( struct gl_context *ctx, GLuint n,
else {
/* need to use double precision to prevent overflow problems */
for (i = 0; i < n; i++) {
- GLdouble z = depthValues[i] * (GLfloat) depthMax;
+ GLdouble z = depthValues[i] * (GLdouble) depthMax;
if (z >= (GLdouble) 0xffffffff)
zValues[i] = 0xffffffff;
else
diff --git a/mesalib/src/mesa/main/pack.h b/mesalib/src/mesa/main/pack.h
index cd49c7495..2fbdf9115 100644
--- a/mesalib/src/mesa/main/pack.h
+++ b/mesalib/src/mesa/main/pack.h
@@ -145,9 +145,15 @@ _mesa_unpack_image(GLuint dimensions,
void
-_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
- GLenum dstFormat, GLenum dstType,
- GLvoid *dstAddr);
+_mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr);
+
+
+void
+_mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr);
extern void
diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c
index 7ac877497..f0bc157d8 100644
--- a/mesalib/src/mesa/main/readpix.c
+++ b/mesalib/src/mesa/main/readpix.c
@@ -322,6 +322,8 @@ slow_read_rgba_pixels( struct gl_context *ctx,
void *rgba;
GLubyte *dst, *map;
int dstStride, stride, j;
+ GLboolean dst_is_integer = _mesa_is_enum_format_integer(format);
+ GLboolean dst_is_uint = _mesa_is_format_unsigned(rbFormat);
dstStride = _mesa_image_row_stride(packing, width, format, type);
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
@@ -339,12 +341,17 @@ slow_read_rgba_pixels( struct gl_context *ctx,
goto done;
for (j = 0; j < height; j++) {
- if (_mesa_is_enum_format_integer(format)) {
+ if (dst_is_integer) {
_mesa_unpack_uint_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba);
_mesa_rebase_rgba_uint(width, (GLuint (*)[4]) rgba,
rb->_BaseFormat);
- _mesa_pack_rgba_span_int(ctx, width, (GLuint (*)[4]) rgba, format,
- type, dst);
+ if (dst_is_uint) {
+ _mesa_pack_rgba_span_from_uints(ctx, width, (GLuint (*)[4]) rgba, format,
+ type, dst);
+ } else {
+ _mesa_pack_rgba_span_from_ints(ctx, width, (GLint (*)[4]) rgba, format,
+ type, dst);
+ }
} else {
_mesa_unpack_rgba_row(rbFormat, width, map, (GLfloat (*)[4]) rgba);
_mesa_rebase_rgba_float(width, (GLfloat (*)[4]) rgba,
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index dc8adfc3f..8bf5f490a 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -130,7 +130,6 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
sampObj->MaxAnisotropy = 1.0F;
sampObj->CompareMode = GL_NONE;
sampObj->CompareFunc = GL_LEQUAL;
- sampObj->CompareFailValue = 0.0;
sampObj->sRGBDecode = GL_DECODE_EXT;
sampObj->CubeMapSeamless = GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 0ba3ff5b3..4cd87c645 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -306,7 +306,8 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
GLuint img, row;
GLfloat (*rgba)[4];
GLuint (*rgba_uint)[4];
- GLboolean is_integer = _mesa_is_format_integer_color(texImage->TexFormat);
+ GLboolean tex_is_integer = _mesa_is_format_integer_color(texImage->TexFormat);
+ GLboolean tex_is_uint = _mesa_is_format_unsigned(texImage->TexFormat);
/* Allocate buffer for one row of texels */
rgba = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
@@ -358,12 +359,19 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
width, height, format, type,
img, row, 0);
- if (is_integer) {
+ if (tex_is_integer) {
_mesa_unpack_uint_rgba_row(texFormat, width, src, rgba_uint);
if (rebaseFormat)
_mesa_rebase_rgba_uint(width, rgba_uint, rebaseFormat);
- _mesa_pack_rgba_span_int(ctx, width, rgba_uint,
- format, type, dest);
+ if (tex_is_uint) {
+ _mesa_pack_rgba_span_from_uints(ctx, width,
+ (GLuint (*)[4]) rgba_uint,
+ format, type, dest);
+ } else {
+ _mesa_pack_rgba_span_from_ints(ctx, width,
+ (GLint (*)[4]) rgba_uint,
+ format, type, dest);
+ }
} else {
_mesa_unpack_rgba_row(texFormat, width, src, rgba);
if (rebaseFormat)
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index f70da4fbc..1d905b608 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -144,7 +144,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Sampler.MaxAnisotropy = 1.0;
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
- obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */
obj->DepthMode = GL_LUMINANCE;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
@@ -257,7 +256,6 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->Sampler.MaxAnisotropy = src->Sampler.MaxAnisotropy;
dest->Sampler.CompareMode = src->Sampler.CompareMode;
dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
- dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
dest->DepthMode = src->DepthMode;
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
@@ -879,7 +877,58 @@ _mesa_total_texture_memory(struct gl_context *ctx)
return total;
}
+static struct gl_texture_object *
+invalidate_tex_image_error_check(struct gl_context *ctx, GLuint texture,
+ GLint level, const char *name)
+{
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "If <texture> is zero or is not the name of a texture, the error
+ * INVALID_VALUE is generated."
+ *
+ * This performs the error check in a different order than listed in the
+ * spec. We have to get the texture object before we can validate the
+ * other parameters against values in the texture object.
+ */
+ struct gl_texture_object *const t = _mesa_lookup_texture(ctx, texture);
+ if (texture == 0 || t == NULL) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", name);
+ return NULL;
+ }
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "If <level> is less than zero or greater than the base 2 logarithm
+ * of the maximum texture width, height, or depth, the error
+ * INVALID_VALUE is generated."
+ */
+ if (level < 0 || level > t->MaxLevel) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(level)", name);
+ return NULL;
+ }
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "If the target of <texture> is TEXTURE_RECTANGLE, TEXTURE_BUFFER,
+ * TEXTURE_2D_MULTISAMPLE, or TEXTURE_2D_MULTISAMPLE_ARRAY, and <level>
+ * is not zero, the error INVALID_VALUE is generated."
+ */
+ if (level != 0) {
+ switch (t->Target) {
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_BUFFER:
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(level)", name);
+ return NULL;
+
+ default:
+ break;
+ }
+ }
+
+ return t;
+}
/*@}*/
@@ -1348,4 +1397,164 @@ _mesa_unlock_context_textures( struct gl_context *ctx )
_glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
}
+void GLAPIENTRY
+_mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ struct gl_texture_object *t;
+ struct gl_texture_image *image;
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ t = invalidate_tex_image_error_check(ctx, texture, level,
+ "glInvalidateTexSubImage");
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "...the specified subregion must be between -<b> and <dim>+<b> where
+ * <dim> is the size of the dimension of the texture image, and <b> is
+ * the size of the border of that texture image, otherwise
+ * INVALID_VALUE is generated (border is not applied to dimensions that
+ * don't exist in a given texture target)."
+ */
+ image = t->Image[0][level];
+ if (image) {
+ int xBorder;
+ int yBorder;
+ int zBorder;
+ int imageWidth;
+ int imageHeight;
+ int imageDepth;
+
+ /* The GL_ARB_invalidate_subdata spec says:
+ *
+ * "For texture targets that don't have certain dimensions, this
+ * command treats those dimensions as having a size of 1. For
+ * example, to invalidate a portion of a two-dimensional texture,
+ * the application would use <zoffset> equal to zero and <depth>
+ * equal to one."
+ */
+ switch (t->Target) {
+ case GL_TEXTURE_BUFFER:
+ xBorder = 0;
+ yBorder = 0;
+ zBorder = 0;
+ imageWidth = 1;
+ imageHeight = 1;
+ imageDepth = 1;
+ break;
+ case GL_TEXTURE_1D:
+ xBorder = image->Border;
+ yBorder = 0;
+ zBorder = 0;
+ imageWidth = image->Width;
+ imageHeight = 1;
+ imageDepth = 1;
+ break;
+ case GL_TEXTURE_1D_ARRAY:
+ xBorder = image->Border;
+ yBorder = 0;
+ zBorder = 0;
+ imageWidth = image->Width;
+ imageHeight = image->Height;
+ imageDepth = 1;
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_2D_MULTISAMPLE:
+ xBorder = image->Border;
+ yBorder = image->Border;
+ zBorder = 0;
+ imageWidth = image->Width;
+ imageHeight = image->Height;
+ imageDepth = 1;
+ break;
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ xBorder = image->Border;
+ yBorder = image->Border;
+ zBorder = 0;
+ imageWidth = image->Width;
+ imageHeight = image->Height;
+ imageDepth = image->Depth;
+ break;
+ case GL_TEXTURE_3D:
+ xBorder = image->Border;
+ yBorder = image->Border;
+ zBorder = image->Border;
+ imageWidth = image->Width;
+ imageHeight = image->Height;
+ imageDepth = image->Depth;
+ break;
+ default:
+ assert(!"Should not get here.");
+ xBorder = 0;
+ yBorder = 0;
+ zBorder = 0;
+ imageWidth = 0;
+ imageHeight = 0;
+ imageDepth = 0;
+ break;
+ }
+
+ if (xoffset < -xBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glInvalidateSubTexImage(xoffset)");
+ return;
+ }
+
+ if (xoffset + width > imageWidth + xBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateSubTexImage(xoffset+width)");
+ return;
+ }
+
+ if (yoffset < -yBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glInvalidateSubTexImage(yoffset)");
+ return;
+ }
+
+ if (yoffset + height > imageHeight + yBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateSubTexImage(yoffset+height)");
+ return;
+ }
+
+ if (zoffset < -zBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateSubTexImage(zoffset)");
+ return;
+ }
+
+ if (zoffset + depth > imageDepth + zBorder) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glInvalidateSubTexImage(zoffset+depth)");
+ return;
+ }
+ }
+
+ /* We don't actually do anything for this yet. Just return after
+ * validating the parameters and generating the required errors.
+ */
+ return;
+}
+
+void GLAPIENTRY
+_mesa_InvalidateTexImage(GLuint texture, GLint level)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ invalidate_tex_image_error_check(ctx, texture, level,
+ "glInvalidateTexImage");
+
+ /* We don't actually do anything for this yet. Just return after
+ * validating the parameters and generating the required errors.
+ */
+ return;
+}
+
/*@}*/
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index 23e1ade09..93e0d7738 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -152,6 +152,14 @@ _mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
extern GLboolean GLAPIENTRY
_mesa_IsTexture( GLuint texture );
+extern void GLAPIENTRY
+_mesa_InvalidateTexSubImage(GLuint texture, GLint level, GLint xoffset,
+ GLint yoffset, GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth);
+
+extern void GLAPIENTRY
+_mesa_InvalidateTexImage(GLuint texture, GLint level);
+
/*@}*/
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 9e7c3e457..690fd6c25 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -541,20 +541,6 @@ set_tex_parameterf(struct gl_context *ctx,
}
return GL_FALSE;
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (ctx->Extensions.ARB_shadow_ambient) {
- if (texObj->Sampler.CompareFailValue != params[0]) {
- flush(ctx);
- texObj->Sampler.CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
- return GL_TRUE;
- }
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
- }
- return GL_FALSE;
-
case GL_TEXTURE_LOD_BIAS:
/* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
if (texObj->Sampler.LodBias != params[0]) {
@@ -1136,11 +1122,6 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
goto invalid_pname;
*params = obj->Sampler.MaxAnisotropy;
break;
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (!ctx->Extensions.ARB_shadow_ambient)
- goto invalid_pname;
- *params = obj->Sampler.CompareFailValue;
- break;
case GL_GENERATE_MIPMAP_SGIS:
*params = (GLfloat) obj->GenerateMipmap;
break;
@@ -1282,11 +1263,6 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
goto invalid_pname;
*params = (GLint) obj->Sampler.MaxAnisotropy;
break;
- case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
- if (!ctx->Extensions.ARB_shadow_ambient)
- goto invalid_pname;
- *params = (GLint) FLOAT_TO_INT(obj->Sampler.CompareFailValue);
- break;
case GL_GENERATE_MIPMAP_SGIS:
*params = (GLint) obj->GenerateMipmap;
break;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 544c08d73..18429f581 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -3200,6 +3200,7 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS)
srcPacking);
const GLuint *src = tempImage;
GLint img, row;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3207,8 +3208,14 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLbyte *dstTexel = (GLbyte *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = (GLbyte) src[i];
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLbyte) MIN2(src[i], 0x7f);
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLbyte) CLAMP((GLint) src[i], -0x80, 0x7f);
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3270,6 +3277,7 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS)
srcPacking);
const GLuint *src = tempImage;
GLint img, row;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3277,8 +3285,14 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLshort *dstTexel = (GLshort *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = (GLint) src[i];
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLshort) MIN2(src[i], 0x7fff);
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLshort)CLAMP((GLint) src[i], -0x8000, 0x7fff);
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3340,6 +3354,7 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS)
srcPacking);
const GLuint *src = tempImage;
GLint img, row;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3347,8 +3362,14 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLint *dstTexel = (GLint *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = (GLint) src[i];
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLint) MIN2(src[i], 0x7fffffff);
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLint) src[i];
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3407,6 +3428,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS)
srcFormat, srcType, srcAddr, srcPacking);
const GLuint *src = tempImage;
GLint img, row;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3414,8 +3436,14 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLubyte *dstTexel = (GLubyte *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = (GLubyte) CLAMP(src[i], 0, 0xff);
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLubyte) MIN2(src[i], 0xff);
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLubyte) CLAMP((GLint) src[i], 0, 0xff);
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3474,6 +3502,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS)
srcFormat, srcType, srcAddr, srcPacking);
const GLuint *src = tempImage;
GLint img, row;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3481,8 +3510,14 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLushort *dstTexel = (GLushort *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = (GLushort) CLAMP(src[i], 0, 0xffff);
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLushort) MIN2(src[i], 0xffff);
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = (GLushort) CLAMP((GLint) src[i], 0, 0xffff);
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3540,6 +3575,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS)
srcWidth, srcHeight, srcDepth,
srcFormat, srcType, srcAddr, srcPacking);
const GLuint *src = tempImage;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
GLint img, row;
if (!tempImage)
return GL_FALSE;
@@ -3548,8 +3584,14 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLuint *dstTexel = (GLuint *) dstRow;
GLint i;
- for (i = 0; i < srcWidth * components; i++) {
- dstTexel[i] = src[i];
+ if (is_unsigned) {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = src[i];
+ }
+ } else {
+ for (i = 0; i < srcWidth * components; i++) {
+ dstTexel[i] = MAX2((GLint) src[i], 0);
+ }
}
dstRow += dstRowStride;
src += srcWidth * components;
@@ -3867,6 +3909,7 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS)
srcPacking);
const GLuint *src = tempImage;
GLint img, row, col;
+ GLboolean is_unsigned = _mesa_is_type_unsigned(srcType);
if (!tempImage)
return GL_FALSE;
for (img = 0; img < srcDepth; img++) {
@@ -3874,14 +3917,26 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS)
for (row = 0; row < srcHeight; row++) {
GLuint *dstUI = (GLuint *) dstRow;
- for (col = 0; col < srcWidth; col++) {
- GLushort a,r,g,b;
- r = src[RCOMP];
- g = src[GCOMP];
- b = src[BCOMP];
- a = src[ACOMP];
- dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b);
- src += 4;
+ if (is_unsigned) {
+ for (col = 0; col < srcWidth; col++) {
+ GLushort a,r,g,b;
+ r = MIN2(src[RCOMP], 0x3ff);
+ g = MIN2(src[GCOMP], 0x3ff);
+ b = MIN2(src[BCOMP], 0x3ff);
+ a = MIN2(src[ACOMP], 0x003);
+ dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b);
+ src += 4;
+ }
+ } else {
+ for (col = 0; col < srcWidth; col++) {
+ GLushort a,r,g,b;
+ r = CLAMP((GLint) src[RCOMP], 0, 0x3ff);
+ g = CLAMP((GLint) src[GCOMP], 0, 0x3ff);
+ b = CLAMP((GLint) src[BCOMP], 0, 0x3ff);
+ a = CLAMP((GLint) src[ACOMP], 0, 0x003);
+ dstUI[col] = (a << 30) | (r << 20) | (g << 10) | (b);
+ src += 4;
+ }
}
dstRow += dstRowStride;
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 91212218e..f9c6677b1 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -551,22 +551,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
value[3] = ctx->Pixel.AlphaBias;
return;
- case STATE_SHADOW_AMBIENT:
- {
- const int unit = (int) state[2];
- const struct gl_texture_object *texObj
- = ctx->Texture.Unit[unit]._Current;
- const struct gl_sampler_object *samp =
- _mesa_get_samplerobj(ctx, unit);
- if (texObj) {
- value[0] =
- value[1] =
- value[2] =
- value[3] = samp->CompareFailValue;
- }
- }
- return;
-
case STATE_FB_SIZE:
value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1);
value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
@@ -702,7 +686,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
return _NEW_MODELVIEW;
case STATE_TEXRECT_SCALE:
- case STATE_SHADOW_AMBIENT:
case STATE_ROT_MATRIX_0:
case STATE_ROT_MATRIX_1:
return _NEW_TEXTURE;
@@ -918,9 +901,6 @@ append_token(char *dst, gl_state_index k)
case STATE_PT_BIAS:
append(dst, "PTbias");
break;
- case STATE_SHADOW_AMBIENT:
- append(dst, "CompareFailValue");
- break;
case STATE_FB_SIZE:
append(dst, "FbSize");
break;
diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h
index 65baa7833..efd0e030c 100644
--- a/mesalib/src/mesa/program/prog_statevars.h
+++ b/mesalib/src/mesa/program/prog_statevars.h
@@ -124,7 +124,6 @@ typedef enum gl_state_index_ {
STATE_LIGHT_HALF_VECTOR, /* object vs eye space */
STATE_PT_SCALE, /**< Pixel transfer RGBA scale */
STATE_PT_BIAS, /**< Pixel transfer RGBA bias */
- STATE_SHADOW_AMBIENT, /**< ARB_shadow_ambient fail value; token[2] is texture unit index */
STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index ce248dea1..30e2219b0 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -5,8 +5,8 @@
# this is part of MAIN_FILES
MAIN_ES_FILES = \
- $(SRCDIR)main/api_exec_es1.c \
- $(SRCDIR)main/api_exec_es2.c
+ $(BUILDDIR)main/api_exec_es1.c \
+ $(BUILDDIR)main/api_exec_es2.c
MAIN_FILES = \
$(SRCDIR)main/api_arrayelt.c \
@@ -35,7 +35,6 @@ MAIN_FILES = \
$(SRCDIR)main/drawpix.c \
$(SRCDIR)main/drawtex.c \
$(SRCDIR)main/enable.c \
- $(SRCDIR)main/enums.c \
$(SRCDIR)main/errors.c \
$(SRCDIR)main/eval.c \
$(SRCDIR)main/execmem.c \
@@ -107,6 +106,7 @@ MAIN_FILES = \
$(SRCDIR)main/version.c \
$(SRCDIR)main/viewport.c \
$(SRCDIR)main/vtxfmt.c \
+ $(BUILDDIR)main/enums.c \
$(MAIN_ES_FILES)
MAIN_CXX_FILES = \
@@ -251,11 +251,9 @@ STATETRACKER_FILES = \
PROGRAM_FILES = \
$(SRCDIR)program/arbprogparse.c \
$(SRCDIR)program/hash_table.c \
- $(SRCDIR)program/lex.yy.c \
$(SRCDIR)program/nvfragparse.c \
$(SRCDIR)program/nvvertparse.c \
$(SRCDIR)program/program.c \
- $(SRCDIR)program/program_parse.tab.c \
$(SRCDIR)program/program_parse_extra.c \
$(SRCDIR)program/prog_cache.c \
$(SRCDIR)program/prog_execute.c \
@@ -269,7 +267,9 @@ PROGRAM_FILES = \
$(SRCDIR)program/prog_statevars.c \
$(SRCDIR)program/programopt.c \
$(SRCDIR)program/register_allocate.c \
- $(SRCDIR)program/symbol_table.c
+ $(SRCDIR)program/symbol_table.c \
+ $(BUILDDIR)program/lex.yy.c \
+ $(BUILDDIR)program/program_parse.tab.c
SHADER_CXX_FILES = \
@@ -372,18 +372,18 @@ MESA_GALLIUM_OBJECTS = \
COMMON_DRIVER_OBJECTS = $(COMMON_DRIVER_FILES:.c=.o)
-### Other archives/libraries
-
-GLSL_LIBS = \
- $(TOP)/src/glsl/libglsl.a
-
-
### Include directories
INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/glsl \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mapi \
- -I$(TOP)/src/gallium/include \
- -I$(TOP)/src/gallium/auxiliary
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/glsl \
+ -I$(top_builddir)/src/glsl \
+ -I$(top_srcdir)/src/glsl/glcpp \
+ -I$(top_srcdir)/src/mesa \
+ -I$(top_builddir)/src/mesa \
+ -I$(top_srcdir)/src/mesa/main \
+ -I$(top_builddir)/src/mesa/main \
+ -I$(top_srcdir)/src/mapi \
+ -I$(top_builddir)/src/mapi \
+ -I$(top_srcdir)/src/gallium/include \
+ -I$(top_srcdir)/src/gallium/auxiliary
diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
index 204f505a6..d9e9d21f6 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -239,7 +239,8 @@ static void update_raster_state( struct st_context *st )
/* _NEW_FRAG_CLAMP */
raster->clamp_fragment_color = !st->clamp_frag_color_in_shader &&
- ctx->Color._ClampFragmentColor;
+ ctx->Color._ClampFragmentColor &&
+ !ctx->DrawBuffer->_IntegerColor;
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 ae3491097..45e7a117f 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_shader.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_shader.c
@@ -85,7 +85,8 @@ update_fp( struct st_context *st )
/* _NEW_FRAG_CLAMP */
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor;
+ st->ctx->Color._ClampFragmentColor &&
+ !st->ctx->DrawBuffer->_IntegerColor;
st->fp_variant = st_get_fp_variant(st, stfp, &key);
@@ -106,7 +107,7 @@ update_fp( struct st_context *st )
const struct st_tracked_state st_update_fp = {
"st_update_fp", /* name */
{ /* dirty */
- 0, /* mesa */
+ _NEW_BUFFERS, /* mesa */
ST_NEW_FRAGMENT_PROGRAM /* st */
},
update_fp /* update */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index 3c17bd6c3..7d9ccc1e5 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -424,7 +424,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
key.st = st;
key.bitmap = GL_TRUE;
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor;
+ st->ctx->Color._ClampFragmentColor &&
+ !st->ctx->DrawBuffer->_IntegerColor;
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 88068ac60..9f1b427a9 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -697,7 +697,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 = !st->clamp_frag_color_in_shader &&
- ctx->Color._ClampFragmentColor;
+ ctx->Color._ClampFragmentColor &&
+ !ctx->DrawBuffer->_IntegerColor;
rasterizer.gl_rasterization_rules = 1;
rasterizer.depth_clip = !ctx->Transform.DepthClamp;
rasterizer.scissor = ctx->Scissor.Enabled;
@@ -1026,7 +1027,8 @@ get_color_fp_variant(struct st_context *st)
ctx->Pixel.AlphaScale != 1.0);
key.pixelMaps = ctx->Pixel.MapColorFlag;
key.clamp_color = st->clamp_frag_color_in_shader &&
- st->ctx->Color._ClampFragmentColor;
+ st->ctx->Color._ClampFragmentColor &&
+ !st->ctx->DrawBuffer->_IntegerColor;
fpv = st_get_fp_variant(st, st->fp, &key);
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index 51c899208..3c2aae913 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -3345,34 +3345,33 @@ sample_lambda_1d_array(struct gl_context *ctx,
/**
- * Compare texcoord against depth sample. Return 1.0 or the ambient value.
+ * Compare texcoord against depth sample. Return 1.0 or 0.0 value.
*/
static inline GLfloat
-shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample,
- GLfloat ambient)
+shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample)
{
switch (function) {
case GL_LEQUAL:
- return (coord <= depthSample) ? 1.0F : ambient;
+ return (coord <= depthSample) ? 1.0F : 0.0F;
case GL_GEQUAL:
- return (coord >= depthSample) ? 1.0F : ambient;
+ return (coord >= depthSample) ? 1.0F : 0.0F;
case GL_LESS:
- return (coord < depthSample) ? 1.0F : ambient;
+ return (coord < depthSample) ? 1.0F : 0.0F;
case GL_GREATER:
- return (coord > depthSample) ? 1.0F : ambient;
+ return (coord > depthSample) ? 1.0F : 0.0F;
case GL_EQUAL:
- return (coord == depthSample) ? 1.0F : ambient;
+ return (coord == depthSample) ? 1.0F : 0.0F;
case GL_NOTEQUAL:
- return (coord != depthSample) ? 1.0F : ambient;
+ return (coord != depthSample) ? 1.0F : 0.0F;
case GL_ALWAYS:
return 1.0F;
case GL_NEVER:
- return ambient;
+ return 0.0F;
case GL_NONE:
return depthSample;
default:
_mesa_problem(NULL, "Bad compare func in shadow_compare");
- return ambient;
+ return 0.0F;
}
}
@@ -3384,9 +3383,9 @@ static inline GLfloat
shadow_compare4(GLenum function, GLfloat coord,
GLfloat depth00, GLfloat depth01,
GLfloat depth10, GLfloat depth11,
- GLfloat ambient, GLfloat wi, GLfloat wj)
+ GLfloat wi, GLfloat wj)
{
- const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F;
+ const GLfloat d = 0.25F;
GLfloat luminance = 1.0F;
switch (function) {
@@ -3429,13 +3428,13 @@ shadow_compare4(GLenum function, GLfloat coord,
case GL_ALWAYS:
return 1.0F;
case GL_NEVER:
- return ambient;
+ return 0.0F;
case GL_NONE:
/* ordinary bilinear filtering */
return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
default:
_mesa_problem(NULL, "Bad compare func in sample_compare4");
- return ambient;
+ return 0.0F;
}
}
@@ -3483,7 +3482,6 @@ sample_depth_texture( struct gl_context *ctx,
const GLint depth = img->Depth;
const GLuint compare_coord = (tObj->Target == GL_TEXTURE_2D_ARRAY_EXT)
? 3 : 2;
- GLfloat ambient;
GLenum function;
GLfloat result;
@@ -3497,8 +3495,6 @@ sample_depth_texture( struct gl_context *ctx,
tObj->Target == GL_TEXTURE_2D_ARRAY_EXT ||
tObj->Target == GL_TEXTURE_CUBE_MAP);
- ambient = samp->CompareFailValue;
-
/* XXXX if samp->MinFilter != samp->MagFilter, we're ignoring lambda */
function = (samp->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) ?
@@ -3522,7 +3518,7 @@ sample_depth_texture( struct gl_context *ctx,
depthRef = CLAMP(texcoords[i][compare_coord], 0.0F, 1.0F);
- result = shadow_compare(function, depthRef, depthSample, ambient);
+ result = shadow_compare(function, depthRef, depthSample);
switch (tObj->DepthMode) {
case GL_LUMINANCE:
@@ -3617,7 +3613,7 @@ sample_depth_texture( struct gl_context *ctx,
result = shadow_compare4(function, depthRef,
depth00, depth01, depth10, depth11,
- ambient, wi, wj);
+ wi, wj);
switch (tObj->DepthMode) {
case GL_LUMINANCE:
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index cdca10250..f603aeee5 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -380,6 +380,15 @@ main(int argc, char *argv[], char *envp[])
CloseDownEvents();
+ for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
+ ScreenPtr pScreen = screenInfo.gpuscreens[i];
+ FreeScratchPixmapsForScreen(pScreen);
+ (*pScreen->CloseScreen) (pScreen);
+ dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
+ free(pScreen);
+ screenInfo.numGPUScreens = i;
+ }
+
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
FreeScratchPixmapsForScreen(screenInfo.screens[i]);
FreeGCperDepth(i);
@@ -391,15 +400,6 @@ main(int argc, char *argv[], char *envp[])
screenInfo.numScreens = i;
}
- for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
- ScreenPtr pScreen = screenInfo.gpuscreens[i];
- FreeScratchPixmapsForScreen(pScreen);
- (*pScreen->CloseScreen) (pScreen);
- dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
- free(pScreen);
- screenInfo.numGPUScreens = i;
- }
-
ReleaseClientIds(serverClient);
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);
serverClient->devPrivates = NULL;
diff --git a/xorg-server/fb/fbseg.c b/xorg-server/fb/fbseg.c
index 0e4e0a9f7..1848387f6 100644
--- a/xorg-server/fb/fbseg.c
+++ b/xorg-server/fb/fbseg.c
@@ -65,6 +65,12 @@ fbBresSolid(DrawablePtr pDrawable,
if (axis == X_AXIS) {
bits = 0;
while (len--) {
+ if (e >= 0) {
+ WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+ bits = 0;
+ dst += dstStride;
+ e += e3;
+ }
bits |= mask;
mask = fbBresShiftMask(mask, signdx, dstBpp);
if (!mask) {
@@ -74,21 +80,12 @@ fbBresSolid(DrawablePtr pDrawable,
mask = mask0;
}
e += e1;
- if (e >= 0) {
- WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
- bits = 0;
- dst += dstStride;
- e += e3;
- }
}
if (bits)
WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, bits));
}
else {
while (len--) {
- WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
- dst += dstStride;
- e += e1;
if (e >= 0) {
e += e3;
mask = fbBresShiftMask(mask, signdx, dstBpp);
@@ -97,6 +94,9 @@ fbBresSolid(DrawablePtr pDrawable,
mask = mask0;
}
}
+ WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, mask));
+ dst += dstStride;
+ e += e1;
}
}
diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c
index 4ed3f9c59..2d9178121 100644
--- a/xorg-server/glx/glxscreens.c
+++ b/xorg-server/glx/glxscreens.c
@@ -292,6 +292,9 @@ pickFBConfig(__GLXscreen * pGlxScreen, VisualPtr visual)
continue;
if (config->visualRating != GLX_NONE)
continue;
+ /* Ignore multisampled configs */
+ if (config->sampleBuffers)
+ continue;
if (glxConvertToXVisualType(config->visualType) != visual->class)
continue;
/* If it's the 32-bit RGBA visual, demand a 32-bit fbconfig. */
diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c
index 154f684c4..1947c5be9 100644
--- a/xorg-server/hw/xfree86/modes/xf86Crtc.c
+++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c
@@ -726,6 +726,12 @@ xf86CrtcCloseScreen(ScreenPtr screen)
xf86RotateCloseScreen(screen);
+ xf86RandR12CloseScreen(screen);
+
+ free(config->name);
+
+ screen->CloseScreen(screen);
+
for (o = 0; o < config->num_output; o++) {
xf86OutputPtr output = config->output[o];
@@ -749,10 +755,7 @@ xf86CrtcCloseScreen(ScreenPtr screen)
else if (screen->current_master)
DetachUnboundGPU(screen);
}
- xf86RandR12CloseScreen(screen);
-
- free(config->name);
- return screen->CloseScreen(screen);
+ return TRUE;
}
/*
diff --git a/xorg-server/hw/xquartz/quartz.c b/xorg-server/hw/xquartz/quartz.c
index d74fc6446..31b0e619a 100644
--- a/xorg-server/hw/xquartz/quartz.c
+++ b/xorg-server/hw/xquartz/quartz.c
@@ -43,6 +43,7 @@
#include "darwinEvents.h"
#include "pseudoramiX.h"
#include "extension.h"
+#include "glx_extinit.h"
#define _APPLEWM_SERVER_
#include "applewmExt.h"
diff --git a/xorg-server/render/filter.c b/xorg-server/render/filter.c
index 8c401ee5d..019ea7f94 100644
--- a/xorg-server/render/filter.c
+++ b/xorg-server/render/filter.c
@@ -273,7 +273,10 @@ PictureResetFilters(ScreenPtr pScreen)
free(ps->filters);
free(ps->filterAliases);
- PictureFreeFilterIds();
+
+ /* Free the filters when the last screen is closed */
+ if (pScreen->myNum == 0)
+ PictureFreeFilterIds();
}
int