2 * Copyright © 2014 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #ifndef _GLAMOR_PROGRAM_H_
24 #define _GLAMOR_PROGRAM_H_
27 glamor_program_location_none
= 0,
28 glamor_program_location_fg
= 1,
29 glamor_program_location_bg
= 2,
30 glamor_program_location_fillsamp
= 4,
31 glamor_program_location_fillpos
= 8,
32 glamor_program_location_font
= 16,
33 glamor_program_location_bitplane
= 32,
34 glamor_program_location_dash
= 64,
35 glamor_program_location_atlas
= 128,
36 } glamor_program_location
;
39 glamor_program_flag_none
= 0,
40 } glamor_program_flag
;
43 glamor_program_alpha_normal
,
44 glamor_program_alpha_ca_first
,
45 glamor_program_alpha_ca_second
,
46 glamor_program_alpha_dual_blend
,
47 glamor_program_alpha_dual_blend_gles2
,
48 glamor_program_alpha_count
49 } glamor_program_alpha
;
51 typedef struct _glamor_program glamor_program
;
53 typedef Bool (*glamor_use
) (DrawablePtr drawable
, GCPtr gc
, glamor_program
*prog
, void *arg
);
55 typedef Bool (*glamor_use_render
) (CARD8 op
, PicturePtr src
, PicturePtr dst
, glamor_program
*prog
);
61 const char *fs_extensions
;
66 const glamor_program_location locations
;
67 const glamor_program_flag flags
;
68 const char *source_name
;
70 glamor_use_render use_render
;
73 struct _glamor_program
{
79 GLint fill_size_inv_uniform
;
80 GLint fill_offset_uniform
;
82 GLint bitplane_uniform
;
85 GLint dash_length_uniform
;
87 glamor_program_location locations
;
88 glamor_program_flag flags
;
91 glamor_program_alpha alpha
;
92 glamor_use_render prim_use_render
;
93 glamor_use_render fill_use_render
;
97 glamor_program progs
[4];
98 } glamor_program_fill
;
100 extern const glamor_facet glamor_fill_solid
;
103 glamor_build_program(ScreenPtr screen
,
104 glamor_program
*prog
,
105 const glamor_facet
*prim
,
106 const glamor_facet
*fill
,
108 const char *defines
);
111 glamor_use_program(DrawablePtr drawable
,
113 glamor_program
*prog
,
117 glamor_use_program_fill(DrawablePtr drawable
,
119 glamor_program_fill
*program_fill
,
120 const glamor_facet
*prim
);
123 glamor_program_source_solid
,
124 glamor_program_source_picture
,
125 glamor_program_source_1x1_picture
,
126 glamor_program_source_count
,
127 } glamor_program_source
;
130 glamor_program progs
[glamor_program_source_count
][glamor_program_alpha_count
];
131 } glamor_program_render
;
134 glamor_is_component_alpha(PicturePtr mask
) {
135 if (mask
&& mask
->componentAlpha
&& PICT_FORMAT_RGB(mask
->format
))
141 glamor_setup_program_render(CARD8 op
,
145 glamor_program_render
*program_render
,
146 const glamor_facet
*prim
,
147 const char *defines
);
150 glamor_use_program_render(glamor_program
*prog
,
155 #endif /* _GLAMOR_PROGRAM_H_ */