unreachable("Unexpected system value to TGSI");
}
}
+
+enum tgsi_interpolate_mode
+tgsi_get_interp_mode(enum glsl_interp_mode mode, bool color)
+{
+ switch (mode) {
+ case INTERP_MODE_NONE:
+ return color ? TGSI_INTERPOLATE_COLOR : TGSI_INTERPOLATE_PERSPECTIVE;
+ case INTERP_MODE_FLAT:
+ return TGSI_INTERPOLATE_CONSTANT;
+ case INTERP_MODE_NOPERSPECTIVE:
+ return TGSI_INTERPOLATE_LINEAR;
+ case INTERP_MODE_SMOOTH:
+ return TGSI_INTERPOLATE_PERSPECTIVE;
+ default:
+ unreachable("unknown interpolation mode");
+ }
+}
enum tgsi_semantic
tgsi_get_sysval_semantic(unsigned sysval);
+enum tgsi_interpolate_mode
+tgsi_get_interp_mode(enum glsl_interp_mode mode, bool color);
+
static inline enum pipe_shader_type
pipe_shader_type_from_mesa(gl_shader_stage stage)
{
std::sort(decls, decls + count, sorter);
}
-static enum tgsi_interpolate_mode
-st_translate_interp(enum glsl_interp_mode glsl_qual, GLuint varying)
-{
- switch (glsl_qual) {
- case INTERP_MODE_NONE:
- if (varying == VARYING_SLOT_COL0 || varying == VARYING_SLOT_COL1)
- return TGSI_INTERPOLATE_COLOR;
- return TGSI_INTERPOLATE_PERSPECTIVE;
- case INTERP_MODE_SMOOTH:
- return TGSI_INTERPOLATE_PERSPECTIVE;
- case INTERP_MODE_FLAT:
- return TGSI_INTERPOLATE_CONSTANT;
- case INTERP_MODE_NOPERSPECTIVE:
- return TGSI_INTERPOLATE_LINEAR;
- default:
- assert(0 && "unexpected interp mode in st_translate_interp()");
- return TGSI_INTERPOLATE_PERSPECTIVE;
- }
-}
-
/**
* Translate intermediate IR (glsl_to_tgsi_instruction) to TGSI format.
* \param program the program to translate
assert(interpMode);
interp_mode = interpMode[slot] != TGSI_INTERPOLATE_COUNT ?
(enum tgsi_interpolate_mode) interpMode[slot] :
- st_translate_interp(decl->interp, inputSlotToAttr[slot]);
+ tgsi_get_interp_mode(decl->interp,
+ inputSlotToAttr[slot] == VARYING_SLOT_COL0 ||
+ inputSlotToAttr[slot] == VARYING_SLOT_COL1);
interp_location = (enum tgsi_interpolate_loc) decl->interp_loc;
}