lp_build_context_init(&bld, llvm->gallivm, vs_type);
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
lp_build_context_init(&bld, llvm->gallivm, vs_type);
for (attrib = 0; attrib < info->num_outputs; ++attrib) {
switch (info->output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
case TGSI_SEMANTIC_BCOLOR:
switch (info->output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
case TGSI_SEMANTIC_BCOLOR:
static void
generate_fetch(struct gallivm_state *gallivm,
LLVMValueRef vbuffers_ptr,
static void
generate_fetch(struct gallivm_state *gallivm,
LLVMValueRef vbuffers_ptr,
static void
soa_to_aos(struct gallivm_state *gallivm,
LLVMValueRef soa[NUM_CHANNELS],
static void
soa_to_aos(struct gallivm_state *gallivm,
LLVMValueRef soa[NUM_CHANNELS],
static void
convert_to_soa(struct gallivm_state *gallivm,
LLVMValueRef (*aos)[NUM_CHANNELS],
static void
convert_to_soa(struct gallivm_state *gallivm,
LLVMValueRef (*aos)[NUM_CHANNELS],
store_aos(gallivm, io3_ptr, attr_index, aos[3], clipmask3);
}
store_aos(gallivm, io3_ptr, attr_index, aos[3], clipmask3);
}
LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
lp_build_name(out, "output%u.%c", attrib, "xyzw"[chan]);
/*lp_build_printf(builder, "output %d : %d ",
LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
lp_build_name(out, "output%u.%c", attrib, "xyzw"[chan]);
/*lp_build_printf(builder, "output %d : %d ",
LLVMConstInt(LLVMInt32Type(), chan, 0));
print_vectorf(builder, out);*/
soa[chan] = out;
LLVMConstInt(LLVMInt32Type(), chan, 0));
print_vectorf(builder, out);*/
soa[chan] = out;
* Stores original vertex positions in clip coordinates
* There is probably a more efficient way to do this, 4 floats at once
* rather than extracting each element one by one.
* Stores original vertex positions in clip coordinates
* There is probably a more efficient way to do this, 4 floats at once
* rather than extracting each element one by one.
clip_ptr2 = draw_jit_header_clip(gallivm, io2_ptr);
clip_ptr3 = draw_jit_header_clip(gallivm, io3_ptr);
clip_ptr2 = draw_jit_header_clip(gallivm, io2_ptr);
clip_ptr3 = draw_jit_header_clip(gallivm, io3_ptr);
clip0_ptr = LLVMBuildGEP(builder, clip_ptr0, indices, 2, ""); /* x0 */
clip1_ptr = LLVMBuildGEP(builder, clip_ptr1, indices, 2, ""); /* x1 */
clip2_ptr = LLVMBuildGEP(builder, clip_ptr2, indices, 2, ""); /* x2 */
clip0_ptr = LLVMBuildGEP(builder, clip_ptr0, indices, 2, ""); /* x0 */
clip1_ptr = LLVMBuildGEP(builder, clip_ptr1, indices, 2, ""); /* x1 */
clip2_ptr = LLVMBuildGEP(builder, clip_ptr2, indices, 2, ""); /* x2 */
LLVMValueRef index = lp_build_const_int32(gallivm, i);
res = LLVMBuildInsertElement(gallivm->builder, res, a,
index, i == 3 ? name : "");
LLVMValueRef index = lp_build_const_int32(gallivm, i);
res = LLVMBuildInsertElement(gallivm->builder, res, a,
index, i == 3 ? name : "");
LLVMValueRef zero, shift;
LLVMValueRef pos_x, pos_y, pos_z, pos_w;
LLVMValueRef plane1, planes, plane_ptr, sum;
LLVMValueRef zero, shift;
LLVMValueRef pos_x, pos_y, pos_z, pos_w;
LLVMValueRef plane1, planes, plane_ptr, sum;
struct lp_type f32_type = lp_type_float_vec(32);
mask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
struct lp_type f32_type = lp_type_float_vec(32);
mask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
pos_w = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 w2 w3*/
/* Cliptest, for hardwired planes */
pos_w = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 w2 w3*/
/* Cliptest, for hardwired planes */
/* plane 1 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
temp = shift;
/* plane 1 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, pos_x , pos_w);
temp = shift;
mask = LLVMBuildOr(builder, mask, test, "");
}
mask = LLVMBuildOr(builder, mask, test, "");
}
/* plane 5 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
test = LLVMBuildAnd(builder, test, temp, "");
mask = LLVMBuildOr(builder, mask, test, "");
}
/* plane 5 */
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, pos_z);
test = LLVMBuildAnd(builder, test, temp, "");
mask = LLVMBuildOr(builder, mask, test, "");
}
/* plane 5 */
test = LLVMBuildFAdd(builder, pos_z, pos_w, "");
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
/* plane 5 */
test = LLVMBuildFAdd(builder, pos_z, pos_w, "");
test = lp_build_compare(gallivm, f32_type, PIPE_FUNC_GREATER, zero, test);
mask = LLVMBuildOr(builder, mask, test, "");
}
mask = LLVMBuildOr(builder, mask, test, "");
}
LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr);
LLVMValueRef indices[3];
temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 32);
LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_ptr);
LLVMValueRef indices[3];
temp = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 32);
temp = LLVMBuildExtractElement(builder, clipmask,
lp_build_const_int32(gallivm, i) , "");
ret = LLVMBuildOr(builder, ret, temp, "");
temp = LLVMBuildExtractElement(builder, clipmask,
lp_build_const_int32(gallivm, i) , "");
ret = LLVMBuildOr(builder, ret, temp, "");
variant->function = LLVMAddFunction(gallivm->module, "draw_llvm_shader",
func_type);
LLVMSetFunctionCallConv(variant->function, LLVMCCallConv);
variant->function = LLVMAddFunction(gallivm->module, "draw_llvm_shader",
func_type);
LLVMSetFunctionCallConv(variant->function, LLVMCCallConv);
- for(i = 0; i < Elements(arg_types); ++i)
- if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+ for (i = 0; i < Elements(arg_types); ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
LLVMAddAttribute(LLVMGetParam(variant->function, i), LLVMNoAliasAttribute);
context_ptr = LLVMGetParam(variant->function, 0);
LLVMAddAttribute(LLVMGetParam(variant->function, i), LLVMNoAliasAttribute);
context_ptr = LLVMGetParam(variant->function, 0);
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
generate_viewport(llvm, builder, outputs, context_ptr);
}
generate_viewport(llvm, builder, outputs, context_ptr);
}
variant->function_elts = LLVMAddFunction(gallivm->module, "draw_llvm_shader_elts", func_type);
LLVMSetFunctionCallConv(variant->function_elts, LLVMCCallConv);
variant->function_elts = LLVMAddFunction(gallivm->module, "draw_llvm_shader_elts", func_type);
LLVMSetFunctionCallConv(variant->function_elts, LLVMCCallConv);
- for(i = 0; i < Elements(arg_types); ++i)
- if(LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
+ for (i = 0; i < Elements(arg_types); ++i)
+ if (LLVMGetTypeKind(arg_types[i]) == LLVMPointerTypeKind)
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
/* allocate clipmask, assign it integer type */
clipmask = generate_clipmask(gallivm, outputs,
variant->key.clip_xy,
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
/* return clipping boolean value for function */
clipmask_bool(gallivm, clipmask, ret_ptr);
}
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
clipmask = lp_build_const_int_vec(gallivm, lp_type_int_vec(32), 0);
}
/* do viewport mapping */
generate_viewport(llvm, builder, outputs, context_ptr);
}
generate_viewport(llvm, builder, outputs, context_ptr);
}