assert(0);
}
- if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
- /* FOG.y = front/back facing XXX fix this */
- setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
- setup->coef[fragSlot].dadx[1] = 0.0;
- setup->coef[fragSlot].dady[1] = 0.0;
+ if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
+ setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
+ setup->coef[fragSlot].dadx[0] = 0.0;
+ setup->coef[fragSlot].dady[0] = 0.0;
}
}
}
assert(0);
}
- if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
- /* FOG.y = front/back facing XXX fix this */
- setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
- setup->coef[fragSlot].dadx[1] = 0.0;
- setup->coef[fragSlot].dady[1] = 0.0;
+ if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
+ setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
+ setup->coef[fragSlot].dadx[0] = 0.0;
+ setup->coef[fragSlot].dady[0] = 0.0;
}
}
return TRUE;
assert(0);
}
- if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
- /* FOG.y = front/back facing XXX fix this */
- setup->coef[fragSlot].a0[1] = 1.0f - setup->quad.input.facing;
- setup->coef[fragSlot].dadx[1] = 0.0;
- setup->coef[fragSlot].dady[1] = 0.0;
+ if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) {
+ setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing;
+ setup->coef[fragSlot].dadx[0] = 0.0;
+ setup->coef[fragSlot].dady[0] = 0.0;
}
}
break;
case TGSI_SEMANTIC_GENERIC:
+ case TGSI_SEMANTIC_FACE:
/* this includes texcoords and varying vars */
src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
spfs->info.input_semantic_index[i]);
#define TGSI_SEMANTIC_PSIZE 4
#define TGSI_SEMANTIC_GENERIC 5
#define TGSI_SEMANTIC_NORMAL 6
-#define TGSI_SEMANTIC_COUNT 7 /**< number of semantic values */
+#define TGSI_SEMANTIC_FACE 7
+#define TGSI_SEMANTIC_COUNT 8 /**< number of semantic values */
struct tgsi_declaration_semantic
{
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
if (fragInputsRead & (1 << inAttr)) {
- stfp->input_to_slot[inAttr] = numIn;
- numIn++;
+ if ((fragInputsRead & FRAG_BIT_FOGC)) {
+ if (stfp->Base.UsesPointCoord) {
+ stfp->input_to_slot[inAttr] = numIn;
+ numIn++;
+ }
+ if (stfp->Base.UsesFrontFacing) {
+ stfp->input_to_slot[inAttr] = numIn;
+ numIn++;
+ }
+ if (stfp->Base.UsesFogFragCoord) {
+ stfp->input_to_slot[inAttr] = numIn;
+ numIn++;
+ }
+ } else {
+ stfp->input_to_slot[inAttr] = numIn;
+ numIn++;
+ }
}
else {
stfp->input_to_slot[inAttr] = UNUSED;
*/
static GLuint
map_register_file_index(
+ GLuint procType,
GLuint file,
GLuint index,
+ GLuint *swizzle,
const GLuint inputMapping[],
const GLuint outputMapping[],
const GLuint immediateMapping[],
{
switch( file ) {
case TGSI_FILE_INPUT:
+ if (procType == TGSI_PROCESSOR_FRAGMENT &&
+ index == FRAG_ATTRIB_FOGC) {
+ if (GET_SWZ(*swizzle, 0) == SWIZZLE_X) {
+ /* do nothing we're, ok */
+ } else if (GET_SWZ(*swizzle, 0) == SWIZZLE_Y) {
+ /* replace the swizzle with xxxx */
+ *swizzle = MAKE_SWIZZLE4(SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_X);
+ } else {
+ /* fixme: point coord */
+ }
+ }
/* inputs are mapped according to the user-defined map */
return inputMapping[index];
fulldst = &fullinst->FullDstRegisters[0];
fulldst->DstRegister.File = map_register_file( inst->DstReg.File, 0, NULL, GL_FALSE );
fulldst->DstRegister.Index = map_register_file_index(
+ procType,
fulldst->DstRegister.File,
inst->DstReg.Index,
+ NULL,
inputMapping,
outputMapping,
NULL,
for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
GLuint j;
+ GLuint swizzle = inst->SrcReg[i].Swizzle;
fullsrc = &fullinst->FullSrcRegisters[i];
immediateMapping,
indirectAccess );
fullsrc->SrcRegister.Index = map_register_file_index(
+ procType,
fullsrc->SrcRegister.File,
inst->SrcReg[i].Index,
+ &swizzle,
inputMapping,
outputMapping,
immediateMapping,
GLboolean extended = (inst->SrcReg[i].Negate != NEGATE_NONE &&
inst->SrcReg[i].Negate != NEGATE_XYZW);
for( j = 0; j < 4; j++ ) {
- swz[j] = GET_SWZ( inst->SrcReg[i].Swizzle, j );
+ swz[j] = GET_SWZ( swizzle, j );
if (swz[j] > SWIZZLE_W)
extended = GL_TRUE;
}
if (stfp->Base.UsesPointCoord) {
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
stfp->input_semantic_index[slot] = num_generic++;
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ } else if (stfp->Base.UsesFrontFacing) {
+ stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
+ stfp->input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
} else {
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
stfp->input_semantic_index[slot] = 0;
+ interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
}
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
break;
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1: