*/
bool frag_coord_is_sysval;
+ /* Whether to lower TessLevelInner and TessLevelOuter to system values.
+ * This is the inverse of GLSLTessLevelsAsInputs in GLSL.
+ */
+ bool tess_levels_are_sysvals;
+
struct spirv_supported_capabilities caps;
/* Address format for various kinds of pointers. */
vtn_fail("invalid stage for SpvBuiltInViewportIndex");
break;
case SpvBuiltInTessLevelOuter:
- *location = VARYING_SLOT_TESS_LEVEL_OUTER;
+ if (b->options && b->options->tess_levels_are_sysvals &&
+ *mode == nir_var_shader_in) {
+ *location = SYSTEM_VALUE_TESS_LEVEL_OUTER;
+ set_mode_system_value(b, mode);
+ } else {
+ *location = VARYING_SLOT_TESS_LEVEL_OUTER;
+ }
break;
case SpvBuiltInTessLevelInner:
- *location = VARYING_SLOT_TESS_LEVEL_INNER;
+ if (b->options && b->options->tess_levels_are_sysvals &&
+ *mode == nir_var_shader_in) {
+ *location = SYSTEM_VALUE_TESS_LEVEL_INNER;
+ set_mode_system_value(b, mode);
+ } else {
+ *location = VARYING_SLOT_TESS_LEVEL_INNER;
+ }
break;
case SpvBuiltInTessCoord:
*location = SYSTEM_VALUE_TESS_COORD;