Git Product home page Git Product logo

egui_winit_vulkano's People

Contributors

aedm avatar alnyan avatar firestar99 avatar fuzzyzilla avatar grego avatar hakolao avatar jsatka avatar letronix624 avatar michaelwu avatar past9 avatar ryco117 avatar stefnotch avatar tuguzt avatar yousafe avatar zortacdev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

egui_winit_vulkano's Issues

Re-assign the subpass after creation

I might be getting vulkano and this library wrong but, I want to switch between render passes, but to make any of those changes requires me to reassign the subpass to the Gui struct, Is there a way to do it?

Font artifacts on Radeon RX 5700

OS: Arch Linux
egui_winit_vulkano version: 0.17.0
Graphics card: Radeon RX 5700 (Free driver + vulkan-radeon)

I'm currently observing color artifacts with label/button fonts when using RX 5700, yet the issue does not reproduce on Ryzen 4700U's integrated GPU.

GUI is setup with is_overlay = false and I used minimal.rs as an example.

I'm not sure if this is the correct crate to open the issue, but I don't really know whether the issue is in the integration or in egui itself.

A panic when resizing the window

I ran ./run_all_examples.sh and build the examples successfully. To test examples, I did some random things, including rapidly resizing the window , which led to the panic. Those crushed examples all draws the triangle.

     Running `target/release/examples/subpass`
thread 'main' panicked at examples/subpass.rs:123:56:
called `Result::unwrap()` on an `Err` value: OutOfDate
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   Compiling egui_winit_vulkano v0.25.0 (/home/Cr0c0diLe/Documents/egui_winit_vulkano)
    Finished release [optimized] target(s) in 2.07s
     Running `target/release/examples/demo_app`
   Compiling egui_winit_vulkano v0.25.0 (/home/Cr0c0diLe/Documents/egui_winit_vulkano)
    Finished release [optimized] target(s) in 2.55s
     Running `target/release/examples/paint_callback`
thread 'main' panicked at examples/paint_callback.rs:116:56:
called `Result::unwrap()` on an `Err` value: OutOfDate
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   Compiling egui_winit_vulkano v0.25.0 (/home/Cr0c0diLe/Documents/egui_winit_vulkano)
    Finished release [optimized] target(s) in 2.72s
     Running `target/release/examples/multisample`
thread 'main' panicked at examples/multisample.rs:130:56:
called `Result::unwrap()` on an `Err` value: OutOfDate
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In addition, there's an unusual observation that may or may not be related to this panic, which I find quite peculiar. It appears that the 'panic' is more likely to occur on a monitor connected via HDMI, as opposed to the built-in monitor of the laptop.

Example demo_app crashes when minimized on Windows

Not sure why but the example demo_app crashes when I minimize one of the two windows on Windows. Note that I have validation layers enabled through the Vulkan Configurator.

This is what is printed in the terminal:

$ cargo run --example demo_app
    Finished dev [unoptimized + debuginfo] target(s) in 0.23s
     Running `target\debug\examples\demo_app.exe`
UNASSIGNED-khronos-validation-createinstance-status-message(INFO / SPEC): msgNum: -671457468 - Validation Information: [ UNASSIGNED-khronos-validation-createinstance-status-message ] Object 0: handle = 0x2ac7fc07380, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xd7fa5f44 | Khronos Validation Layer Active:
    Settings File: Found at C:\Users\Yousif\AppData\Local\LunarG\vkconfig\override\vk_layer_settings.txt specified by VkConfig application override.
    Current Enables: VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION.
    Current Disables: VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT.

    Objects: 1
        [0] 0x2ac7fc07380, type: 1, name: NULL
VUID-VkPhysicalDeviceProperties2-pNext-pNext(ERROR / SPEC): msgNum: -579609649 - Validation Error: [ VUID-VkPhysicalDeviceProperties2-pNext-pNext ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdd73dbcf | vkGetPhysicalDeviceProperties2: pProperties->pNext chain includes a structure with unknown VkStructureType (1000482001); Allowed structures are [VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCopyMemoryIndirectPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT, VkPhysicalDeviceDescriptorBufferPropertiesEXT, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceDrmPropertiesEXT, VkPhysicalDeviceExtendedDynamicState3PropertiesEXT, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT, VkPhysicalDeviceIDProperties, VkPhysicalDeviceImageProcessingPropertiesQCOM, VkPhysicalDeviceInlineUniformBlockProperties, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMaintenance4Properties, VkPhysicalDeviceMemoryDecompressionPropertiesNV, VkPhysicalDeviceMeshShaderPropertiesEXT, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiDrawPropertiesEXT, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDeviceOpacityMicromapPropertiesEXT, VkPhysicalDeviceOpticalFlowPropertiesNV, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePipelineRobustnessPropertiesEXT, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDeviceProvokingVertexPropertiesEXT, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderCorePropertiesARM, VkPhysicalDeviceShaderIntegerDotProductProperties, VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlProperties, VkPhysicalDeviceSubpassShadingPropertiesHUAWEI, VkPhysicalDeviceTexelBufferAlignmentProperties, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, VkPhysicalDeviceVulkan12Properties, VkPhysicalDeviceVulkan13Properties]. This error is based on the Valid Usage documentation for version 243 of the Vulkan header.  It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pProperties->pNext is undefined and may not work correctly with validation enabled The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkPhysicalDeviceAccelerationStructurePropertiesKHR, VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT, VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI, VkPhysicalDeviceConservativeRasterizationPropertiesEXT, VkPhysicalDeviceCooperativeMatrixPropertiesNV, VkPhysicalDeviceCopyMemoryIndirectPropertiesNV, VkPhysicalDeviceCustomBorderColorPropertiesEXT, VkPhysicalDeviceDepthStencilResolveProperties, VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT, VkPhysicalDeviceDescriptorBufferPropertiesEXT, VkPhysicalDeviceDescriptorIndexingProperties, VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV, VkPhysicalDeviceDiscardRectanglePropertiesEXT, VkPhysicalDeviceDriverProperties, VkPhysicalDeviceDrmPropertiesEXT, VkPhysicalDeviceExtendedDynamicState3PropertiesEXT, VkPhysicalDeviceExternalMemoryHostPropertiesEXT, VkPhysicalDeviceFloatControlsProperties, VkPhysicalDeviceFragmentDensityMap2PropertiesEXT, VkPhysicalDeviceFragmentDensityMapOffsetPropertiesQCOM, VkPhysicalDeviceFragmentDensityMapPropertiesEXT, VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR, VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV, VkPhysicalDeviceFragmentShadingRatePropertiesKHR, VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT, VkPhysicalDeviceIDProperties, VkPhysicalDeviceImageProcessingPropertiesQCOM, VkPhysicalDeviceInlineUniformBlockProperties, VkPhysicalDeviceLineRasterizationPropertiesEXT, VkPhysicalDeviceMaintenance3Properties, VkPhysicalDeviceMaintenance4Properties, VkPhysicalDeviceMemoryDecompressionPropertiesNV, VkPhysicalDeviceMeshShaderPropertiesEXT, VkPhysicalDeviceMeshShaderPropertiesNV, VkPhysicalDeviceMultiDrawPropertiesEXT, VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX, VkPhysicalDeviceMultiviewProperties, VkPhysicalDeviceOpacityMicromapPropertiesEXT, VkPhysicalDeviceOpticalFlowPropertiesNV, VkPhysicalDevicePCIBusInfoPropertiesEXT, VkPhysicalDevicePerformanceQueryPropertiesKHR, VkPhysicalDevicePipelineRobustnessPropertiesEXT, VkPhysicalDevicePointClippingProperties, VkPhysicalDevicePortabilitySubsetPropertiesKHR, VkPhysicalDeviceProtectedMemoryProperties, VkPhysicalDeviceProvokingVertexPropertiesEXT, VkPhysicalDevicePushDescriptorPropertiesKHR, VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV, VkPhysicalDeviceRayTracingPipelinePropertiesKHR, VkPhysicalDeviceRayTracingPropertiesNV, VkPhysicalDeviceRobustness2PropertiesEXT, VkPhysicalDeviceSampleLocationsPropertiesEXT, VkPhysicalDeviceSamplerFilterMinmaxProperties, VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM, VkPhysicalDeviceShaderCoreProperties2AMD, VkPhysicalDeviceShaderCorePropertiesAMD, VkPhysicalDeviceShaderCorePropertiesARM, VkPhysicalDeviceShaderIntegerDotProductProperties, VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT, VkPhysicalDeviceShaderSMBuiltinsPropertiesNV, VkPhysicalDeviceShadingRateImagePropertiesNV, VkPhysicalDeviceSubgroupProperties, VkPhysicalDeviceSubgroupSizeControlProperties, VkPhysicalDeviceSubpassShadingPropertiesHUAWEI, VkPhysicalDeviceTexelBufferAlignmentProperties, VkPhysicalDeviceTimelineSemaphoreProperties, VkPhysicalDeviceTransformFeedbackPropertiesEXT, VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT, VkPhysicalDeviceVulkan11Properties, VkPhysicalDeviceVulkan12Properties, or VkPhysicalDeviceVulkan13Properties (https://vulkan.lunarg.com/doc/view/1.3.243.0/windows/1.3-extensions/vkspec.html#VUID-VkPhysicalDeviceProperties2-pNext-pNext)
    Objects: 1
        [0] 0, type: 3, name: NULL
VUID-vkAcquireNextImageKHR-surface-07783(ERROR / SPEC): msgNum: -1391585802 - Validation Error: [ VUID-vkAcquireNextImageKHR-surface-07783 ] Object 0: handle = 0x564fdd0000000069, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | 
MessageID = 0xad0e15f6 | vkAcquireNextImageKHR: Application has already previously acquired 1 image from swapchain. Only 1 is available to be acquired using a timeout of UINT64_MAX (given the swapchain has 2, and VkSurfaceCapabilitiesKHR::minImageCount is 2). The Vulkan spec states: If forward progress cannot be guaranteed for the surface used to create the swapchain member of pAcquireInfo, the timeout member of pAcquireInfo must not 
be UINT64_MAX (https://vulkan.lunarg.com/doc/view/1.3.243.0/windows/1.3-extensions/vkspec.html#VUID-vkAcquireNextImageKHR-surface-07783)
    Objects: 1
        [0] 0x564fdd0000000069, type: 1000001000, name: NULL
thread 'main' panicked at C:\Users\Yousif\.cargo\registry\src\index.crates.io-6f17d22bba15001f\vulkano-0.34.1\src\lib.rs:445:17:
called `Validated::unwrap` on a `ValidationError` value: trying to use a swapchain image without depending on a corresponding acquire image future
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\demo_app.exe` (exit code: 101)

Crash assertion failed: range.start % atom_size == 0

All examples crash on mac

thread 'main' panicked at 'assertion failed: range.start % atom_size == 0 &&\n    (range.end % atom_size == 0 || range.end == self.size)', /Users/okkohakola/.cargo/registry/src/github.com-1ecc6299db9ec823/vulkano-0.32.0/src/memory/allocator/suballocator.rs:312:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/core/src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/core/src/panicking.rs:48:5
   3: vulkano::memory::allocator::suballocator::MemoryAlloc::create_memory_range
   4: vulkano::buffer::cpu_pool::CpuBufferPool<T,A>::try_next_impl
   5: vulkano::buffer::cpu_pool::CpuBufferPool<T,A>::from_iter
   6: egui_winit_vulkano::renderer::Renderer::draw_egui
   7: egui_winit_vulkano::renderer::Renderer::draw_on_subpass_image
   8: egui_winit_vulkano::integration::Gui::draw_on_subpass_image
   9: subpass::SimpleGuiPipeline::render
  10: subpass::main::{{closure}}
  11: <winit::platform_impl::platform::app_state::EventLoopHandler<T> as winit::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
  12: winit::platform_impl::platform::app_state::Handler::handle_nonuser_event
  13: winit::platform_impl::platform::app_state::AppState::cleared

Memory Overcommitment

Currently, on devices with >1GiB of VRAM, 512MiB is eagerly allocated. On other devices, this number is smaller at 128MiB. On the demo_app example, these numbers are further doubled due to the existence of two renderers. Measuring the true usage of these allocations in a pessimistic case (opening every possible window in demo_app) true usage for a single renderer is around 5MiB, a 100x overcommitment!

This is due to the use of StandardMemoryAllocator::new_default in util::Allocators::new_default, which is not user-configurable and assigns these default heap sizes. It would be fairly unobtrusive to reduce these to a more reasonable size with the ability to grow (For apps which need large amounts of images for example, or user callbacks that allocate a lot).

However I think an inversion of control for the allocators would be a much better solution - allowing the user to optionally provide the allocators, pre-informed with block sizes for Vertex+Index, Image Stage, and Image memory. This would further allow the user to specify an allocator that they are already using, allowing better sharing of resources between this crate and user code and allow the user code to choose block sizes that match their egui usecase.

I am prepared to make either change myself, but would like feedback on the API change that the inversion of control would bring and if that fits the ethos of this project! ^^

A panic when running on android.

I have been trying to get an app to run with vulkano, winit and egui on android. It compiles fine but when it starts on my phone it has this error:
thread '<unnamed>' panicked at 'Cannot get the native window, it's null and will always be null before Event::Resumed and after Event::Suspended. Make sure you only call this function between those events.'

Lagging GUI

Expected Behaviour

GUI is responsive

Observed Behaviour

There is a long lag time between interacting with GUI elements and them responding.

Environment

  • NixOS unstable
  • X11
  • LeftWM
  • NVIDIA 1060 6GB
  • Ryzen 2400G

Video

lagging-gui.mp4

Code

I'm using approach 4 to ensure egui renders into the correct color space.

Enable khr_swapchain_mutable_format.

let required_device_extensions = DeviceExtensions {
    khr_swapchain: true,
    khr_swapchain_mutable_format: true,
    ..DeviceExtensions::empty()
};

Create swapchain with SwapchainCreateFlags::MUTABLE_FORMAT.

let (swapchain, images) = Swapchain::new(
    vulkan_context.device.clone(),
    vulkan_context.surface.clone(),
    SwapchainCreateInfo {
        image_format: swapchain_format,
        image_view_formats: vec![swapchain_format, Format::R8G8B8A8_UNORM],
        min_image_count: surface_capabilities.min_image_count.max(2),
        image_extent: window_context.window.clone().inner_size().into(),
        image_usage: ImageUsage::COLOR_ATTACHMENT,
        composite_alpha: surface_capabilities
            .supported_composite_alpha
            .into_iter()
            .next()
            .unwrap(),
        flags: SwapchainCreateFlags::MUTABLE_FORMAT,
            ..Default::default()
    },
).expect("Failed to create Swapchain and/or Images");

Create Format::R8G8B8A8_UNORM image views of swapchain images.

let gui_image_views = images
    .iter()
    .map(|image| {
        ImageView::new(
            image.clone(),
            ImageViewCreateInfo {
                format: Format::R8G8B8A8_UNORM,
                ..ImageViewCreateInfo::from_image(image)
            },
        )
    })
    .map(Result::unwrap)
    .collect_vec();

Initialise Gui object with correct image view format.

let gui = Gui::new(
    event_loop,
    vulkan_context.surface.clone(),
    vulkan_context.queue.clone(),
    rendering_context.gui_image_views[0].format(),
    GuiConfig {
        is_overlay: true,
        ..Default::default()
    },
);

Create GUI elements in render loop.

WindowEvent::RedrawRequested => {
    self.gui.immediate_ui(|gui| {
        let ctx = gui.context();

        egui::TopBottomPanel::top("top_panel").show(&ctx, |ui| {
            ui.menu_button("File", |ui| {
                if ui.add(egui::Button::new("Import model")).clicked() {
                    ui.close_menu();
                }
            });
        });

        egui::SidePanel::left("left_panel").show(&ctx, |ui| {
            ui.heading("My egui Application");
            ui.label("Hello world");
        });
    });
    
    self.render(&mut frame_state);
}

Render scene and GUI then present.

let future = self
    .previous_frame_end
    .take()
    .unwrap()
    .join(acquire_future)
    .then_execute(self.vulkan_context.queue.clone(), command_buffer)
    .unwrap()
    .then_signal_fence_and_flush()
    .unwrap();

let gui_future = self.gui.draw_on_image(
    future,
    self.rendering_context.gui_image_views[image_index as usize].clone(),
);

let future = gui_future
    .then_swapchain_present(
        self.vulkan_context.queue.clone(),
        SwapchainPresentInfo::swapchain_image_index(
            self.rendering_context.swapchain.clone(),
            image_index,
        ),
    )
.then_signal_fence_and_flush();

This issue comes from my repo, vulkano-teapot. You can look at the whole source here if you need.

This issue does not happen in your examples, so something's wrong with my code somewhere.

This is a link to a flamegraph I generated using cargo-flamegraph
https://github.com/hakolao/egui_winit_vulkano/assets/93549743/63f474b4-6bde-4f44-9407-c5d5071475a9

Thanks in advance for taking the time to look over this issue :)

Antialiasing?

Is text anti-aliasing a thing?

image

Text don't seem to render too well.

Cannot find `vulkano-shaders` in example

 /tmp/egui_winit_vulkano │ master  ./run_all_examples.sh  
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling autocfg v1.1.0
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling libc v0.2.153
   Compiling xml-rs v0.8.19
   Compiling smallvec v1.13.1
   Compiling once_cell v1.19.0
   Compiling pkg-config v0.3.30
   Compiling parking_lot_core v0.9.9
   Compiling bitflags v1.3.2
   Compiling scopeguard v1.2.0
   Compiling log v0.4.21
   Compiling serde v1.0.197
   Compiling libloading v0.8.3
   Compiling crossbeam-utils v0.8.19
   Compiling simd-adler32 v0.3.7
   Compiling hashbrown v0.14.3
   Compiling lock_api v0.4.11
   Compiling memoffset v0.6.5
   Compiling equivalent v1.0.1
   Compiling dlib v0.5.2
   Compiling memchr v2.7.1
   Compiling adler v1.0.2
   Compiling crc32fast v1.4.0
   Compiling wayland-sys v0.29.5
   Compiling ttf-parser v0.20.0
   Compiling quote v1.0.35
   Compiling lazy_static v1.4.0
   Compiling miniz_oxide v0.7.2
   Compiling ahash v0.8.11
   Compiling syn v2.0.53
   Compiling wayland-scanner v0.29.5
   Compiling indexmap v2.2.5
   Compiling aho-corasick v1.1.2
   Compiling serde_json v1.0.114
   Compiling thiserror v1.0.58
   Compiling regex-syntax v0.8.2
   Compiling ab_glyph_rasterizer v0.1.8
   Compiling getrandom v0.2.12
   Compiling slotmap v1.0.7
   Compiling downcast-rs v1.2.0
   Compiling zerocopy v0.7.32
   Compiling scoped-tls v1.0.1
   Compiling ryu v1.0.17
   Compiling itoa v1.0.10
   Compiling nix v0.24.3
   Compiling parking_lot v0.12.1
   Compiling flate2 v1.0.28
   Compiling vk-parse v0.12.0
   Compiling unicase v2.7.0
   Compiling heck v0.4.1
   Compiling wayland-client v0.29.5
   Compiling wayland-protocols v0.29.5
   Compiling ash v0.37.3+1.3.251
   Compiling nix v0.25.1
   Compiling crossbeam-epoch v0.9.18
   Compiling owned_ttf_parser v0.20.0
   Compiling smithay-client-toolkit v0.16.1
   Compiling wayland-commons v0.29.5
   Compiling ab_glyph v0.2.23
   Compiling fdeflate v0.3.4
   Compiling regex-automata v0.4.6
   Compiling xcursor v0.3.5
   Compiling vec_map v0.8.2
   Compiling rayon-core v1.12.1
   Compiling png v0.17.13
   Compiling crossbeam-deque v0.8.5
   Compiling memmap2 v0.5.10
   Compiling percent-encoding v2.3.1
   Compiling arrayref v0.3.7
   Compiling strict-num v0.1.1
   Compiling xmlparser v0.13.6
   Compiling tinyvec_macros v0.1.1
   Compiling nohash-hasher v0.2.0
   Compiling cc v1.0.90
   Compiling tinyvec v1.6.0
   Compiling roxmltree v0.14.1
   Compiling wayland-cursor v0.29.5
   Compiling cmake v0.1.50
   Compiling x11-dl v2.21.0
   Compiling num-traits v0.2.18
   Compiling rustix v0.38.31
   Compiling syn v1.0.109
   Compiling toml_datetime v0.6.5
   Compiling cfg_aliases v0.1.1
   Compiling winnow v0.5.40
   Compiling regex v1.10.3
   Compiling arrayvec v0.7.4
   Compiling shaderc-sys v0.8.3
   Compiling winit v0.28.7
   Compiling unicode-normalization v0.1.23
   Compiling bytemuck_derive v1.6.0
   Compiling serde_derive v1.0.197
   Compiling thiserror-impl v1.0.58
   Compiling linux-raw-sys v0.4.13
   Compiling either v1.10.0
   Compiling unicode-bidi v0.3.15
   Compiling raw-window-handle v0.5.2
   Compiling bitflags v2.5.0
   Compiling idna v0.5.0
   Compiling rayon v1.9.0
   Compiling toml_edit v0.19.15
   Compiling mime_guess2 v2.0.5
   Compiling bytemuck v1.15.0
   Compiling calloop v0.10.6
   Compiling tiny-skia-path v0.8.4
   Compiling half v2.4.0
   Compiling tiny-skia v0.8.4
   Compiling proc-macro-crate v1.3.1
   Compiling form_urlencoded v1.2.1
   Compiling mio v0.8.11
   Compiling spin v0.9.8
   Compiling libloading v0.7.4
   Compiling instant v0.1.12
   Compiling weezl v0.1.8
   Compiling x11rb-protocol v0.13.0
   Compiling flume v0.11.0
   Compiling jpeg-decoder v0.3.1
   Compiling vulkano-macros v0.34.0
   Compiling sctk-adwaita v0.5.4
   Compiling emath v0.24.1
   Compiling ecolor v0.24.1
   Compiling epaint v0.24.1
   Compiling vulkano v0.34.1
   Compiling x11rb v0.13.0
   Compiling crossbeam-queue v0.3.11
   Compiling url v2.5.0
   Compiling egui v0.24.1
   Compiling enum-map-derive v0.17.0
   Compiling thread_local v1.1.8
   Compiling zune-inflate v0.2.54
   Compiling color_quant v1.1.0
   Compiling home v0.5.9
   Compiling mime v0.3.17
   Compiling bit_field v0.10.2
   Compiling lebe v0.5.2
   Compiling webbrowser v0.8.13
   Compiling exr v1.72.0
   Compiling gif v0.13.1
   Compiling enum-map v2.7.3
   Compiling shaderc v0.8.3
   Compiling arboard v3.3.2
   Compiling smithay-clipboard v0.6.6
   Compiling tiff v0.9.1
   Compiling qoi v0.4.1
   Compiling cgmath v0.18.0
   Compiling web-time v0.2.4
   Compiling byteorder v1.5.0
   Compiling egui-winit v0.24.1
   Compiling egui_extras v0.24.2
   Compiling image v0.24.9
   Compiling egui_plot v0.24.2
   Compiling approx v0.4.0
   Compiling unicode_names2 v0.6.0
   Compiling egui_demo_lib v0.24.1
   Compiling vulkano-shaders v0.34.0
   Compiling vulkano-util v0.34.1
   Compiling egui_winit_vulkano v0.27.0 (/tmp/egui_winit_vulkano)
error[E0463]: can't find crate for `vulkano_shaders`
    --> src/renderer.rs:1024:5
     |
1024 |     vulkano_shaders::shader! {
     |     ^^^^^^^^^^^^^^^ can't find crate

error: cannot determine resolution for the macro `vulkano_shaders::shader`
    --> src/renderer.rs:1024:5
     |
1024 |     vulkano_shaders::shader! {
     |     ^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: import resolution is stuck, try simplifying macro imports

error[E0463]: can't find crate for `vulkano_shaders`
    --> src/renderer.rs:1055:5
     |
1055 |     vulkano_shaders::shader! {
     |     ^^^^^^^^^^^^^^^ can't find crate

error: cannot determine resolution for the macro `vulkano_shaders::shader`
    --> src/renderer.rs:1055:5
     |
1055 |     vulkano_shaders::shader! {
     |     ^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: import resolution is stuck, try simplifying macro imports

error[E0425]: cannot find function `load` in module `vs`
   --> src/renderer.rs:220:22
    |
220 |         let vs = vs::load(gfx_queue.device().clone())
    |                      ^^^^ not found in `vs`
    |
help: consider importing this function
    |
10  + use image::load;
    |
help: if you import `load`, refer to it directly
    |
220 -         let vs = vs::load(gfx_queue.device().clone())
220 +         let vs = load(gfx_queue.device().clone())
    |

error[E0425]: cannot find function `load` in module `fs`
   --> src/renderer.rs:224:22
    |
224 |         let fs = fs::load(gfx_queue.device().clone())
    |                      ^^^^ not found in `fs`
    |
help: consider importing this function
    |
10  + use image::load;
    |
help: if you import `load`, refer to it directly
    |
224 -         let fs = fs::load(gfx_queue.device().clone())
224 +         let fs = load(gfx_queue.device().clone())
    |

error[E0422]: cannot find struct, variant or union type `PushConstants` in module `vs`
   --> src/renderer.rs:775:34
    |
775 |         let push_constants = vs::PushConstants {
    |                                  ^^^^^^^^^^^^^ not found in `vs`

Some errors have detailed explanations: E0422, E0425, E0463.
For more information about an error, try `rustc --explain E0422`.
error: could not compile `egui_winit_vulkano` (lib) due to 7 previous errors
warning: build failed, waiting for other jobs to finish...
    Building [=======================> ] 252/254: vulkano 

Expected

Example runs

Observed

Example crashes


I just cloned the repo directly without modification.
Thanks.

Also, what do you think about including an example which does not use vulkano-util, for example only using the triangle example from the vulkano repo.
This would be useful for users who do not use vulkano-util.

Failed to signal fence and flush on draw_on_image

Failed to signal fence and flush: a validation error occurred

Caused by:
    access to a resource has been denied (resource use: Some(ResourceUseRef { command_index: 0, command_name: "begin_rendering", resource_in_command: DepthStencilAttachment, secondary_use_ref: None }), error: the resource is already in use, and there is no tracking of concurrent usages)

I’m not so clear on why this happens, but this is fixed by heading to line 671 (line 673 for #53) in renderer.rs and replacing:

let future =
        after_main_cb.then_signal_fence_and_flush().expect("Failed to signal fence and flush");
// Return our future
Box::new(future)

with

Box::new(after_main_cb)

i.e. not signalling and flushing. I'm not enough of a Vulkan expert to understand why this works - I think it has something to do with how the swapchain is set up. I don't know if this happens on the main branch here, but it definitely occurs on #53, and there aren't code changes that would suggest otherwise.

My submission code is as follows:

let buffer = command_buffer.end()?;
let future = self
    .previous_frame_end
    .take()
    .unwrap()
    .join(self.acquire_future.take().unwrap())
    .then_execute(self.queue.clone(), buffer)?;
let future = self.gui.draw_on_image(future, self.egui_image_views[self.image_index as usize].clone())
    .then_swapchain_present(
        self.queue.clone(),
        SwapchainPresentInfo::swapchain_image_index(
            self.swapchain.clone(),
            self.image_index,
        ),
    )
    .then_signal_fence_and_flush();

match future {
    Ok(future) => {
        info!("Frame submitted successfully");
        self.previous_frame_end = Some(future.boxed());
    }
    Err(Validated::Error(VulkanError::OutOfDate)) => {
        info!("Swapchain out of date");
        self.recreate_swapchain = true;
        self.previous_frame_end = Some(vulkano::sync::now(self.device.clone()).boxed());
    }
    Err(e) => {
        error!("Failed to flush future: {:?}", e);
        self.previous_frame_end = Some(vulkano::sync::now(self.device.clone()).boxed());
    }
}

egui::RichText size is broken.

After egui::RichText::new(text).size(x) is called, font display is screwed up, if text is updated text string.
how to reproduce:
with example code minimal.rs, add ui.label(egui::RichText::new(format!("** {} **", count)).size(60.0) ); into line81.

code snipper:
ui.separator();
ui.columns(2, |columns| {
ScrollArea::vertical().id_source("source").show(
&mut columns[0],
|ui| {
// ui.add(
// TextEdit::multiline(&mut code).font(TextStyle::Monospace),
// );
ui.label(
egui::RichText::new(format!("** {} **", count)).size(60.0)
);
count += 1;
},
);
ScrollArea::vertical().id_source("rendered").show(
&mut columns[1],
|ui| {
egui_demo_lib::easy_mark::easy_mark(ui, &code);
},
);
});

Adjusting UI scaling / scale factor

Hey there. First of all, thanks for this glue package, it's made playing around with egui much easier :)

I noticed that, running the wholesome example on macOS, that pixel density / HiDPI / whatever you want to call it was not taken into account. In other words, logical pixels and physical pixels were treated as the same thing, resulting in very small rendering. Note the disparity between the size of the window title and the content of the window:

Screenshot 2022-08-26 at 19 05 19

I did find scale_factor_override in WindowDescriptor, but adjusting that only resulted in the size of the window changing. That is, if I tried to create a window 500x500px and set a scale_factor_override of 2, then the window would be 1000x1000px, but the content was still the same size.

Investigating a bit further, I found that egui_winit handles this sort of scaling via the set_pixels_per_point method on egui_winit::State. This state is created in integration::Gui::new, and adding the following before returning from the constructor results in the (imo) "correct" content size:

egui_winit.set_pixels_per_point(surface.window().scale_factor() as f32);

Screenshot 2022-08-26 at 19 08 37

So, long story short, this results in a bunch of questions from my side:

  • Do you think it's desirable to add this functionality to the egui_winit_vulkano crate?
    • If so, I think it'd be handy to both detect the default as shown above, but also allow the user to chose the pixels_per_point manually, if desired.
  • Could you elaborate what the the current idea behind scale_factor_override is?

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.