atifragshader.h revision b8e80941
1848b8605Smrg/*
2848b8605Smrg * Mesa 3-D graphics library ATI Fragment Shader
3848b8605Smrg *
4848b8605Smrg * Copyright (C) 2004  David Airlie   All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg */
7848b8605Smrg
8848b8605Smrg#ifndef ATIFRAGSHADER_H
9848b8605Smrg#define ATIFRAGSHADER_H
10848b8605Smrg
11848b8605Smrg#include "glheader.h"
12848b8605Smrg
13b8e80941Smrg
14848b8605Smrgstruct gl_context;
15848b8605Smrg
16848b8605Smrg#define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8
17848b8605Smrg#define MAX_NUM_PASSES_ATI                2
18848b8605Smrg#define MAX_NUM_FRAGMENT_REGISTERS_ATI    6
19b8e80941Smrg#define MAX_NUM_FRAGMENT_CONSTANTS_ATI    8
20848b8605Smrg
21848b8605Smrgstruct ati_fs_opcode_st
22848b8605Smrg{
23848b8605Smrg   GLenum opcode;
24848b8605Smrg   GLint num_src_args;
25848b8605Smrg};
26848b8605Smrg
27848b8605Smrgstruct atifragshader_src_register
28848b8605Smrg{
29848b8605Smrg   GLuint Index;
30848b8605Smrg   GLuint argRep;
31848b8605Smrg   GLuint argMod;
32848b8605Smrg};
33848b8605Smrg
34848b8605Smrgstruct atifragshader_dst_register
35848b8605Smrg{
36848b8605Smrg   GLuint Index;
37848b8605Smrg   GLuint dstMod;
38848b8605Smrg   GLuint dstMask;
39848b8605Smrg};
40848b8605Smrg
41848b8605Smrg#define ATI_FRAGMENT_SHADER_COLOR_OP 0
42848b8605Smrg#define ATI_FRAGMENT_SHADER_ALPHA_OP 1
43848b8605Smrg#define ATI_FRAGMENT_SHADER_PASS_OP  2
44848b8605Smrg#define ATI_FRAGMENT_SHADER_SAMPLE_OP 3
45848b8605Smrg
46848b8605Smrg/* two opcodes - one for color/one for alpha */
47848b8605Smrg/* up to three source registers for most ops */
48848b8605Smrgstruct atifs_instruction
49848b8605Smrg{
50848b8605Smrg   GLenum Opcode[2];
51848b8605Smrg   GLuint ArgCount[2];
52848b8605Smrg   struct atifragshader_src_register SrcReg[2][3];
53848b8605Smrg   struct atifragshader_dst_register DstReg[2];
54848b8605Smrg};
55848b8605Smrg
56848b8605Smrg/* different from arithmetic shader instruction */
57848b8605Smrgstruct atifs_setupinst
58848b8605Smrg{
59848b8605Smrg   GLenum Opcode;
60848b8605Smrg   GLuint src;
61848b8605Smrg   GLenum swizzle;
62848b8605Smrg};
63848b8605Smrg
64848b8605Smrg
65848b8605Smrgextern struct ati_fragment_shader *
66848b8605Smrg_mesa_new_ati_fragment_shader(struct gl_context *ctx, GLuint id);
67848b8605Smrg
68848b8605Smrgextern void
69848b8605Smrg_mesa_delete_ati_fragment_shader(struct gl_context *ctx,
70848b8605Smrg                                 struct ati_fragment_shader *s);
71848b8605Smrg
72848b8605Smrg
73848b8605Smrgextern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range);
74848b8605Smrg
75848b8605Smrgextern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id);
76848b8605Smrg
77848b8605Smrgextern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id);
78848b8605Smrg
79848b8605Smrgextern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void);
80848b8605Smrg
81848b8605Smrgextern void GLAPIENTRY _mesa_EndFragmentShaderATI(void);
82848b8605Smrg
83848b8605Smrgextern void GLAPIENTRY
84848b8605Smrg_mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle);
85848b8605Smrg
86848b8605Smrgextern void GLAPIENTRY
87848b8605Smrg_mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle);
88848b8605Smrg
89848b8605Smrgextern void GLAPIENTRY
90848b8605Smrg_mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask,
91848b8605Smrg			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
92848b8605Smrg			  GLuint arg1Mod);
93848b8605Smrg
94848b8605Smrgextern void GLAPIENTRY
95848b8605Smrg_mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask,
96848b8605Smrg			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
97848b8605Smrg			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
98848b8605Smrg			  GLuint arg2Mod);
99848b8605Smrg
100848b8605Smrgextern void GLAPIENTRY
101848b8605Smrg_mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask,
102848b8605Smrg			  GLuint dstMod, GLuint arg1, GLuint arg1Rep,
103848b8605Smrg			  GLuint arg1Mod, GLuint arg2, GLuint arg2Rep,
104848b8605Smrg			  GLuint arg2Mod, GLuint arg3, GLuint arg3Rep,
105848b8605Smrg			  GLuint arg3Mod);
106848b8605Smrg
107848b8605Smrgextern void GLAPIENTRY
108848b8605Smrg_mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
109848b8605Smrg			  GLuint arg1Rep, GLuint arg1Mod);
110848b8605Smrg
111848b8605Smrgextern void GLAPIENTRY
112848b8605Smrg_mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
113848b8605Smrg			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
114848b8605Smrg			  GLuint arg2Rep, GLuint arg2Mod);
115848b8605Smrg
116848b8605Smrgextern void GLAPIENTRY
117848b8605Smrg_mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1,
118848b8605Smrg			  GLuint arg1Rep, GLuint arg1Mod, GLuint arg2,
119848b8605Smrg			  GLuint arg2Rep, GLuint arg2Mod, GLuint arg3,
120848b8605Smrg			  GLuint arg3Rep, GLuint arg3Mod);
121848b8605Smrg
122848b8605Smrgextern void GLAPIENTRY
123848b8605Smrg_mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value);
124848b8605Smrg
125848b8605Smrg
126848b8605Smrg#endif /* ATIFRAGSHADER_H */
127