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
48
49
50
51
52
53
|
#include <pixman.h>
/*
* The basic idea:
*
* A /program/ is a list of instructions that
*
* - takes a number of *source* images (numbered from 0 to n)
* - takes one destination image
* - takes a clip region parameter
*
* When executed, for each pixel in the destination image,
* the instructions are interpreted and the result is written
* back.
*
* Do we talk about /pixels/ here? Yes, probably, though there
* is nothing stopping people from treating an image as if it were
* an a8.
*
*/
typedef struct psl_program_t psl_program_t;
typedef struct psl_var_t psl_var_t;
typedef struct psl_instruction_t psl_instruction_t;
typedef struct instruction_list_t psl_statement_t;
psl_program_t * psl_program_create (psl_statement_t *statement);
psl_var_t * psl_imm_un8 (int value);
psl_var_t * psl_imm_sp (float f);
psl_var_t * psl_var (const char *name);
psl_instruction_t *psl_tex (psl_var_t *dest,
psl_var_t *img,
psl_var_t *u,
psl_var_t *v);
psl_instruction_t *psl_add (psl_var_t *dest,
psl_var_t *src1,
psl_var_t *src2);
psl_instruction_t *psl_mad (psl_var_t *dest,
psl_var_t *src1,
psl_var_t *src2,
psl_var_t *src3);
psl_instruction_t *psl_cmp_lt (psl_var_t *dest,
psl_var_t *src1,
psl_var_t *src2);
psl_instruction_t *psl_label (const char *name);
psl_statement_t * psl_asm (psl_instruction_t *instruction,
...);
void psl_program_run (psl_program_t *program,
pixman_region32_t *clip,
pixman_image_t *destination,
pixman_image_t **sources);
void psl_program_destroy (psl_program_t *program);
|