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:
parent
80dcd63f64
commit
eebb04fca4
|
@ -904,6 +904,8 @@ d3d12_create_sampler_view(struct pipe_context *pctx,
|
||||||
desc.Buffer.StructureByteStride = 0;
|
desc.Buffer.StructureByteStride = 0;
|
||||||
desc.Buffer.NumElements = texture->width0 / util_format_get_blocksize(state->format);
|
desc.Buffer.NumElements = texture->width0 / util_format_get_blocksize(state->format);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
unreachable("Invalid SRV dimension");
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d12_descriptor_pool_alloc_handle(ctx->view_pool, &sampler_view->handle);
|
d3d12_descriptor_pool_alloc_handle(ctx->view_pool, &sampler_view->handle);
|
||||||
|
|
|
@ -285,9 +285,10 @@ d3d12_non_opaque_plane_count(DXGI_FORMAT format)
|
||||||
case DXGI_FORMAT_Y216:
|
case DXGI_FORMAT_Y216:
|
||||||
case DXGI_FORMAT_NV11:
|
case DXGI_FORMAT_NV11:
|
||||||
return 2;
|
return 2;
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
|
|
|
@ -172,6 +172,9 @@ init_texture(struct d3d12_screen *screen,
|
||||||
desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
|
desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE3D;
|
||||||
desc.DepthOrArraySize = templ->depth0;
|
desc.DepthOrArraySize = templ->depth0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
unreachable("Invalid texture type");
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.Flags = D3D12_RESOURCE_FLAG_NONE;
|
desc.Flags = D3D12_RESOURCE_FLAG_NONE;
|
||||||
|
|
|
@ -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_MAX_HW_ATOMIC_COUNTER_BUFFERS:
|
||||||
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
|
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
|
||||||
return 0; /* not implemented */
|
return 0; /* not implemented */
|
||||||
}
|
|
||||||
|
|
||||||
/* should only get here on unhandled cases */
|
/* should only get here on unhandled cases */
|
||||||
return 0;
|
default: return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
@ -134,6 +134,9 @@ initialize_dsv(struct pipe_context *pctx,
|
||||||
desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer;
|
||||||
desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
unreachable("Unhandled DSV dimension");
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d12_descriptor_pool_alloc_handle(ctx->dsv_pool, handle);
|
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.FirstWSlice = tpl->u.tex.first_layer;
|
||||||
desc.Texture3D.WSize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
desc.Texture3D.WSize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
unreachable("Unhandled RTV dimension");
|
||||||
}
|
}
|
||||||
|
|
||||||
d3d12_descriptor_pool_alloc_handle(ctx->rtv_pool, handle);
|
d3d12_descriptor_pool_alloc_handle(ctx->rtv_pool, handle);
|
||||||
|
|
Loading…
Reference in New Issue