Weird issue with Adapter.GetProperties

7 views
Skip to first unread message

Mark Sibly

unread,
May 21, 2024, 2:59:24 AMMay 21
to Dawn Graphics
I'm having this weird issue getting adapter properties on Linux.

The first thing my code does after successfully requesting an adapter is dump it's properties using code like this:

```
void logAdapterProps(const wgpu::Adapter& adapter) {

wgpu::AdapterProperties props{};
adapter.GetProperties(&props);

SGD_LOG << "Dawn WGPU Adapter Properties:";
SGD_LOG << "Vender name:" << (props.vendorName ? props.vendorName : "???");
SGD_LOG << "Architecture:" << (props.architecture ? props.architecture : "???");
SGD_LOG << "Name:" << (props.name ? props.name : "???");
        . ..etc...
```
However, this has started crashing on Linux builds with the error:
```
Error: Unexpected chained struct of type SType:: found on AdapterProperties chain.
    at ValidateAndUnpack<dawn::native::AdapterProperties> (/home/marksibly/dev/libsgd/cmake-build-release/_deps/dawn-build/gen/src/dawn/native/ChainUtils_autogen.cpp:210)
```
The properties struct is not filled in correctly in this case.

I had a quick look at the GetProperties() code and all it does is assign a default AdaptorProperties() to the object you give it and call the 'real' wgpuAdapterGetProperties.

So I tried that myself directly without the assignment of the default (I already set it to default anyway) and it fixed the issue, so it would appear the AdapterProperties assignment operator is doing something unusual. Or maybe g++ on Linux is doing something strange, it's not happening to me on Windows or MacOS.

I did have a quick look at the assignment operator, and it does calls the dtor if certain fields are non-null (so you definitely don't want to pass it an uninitialzed object!), but they should be null because I've {} initialized it so I'm unclear what could be going wrong.

Also, this only seems to happen when I run from a shell and not from an IDE so I don't know for sure when it started as I usually start from an IDE.

I tried to report this as a dawn issue but that's all changed now and I get taken to the chromium issues page. Should I post there any way?

Bye,
Mark

Austin Eng

unread,
May 21, 2024, 11:21:39 AMMay 21
to Mark Sibly, Dawn Graphics
Hey Mark - that's weird indeed.
Which version of Dawn was it originally working with, and which version did it stop working?

--
You received this message because you are subscribed to the Google Groups "Dawn Graphics" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dawn-graphic...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dawn-graphics/ff8c1484-dd44-4e21-997c-fc603d1ac487n%40googlegroups.com.

Kai Ninomiya

unread,
May 21, 2024, 1:41:30 PMMay 21
to Austin Eng, Mark Sibly, Dawn Graphics
> I tried to report this as a dawn issue but that's all changed now and I get taken to the chromium issues page. Should I post there any way?

Yes, Dawn's bugtracker is now a subcomponent of Chromium's. You can file in the "Chromium > Dawn" component. Direct link: https://issues.chromium.org/issues/new?noWizard=true&component=1570784 (there will be a shortlink at crbug.com/dawn/new but it's broken right now)

It sounds like you're running into undefined behavior, I think probably uninitialized memory somewhere since shell vs IDE is probably affecting it by running under a debugger, or something. Have you tried building your program with ASAN (-fsanitize=address) or other sanitizers?

-Kai (he/they)


Mark Sibly

unread,
May 21, 2024, 4:54:42 PMMay 21
to Kai Ninomiya, Austin Eng, Dawn Graphics
Thanks all,

I'll do some more research and try to find out when it started happening and post a dawn issue, thanks for the direct link @kai.

You might want to also change the 'issues' link at  https://dawn.googlesource.com/dawn too, this has been my google dawn homepage for ages now.

Bye!
Mark

Austin Eng

unread,
May 22, 2024, 1:24:13 PMMay 22
to Mark Sibly, Kai Ninomiya, Dawn Graphics
Thanks for calling out the outdated README.md Mark. I'm updating the links in https://dawn-review.googlesource.com/c/dawn/+/189361

Mark Sibly

unread,
May 24, 2024, 7:03:23 PMMay 24
to Austin Eng, Kai Ninomiya, Dawn Graphics
I have created an issue here: https://issues.chromium.org/issues/342602627



Reply all
Reply to author
Forward
0 new messages