avoid using 'default' for enum switches
This commit is contained in:
parent
8421690c33
commit
bb329b9278
@ -22,19 +22,19 @@ static inline D3D11_TEXTURE_ADDRESS_MODE ConvertGSAddressMode(
|
||||
gs_address_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
default:
|
||||
case GS_ADDRESS_WRAP: return D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
case GS_ADDRESS_CLAMP: return D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
case GS_ADDRESS_MIRROR: return D3D11_TEXTURE_ADDRESS_MIRROR;
|
||||
case GS_ADDRESS_BORDER: return D3D11_TEXTURE_ADDRESS_BORDER;
|
||||
case GS_ADDRESS_MIRRORONCE: return D3D11_TEXTURE_ADDRESS_MIRROR_ONCE;
|
||||
}
|
||||
|
||||
return D3D11_TEXTURE_ADDRESS_WRAP;
|
||||
}
|
||||
|
||||
static inline D3D11_FILTER ConvertGSFilter( gs_sample_filter filter)
|
||||
{
|
||||
switch (filter) {
|
||||
default:
|
||||
case GS_FILTER_POINT:
|
||||
return D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
case GS_FILTER_LINEAR:
|
||||
@ -54,6 +54,8 @@ static inline D3D11_FILTER ConvertGSFilter( gs_sample_filter filter)
|
||||
case GS_FILTER_ANISOTROPIC:
|
||||
return D3D11_FILTER_ANISOTROPIC;
|
||||
}
|
||||
|
||||
return D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||
}
|
||||
|
||||
gs_sampler_state::gs_sampler_state(device_t device, gs_sampler_info *info)
|
||||
|
@ -76,8 +76,9 @@ static inline DXGI_FORMAT ConvertGSTextureFormat(gs_color_format format)
|
||||
case GS_DXT1: return DXGI_FORMAT_BC1_UNORM;
|
||||
case GS_DXT3: return DXGI_FORMAT_BC2_UNORM;
|
||||
case GS_DXT5: return DXGI_FORMAT_BC3_UNORM;
|
||||
default: return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
static inline DXGI_FORMAT ConvertGSZStencilFormat(gs_zstencil_format format)
|
||||
@ -87,14 +88,14 @@ static inline DXGI_FORMAT ConvertGSZStencilFormat(gs_zstencil_format format)
|
||||
case GS_Z24_S8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
case GS_Z32F: return DXGI_FORMAT_D32_FLOAT;
|
||||
case GS_Z32F_S8X24: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
||||
default: return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
return DXGI_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
static inline D3D11_COMPARISON_FUNC ConvertGSDepthTest(gs_depth_test test)
|
||||
{
|
||||
switch (test) {
|
||||
default:
|
||||
case GS_NEVER: return D3D11_COMPARISON_NEVER;
|
||||
case GS_LESS: return D3D11_COMPARISON_LESS;
|
||||
case GS_LEQUAL: return D3D11_COMPARISON_LESS_EQUAL;
|
||||
@ -104,12 +105,13 @@ static inline D3D11_COMPARISON_FUNC ConvertGSDepthTest(gs_depth_test test)
|
||||
case GS_NOTEQUAL: return D3D11_COMPARISON_NOT_EQUAL;
|
||||
case GS_ALWAYS: return D3D11_COMPARISON_ALWAYS;
|
||||
}
|
||||
|
||||
return D3D11_COMPARISON_NEVER;
|
||||
}
|
||||
|
||||
static inline D3D11_STENCIL_OP ConvertGSStencilOp(gs_stencil_op op)
|
||||
{
|
||||
switch (op) {
|
||||
default:
|
||||
case GS_KEEP: return D3D11_STENCIL_OP_KEEP;
|
||||
case GS_ZERO: return D3D11_STENCIL_OP_ZERO;
|
||||
case GS_REPLACE: return D3D11_STENCIL_OP_REPLACE;
|
||||
@ -117,12 +119,13 @@ static inline D3D11_STENCIL_OP ConvertGSStencilOp(gs_stencil_op op)
|
||||
case GS_DECR: return D3D11_STENCIL_OP_DECR;
|
||||
case GS_INVERT: return D3D11_STENCIL_OP_INVERT;
|
||||
}
|
||||
|
||||
return D3D11_STENCIL_OP_KEEP;
|
||||
}
|
||||
|
||||
static inline D3D11_BLEND ConvertGSBlendType(gs_blend_type type)
|
||||
{
|
||||
switch (type) {
|
||||
default:
|
||||
case GS_BLEND_ZERO: return D3D11_BLEND_ZERO;
|
||||
case GS_BLEND_ONE: return D3D11_BLEND_ONE;
|
||||
case GS_BLEND_SRCCOLOR: return D3D11_BLEND_SRC_COLOR;
|
||||
@ -135,28 +138,32 @@ static inline D3D11_BLEND ConvertGSBlendType(gs_blend_type type)
|
||||
case GS_BLEND_INVDSTALPHA: return D3D11_BLEND_INV_DEST_ALPHA;
|
||||
case GS_BLEND_SRCALPHASAT: return D3D11_BLEND_SRC_ALPHA_SAT;
|
||||
}
|
||||
|
||||
return D3D11_BLEND_ONE;
|
||||
}
|
||||
|
||||
static inline D3D11_CULL_MODE ConvertGSCullMode(gs_cull_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
default:
|
||||
case GS_BACK: return D3D11_CULL_BACK;
|
||||
case GS_FRONT: return D3D11_CULL_FRONT;
|
||||
case GS_NEITHER: return D3D11_CULL_NONE;
|
||||
}
|
||||
|
||||
return D3D11_CULL_BACK;
|
||||
}
|
||||
|
||||
static inline D3D11_PRIMITIVE_TOPOLOGY ConvertGSTopology(gs_draw_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
default:
|
||||
case GS_POINTS: return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
case GS_LINES: return D3D11_PRIMITIVE_TOPOLOGY_LINELIST;
|
||||
case GS_LINESTRIP: return D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP;
|
||||
case GS_TRIS: return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case GS_TRISTRIP: return D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
||||
}
|
||||
|
||||
return D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
}
|
||||
|
||||
/* exception-safe RAII wrapper for vertex buffer data (NOTE: not copy-safe) */
|
||||
|
@ -497,7 +497,7 @@ void shader_setval(shader_t shader, sparam_t param, const void *val,
|
||||
if (!matching_shader(shader, param))
|
||||
return;
|
||||
|
||||
switch (param->type) {
|
||||
switch ((uint32_t)param->type) {
|
||||
case SHADER_PARAM_FLOAT: expected_size = sizeof(float); break;
|
||||
case SHADER_PARAM_BOOL:
|
||||
case SHADER_PARAM_INT: expected_size = sizeof(int); break;
|
||||
|
@ -53,8 +53,10 @@ static inline GLint convert_gs_format(enum gs_color_format format)
|
||||
case GS_DXT1: return GL_RGB;
|
||||
case GS_DXT3: return GL_RGBA;
|
||||
case GS_DXT5: return GL_RGBA;
|
||||
default: return 0;
|
||||
case GS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline GLint convert_gs_internal_format(enum gs_color_format format)
|
||||
@ -77,8 +79,10 @@ static inline GLint convert_gs_internal_format(enum gs_color_format format)
|
||||
case GS_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
case GS_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
case GS_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
default: return 0;
|
||||
case GS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline GLenum get_gl_format_type(enum gs_color_format format)
|
||||
@ -101,8 +105,10 @@ static inline GLenum get_gl_format_type(enum gs_color_format format)
|
||||
case GS_DXT1: return GL_UNSIGNED_BYTE;
|
||||
case GS_DXT3: return GL_UNSIGNED_BYTE;
|
||||
case GS_DXT5: return GL_UNSIGNED_BYTE;
|
||||
default: return 0;
|
||||
case GS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
static inline GLenum convert_zstencil_format(enum gs_zstencil_format format)
|
||||
@ -112,14 +118,15 @@ static inline GLenum convert_zstencil_format(enum gs_zstencil_format format)
|
||||
case GS_Z24_S8: return GL_DEPTH24_STENCIL8;
|
||||
case GS_Z32F: return GL_DEPTH_COMPONENT32F;
|
||||
case GS_Z32F_S8X24: return GL_DEPTH32F_STENCIL8;
|
||||
default: return 0;
|
||||
case GS_ZS_NONE: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline GLenum convert_gs_depth_test(enum gs_depth_test test)
|
||||
{
|
||||
switch (test) {
|
||||
default:
|
||||
case GS_NEVER: return GL_NEVER;
|
||||
case GS_LESS: return GL_LESS;
|
||||
case GS_LEQUAL: return GL_LEQUAL;
|
||||
@ -129,12 +136,13 @@ static inline GLenum convert_gs_depth_test(enum gs_depth_test test)
|
||||
case GS_NOTEQUAL: return GL_NOTEQUAL;
|
||||
case GS_ALWAYS: return GL_ALWAYS;
|
||||
}
|
||||
|
||||
return GL_NEVER;
|
||||
}
|
||||
|
||||
static inline GLenum convert_gs_stencil_op(enum gs_stencil_op op)
|
||||
{
|
||||
switch (op) {
|
||||
default:
|
||||
case GS_KEEP: return GL_KEEP;
|
||||
case GS_ZERO: return GL_ZERO;
|
||||
case GS_REPLACE: return GL_REPLACE;
|
||||
@ -142,22 +150,24 @@ static inline GLenum convert_gs_stencil_op(enum gs_stencil_op op)
|
||||
case GS_DECR: return GL_DECR;
|
||||
case GS_INVERT: return GL_INVERT;
|
||||
}
|
||||
|
||||
return GL_KEEP;
|
||||
}
|
||||
|
||||
static inline GLenum convert_gs_stencil_side(enum gs_stencil_side side)
|
||||
{
|
||||
switch (side) {
|
||||
default:
|
||||
case GS_STENCIL_FRONT: return GL_FRONT;
|
||||
case GS_STENCIL_BACK: return GL_BACK;
|
||||
case GS_STENCIL_BOTH: return GL_FRONT_AND_BACK;
|
||||
}
|
||||
|
||||
return GL_FRONT;
|
||||
}
|
||||
|
||||
static inline GLenum convert_gs_blend_type(enum gs_blend_type type)
|
||||
{
|
||||
switch (type) {
|
||||
default:
|
||||
case GS_BLEND_ZERO: return GL_ZERO;
|
||||
case GS_BLEND_ONE: return GL_ONE;
|
||||
case GS_BLEND_SRCCOLOR: return GL_SRC_COLOR;
|
||||
@ -170,83 +180,90 @@ static inline GLenum convert_gs_blend_type(enum gs_blend_type type)
|
||||
case GS_BLEND_INVDSTALPHA: return GL_ONE_MINUS_DST_ALPHA;
|
||||
case GS_BLEND_SRCALPHASAT: return GL_SRC_ALPHA_SATURATE;
|
||||
}
|
||||
|
||||
return GL_ONE;
|
||||
}
|
||||
|
||||
static inline GLenum convert_shader_type(enum shader_type type)
|
||||
{
|
||||
switch (type) {
|
||||
default:
|
||||
case SHADER_VERTEX: return GL_VERTEX_SHADER;
|
||||
case SHADER_PIXEL: return GL_FRAGMENT_SHADER;
|
||||
}
|
||||
|
||||
return GL_VERTEX_SHADER;
|
||||
}
|
||||
|
||||
static inline void convert_filter(enum gs_sample_filter filter,
|
||||
GLint *min_filter, GLint *mag_filter)
|
||||
{
|
||||
switch (filter) {
|
||||
default:
|
||||
case GS_FILTER_POINT:
|
||||
*min_filter = GL_NEAREST_MIPMAP_NEAREST;
|
||||
*mag_filter = GL_NEAREST;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_LINEAR:
|
||||
*min_filter = GL_LINEAR_MIPMAP_LINEAR;
|
||||
*mag_filter = GL_LINEAR;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_MAG_POINT_MIP_LINEAR:
|
||||
*min_filter = GL_NEAREST_MIPMAP_LINEAR;
|
||||
*mag_filter = GL_NEAREST;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT:
|
||||
*min_filter = GL_NEAREST_MIPMAP_NEAREST;
|
||||
*mag_filter = GL_LINEAR;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_POINT_MAG_MIP_LINEAR:
|
||||
*min_filter = GL_NEAREST_MIPMAP_LINEAR;
|
||||
*mag_filter = GL_LINEAR;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_LINEAR_MAG_MIP_POINT:
|
||||
*min_filter = GL_LINEAR_MIPMAP_NEAREST;
|
||||
*mag_filter = GL_NEAREST;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR:
|
||||
*min_filter = GL_LINEAR_MIPMAP_LINEAR;
|
||||
*mag_filter = GL_NEAREST;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_MIN_MAG_LINEAR_MIP_POINT:
|
||||
*min_filter = GL_LINEAR_MIPMAP_NEAREST;
|
||||
*mag_filter = GL_LINEAR;
|
||||
break;
|
||||
return;
|
||||
case GS_FILTER_ANISOTROPIC:
|
||||
*min_filter = GL_LINEAR_MIPMAP_LINEAR;
|
||||
*mag_filter = GL_LINEAR;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
*min_filter = GL_NEAREST_MIPMAP_NEAREST;
|
||||
*mag_filter = GL_NEAREST;
|
||||
}
|
||||
|
||||
static inline GLint convert_address_mode(enum gs_address_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
default:
|
||||
case GS_ADDRESS_WRAP: return GL_REPEAT;
|
||||
case GS_ADDRESS_CLAMP: return GL_CLAMP_TO_EDGE;
|
||||
case GS_ADDRESS_MIRROR: return GL_MIRRORED_REPEAT;
|
||||
case GS_ADDRESS_BORDER: return GL_CLAMP_TO_BORDER;
|
||||
case GS_ADDRESS_MIRRORONCE: return GL_MIRROR_CLAMP_EXT;
|
||||
}
|
||||
|
||||
return GL_REPEAT;
|
||||
}
|
||||
|
||||
static inline GLenum convert_gs_topology(enum gs_draw_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
default:
|
||||
case GS_POINTS: return GL_POINTS;
|
||||
case GS_LINES: return GL_LINES;
|
||||
case GS_LINESTRIP: return GL_LINE_STRIP;
|
||||
case GS_TRIS: return GL_TRIANGLES;
|
||||
case GS_TRISTRIP: return GL_TRIANGLE_STRIP;
|
||||
}
|
||||
|
||||
return GL_POINTS;
|
||||
}
|
||||
|
||||
extern void convert_sampler_info(struct gs_sampler_state *sampler,
|
||||
|
@ -39,7 +39,7 @@ struct gl_platform {
|
||||
/* For now, only support basic 32bit formats for graphics output. */
|
||||
static inline int get_color_format_bits(enum gs_color_format format)
|
||||
{
|
||||
switch (format) {
|
||||
switch ((uint32_t)format) {
|
||||
case GS_RGBA:
|
||||
return 32;
|
||||
default:
|
||||
@ -49,7 +49,7 @@ static inline int get_color_format_bits(enum gs_color_format format)
|
||||
|
||||
static inline int get_depth_format_bits(enum gs_zstencil_format zsformat)
|
||||
{
|
||||
switch (zsformat) {
|
||||
switch ((uint32_t)zsformat) {
|
||||
case GS_Z16:
|
||||
return 16;
|
||||
case GS_Z24_S8:
|
||||
@ -61,7 +61,7 @@ static inline int get_depth_format_bits(enum gs_zstencil_format zsformat)
|
||||
|
||||
static inline int get_stencil_format_bits(enum gs_zstencil_format zsformat)
|
||||
{
|
||||
switch (zsformat) {
|
||||
switch ((uint32_t)zsformat) {
|
||||
case GS_Z24_S8:
|
||||
return 8;
|
||||
default:
|
||||
|
@ -42,8 +42,10 @@ static inline GLenum get_attachment(enum gs_zstencil_format format)
|
||||
case GS_Z24_S8: return GL_DEPTH_STENCIL_ATTACHMENT;
|
||||
case GS_Z32F: return GL_DEPTH_ATTACHMENT;
|
||||
case GS_Z32F_S8X24: return GL_DEPTH_STENCIL_ATTACHMENT;
|
||||
default: return 0;
|
||||
case GS_ZS_NONE: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
zstencil_t device_create_zstencil(device_t device, uint32_t width,
|
||||
|
@ -1351,8 +1351,8 @@ static inline bool ep_compile_pass_shader(struct effect_parser *ep,
|
||||
dstr_cat(&location, " (Vertex ");
|
||||
else if (type == SHADER_PIXEL)
|
||||
dstr_cat(&location, " (Pixel ");
|
||||
else if (type == SHADER_GEOMETRY)
|
||||
dstr_cat(&location, " (Geometry ");
|
||||
/*else if (type == SHADER_GEOMETRY)
|
||||
dstr_cat(&location, " (Geometry ");*/
|
||||
|
||||
dstr_catf(&location, "shader, technique %s, pass %u)", tech->name,
|
||||
pass_idx);
|
||||
|
@ -287,7 +287,6 @@ struct shader_param_info {
|
||||
enum shader_type {
|
||||
SHADER_VERTEX,
|
||||
SHADER_PIXEL,
|
||||
SHADER_GEOMETRY
|
||||
};
|
||||
|
||||
EXPORT void shader_destroy(shader_t shader);
|
||||
@ -681,9 +680,10 @@ static inline uint32_t gs_get_format_bpp(enum gs_color_format format)
|
||||
case GS_DXT1: return 4;
|
||||
case GS_DXT3: return 8;
|
||||
case GS_DXT5: return 8;
|
||||
default:
|
||||
case GS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool gs_is_compressed_format(enum gs_color_format format)
|
||||
|
@ -86,9 +86,10 @@ static inline uint32_t get_audio_channels(enum speaker_setup speakers)
|
||||
case SPEAKERS_5POINT1_SURROUND: return 6;
|
||||
case SPEAKERS_7POINT1: return 8;
|
||||
case SPEAKERS_7POINT1_SURROUND: return 8;
|
||||
default:
|
||||
case SPEAKERS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline size_t get_audio_bytes_per_channel(enum audio_type type)
|
||||
@ -99,9 +100,10 @@ static inline size_t get_audio_bytes_per_channel(enum audio_type type)
|
||||
case AUDIO_FORMAT_24BIT: return 3;
|
||||
case AUDIO_FORMAT_FLOAT:
|
||||
case AUDIO_FORMAT_32BIT: return 4;
|
||||
default:
|
||||
case AUDIO_FORMAT_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline size_t get_audio_size(enum audio_type type,
|
||||
|
Loading…
x
Reference in New Issue
Block a user