diff options
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_shader.h')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_shader.h | 182 |
1 files changed, 3 insertions, 179 deletions
diff --git a/src/gallium/drivers/ilo/ilo_shader.h b/src/gallium/drivers/ilo/ilo_shader.h index 9318785adbd..f286a9f785f 100644 --- a/src/gallium/drivers/ilo/ilo_shader.h +++ b/src/gallium/drivers/ilo/ilo_shader.h @@ -29,145 +29,11 @@ #define ILO_SHADER_H #include "ilo_common.h" -#include "ilo_context.h" +struct intel_bo; +struct ilo_context; struct ilo_shader_cache; - -/* XXX The interface needs to be reworked */ - -/** - * A shader variant. It consists of non-orthogonal states of the pipe context - * affecting the compilation of a shader. - */ -struct ilo_shader_variant { - union { - struct { - bool rasterizer_discard; - int num_ucps; - } vs; - - struct { - bool rasterizer_discard; - int num_inputs; - int semantic_names[PIPE_MAX_SHADER_INPUTS]; - int semantic_indices[PIPE_MAX_SHADER_INPUTS]; - } gs; - - struct { - bool flatshade; - int fb_height; - int num_cbufs; - } fs; - } u; - - int num_sampler_views; - struct { - unsigned r:3; - unsigned g:3; - unsigned b:3; - unsigned a:3; - } sampler_view_swizzles[ILO_MAX_SAMPLER_VIEWS]; - - uint32_t saturate_tex_coords[3]; -}; - -/** - * A compiled shader. - */ -struct ilo_shader { - struct ilo_shader_variant variant; - - struct { - int semantic_names[PIPE_MAX_SHADER_INPUTS]; - int semantic_indices[PIPE_MAX_SHADER_INPUTS]; - int interp[PIPE_MAX_SHADER_INPUTS]; - bool centroid[PIPE_MAX_SHADER_INPUTS]; - int count; - - int start_grf; - bool has_pos; - bool has_linear_interp; - int barycentric_interpolation_mode; - bool discard_adj; - } in; - - struct { - int register_indices[PIPE_MAX_SHADER_OUTPUTS]; - int semantic_names[PIPE_MAX_SHADER_OUTPUTS]; - int semantic_indices[PIPE_MAX_SHADER_OUTPUTS]; - int count; - - bool has_pos; - } out; - - bool has_kill; - bool dispatch_16; - - bool stream_output; - int svbi_post_inc; - /* for VS stream output / rasterizer discard */ - int gs_offsets[3]; - int gs_start_grf; - - void *kernel; - int kernel_size; - - /* what does the push constant buffer consist of? */ - struct { - int clip_state_size; - } pcb; - - struct list_head list; - - /* managed by shader cache */ - bool uploaded; - uint32_t cache_offset; -}; - -/** - * Information about a shader state. - */ -struct ilo_shader_info { - const struct ilo_dev_info *dev; - int type; - - const struct tgsi_token *tokens; - - struct pipe_stream_output_info stream_output; - struct { - unsigned req_local_mem; - unsigned req_private_mem; - unsigned req_input_mem; - } compute; - - bool has_color_interp; - bool has_pos; - bool has_vertexid; - bool has_instanceid; - bool fs_color0_writes_all_cbufs; - - int edgeflag_in; - int edgeflag_out; - - uint32_t shadow_samplers; - int num_samplers; -}; - -/** - * A shader state. - */ -struct ilo_shader_state { - struct ilo_shader_info info; - - struct list_head variants; - int num_variants, total_size; - - struct ilo_shader *shader; - - /* managed by shader cache */ - struct ilo_shader_cache *cache; - struct list_head list; -}; +struct ilo_shader_state; struct ilo_shader_cache * ilo_shader_cache_create(void); @@ -188,11 +54,6 @@ ilo_shader_cache_upload(struct ilo_shader_cache *shc, struct intel_bo *bo, unsigned offset, bool incremental); -void -ilo_shader_variant_init(struct ilo_shader_variant *variant, - const struct ilo_shader_info *info, - const struct ilo_context *ilo); - struct ilo_shader_state * ilo_shader_state_create(const struct ilo_context *ilo, int type, const void *templ); @@ -200,41 +61,4 @@ ilo_shader_state_create(const struct ilo_context *ilo, void ilo_shader_state_destroy(struct ilo_shader_state *state); -struct ilo_shader * -ilo_shader_state_add_variant(struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -bool -ilo_shader_state_use_variant(struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -struct ilo_shader * -ilo_shader_compile_vs(const struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -struct ilo_shader * -ilo_shader_compile_gs(const struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -bool -ilo_shader_compile_gs_passthrough(const struct ilo_shader_state *vs_state, - const struct ilo_shader_variant *vs_variant, - const int *so_mapping, - struct ilo_shader *vs); - -struct ilo_shader * -ilo_shader_compile_fs(const struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -struct ilo_shader * -ilo_shader_compile_cs(const struct ilo_shader_state *state, - const struct ilo_shader_variant *variant); - -static inline void -ilo_shader_destroy(struct ilo_shader *sh) -{ - FREE(sh->kernel); - FREE(sh); -} - #endif /* ILO_SHADER_H */ |