diff options
author | Tim Rowley <[email protected]> | 2017-03-02 16:41:02 -0600 |
---|---|---|
committer | Tim Rowley <[email protected]> | 2017-03-05 07:33:49 -0600 |
commit | f1d728411726fd0bc5baf9746e838f609900836e (patch) | |
tree | 14b54416bb159b66a71624042b66ae75faba318e /src/gallium/drivers/swr/swr_state.h | |
parent | 08a82363ba7c281a1b3d7f6dbe6946860ee68e38 (diff) |
swr: implement geometry shaders
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/swr_state.h')
-rw-r--r-- | src/gallium/drivers/swr/swr_state.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/swr_state.h b/src/gallium/drivers/swr/swr_state.h index 202f16547f9..c89e303ba33 100644 --- a/src/gallium/drivers/swr/swr_state.h +++ b/src/gallium/drivers/swr/swr_state.h @@ -48,6 +48,7 @@ struct ShaderVariant { typedef ShaderVariant<PFN_VERTEX_FUNC> VariantVS; typedef ShaderVariant<PFN_PIXEL_KERNEL> VariantFS; +typedef ShaderVariant<PFN_GS_FUNC> VariantGS; /* skeleton */ struct swr_vertex_shader { @@ -67,6 +68,14 @@ struct swr_fragment_shader { std::unordered_map<swr_jit_fs_key, std::unique_ptr<VariantFS>> map; }; +struct swr_geometry_shader { + struct pipe_shader_state pipe; + struct lp_tgsi_info info; + SWR_GS_STATE gsState; + + std::unordered_map<swr_jit_gs_key, std::unique_ptr<VariantGS>> map; +}; + /* Vertex element state */ struct swr_vertex_element_state { FETCH_COMPILE_STATE fsState; @@ -321,4 +330,45 @@ swr_convert_target_type(const enum pipe_texture_target target) return SURFACE_NULL; } } + +/* + * Convert mesa PIPE_PRIM_X to SWR enum PRIMITIVE_TOPOLOGY + */ +static INLINE enum PRIMITIVE_TOPOLOGY +swr_convert_prim_topology(const unsigned mode) +{ + switch (mode) { + case PIPE_PRIM_POINTS: + return TOP_POINT_LIST; + case PIPE_PRIM_LINES: + return TOP_LINE_LIST; + case PIPE_PRIM_LINE_LOOP: + return TOP_LINE_LOOP; + case PIPE_PRIM_LINE_STRIP: + return TOP_LINE_STRIP; + case PIPE_PRIM_TRIANGLES: + return TOP_TRIANGLE_LIST; + case PIPE_PRIM_TRIANGLE_STRIP: + return TOP_TRIANGLE_STRIP; + case PIPE_PRIM_TRIANGLE_FAN: + return TOP_TRIANGLE_FAN; + case PIPE_PRIM_QUADS: + return TOP_QUAD_LIST; + case PIPE_PRIM_QUAD_STRIP: + return TOP_QUAD_STRIP; + case PIPE_PRIM_POLYGON: + return TOP_TRIANGLE_FAN; /* XXX TOP_POLYGON; */ + case PIPE_PRIM_LINES_ADJACENCY: + return TOP_LINE_LIST_ADJ; + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + return TOP_LISTSTRIP_ADJ; + case PIPE_PRIM_TRIANGLES_ADJACENCY: + return TOP_TRI_LIST_ADJ; + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + return TOP_TRI_STRIP_ADJ; + default: + assert(0 && "Unknown topology"); + return TOP_UNKNOWN; + } +}; #endif |