Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4358 Serge 1
#ifndef LP_STATE_SETUP_H
2
#define LP_STATE_SETUP_H
3
 
4
#include "lp_bld_interp.h"
5
 
6
 
7
struct llvmpipe_context;
8
struct lp_setup_variant;
9
 
10
struct lp_setup_variant_list_item
11
{
12
   struct lp_setup_variant *base;
13
   struct lp_setup_variant_list_item *next, *prev;
14
};
15
 
16
 
17
struct lp_setup_variant_key {
18
   unsigned size:16;
19
   unsigned num_inputs:8;
20
   int color_slot:8;
21
 
22
   int bcolor_slot:8;
23
   int spec_slot:8;
24
   int bspec_slot:8;
25
   unsigned flatshade_first:1;
26
   unsigned pixel_center_half:1;
27
   unsigned twoside:1;
28
   unsigned pad:5;
29
 
30
   /* TODO: get those floats out of the key and use a jit_context for setup */
31
   float pgon_offset_units;
32
   float pgon_offset_scale;
33
   float pgon_offset_clamp;
34
   struct lp_shader_input inputs[PIPE_MAX_SHADER_INPUTS];
35
};
36
 
37
 
38
typedef void (*lp_jit_setup_triangle)( const float (*v0)[4],
39
				       const float (*v1)[4],
40
				       const float (*v2)[4],
41
				       boolean front_facing,
42
				       float (*a0)[4],
43
				       float (*dadx)[4],
44
				       float (*dady)[4] );
45
 
46
 
47
 
48
 
49
/* At this stage, for a given variant key, we create a
50
 * draw_vertex_info struct telling the draw module how to format the
51
 * vertices, and an llvm-generated function which calculates the
52
 * attribute interpolants (a0, dadx, dady) from three of those
53
 * vertices.
54
 */
55
struct lp_setup_variant {
56
   struct lp_setup_variant_key key;
57
 
58
   struct lp_setup_variant_list_item list_item_global;
59
 
60
   struct gallivm_state *gallivm;
61
 
62
   /* XXX: this is a pointer to the LLVM IR.  Once jit_function is
63
    * generated, we never need to use the IR again - need to find a
64
    * way to release this data without destroying the generated
65
    * assembly.
66
    */
67
   LLVMValueRef function;
68
 
69
   /* The actual generated setup function:
70
    */
71
   lp_jit_setup_triangle jit_function;
72
 
73
   unsigned no;
74
};
75
 
76
void lp_delete_setup_variants(struct llvmpipe_context *lp);
77
 
78
void
79
lp_dump_setup_coef( const struct lp_setup_variant_key *key,
80
		    const float (*sa0)[4],
81
		    const float (*sdadx)[4],
82
		    const float (*sdady)[4]);
83
 
84
#endif