Home | History | Annotate | Download | only in draw

Lines Matching defs:gallivm

33 #include "gallivm/lp_bld_arit.h"
34 #include "gallivm/lp_bld_logic.h"
35 #include "gallivm/lp_bld_const.h"
36 #include "gallivm/lp_bld_swizzle.h"
37 #include "gallivm/lp_bld_struct.h"
38 #include "gallivm/lp_bld_type.h"
39 #include "gallivm/lp_bld_flow.h"
40 #include "gallivm/lp_bld_debug.h"
41 #include "gallivm/lp_bld_tgsi.h"
42 #include "gallivm/lp_bld_printf.h"
43 #include "gallivm/lp_bld_intr.h"
44 #include "gallivm/lp_bld_init.h"
45 #include "gallivm/lp_bld_type.h"
46 #include "gallivm/lp_bld_pack.h"
47 #include "gallivm/lp_bld_format.h"
70 create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
72 LLVMTargetDataRef target = gallivm->target;
75 LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
86 LLVMArrayType(LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0),
90 elem_types[DRAW_JIT_TEXTURE_LOD_BIAS] = LLVMFloatTypeInContext(gallivm->context);
92 LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
94 texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
98 LLVMAddTypeName(gallivm->module, struct_name, texture_type);
103 LLVMInvalidateStructLayout(gallivm->target, texture_type);
153 create_jit_context_type(struct gallivm_state *gallivm,
156 LLVMTargetDataRef target = gallivm->target;
157 LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
168 context_type = LLVMStructTypeInContext(gallivm->context, elem_types,
171 LLVMAddTypeName(gallivm->module, struct_name, context_type);
173 LLVMInvalidateStructLayout(gallivm->target, context_type);
196 create_jit_vertex_buffer_type(struct gallivm_state *gallivm, const char *struct_name)
198 LLVMTargetDataRef target = gallivm->target;
203 elem_types[1] = LLVMInt32TypeInContext(gallivm->context);
205 elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */
207 vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
210 LLVMAddTypeName(gallivm->module, struct_name, vb_type);
212 LLVMInvalidateStructLayout(gallivm->target, vb_type);
230 create_jit_vertex_header(struct gallivm_state *gallivm, int data_elems)
232 LLVMTargetDataRef target = gallivm->target;
239 elem_types[DRAW_JIT_VERTEX_VERTEX_ID] = LLVMIntTypeInContext(gallivm->context, 32);
240 elem_types[DRAW_JIT_VERTEX_CLIP] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
241 elem_types[DRAW_JIT_VERTEX_PRE_CLIP_POS] = LLVMArrayType(LLVMFloatTypeInContext(gallivm->context), 4);
244 vertex_header = LLVMStructTypeInContext(gallivm->context, elem_types,
247 LLVMAddTypeName(gallivm->module, struct_name, vertex_header);
249 LLVMInvalidateStructLayout(gallivm->target, vertex_header);
289 struct gallivm_state *gallivm = variant->gallivm;
292 texture_type = create_jit_texture_type(gallivm, "texture");
294 context_type = create_jit_context_type(gallivm, texture_type, "draw_jit_context");
297 buffer_type = LLVMPointerType(LLVMIntTypeInContext(gallivm->context, 8), 0);
300 vb_type = create_jit_vertex_buffer_type(gallivm, "pipe_vertex_buffer");
395 variant->gallivm = gallivm_create();
401 vertex_header = create_jit_vertex_header(variant->gallivm, num_inputs);
408 gallivm_compile_module(variant->gallivm);
411 gallivm_jit_function(variant->gallivm, variant->function);
414 gallivm_jit_function(variant->gallivm, variant->function_elts);
439 LLVMValueRef consts_ptr = draw_jit_context_vs_constants(variant->gallivm, context_ptr);
449 lp_build_tgsi_soa(variant->gallivm,
466 lp_build_context_init(&bld, variant->gallivm, vs_type);
495 generate_fetch(struct gallivm_state *gallivm,
504 LLVMValueRef zero = LLVMConstNull(LLVMInt32TypeInContext(gallivm->context));
505 LLVMBuilderRef builder = gallivm->builder;
507 LLVMConstInt(LLVMInt64TypeInContext(gallivm->context),
511 LLVMValueRef vb_stride = draw_jit_vbuffer_stride(gallivm, vbuf);
512 LLVMValueRef vb_buffer_offset = draw_jit_vbuffer_offset(gallivm, vbuf);
518 lp_build_const_int32(gallivm, velem->instance_divisor),
530 lp_build_const_int32(gallivm, velem->src_offset),
533 /* lp_build_printf(gallivm, "vbuf index = %d, stride is %d\n", indices, stride);*/
536 *res = lp_build_fetch_rgba_aos(gallivm,
544 convert_to_soa(struct gallivm_state *gallivm,
570 aos_channels[j] = lp_build_concat(gallivm, channel, aos_channel_type, pixels_per_channel);
573 lp_build_transpose_aos(gallivm, soa_type, aos_channels, dst_soa[i]);
579 store_aos(struct gallivm_state *gallivm,
584 LLVMTypeRef data_ptr_type = LLVMPointerType(lp_build_vec_type(gallivm, lp_float32_vec4_type()), 0);
585 LLVMBuilderRef builder = gallivm->builder;
586 LLVMValueRef data_ptr = draw_jit_header_data(gallivm, io_ptr);
589 indices[0] = lp_build_const_int32(gallivm, 0);
591 indices[2] = lp_build_const_int32(gallivm, 0);
594 lp_build_printf(gallivm, " ---- %p storing attribute %d (io = %p)\n", data_ptr, index, io_ptr);
606 store_aos_array(struct gallivm_state *gallivm,
615 LLVMBuilderRef builder = gallivm->builder;
616 LLVMValueRef attr_index = lp_build_const_int32(gallivm, attrib);
625 inds[i] = lp_build_const_int32(gallivm, i);
642 val = lp_build_const_int_vec(gallivm, lp_int_type(soa_type), vertex_id_pad_edgeflag);
646 LLVMValueRef id_ptr = draw_jit_header_id(gallivm, io_ptrs[i]);
650 lp_build_printf(gallivm, "io = %p, index %d\n, clipmask = %x\n",
658 store_aos(gallivm, io_ptrs[i], attr_index, aos[i]);
664 convert_to_aos(struct gallivm_state *gallivm,
672 LLVMBuilderRef builder = gallivm->builder;
676 lp_build_printf(gallivm, " # storing begin\n");
686 lp_build_printf(gallivm, "output %d : %d ",
687 LLVMConstInt(LLVMInt32TypeInContext(gallivm->context),
689 LLVMConstInt(LLVMInt32TypeInContext(gallivm->context),
691 lp_build_print_value(gallivm, "val = ", out);
702 lp_build_transpose_aos(gallivm, soa_type, soa, aos);
704 lp_build_transpose_aos(gallivm, soa_type, soa, soa);
707 aos[i] = lp_build_extract_range(gallivm,
714 store_aos_array(gallivm,
723 lp_build_printf(gallivm, " # storing end\n");
732 store_clip(struct gallivm_state *gallivm,
738 LLVMBuilderRef builder = gallivm->builder;
748 indices[1] = lp_build_const_int32(gallivm, 0);
751 inds[i] = lp_build_const_int32(gallivm, i);
762 clip_ptrs[i] = draw_jit_header_clip(gallivm, io_ptrs[i]);
766 clip_ptrs[i] = draw_jit_header_pre_clip_pos(gallivm, io_ptrs[i]);
770 lp_build_transpose_aos(gallivm, vs_type, soa, soa);
772 aos[i] = lp_build_extract_range(gallivm,
779 LLVMTypeRef clip_ptr_type = LLVMPointerType(LLVMVectorType(LLVMFloatTypeInContext(gallivm->context), 4), 0);
802 struct gallivm_state *gallivm = variant->gallivm;
804 LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
806 LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0); /*1.0 1.0 1.0 1.0*/
807 LLVMValueRef vp_ptr = draw_jit_context_viewport(gallivm, context_ptr);
822 index = lp_build_const_int32(gallivm, i);
825 index = lp_build_const_int32(gallivm, i+4);
828 scale = lp_build_broadcast(gallivm, vs_type_llvm,
830 trans = lp_build_broadcast(gallivm, vs_type_llvm,
852 struct gallivm_state *gallivm,
863 LLVMBuilderRef builder = gallivm->builder;
884 mask = lp_build_const_int_vec(gallivm, i32_type, 0);
885 temp = lp_build_const_int_vec(gallivm, i32_type, 0);
886 zero = lp_build_const_vec(gallivm, f32_type, 0); /* 0.0f 0.0f 0.0f 0.0f */
887 shift = lp_build_const_int_vec(gallivm, i32_type, 1); /* 1 1 1 1 */
913 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
920 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
926 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_y, pos_w);
933 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
940 temp = lp_build_const_int_vec(gallivm, i32_type, 16);
943 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
950 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
955 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_z, pos_w);
962 LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr);
982 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, clipdist);
983 temp = lp_build_const_int_vec(gallivm, i32_type, 1 << plane_idx);
987 LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
988 indices[0] = lp_build_const_int32(gallivm, 0);
989 indices[1] = lp_build_const_int32(gallivm, plane_idx);
991 indices[2] = lp_build_const_int32(gallivm, 0);
994 planes = lp_build_broadcast(gallivm, vs_type_llvm, plane1);
997 indices[2] = lp_build_const_int32(gallivm, 1);
1000 planes = lp_build_broadcast(gallivm, vs_type_llvm, plane1);
1004 indices[2] = lp_build_const_int32(gallivm, 2);
1007 planes = lp_build_broadcast(gallivm, vs_type_llvm, plane1);
1011 indices[2] = lp_build_const_int32(gallivm, 3);
1014 planes = lp_build_broadcast(gallivm, vs_type_llvm, plane1);
1018 test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, sum);
1019 temp = lp_build_const_int_vec(gallivm, i32_type, 1 << plane_idx);
1034 clipmask_booli32(struct gallivm_state *gallivm,
1038 LLVMBuilderRef builder = gallivm->builder;
1039 LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
1051 lp_build_const_int32(gallivm, i) , "");
1062 struct gallivm_state *gallivm = variant->gallivm;
1063 LLVMContextRef context = gallivm->context;
1075 LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
1076 LLVMValueRef one = lp_build_const_int32(gallivm, 1);
1113 variant_func = LLVMAddFunction(gallivm->module,
1161 block = LLVMAppendBasicBlockInContext(gallivm->context, variant_func, "entry");
1162 builder = gallivm->builder;
1165 lp_build_context_init(&bld, gallivm, lp_type_int(32));
1175 clipmask_bool_ptr = lp_build_alloca(gallivm, lp_build_int_vec_type(gallivm, vs_type), "");
1176 LLVMBuildStore(builder, lp_build_zero(gallivm, lp_int_type(vs_type)), clipmask_bool_ptr);
1191 step = lp_build_const_int32(gallivm, vector_length);
1195 lp_build_loop_begin(&lp_loop, gallivm, start);
1210 lp_build_printf(gallivm, " --- io %d = %p, loop counter %d\n",
1213 system_values.vertex_id = lp_build_zero(gallivm, lp_type_uint_vec(32, 32*vector_length));
1218 lp_build_const_int32(gallivm, i), "");
1232 system_values.vertex_id = LLVMBuildInsertElement(gallivm->builder,
1234 lp_build_const_int32(gallivm, i), "");
1238 lp_build_const_int32(gallivm, velem->vertex_buffer_index);
1240 generate_fetch(gallivm, vbuffers_ptr,
1245 convert_to_soa(gallivm, aos_attribs, inputs,
1260 store_clip(gallivm, vs_type, io, outputs, 0, cv);
1261 store_clip(gallivm, vs_type, io, outputs, 1, pos);
1268 gallivm,
1282 clipmask = lp_build_const_int_vec(gallivm, lp_int_type(vs_type), 0);
1294 convert_to_aos(gallivm, io, outputs, clipmask,
1304 ret = clipmask_booli32(gallivm, vs_type, clipmask_bool_ptr);
1308 gallivm_verify_function(gallivm, variant_func);
1418 gallivm_free_function(variant->gallivm,
1423 gallivm_free_function(variant->gallivm,
1427 gallivm_destroy(variant->gallivm);