Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 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 | #define MAX_NUM_INSTRUCTIONS_PER_PASS_ATI 8 |
| 12 | #define MAX_NUM_PASSES_ATI 2 |
| 13 | #define MAX_NUM_FRAGMENT_REGISTERS_ATI 6 |
| 14 | |
| 15 | struct ati_fs_opcode_st |
| 16 | { |
| 17 | GLenum opcode; |
| 18 | GLint num_src_args; |
| 19 | }; |
| 20 | |
| 21 | extern struct ati_fs_opcode_st ati_fs_opcodes[]; |
| 22 | |
| 23 | struct atifragshader_src_register |
| 24 | { |
| 25 | GLuint Index; |
| 26 | GLuint argRep; |
| 27 | GLuint argMod; |
| 28 | }; |
| 29 | |
| 30 | struct atifragshader_dst_register |
| 31 | { |
| 32 | GLuint Index; |
| 33 | GLuint dstMod; |
| 34 | GLuint dstMask; |
Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | #define ATI_FRAGMENT_SHADER_COLOR_OP 0 |
| 38 | #define ATI_FRAGMENT_SHADER_ALPHA_OP 1 |
| 39 | #define ATI_FRAGMENT_SHADER_PASS_OP 2 |
| 40 | #define ATI_FRAGMENT_SHADER_SAMPLE_OP 3 |
| 41 | |
Roland Scheidegger | f519a77 | 2005-09-02 01:11:53 +0000 | [diff] [blame] | 42 | /* two opcodes - one for color/one for alpha */ |
Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 43 | /* up to three source registers for most ops */ |
| 44 | struct atifs_instruction |
| 45 | { |
| 46 | GLenum Opcode[2]; |
| 47 | GLuint ArgCount[2]; |
| 48 | struct atifragshader_src_register SrcReg[2][3]; |
| 49 | struct atifragshader_dst_register DstReg[2]; |
| 50 | }; |
| 51 | |
Roland Scheidegger | f519a77 | 2005-09-02 01:11:53 +0000 | [diff] [blame] | 52 | /* different from arithmetic shader instruction */ |
| 53 | struct atifs_setupinst |
| 54 | { |
| 55 | GLenum Opcode; |
| 56 | GLuint src; |
| 57 | GLenum swizzle; |
| 58 | }; |
| 59 | |
Brian Paul | 63d6830 | 2005-11-19 16:43:04 +0000 | [diff] [blame] | 60 | |
| 61 | extern struct ati_fragment_shader * |
| 62 | _mesa_new_ati_fragment_shader(GLcontext *ctx, GLuint id); |
| 63 | |
| 64 | extern void |
| 65 | _mesa_delete_ati_fragment_shader(GLcontext *ctx, |
| 66 | struct ati_fragment_shader *s); |
| 67 | |
| 68 | |
Dave Airlie | 7f752fe | 2004-12-19 03:06:59 +0000 | [diff] [blame] | 69 | extern GLuint GLAPIENTRY _mesa_GenFragmentShadersATI(GLuint range); |
| 70 | |
| 71 | extern void GLAPIENTRY _mesa_BindFragmentShaderATI(GLuint id); |
| 72 | |
| 73 | extern void GLAPIENTRY _mesa_DeleteFragmentShaderATI(GLuint id); |
| 74 | |
| 75 | extern void GLAPIENTRY _mesa_BeginFragmentShaderATI(void); |
| 76 | |
| 77 | extern void GLAPIENTRY _mesa_EndFragmentShaderATI(void); |
| 78 | |
| 79 | extern void GLAPIENTRY |
| 80 | _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle); |
| 81 | |
| 82 | extern void GLAPIENTRY |
| 83 | _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle); |
| 84 | |
| 85 | extern void GLAPIENTRY |
| 86 | _mesa_ColorFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMask, |
| 87 | GLuint dstMod, GLuint arg1, GLuint arg1Rep, |
| 88 | GLuint arg1Mod); |
| 89 | |
| 90 | extern void GLAPIENTRY |
| 91 | _mesa_ColorFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMask, |
| 92 | GLuint dstMod, GLuint arg1, GLuint arg1Rep, |
| 93 | GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, |
| 94 | GLuint arg2Mod); |
| 95 | |
| 96 | extern void GLAPIENTRY |
| 97 | _mesa_ColorFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMask, |
| 98 | GLuint dstMod, GLuint arg1, GLuint arg1Rep, |
| 99 | GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, |
| 100 | GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, |
| 101 | GLuint arg3Mod); |
| 102 | |
| 103 | extern void GLAPIENTRY |
| 104 | _mesa_AlphaFragmentOp1ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, |
| 105 | GLuint arg1Rep, GLuint arg1Mod); |
| 106 | |
| 107 | extern void GLAPIENTRY |
| 108 | _mesa_AlphaFragmentOp2ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, |
| 109 | GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, |
| 110 | GLuint arg2Rep, GLuint arg2Mod); |
| 111 | |
| 112 | extern void GLAPIENTRY |
| 113 | _mesa_AlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, |
| 114 | GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, |
| 115 | GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, |
| 116 | GLuint arg3Rep, GLuint arg3Mod); |
| 117 | |
| 118 | extern void GLAPIENTRY |
| 119 | _mesa_SetFragmentShaderConstantATI(GLuint dst, const GLfloat * value); |
| 120 | |
| 121 | #endif |