gallium: more fog extraction fixes
fix the cases when fog coord/front face/point coord are used in the same shader.
This commit is contained in:
@@ -137,22 +137,15 @@ find_translated_vp(struct st_context *st,
|
|||||||
|
|
||||||
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
|
for (inAttr = 0; inAttr < FRAG_ATTRIB_MAX; inAttr++) {
|
||||||
if (fragInputsRead & (1 << inAttr)) {
|
if (fragInputsRead & (1 << inAttr)) {
|
||||||
|
stfp->input_to_slot[inAttr] = numIn;
|
||||||
|
numIn++;
|
||||||
if ((fragInputsRead & FRAG_BIT_FOGC)) {
|
if ((fragInputsRead & FRAG_BIT_FOGC)) {
|
||||||
if (stfp->Base.UsesPointCoord) {
|
/* leave placeholders for the
|
||||||
stfp->input_to_slot[inAttr] = numIn;
|
* extra registers we extract from fog */
|
||||||
numIn++;
|
if (stfp->Base.UsesFrontFacing ||
|
||||||
|
stfp->Base.UsesPointCoord) {
|
||||||
|
numIn += 2;
|
||||||
}
|
}
|
||||||
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 {
|
else {
|
||||||
|
@@ -122,8 +122,15 @@ map_register_file_index(
|
|||||||
SWIZZLE_X,
|
SWIZZLE_X,
|
||||||
SWIZZLE_X,
|
SWIZZLE_X,
|
||||||
SWIZZLE_X);
|
SWIZZLE_X);
|
||||||
|
/* register after fog */
|
||||||
|
return inputMapping[index] + 1;
|
||||||
} else {
|
} else {
|
||||||
/* fixme: point coord */
|
*swizzle = MAKE_SWIZZLE4(SWIZZLE_Z,
|
||||||
|
SWIZZLE_W,
|
||||||
|
SWIZZLE_Z,
|
||||||
|
SWIZZLE_W);
|
||||||
|
/* register after frontface */
|
||||||
|
return inputMapping[index] + 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* inputs are mapped according to the user-defined map */
|
/* inputs are mapped according to the user-defined map */
|
||||||
|
@@ -433,20 +433,34 @@ st_translate_fragment_program(struct st_context *st,
|
|||||||
stfp->input_semantic_index[slot] = 1;
|
stfp->input_semantic_index[slot] = 1;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_FOGC:
|
case FRAG_ATTRIB_FOGC: {
|
||||||
if (stfp->Base.UsesPointCoord) {
|
int extra_decls = 0;
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
if (stfp->Base.UsesFogFragCoord) {
|
||||||
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_name[slot] = TGSI_SEMANTIC_FOG;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
stfp->input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
|
input_flags[slot] = stfp->Base.Base.InputFlags[attr];
|
||||||
|
++extra_decls;
|
||||||
}
|
}
|
||||||
|
if (stfp->Base.UsesFrontFacing) {
|
||||||
|
GLint idx = slot + extra_decls;
|
||||||
|
stfp->input_semantic_name[idx] = TGSI_SEMANTIC_FACE;
|
||||||
|
stfp->input_semantic_index[idx] = 0;
|
||||||
|
interpMode[idx] = TGSI_INTERPOLATE_CONSTANT;
|
||||||
|
input_flags[idx] = stfp->Base.Base.InputFlags[attr];
|
||||||
|
++extra_decls;
|
||||||
|
}
|
||||||
|
if (stfp->Base.UsesPointCoord) {
|
||||||
|
GLint idx = slot + extra_decls;
|
||||||
|
stfp->input_semantic_name[idx] = TGSI_SEMANTIC_GENERIC;
|
||||||
|
stfp->input_semantic_index[idx] = num_generic++;
|
||||||
|
interpMode[idx] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
|
input_flags[idx] = stfp->Base.Base.InputFlags[attr];
|
||||||
|
++extra_decls;
|
||||||
|
}
|
||||||
|
fs_num_inputs += extra_decls - 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_TEX0:
|
case FRAG_ATTRIB_TEX0:
|
||||||
case FRAG_ATTRIB_TEX1:
|
case FRAG_ATTRIB_TEX1:
|
||||||
|
Reference in New Issue
Block a user