Frontends might try to allocate linear textures or images, we should
gracefully return NULL so frontends can do fallback paths.
Signed-off-by: Karol Herbst <git@karolherbst.de>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
return DRM_FORMAT_MOD_APPLE_TWIDDLED;
}
return DRM_FORMAT_MOD_APPLE_TWIDDLED;
}
- assert(agx_linear_allowed(pres));
- return DRM_FORMAT_MOD_LINEAR;
+ if (agx_linear_allowed(pres))
+ return DRM_FORMAT_MOD_LINEAR;
+ else
+ return DRM_FORMAT_MOD_INVALID;
}
static struct pipe_resource *
}
static struct pipe_resource *
if (modifiers) {
nresource->modifier =
agx_select_modifier_from_list(nresource, modifiers, count);
if (modifiers) {
nresource->modifier =
agx_select_modifier_from_list(nresource, modifiers, count);
-
- /* There may not be a matching modifier, bail if so */
- if (nresource->modifier == DRM_FORMAT_MOD_INVALID) {
- free(nresource);
- return NULL;
- }
} else {
nresource->modifier = agx_select_best_modifier(nresource);
} else {
nresource->modifier = agx_select_best_modifier(nresource);
- assert(nresource->modifier != DRM_FORMAT_MOD_INVALID);
+ /* There may not be a matching modifier, bail if so */
+ if (nresource->modifier == DRM_FORMAT_MOD_INVALID) {
+ free(nresource);
+ return NULL;
}
/* If there's only 1 layer and there's no compression, there's no harm in
}
/* If there's only 1 layer and there's no compression, there's no harm in