int i;
struct gallivm_state *gallivm = variant->gallivm;
struct lp_type f32_type = vs_type;
+ const unsigned pos = draw_current_shader_position_output(variant->llvm->draw);
LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
- LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[0][3], ""); /*w0 w1 .. wn*/
+ LLVMValueRef out3 = LLVMBuildLoad(builder, outputs[pos][3], ""); /*w0 w1 .. wn*/
LLVMValueRef const1 = lp_build_const_vec(gallivm, f32_type, 1.0); /*1.0 1.0 1.0 1.0*/
LLVMValueRef vp_ptr = draw_jit_context_viewport(gallivm, context_ptr);
/* for 1/w convention*/
out3 = LLVMBuildFDiv(builder, const1, out3, "");
- LLVMBuildStore(builder, out3, outputs[0][3]);
+ LLVMBuildStore(builder, out3, outputs[pos][3]);
/* Viewport Mapping */
for (i=0; i<3; i++) {
- LLVMValueRef out = LLVMBuildLoad(builder, outputs[0][i], ""); /*x0 x1 .. xn*/
+ LLVMValueRef out = LLVMBuildLoad(builder, outputs[pos][i], ""); /*x0 x1 .. xn*/
LLVMValueRef scale;
LLVMValueRef trans;
LLVMValueRef scale_i;
out = LLVMBuildFAdd(builder, out, trans, "");
/* store transformed outputs */
- LLVMBuildStore(builder, out, outputs[0][i]);
+ LLVMBuildStore(builder, out, outputs[pos][i]);
}
}
struct lp_build_sampler_soa *sampler = 0;
LLVMValueRef ret, clipmask_bool_ptr;
const struct draw_geometry_shader *gs = draw->gs.geometry_shader;
+ struct draw_llvm_variant_key *key = &variant->key;
/* If geometry shader is present we need to skip both the viewport
* transformation and clipping otherwise the inputs to the geometry
* shader will be incorrect.
*/
- const boolean bypass_viewport = gs || variant->key.bypass_viewport;
- const boolean enable_cliptest = !gs && (variant->key.clip_xy ||
- variant->key.clip_z ||
- variant->key.clip_user);
+ const boolean bypass_viewport = gs || key->bypass_viewport;
+ const boolean enable_cliptest = !gs && (key->clip_xy ||
+ key->clip_z ||
+ key->clip_user);
LLVMValueRef variant_func;
const unsigned pos = draw_current_shader_position_output(llvm->draw);
const unsigned cv = draw_current_shader_clipvertex_output(llvm->draw);
/* code generated texture sampling */
sampler = draw_llvm_sampler_soa_create(
- draw_llvm_variant_key_samplers(&variant->key),
+ draw_llvm_variant_key_samplers(key),
context_ptr);
if (elts) {
&system_values,
context_ptr,
sampler,
- variant->key.clamp_vertex_color);
+ key->clamp_vertex_color);
if (pos != -1 && cv != -1) {
/* store original positions in clip before further manipulation */
gallivm,
vs_type,
outputs,
- variant->key.clip_xy,
- variant->key.clip_z,
- variant->key.clip_user,
- variant->key.clip_halfz,
- variant->key.ucp_enable,
+ key->clip_xy,
+ key->clip_z,
+ key->clip_user,
+ key->clip_halfz,
+ key->ucp_enable,
context_ptr, &have_clipdist);
temp = LLVMBuildOr(builder, clipmask, temp, "");
/* store temporary clipping boolean value */
key->clip_z = llvm->draw->clip_z;
key->clip_user = llvm->draw->clip_user;
key->bypass_viewport = llvm->draw->identity_viewport;
- key->clip_halfz = !llvm->draw->rasterizer->gl_rasterization_rules;
+ key->clip_halfz = llvm->draw->rasterizer->clip_halfz;
key->need_edgeflags = (llvm->draw->vs.edgeflag_output ? TRUE : FALSE);
key->ucp_enable = llvm->draw->rasterizer->clip_plane_enable;
key->has_gs = llvm->draw->gs.geometry_shader != NULL;