summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c18
-rw-r--r--src/mesa/state_tracker/st_atom_viewport.c6
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c2
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c2
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c22
-rw-r--r--src/mesa/state_tracker/st_framebuffer.c2
-rw-r--r--src/mesa/state_tracker/st_program.c28
-rw-r--r--src/mesa/state_tracker/st_program.h9
9 files changed, 27 insertions, 66 deletions
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index aa0508a41fc..d9b508537d0 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -60,26 +60,10 @@ static void
translate_fp(struct st_context *st,
struct st_fragment_program *stfp)
{
- const GLbitfield fragInputsRead = stfp->Base.Base.InputsRead;
-
if (!stfp->state.tokens) {
- GLuint inAttr, numIn = 0;
-
- for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
- if (fragInputsRead & (1 << inAttr)) {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
- }
- else {
- stfp->input_to_slot[inAttr] = -1;
- }
- }
-
- stfp->num_input_slots = numIn;
-
assert(stfp->Base.Base.NumInstructions > 0);
- st_translate_fragment_program(st, stfp, stfp->input_to_slot);
+ st_translate_fragment_program(st, stfp);
}
}
diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c
index 27ec2eb0331..b82bbfe410f 100644
--- a/src/mesa/state_tracker/st_atom_viewport.c
+++ b/src/mesa/state_tracker/st_atom_viewport.c
@@ -62,9 +62,9 @@ update_viewport( struct st_context *st )
GLfloat x = (GLfloat)ctx->Viewport.X;
GLfloat y = (GLfloat)ctx->Viewport.Y;
GLfloat z = ctx->Viewport.Near;
- GLfloat half_width = (GLfloat)ctx->Viewport.Width / 2.0f;
- GLfloat half_height = (GLfloat)ctx->Viewport.Height / 2.0f;
- GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) / 2.0f;
+ GLfloat half_width = (GLfloat)ctx->Viewport.Width * 0.5f;
+ GLfloat half_height = (GLfloat)ctx->Viewport.Height * 0.5f;
+ GLfloat half_depth = (GLfloat)(ctx->Viewport.Far - ctx->Viewport.Near) * 0.5f;
st->state.viewport.scale[0] = half_width;
st->state.viewport.scale[1] = half_height * yScale;
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index c70bbc880c0..85420a950f4 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -221,7 +221,7 @@ combined_bitmap_fragment_program(GLcontext *ctx)
#endif
/* translate to TGSI tokens */
- st_translate_fragment_program(st, stfp->bitmap_program, NULL);
+ st_translate_fragment_program(st, stfp->bitmap_program);
}
return stfp->bitmap_program;
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 9b1d2103f17..2a084ca5779 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -140,7 +140,7 @@ combined_drawpix_fragment_program(GLcontext *ctx)
#endif
/* translate to TGSI tokens */
- st_translate_fragment_program(st, stfp, NULL);
+ st_translate_fragment_program(st, stfp);
/* save new program, update serial numbers */
st->pixel_xfer.xfer_prog_sn = st->pixel_xfer.program->serialNo;
@@ -221,7 +221,7 @@ make_fragment_shader_z(struct st_context *st)
p->SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
st->drawpix.z_shader = (struct st_fragment_program *) p;
- st_translate_fragment_program(st, st->drawpix.z_shader, NULL);
+ st_translate_fragment_program(st, st->drawpix.z_shader);
return st->drawpix.z_shader;
}
diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c
index 996e065fedc..0fcb427f30a 100644
--- a/src/mesa/state_tracker/st_cb_strings.c
+++ b/src/mesa/state_tracker/st_cb_strings.c
@@ -39,7 +39,7 @@
#include "st_context.h"
#include "st_cb_strings.h"
-#define ST_VERSION_STRING "0.3"
+#define ST_VERSION_STRING "0.4"
static const GLubyte *
st_get_string(GLcontext * ctx, GLenum name)
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 7c5664be1d8..13f050900a6 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -543,22 +543,15 @@ st_TexImage(GLcontext * ctx,
_mesa_align_free(texImage->Data);
}
- if (width == 0 || height == 0 || depth == 0) {
- /* stop after freeing old image */
- return;
- }
-
- /* If this is the only mipmap level in the texture, could call
- * bmBufferData with NULL data to free the old block and avoid
- * waiting on any outstanding fences.
+ /*
+ * See if the new image is somehow incompatible with the existing
+ * mipmap. If so, free the old mipmap.
*/
if (stObj->pt) {
if (stObj->teximage_realloc ||
level > (GLint) stObj->pt->last_level ||
- (stObj->pt->last_level == level &&
- stObj->pt->target != PIPE_TEXTURE_CUBE &&
- !st_texture_match_image(stObj->pt, &stImage->base,
- stImage->face, stImage->level))) {
+ !st_texture_match_image(stObj->pt, &stImage->base,
+ stImage->face, stImage->level)) {
DBG("release it\n");
pipe_texture_reference(&stObj->pt, NULL);
assert(!stObj->pt);
@@ -566,6 +559,11 @@ st_TexImage(GLcontext * ctx,
}
}
+ if (width == 0 || height == 0 || depth == 0) {
+ /* stop after freeing old image */
+ return;
+ }
+
if (!stObj->pt) {
guess_and_alloc_texture(ctx->st, stObj, stImage);
if (!stObj->pt) {
diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c
index ed9c0ff5b76..4e225a123c8 100644
--- a/src/mesa/state_tracker/st_framebuffer.c
+++ b/src/mesa/state_tracker/st_framebuffer.c
@@ -54,7 +54,7 @@ st_create_framebuffer( const __GLcontextModes *visual,
if (visual->sampleBuffers)
samples = visual->samples;
- _mesa_initialize_framebuffer(&stfb->Base, visual);
+ _mesa_initialize_window_framebuffer(&stfb->Base, visual);
if (visual->doubleBufferMode) {
struct gl_renderbuffer *rb
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 5c87e47ca3d..a639003dbd0 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -269,24 +269,20 @@ fail:
/**
* Translate a Mesa fragment shader into a TGSI shader.
- * \param inputMapping to map fragment program input registers to TGSI
- * input slots
* \return pointer to cached pipe_shader object.
*/
void
st_translate_fragment_program(struct st_context *st,
- struct st_fragment_program *stfp,
- const GLuint inputMapping[])
+ struct st_fragment_program *stfp )
{
struct pipe_context *pipe = st->pipe;
GLuint outputMapping[FRAG_RESULT_MAX];
- GLuint defaultInputMapping[FRAG_ATTRIB_MAX];
+ GLuint inputMapping[FRAG_ATTRIB_MAX];
GLuint interpMode[16]; /* XXX size? */
GLuint attr;
enum pipe_error error;
const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
struct ureg_program *ureg;
- GLuint vslot = 0;
uint fs_num_inputs = 0;
@@ -294,24 +290,14 @@ st_translate_fragment_program(struct st_context *st,
ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS];
uint fs_num_outputs = 0;
- /* which vertex output goes to the first fragment input: */
- if (inputsRead & FRAG_BIT_WPOS)
- vslot = 0;
- else
- vslot = 1;
-
/*
* Convert Mesa program inputs to TGSI input register semantics.
*/
for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
if (inputsRead & (1 << attr)) {
- const GLuint slot = fs_num_inputs;
-
- defaultInputMapping[attr] = slot;
-
- stfp->input_map[slot] = vslot++;
+ const GLuint slot = fs_num_inputs++;
- fs_num_inputs++;
+ inputMapping[attr] = slot;
switch (attr) {
case FRAG_ATTRIB_WPOS:
@@ -376,6 +362,9 @@ st_translate_fragment_program(struct st_context *st,
break;
}
}
+ else {
+ inputMapping[attr] = -1;
+ }
}
/*
@@ -417,9 +406,6 @@ st_translate_fragment_program(struct st_context *st,
}
}
- if (!inputMapping)
- inputMapping = defaultInputMapping;
-
ureg = ureg_create( TGSI_PROCESSOR_FRAGMENT );
if (ureg == NULL)
return;
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 6b9a9226df5..d9822e50f55 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -52,12 +52,6 @@ struct st_fragment_program
struct gl_fragment_program Base;
GLuint serialNo;
- GLuint input_to_slot[FRAG_ATTRIB_MAX]; /**< Maps FRAG_ATTRIB_x to slot */
- GLuint num_input_slots;
-
- /** map FP input back to VP output */
- GLuint input_map[PIPE_MAX_SHADER_INPUTS];
-
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
@@ -171,8 +165,7 @@ st_reference_fragprog(struct st_context *st,
extern void
st_translate_fragment_program(struct st_context *st,
- struct st_fragment_program *fp,
- const GLuint inputMapping[]);
+ struct st_fragment_program *fp);
/* Called after program string change, discard all previous