{
GLuint flags = 0;
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
+ if (inst->Saturate)
flags |= A0_DEST_SATURATE;
if (inst->DstReg.WriteMask & WRITEMASK_X)
flags |= A0_DEST_CHANNEL_X;
mesa_inst->Opcode = inst->op;
mesa_inst->CondUpdate = inst->cond_update;
if (inst->saturate)
- mesa_inst->SaturateMode = SATURATE_ZERO_ONE;
+ mesa_inst->Saturate = GL_TRUE;
mesa_inst->DstReg.File = inst->dst.file;
mesa_inst->DstReg.Index = inst->dst.index;
mesa_inst->DstReg.CondMask = inst->dst.cond_mask;
struct gl_program_machine *machine, const GLfloat value[4])
{
const struct prog_dst_register *dstReg = &(inst->DstReg);
- const GLboolean clamp = inst->SaturateMode == SATURATE_ZERO_ONE;
+ const GLboolean clamp = inst->Saturate;
GLuint writeMask = dstReg->WriteMask;
GLfloat clampedValue[4];
GLfloat *dst = get_dst_register_pointer(dstReg, machine);
inst[i].DstReg.CondMask = COND_TR;
inst[i].DstReg.CondSwizzle = SWIZZLE_NOOP;
- inst[i].SaturateMode = SATURATE_OFF;
+ inst[i].Saturate = GL_FALSE;
inst[i].Precision = FLOAT32;
}
}
/*@}*/
-/**
- * Saturation modes when storing values.
- */
-/*@{*/
-#define SATURATE_OFF 0
-#define SATURATE_ZERO_ONE 1
-/*@}*/
-
-
/**
* Per-component negation masks
*/
GLuint CondDst:1;
/**
- * Saturate each value of the vectored result to the range [0,1] or the
- * range [-1,1]. \c SSAT mode (i.e., saturation to the range [-1,1]) is
- * only available in NV_fragment_program2 mode.
- * Value is one of the SATURATE_* tokens.
+ * Saturate each value of the vectored result to the range [0,1].
*
* \since
* NV_fragment_program_option, NV_vertex_program3.
*/
- GLuint SaturateMode:2;
+ GLuint Saturate:1;
/**
* Per-instruction selectable precision: FLOAT32, FLOAT16, FIXED12.
return
can_downward_mov_be_modifed(mov) &&
mov->DstReg.File == PROGRAM_TEMPORARY &&
- mov->SaturateMode == SATURATE_OFF;
+ !mov->Saturate;
}
if (mask != (inst->DstReg.WriteMask & mask))
return GL_FALSE;
- inst->SaturateMode |= mov->SaturateMode;
+ inst->Saturate |= mov->Saturate;
/* Depending on the instruction, we may need to recompute the swizzles.
* Also, some other instructions (like TEX) are not linear. We will only
fprintf(f, ".C");
/* frag prog only */
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
+ if (inst->Saturate)
fprintf(f, "_SAT");
fprintf(f, " ");
switch (inst->Opcode) {
case OPCODE_SWZ:
fprintf(f, "SWZ");
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
+ if (inst->Saturate)
fprintf(f, "_SAT");
fprintf(f, " ");
fprint_dst_reg(f, &inst->DstReg, mode, prog);
case OPCODE_TXB:
case OPCODE_TXD:
fprintf(f, "%s", _mesa_opcode_string(inst->Opcode));
- if (inst->SaturateMode == SATURATE_ZERO_ONE)
+ if (inst->Saturate)
fprintf(f, "_SAT");
fprintf(f, " ");
fprint_dst_reg(f, &inst->DstReg, mode, prog);
break;
}
- if (prog_inst->SaturateMode) {
- assert(prog_inst->SaturateMode == SATURATE_ZERO_ONE);
+ if (prog_inst->Saturate) {
+ assert(prog_inst->Saturate);
assert(!dest.dest.is_ssa);
ptn_move_dest(b, dest, nir_fsat(b, ptn_src_for_dest(c, &dest)));
}
inst->Base.Opcode = base->Opcode;
inst->Base.CondUpdate = base->CondUpdate;
inst->Base.CondDst = base->CondDst;
- inst->Base.SaturateMode = base->SaturateMode;
+ inst->Base.Saturate = base->Saturate;
inst->Base.Precision = base->Precision;
asm_instruction_set_operands(inst, dst, src0, src1, src2);
{
inst->CondUpdate = 0;
inst->CondDst = 0;
- inst->SaturateMode = SATURATE_OFF;
+ inst->Saturate = GL_FALSE;
inst->Precision = FLOAT32;
*/
if (state->mode == ARB_fragment) {
if (strcmp(suffix, "_SAT") == 0) {
- inst->SaturateMode = SATURATE_ZERO_ONE;
+ inst->Saturate = GL_TRUE;
suffix += 4;
}
}
/* change the instruction to write to colorTemp w/ clamping */
inst->DstReg.File = PROGRAM_TEMPORARY;
inst->DstReg.Index = colorTemp;
- inst->SaturateMode = saturate;
+ inst->Saturate = saturate;
/* don't break (may be several writes to result.color) */
}
inst++;
inst->SrcReg[2].File = PROGRAM_STATE_VAR;
inst->SrcReg[2].Index = fogPRefOpt;
inst->SrcReg[2].Swizzle = SWIZZLE_YYYY;
- inst->SaturateMode = SATURATE_ZERO_ONE;
+ inst->Saturate = GL_TRUE;
inst++;
}
else {
inst->SrcReg[0].Index = fogFactorTemp;
inst->SrcReg[0].Negate = NEGATE_XYZW;
inst->SrcReg[0].Swizzle = SWIZZLE_XXXX;
- inst->SaturateMode = SATURATE_ZERO_ONE;
+ inst->Saturate = GL_TRUE;
inst++;
}
/* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
if (num_dst)
dst[0] = translate_dst( t,
&inst->DstReg,
- inst->SaturateMode,
+ inst->Saturate,
clamp_dst_color_output);
for (i = 0; i < num_src; i++)