GithubHelp home page GithubHelp logo

Comments (9)

grovesNL avatar grovesNL commented on August 20, 2024 2

I can't confirm right now but I believe we don't assume any backend by default, so you'll need to specify cargo build --features metal or cargo build --features gfx-backend-metal depending on which crate you build.

We could probably provide an error when no backend has been selected.

from wgpu.

grovesNL avatar grovesNL commented on August 20, 2024 2

To clarify my understanding, is it correct to say that I've compiled wgpu with no backend, and then the C code calls correctly into the rust library which was compiled incorrectly?

That's right, the library needs to be compiled with a particular backend specified (most functions will fail when they hit an unimplemented somewhere).

The Makefile is probably out of date because it existed before we switched to cmake for the C example.

I also don't see gfx-backend-metal in the features section of wgpu-native's Cargo.toml

I don't think this should be required because it's an optional crate (i.e. --features gfx-backend-metal should work).

You should be able to run the command (including all of the cds) we just added to Travis: https://github.com/gfx-rs/wgpu/blob/master/.travis.yml#L47 I also forgot to mention the local flag when building wgpu-native directly.

Edit: We also have a Gitter to chat if it's easier to discuss there.

from wgpu.

cshenton avatar cshenton commented on August 20, 2024 2

Brilliant! The command from travis builds a binary that works on my machine.

Thanks so much for being so responsive on this. Now I can start experimenting against the C API.

from wgpu.

cshenton avatar cshenton commented on August 20, 2024

I suspected it was something to do with selecting a backend. To clarify my understanding, is it correct to say that I've compiled wgpu with no backend, and then the C code calls correctly into the rust library which was compiled incorrectly?

from wgpu.

cshenton avatar cshenton commented on August 20, 2024

I've just cloned a fresh copy of the repo and built with cargo build --features metal using the same repro steps above and am getting the same error.

from wgpu.

cshenton avatar cshenton commented on August 20, 2024

In addition, running the following from the root of a fresh copy of the repo:

make lib-native
cd examples/hello_triangle_c/
cmake .
make hello_triangle
./hello_triangle

Results in a Segmentation fault: 11

from wgpu.

cshenton avatar cshenton commented on August 20, 2024

I also don't see gfx-backend-metal in the features section of wgpu-native's Cargo.toml, which could explain why the conditional compilation of the metal backend is working for the rust example but not the C one.

from wgpu.

kvark avatar kvark commented on August 20, 2024

@cshenton don't hesitate to visit us on gitter or elsewhere! We'd be happy to showcase your screenshots in the gallery.

from wgpu.

mokpi avatar mokpi commented on August 20, 2024

The link provided above by grovesNL no longer works, but I believe it refers to this line found here in 508b724.

  - if [[ $TRAVIS_OS_NAME == "osx" ]]; then (brew update && brew upgrade cmake && brew install glfw3 && cd wgpu-native && cargo build --features=local,gfx-backend-metal && cd ../examples/hello_triangle_c && mkdir build && cd build && cmake .. && make); fi

However, it seems such a long ago answer is no longer applicable if one faces the same issue in 2023 or onwards, at least in my own experience that's the case.

from wgpu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.