• 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 "compiler.h"
12 #include "glheader.h"
13 #include "mfeatures.h"
14 
15 struct _glapi_table;
16 struct gl_context;
17 
18 #define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8
19 #define MAX_NUM_PASSES_ATI                2
20 #define MAX_NUM_FRAGMENT_REGISTERS_ATI    6
21 
22 struct ati_fs_opcode_st
23 {
24    GLenum opcode;
25    GLint num_src_args;
26 };
27 
28 extern struct ati_fs_opcode_st ati_fs_opcodes[];
29 
30 struct atifragshader_src_register
31 {
32    GLuint Index;
33    GLuint argRep;
34    GLuint argMod;
35 };
36 
37 struct atifragshader_dst_register
38 {
39    GLuint Index;
40    GLuint dstMod;
41    GLuint dstMask;
42 };
43 
44 #define ATI_FRAGMENT_SHADER_COLOR_OP 0
45 #define ATI_FRAGMENT_SHADER_ALPHA_OP 1
46 #define ATI_FRAGMENT_SHADER_PASS_OP  2
47 #define ATI_FRAGMENT_SHADER_SAMPLE_OP 3
48 
49 /* two opcodes - one for color/one for alpha */
50 /* up to three source registers for most ops */
51 struct atifs_instruction
52 {
53    GLenum Opcode[2];
54    GLuint ArgCount[2];
55    struct atifragshader_src_register SrcReg[2][3];
56    struct atifragshader_dst_register DstReg[2];
57 };
58 
59 /* different from arithmetic shader instruction */
60 struct atifs_setupinst
61 {
62    GLenum Opcode;
63    GLuint src;
64    GLenum swizzle;
65 };
66 
67 
68 #if FEATURE_ATI_fragment_shader
69 
70 extern void
71 _mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp);
72 
73 extern struct ati_fragment_shader *
74 _mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id);
75 
76 extern void
77 _mesa_delete_ati_fragment_shader(struct gl_context *ctx,
78                                  struct ati_fragment_shader *s);
79 
80 
81 extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range);
82 
83 extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id);
84 
85 extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id);
86 
87 extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void);
88 
89 extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void);
90 
91 extern void GLAPIENTRY
92 _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle);
93 
94 extern void GLAPIENTRY
95 _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle);
96 
97 extern void GLAPIENTRY
98 _mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask,
99 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
100 			  GLuint arg1Mod);
101 
102 extern void GLAPIENTRY
103 _mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask,
104 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
105 			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
106 			  GLuint arg2Mod);
107 
108 extern void GLAPIENTRY
109 _mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask,
110 			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
111 			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
112 			  GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
113 			  GLuint arg3Mod);
114 
115 extern void GLAPIENTRY
116 _mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
117 			  GLuint arg1Rep, GLuint arg1Mod);
118 
119 extern void GLAPIENTRY
120 _mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
121 			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
122 			  GLuint arg2Rep, GLuint arg2Mod);
123 
124 extern void GLAPIENTRY
125 _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
126 			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
127 			  GLuint arg2Rep, GLuint arg2Mod, GLuint arg3,
128 			  GLuint arg3Rep, GLuint arg3Mod);
129 
130 extern void GLAPIENTRY
131 _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value);
132 
133 #else /* FEATURE_ATI_fragment_shader */
134 
135 static inline void
_mesa_init_ati_fragment_shader_dispatch(struct _glapi_table * disp)136 _mesa_init_ati_fragment_shader_dispatch(struct _glapi_table *disp)
137 {
138 }
139 
140 static inline struct ati_fragment_shader *
_mesa_new_ati_fragment_shader(struct gl_context * ctx,GLuint id)141 _mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id)
142 {
143    return NULL;
144 }
145 
146 static inline void
_mesa_delete_ati_fragment_shader(struct gl_context * ctx,struct ati_fragment_shader * s)147 _mesa_delete_ati_fragment_shader(struct gl_context *ctx,
148                                  struct ati_fragment_shader *s)
149 {
150 }
151 
152 #endif /* FEATURE_ATI_fragment_shader */
153 
154 #endif /* ATIFRAGSHADER_H */
155