Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / drivers / dri / r600 / r700_assembler.h
1 /*
2 * Copyright (C) 2008-2009 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 */
21
22 /*
23 * Authors:
24 * Richard Li <RichardZ.Li@amd.com>, <richardradeon@gmail.com>
25 */
26
27 #ifndef _R700_ASSEMBLER_H_
28 #define _R700_ASSEMBLER_H_
29
30 #include "main/mtypes.h"
31 #include "shader/prog_instruction.h"
32
33 #include "r700_chip.h"
34 #include "r700_shaderinst.h"
35 #include "r700_shader.h"
36
37 typedef enum LOADABLE_SCRIPT_SIGNITURE
38 {
39 GLSL_NOISE1 = 0x10000001,
40 GLSL_NOISE2 = 0x10000002,
41 GLSL_NOISE3 = 0x10000003,
42 GLSL_NOISE4 = 0x10000004
43 }LOADABLE_SCRIPT_SIGNITURE;
44
45 typedef struct COMPILED_SUB
46 {
47 struct prog_instruction *Instructions;
48 GLuint NumInstructions;
49 GLuint NumTemporaries;
50 GLuint NumParameters;
51 GLuint MinRegIndex;
52 GLfloat (*ParameterValues)[4];
53 GLbyte outputSwizzleX;
54 GLbyte outputSwizzleY;
55 GLbyte outputSwizzleZ;
56 GLbyte outputSwizzleW;
57 GLshort srcRegIndex[3];
58 GLushort dstRegIndex;
59 }COMPILED_SUB;
60
61 typedef struct PRESUB_DESCtag
62 {
63 LOADABLE_SCRIPT_SIGNITURE sptSigniture;
64 GLint subIL_Shift;
65 struct prog_src_register InReg[3];
66 struct prog_dst_register OutReg;
67
68 GLushort maxStartReg;
69 GLushort number_used_registers;
70
71 GLuint unConstantsStart;
72
73 COMPILED_SUB * pCompiledSub;
74 } PRESUB_DESC;
75
76 typedef enum SHADER_PIPE_TYPE
77 {
78 SPT_VP = 0,
79 SPT_FP = 1
80 } SHADER_PIPE_TYPE;
81
82 typedef enum ConstantCycles
83 {
84 NUMBER_OF_CYCLES = 3,
85 NUMBER_OF_COMPONENTS = 4
86 } ConstantCycles;
87
88 typedef enum HARDWARE_LIMIT_VALUES
89 {
90 TEMPORARY_REGISTER_OFFSET = SQ_ALU_SRC_GPR_BASE,
91 MAX_TEMPORARY_REGISTERS = SQ_ALU_SRC_GPR_SIZE,
92 MAX_CONSTANT_REGISTERS = SQ_ALU_SRC_CFILE_SIZE,
93 CFILE_REGISTER_OFFSET = SQ_ALU_SRC_CFILE_BASE,
94 NUMBER_OF_INPUT_COLORS = 2,
95 NUMBER_OF_OUTPUT_COLORS = 8,
96 NUMBER_OF_TEXTURE_UNITS = 16,
97 MEGA_FETCH_BYTES = 32
98 } HARDWARE_LIMIT_VALUES;
99
100 typedef enum AddressMode
101 {
102 ADDR_ABSOLUTE = 0,
103 ADDR_RELATIVE_A0 = 1,
104 ADDR_RELATIVE_FLI_0 = 2,
105 NUMBER_OF_ADDR_MOD = 3
106 } AddressMode;
107
108 typedef enum SrcRegisterType
109 {
110 SRC_REG_TEMPORARY = 0,
111 SRC_REG_INPUT = 1,
112 SRC_REG_CONSTANT = 2,
113 SRC_REG_ALT_TEMPORARY = 3,
114 SRC_REC_LITERAL = 4,
115 NUMBER_OF_SRC_REG_TYPE = 5
116 } SrcRegisterType;
117
118 typedef enum DstRegisterType
119 {
120 DST_REG_TEMPORARY = 0,
121 DST_REG_A0 = 1,
122 DST_REG_OUT = 2,
123 DST_REG_OUT_X_REPL = 3,
124 DST_REG_ALT_TEMPORARY = 4,
125 DST_REG_INPUT = 5,
126 NUMBER_OF_DST_REG_TYPE = 6
127 } DstRegisterType;
128
129 typedef unsigned int BITS;
130
131 typedef struct PVSDSTtag
132 {
133 BITS opcode:8; //(:6) //@@@ really should be 10 bits for OP2
134 BITS math:1;
135 BITS predicated:1; //10 //8
136 BITS pred_inv :1; //11 //8
137
138 BITS rtype:3;
139 BITS reg:10; //24 //20
140
141 BITS writex:1;
142 BITS writey:1;
143 BITS writez:1;
144 BITS writew:1; //28
145
146 BITS op3:1; // 29 Represents *_OP3_* ALU opcode
147
148 BITS dualop:1; // 30 //26
149
150 BITS addrmode0:1; //31 //29
151 BITS addrmode1:1; //32
152 } PVSDST;
153
154 typedef struct PVSINSTtag
155 {
156 BITS literal_slots :2;
157 BITS SaturateMode :2;
158 BITS index_mode :3;
159 } PVSINST;
160
161 typedef struct PVSSRCtag
162 {
163 BITS rtype:3;
164 BITS addrmode0:1;
165 BITS reg:10; //14 (8)
166 BITS swizzlex:3;
167 BITS swizzley:3;
168 BITS swizzlez:3;
169 BITS swizzlew:3; //26
170
171 BITS abs:1;
172 BITS negx:1;
173 BITS negy:1;
174 BITS negz:1;
175 BITS negw:1; //31
176 //BITS addrsel:2;
177 BITS addrmode1:1; //32
178 } PVSSRC;
179
180 typedef struct PVSMATHtag
181 {
182 BITS rtype:4;
183 BITS spare:1;
184 BITS reg:8;
185 BITS swizzlex:3;
186 BITS swizzley:3;
187 BITS dstoff:2; // 2 bits of dest offset into alt ram
188 BITS opcode:4;
189 BITS negx:1;
190 BITS negy:1;
191 BITS dstcomp:2; // select dest component
192 BITS spare2:3;
193 } PVSMATH;
194
195 typedef union PVSDWORDtag
196 {
197 BITS bits;
198 PVSDST dst;
199 PVSINST dst2;
200 PVSSRC src;
201 PVSMATH math;
202 float f;
203 } PVSDWORD;
204
205 typedef struct VAP_OUT_VTX_FMT_0tag
206 {
207 BITS pos:1; // 0
208 BITS misc:1;
209 BITS clip_dist0:1;
210 BITS clip_dist1:1;
211 BITS pos_param:1; // 4
212
213 BITS color0:1; // 5
214 BITS color1:1;
215 BITS color2:1;
216 BITS color3:1;
217 BITS color4:1;
218 BITS color5:1;
219 BITS color6:1;
220 BITS color7:1;
221
222 BITS normal:1;
223
224 BITS depth:1; // 14
225
226 BITS point_size:1; // 15
227 BITS edge_flag:1;
228 BITS rta_index:1; // shares same channel as kill_flag
229 BITS kill_flag:1;
230 BITS viewport_index:1; // 19
231
232 BITS resvd1:12; // 20
233 } VAP_OUT_VTX_FMT_0;
234
235 typedef struct VAP_OUT_VTX_FMT_1tag
236 {
237 BITS tex0comp:3;
238 BITS tex1comp:3;
239 BITS tex2comp:3;
240 BITS tex3comp:3;
241 BITS tex4comp:3;
242 BITS tex5comp:3;
243 BITS tex6comp:3;
244 BITS tex7comp:3;
245
246 BITS resvd:8;
247 } VAP_OUT_VTX_FMT_1;
248
249 typedef struct VAP_OUT_VTX_FMT_2tag
250 {
251 BITS tex8comp :3;
252 BITS tex9comp :3;
253 BITS tex10comp:3;
254 BITS tex11comp:3;
255 BITS tex12comp:3;
256 BITS tex13comp:3;
257 BITS tex14comp:3;
258 BITS tex15comp:3;
259
260 BITS resvd:8;
261 } VAP_OUT_VTX_FMT_2;
262
263 typedef struct OUT_FRAGMENT_FMT_0tag
264 {
265 BITS color0:1;
266 BITS color1:1;
267 BITS color2:1;
268 BITS color3:1;
269 BITS color4:1;
270 BITS color5:1;
271 BITS color6:1;
272 BITS color7:1;
273
274 BITS depth:1;
275 BITS stencil_ref:1;
276 BITS coverage_to_mask:1;
277 BITS mask:1;
278
279 BITS resvd1:20;
280 } OUT_FRAGMENT_FMT_0;
281
282 typedef enum CF_CLAUSE_TYPE
283 {
284 CF_EXPORT_CLAUSE,
285 CF_ALU_CLAUSE,
286 CF_TEX_CLAUSE,
287 CF_VTX_CLAUSE,
288 CF_OTHER_CLAUSE,
289 CF_EMPTY_CLAUSE,
290 NUMBER_CF_CLAUSE_TYPES
291 } CF_CLAUSE_TYPE;
292
293 enum
294 {
295 MAX_BOOL_CONSTANTS = 32,
296 MAX_INT_CONSTANTS = 32,
297 MAX_FLOAT_CONSTANTS = 256,
298
299 FC_NONE = 0,
300 FC_IF = 1,
301 FC_LOOP = 2,
302 FC_REP = 3,
303 FC_PUSH_VPM = 4,
304 FC_PUSH_WQM = 5,
305
306 COND_NONE = 0,
307 COND_BOOL = 1,
308 COND_PRED = 2,
309 COND_ALU = 3,
310
311 SAFEDIST_TEX = 6, ///< safe distance for using result of texture lookup in alu or another tex lookup
312 SAFEDIST_ALU = 6 ///< the same for alu->fc
313 };
314
315 typedef struct FC_LEVEL
316 {
317 R700ControlFlowGenericClause * first;
318 R700ControlFlowGenericClause ** mid;
319 unsigned int unNumMid;
320 unsigned int midLen;
321 unsigned int type;
322 unsigned int cond;
323 unsigned int inv;
324 int id; ///< id of bool or int variable
325 } FC_LEVEL;
326
327 typedef struct VTX_FETCH_METHOD
328 {
329 GLboolean bEnableMini;
330 GLuint mega_fetch_remainder;
331 } VTX_FETCH_METHOD;
332
333 typedef struct SUB_OFFSET
334 {
335 GLint subIL_Offset;
336 GLuint unCFoffset;
337 GLuint unStackDepthMax;
338 PRESUB_DESC * pPresubDesc;
339 TypedShaderList lstCFInstructions_local;
340 } SUB_OFFSET;
341
342 typedef struct CALLER_POINTER
343 {
344 GLint subIL_Offset;
345 GLint subDescIndex;
346 R700ControlFlowGenericClause* cf_ptr;
347
348 R700ControlFlowGenericClause* prelude_cf_ptr;
349 R700ControlFlowGenericClause* finale_cf_ptr;
350 } CALLER_POINTER;
351
352 #define SQ_MAX_CALL_DEPTH 0x00000020
353
354 typedef struct CALL_LEVEL
355 {
356 unsigned int FCSP_BeforeEntry;
357 GLint subDescIndex;
358 GLushort current;
359 GLushort max;
360 TypedShaderList * plstCFInstructions_local;
361 } CALL_LEVEL;
362
363 #define HAS_CURRENT_LOOPRET 0x1L
364 #define HAS_LOOPRET 0x2L
365 #define LOOPRET_FLAGS HAS_LOOPRET | HAS_CURRENT_LOOPRET
366
367 typedef struct r700_AssemblerBase
368 {
369 R700ControlFlowSXClause* cf_last_export_ptr;
370 R700ControlFlowSXClause* cf_current_export_clause_ptr;
371 R700ControlFlowALUClause* cf_current_alu_clause_ptr;
372 R700ControlFlowGenericClause* cf_current_tex_clause_ptr;
373 R700ControlFlowGenericClause* cf_current_vtx_clause_ptr;
374 R700ControlFlowGenericClause* cf_current_cf_clause_ptr;
375
376 //Result shader
377 R700_Shader * pR700Shader;
378
379 // No clause has been created yet
380 CF_CLAUSE_TYPE cf_current_clause_type;
381
382 BITS alu_x_opcode;
383
384 GLuint number_of_exports;
385 GLuint number_of_colorandz_exports;
386 GLuint number_of_export_opcodes;
387
388 PVSDWORD D;
389 PVSDWORD D2;
390 PVSDWORD S[3];
391 PVSDWORD C[4];
392
393 unsigned int uLastPosUpdate;
394 unsigned int last_cond_register;
395
396 OUT_FRAGMENT_FMT_0 fp_stOutFmt0;
397
398 unsigned int uIIns;
399 unsigned int uOIns;
400 unsigned int number_used_registers;
401 unsigned int uUsedConsts;
402
403 unsigned int flag_reg_index;
404
405 // Fragment programs
406 unsigned int uiFP_AttributeMap[FRAG_ATTRIB_MAX];
407 unsigned int uiFP_OutputMap[FRAG_RESULT_MAX];
408 unsigned int uBoolConsts;
409 unsigned int uIntConsts;
410 unsigned int uInsts;
411 unsigned int uConsts;
412
413 // Vertex programs
414 unsigned char ucVP_AttributeMap[VERT_ATTRIB_MAX];
415 unsigned char ucVP_OutputMap[VERT_RESULT_MAX];
416
417 unsigned char * pucOutMask;
418
419 //-----------------------------------------------------------------------------------
420 // flow control members
421 //-----------------------------------------------------------------------------------
422 unsigned int FCSP;
423 FC_LEVEL fc_stack[32];
424
425 //-----------------------------------------------------------------------------------
426 // ArgSubst used in Assemble_Source() function
427 //-----------------------------------------------------------------------------------
428 int aArgSubst[4];
429
430 GLint hw_gpr[ NUMBER_OF_CYCLES ][ NUMBER_OF_COMPONENTS ];
431 GLint hw_cfile_addr[ NUMBER_OF_COMPONENTS ];
432 GLint hw_cfile_chan[ NUMBER_OF_COMPONENTS ];
433
434 GLuint uOutputs;
435
436 GLint color_export_register_number[NUMBER_OF_OUTPUT_COLORS];
437 GLint depth_export_register_number;
438
439 GLint stencil_export_register_number;
440 GLint coverage_to_mask_export_register_number;
441 GLint mask_export_register_number;
442
443 GLuint starting_export_register_number;
444 GLuint starting_vfetch_register_number;
445 GLuint starting_temp_register_number;
446 GLuint uHelpReg;
447 GLuint uFirstHelpReg;
448
449 GLboolean input_position_is_used;
450 GLboolean input_normal_is_used;
451
452 GLboolean input_color_is_used[NUMBER_OF_INPUT_COLORS];
453
454 GLboolean input_texture_unit_is_used[NUMBER_OF_TEXTURE_UNITS];
455
456 R700VertexGenericFetch* vfetch_instruction_ptr_array[VERT_ATTRIB_MAX];
457
458 GLuint number_of_inputs;
459
460 InstDeps *pInstDeps;
461
462 SHADER_PIPE_TYPE currentShaderType;
463 struct prog_instruction * pILInst;
464 GLuint uiCurInst;
465 GLubyte SamplerUnits[MAX_SAMPLERS];
466 GLboolean bR6xx;
467 /* helper to decide which type of instruction to assemble */
468 GLboolean is_tex;
469 /* we inserted helper intructions and need barrier on next TEX ins */
470 GLboolean need_tex_barrier;
471
472 SUB_OFFSET * subs;
473 GLuint unSubArraySize;
474 GLuint unSubArrayPointer;
475 CALLER_POINTER * callers;
476 GLuint unCallerArraySize;
477 GLuint unCallerArrayPointer;
478 unsigned int CALLSP;
479 CALL_LEVEL CALLSTACK[SQ_MAX_CALL_DEPTH];
480
481 GLuint unCFflags;
482
483 PRESUB_DESC * presubs;
484 GLuint unPresubArraySize;
485 GLuint unNumPresub;
486 GLuint unCurNumILInsts;
487
488 GLuint unVetTexBits;
489
490 GLuint shadow_regs[R700_MAX_TEXTURE_UNITS];
491
492 } r700_AssemblerBase;
493
494 //Internal use
495 BITS addrmode_PVSDST(PVSDST * pPVSDST);
496 void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode);
497 void nomask_PVSDST(PVSDST * pPVSDST);
498 BITS addrmode_PVSSRC(PVSSRC* pPVSSRC);
499 void setaddrmode_PVSSRC(PVSSRC* pPVSSRC, BITS addrmode);
500 void setswizzle_PVSSRC(PVSSRC* pPVSSRC, BITS swz);
501 void noswizzle_PVSSRC(PVSSRC* pPVSSRC);
502 void swizzleagain_PVSSRC(PVSSRC * pPVSSRC, BITS x, BITS y, BITS z, BITS w);
503 void neg_PVSSRC(PVSSRC* pPVSSRC);
504 void noneg_PVSSRC(PVSSRC* pPVSSRC);
505 void flipneg_PVSSRC(PVSSRC* pPVSSRC);
506 void zerocomp_PVSSRC(PVSSRC* pPVSSRC, int c);
507 void onecomp_PVSSRC(PVSSRC* pPVSSRC, int c);
508 BITS is_misc_component_exported(VAP_OUT_VTX_FMT_0* pOutVTXFmt0);
509 BITS is_depth_component_exported(OUT_FRAGMENT_FMT_0* pFPOutFmt) ;
510 GLboolean is_reduction_opcode(PVSDWORD * dest);
511 GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size);
512
513 unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3);
514
515 GLboolean IsTex(gl_inst_opcode Opcode);
516 GLboolean IsAlu(gl_inst_opcode Opcode);
517 int check_current_clause(r700_AssemblerBase* pAsm,
518 CF_CLAUSE_TYPE new_clause_type);
519 GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm,
520 R700VertexInstruction* vertex_instruction_ptr);
521 GLboolean add_tex_instruction(r700_AssemblerBase* pAsm,
522 R700TextureInstruction* tex_instruction_ptr);
523 GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm,
524 GLuint gl_client_id,
525 GLuint destination_register,
526 GLuint number_of_elements,
527 GLenum dataElementType,
528 VTX_FETCH_METHOD* pFetchMethod);
529 GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm,
530 GLuint destination_register,
531 GLenum type,
532 GLint size,
533 GLubyte element,
534 GLuint _signed,
535 GLboolean normalize,
536 GLenum format,
537 VTX_FETCH_METHOD * pFetchMethod);
538 GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm);
539 GLuint gethelpr(r700_AssemblerBase* pAsm);
540 void resethelpr(r700_AssemblerBase* pAsm);
541 void checkop_init(r700_AssemblerBase* pAsm);
542 GLboolean mov_temp(r700_AssemblerBase* pAsm, int src);
543 GLboolean checkop1(r700_AssemblerBase* pAsm);
544 GLboolean checkop2(r700_AssemblerBase* pAsm);
545 GLboolean checkop3(r700_AssemblerBase* pAsm);
546 GLboolean assemble_src(r700_AssemblerBase *pAsm,
547 int src,
548 int fld);
549 GLboolean assemble_dst(r700_AssemblerBase *pAsm);
550 GLboolean tex_dst(r700_AssemblerBase *pAsm);
551 GLboolean tex_src(r700_AssemblerBase *pAsm);
552 GLboolean assemble_tex_instruction(r700_AssemblerBase *pAsm, GLboolean normalized);
553 void initialize(r700_AssemblerBase *pAsm);
554 GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr,
555 int source_index,
556 PVSSRC* pSource,
557 BITS scalar_channel_index);
558 GLboolean add_alu_instruction(r700_AssemblerBase* pAsm,
559 R700ALUInstruction* alu_instruction_ptr,
560 GLuint contiguous_slots_needed);
561
562 GLboolean add_cf_instruction(r700_AssemblerBase* pAsm);
563 void add_return_inst(r700_AssemblerBase *pAsm);
564
565 void get_src_properties(R700ALUInstruction* alu_instruction_ptr,
566 int source_index,
567 BITS* psrc_sel,
568 BITS* psrc_rel,
569 BITS* psrc_chan,
570 BITS* psrc_neg);
571 int is_cfile(BITS sel);
572 int is_const(BITS sel);
573 int is_gpr(BITS sel);
574 GLboolean reserve_cfile(r700_AssemblerBase* pAsm,
575 GLuint sel,
576 GLuint chan);
577 GLboolean reserve_gpr(r700_AssemblerBase* pAsm, GLuint sel, GLuint chan, GLuint cycle);
578 GLboolean cycle_for_scalar_bank_swizzle(const int swiz, const int sel, GLuint* pCycle);
579 GLboolean cycle_for_vector_bank_swizzle(const int swiz, const int sel, GLuint* pCycle);
580 GLboolean check_scalar(r700_AssemblerBase* pAsm,
581 R700ALUInstruction* alu_instruction_ptr);
582 GLboolean check_vector(r700_AssemblerBase* pAsm,
583 R700ALUInstruction* alu_instruction_ptr);
584 GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm);
585 GLboolean next_ins(r700_AssemblerBase *pAsm);
586
587 GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops);
588 GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset);
589 GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue);
590 GLboolean testFlag(r700_AssemblerBase *pAsm);
591 GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP);
592 GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF);
593
594 GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode);
595 GLboolean assemble_ABS(r700_AssemblerBase *pAsm);
596 GLboolean assemble_ADD(r700_AssemblerBase *pAsm);
597 GLboolean assemble_ARL(r700_AssemblerBase *pAsm);
598 GLboolean assemble_BAD(char *opcode_str);
599 GLboolean assemble_CMP(r700_AssemblerBase *pAsm);
600 GLboolean assemble_DOT(r700_AssemblerBase *pAsm);
601 GLboolean assemble_DST(r700_AssemblerBase *pAsm);
602 GLboolean assemble_EX2(r700_AssemblerBase *pAsm);
603 GLboolean assemble_EXP(r700_AssemblerBase *pAsm);
604 GLboolean assemble_FLR(r700_AssemblerBase *pAsm);
605 GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm);
606 GLboolean assemble_FRC(r700_AssemblerBase *pAsm);
607 GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode);
608 GLboolean assemble_LG2(r700_AssemblerBase *pAsm);
609 GLboolean assemble_LRP(r700_AssemblerBase *pAsm);
610 GLboolean assemble_LOG(r700_AssemblerBase *pAsm);
611 GLboolean assemble_MAD(r700_AssemblerBase *pAsm);
612 GLboolean assemble_LIT(r700_AssemblerBase *pAsm);
613 GLboolean assemble_MAX(r700_AssemblerBase *pAsm);
614 GLboolean assemble_MIN(r700_AssemblerBase *pAsm);
615 GLboolean assemble_MOV(r700_AssemblerBase *pAsm);
616 GLboolean assemble_MUL(r700_AssemblerBase *pAsm);
617 GLboolean assemble_POW(r700_AssemblerBase *pAsm);
618 GLboolean assemble_RCP(r700_AssemblerBase *pAsm);
619 GLboolean assemble_RSQ(r700_AssemblerBase *pAsm);
620 GLboolean assemble_SCS(r700_AssemblerBase *pAsm);
621 GLboolean assemble_SGE(r700_AssemblerBase *pAsm);
622 GLboolean assemble_CONT(r700_AssemblerBase *pAsm);
623
624 GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode);
625 GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode);
626 GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode);
627
628 GLboolean assemble_SLT(r700_AssemblerBase *pAsm);
629 GLboolean assemble_STP(r700_AssemblerBase *pAsm);
630 GLboolean assemble_TEX(r700_AssemblerBase *pAsm);
631 GLboolean assemble_XPD(r700_AssemblerBase *pAsm);
632 GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm);
633 GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse);
634 GLboolean assemble_ELSE(r700_AssemblerBase *pAsm);
635 GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm);
636
637 GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm);
638 GLboolean assemble_BRK(r700_AssemblerBase *pAsm);
639 GLboolean assemble_COND(r700_AssemblerBase *pAsm);
640 GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm);
641
642 GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift);
643 GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm);
644 GLboolean assemble_RET(r700_AssemblerBase *pAsm);
645 GLboolean assemble_CAL(r700_AssemblerBase *pAsm,
646 GLint nILindex,
647 GLuint uiIL_Offest,
648 GLuint uiNumberInsts,
649 struct prog_instruction *pILInst,
650 PRESUB_DESC * pPresubDesc);
651
652 GLboolean Process_Export(r700_AssemblerBase* pAsm,
653 GLuint type,
654 GLuint export_starting_index,
655 GLuint export_count,
656 GLuint starting_register_number,
657 GLboolean is_depth_export);
658 GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm,
659 BITS depth_channel_select);
660
661 GLboolean callPreSub(r700_AssemblerBase* pAsm,
662 LOADABLE_SCRIPT_SIGNITURE scriptSigniture,
663 /* struct prog_instruction ** pILInstParent, */
664 COMPILED_SUB * pCompiledSub,
665 GLshort uOutReg,
666 GLshort uNumValidSrc);
667
668 //Interface
669 GLboolean AssembleInstr(GLuint uiFirstInst,
670 GLuint uiIL_Shift,
671 GLuint uiNumberInsts,
672 struct prog_instruction *pILInst,
673 r700_AssemblerBase *pR700AsmCode);
674 GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten);
675 GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten);
676
677 GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg);
678 GLboolean InitShaderProgram(r700_AssemblerBase * pAsm);
679
680 int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader);
681 GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode);
682
683 #endif //_R700_ASSEMBLER_H_