d3d12: Fix unhandled switch case warnings

Some D3D enums have invalid values (e.g. NONE) in the enum,
so default: makes sense to catch invalid values in those cases.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7780>
This commit is contained in:
Jesse Natalie 2020-11-25 17:10:39 -08:00 committed by Marge Bot
parent 80dcd63f64
commit eebb04fca4
5 changed files with 16 additions and 4 deletions

View File

@ -904,6 +904,8 @@ d3d12_create_sampler_view(struct pipe_context *pctx,
desc.Buffer.StructureByteStride = 0;
desc.Buffer.NumElements = texture->width0 / util_format_get_blocksize(state->format);
break;
default:
unreachable("Invalid SRV dimension");
}
d3d12_descriptor_pool_alloc_handle(ctx->view_pool, &sampler_view->handle);

View File

@ -285,9 +285,10 @@ d3d12_non_opaque_plane_count(DXGI_FORMAT format)
case DXGI_FORMAT_Y216:
case DXGI_FORMAT_NV11:
return 2;
}
return 1;
default:
return 1;
}
}
unsigned

View File

@ -172,6 +172,9 @@ init_texture(struct d3d12_screen *screen,
desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
desc.DepthOrArraySize = templ->depth0;
break;
default:
unreachable("Invalid texture type");
}
desc.Flags = D3D12_RESOURCE_FLAG_NONE;

View File

@ -475,10 +475,10 @@ d3d12_get_shader_param(struct pipe_screen *pscreen,
case PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS:
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 0; /* not implemented */
}
/* should only get here on unhandled cases */
return 0;
default: return 0;
}
}
static bool

View File

@ -134,6 +134,9 @@ initialize_dsv(struct pipe_context *pctx,
desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer;
desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
break;
default:
unreachable("Unhandled DSV dimension");
}
d3d12_descriptor_pool_alloc_handle(ctx->dsv_pool, handle);
@ -208,6 +211,9 @@ initialize_rtv(struct pipe_context *pctx,
desc.Texture3D.FirstWSlice = tpl->u.tex.first_layer;
desc.Texture3D.WSize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
break;
default:
unreachable("Unhandled RTV dimension");
}
d3d12_descriptor_pool_alloc_handle(ctx->rtv_pool, handle);