aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
commiteaa70945cb3f1a432b8c505ecede9ebc7769f36d (patch)
tree8e44ff4da739e384a2c6a34c1b42ecfb8e212344 /mesalib/src/mesa/state_tracker
parent474621addc25cb22865c54b70ffbec07c82eb04c (diff)
downloadvcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.gz
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.bz2
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.zip
libX11 libxcb mesa xserver mkfontscale git update 13 feb 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom.c410
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c19
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_blit.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c4
6 files changed, 238 insertions, 225 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c
index 95010d1b2..d9cd4aab4 100644
--- a/mesalib/src/mesa/state_tracker/st_atom.c
+++ b/mesalib/src/mesa/state_tracker/st_atom.c
@@ -1,205 +1,205 @@
-/**************************************************************************
- *
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/glheader.h"
-#include "main/context.h"
-
-#include "pipe/p_defines.h"
-#include "st_context.h"
-#include "st_atom.h"
-#include "st_cb_bitmap.h"
-#include "st_program.h"
-#include "st_manager.h"
-
-
-/**
- * This is used to initialize st->atoms[].
- */
-static const struct st_tracked_state *atoms[] =
-{
- &st_update_depth_stencil_alpha,
- &st_update_clip,
-
- &st_finalize_textures,
- &st_update_fp,
- &st_update_gp,
- &st_update_vp,
-
- &st_update_rasterizer,
- &st_update_polygon_stipple,
- &st_update_viewport,
- &st_update_scissor,
- &st_update_blend,
- &st_update_sampler,
- &st_update_vertex_texture,
- &st_update_texture,
- &st_update_framebuffer,
- &st_update_msaa,
- &st_update_vs_constants,
- &st_update_gs_constants,
- &st_update_fs_constants,
- &st_update_pixel_transfer
-};
-
-
-void st_init_atoms( struct st_context *st )
-{
- /* no-op */
-}
-
-
-void st_destroy_atoms( struct st_context *st )
-{
- /* no-op */
-}
-
-
-/***********************************************************************
- */
-
-static GLboolean check_state( const struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- return ((a->mesa & b->mesa) ||
- (a->st & b->st));
-}
-
-static void accumulate_state( struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- a->mesa |= b->mesa;
- a->st |= b->st;
-}
-
-
-static void xor_states( struct st_state_flags *result,
- const struct st_state_flags *a,
- const struct st_state_flags *b )
-{
- result->mesa = a->mesa ^ b->mesa;
- result->st = a->st ^ b->st;
-}
-
-
-/* Too complex to figure out, just check every time:
- */
-static void check_program_state( struct st_context *st )
-{
- struct gl_context *ctx = st->ctx;
-
- if (ctx->VertexProgram._Current != &st->vp->Base)
- st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
-
- if (ctx->FragmentProgram._Current != &st->fp->Base)
- st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
-
- if (ctx->GeometryProgram._Current != &st->gp->Base)
- st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
-}
-
-
-/***********************************************************************
- * Update all derived state:
- */
-
-void st_validate_state( struct st_context *st )
-{
- struct st_state_flags *state = &st->dirty;
- GLuint i;
-
- /* The bitmap cache is immune to pixel unpack changes.
- * Note that GLUT makes several calls to glPixelStore for each
- * bitmap char it draws so this is an important check.
- */
- if (state->mesa & ~_NEW_PACKUNPACK)
- st_flush_bitmap_cache(st);
-
- check_program_state( st );
-
- st_manager_validate_framebuffers(st);
-
- if (state->st == 0)
- return;
-
- /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
-
-#ifdef NDEBUG
- if (0) {
-#else
- if (1) {
-#endif
- /* Debug version which enforces various sanity checks on the
- * state flags which are generated and checked to help ensure
- * state atoms are ordered correctly in the list.
- */
- struct st_state_flags examined, prev;
- memset(&examined, 0, sizeof(examined));
- prev = *state;
-
- for (i = 0; i < Elements(atoms); i++) {
- const struct st_tracked_state *atom = atoms[i];
- struct st_state_flags generated;
-
- /*printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
-
- if (!(atom->dirty.mesa || atom->dirty.st) ||
- !atom->update) {
- printf("malformed atom %s\n", atom->name);
- assert(0);
- }
-
- if (check_state(state, &atom->dirty)) {
- atoms[i]->update( st );
- /*printf("after: %x\n", atom->dirty.mesa);*/
- }
-
- accumulate_state(&examined, &atom->dirty);
-
- /* generated = (prev ^ state)
- * if (examined & generated)
- * fail;
- */
- xor_states(&generated, &prev, state);
- assert(!check_state(&examined, &generated));
- prev = *state;
- }
- /*printf("\n");*/
-
- }
- else {
- for (i = 0; i < Elements(atoms); i++) {
- if (check_state(state, &atoms[i]->dirty))
- atoms[i]->update( st );
- }
- }
-
- memset(state, 0, sizeof(*state));
-}
-
-
-
+/**************************************************************************
+ *
+ * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "main/glheader.h"
+#include "main/context.h"
+
+#include "pipe/p_defines.h"
+#include "st_context.h"
+#include "st_atom.h"
+#include "st_cb_bitmap.h"
+#include "st_program.h"
+#include "st_manager.h"
+
+
+/**
+ * This is used to initialize st->atoms[].
+ */
+static const struct st_tracked_state *atoms[] =
+{
+ &st_update_depth_stencil_alpha,
+ &st_update_clip,
+
+ &st_finalize_textures,
+ &st_update_fp,
+ &st_update_gp,
+ &st_update_vp,
+
+ &st_update_rasterizer,
+ &st_update_polygon_stipple,
+ &st_update_viewport,
+ &st_update_scissor,
+ &st_update_blend,
+ &st_update_sampler,
+ &st_update_vertex_texture,
+ &st_update_texture,
+ &st_update_framebuffer,
+ &st_update_msaa,
+ &st_update_vs_constants,
+ &st_update_gs_constants,
+ &st_update_fs_constants,
+ &st_update_pixel_transfer
+};
+
+
+void st_init_atoms( struct st_context *st )
+{
+ /* no-op */
+}
+
+
+void st_destroy_atoms( struct st_context *st )
+{
+ /* no-op */
+}
+
+
+/***********************************************************************
+ */
+
+static GLboolean check_state( const struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ return ((a->mesa & b->mesa) ||
+ (a->st & b->st));
+}
+
+static void accumulate_state( struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ a->mesa |= b->mesa;
+ a->st |= b->st;
+}
+
+
+static void xor_states( struct st_state_flags *result,
+ const struct st_state_flags *a,
+ const struct st_state_flags *b )
+{
+ result->mesa = a->mesa ^ b->mesa;
+ result->st = a->st ^ b->st;
+}
+
+
+/* Too complex to figure out, just check every time:
+ */
+static void check_program_state( struct st_context *st )
+{
+ struct gl_context *ctx = st->ctx;
+
+ if (ctx->VertexProgram._Current != &st->vp->Base)
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
+
+ if (ctx->FragmentProgram._Current != &st->fp->Base)
+ st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
+
+ if (ctx->GeometryProgram._Current != &st->gp->Base)
+ st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
+}
+
+
+/***********************************************************************
+ * Update all derived state:
+ */
+
+void st_validate_state( struct st_context *st )
+{
+ struct st_state_flags *state = &st->dirty;
+ GLuint i;
+
+ /* The bitmap cache is immune to pixel unpack changes.
+ * Note that GLUT makes several calls to glPixelStore for each
+ * bitmap char it draws so this is an important check.
+ */
+ if (state->mesa & ~_NEW_PACKUNPACK)
+ st_flush_bitmap_cache(st);
+
+ check_program_state( st );
+
+ st_manager_validate_framebuffers(st);
+
+ if (state->st == 0)
+ return;
+
+ /*printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/
+
+#ifdef DEBUG
+ if (1) {
+#else
+ if (0) {
+#endif
+ /* Debug version which enforces various sanity checks on the
+ * state flags which are generated and checked to help ensure
+ * state atoms are ordered correctly in the list.
+ */
+ struct st_state_flags examined, prev;
+ memset(&examined, 0, sizeof(examined));
+ prev = *state;
+
+ for (i = 0; i < Elements(atoms); i++) {
+ const struct st_tracked_state *atom = atoms[i];
+ struct st_state_flags generated;
+
+ /*printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/
+
+ if (!(atom->dirty.mesa || atom->dirty.st) ||
+ !atom->update) {
+ printf("malformed atom %s\n", atom->name);
+ assert(0);
+ }
+
+ if (check_state(state, &atom->dirty)) {
+ atoms[i]->update( st );
+ /*printf("after: %x\n", atom->dirty.mesa);*/
+ }
+
+ accumulate_state(&examined, &atom->dirty);
+
+ /* generated = (prev ^ state)
+ * if (examined & generated)
+ * fail;
+ */
+ xor_states(&generated, &prev, state);
+ assert(!check_state(&examined, &generated));
+ prev = *state;
+ }
+ /*printf("\n");*/
+
+ }
+ else {
+ for (i = 0; i < Elements(atoms); i++) {
+ if (check_state(state, &atoms[i]->dirty))
+ atoms[i]->update( st );
+ }
+ }
+
+ memset(state, 0, sizeof(*state));
+}
+
+
+
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index fb1e4092c..8d2317ea1 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -116,11 +116,12 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
for (j = 0; j < texSize; j++) {
union util_color uc;
int k = (i * texSize + j);
- ubyte r = ctx->PixelMaps.RtoR.Map8[j * rSize / texSize];
- ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize];
- ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize];
- ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize];
- util_pack_color_ub(r, g, b, a, pt->format, &uc);
+ float rgba[4];
+ rgba[0] = ctx->PixelMaps.RtoR.Map[j * rSize / texSize];
+ rgba[1] = ctx->PixelMaps.GtoG.Map[i * gSize / texSize];
+ rgba[2] = ctx->PixelMaps.BtoB.Map[j * bSize / texSize];
+ rgba[3] = ctx->PixelMaps.AtoA.Map[i * aSize / texSize];
+ util_pack_color(rgba, pt->format, &uc);
*(dest + k) = uc.ui;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index 8845fed51..ee69fc390 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -233,29 +233,33 @@ update_fragment_samplers(struct st_context *st)
const struct gl_context *ctx = st->ctx;
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
GLuint su;
+ GLuint samplers_used = fprog->Base.SamplersUsed;
+ GLuint old_max = st->state.num_samplers;
st->state.num_samplers = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) {
+ for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
struct pipe_sampler_state *sampler = st->state.samplers + su;
-
- if (fprog->Base.SamplersUsed & (1 << su)) {
+ if (samplers_used & 1) {
GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
+ texUnit = fprog->Base.SamplerUnits[su];
- convert_sampler(st, sampler, texUnit);
+ convert_sampler(st, sampler, texUnit);
st->state.num_samplers = su + 1;
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, sampler);
}
- else {
+ else if (samplers_used != 0 || su < old_max) {
/*printf("%s su=%u null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, NULL);
+ } else {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index d241527cc..e8941da8d 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -300,24 +300,31 @@ update_fragment_textures(struct st_context *st)
const struct gl_context *ctx = st->ctx;
struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
GLuint su;
+ int old_max = st->state.num_textures;
+ GLbitfield samplers_used = fprog->Base.SamplersUsed;
st->state.num_textures = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) {
+ for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
struct pipe_sampler_view *sampler_view = NULL;
- if (fprog->Base.SamplersUsed & (1 << su)) {
+
+ if (samplers_used & 1) {
GLboolean retval;
GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
+ texUnit = fprog->Base.SamplerUnits[su];
- retval = update_single_texture(st, &sampler_view, texUnit);
- if (retval == GL_FALSE)
- continue;
+ retval = update_single_texture(st, &sampler_view, texUnit);
+ if (retval == GL_FALSE)
+ continue;
st->state.num_textures = su + 1;
+ } else if (samplers_used == 0 && su >= old_max) {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
+
pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c
index 750f541b5..27da2c633 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_blit.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c
@@ -178,7 +178,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
st->pipe->render_condition(st->pipe, NULL, 0);
}
- if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers) {
+ if (readFB->Visual.sampleBuffers > drawFB->Visual.sampleBuffers &&
+ readFB->Visual.samples > 1) {
struct pipe_resolve_info info;
if (dstX0 < dstX1) {
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 443cb4bdf..fb36a6809 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -146,8 +146,8 @@ void st_init_limits(struct st_context *st)
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
- /* Quads always follow GL provoking rules. */
- c->QuadsFollowProvokingVertexConvention = GL_FALSE;
+ c->QuadsFollowProvokingVertexConvention = screen->get_param(
+ screen, PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION);
for (sh = 0; sh < MESA_SHADER_TYPES; ++sh) {
struct gl_shader_compiler_options *options =