R1xx/r2xx: Don't use an alpha texture format for GLX_TEXTURE_FORMAT_RGB_EXT
[mesa.git] / src / mesa / drivers / dri / r300 / radeon_program_pair.h
1 /*
2 * Copyright (C) 2008 Nicolai Haehnle.
3 *
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 */
27
28 #ifndef __RADEON_PROGRAM_PAIR_H_
29 #define __RADEON_PROGRAM_PAIR_H_
30
31 #include "radeon_program.h"
32
33
34 /**
35 * Represents a paired instruction, as found in R300 and R500
36 * fragment programs.
37 */
38 struct radeon_pair_instruction_source {
39 GLuint Index:8;
40 GLuint Constant:1;
41 GLuint Used:1;
42 };
43
44 struct radeon_pair_instruction_rgb {
45 GLuint Opcode:8;
46 GLuint DestIndex:8;
47 GLuint WriteMask:3;
48 GLuint OutputWriteMask:3;
49 GLuint Saturate:1;
50
51 struct radeon_pair_instruction_source Src[3];
52
53 struct {
54 GLuint Source:2;
55 GLuint Swizzle:9;
56 GLuint Abs:1;
57 GLuint Negate:1;
58 } Arg[3];
59 };
60
61 struct radeon_pair_instruction_alpha {
62 GLuint Opcode:8;
63 GLuint DestIndex:8;
64 GLuint WriteMask:1;
65 GLuint OutputWriteMask:1;
66 GLuint DepthWriteMask:1;
67 GLuint Saturate:1;
68
69 struct radeon_pair_instruction_source Src[3];
70
71 struct {
72 GLuint Source:2;
73 GLuint Swizzle:3;
74 GLuint Abs:1;
75 GLuint Negate:1;
76 } Arg[3];
77 };
78
79 struct radeon_pair_instruction {
80 struct radeon_pair_instruction_rgb RGB;
81 struct radeon_pair_instruction_alpha Alpha;
82 };
83
84
85 /**
86 *
87 */
88 struct radeon_pair_handler {
89 /**
90 * Fill in the proper hardware index for the given constant register.
91 *
92 * @return GL_FALSE on error.
93 */
94 GLboolean (*EmitConst)(void*, GLuint file, GLuint index, GLuint *hwindex);
95
96 /**
97 * Write a paired instruction to the hardware.
98 *
99 * @return GL_FALSE on error.
100 */
101 GLboolean (*EmitPaired)(void*, struct radeon_pair_instruction*);
102
103 /**
104 * Write a texture instruction to the hardware.
105 * Register indices have already been rewritten to the allocated
106 * hardware register numbers.
107 *
108 * @return GL_FALSE on error.
109 */
110 GLboolean (*EmitTex)(void*, struct prog_instruction*);
111
112 /**
113 * Called before a block of contiguous, independent texture
114 * instructions is emitted.
115 */
116 GLboolean (*BeginTexBlock)(void*);
117
118 GLuint MaxHwTemps;
119 };
120
121 GLboolean radeonPairProgram(GLcontext *ctx, struct gl_program *program,
122 const struct radeon_pair_handler*, void *userdata);
123
124 void radeonPrintPairInstruction(struct radeon_pair_instruction *inst);
125
126 #endif /* __RADEON_PROGRAM_PAIR_H_ */