struct draw_llvm;
struct llvm_vertex_shader;
struct llvm_geometry_shader;
+struct llvm_tess_ctrl_shader;
+struct llvm_tess_eval_shader;
struct draw_jit_texture
{
unsigned clip_halfz:1;
unsigned bypass_viewport:1;
unsigned need_edgeflags:1;
- unsigned has_gs:1;
+ unsigned has_gs_or_tes:1;
unsigned num_outputs:8;
unsigned ucp_enable:PIPE_MAX_CLIP_PLANES;
/* note padding here - must use memset */
/* Followed by variable number of images.*/
};
+struct draw_tcs_llvm_variant_key
+{
+ unsigned nr_samplers:8;
+ unsigned nr_sampler_views:8;
+ unsigned nr_images:8;
+ struct draw_sampler_static_state samplers[1];
+ /* Followed by variable number of images.*/
+};
+
+struct draw_tes_llvm_variant_key
+{
+ unsigned nr_samplers:8;
+ unsigned nr_sampler_views:8;
+ unsigned nr_images:8;
+ struct draw_sampler_static_state samplers[1];
+ /* Followed by variable number of images.*/
+};
+
#define DRAW_LLVM_MAX_VARIANT_KEY_SIZE \
(sizeof(struct draw_llvm_variant_key) + \
PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state) + \
PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+#define DRAW_TCS_LLVM_MAX_VARIANT_KEY_SIZE \
+ (sizeof(struct draw_tcs_llvm_variant_key) + \
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+
+#define DRAW_TES_LLVM_MAX_VARIANT_KEY_SIZE \
+ (sizeof(struct draw_tes_llvm_variant_key) + \
+ PIPE_MAX_SHADER_IMAGES * sizeof(struct draw_image_static_state) + \
+ PIPE_MAX_SHADER_SAMPLER_VIEWS * sizeof(struct draw_sampler_static_state))
+
static inline size_t
draw_llvm_variant_key_size(unsigned nr_vertex_elements,
(nr_samplers - 1) * sizeof(struct draw_sampler_static_state));
}
+static inline size_t
+draw_tcs_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images)
+{
+ return (sizeof(struct draw_tcs_llvm_variant_key) +
+ (nr_images) * sizeof(struct draw_sampler_static_state) +
+ (nr_samplers - 1) * sizeof(struct draw_sampler_static_state));
+}
+
+static inline size_t
+draw_tes_llvm_variant_key_size(unsigned nr_samplers, unsigned nr_images)
+{
+ return (sizeof(struct draw_tes_llvm_variant_key) +
+ (nr_images) * sizeof(struct draw_sampler_static_state) +
+ (nr_samplers - 1) * sizeof(struct draw_sampler_static_state));
+}
static inline struct draw_sampler_static_state *
draw_llvm_variant_key_samplers(struct draw_llvm_variant_key *key)
&key->samplers[key->nr_samplers];
}
+static inline struct draw_image_static_state *
+draw_tcs_llvm_variant_key_images(struct draw_tcs_llvm_variant_key *key)
+{
+ return (struct draw_image_static_state *)
+ &key->samplers[key->nr_samplers];
+}
+
+static inline struct draw_image_static_state *
+draw_tes_llvm_variant_key_images(struct draw_tes_llvm_variant_key *key)
+{
+ return (struct draw_image_static_state *)
+ &key->samplers[key->nr_samplers];
+}
+
struct draw_llvm_variant_list_item
{
struct draw_llvm_variant *base;
struct draw_gs_llvm_variant_list_item *next, *prev;
};
+struct draw_tcs_llvm_variant_list_item
+{
+ struct draw_tcs_llvm_variant *base;
+ struct draw_tcs_llvm_variant_list_item *next, *prev;
+};
+
+struct draw_tes_llvm_variant_list_item
+{
+ struct draw_tes_llvm_variant *base;
+ struct draw_tes_llvm_variant_list_item *next, *prev;
+};
struct draw_llvm_variant
{
struct draw_gs_llvm_variant_key key;
};
+struct draw_tcs_llvm_variant
+{
+ struct gallivm_state *gallivm;
+
+ /* LLVM JIT builder types */
+ LLVMTypeRef context_ptr_type;
+ LLVMTypeRef input_array_type;
+ LLVMTypeRef output_array_type;
+
+ LLVMValueRef context_ptr;
+ LLVMValueRef io_ptr;
+ LLVMValueRef num_prims;
+ LLVMValueRef function;
+ draw_tcs_jit_func jit_func;
+
+ struct llvm_tess_ctrl_shader *shader;
+
+ struct draw_llvm *llvm;
+ struct draw_tcs_llvm_variant_list_item list_item_global;
+ struct draw_tcs_llvm_variant_list_item list_item_local;
+
+ /* key is variable-sized, must be last */
+ struct draw_tcs_llvm_variant_key key;
+};
+
+struct draw_tes_llvm_variant
+{
+ struct gallivm_state *gallivm;
+
+ /* LLVM JIT builder types */
+ LLVMTypeRef context_ptr_type;
+ LLVMTypeRef vertex_header_ptr_type;
+ LLVMTypeRef input_array_type;
+ LLVMTypeRef patch_input_array_type;
+
+ LLVMValueRef context_ptr;
+ LLVMValueRef io_ptr;
+ LLVMValueRef num_prims;
+ LLVMValueRef function;
+ draw_tes_jit_func jit_func;
+
+ struct llvm_tess_eval_shader *shader;
+
+ struct draw_llvm *llvm;
+ struct draw_tes_llvm_variant_list_item list_item_global;
+ struct draw_tes_llvm_variant_list_item list_item_local;
+
+ /* key is variable-sized, must be last */
+ struct draw_tes_llvm_variant_key key;
+};
+
struct llvm_vertex_shader {
struct draw_vertex_shader base;
unsigned variants_cached;
};
+struct llvm_tess_ctrl_shader {
+ struct draw_tess_ctrl_shader base;
+
+ unsigned variant_key_size;
+ struct draw_tcs_llvm_variant_list_item variants;
+ unsigned variants_created;
+ unsigned variants_cached;
+};
+
+struct llvm_tess_eval_shader {
+ struct draw_tess_eval_shader base;
+
+ unsigned variant_key_size;
+ struct draw_tes_llvm_variant_list_item variants;
+ unsigned variants_created;
+ unsigned variants_cached;
+};
struct draw_llvm {
struct draw_context *draw;
struct draw_jit_context jit_context;
struct draw_gs_jit_context gs_jit_context;
+ struct draw_tcs_jit_context tcs_jit_context;
+ struct draw_tes_jit_context tes_jit_context;
struct draw_llvm_variant_list_item vs_variants_list;
int nr_variants;
struct draw_gs_llvm_variant_list_item gs_variants_list;
int nr_gs_variants;
+
+ struct draw_tcs_llvm_variant_list_item tcs_variants_list;
+ int nr_tcs_variants;
+
+ struct draw_tes_llvm_variant_list_item tes_variants_list;
+ int nr_tes_variants;
};
return (struct llvm_geometry_shader *)gs;
}
+static inline struct llvm_tess_ctrl_shader *
+llvm_tess_ctrl_shader(struct draw_tess_ctrl_shader *tcs)
+{
+ return (struct llvm_tess_ctrl_shader *)tcs;
+}
-
+static inline struct llvm_tess_eval_shader *
+llvm_tess_eval_shader(struct draw_tess_eval_shader *tes)
+{
+ return (struct llvm_tess_eval_shader *)tes;
+}
struct draw_llvm *
draw_llvm_create(struct draw_context *draw, LLVMContextRef llvm_context);
void
draw_gs_llvm_dump_variant_key(struct draw_gs_llvm_variant_key *key);
+struct draw_tcs_llvm_variant *
+draw_tcs_llvm_create_variant(struct draw_llvm *llvm,
+ unsigned num_vertex_header_attribs,
+ const struct draw_tcs_llvm_variant_key *key);
+
+void
+draw_tcs_llvm_destroy_variant(struct draw_tcs_llvm_variant *variant);
+
+struct draw_tcs_llvm_variant_key *
+draw_tcs_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
+
+void
+draw_tcs_llvm_dump_variant_key(struct draw_tcs_llvm_variant_key *key);
+
+struct draw_tes_llvm_variant *
+draw_tes_llvm_create_variant(struct draw_llvm *llvm,
+ unsigned num_vertex_header_attribs,
+ const struct draw_tes_llvm_variant_key *key);
+
+void
+draw_tes_llvm_destroy_variant(struct draw_tes_llvm_variant *variant);
+
+struct draw_tes_llvm_variant_key *
+draw_tes_llvm_make_variant_key(struct draw_llvm *llvm, char *store);
+
+void
+draw_tes_llvm_dump_variant_key(struct draw_tes_llvm_variant_key *key);
+
struct lp_build_sampler_soa *
draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_state);