Fix -Wswitch-default

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Marc-André Lureau 9 years ago committed by Dave Airlie
parent 40d80b7088
commit c59eddf16e
  1. 2
      src/vrend_decode.c
  2. 19
      src/vrend_renderer.c
  3. 22
      src/vrend_shader.c

@ -1227,6 +1227,8 @@ int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
case VIRGL_CCMD_BIND_SHADER:
ret = vrend_decode_bind_shader(gdctx, len);
break;
default:
ret = EINVAL;
}
if (ret == EINVAL) {

@ -447,8 +447,9 @@ static inline const char *pipe_shader_to_prefix(int shader_type)
case PIPE_SHADER_VERTEX: return "vs";
case PIPE_SHADER_FRAGMENT: return "fs";
case PIPE_SHADER_GEOMETRY: return "gs";
};
default:
return NULL;
};
}
static const char *vrend_ctx_error_strings[] = { "None", "Unknown", "Illegal shader", "Illegal handle", "Illegal resource", "Illegal surface", "Illegal vertex format", "Illegal command buffer" };
@ -1247,9 +1248,10 @@ static inline GLenum to_gl_swizzle(int swizzle)
case PIPE_SWIZZLE_ALPHA: return GL_ALPHA;
case PIPE_SWIZZLE_ZERO: return GL_ZERO;
case PIPE_SWIZZLE_ONE: return GL_ONE;
}
default:
assert(0);
return 0;
}
}
int vrend_create_sampler_view(struct vrend_context *ctx,
@ -2014,8 +2016,9 @@ static inline int conv_shader_type(int type)
case PIPE_SHADER_VERTEX: return GL_VERTEX_SHADER;
case PIPE_SHADER_FRAGMENT: return GL_FRAGMENT_SHADER;
case PIPE_SHADER_GEOMETRY: return GL_GEOMETRY_SHADER;
};
default:
return 0;
};
}
static int vrend_shader_create(struct vrend_context *ctx,
@ -2418,9 +2421,10 @@ static GLenum get_xfb_mode(GLenum mode)
case GL_LINE_LOOP:
case GL_LINE_STRIP:
return GL_LINES;
}
default:
fprintf(stderr, "failed to translate TFB %d\n", mode);
return GL_POINTS;
}
}
static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
@ -3236,9 +3240,10 @@ static inline GLenum translate_fill(uint32_t mode)
return GL_LINE;
case PIPE_POLYGON_MODE_FILL:
return GL_FILL;
}
default:
assert(0);
return 0;
}
}
static void vrend_hw_emit_rs(struct vrend_context *ctx)
@ -3342,6 +3347,8 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
case PIPE_FACE_FRONT_AND_BACK:
glCullFace(GL_FRONT_AND_BACK);
break;
default:
fprintf(stderr, "unhandled cull-face: %x\n", state->cull_face);
}
glEnable(GL_CULL_FACE);
} else
@ -5847,6 +5854,8 @@ void vrend_render_condition(struct vrend_context *ctx,
case PIPE_RENDER_COND_BY_REGION_NO_WAIT:
glmode = GL_QUERY_BY_REGION_NO_WAIT;
break;
default:
fprintf(stderr, "unhandled condition %x\n", mode);
}
glBeginConditionalRender(q->id, glmode);

@ -143,8 +143,9 @@ static inline const char *tgsi_proc_to_prefix(int shader_type)
case TGSI_PROCESSOR_VERTEX: return "vs";
case TGSI_PROCESSOR_FRAGMENT: return "fs";
case TGSI_PROCESSOR_GEOMETRY: return "gs";
};
default:
return NULL;
};
}
static inline const char *prim_to_name(int prim)
@ -685,8 +686,8 @@ static char get_swiz_char(int swiz)
case TGSI_SWIZZLE_Y: return 'y';
case TGSI_SWIZZLE_Z: return 'z';
case TGSI_SWIZZLE_W: return 'w';
default: return 0;
}
return 0;
}
static int emit_cbuf_writes(struct dump_ctx *ctx)
@ -879,6 +880,8 @@ static int emit_clip_dist_movs(struct dump_ctx *ctx)
case 1: wm = 'y'; break;
case 2: wm = 'z'; break;
case 3: wm = 'w'; break;
default:
return EINVAL;
}
snprintf(buf, 255, "gl_ClipDistance[%d] = clip_dist_temp[%d].%c;\n",
i, clipidx, wm);
@ -958,6 +961,9 @@ static int translate_tex(struct dump_ctx *ctx,
case TGSI_TEXTURE_SHADOW2D_ARRAY:
is_shad = true;
break;
default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture);
return false;
}
if (ctx->cfg->glsl_version >= 140)
@ -1152,6 +1158,9 @@ static int translate_tex(struct dump_ctx *ctx,
snprintf(offbuf, 25, ", ivec3(%d, %d, %d)", imd->val[inst->TexOffsets[0].SwizzleX].i, imd->val[inst->TexOffsets[0].SwizzleY].i,
imd->val[inst->TexOffsets[0].SwizzleZ].i);
break;
default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture);
return false;
}
if (inst->Instruction.Opcode == TGSI_OPCODE_TXL || inst->Instruction.Opcode == TGSI_OPCODE_TXL2 || inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
@ -1451,6 +1460,9 @@ iter_instruction(struct tgsi_iterate_context *iter,
case TGSI_IMM_INT32:
snprintf(temp, 25, "%d", imd->val[idx].i);
break;
default:
fprintf(stderr, "unhandled imm type: %x\n", imd->type);
return false;
}
strncat(srcs[i], temp, 255);
if (j < 3)
@ -1981,8 +1993,9 @@ static const char *get_interp_string(int interpolate, bool flatshade)
case TGSI_INTERPOLATE_COLOR:
if (flatshade)
return "flat ";
}
default:
return NULL;
}
}
static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
@ -2392,6 +2405,9 @@ bool vrend_patch_vertex_shader_interpolants(char *program,
snprintf(glsl_name, 64, "%s_g%d", is_gs ? "out" : "ex", fs_info->interpinfo[i].semantic_index);
replace_interp(program, glsl_name, pstring);
break;
default:
fprintf(stderr,"unhandled semantic: %x\n", fs_info->interpinfo[i].semantic_name);
return false;
}
}

Loading…
Cancel
Save