* Create LLVM type for struct draw_jit_context
*/
static LLVMTypeRef
-create_jit_context_type(struct gallivm_state *gallivm, const char *struct_name)
+create_vs_jit_context_type(struct gallivm_state *gallivm, const char *struct_name)
{
LLVMTargetDataRef target = gallivm->target;
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
- LLVMTypeRef elem_types[DRAW_JIT_CTX_NUM_FIELDS];
+ LLVMTypeRef elem_types[DRAW_VS_JIT_CTX_NUM_FIELDS];
- elem_types[DRAW_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), DRAW_TOTAL_CLIP_PLANES), 0);
- elem_types[DRAW_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0);
+ elem_types[DRAW_VS_JIT_CTX_PLANES] = LLVMPointerType(LLVMArrayType(LLVMArrayType(float_type, 4), DRAW_TOTAL_CLIP_PLANES), 0);
+ elem_types[DRAW_VS_JIT_CTX_VIEWPORT] = LLVMPointerType(float_type, 0);
LLVMTypeRef context_type = LLVMStructTypeInContext(gallivm->context, elem_types, ARRAY_SIZE(elem_types), 0);
(void) target; /* silence unused var warning for non-debug build */
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes,
- target, context_type, DRAW_JIT_CTX_PLANES);
- LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewports,
- target, context_type, DRAW_JIT_CTX_VIEWPORT);
- LP_CHECK_STRUCT_SIZE(struct draw_jit_context,
+ LP_CHECK_MEMBER_OFFSET(struct draw_vs_jit_context, planes,
+ target, context_type, DRAW_VS_JIT_CTX_PLANES);
+ LP_CHECK_MEMBER_OFFSET(struct draw_vs_jit_context, viewports,
+ target, context_type, DRAW_VS_JIT_CTX_VIEWPORT);
+ LP_CHECK_STRUCT_SIZE(struct draw_vs_jit_context,
target, context_type);
return context_type;
* Create LLVM types for various structures.
*/
static void
-create_jit_types(struct draw_llvm_variant *variant)
+create_vs_jit_types(struct draw_llvm_variant *variant)
{
struct gallivm_state *gallivm = variant->gallivm;
- variant->context_type = create_jit_context_type(gallivm, "draw_jit_context");
+ variant->context_type = create_vs_jit_context_type(gallivm, "draw_vs_jit_context");
variant->context_ptr_type = LLVMPointerType(variant->context_type, 0);
variant->resources_type = lp_build_jit_resources_type(gallivm);
get_context_ptr_type(struct draw_llvm_variant *variant)
{
if (!variant->context_ptr_type)
- create_jit_types(variant);
+ create_vs_jit_types(variant);
return variant->context_ptr_type;
}
get_buffer_ptr_type(struct draw_llvm_variant *variant)
{
if (!variant->buffer_ptr_type)
- create_jit_types(variant);
+ create_vs_jit_types(variant);
return variant->buffer_ptr_type;
}
get_vb_ptr_type(struct draw_llvm_variant *variant)
{
if (!variant->vb_ptr_type)
- create_jit_types(variant);
+ create_vs_jit_types(variant);
return variant->vb_ptr_type;
}
}
variant->gallivm = gallivm_create(module_name, llvm->context, &cached);
- create_jit_types(variant);
+ create_vs_jit_types(variant);
if (gallivm_debug & (GALLIVM_DEBUG_TGSI | GALLIVM_DEBUG_IR)) {
if (llvm->draw->vs.vertex_shader->state.type == PIPE_SHADER_IR_TGSI)
LLVMTypeRef vs_type_llvm = lp_build_vec_type(gallivm, vs_type);
LLVMValueRef out3 = LLVMBuildLoad2(builder, vs_type_llvm, 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_viewports(variant, context_ptr);
+ LLVMValueRef vp_ptr = draw_vs_jit_context_viewports(variant, context_ptr);
/* We treat pipe_viewport_state as a float array */
const int scale_index_offset = offsetof(struct pipe_viewport_state, scale) / sizeof(float);
}
if (clip_user) {
- LLVMValueRef planes_ptr = draw_jit_context_planes(gallivm, context_type, context_ptr);
+ LLVMValueRef planes_ptr = draw_vs_jit_context_planes(gallivm, context_type, context_ptr);
LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context);
LLVMTypeRef planes_type = LLVMArrayType(LLVMArrayType(float_type, 4), DRAW_TOTAL_CLIP_PLANES);
LLVMValueRef indices[3];
switch (shader_stage) {
case PIPE_SHADER_VERTEX:
- assert(sview_idx < ARRAY_SIZE(draw->llvm->jit_resources.textures));
- jit_tex = &draw->llvm->jit_resources.textures[sview_idx];
+ assert(sview_idx < ARRAY_SIZE(draw->llvm->vs_jit_resources.textures));
+ jit_tex = &draw->llvm->vs_jit_resources.textures[sview_idx];
break;
case PIPE_SHADER_GEOMETRY:
assert(sview_idx < ARRAY_SIZE(draw->llvm->gs_jit_resources.textures));
switch (shader_stage) {
case PIPE_SHADER_VERTEX:
- assert(idx < ARRAY_SIZE(draw->llvm->jit_resources.images));
- jit_image = &draw->llvm->jit_resources.images[idx];
+ assert(idx < ARRAY_SIZE(draw->llvm->vs_jit_resources.images));
+ jit_image = &draw->llvm->vs_jit_resources.images[idx];
break;
case PIPE_SHADER_GEOMETRY:
assert(idx < ARRAY_SIZE(draw->llvm->gs_jit_resources.images));
switch (shader_type) {
case PIPE_SHADER_VERTEX:
for (unsigned i = 0; i < draw->num_samplers[PIPE_SHADER_VERTEX]; i++) {
- struct lp_jit_sampler *jit_sam = &draw->llvm->jit_resources.samplers[i];
+ struct lp_jit_sampler *jit_sam = &draw->llvm->vs_jit_resources.samplers[i];
if (draw->samplers[PIPE_SHADER_VERTEX][i]) {
const struct pipe_sampler_state *s
* Only use types with a clear size and padding here, in particular prefer the
* stdint.h types to the basic integer types.
*/
-struct draw_jit_context
+struct draw_vs_jit_context
{
float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
struct pipe_viewport_state *viewports;
};
enum {
- DRAW_JIT_CTX_PLANES = 0,
- DRAW_JIT_CTX_VIEWPORT = 1,
- DRAW_JIT_CTX_NUM_FIELDS
+ DRAW_VS_JIT_CTX_PLANES = 0,
+ DRAW_VS_JIT_CTX_VIEWPORT = 1,
+ DRAW_VS_JIT_CTX_NUM_FIELDS
};
-#define draw_jit_context_planes(_gallivm, _type, _ptr) \
- lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_JIT_CTX_PLANES, "planes")
+#define draw_vs_jit_context_planes(_gallivm, _type, _ptr) \
+ lp_build_struct_get2(_gallivm, _type, _ptr, DRAW_VS_JIT_CTX_PLANES, "planes")
-#define draw_jit_context_viewports(_variant, _ptr) \
- lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewports")
+#define draw_vs_jit_context_viewports(_variant, _ptr) \
+ lp_build_struct_get2(_variant->gallivm, _variant->context_type, _ptr, DRAW_VS_JIT_CTX_VIEWPORT, "viewports")
#define draw_jit_vbuffer_stride(_gallivm, _type, _ptr) \
typedef boolean
-(*draw_jit_vert_func)(struct draw_jit_context *context,
+(*draw_jit_vert_func)(struct draw_vs_jit_context *context,
const struct lp_jit_resources *resources,
struct vertex_header *io,
const struct draw_vertex_buffer vbuffers[PIPE_MAX_ATTRIBS],
LLVMContextRef context;
boolean context_owned;
- struct draw_jit_context jit_context;
+ struct draw_vs_jit_context vs_jit_context;
struct draw_gs_jit_context gs_jit_context;
- struct lp_jit_resources jit_resources;
+ struct lp_jit_resources vs_jit_resources;
struct lp_jit_resources gs_jit_resources;
struct lp_jit_resources tcs_jit_resources;
struct lp_jit_resources tes_jit_resources;
struct draw_llvm *llvm = fpme->llvm;
unsigned i;
- for (i = 0; i < ARRAY_SIZE(llvm->jit_resources.constants); ++i) {
+ for (i = 0; i < ARRAY_SIZE(llvm->vs_jit_resources.constants); ++i) {
/*
* There could be a potential issue with rounding this up, as the
* shader expects 16-byte allocations, the fix is likely to move
* to LOAD intrinsic in the future and remove the vec4 constraint.
*/
int num_consts = get_num_consts_robust(draw, draw->pt.user.vs_constants_size, i);
- llvm->jit_resources.constants[i].f = draw->pt.user.vs_constants[i];
- llvm->jit_resources.constants[i].num_elements = num_consts;
+ llvm->vs_jit_resources.constants[i].f = draw->pt.user.vs_constants[i];
+ llvm->vs_jit_resources.constants[i].num_elements = num_consts;
if (num_consts == 0) {
- llvm->jit_resources.constants[i].f = fake_const_buf;
+ llvm->vs_jit_resources.constants[i].f = fake_const_buf;
}
}
- for (i = 0; i < ARRAY_SIZE(llvm->jit_resources.ssbos); ++i) {
+ for (i = 0; i < ARRAY_SIZE(llvm->vs_jit_resources.ssbos); ++i) {
int num_ssbos = draw->pt.user.vs_ssbos_size[i];
- llvm->jit_resources.ssbos[i].u = draw->pt.user.vs_ssbos[i];
- llvm->jit_resources.ssbos[i].num_elements = num_ssbos;
+ llvm->vs_jit_resources.ssbos[i].u = draw->pt.user.vs_ssbos[i];
+ llvm->vs_jit_resources.ssbos[i].num_elements = num_ssbos;
if (num_ssbos == 0) {
- llvm->jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
+ llvm->vs_jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
}
}
}
}
- llvm->jit_context.planes =
+ llvm->vs_jit_context.planes =
(float (*)[DRAW_TOTAL_CLIP_PLANES][4]) draw->pt.user.planes[0];
llvm->gs_jit_context.planes =
(float (*)[DRAW_TOTAL_CLIP_PLANES][4]) draw->pt.user.planes[0];
- llvm->jit_context.viewports = draw->viewports;
+ llvm->vs_jit_context.viewports = draw->viewports;
llvm->gs_jit_context.viewports = draw->viewports;
- llvm->jit_resources.aniso_filter_table = lp_build_sample_aniso_filter_table();
+ llvm->vs_jit_resources.aniso_filter_table = lp_build_sample_aniso_filter_table();
llvm->gs_jit_resources.aniso_filter_table = lp_build_sample_aniso_filter_table();
llvm->tcs_jit_resources.aniso_filter_table = lp_build_sample_aniso_filter_table();
llvm->tes_jit_resources.aniso_filter_table = lp_build_sample_aniso_filter_table();
elts = fetch_info->elts;
}
/* Run vertex fetch shader */
- clipped = fpme->current_variant->jit_func(&fpme->llvm->jit_context,
- &fpme->llvm->jit_resources,
+ clipped = fpme->current_variant->jit_func(&fpme->llvm->vs_jit_context,
+ &fpme->llvm->vs_jit_resources,
llvm_vert_info.verts,
draw->pt.user.vbuffer,
fetch_info->count,