summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-07-05 00:53:13 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-07-05 00:53:13 +1000
commit77f8167d75d0016c76812fc147c06072e5729965 (patch)
treef610929b3fa6d62013593df797b9e05d7c1452b4 /src/mesa/state_tracker
parent6f56b527d866506a323feb19f9d8529d40034af2 (diff)
parent194cfc7a4ed86653db34be0e331ad7c23b5334eb (diff)
Merge remote branch 'upstream/gallium-0.1' into gallium-0.1
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c2
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c3
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c33
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c5
-rw-r--r--src/mesa/state_tracker/st_program.c7
-rw-r--r--src/mesa/state_tracker/st_program.h3
6 files changed, 39 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index 87a91d56d0..ff40bb4312 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st )
raster->line_stipple_factor = ctx->Line.StippleFactor - 1;
/* _NEW_MULTISAMPLE */
- if (ctx->Multisample.Enabled)
+ if (ctx->Multisample._Enabled)
raster->multisample = 1;
/* _NEW_SCISSOR */
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 1e182eef1c..3ba6a971f6 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -136,7 +136,8 @@ update_samplers(struct st_context *st)
const struct gl_texture_object *texobj
= st->ctx->Texture.Unit[texUnit]._Current;
- assert(texobj);
+ if (!texobj)
+ continue;
sampler->wrap_s = gl_wrap_to_sp(texobj->WrapS);
sampler->wrap_t = gl_wrap_to_sp(texobj->WrapT);
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index a62ea8161c..4fa304ede0 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -175,6 +175,7 @@ find_translated_vp(struct st_context *st,
GLuint outAttr, dummySlot;
const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten;
GLuint numVpOuts = 0;
+ GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE;
/* Compute mapping of vertex program outputs to slots, which depends
* on the fragment program's input->slot mapping.
@@ -199,19 +200,28 @@ find_translated_vp(struct st_context *st,
numVpOuts++;
}
}
- else if (outAttr == VERT_RESULT_PSIZ ||
- outAttr == VERT_RESULT_BFC0 ||
- outAttr == VERT_RESULT_BFC1) {
- /* backface colors go into last slots */
- xvp->output_to_slot[outAttr] = numVpOuts++;
- }
+ else if (outAttr == VERT_RESULT_PSIZ)
+ emitPntSize = GL_TRUE;
+ else if (outAttr == VERT_RESULT_BFC0)
+ emitBFC0 = GL_TRUE;
+ else if (outAttr == VERT_RESULT_BFC1)
+ emitBFC1 = GL_TRUE;
}
- /*
- printf("output_to_slot[%d] = %d\n", outAttr,
+#if 0 /*debug*/
+ printf("assign output_to_slot[%d] = %d\n", outAttr,
xvp->output_to_slot[outAttr]);
- */
+#endif
}
+ /* must do these last */
+ if (emitPntSize)
+ xvp->output_to_slot[VERT_RESULT_PSIZ] = numVpOuts++;
+ if (emitBFC0)
+ xvp->output_to_slot[VERT_RESULT_BFC0] = numVpOuts++;
+ if (emitBFC1)
+ xvp->output_to_slot[VERT_RESULT_BFC1] = numVpOuts++;
+
+
/* Unneeded vertex program outputs will go to this slot.
* We could use this info to do dead code elimination in the
* vertex program.
@@ -224,6 +234,11 @@ find_translated_vp(struct st_context *st,
if (xvp->output_to_slot[outAttr] == UNUSED)
xvp->output_to_slot[outAttr] = dummySlot;
}
+#if 0 /*debug*/
+ printf("output_to_slot[%d] = %d\n", outAttr,
+ xvp->output_to_slot[outAttr]);
+#endif
+
}
assert(stvp->Base.Base.NumInstructions > 1);
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index f3bc3b8584..de86832342 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -541,6 +541,9 @@ reset_cache(struct st_context *st)
cache->ymin = 1000000;
cache->ymax = -1000000;
+ if (cache->surf)
+ screen->tex_surface_release(screen, &cache->surf);
+
assert(!cache->texture);
/* allocate a new texture */
@@ -588,6 +591,8 @@ st_flush_bitmap_cache(struct st_context *st)
* So unmap and release the texture surface before drawing.
*/
screen->surface_unmap(screen, cache->surf);
+ cache->buffer = NULL;
+
screen->tex_surface_release(screen, &cache->surf);
draw_bitmap_quad(st->ctx,
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 958096f68e..5966bbadae 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -49,6 +49,9 @@
#include "cso_cache/cso_context.h"
+#define ST_MAX_SHADER_TOKENS 4096
+
+
#define TGSI_DEBUG 0
@@ -296,6 +299,8 @@ st_translate_vertex_program(struct st_context *st,
/* tokenized result */
tokens, ST_MAX_SHADER_TOKENS);
+ assert(num_tokens < ST_MAX_SHADER_TOKENS);
+
vs.tokens = (struct tgsi_token *)
mem_dup(tokens, num_tokens * sizeof(tokens[0]));
@@ -467,6 +472,8 @@ st_translate_fragment_program(struct st_context *st,
/* tokenized result */
tokens, ST_MAX_SHADER_TOKENS);
+ assert(num_tokens < ST_MAX_SHADER_TOKENS);
+
fs.tokens = (struct tgsi_token *)
mem_dup(tokens, num_tokens * sizeof(tokens[0]));
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index bf07a50789..086e9391aa 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -39,9 +39,6 @@
#include "pipe/p_shader_tokens.h"
-#define ST_MAX_SHADER_TOKENS 1024
-
-
struct cso_fragment_shader;
struct cso_vertex_shader;
struct translated_vertex_program;