atifragshader.h revision b8e80941
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
14struct 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
21struct ati_fs_opcode_st
22{
23   GLenum opcode;
24   GLint num_src_args;
25};
26
27struct atifragshader_src_register
28{
29   GLuint Index;
30   GLuint argRep;
31   GLuint argMod;
32};
33
34struct 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 */
48struct 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 */
57struct atifs_setupinst
58{
59   GLenum Opcode;
60   GLuint src;
61   GLenum swizzle;
62};
63
64
65extern struct ati_fragment_shader *
66_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id);
67
68extern void
69_mesa_delete_ati_fragment_shader(struct gl_context *ctx,
70                                 struct ati_fragment_shader *s);
71
72
73extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range);
74
75extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id);
76
77extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id);
78
79extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void);
80
81extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void);
82
83extern void GLAPIENTRY
84_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle);
85
86extern void GLAPIENTRY
87_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle);
88
89extern void GLAPIENTRY
90_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask,
91			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
92			  GLuint arg1Mod);
93
94extern 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
100extern 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
107extern void GLAPIENTRY
108_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
109			  GLuint arg1Rep, GLuint arg1Mod);
110
111extern 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
116extern 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
122extern void GLAPIENTRY
123_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value);
124
125
126#endif /* ATIFRAGSHADER_H */
127