2 * Copyright (C) 2008 Nicolai Haehnle.
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:
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.
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.
28 #ifndef __RADEON_PROGRAM_PAIR_H_
29 #define __RADEON_PROGRAM_PAIR_H_
31 #include "radeon_program.h"
33 struct radeon_compiler
;
37 * Represents a paired instruction, as found in R300 and R500
40 struct radeon_pair_instruction_source
{
46 struct radeon_pair_instruction_rgb
{
50 GLuint OutputWriteMask
:3;
53 struct radeon_pair_instruction_source Src
[3];
63 struct radeon_pair_instruction_alpha
{
67 GLuint OutputWriteMask
:1;
68 GLuint DepthWriteMask
:1;
71 struct radeon_pair_instruction_source Src
[3];
81 struct radeon_pair_instruction
{
82 struct radeon_pair_instruction_rgb RGB
;
83 struct radeon_pair_instruction_alpha Alpha
;
88 RADEON_OPCODE_TEX
= 0,
94 struct radeon_pair_texture_instruction
{
95 GLuint Opcode
:2; /**< one of RADEON_OPCODE_xxx */
101 GLuint TexSrcTarget
:3;
104 GLuint SrcSwizzle
:12;
111 struct radeon_pair_handler
{
113 * Fill in the proper hardware index for the given constant register.
115 * @return GL_FALSE on error.
117 GLboolean (*EmitConst
)(void*, GLuint file
, GLuint index
, GLuint
*hwindex
);
120 * Write a paired instruction to the hardware.
122 * @return GL_FALSE on error.
124 GLboolean (*EmitPaired
)(void*, struct radeon_pair_instruction
*);
127 * Write a texture instruction to the hardware.
128 * Register indices have already been rewritten to the allocated
129 * hardware register numbers.
131 * @return GL_FALSE on error.
133 GLboolean (*EmitTex
)(void*, struct radeon_pair_texture_instruction
*);
136 * Called before a block of contiguous, independent texture
137 * instructions is emitted.
139 GLboolean (*BeginTexBlock
)(void*);
144 void radeonPairProgram(
145 struct radeon_compiler
* compiler
,
146 const struct radeon_pair_handler
*, void *userdata
);
148 void radeonPrintPairInstruction(struct radeon_pair_instruction
*inst
);
150 #endif /* __RADEON_PROGRAM_PAIR_H_ */