diff options
Diffstat (limited to 'src/mesa/state_tracker')
27 files changed, 53 insertions, 90 deletions
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index d70cf877e8..d975cd66f7 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -37,7 +37,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "st_debug.h" #include "st_context.h" diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 8d045f2c6c..fba7bfe2ce 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -40,6 +40,7 @@ #include "cso_cache/cso_context.h" #include "util/u_rect.h" #include "util/u_math.h" +#include "util/u_inlines.h" diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 181f88a334..ea16719ba0 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -37,7 +37,6 @@ #include "main/imports.h" #include "main/mtypes.h" -#include "main/macros.h" #include "shader/program.h" #include "pipe/p_context.h" @@ -50,7 +49,6 @@ #include "st_context.h" #include "st_atom.h" #include "st_program.h" -#include "st_atom_shader.h" @@ -61,26 +59,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_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 0b68447d21..57b71c1e7b 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -39,6 +39,7 @@ #include "st_texture.h" #include "st_cb_texture.h" #include "pipe/p_context.h" +#include "util/u_inlines.h" #include "cso_cache/cso_context.h" diff --git a/src/mesa/state_tracker/st_atom_viewport.c b/src/mesa/state_tracker/st_atom_viewport.c index 27ec2eb033..0b6c34ca2c 100644 --- a/src/mesa/state_tracker/st_atom_viewport.c +++ b/src/mesa/state_tracker/st_atom_viewport.c @@ -27,7 +27,6 @@ #include "main/context.h" -#include "main/colormac.h" #include "st_context.h" #include "st_atom.h" #include "pipe/p_context.h" @@ -62,9 +61,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_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 798081ec89..1be72e729e 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -43,7 +43,7 @@ #include "st_inlines.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "util/u_tile.h" diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index d1b35f796e..85420a950f 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -47,7 +47,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "util/u_draw_quad.h" #include "util/u_simple_shaders.h" #include "shader/prog_instruction.h" @@ -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_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 65aa2a28ac..36e03018d9 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -41,8 +41,7 @@ #include "st_cb_fbo.h" #include "util/u_blit.h" - -#include "cso_cache/cso_context.h" +#include "util/u_inlines.h" void diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 0102d8a6f7..3ff589034a 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -42,7 +42,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" /** diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 94693d91f3..0c7bcb8597 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -47,7 +47,7 @@ #include "st_inlines.h" #include "pipe/p_context.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "util/u_format.h" diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 7afdc31ede..2a084ca577 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -53,7 +53,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "tgsi/tgsi_ureg.h" #include "util/u_tile.h" #include "util/u_draw_quad.h" @@ -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_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index f7350ef1e3..9f2fe7420d 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -50,6 +50,7 @@ #include "util/u_format.h" #include "util/u_rect.h" +#include "util/u_inlines.h" /** diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 17261f8321..edf26473d4 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -40,7 +40,6 @@ #include "main/imports.h" #include "main/context.h" #include "main/feedback.h" -#include "main/macros.h" #include "vbo/vbo.h" diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 5138e596a9..82ef5572e1 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -43,7 +43,6 @@ #include "st_context.h" #include "st_program.h" -#include "st_atom_shader.h" #include "st_mesa_to_tgsi.h" #include "st_cb_program.h" @@ -178,9 +177,9 @@ static GLboolean st_is_program_native( GLcontext *ctx, } -static void st_program_string_notify( GLcontext *ctx, - GLenum target, - struct gl_program *prog ) +static GLboolean st_program_string_notify( GLcontext *ctx, + GLenum target, + struct gl_program *prog ) { struct st_context *st = st_context(ctx); @@ -212,6 +211,9 @@ static void st_program_string_notify( GLcontext *ctx, if (st->vp == stvp) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; } + + /* XXX check if program is legal, within limits */ + return GL_TRUE; } diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 8eb825a6a4..6b1fdf3ecd 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -40,7 +40,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "util/u_tile.h" #include "st_debug.h" diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index f22c5369e4..0fcb427f30 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -35,10 +35,11 @@ #include "main/macros.h" #include "pipe/p_context.h" #include "pipe/p_screen.h" +#include "util/u_string.h" #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 cee2452eaf..13f050900a 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -57,7 +57,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "pipe/p_shader_tokens.h" #include "util/u_tile.h" #include "util/u_blit.h" @@ -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_context.c b/src/mesa/state_tracker/st_context.c index a62ff248ce..8f6a0c2423 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -63,6 +63,7 @@ #include "st_gen_mipmap.h" #include "st_program.h" #include "pipe/p_context.h" +#include "util/u_inlines.h" #include "draw/draw_context.h" #include "cso_cache/cso_context.h" diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 381c68474d..e1dcb154c1 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -55,7 +55,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" static GLuint double_types[4] = { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index cdaee2a353..75ad1a97cf 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -39,7 +39,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "draw/draw_private.h" #include "draw/draw_context.h" diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 835142e3d4..4e225a123c 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -35,6 +35,7 @@ #include "st_cb_fbo.h" #include "st_public.h" #include "pipe/p_defines.h" +#include "util/u_inlines.h" struct st_framebuffer * @@ -53,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_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 3823a59d37..f67d7b4cb5 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -36,7 +36,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "util/u_format.h" #include "util/u_gen_mipmap.h" #include "util/u_math.h" diff --git a/src/mesa/state_tracker/st_inlines.h b/src/mesa/state_tracker/st_inlines.h index dccc46f12d..e105870bc7 100644 --- a/src/mesa/state_tracker/st_inlines.h +++ b/src/mesa/state_tracker/st_inlines.h @@ -36,7 +36,7 @@ #include "pipe/p_context.h" #include "pipe/p_screen.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "pipe/p_state.h" #include "st_context.h" diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 4aed2df8c3..6283833463 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -40,7 +40,6 @@ #include "st_context.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" -#include "shader/prog_print.h" #include "util/u_debug.h" #include "util/u_math.h" #include "util/u_memory.h" diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 5c87e47ca3..a639003dbd 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 6b9a9226df..d9822e50f5 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 diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index b210ac9187..5a45c4358a 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -41,7 +41,7 @@ #include "pipe/p_state.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "util/u_format.h" #include "util/u_rect.h" #include "util/u_math.h" |