shader: document fallthroughs.

This should fix all -Wimplicit-fallthrough warnings.
macos/master
Dave Airlie 7 years ago
parent b98ea3d919
commit 9e357bd2ef
  1. 20
      src/vrend_shader.c

@ -539,6 +539,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
require_glsl_ver(ctx, 150); require_glsl_ver(ctx, 150);
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_VIEWPORT_INDEX: case TGSI_SEMANTIC_VIEWPORT_INDEX:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
ctx->inputs[i].glsl_predefined_no_emit = true; ctx->inputs[i].glsl_predefined_no_emit = true;
@ -550,6 +551,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_LAYER; ctx->shader_req_bits |= SHADER_REQ_LAYER;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_LAYER: case TGSI_SEMANTIC_LAYER:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
name_prefix = "gl_Layer"; name_prefix = "gl_Layer";
@ -560,6 +562,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_LAYER; ctx->shader_req_bits |= SHADER_REQ_LAYER;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_PSIZE: case TGSI_SEMANTIC_PSIZE:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_PointSize"; name_prefix = "gl_PointSize";
@ -569,6 +572,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->inputs[i].glsl_gl_in = true; ctx->inputs[i].glsl_gl_in = true;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_CLIPDIST: case TGSI_SEMANTIC_CLIPDIST:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_ClipDistance"; name_prefix = "gl_ClipDistance";
@ -584,6 +588,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->num_in_clip_dist += 4; ctx->num_in_clip_dist += 4;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_POSITION: case TGSI_SEMANTIC_POSITION:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
name_prefix = "gl_Position"; name_prefix = "gl_Position";
@ -597,7 +602,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->inputs[i].glsl_no_index = true; ctx->inputs[i].glsl_no_index = true;
break; break;
} }
/* fallthrough for vertex shader */ /* fallthrough */
case TGSI_SEMANTIC_FACE: case TGSI_SEMANTIC_FACE:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
if (ctx->front_face_emitted) { if (ctx->front_face_emitted) {
@ -610,6 +615,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->front_face_emitted = true; ctx->front_face_emitted = true;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_GENERIC: case TGSI_SEMANTIC_GENERIC:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
if (ctx->key->coord_replace & (1 << ctx->inputs[i].sid)) { if (ctx->key->coord_replace & (1 << ctx->inputs[i].sid)) {
@ -622,6 +628,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break; break;
} }
} }
/* fallthrough */
default: default:
name_prefix = get_stage_input_name_prefix(ctx, iter->processor.Processor); name_prefix = get_stage_input_name_prefix(ctx, iter->processor.Processor);
break; break;
@ -730,7 +737,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "ex"; name_prefix = "ex";
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_BCOLOR: case TGSI_SEMANTIC_BCOLOR:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) { if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
if (ctx->glsl_ver_required < 140) { if (ctx->glsl_ver_required < 140) {
@ -744,6 +751,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "ex"; name_prefix = "ex";
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_PSIZE: case TGSI_SEMANTIC_PSIZE:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) { if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
ctx->outputs[i].glsl_predefined_no_emit = true; ctx->outputs[i].glsl_predefined_no_emit = true;
@ -758,6 +766,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_PointSize"; name_prefix = "gl_PointSize";
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_LAYER: case TGSI_SEMANTIC_LAYER:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true; ctx->outputs[i].glsl_predefined_no_emit = true;
@ -767,6 +776,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_Layer"; name_prefix = "gl_Layer";
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_PRIMID: case TGSI_SEMANTIC_PRIMID:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true; ctx->outputs[i].glsl_predefined_no_emit = true;
@ -776,6 +786,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_PrimitiveID"; name_prefix = "gl_PrimitiveID";
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_VIEWPORT_INDEX: case TGSI_SEMANTIC_VIEWPORT_INDEX:
if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
ctx->outputs[i].glsl_predefined_no_emit = true; ctx->outputs[i].glsl_predefined_no_emit = true;
@ -787,10 +798,12 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX; ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX;
break; break;
} }
/* fallthrough */
case TGSI_SEMANTIC_GENERIC: case TGSI_SEMANTIC_GENERIC:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX)
if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC) if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC)
color_offset = -1; color_offset = -1;
/* fallthrough */
default: default:
name_prefix = get_stage_output_name_prefix(iter->processor.Processor); name_prefix = get_stage_output_name_prefix(iter->processor.Processor);
break; break;
@ -1342,6 +1355,7 @@ static bool set_texture_reqs(struct dump_ctx *ctx,
break; break;
case TGSI_TEXTURE_SHADOWCUBE_ARRAY: case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
*is_shad = true; *is_shad = true;
/* fallthrough */
case TGSI_TEXTURE_CUBE_ARRAY: case TGSI_TEXTURE_CUBE_ARRAY:
ctx->shader_req_bits |= SHADER_REQ_CUBE_ARRAY; ctx->shader_req_bits |= SHADER_REQ_CUBE_ARRAY;
break; break;
@ -1354,6 +1368,7 @@ static bool set_texture_reqs(struct dump_ctx *ctx,
break; break;
case TGSI_TEXTURE_SHADOWRECT: case TGSI_TEXTURE_SHADOWRECT:
*is_shad = true; *is_shad = true;
/* fallthrough */
case TGSI_TEXTURE_RECT: case TGSI_TEXTURE_RECT:
ctx->shader_req_bits |= SHADER_REQ_SAMPLER_RECT; ctx->shader_req_bits |= SHADER_REQ_SAMPLER_RECT;
break; break;
@ -3006,6 +3021,7 @@ static const char *get_interp_string(struct vrend_shader_cfg *cfg, int interpola
case TGSI_INTERPOLATE_COLOR: case TGSI_INTERPOLATE_COLOR:
if (flatshade) if (flatshade)
return "flat "; return "flat ";
/* fallthrough */
default: default:
return NULL; return NULL;
} }

Loading…
Cancel
Save