glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / state_trackers / vega / shaders_cache.h
blobfeca58b61a9dd412ac3493a15ad586647132941c
1 /**************************************************************************
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
27 #ifndef SHADERS_CACHE_H
28 #define SHADERS_CACHE_H
31 struct vg_context;
32 struct pipe_context;
33 struct tgsi_token;
34 struct shaders_cache;
36 enum VegaShaderType {
37 VEGA_SOLID_FILL_SHADER = 1 << 0,
38 VEGA_LINEAR_GRADIENT_SHADER = 1 << 1,
39 VEGA_RADIAL_GRADIENT_SHADER = 1 << 2,
40 VEGA_PATTERN_SHADER = 1 << 3,
41 VEGA_IMAGE_NORMAL_SHADER = 1 << 4,
42 VEGA_IMAGE_MULTIPLY_SHADER = 1 << 5,
43 VEGA_IMAGE_STENCIL_SHADER = 1 << 6,
45 VEGA_MASK_SHADER = 1 << 7,
47 VEGA_BLEND_MULTIPLY_SHADER = 1 << 8,
48 VEGA_BLEND_SCREEN_SHADER = 1 << 9,
49 VEGA_BLEND_DARKEN_SHADER = 1 << 10,
50 VEGA_BLEND_LIGHTEN_SHADER = 1 << 11,
52 VEGA_PREMULTIPLY_SHADER = 1 << 12,
53 VEGA_UNPREMULTIPLY_SHADER = 1 << 13,
55 VEGA_BW_SHADER = 1 << 14
58 struct vg_shader {
59 void *driver;
60 struct tgsi_token *tokens;
61 int type;/* PIPE_SHADER_VERTEX, PIPE_SHADER_FRAGMENT */
64 struct shaders_cache *shaders_cache_create(struct vg_context *pipe);
65 void shaders_cache_destroy(struct shaders_cache *sc);
66 void *shaders_cache_fill(struct shaders_cache *sc,
67 int shader_key);
69 struct vg_shader *shader_create_from_text(struct pipe_context *pipe,
70 const char *txt, int num_tokens,
71 int type);
73 void vg_shader_destroy(struct vg_context *ctx, struct vg_shader *shader);
77 #endif