-/* $Id: nvfragprog.h,v 1.4 2003/03/14 15:40:59 brianp Exp $ */
-
/*
* Mesa 3-D graphics library
* Version: 5.1
*/
-/* Private vertex program types and constants only used by files
- * related to vertex programs.
+/* Private fragment program types and constants only used by files
+ * related to fragment programs.
+ *
+ * XXX TO-DO: Rename this file "fragprog.h" since it's not NV-specific.
*/
#include "config.h"
-/* Location of register sets within the whole register file */
-#define FP_INPUT_REG_START 0
-#define FP_INPUT_REG_END (FP_INPUT_REG_START + MAX_NV_FRAGMENT_PROGRAM_INPUTS - 1)
-#define FP_OUTPUT_REG_START (FP_INPUT_REG_END + 1)
-#define FP_OUTPUT_REG_END (FP_OUTPUT_REG_START + MAX_NV_FRAGMENT_PROGRAM_OUTPUTS - 1)
-#define FP_TEMP_REG_START (FP_OUTPUT_REG_END + 1)
-#define FP_TEMP_REG_END (FP_TEMP_REG_START + MAX_NV_FRAGMENT_PROGRAM_TEMPS - 1)
-#define FP_PROG_REG_START (FP_TEMP_REG_END + 1)
-#define FP_PROG_REG_END (FP_PROG_REG_START + MAX_NV_FRAGMENT_PROGRAM_PARAMS - 1)
-#define FP_DUMMY_REG_START (FP_PROG_REG_END + 1)
-#define FP_DUMMY_REG_END (FP_DUMMY_REG_START + MAX_NV_FRAGMENT_PROGRAM_WRITE_ONLYS - 1)
+/* output registers */
+#define FRAG_OUTPUT_COLR 0
+#define FRAG_OUTPUT_COLH 1
+#define FRAG_OUTPUT_DEPR 2
/* condition codes */
#define FIXED12 0x4
+/* Fragment program instruction opcodes */
enum fp_opcode {
- FP_OPCODE_ADD = 1000,
+ FP_OPCODE_ABS = 1000, /* ARB_f_p only */
+ FP_OPCODE_ADD,
+ FP_OPCODE_CMP, /* ARB_f_p only */
FP_OPCODE_COS,
- FP_OPCODE_DDX,
- FP_OPCODE_DDY,
+ FP_OPCODE_DDX, /* NV_f_p only */
+ FP_OPCODE_DDY, /* NV_f_p only */
FP_OPCODE_DP3,
FP_OPCODE_DP4,
+ FP_OPCODE_DPH, /* ARB_f_p only */
FP_OPCODE_DST,
FP_OPCODE_EX2,
FP_OPCODE_FLR,
FP_OPCODE_MIN,
FP_OPCODE_MOV,
FP_OPCODE_MUL,
- FP_OPCODE_PK2H,
- FP_OPCODE_PK2US,
- FP_OPCODE_PK4B,
- FP_OPCODE_PK4UB,
+ FP_OPCODE_PK2H, /* NV_f_p only */
+ FP_OPCODE_PK2US, /* NV_f_p only */
+ FP_OPCODE_PK4B, /* NV_f_p only */
+ FP_OPCODE_PK4UB, /* NV_f_p only */
FP_OPCODE_POW,
FP_OPCODE_RCP,
- FP_OPCODE_RFL,
+ FP_OPCODE_RFL, /* NV_f_p only */
FP_OPCODE_RSQ,
- FP_OPCODE_SEQ,
- FP_OPCODE_SFL,
- FP_OPCODE_SGE,
- FP_OPCODE_SGT,
+ FP_OPCODE_SCS, /* ARB_f_p only */
+ FP_OPCODE_SEQ, /* NV_f_p only */
+ FP_OPCODE_SFL, /* NV_f_p only */
+ FP_OPCODE_SGE, /* NV_f_p only */
+ FP_OPCODE_SGT, /* NV_f_p only */
FP_OPCODE_SIN,
- FP_OPCODE_SLE,
+ FP_OPCODE_SLE, /* NV_f_p only */
FP_OPCODE_SLT,
- FP_OPCODE_SNE,
- FP_OPCODE_STR,
+ FP_OPCODE_SNE, /* NV_f_p only */
+ FP_OPCODE_STR, /* NV_f_p only */
FP_OPCODE_SUB,
+ FP_OPCODE_SWZ, /* ARB_f_p only */
FP_OPCODE_TEX,
- FP_OPCODE_TXD,
+ FP_OPCODE_TXB, /* ARB_f_p only */
+ FP_OPCODE_TXD, /* NV_f_p only */
FP_OPCODE_TXP,
- FP_OPCODE_UP2H,
- FP_OPCODE_UP2US,
- FP_OPCODE_UP4B,
- FP_OPCODE_UP4UB,
- FP_OPCODE_X2D,
+ FP_OPCODE_UP2H, /* NV_f_p only */
+ FP_OPCODE_UP2US, /* NV_f_p only */
+ FP_OPCODE_UP4B, /* NV_f_p only */
+ FP_OPCODE_UP4UB, /* NV_f_p only */
+ FP_OPCODE_X2D, /* XPD in ARB_f_p */
FP_OPCODE_END /* private opcode */
};
+/* Instruction source register */
struct fp_src_register
{
- GLint RegType; /* constant, param, temp or attribute register */
- GLint Register; /* or the offset from the address register */
+ enum register_file File;
+ GLint Index;
GLuint Swizzle[4];
GLboolean NegateBase; /* negate before absolute value? */
GLboolean Abs; /* take absolute value? */
/* Instruction destination register */
struct fp_dst_register
{
- GLint Register;
+ enum register_file File;
+ GLint Index;
GLboolean WriteMask[4];
GLuint CondMask;
GLuint CondSwizzle[4];
};
+/* Fragment program instruction */
struct fp_instruction
{
enum fp_opcode Opcode;
GLubyte Precision; /* FLOAT32, FLOAT16 or FIXED12 */
GLubyte TexSrcUnit; /* texture unit for TEX, TXD, TXP instructions */
GLubyte TexSrcBit; /* TEXTURE_1D,2D,3D,CUBE,RECT_BIT source target */
+#if FEATURE_MESA_program_debug
+ GLint StringPos;
+#endif
};
-
#endif