mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
intel/isl: Fix isl_format_is_valid
The format enum space isn't necessarily contiguous so we can't assume
that if it's in the table it's valid. We need to check something.
Fixes: ed6e586562 "intel: properly constify isl_format_layouts"
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11191>
This commit is contained in:
parent
90a5fef85c
commit
b742f73913
1 changed files with 6 additions and 1 deletions
|
|
@ -105,7 +105,12 @@ isl_format_is_valid(enum isl_format format)
|
|||
{
|
||||
if (format >= sizeof(isl_format_layouts) / sizeof(isl_format_layouts[0]))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
/* Only ISL_FORMAT_R32G32B32A32_FLOAT == 0 but that's a valid format.
|
||||
* For all others, if this doesn't match then the entry in the table
|
||||
* must not exist.
|
||||
*/
|
||||
return isl_format_layouts[format].format == format;
|
||||
}
|
||||
|
||||
enum isl_format
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue