• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Mesa 3-D graphics library ATI Fragment Shader
3  *
4  * Copyright (C) 2004  David Airlie   All Rights Reserved.
5  *
6  */
7 
8 #ifndef ATIFRAGSHADER_H
9 #define ATIFRAGSHADER_H
10 
11 #include "glheader.h"
12 
13 
14 struct gl_context;
15 
16 #define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8
17 #define MAX_NUM_PASSES_ATI                2
18 #define MAX_NUM_FRAGMENT_REGISTERS_ATI    6
19 #define MAX_NUM_FRAGMENT_CONSTANTS_ATI    8
20 
21 struct ati_fs_opcode_st
22 {
23    GLenum opcode;
24    GLint num_src_args;
25 };
26 
27 struct atifragshader_src_register
28 {
29    GLuint Index;
30    GLuint argRep;
31    GLuint argMod;
32 };
33 
34 struct atifragshader_dst_register
35 {
36    GLuint Index;
37    GLuint dstMod;
38    GLuint dstMask;
39 };
40 
41 #define ATI_FRAGMENT_SHADER_COLOR_OP 0
42 #define ATI_FRAGMENT_SHADER_ALPHA_OP 1
43 #define ATI_FRAGMENT_SHADER_PASS_OP  2
44 #define ATI_FRAGMENT_SHADER_SAMPLE_OP 3
45 
46 /* two opcodes - one for color/one for alpha */
47 /* up to three source registers for most ops */
48 struct atifs_instruction
49 {
50    GLenum Opcode[2];
51    GLuint ArgCount[2];
52    struct atifragshader_src_register SrcReg[2][3];
53    struct atifragshader_dst_register DstReg[2];
54 };
55 
56 /* different from arithmetic shader instruction */
57 struct atifs_setupinst
58 {
59    GLenum Opcode;
60    GLuint src;
61    GLenum swizzle;
62 };
63 
64 
65 extern struct ati_fragment_shader *
66 _mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id);
67 
68 extern void
69 _mesa_delete_ati_fragment_shader(struct gl_context *ctx,
70                                  struct ati_fragment_shader *s);
71 
72 
73 extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range);
74 
75 extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id);
76 
77 extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id);
78 
79 extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void);
80 
81 extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void);
82 
83 extern void GLAPIENTRY
84 _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle);
85 
86 extern void GLAPIENTRY
87 _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle);
88 
89 extern void GLAPIENTRY
90 _mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask,
91 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
92 			  GLuint arg1Mod);
93 
94 extern void GLAPIENTRY
95 _mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask,
96 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
97 			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
98 			  GLuint arg2Mod);
99 
100 extern void GLAPIENTRY
101 _mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask,
102 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
103 			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
104 			  GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
105 			  GLuint arg3Mod);
106 
107 extern void GLAPIENTRY
108 _mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
109 			  GLuint arg1Rep, GLuint arg1Mod);
110 
111 extern void GLAPIENTRY
112 _mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
113 			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
114 			  GLuint arg2Rep, GLuint arg2Mod);
115 
116 extern void GLAPIENTRY
117 _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
118 			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
119 			  GLuint arg2Rep, GLuint arg2Mod, GLuint arg3,
120 			  GLuint arg3Rep, GLuint arg3Mod);
121 
122 extern void GLAPIENTRY
123 _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value);
124 
125 
126 #endif /* ATIFRAGSHADER_H */
127