Giter VIP home page Giter VIP logo

Comments (4)

grovesNL avatar grovesNL commented on June 20, 2024

Yes I think you're right. IIRC this was changed slightly when support was added for the wasm backend. I guess we haven't hit this issue yet because most shaders only have a single entry point.

check! just catches all exceptions, so it should be fine if sc_internal_free_pointer will never actually throw anything.

from spirv_cross.

cheako avatar cheako commented on June 20, 2024

check! has the side effect of making functions that can never return with failure be prototyped as if they can. I could see a case for wanting the future proof the API, but I think that's ill advised.

from spirv_cross.

grovesNL avatar grovesNL commented on June 20, 2024

Right, but the issue is that exceptions can be thrown by almost anywhere we interact with SPIRV-Cross, and unwinding across the Rust/C++ boundary is undefined behavior (i.e. see catch_unwind). So even if check! isn't needed for free here, some other call in the same function body might require it anyway, so the Result in the API is still necessary.

Although I think we're going to move to using assertions instead of exceptions anyway, through use of the assertions flag in SPIRV-Cross (some other codebases which use spirv_cross require C++ exceptions be disabled). This isn't great for making errors recoverable, but we could probably later split this into checked/unchecked variants later (where the checked variants could do some simple checking like validating IDs and still return Result).

from spirv_cross.

cheako avatar cheako commented on June 20, 2024

I'd PM instead of cluttering the issue, but github sigh.

I don't understand C++. I managed to add support for get_active_buffer_ranges() without any consideration for exceptions, didn't even realize they were part of C++ until now.

from spirv_cross.

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.