Giter Club home page Giter Club logo

Comments (2)

aclysma avatar aclysma commented on July 17, 2024

Add the feature flags you want (such as rafx-vulkan,rafx-gles3) and use the API-specific init functions such as RafxApi::new_vulkan or RafxApi::new_gles3. RafxApi::new demonstrates this and probably does what you want by default.

rafx/rafx-api/src/api.rs

Lines 63 to 88 in 0a49546

pub unsafe fn new(
_window: &dyn HasRawWindowHandle,
_api_def: &RafxApiDef,
) -> RafxResult<Self> {
#[cfg(feature = "rafx-metal")]
{
return RafxApi::new_metal(_window, _api_def, &Default::default());
}
#[cfg(feature = "rafx-vulkan")]
{
return RafxApi::new_vulkan(_window, _api_def, &Default::default());
}
#[cfg(feature = "rafx-gles3")]
{
return RafxApi::new_gles3(_window, _api_def, &Default::default());
}
#[cfg(feature = "rafx-gles2")]
{
return RafxApi::new_gles2(_window, _api_def, &Default::default());
}
return Err("Rafx was compiled with no backend feature flag. Use on of the following features: rafx-metal, rafx-vulkan, rafx-gles2")?;
}

Long term, API selection could be made by having a config file that explicitly pairs PCI device IDs/driver versions with APIs (for example to ban an old GPU from vulkan if it is known to have a buggy driver). This could also be used to enable/disable rendering settings based on the performance of that particular GPU. This is outside the scope of this project for the time being and is a fairly opinionated thing.

from rafx.

zicklag avatar zicklag commented on July 17, 2024

Oh, cool, I didn't realize it would work with multiple backends enabled at the same time. Perfect!

from rafx.

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.