diff options
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_rasterizer.c | 55 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_resource.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_screen.c | 57 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_fs.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_state_rss.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_surface.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_swtnl_backend.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_insn.c | 14 |
10 files changed, 102 insertions, 50 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index 5253c45cb2..660eb0757a 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -36,16 +36,17 @@ /* Hardware frontwinding is always set up as SVGA3D_FRONTWINDING_CW. */ static SVGA3dFace svga_translate_cullmode( unsigned mode, - unsigned front_winding ) + unsigned front_ccw ) { + const int hw_front_ccw = 0; /* hardware is always CW */ switch (mode) { - case PIPE_WINDING_NONE: + case PIPE_FACE_NONE: return SVGA3D_FACE_NONE; - case PIPE_WINDING_CCW: - return SVGA3D_FACE_BACK; - case PIPE_WINDING_CW: - return SVGA3D_FACE_FRONT; - case PIPE_WINDING_BOTH: + case PIPE_FACE_FRONT: + return front_ccw == hw_front_ccw ? SVGA3D_FACE_FRONT : SVGA3D_FACE_BACK; + case PIPE_FACE_BACK: + return front_ccw == hw_front_ccw ? SVGA3D_FACE_BACK : SVGA3D_FACE_FRONT; + case PIPE_FACE_FRONT_AND_BACK: return SVGA3D_FACE_FRONT_BACK; default: assert(0); @@ -81,8 +82,8 @@ svga_create_rasterizer_state(struct pipe_context *pipe, /* fill_cw, fill_ccw - draw module or index translation */ rast->shademode = svga_translate_flatshade( templ->flatshade ); - rast->cullmode = svga_translate_cullmode( templ->cull_mode, - templ->front_winding ); + rast->cullmode = svga_translate_cullmode( templ->cull_face, + templ->front_ccw ); rast->scissortestenable = templ->scissor; rast->multisampleantialias = templ->multisample; rast->antialiasedlineenable = templ->line_smooth; @@ -117,31 +118,31 @@ svga_create_rasterizer_state(struct pipe_context *pipe, rast->need_pipeline |= SVGA_PIPELINE_FLAG_POINTS; { - boolean offset_cw = templ->offset_cw; - boolean offset_ccw = templ->offset_ccw; - boolean offset = 0; - int fill_cw = templ->fill_cw; - int fill_ccw = templ->fill_ccw; + int fill_front = templ->fill_front; + int fill_back = templ->fill_back; int fill = PIPE_POLYGON_MODE_FILL; + boolean offset_front = util_get_offset(templ, fill_front); + boolean offset_back = util_get_offset(templ, fill_back); + boolean offset = 0; - switch (templ->cull_mode) { - case PIPE_WINDING_BOTH: + switch (templ->cull_face) { + case PIPE_FACE_FRONT_AND_BACK: offset = 0; fill = PIPE_POLYGON_MODE_FILL; break; - case PIPE_WINDING_CW: - offset = offset_ccw; - fill = fill_ccw; + case PIPE_FACE_FRONT: + offset = offset_front; + fill = fill_front; break; - case PIPE_WINDING_CCW: - offset = offset_cw; - fill = fill_cw; + case PIPE_FACE_BACK: + offset = offset_back; + fill = fill_back; break; - case PIPE_WINDING_NONE: - if (fill_cw != fill_ccw || offset_cw != offset_ccw) + case PIPE_FACE_NONE: + if (fill_front != fill_back || offset_front != offset_back) { /* Always need the draw module to work out different * front/back fill modes: @@ -149,8 +150,8 @@ svga_create_rasterizer_state(struct pipe_context *pipe, rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; } else { - offset = offset_ccw; - fill = fill_ccw; + offset = offset_front; + fill = fill_front; } break; @@ -167,7 +168,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe, (templ->flatshade || templ->light_twoside || offset || - templ->cull_mode != PIPE_WINDING_NONE)) + templ->cull_face != PIPE_FACE_NONE)) { fill = PIPE_POLYGON_MODE_FILL; rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c index ba630582e5..ef2a0c40f0 100644 --- a/src/gallium/drivers/svga/svga_resource.c +++ b/src/gallium/drivers/svga/svga_resource.c @@ -33,6 +33,7 @@ svga_resource_from_handle(struct pipe_screen * screen, void svga_init_resource_functions(struct svga_context *svga) { + svga->pipe.is_resource_referenced = u_is_resource_referenced_vtbl; svga->pipe.get_transfer = u_get_transfer_vtbl; svga->pipe.transfer_map = u_transfer_map_vtbl; svga->pipe.transfer_flush_region = u_transfer_flush_region_vtbl; diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index b24af32921..99b419178b 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -84,7 +84,7 @@ svga_get_name( struct pipe_screen *pscreen ) static float -svga_get_paramf(struct pipe_screen *screen, int param) +svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { struct svga_screen *svgascreen = svga_screen(screen); struct svga_winsys_screen *sws = svgascreen->sws; @@ -134,6 +134,8 @@ svga_get_paramf(struct pipe_screen *screen, int param) return MIN2(result.u, PIPE_MAX_COLOR_BUFS); case PIPE_CAP_OCCLUSION_QUERY: return 1; + case PIPE_CAP_TIMER_QUERY: + return 0; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; @@ -177,6 +179,57 @@ svga_get_paramf(struct pipe_screen *screen, int param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: return 0; + /* + * Fragment shader limits + */ + + case PIPE_CAP_MAX_FS_INSTRUCTIONS: + case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS: + case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS: + case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS: + return svgascreen->use_ps30 ? 512 : 96; + case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH: + return SVGA3D_MAX_NESTING_LEVEL; + case PIPE_CAP_MAX_FS_INPUTS: + return 10; + case PIPE_CAP_MAX_FS_CONSTS: + return svgascreen->use_vs30 ? 224 : 16; + case PIPE_CAP_MAX_FS_TEMPS: + if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result)) + return svgascreen->use_ps30 ? 32 : 12; + return result.u; + case PIPE_CAP_MAX_FS_ADDRS: + return svgascreen->use_ps30 ? 1 : 0; + case PIPE_CAP_MAX_FS_PREDS: + return svgascreen->use_ps30 ? 1 : 0; + + /* + * Vertex shader limits + */ + case PIPE_CAP_MAX_VS_INSTRUCTIONS: + case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS: + if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result)) + return svgascreen->use_vs30 ? 512 : 256; + return result.u; + case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS: + case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS: + /* XXX: until we have vertex texture support */ + return 0; + case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH: + return SVGA3D_MAX_NESTING_LEVEL; + case PIPE_CAP_MAX_VS_INPUTS: + return 16; + case PIPE_CAP_MAX_VS_CONSTS: + return 256; + case PIPE_CAP_MAX_VS_TEMPS: + if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result)) + return svgascreen->use_vs30 ? 32 : 12; + return result.u; + case PIPE_CAP_MAX_VS_ADDRS: + return svgascreen->use_vs30 ? 1 : 0; + case PIPE_CAP_MAX_VS_PREDS: + return svgascreen->use_vs30 ? 1 : 0; + default: return 0; } @@ -186,7 +239,7 @@ svga_get_paramf(struct pipe_screen *screen, int param) /* This is a fairly pointless interface */ static int -svga_get_param(struct pipe_screen *screen, int param) +svga_get_param(struct pipe_screen *screen, enum pipe_cap param) { return (int) svga_get_paramf( screen, param ); } diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c index 1310fd9825..ad6f294713 100644 --- a/src/gallium/drivers/svga/svga_state_fs.c +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -131,8 +131,7 @@ static int make_fs_key( const struct svga_context *svga, /* SVGA_NEW_RAST */ key->light_twoside = svga->curr.rast->templ.light_twoside; - key->front_cw = (svga->curr.rast->templ.front_winding == - PIPE_WINDING_CW); + key->front_ccw = svga->curr.rast->templ.front_ccw; } /* The blend workaround for simulating logicop xor behaviour diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c index b7195d246b..ab13f3fdf1 100644 --- a/src/gallium/drivers/svga/svga_state_rss.c +++ b/src/gallium/drivers/svga/svga_state_rss.c @@ -146,13 +146,13 @@ static int emit_rss( struct svga_context *svga, * then our definition of front face agrees with hardware. * Otherwise need to flip. */ - if (rast->templ.front_winding == PIPE_WINDING_CW) { - cw = 0; - ccw = 1; + if (rast->templ.front_ccw) { + ccw = 0; + cw = 1; } else { - cw = 1; - ccw = 0; + ccw = 1; + cw = 0; } /* Twoside stencil diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c index bd2cc38004..b21dc5fd9a 100644 --- a/src/gallium/drivers/svga/svga_surface.c +++ b/src/gallium/drivers/svga/svga_surface.c @@ -37,7 +37,6 @@ #include "svga_context.h" #include "svga_resource_texture.h" #include "svga_surface.h" -#include "svga_winsys.h" #include "svga_debug.h" diff --git a/src/gallium/drivers/svga/svga_swtnl.h b/src/gallium/drivers/svga/svga_swtnl.h index 8724690f7e..65c675f99c 100644 --- a/src/gallium/drivers/svga/svga_swtnl.h +++ b/src/gallium/drivers/svga/svga_swtnl.h @@ -30,7 +30,6 @@ struct svga_context; struct pipe_context; -struct pipe_buffer; struct vbuf_render; diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c index b0cbead8a5..ff3da84272 100644 --- a/src/gallium/drivers/svga/svga_swtnl_backend.c +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -240,9 +240,9 @@ svga_vbuf_render_draw_arrays( struct vbuf_render *render, static void -svga_vbuf_render_draw( struct vbuf_render *render, - const ushort *indices, - uint nr_indices) +svga_vbuf_render_draw_elements( struct vbuf_render *render, + const ushort *indices, + uint nr_indices) { struct svga_vbuf_render *svga_render = svga_vbuf_render(render); struct svga_context *svga = svga_render->svga; @@ -341,7 +341,7 @@ svga_vbuf_render_create( struct svga_context *svga ) svga_render->base.map_vertices = svga_vbuf_render_map_vertices; svga_render->base.unmap_vertices = svga_vbuf_render_unmap_vertices; svga_render->base.set_primitive = svga_vbuf_render_set_primitive; - svga_render->base.draw = svga_vbuf_render_draw; + svga_render->base.draw_elements = svga_vbuf_render_draw_elements; svga_render->base.draw_arrays = svga_vbuf_render_draw_arrays; svga_render->base.release_vertices = svga_vbuf_render_release_vertices; svga_render->base.destroy = svga_vbuf_render_destroy; diff --git a/src/gallium/drivers/svga/svga_tgsi.h b/src/gallium/drivers/svga/svga_tgsi.h index 063c9cf422..7ea909c37b 100644 --- a/src/gallium/drivers/svga/svga_tgsi.h +++ b/src/gallium/drivers/svga/svga_tgsi.h @@ -48,7 +48,7 @@ struct svga_vs_compile_key struct svga_fs_compile_key { unsigned light_twoside:1; - unsigned front_cw:1; + unsigned front_ccw:1; unsigned white_fragments:1; unsigned num_textures:8; unsigned num_unnormalized_coords:8; diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 7d7024c4a7..67e1f22a70 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -2588,10 +2588,10 @@ static boolean emit_light_twoside( struct svga_shader_emitter *emit ) if_token = inst_token( SVGA3DOP_IFC ); - if (emit->key.fkey.front_cw) - if_token.control = SVGA3DOPCOMP_GT; - else + if (emit->key.fkey.front_ccw) if_token.control = SVGA3DOPCOMP_LT; + else + if_token.control = SVGA3DOPCOMP_GT; zero = scalar(zero, TGSI_SWIZZLE_X); @@ -2639,12 +2639,12 @@ static boolean emit_frontface( struct svga_shader_emitter *emit ) temp = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); - if (emit->key.fkey.front_cw) { - pass = scalar( zero, TGSI_SWIZZLE_W ); - fail = scalar( zero, TGSI_SWIZZLE_X ); - } else { + if (emit->key.fkey.front_ccw) { pass = scalar( zero, TGSI_SWIZZLE_X ); fail = scalar( zero, TGSI_SWIZZLE_W ); + } else { + pass = scalar( zero, TGSI_SWIZZLE_W ); + fail = scalar( zero, TGSI_SWIZZLE_X ); } if (!emit_conditional(emit, PIPE_FUNC_GREATER, |