diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom.c | 7 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_depth.c | 11 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_sampler.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_shader.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 55 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_program.c | 12 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_queryobj.c | 9 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_rasterpos.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_viewport.c | 50 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_viewport.h | 29 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_debug.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 19 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw_feedback.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 54 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.h | 11 |
18 files changed, 114 insertions, 173 deletions
diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index 73df44d198..6a7ebff6ca 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -35,7 +35,8 @@ #include "st_cb_bitmap.h" #include "st_program.h" - +#include "pipe/p_context.h" + /** * This is used to initialize st->atoms[]. @@ -135,6 +136,10 @@ void st_validate_state( struct st_context *st ) check_program_state( st ); + if (st->pipe->screen->update_buffer) + st->pipe->screen->update_buffer(st->pipe->screen, + st->pipe->priv); + if (state->st == 0) return; diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 88b80a07fc..3c07afba9a 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -94,9 +94,11 @@ static void update_depth_stencil_alpha(struct st_context *st) { struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil; + struct pipe_stencil_ref sr; GLcontext *ctx = st->ctx; memset(dsa, 0, sizeof(*dsa)); + memset(&sr, 0, sizeof(sr)); if (ctx->Depth.Test && ctx->DrawBuffer->Visual.depthBits > 0) { dsa->depth.enabled = 1; @@ -110,9 +112,9 @@ update_depth_stencil_alpha(struct st_context *st) dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[0]); dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[0]); dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[0]); - dsa->stencil[0].ref_value = ctx->Stencil.Ref[0] & 0xff; dsa->stencil[0].valuemask = ctx->Stencil.ValueMask[0] & 0xff; dsa->stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; + sr.ref_value[0] = ctx->Stencil.Ref[0] & 0xff; if (ctx->Stencil._TestTwoSide) { const GLuint back = ctx->Stencil._BackFace; @@ -121,13 +123,17 @@ update_depth_stencil_alpha(struct st_context *st) dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(ctx->Stencil.FailFunc[back]); dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(ctx->Stencil.ZFailFunc[back]); dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(ctx->Stencil.ZPassFunc[back]); - dsa->stencil[1].ref_value = ctx->Stencil.Ref[back] & 0xff; dsa->stencil[1].valuemask = ctx->Stencil.ValueMask[back] & 0xff; dsa->stencil[1].writemask = ctx->Stencil.WriteMask[back] & 0xff; + sr.ref_value[1] = ctx->Stencil.Ref[back] & 0xff; } else { + /* This should be unnecessary. Drivers must not expect this to + * contain valid data, except the enabled bit + */ dsa->stencil[1] = dsa->stencil[0]; dsa->stencil[1].enabled = 0; + sr.ref_value[1] = sr.ref_value[0]; } } @@ -138,6 +144,7 @@ update_depth_stencil_alpha(struct st_context *st) } cso_set_depth_stencil_alpha(st->cso_context, dsa); + cso_set_stencil_ref(st->cso_context, &sr); } diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 9d63f1c6ab..a8262a5e1a 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -211,7 +211,7 @@ update_samplers(struct st_context *st) teximg ? teximg->_BaseFormat : GL_RGBA, sampler->border_color); - sampler->max_anisotropy = texobj->MaxAnisotropy; + sampler->max_anisotropy = (texobj->MaxAnisotropy == 1.0 ? 0 : (GLuint)texobj->MaxAnisotropy); /* only care about ARB_shadow, not SGI shadow */ if (texobj->CompareMode == GL_COMPARE_R_TO_TEXTURE) { diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index ea16719ba0..ad151edf3b 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -59,7 +59,7 @@ static void translate_fp(struct st_context *st, struct st_fragment_program *stfp) { - if (!stfp->state.tokens) { + if (!stfp->tgsi.tokens) { assert(stfp->Base.Base.NumInstructions > 0); st_translate_fragment_program(st, stfp); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 0c7bcb8597..898c32293d 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -215,6 +215,7 @@ clear_with_quad(GLcontext *ctx, */ cso_save_blend(st->cso_context); + cso_save_stencil_ref(st->cso_context); cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_fragment_shader(st->cso_context); @@ -254,14 +255,17 @@ clear_with_quad(GLcontext *ctx, } if (stencil) { + struct pipe_stencil_ref stencil_ref; + memset(&stencil_ref, 0, sizeof(stencil_ref)); depth_stencil.stencil[0].enabled = 1; depth_stencil.stencil[0].func = PIPE_FUNC_ALWAYS; depth_stencil.stencil[0].fail_op = PIPE_STENCIL_OP_REPLACE; depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE; depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE; - depth_stencil.stencil[0].ref_value = ctx->Stencil.Clear; depth_stencil.stencil[0].valuemask = 0xff; depth_stencil.stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff; + stencil_ref.ref_value[0] = ctx->Stencil.Clear; + cso_set_stencil_ref(st->cso_context, &stencil_ref); } cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil); @@ -277,10 +281,12 @@ clear_with_quad(GLcontext *ctx, /* Restore pipe state */ cso_restore_blend(st->cso_context); + cso_restore_stencil_ref(st->cso_context); cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); + } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 2a084ca577..36c0a2b0e1 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -93,8 +93,9 @@ is_passthrough_program(const struct gl_fragment_program *prog) /** * Make fragment shader for glDraw/CopyPixels. This shader is made * by combining the pixel transfer shader with the user-defined shader. + * \return pointer to Gallium driver fragment shader */ -static struct st_fragment_program * +static void * combined_drawpix_fragment_program(GLcontext *ctx) { struct st_context *st = st_context(ctx); @@ -113,7 +114,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) */ if (is_passthrough_program(&st->fp->Base)) { stfp = (struct st_fragment_program *) - _mesa_clone_program(ctx, &st->pixel_xfer.program->Base.Base); + _mesa_clone_fragment_program(ctx, &st->pixel_xfer.program->Base); } else { #if 0 @@ -156,7 +157,7 @@ combined_drawpix_fragment_program(GLcontext *ctx) */ st_upload_constants(st, stfp->Base.Base.Parameters, PIPE_SHADER_FRAGMENT); - return stfp; + return stfp->driver_shader; } @@ -164,8 +165,9 @@ combined_drawpix_fragment_program(GLcontext *ctx) * Create fragment shader that does a TEX() instruction to get a Z * value, then writes to FRAG_RESULT_DEPTH. * Pass fragment color through as-is. + * \return pointer to the Gallium driver fragment shader */ -static struct st_fragment_program * +static void * make_fragment_shader_z(struct st_context *st) { GLcontext *ctx = st->ctx; @@ -173,7 +175,7 @@ make_fragment_shader_z(struct st_context *st) GLuint ic = 0; if (st->drawpix.z_shader) { - return st->drawpix.z_shader; + return st->drawpix.z_shader->driver_shader; } /* @@ -223,7 +225,7 @@ make_fragment_shader_z(struct st_context *st) st->drawpix.z_shader = (struct st_fragment_program *) p; st_translate_fragment_program(st, st->drawpix.z_shader); - return st->drawpix.z_shader; + return st->drawpix.z_shader->driver_shader; } @@ -233,8 +235,8 @@ make_fragment_shader_z(struct st_context *st) * vertex position and texcoord (and optionally, color). */ static void * -st_make_passthrough_vertex_shader(struct st_context *st, - GLboolean passColor) +make_passthrough_vertex_shader(struct st_context *st, + GLboolean passColor) { if (!st->drawpix.vert_shaders[passColor]) { struct ureg_program *ureg = @@ -270,8 +272,12 @@ st_make_passthrough_vertex_shader(struct st_context *st, } +/** + * Return a texture internalFormat for drawing/copying an image + * of the given type. + */ static GLenum -_mesa_base_format(GLenum format) +base_format(GLenum format) { switch (format) { case GL_DEPTH_COMPONENT: @@ -306,7 +312,7 @@ make_texture(struct st_context *st, GLenum baseFormat; int ptw, pth; - baseFormat = _mesa_base_format(format); + baseFormat = base_format(format); mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type); assert(mformat); @@ -764,10 +770,8 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { - struct st_fragment_program *stfp; - void *driver_vp; + void *driver_vp, *driver_fp; struct st_context *st = st_context(ctx); - struct pipe_surface *ps; const GLfloat *color; if (format == GL_STENCIL_INDEX || @@ -783,15 +787,13 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, st_validate_state(st); if (format == GL_DEPTH_COMPONENT) { - ps = st->state.framebuffer.zsbuf; - stfp = make_fragment_shader_z(st); - driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE); + driver_fp = make_fragment_shader_z(st); + driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); color = ctx->Current.RasterColor; } else { - ps = st->state.framebuffer.cbufs[0]; - stfp = combined_drawpix_fragment_program(ctx); - driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE); + driver_fp = combined_drawpix_fragment_program(ctx); + driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); color = NULL; } @@ -804,7 +806,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY, pt, driver_vp, - stfp->driver_shader, + driver_fp, color, GL_FALSE); pipe_texture_reference(&pt, NULL); } @@ -922,8 +924,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct st_renderbuffer *rbRead; - void *driver_vp; - struct st_fragment_program *stfp; + void *driver_vp, *driver_fp; struct pipe_texture *pt; GLfloat *color; enum pipe_format srcFormat, texFormat; @@ -970,15 +971,15 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, if (type == GL_COLOR) { rbRead = st_get_color_read_renderbuffer(ctx); color = NULL; - stfp = combined_drawpix_fragment_program(ctx); - driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE); + driver_fp = combined_drawpix_fragment_program(ctx); + driver_vp = make_passthrough_vertex_shader(st, GL_FALSE); } else { assert(type == GL_DEPTH); rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; - stfp = make_fragment_shader_z(st); - driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE); + driver_fp = make_fragment_shader_z(st); + driver_vp = make_passthrough_vertex_shader(st, GL_TRUE); } srcFormat = rbRead->texture->format; @@ -1112,7 +1113,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY, pt, driver_vp, - stfp->driver_shader, + driver_fp, color, GL_TRUE); pipe_texture_reference(&pt, NULL); diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 82ef5572e1..2361b2eddf 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -148,9 +148,9 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) stfp->driver_shader = NULL; } - if (stfp->state.tokens) { - st_free_tokens(stfp->state.tokens); - stfp->state.tokens = NULL; + if (stfp->tgsi.tokens) { + st_free_tokens(stfp->tgsi.tokens); + stfp->tgsi.tokens = NULL; } if (stfp->bitmap_program) { @@ -193,9 +193,9 @@ static GLboolean st_program_string_notify( GLcontext *ctx, stfp->driver_shader = NULL; } - if (stfp->state.tokens) { - st_free_tokens(stfp->state.tokens); - stfp->state.tokens = NULL; + if (stfp->tgsi.tokens) { + st_free_tokens(stfp->tgsi.tokens); + stfp->tgsi.tokens = NULL; } if (st->fp == stfp) diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index 2281d10e99..dc40c5d269 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -130,13 +130,8 @@ st_CheckQuery(GLcontext *ctx, struct gl_query_object *q) { struct pipe_context *pipe = ctx->st->pipe; struct st_query_object *stq = st_query_object(q); - - if (!q->Ready) { - q->Ready = pipe->get_query_result(pipe, - stq->pq, - FALSE, - &q->Result); - } + assert(!q->Ready); /* we should not get called if Ready is TRUE */ + q->Ready = pipe->get_query_result(pipe, stq->pq, FALSE, &q->Result); } diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 42a1377809..4692891c8a 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -251,6 +251,14 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4]) /* draw the point */ st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, GL_TRUE, 0, 1); + + /* restore draw's rasterization stage depending on rendermode */ + if (ctx->RenderMode == GL_FEEDBACK) { + draw_set_rasterize_stage(draw, st->feedback_stage); + } + else if (ctx->RenderMode == GL_SELECT) { + draw_set_rasterize_stage(draw, st->selection_stage); + } } diff --git a/src/mesa/state_tracker/st_cb_viewport.c b/src/mesa/state_tracker/st_cb_viewport.c deleted file mode 100644 index b29191abef..0000000000 --- a/src/mesa/state_tracker/st_cb_viewport.c +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * 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 "st_context.h" -#include "st_cb_viewport.h" - -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" - - -static void st_viewport(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - struct st_context *st = ctx->st; - - if (st->pipe->screen && st->pipe->screen->update_buffer) - st->pipe->screen->update_buffer( st->pipe->screen, - st->pipe->priv ); -} - -void st_init_viewport_functions(struct dd_function_table *functions) -{ - functions->Viewport = st_viewport; -} diff --git a/src/mesa/state_tracker/st_cb_viewport.h b/src/mesa/state_tracker/st_cb_viewport.h deleted file mode 100644 index 44948e5316..0000000000 --- a/src/mesa/state_tracker/st_cb_viewport.h +++ /dev/null @@ -1,29 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * 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. - * - **************************************************************************/ - -extern void -st_init_viewport_functions(struct dd_function_table *functions); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 8f6a0c2423..5b3987d73a 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -56,7 +56,6 @@ #include "st_cb_texture.h" #include "st_cb_flush.h" #include "st_cb_strings.h" -#include "st_cb_viewport.h" #include "st_atom.h" #include "st_draw.h" #include "st_extensions.h" @@ -343,7 +342,6 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_texture_functions(functions); st_init_flush_functions(functions); st_init_string_functions(functions); - st_init_viewport_functions(functions); functions->UpdateState = st_invalidate_state; } diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index 6e699ca552..5dbabfa5c2 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -87,11 +87,11 @@ st_print_current(void) #endif if (st->vp->varients) - tgsi_dump( st->vp->varients[0].state.tokens, 0 ); + tgsi_dump( st->vp->varients[0].tgsi.tokens, 0 ); if (st->vp->Base.Base.Parameters) _mesa_print_parameter_list(st->vp->Base.Base.Parameters); - tgsi_dump( st->fp->state.tokens, 0 ); + tgsi_dump( st->fp->tgsi.tokens, 0 ); if (st->fp->Base.Base.Parameters) _mesa_print_parameter_list(st->fp->Base.Base.Parameters); } diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index e1dcb154c1..4b48c168e9 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -56,6 +56,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "util/u_inlines.h" +#include "util/u_format.h" static GLuint double_types[4] = { @@ -596,7 +597,7 @@ st_draw_vbo(GLcontext *ctx, printf("vlements[%d].vbuffer_index = %u\n", i, velements[i].vertex_buffer_index); printf("vlements[%d].src_offset = %u\n", i, velements[i].src_offset); printf("vlements[%d].nr_comps = %u\n", i, velements[i].nr_components); - printf("vlements[%d].format = %s\n", i, pf_name(velements[i].src_format)); + printf("vlements[%d].format = %s\n", i, util_format_name(velements[i].src_format)); } } #endif @@ -645,20 +646,18 @@ st_draw_vbo(GLcontext *ctx, } /* draw */ - if (nr_prims == 1 && pipe->draw_range_elements != NULL) { - i = 0; - + if (pipe->draw_range_elements && min_index != ~0 && max_index != ~0) { /* XXX: exercise temporary path to pass min/max directly * through to driver & draw module. These interfaces still * need a bit of work... */ - prim = translate_prim( ctx, prims[i].mode ); + for (i = 0; i < nr_prims; i++) { + prim = translate_prim( ctx, prims[i].mode ); - pipe->draw_range_elements(pipe, indexBuf, indexSize, - min_index, - max_index, - prim, - prims[i].start + indexOffset, prims[i].count); + pipe->draw_range_elements(pipe, indexBuf, indexSize, + min_index, max_index, prim, + prims[i].start + indexOffset, prims[i].count); + } } else { for (i = 0; i < nr_prims; i++) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 75ad1a97cf..087f2f22bb 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -119,7 +119,7 @@ st_feedback_draw_vbo(GLcontext *ctx, /* must get these after state validation! */ vp = ctx->st->vp; - vs = &st->vp_varient->state; + vs = &st->vp_varient->tgsi; if (!st->vp_varient->draw_shader) { st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs); diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 3ffc2aee2a..851c16f83c 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -85,7 +85,7 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo) if (desc->layout == UTIL_FORMAT_LAYOUT_ARITH || desc->layout == UTIL_FORMAT_LAYOUT_ARRAY) { #if 0 - printf("%s\n", pf_name( format ) ); + printf("%s\n", util_format_name( format ) ); #endif /* Data type */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 21ad6fef2b..7ce3938904 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -68,8 +68,8 @@ st_vp_release_varients( struct st_context *st, if (vpv->draw_shader) draw_delete_vertex_shader( st->draw, vpv->draw_shader ); - if (vpv->state.tokens) - st_free_tokens(vpv->state.tokens); + if (vpv->tgsi.tokens) + st_free_tokens(vpv->tgsi.tokens); FREE( vpv ); @@ -236,13 +236,13 @@ st_translate_vertex_program(struct st_context *st, if (error) goto fail; - vpv->state.tokens = ureg_get_tokens( ureg, NULL ); - if (!vpv->state.tokens) + vpv->tgsi.tokens = ureg_get_tokens( ureg, NULL ); + if (!vpv->tgsi.tokens) goto fail; ureg_destroy( ureg ); - vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state); + vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi); if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stvp->Base.Base); @@ -250,7 +250,7 @@ st_translate_vertex_program(struct st_context *st, } if (ST_DEBUG & DEBUG_TGSI) { - tgsi_dump( vpv->state.tokens, 0 ); + tgsi_dump( vpv->tgsi.tokens, 0 ); debug_printf("\n"); } @@ -278,12 +278,14 @@ st_translate_fragment_program(struct st_context *st, struct pipe_context *pipe = st->pipe; GLuint outputMapping[FRAG_RESULT_MAX]; GLuint inputMapping[FRAG_ATTRIB_MAX]; - GLuint interpMode[16]; /* XXX size? */ + GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ GLuint attr; enum pipe_error error; const GLbitfield inputsRead = stfp->Base.Base.InputsRead; struct ureg_program *ureg; + ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; + ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; uint fs_num_inputs = 0; ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; @@ -301,28 +303,28 @@ st_translate_fragment_program(struct st_context *st, switch (attr) { case FRAG_ATTRIB_WPOS: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - stfp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; + input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; case FRAG_ATTRIB_COL0: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - stfp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; case FRAG_ATTRIB_COL1: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - stfp->input_semantic_index[slot] = 1; + input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + input_semantic_index[slot] = 1; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; case FRAG_ATTRIB_FOGC: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG; - stfp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_FOG; + input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; case FRAG_ATTRIB_FACE: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE; - stfp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_FACE; + input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; case FRAG_ATTRIB_PNTC: @@ -331,8 +333,8 @@ st_translate_fragment_program(struct st_context *st, * shader input is the point coord attribute so that it can set * up the right vertex attribute values. */ - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[slot] = 0; + input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; @@ -365,8 +367,8 @@ st_translate_fragment_program(struct st_context *st, * readability of the generated TGSI. */ assert(attr >= FRAG_ATTRIB_TEX0); - stfp->input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); + input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; } @@ -428,8 +430,8 @@ st_translate_fragment_program(struct st_context *st, /* inputs */ fs_num_inputs, inputMapping, - stfp->input_semantic_name, - stfp->input_semantic_index, + input_semantic_name, + input_semantic_index, interpMode, /* outputs */ fs_num_outputs, @@ -437,9 +439,9 @@ st_translate_fragment_program(struct st_context *st, fs_output_semantic_name, fs_output_semantic_index, FALSE ); - stfp->state.tokens = ureg_get_tokens( ureg, NULL ); + stfp->tgsi.tokens = ureg_get_tokens( ureg, NULL ); ureg_destroy( ureg ); - stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state); + stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->tgsi); if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stfp->Base.Base); @@ -447,7 +449,7 @@ st_translate_fragment_program(struct st_context *st, } if (ST_DEBUG & DEBUG_TGSI) { - tgsi_dump( stfp->state.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); + tgsi_dump( stfp->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); debug_printf("\n"); } } diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index d9822e50f5..1b3f75ca27 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -52,10 +52,7 @@ struct st_fragment_program struct gl_fragment_program Base; GLuint serialNo; - ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; - ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; - - struct pipe_shader_state state; + struct pipe_shader_state tgsi; void *driver_shader; /** Program prefixed with glBitmap prologue */ @@ -82,9 +79,11 @@ struct st_vp_varient */ struct st_vp_varient_key key; - /** TGSI tokens -- why? + /** + * TGSI tokens (to later generate a 'draw' module shader for + * selection/feedback/rasterpos) */ - struct pipe_shader_state state; + struct pipe_shader_state tgsi; /** Driver's compiled shader */ void *driver_shader; |