Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Zachary Murray ₿⚡️
    @Rudefire_twitter
    nevermind, I found it. If you want to do this, call use vulkano::pipeline::ComputePipelineAbstract
    aleksander-mendoza
    @aleksander-mendoza
    Hi, does anybody know how to reuse command buffers in vulkano? I saw this example https://github.com/bwasty/vulkan-tutorial-rs/blob/f2f6935914bec4e79937b8cac415683c9fbadcb1/src/bin/15_hello_triangle.rs#L523 but it uses very old version of vulkano. In the newest version cloning PrimaryAutoCommandBuffer is not implemented. So how should this be achieved now?
    Roy Wellington Ⅳ
    @thanatos

    I am new to this library too, but this chat room is too quiet, and I think I can answer your question.

    If you're doing something like <future>.then_execute(queue, cb), the second argument there should allow you to pass an Arc.
    Specifically, it takes: https://docs.rs/vulkano/0.24.0/vulkano/command_buffer/trait.PrimaryCommandBuffer.html#impl-PrimaryCommandBuffer-1 (and more specifically, that impl should allow an Arc.)

    I think when you call, e.g., AutoCommandBufferBuild::primary, you'll also need to supply an appropriate usage there.

    Roy Wellington Ⅳ
    @thanatos
    I think I've finally narrowed my ImmutableImage crash down. When the command buffer is finalizing self.resources, the resulting final_resources_states depends on the order of self.resources. Since self.resources is a hash map, this smells like a bug, and the key in both the original map and the final map has custom PartialEq and Hash impls.
    I guess I need to see if I can MVCE it.
    Will Song
    @incertia
    what is the rusty way of storing futures for later use? right now i just wait on the FenceSignalFuture right after submitting a command buffer, presenting, and flushing, but what if i want to do some extra work on the cpu in the meantime? the goal is to either return it out of a function or store it in a struct but throwing around FenceSignalFuture<PresentFuture<...>>s doesn't seem like the correct approach
    Kirill Dubovikov
    @kdubovikov
    Hi. I wonder if those kinds of signatures are ok, or I can simplify them somehow?
    fn create_descriptor_sets(
            pool: &Arc<Mutex<FixedSizeDescriptorSetsPool<Arc<GraphicsPipelineAbstract + Send + Sync>>>>,
            uniform_buffers: &[Arc<CpuAccessibleBuffer<UniformBufferObject>>],
        ) -> Vec<Arc<FixedSizeDescriptorSet<Arc<GraphicsPipelineAbstract + Send + Sync>, ((), vulkano::descriptor::descriptor_set::PersistentDescriptorSetBuf<std::sync::Arc<vulkano::buffer::CpuAccessibleBuffer<UniformBufferObject>>>)>>>
        {
            uniform_buffers
                .iter()
                .map(|uniform_buffer|
                    Arc::new(
                        pool
                            .lock()
                            .unwrap()
                            .next()
                            .add_buffer(uniform_buffer.clone())
                            .unwrap()
                            .build()
                            .unwrap()
                    )
                )
                .collect()
        }
    Georg Schäfer
    @georg.peter.schaefer_gitlab
    I'm currently trying to get into vulkans ray tracing extension, but I couldn't find any of the types provided by the extensions in vulkano-rs. Is there currently no support for ray tracing in vulkano?
    Java
    @java:furry.lol
    [m]

    hi, im trying to follow the outdated guide on vulkano.rs
    and i made it to to the mandelbrot set compute shader, but when i try call add_image on my PersistentDescriptorSetBuilder i get this compilation error:

    error[E0277]: the trait bound `vulkano::image::StorageImage: SafeDeref` is not satisfied
       --> src/main.rs:111:82
        |
    111 |     let set = Arc::new(PersistentDescriptorSet::start(layout.clone())).add_image(image.clone()).unwrap().build().unwrap();
        |                                                                                  ^^^^^^^^^^^^^ the trait `SafeDeref` is not implemented for `vulkano::image::StorageImage`
        |
        = note: required because of the requirements on the impl of `ImageViewAbstract` for `vulkano::image::StorageImage`
        = note: 1 redundant requirements hidden
        = note: required because of the requirements on the impl of `ImageViewAbstract` for `Arc<vulkano::image::StorageImage>`

    i am creating the image like this:

    let image = StorageImage::new(
        device.clone(),
        ImageDimensions::Dim2d {
            width: 1024,
            height: 1024,
            array_layers: 1,
        },
        Format::R8G8B8A8Unorm,
        [queue.family()],
    )
    .unwrap();
    Java
    @java:furry.lol
    [m]
    SafeDeref should be present
    Roy Wellington Ⅳ
    @thanatos

    SafeDeref should be present

    I think it's not that it's not SafeDeref per se (I would guess you're saying that since it's an Arc, the Arc is SafeDeref — and I'd agree), but that there is also a requirement on ImageViewAbstract that T::Target be ImageViewAbstract.

    That is, T (== Arc<StorageImage> must be SafeDeref. You've got that.
    T::Target (== StorageImage must be ImageViewAbstract, which it is not)

    nivpgir
    @nivpgir:matrix.org
    [m]
    hey
    I really want to use rust on android (trying to make imgui-rs work), and so far the best option I found is using vulkano
    I was able to fix this compilation error: vulkano-rs/vulkano#1417
    using these changes:
    I used cargo-apk to build the apk, and run the triangle example, and it runs, then immediately crashes.
    I'm not really experienced with graphics programming and would appreciate any help in debugging this and making it work on android
    Arend-Jan
    @Arend-Jan

    So I’m super new to vulkano and i’m trying to set it up for the first time. I seem to run into a weird error when trying to init the device.

    thread 'main' panicked at 'called Result::unwrap() on an Err value: ExtensionRestrictionNotMet(ExtensionRestrictionError { extension: "khr_portability_subset", restriction: RequiredIfSupported })', src/main.rs:91:6
    note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

    for reference i’m working on a Mac.

    #[macro_use]
    extern crate log;
    
    use vulkano::device::physical::PhysicalDevice;
    use vulkano::device::{Device, DeviceExtensions};
    use vulkano::instance::Instance;
    use vulkano::Version;
    use vulkano_win::VkSurfaceBuild;
    use winit::event_loop::EventLoop;
    use winit::window::WindowBuilder;
    
    fn main() {
        env_logger::init();
        info!("Starting up");
    
        let required_extensions = vulkano_win::required_extensions();
    
        let instance = Instance::new(None, Version::V1_2, &required_extensions, None).unwrap();
    
        for physical_device in PhysicalDevice::enumerate(&instance) {
            info!(
                "Available device: {} (Type: {:?})",
                physical_device.properties().device_name,
                physical_device.properties().device_type,
            );
        }
    
        let physical = PhysicalDevice::enumerate(&instance).next().unwrap();
        info!(
            "Using device: {} (Type: {:?})",
            physical.properties().device_name,
            physical.properties().device_type
        );
    
        let event_loop = EventLoop::new();
        let surface = WindowBuilder::new()
            .build_vk_surface(&event_loop, instance.clone())
            .unwrap();
    
        let queue_family = physical
            .queue_families()
            .find(|&q| {
                q.supports_graphics() && surface.is_supported(q).unwrap_or(false)
            })
            .unwrap();
    
        info!("Initializing device");
        let device_ext = DeviceExtensions {
            khr_swapchain: true,
            ..DeviceExtensions::none()
        };
    
        let (device, mut queues) = Device::new(
            physical,
            physical.supported_features(),
            &device_ext,
            [(queue_family, 0.5)].iter().cloned(),
        )
        .unwrap();
    }
    7 replies
    Justace Clutter
    @justacec

    I was checking out the library through the examples and I am getting an error on my Mac (11.6) with the following:

    vulkano/target/debug on  master took 4s 
    ❯ ./shader-include 
    Using device: AMD Radeon Pro 560X (type: DiscreteGpu)
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ExtensionRestrictionNotMet(ExtensionRestrictionError { extension: "khr_portability_subset", restriction: RequiresInstanceExtension("khr_get_physical_device_properties2") })', examples/src/bin/shader-include/main.rs:62:6
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

    Is this a known thing or do I need to do something special here?

    Justace Clutter
    @justacec
    It seems as though I do have this extension based on the following output:
    ❯ vulkaninfo 
    ==========
    VULKANINFO
    ==========
    
    Vulkan Instance Version: 1.2.189
    
    
    Instance Extensions: count = 12
    ===============================
        VK_EXT_debug_report                    : extension revision 10
        VK_EXT_debug_utils                     : extension revision 2
        VK_EXT_metal_surface                   : extension revision 1
        VK_EXT_swapchain_colorspace            : extension revision 4
        VK_KHR_device_group_creation           : extension revision 1
        VK_KHR_external_fence_capabilities     : extension revision 1
        VK_KHR_external_memory_capabilities    : extension revision 1
        VK_KHR_external_semaphore_capabilities : extension revision 1
        VK_KHR_get_physical_device_properties2 : extension revision 2
        VK_KHR_get_surface_capabilities2       : extension revision 1
        VK_KHR_surface                         : extension revision 25
        VK_MVK_macos_surface                   : extension revision 3
    Justace Clutter
    @justacec
    Ok, I finally figured this out. The khr_get_physical_device_proerties2 extension was not being loaded on the device
    cwhaddon
    @cwhaddon

    I have a simulation where the state is double-buffered, so one timestep I read from buf_0 and write to buf_1 and the following step I do the reverse. I've implemented this by having two descriptor sets but I get an access error:

    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: AccessError { error: AlreadyInUse, command_name: "vkCmdDispatch", command_param: "Buffer bound to set 0 descriptor 1", command_offset: 2 }', src/main.rs:112:10

    No amount of inserting semaphores/cleanup_finished calls seems to help. Does anyone know how I should go about this? Minimal example below.

    fn main() {
        // No instance extensions or device extensions/features
        let (_instance, device, queue) = init();
    
        mod cs {
            vulkano_shaders::shader! {
                ty: "compute",
            src: "
    #version 450
    layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
    
    layout(set = 0, binding = 0) readonly  buffer Old { uint data[]; } old;
    layout(set = 0, binding = 1) writeonly buffer New { uint data[]; } new;
    
    void main() {
        new.data[gl_GlobalInvocationID.x] = old.data[gl_GlobalInvocationID.x];
    }"
            }
        }
    
        let len: u32 = 10;
    
        let make_buf = || {
            DeviceLocalBuffer::<[u32]>::array(
                device.clone(),
                len as DeviceSize,
                BufferUsage {
                    storage_buffer: true,
                    ..BufferUsage::none()
                },
                Some(queue.family()),
            )
            .unwrap()
        };
    
        let (buf_0, buf_1) = (make_buf(), make_buf());
    
        let pipeline = Arc::new(
            ComputePipeline::new(
                device.clone(),
                &cs::Shader::load(device.clone()).unwrap().main_entry_point(),
                &(),
                None,
                |_| {},
            )
            .unwrap(),
        );
    
        let layout = pipeline.layout().descriptor_set_layouts().get(0).unwrap();
        let set_read_0_write_1 = {
            let mut builder = PersistentDescriptorSet::start(layout.clone());
            builder.add_buffer(buf_0.clone()).unwrap();
            builder.add_buffer(buf_1.clone()).unwrap();
            Arc::new(builder.build().unwrap())
        };
        let set_read_1_write_0 = {
            let mut builder = PersistentDescriptorSet::start(layout.clone());
            builder.add_buffer(buf_1).unwrap();
            builder.add_buffer(buf_0).unwrap();
            Arc::new(builder.build().unwrap())
        };
    
        let make_command_buffer = |set| {
            let mut builder = AutoCommandBufferBuilder::primary(
                device.clone(),
                queue.family(),
                CommandBufferUsage::OneTimeSubmit,
            )
            .unwrap();
    
            builder
                .bind_pipeline_compute(pipeline.clone())
                .bind_descriptor_sets(
                    PipelineBindPoint::Compute,
                    pipeline.layout().clone(),
                    0,
                    set,
                )
                .dispatch([len, 1, 1])
                .unwrap();
    
            builder.build().unwrap()
        };
    
        let command_buffer_read_0_write_1 = make_command_buffer(set_read_0_write_1);
        let command_buffer_read_1_write_0 = make_command_buffer(set_read_1_write_0);
    
        sync::now(device.clone())
            .then_execute(queue.clone(), command_buffer_read_0_write_1)
            .unwrap()
            .then_execute(queue.clone(), command_buffer_read_1_write_0)
            .unwrap()
            .then_signal_fence_and_flush()
            .unwrap()
            .wait(None)
            .unwrap();
    }
    Peter David Faria
    @zshift

    Hi, newcomer here. I wanted to share trouble I had with the guide. I defaulted to using 0.25, which was the latest when I started. The guide mostly worked, until I got the point where I needed to get the compute shader running. The types and inputs were totally different. When I tried regressing back to 0.19.0, cargo failed to build vulkano itself, with these errors:

     Compiling vulkano v0.19.0
    error[E0308]: mismatched types
        --> C:\Users\zshif\.cargo\registry\src\github.com-1ecc6299db9ec823\vulkano-0.19.0\src\command_buffer\sys.rs:1455:38
         |
    1455 |         vk.CmdSetBlendConstants(cmd, constants); // TODO: correct to pass array?        
         |                                      ^^^^^^^^^
         |                                      |
         |                                      expected `&[f32; 4]`, found array `[f32; 4]`       
         |                                      help: consider borrowing here: `&constants`        
    
    error[E0609]: no field `shaderf3264` on type `PhysicalDeviceFeatures`
       --> C:\Users\zshif\.cargo\registry\src\github.com-1ecc6299db9ec823\vulkano-0.19.0\src\features.rs:459:28
        |
    459 |     core { shader_f3264 => shaderf3264 },
        |                            ^^^^^^^^^^^ help: a field with a similar name exists: `shaderInt64`
    
    Some errors have detailed explanations: E0308, E0609.
    For more information about an error, try `rustc --explain E0308`.

    I switched to 0.20, and it all works now, but I thought it was worth mentioning.

    wilmhit
    @wilmhit:matrix.org
    [m]
    anyone can help with triangle example? I created new rust project (cargo init), added vulkano, vulkano-win, vulkano-shaders, winit into cargo.toml and copied triangle.rs as main.rs and it doesn't compile (cannot find vulkano::pipeline::input_assembly::InputAssemblyState) and few other tokens.
    error[E0432]: unresolved import `vulkano::pipeline::input_assembly::InputAssemblyState`
      --> src/main.rs:27:5
       |
    27 | use vulkano::pipeline::input_assembly::InputAssemblyState;
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------
       |     |                                  |
       |     |                                  help: a similar name exists in the module: `InputAssembly`
       |     no `InputAssemblyState` in `pipeline::input_assembly`
    
    error[E0432]: unresolved import `vulkano::pipeline::viewport::ViewportState`
      --> src/main.rs:28:45
       |
    28 | use vulkano::pipeline::viewport::{Viewport, ViewportState};
       |                                             ^^^^^^^^^^^^^
       |                                             |
       |                                             no `ViewportState` in `pipeline::viewport`
       |                                             help: a similar name exists in the module: `ViewportsState`
    
    error[E0425]: cannot find function `load` in module `vs`
       --> src/main.rs:275:18
        |
    275 |     let vs = vs::load(device.clone()).unwrap();
        |                  ^^^^ not found in `vs`
    
    error[E0425]: cannot find function `load` in module `fs`
       --> src/main.rs:276:18
        |
    276 |     let fs = fs::load(device.clone()).unwrap();
        |                  ^^^^ not found in `fs`
    
    error[E0107]: missing generics for struct `Framebuffer`
       --> src/main.rs:534:14
        |
    534 | ) -> Vec<Arc<Framebuffer>> {
        |              ^^^^^^^^^^^ expected 1 generic argument
        |
    note: struct defined here, with 1 generic parameter: `A`
    wilmhit
    @wilmhit:matrix.org
    [m]
    Is this chat a graveyard for newbies?
    Java
    @java:furry.lol
    [m]
    Yes
    Roy Wellington Ⅳ
    @thanatos

    and copied triangle.rs

    @wilmhit:matrix.org
    Are you perhaps copying the triangle.rs from master?
    There are unreleased breaking changes on master, but cargo is going to pull the latest version which won't have those; I'd copy the triangle.rs from the same version of vulkano as whatever cargo is getting. Take that last error, on line 534; triangle.rs for the current version (0.26.0) reads,

    ) -> Vec<Arc<dyn FramebufferAbstract>> {

    there, which doesn't match what you have. (What you have matches master.)

    Ben Shurts
    @benshurts:matrix.org
    [m]
    Hey, all I'm new to Rust and Graphics. I'm on Popos, when I run build rest -all it can't find native shaderc libraries. Could someone point me in the right direction?
    baggydev
    @baggydev
    Is there a more popular Vulkano chatroom out there
    Java
    @java:furry.lol
    [m]
    im not sure
    baggydev
    @baggydev
    Hey another person
    Anybody know a good example of mixing a compute shader with a regular shader? I'm trying to write a computeshader raytracer which should output pixels to the screen. Do I need a computepipeline and a graphicspipeline together? Or is there a simpler way to display a computeshader for each screen pixel
    zshift
    @zshift:matrix.org
    [m]
    You could ask on https://www.reddit.com/r/vulkan. They usually respond to questions like this.
    baggydev
    @baggydev
    Thanks zshift, will try it there!
    Peter Waller
    @pwaller

    I've been attempting to use an exported semaphore for video decode, where an external thing is going to signal that it's ready, but I'm stuck at the point of wanting to wait on the semaphore(!).

                    let vk_wait_vid_decode = Semaphore::alloc_with_exportable_fd(device.clone()).unwrap();
                    let vk_wait_vid_decode_fd = vk_wait_cuda.export_opaque_fd().unwrap().into_raw_fd();

    Given my vk_wait_vid_decode which is being signalled by the external stack, any hints how can I wait on it with vulkano?

    quatar
    @quatar:matrix.org
    [m]
    Vulkano-rs looks like a really cool framework and I’m looking to use it over MoltenVK in a project of mine. However, I would like to use subgroup functions, and on the computers that I’ve tried (Macbook Pro 2015 and Macbook M1 Pro) physical_device.supported_features.subgroup_supported_operations keeps returning None. Is this a limitation of MoltenVK (subgroup functions are mentioned in some of their release notes), a limitation of Vulkano-rs, or am I simply initializing in a wrong way?
    LordMZTE ⚡️
    @lordmzte:mzte.de
    [m]
    Hey! I've recently found vulkano, and I really want to learn it and get comfortable with it, but I'm not sure where to start, as I'm rather new, and the guide is supposedly outdated. I've been looking at the examples but they largely look like rocket science to me.
    Java
    @java:furry.lol
    [m]
    i have not found any good resources yet and this room is pretty much dead :/
    LordMZTE ⚡️
    @lordmzte:mzte.de
    [m]
    :(
    Java
    @java:furry.lol
    [m]
    sorry :/
    LordMZTE ⚡️
    @lordmzte:mzte.de
    [m]
    I've actually made quite a bit of progress working through the outdated guide. So far I managed to port the mandelbrot example in the guide to the newest vulkano version.
    Ilya Lakhin
    @Eliah-Lakhin

    @lordmzte:mzte.de Hay!

    We don't maintain this chat, however it's still available for users(and in fact I'm also taking a look from time to time too). However, there is more chance to get a quick answer to specific question or request in GitHub Issues.

    So, as of your question. Yes, the guide is outdated, but our examples maintained very well. I suggest to started with them: https://github.com/vulkano-rs/vulkano/tree/master/examples/src/bin Especially the Triangle example is a good thing to understand base things. There are comments in the example code explaining base things. And pretty much all major things provided by Vulkano have corresponding examples in the examples dir too.

    Hope that helps to start with.

    Regards,
    Ilya.

    Syntaxxor
    @Syntaxxor
    Is there any tutorial on using the current version of Vulkano, 0.27.1? Or do I just have to piece things together from the docs instead of following a tutorial or an example app?
    LordMZTE ⚡️
    @lordmzte:mzte.de
    [m]
    ive just been working through the outdated tutorial and the knowledge is somewhat transferrable to the new version. you can definetely get some stuff working with the guide + the examples
    Roey Borsteinas
    @roeyb1_gitlab

    Hey! I'm fairly new to rust and I'm getting an issue trying to build just an empty rust project with vulkano. I'm getting a compiler error on vulkano-shaders with some unresolved symbols from shaderc it seems:

    error LNK2019: unresolved external symbol shaderc_compile_options_set_auto_combined_image_sampler referenced in function _ZN7shaderc14CompileOptions31set_auto_combined_image_sampler17h147788271e125cdfE

    Would anybody know how to fix this by any chance?
    Roey Borsteinas
    @roeyb1_gitlab
    I have the vulkan sdk installed and VULKAN_SDK environment variable is set (and contains shaderc.lib)