[Mesa-dev] [PATCH] wsi: allow to override the present mode with MESA_VK_WSI_PRESENT_MODE
Michel Dänzer
michel at daenzer.net
Tue Apr 9 09:56:06 UTC 2019
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. :)
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.
--
Earthling Michel Dänzer | https://www.amd.com
Libre software enthusiast | Mesa and X developer
More information about the mesa-dev
mailing list