nir/spirv: Get rid of a bunch of stage asserts

Since we may have multiple entrypoints from different stages, we don't know
what stage we are actually in so these asserts are invalid.
This commit is contained in:
Jason Ekstrand
2016-01-11 10:33:12 -08:00
parent 9f4ba499d1
commit 30883adfb8
-22
View File
@@ -866,21 +866,6 @@ set_mode_system_value(nir_variable_mode *mode)
*mode = nir_var_system_value;
}
static void
validate_per_vertex_mode(struct vtn_builder *b, nir_variable_mode mode)
{
switch (b->shader->stage) {
case MESA_SHADER_VERTEX:
assert(mode == nir_var_shader_out);
break;
case MESA_SHADER_GEOMETRY:
assert(mode == nir_var_shader_out || mode == nir_var_shader_in);
break;
default:
assert(!"Invalid shader stage");
}
}
static void
vtn_get_builtin_location(struct vtn_builder *b,
SpvBuiltIn builtin, int *location,
@@ -889,15 +874,12 @@ vtn_get_builtin_location(struct vtn_builder *b,
switch (builtin) {
case SpvBuiltInPosition:
*location = VARYING_SLOT_POS;
validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInPointSize:
*location = VARYING_SLOT_PSIZ;
validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInClipDistance:
*location = VARYING_SLOT_CLIP_DIST0; /* XXX CLIP_DIST1? */
validate_per_vertex_mode(b, *mode);
break;
case SpvBuiltInCullDistance:
/* XXX figure this out */
@@ -932,17 +914,14 @@ vtn_get_builtin_location(struct vtn_builder *b,
unreachable("no tessellation support");
case SpvBuiltInFragCoord:
*location = VARYING_SLOT_POS;
assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInPointCoord:
*location = VARYING_SLOT_PNTC;
assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInFrontFacing:
*location = VARYING_SLOT_FACE;
assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_in);
break;
case SpvBuiltInSampleId:
@@ -959,7 +938,6 @@ vtn_get_builtin_location(struct vtn_builder *b,
break;
case SpvBuiltInFragDepth:
*location = FRAG_RESULT_DEPTH;
assert(b->shader->stage == MESA_SHADER_FRAGMENT);
assert(*mode == nir_var_shader_out);
break;
case SpvBuiltInNumWorkgroups: