summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/gallivm/lp_bld_action.h
blob: 4da3479cef72b1ecfca470a51a7f9cf30948b426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

#ifndef LP_BLD_ACTION_H
#define LP_BLD_ACTION_H

struct lp_build_tgsi_context;

struct lp_build_emit_data {
   /* Arguments that are passed to lp_build_opcode_action::emit.  The
    * order of the arguments should be as follows:
    * SOA: s0.x, s0.y, s0.z, s0.w, s1.x, s1.y, s1.z, s1.w, s2.x, s2.y, s2.x, s2.w
    * AOS: s0.xyzw, s1.xyzw, s2.xyzw
    * TEXTURE Instructions: coord.xyzw
    *
    * Arguments should be packed into the args array.  For example an SOA
    * instructions that reads s0.x and s1.x args should look like this:
    * args[0] = s0.x;
    * args[1] = s1.x;
    */
   LLVMValueRef args[12];
   unsigned arg_count;
   LLVMTypeRef dst_type;
   unsigned chan;

   /* These fields (inst and info) should be NULL if the
    * lp_build_opcode_action::emit is called without first calling the
    * lp_build_opcode_action::fetch_args function.
    * For example, if TGSI_OPCODE_MAD is implemented using a MUL
    * instruction and an ADD instruction, when the emit functions are
    * called for MUL and ADD inst and info should be NULL.
    */
   const struct tgsi_full_instruction * inst;
   const struct tgsi_opcode_info * info;
};

struct lp_build_opcode_action
{
   void (*fetch_args)(struct lp_build_tgsi_context *,
                      struct lp_build_emit_data *);

   LLVMValueRef (*emit)(const struct lp_build_opcode_action *,
                        struct lp_build_tgsi_context *,
                        struct lp_build_emit_data *);

   const char * intr_name;
};

#endif /* LP_BLD_ACTION_H */