Skip to content

Missing WGPUCallbackMode_AllowSpontaneous in callbacks info structs #112

@WilliamKarolDiCioccio

Description

@WilliamKarolDiCioccio

Description

The current tutorial code for requesting adapters and devices is missing the mode field in the callback info structs, which causes WGPURequestAdapterStatus_InstanceDropped.

Affected Code

  • Adapter request callbacks (WGPURequestAdapterCallbackInfo)
  • Device request callbacks (WGPURequestDeviceCallbackInfo)

This issue shouldn't be affecting anything beyond chapter 1 as you switch to the C++ wrapper and it does contain the mode specifier.

Problem

Without explicitly setting the callback mode, the callbacks use a default mode that prevents them from being invoked spontaneously often causing the WGPURequestAdapterStatus_InstanceDropped error.

Solution

Add WGPUCallbackMode_AllowSpontaneous to all callback info structs:

/* Either WGPURequestAdapterCallbackInfo or WGPURequestDeviceCallbackInfo **/ callbackInfo = {
    .mode = WGPUCallbackMode_AllowSpontaneous,  // Add this line
    .callback = onAdapterRequestEnded,
    .userdata1 = (void*)&userData,
    .userdata2 = nullptr,
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions