1770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/*
2770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Copyright © 2009 Intel Corporation
3770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *
4770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Permission is hereby granted, free of charge, to any person obtaining a
5770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * copy of this software and associated documentation files (the "Software"),
6770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * to deal in the Software without restriction, including without limitation
7770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * and/or sell copies of the Software, and to permit persons to whom the
9770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Software is furnished to do so, subject to the following conditions:
10770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *
11770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * The above copyright notice and this permission notice (including the next
12770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * paragraph) shall be included in all copies or substantial portions of the
13770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Software.
14770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *
15770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * DEALINGS IN THE SOFTWARE.
22770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick */
23770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#pragma once
24770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
25770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#include "main/config.h"
26324857599b2a4735c86e54da9a1776c034dadf72Brian Paul#include "program/prog_parameter.h"
27770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
28f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergstruct gl_context;
2944843c753301db0e8f8343745777479465f34cccIan Romanick
30770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickenum asm_type {
31770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   at_none,
32770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   at_address,
33770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   at_attrib,
34770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   at_param,
35770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   at_temp,
36133501bef2933395f14b2ebdfeda84279be93c60Brian Paul   at_output
37770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
38770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
39770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_symbol {
4094b45567047fd681666f261f1ad0164049f0491aIan Romanick   struct asm_symbol *next;    /**< List linkage for freeing. */
41770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   const char *name;
42770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   enum asm_type type;
43770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned attrib_binding;
44770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned output_binding;   /**< Output / result register number. */
45770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
46770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
47770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * One of PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, or PROGRAM_ENV_PARAM.
48770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
49770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned param_binding_type;
50770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
51770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
52770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Offset into the program_parameter_list where the tokens representing our
53770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * bound state (or constants) start.
54770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
55770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned param_binding_begin;
56770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
57639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul   /**
58639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul    * Constants put into the parameter list may be swizzled.  This
59639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul    * field contain's the symbol's swizzle. (SWIZZLE_X/Y/Z/W)
60639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul    */
61639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul   unsigned param_binding_swizzle;
62639e7a140e430aa8839c652459eddc9a4b79f9c6Brian Paul
63fab1f07d6ad01463897ae792f4b33738afb07369Jeff Smith   /* This is how many entries in the program_parameter_list we take up
64770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * with our state tokens or constants. Note that this is _not_ the same as
65770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * the number of param registers we eventually use.
66770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
67770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned param_binding_length;
68770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
69770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
70770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Index of the temp register assigned to this variable.
71770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
72770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned temp_binding;
73770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
74770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
75770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Flag whether or not a PARAM is an array
76770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
77770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned param_is_array:1;
78770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
79770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
80770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
81770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Flag whether or not a PARAM array is accessed indirectly
82770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
83770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned param_accessed_indirectly:1;
84770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
85770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
86770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
87770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * \brief Is first pass of parameter layout done with this variable?
88770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    *
89770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * The parameter layout routine operates in two passes.  This flag tracks
90770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * whether or not the first pass has handled this variable.
91770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    *
92770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * \sa _mesa_layout_parameters
93770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
94770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned pass1_done:1;
95770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
96770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
97770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
98770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_vector {
99770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned count;
100324857599b2a4735c86e54da9a1776c034dadf72Brian Paul   gl_constant_value data[4];
101770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
102770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
103770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
104770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_swizzle_mask {
105770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned swizzle:12;
106770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned mask:4;
107770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
108770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
109770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
110770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_src_register {
111770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct prog_src_register Base;
112770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
113770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
114770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Symbol associated with indirect access to parameter arrays.
115770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    *
116770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * If \c Base::RelAddr is 1, this will point to the symbol for the parameter
117770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * that is being dereferenced.  Further, \c Base::Index will be the offset
118770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * from the address register being used.
119770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
120770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct asm_symbol *Symbol;
121770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
122770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
123770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
124770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_instruction {
125770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct prog_instruction Base;
126770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct asm_instruction *next;
127770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct asm_src_register SrcReg[3];
128770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
129770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
130770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
131770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickstruct asm_parser_state {
132f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg   struct gl_context *ctx;
133770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct gl_program *prog;
134770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
135770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
136770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Per-program target limits
137770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
138770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct gl_program_constants *limits;
139770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
140770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct _mesa_symbol_table *st;
141770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
142770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
14394b45567047fd681666f261f1ad0164049f0491aIan Romanick    * Linked list of symbols
14494b45567047fd681666f261f1ad0164049f0491aIan Romanick    *
14594b45567047fd681666f261f1ad0164049f0491aIan Romanick    * This list is \b only used when cleaning up compiler state and freeing
14694b45567047fd681666f261f1ad0164049f0491aIan Romanick    * memory.
14794b45567047fd681666f261f1ad0164049f0491aIan Romanick    */
14894b45567047fd681666f261f1ad0164049f0491aIan Romanick   struct asm_symbol *sym;
14994b45567047fd681666f261f1ad0164049f0491aIan Romanick
15094b45567047fd681666f261f1ad0164049f0491aIan Romanick   /**
151770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * State for the lexer.
152770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
153770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   void *scanner;
154770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
155770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
156770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Linked list of instructions generated during parsing.
157770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
158770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /*@{*/
159770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct asm_instruction *inst_head;
160770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct asm_instruction *inst_tail;
161770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /*@}*/
162770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
163770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
164770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
165770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Selected limits copied from gl_constants
166770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    *
167770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * These are limits from the GL context, but various bits in the program
168770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * must be validated against these values.
169770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
170770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /*@{*/
171770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxTextureCoordUnits;
172770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxTextureImageUnits;
173770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxTextureUnits;
174770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxClipPlanes;
175770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxLights;
176770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned MaxProgramMatrices;
17728cec9e832b716b84c11ddabfcee74e0daf6ec49Eric Anholt   unsigned MaxDrawBuffers;
178770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /*@}*/
179770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
180770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
181770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Value to use in state vector accessors for environment and local
182770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * parameters
183770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
184770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   unsigned state_param_enum;
185770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
186770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
187770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   /**
188770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * Input attributes bound to specific names
189770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    *
190770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * This is only needed so that errors can be properly produced when
191770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * multiple ATTRIB statements bind illegal combinations of vertex
192770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    * attributes.
193770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    */
194b14c06e10d570edcb4dcbea173d71751563616e7Mathias Fröhlich   GLbitfield64 InputsBound;
195770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
196770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   enum {
197770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      invalid_mode = 0,
198770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      ARB_vertex,
199770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      ARB_fragment
200770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   } mode;
201770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
202770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct {
203770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned PositionInvariant:1;
204770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned Fog:2;
205770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned PrecisionHint:2;
206770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned DrawBuffers:1;
207770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned Shadow:1;
20888018e2e073909ae807f16707f2701e068900926Ian Romanick      unsigned TexRect:1;
209aafd5762593aa01f2d612f4d769d1af383422c1cIan Romanick      unsigned TexArray:1;
210dc8ec05ace3d2a0284dbe47ec2d88168b1efb517Ian Romanick      unsigned NV_fragment:1;
211e59353f592ef587d34279f0735f06053e289a7b4Luca Barbieri      unsigned OriginUpperLeft:1;
212e59353f592ef587d34279f0735f06053e289a7b4Luca Barbieri      unsigned PixelCenterInteger:1;
213770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   } option;
214770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
215770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   struct {
216770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick      unsigned UsesKill:1;
217a0f7b869592013b24a5bacf0ceb2bdb1e9146378Paul Berry      unsigned UsesDFdy:1;
218770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   } fragment;
219770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick};
220770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
221770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_NONE        0
222770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_FOG_EXP     1
223770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_FOG_EXP2    2
224770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_FOG_LINEAR  3
225770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_NICEST      1
226770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define OPTION_FASTEST     2
227770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
228770cebbc29863ae944a31463ee4bdeb789105abaIan Romanicktypedef struct YYLTYPE {
229770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   int first_line;
230770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   int first_column;
231770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   int last_line;
232770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   int last_column;
233770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick   int position;
234770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick} YYLTYPE;
235770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
236770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define YYLTYPE_IS_DECLARED 1
237770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick#define YYLTYPE_IS_TRIVIAL 1
238770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
239770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
240f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergextern GLboolean _mesa_parse_arb_program(struct gl_context *ctx, GLenum target,
241770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    const GLubyte *str, GLsizei len, struct asm_parser_state *state);
242770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
243770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
244770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
245770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/* From program_lexer.l. */
246770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickextern void _mesa_program_lexer_dtor(void *scanner);
247770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
248770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickextern void _mesa_program_lexer_ctor(void **scanner,
249770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    struct asm_parser_state *state, const char *string, size_t len);
250770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
251770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
252770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/**
253770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *\name From program_parse_extra.c
254770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick */
255770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/*@{*/
256770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
257770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/**
258770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Parses and processes an option string to an ARB vertex program
259770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *
260770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * \return
261770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Non-zero on success, zero on failure.
262770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick */
263770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickextern int _mesa_ARBvp_parse_option(struct asm_parser_state *state,
264770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    const char *option);
265770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
266770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/**
267770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Parses and processes an option string to an ARB fragment program
268770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick *
269770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * \return
270770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick * Non-zero on success, zero on failure.
271770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick */
272770cebbc29863ae944a31463ee4bdeb789105abaIan Romanickextern int _mesa_ARBfp_parse_option(struct asm_parser_state *state,
273770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick    const char *option);
274770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick
275d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick/**
276d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * Parses and processes instruction suffixes
277d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick *
278d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * Instruction suffixes, such as \c _SAT, are processed.  The relevant bits
279d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * are set in \c inst.  If suffixes are encountered that are either not known
280d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * or not supported by the modes and options set in \c state, zero will be
281d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * returned.
282d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick *
283d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * \return
284d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick * Non-zero on success, zero on failure.
285d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick */
286d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanickextern int _mesa_parse_instruction_suffix(const struct asm_parser_state *state,
287d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick    const char *suffix, struct prog_instruction *inst);
288d0adebb8d5ef680590b0f281a20516318c0b8b62Ian Romanick
28981722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick/**
29081722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * Parses a condition code name
29181722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick *
29281722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * The condition code names (e.g., \c LT, \c GT, \c NE) were added to assembly
29381722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * shaders with the \c GL_NV_fragment_program_option extension.  This function
29481722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * converts a string representation into one of the \c COND_ macros.
29581722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick *
29681722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * \return
29781722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * One of the \c COND_ macros defined in prog_instruction.h on success or zero
29881722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick * on failure.
29981722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick */
30081722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanickextern int _mesa_parse_cc(const char *s);
30181722c5d7e8e93d837510b9e6e5d014ec64cf4b3Ian Romanick
302770cebbc29863ae944a31463ee4bdeb789105abaIan Romanick/*@}*/
303