X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fsvga%2Fsvga_swtnl_state.c;h=7d0a1c58f60311317a277412a2eee5e378e5aca3;hb=6a00e4eaee19cdbc8423e53c22fc8a1d7fdd68dd;hp=161631211310298304bfd7ffd13e91f29166062d;hpb=0c75854cc1650dc870e042aa66a053e70b3d4556;p=mesa.git diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c index 16163121131..7d0a1c58f60 100644 --- a/src/gallium/drivers/svga/svga_swtnl_state.c +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -25,14 +25,13 @@ #include "draw/draw_context.h" #include "draw/draw_vbuf.h" -#include "pipe/p_inlines.h" +#include "util/u_inlines.h" #include "pipe/p_state.h" -#include "util/u_memory.h" #include "svga_context.h" #include "svga_swtnl.h" #include "svga_state.h" - +#include "svga_tgsi.h" #include "svga_swtnl_private.h" @@ -62,7 +61,7 @@ static void set_draw_viewport( struct svga_context *svga ) * going to be drawn with triangles, but we're not catching all * cases where that will happen. */ - if (svga->curr.rast->templ.line_width > 1.0) + if (svga->curr.rast->need_pipeline & SVGA_PIPELINE_FLAG_LINES) { adjx = SVGA_LINE_ADJ_X + 0.175; adjy = SVGA_LINE_ADJ_Y - 0.175; @@ -84,8 +83,9 @@ static void set_draw_viewport( struct svga_context *svga ) draw_set_viewport_state(svga->swtnl.draw, &vp); } -static int update_swtnl_draw( struct svga_context *svga, - unsigned dirty ) +static enum pipe_error +update_swtnl_draw( struct svga_context *svga, + unsigned dirty ) { draw_flush( svga->swtnl.draw ); @@ -93,6 +93,10 @@ static int update_swtnl_draw( struct svga_context *svga, draw_bind_vertex_shader(svga->swtnl.draw, svga->curr.vs->draw_shader); + if (dirty & SVGA_NEW_FS) + draw_bind_fragment_shader(svga->swtnl.draw, + svga->curr.fs->draw_shader); + if (dirty & SVGA_NEW_VBUFFER) draw_set_vertex_buffers(svga->swtnl.draw, svga->curr.num_vertex_buffers, @@ -100,8 +104,8 @@ static int update_swtnl_draw( struct svga_context *svga, if (dirty & SVGA_NEW_VELEMENT) draw_set_vertex_elements(svga->swtnl.draw, - svga->curr.num_vertex_elements, - svga->curr.ve ); + svga->curr.velems->count, + svga->curr.velems->velem ); if (dirty & SVGA_NEW_CLIP) draw_set_clip_state(svga->swtnl.draw, @@ -114,16 +118,13 @@ static int update_swtnl_draw( struct svga_context *svga, if (dirty & SVGA_NEW_RAST) draw_set_rasterizer_state(svga->swtnl.draw, - &svga->curr.rast->templ); + &svga->curr.rast->templ, + (void *) svga->curr.rast); if (dirty & SVGA_NEW_FRAME_BUFFER) draw_set_mrd(svga->swtnl.draw, svga->curr.depthscale); - if (dirty & SVGA_NEW_EDGEFLAGS) - draw_set_edgeflags( svga->swtnl.draw, - svga->curr.edgeflags ); - return 0; } @@ -138,13 +139,13 @@ struct svga_tracked_state svga_update_swtnl_draw = SVGA_NEW_VIEWPORT | SVGA_NEW_RAST | SVGA_NEW_FRAME_BUFFER | - SVGA_NEW_REDUCED_PRIMITIVE | - SVGA_NEW_EDGEFLAGS), + SVGA_NEW_REDUCED_PRIMITIVE), update_swtnl_draw }; -int svga_swtnl_update_vdecl( struct svga_context *svga ) +enum pipe_error +svga_swtnl_update_vdecl( struct svga_context *svga ) { struct svga_vbuf_render *svga_render = svga_vbuf_render(svga->swtnl.backend); struct draw_context *draw = svga->swtnl.draw; @@ -152,7 +153,7 @@ int svga_swtnl_update_vdecl( struct svga_context *svga ) SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS]; const enum interp_mode colorInterp = svga->curr.rast->templ.flatshade ? INTERP_CONSTANT : INTERP_LINEAR; - const struct svga_fragment_shader *fs = svga->curr.fs; + struct svga_fragment_shader *fs = svga->curr.fs; int offset = 0; int nr_decls = 0; int src, i; @@ -161,7 +162,7 @@ int svga_swtnl_update_vdecl( struct svga_context *svga ) memset(vdecl, 0, sizeof(vdecl)); /* always add position */ - src = draw_find_vs_output(draw, TGSI_SEMANTIC_POSITION, 0); + src = draw_find_shader_output(draw, TGSI_SEMANTIC_POSITION, 0); draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, src); vinfo->attrib[0].emit = EMIT_4F; vdecl[0].array.offset = offset; @@ -172,13 +173,15 @@ int svga_swtnl_update_vdecl( struct svga_context *svga ) nr_decls++; for (i = 0; i < fs->base.info.num_inputs; i++) { - unsigned name = fs->base.info.input_semantic_name[i]; - unsigned index = fs->base.info.input_semantic_index[i]; - src = draw_find_vs_output(draw, name, index); + const unsigned sem_name = fs->base.info.input_semantic_name[i]; + const unsigned sem_index = fs->base.info.input_semantic_index[i]; + + src = draw_find_shader_output(draw, sem_name, sem_index); + vdecl[nr_decls].array.offset = offset; - vdecl[nr_decls].identity.usageIndex = fs->base.info.input_semantic_index[i]; + vdecl[nr_decls].identity.usageIndex = sem_index; - switch (name) { + switch (sem_name) { case TGSI_SEMANTIC_COLOR: draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_COLOR; @@ -190,7 +193,8 @@ int svga_swtnl_update_vdecl( struct svga_context *svga ) draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD; vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4; - vdecl[nr_decls].identity.usageIndex += 1; + vdecl[nr_decls].identity.usageIndex = + svga_remap_generic_index(fs->generic_remap_table, sem_index); offset += 16; nr_decls++; break; @@ -226,8 +230,9 @@ int svga_swtnl_update_vdecl( struct svga_context *svga ) } -static int update_swtnl_vdecl( struct svga_context *svga, - unsigned dirty ) +static enum pipe_error +update_swtnl_vdecl( struct svga_context *svga, + unsigned dirty ) { return svga_swtnl_update_vdecl( svga ); }