[Mesa-dev] [PATCH] wsi: allow to override the present mode with MESA_VK_WSI_PRESENT_MODE
Eric Engestrom
eric at engestrom.ch
Tue Apr 9 10:08:13 UTC 2019
On 2019-04-09 at 10:56, Michel Dänzer <michel at daenzer.net> wrote:
> On 2019-04-09 10:03 a.m., Eric Engestrom wrote:
> > On Tuesday, 2019-04-09 09:08:36 +0200, Samuel Pitoiset wrote:
> >>
> >> + if (!strcmp(mode, "fifo")) {
> >> + swapchain->present_mode = VK_PRESENT_MODE_FIFO_KHR;
> >> + } else if (!strcmp(mode, "mailbox")) {
> >> + swapchain->present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
> >> + } else if (!strcmp(mode, "immediate")) {
> >> + swapchain->present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
> >> + } else {
> >> + unreachable("Invalid MESA_VK_WSI_PRESENT_MODE value");
> >
> > unreachable() means the compiler is allowed to do anything, including
> > considering the application as dead.
> >
> > Not something we want user to be able to do with a simple
> > `MESA_VK_WSI_PRESENT_MODE=0` :)
> >
> > With an assert() instead, this is:
> > Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
>
> With assertions enabled, the application is most certainly dead after a
> failed assertion. :)
Sure, but the difference is in prod, where you want to just silently ignore the invalid override, not die ;)
>
> I'd just print something along the lines of "Invalid
> MESA_VK_WSI_PRESENT_MODE value, ignoring" and continue as if it wasn't
> set at all.
Sure, that works too 👍
More information about the mesa-dev
mailing list