Giter Club home page Giter Club logo

imgui-wgpu-rs's People

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  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  avatar  avatar

imgui-wgpu-rs's Issues

Bump version to 0.7.0?

It looks like some dependencies were recently version bumped in this repo, but the version imgui-wgpu itself was not bumped. Is it ready to be published as 0.7.0, or is more work needed?

Different blending compared to official OpenGL backend

OpenGL Wgpu
grim_1666812610 grim_1666812621

Description

The alpha blending looks different compared to the ImGui OpenGL 3 backend.

Repro steps

OpenGL is based on example_glfw_opengl3, Wgpu is based on imgui-wgpu-rs example.

System Information

  • imgui-wgpu-rs 0.20.0
  • Arch Linux, 6.0.2
  • Wayland, Sway
  • AMD Radeon iGPU

Massive memory leaks on Mac OS when in background

Description

hello_world example has memory leaks (up to 50 gigabytes) when left in the background on Mac OS X

Repro steps

Run the hello world example in release mode, then leave it in the background

System Information

Computer information: Mac OS 11.5.2, 16 Inch MacBook Pro 2019, AMD Radeon Pro 5500M 4 GB
cargo version 1.53
imgui-wgpu v0.17.0
winit v0.24.0
wgpu-hal v0.10.7
wgpu v0.10.1
imgui v0.7.0
imgui-winit-support v0.7.1

imgui-rs v0.8 has been released and this crate seems to be incompatible

Just wanted to let you know that a new version of imgui-rs and the platform crates have been released and there is a version mismatch and incompatibility as expected:

error: failed to select a version for `imgui-sys`.
    ... required by package `imgui v0.7.0`
    ... which is depended on by `imgui-wgpu v0.17.0`
    ... which is depended on by `blight v0.1.0 (/Users/near/Code/blight)`
versions that meet the requirements `^0.7.0` are: 0.7.0

the package `imgui-sys` links to the native library `imgui`, but it conflicts with a previous package which links to `imgui` as well:
package `imgui-sys v0.8.0`
    ... which is depended on by `imgui v0.8.0`
    ... which is depended on by `blight v0.1.0 (/Users/near/Code/blight)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='imgui-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

failed to select a version for `imgui-sys` which could resolve this conflict

Crashing with `Invalid ScissorRect Parameters`

Description

Trying to use this crate on my project I get an Invalid ScissorRect Parameters error from WGPU by trying to draw the demo window. This also happens when I try to run the hello-world example.

Repro steps

  1. Clone this repository
  2. cargo run --example hello-world

Extra Materials

Here's the output from the example:

MESA-INTEL: warning: Haswell Vulkan support is incomplete
[2021-10-14T09:55:52Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 1, Vulkan)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters

', /home/aleok/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.0/src/backend/direct.rs:2195:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

System Information

imgui-wgpu-rs version: Tested with both current master branch head & 0.18.0
OS info:

OS: Manjaro Linux x86_64 
Kernel: 5.10.70-1-MANJARO 
Resolution: 1366x768 
DE: Plasma 5.22.5 
WM: KWin 
CPU: Intel i5-4210U (4) @ 2.700GHz 
GPU: Intel Haswell-ULT 
GPU: AMD ATI Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 520 Mobile 
Memory: 1323MiB / 7876MiB

Cannot build. Failed to select a version of imgui-sys

Description

Hey guys, first of all, thank you for your work.
As this is the first time I'm using imgui maybe it's an experience-related problem. But when trying to use imgui-wgpu I'm having trouble building the project. But maybe the version of the crates I'm using are not right.

This is how my cargo.toml looks like:
(the cargo.toml of the examples uses version 0.11 for imgui and imgui-winit-support)

wgpu = "0.15"
winit = "0.27.5"

imgui-wgpu = "0.22.0"
imgui = "0.11"
imgui-winit-support = "0.11"

Problem

error: failed to select a version for `imgui-sys`.
    ... required by package `imgui v0.10.0`
    ... which satisfies dependency `imgui = "^0.10"` of package `imgui-wgpu v0.22.0`
    ... which satisfies dependency `imgui-wgpu = "^0.22.0"` of package `wgpu_playground v0.1.0 (C:\Users\_\projects\cg\own\wgpu_playground)`
versions that meet the requirements `^0.10.0` are: 0.10.0

the package `imgui-sys` links to the native library `imgui`, but it conflicts with a previous package which links to `imgui` as well:
package `imgui-sys v0.11.0`
    ... which satisfies dependency `imgui-sys = "^0.11.0"` of package `imgui v0.11.0`
    ... which satisfies dependency `imgui = "^0.11.0"` of package `imgui-winit-support v0.11.0`
    ... which satisfies dependency `imgui-winit-support = "^0.11"` of package `wgpu_playground v0.1.0 (C:\Users\_\projects\cg\own\wgpu_playground)`
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='imgui-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.

Repro steps

cargo build

System Information

rustc 1.68.2 (9eb3afe9e 2023-03-27) stable
OS: Win 11 x64

Invalid ScissorRect parameters in examples

Affects 97687c2.
I get this error instantly on startup when I clone this repo and run any example, except the two simple_api examples.
There is also an out-of-bounds validation error from Vulkan.

Related: issue #48, except this issue is distinct because it affects the examples.

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 1, Vulkan)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters
Full traceback

$ RUST_BACKTRACE=1 cargo run --example hello_world    
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/examples/hello_world`
[0.069024 ERROR]()(no module): 
VALIDATION [VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 (2094043421)] : Validation Error: [ VUID-VkSwapchainCreateInfoKHR-imageExtent-01274 ] Object 0: handle = 0x559b78036f30, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7cd0911d | vkCreateSwapchainKHR() called with imageExtent = (800,600), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (1387,780), minImageExtent = (1387,780), maxImageExtent = (1387,780). The Vulkan spec states: imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-imageExtent-01274)
object info: (type: DEVICE, hndl: 94126221782832)

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 1, Vulkan)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters


thread 'main' panicked at 'Handling wgpu errors as fatal by default', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1896:5
stack backtrace:
   0: std::panicking::begin_panic
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:519:12
   1: wgpu::backend::direct::default_error_handler
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1896:5
   2: core::ops::function::Fn::call
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:70:5
   3: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1535:9
   4: wgpu::backend::direct::ErrorSinkRaw::handle_error
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1883:9
   5: wgpu::backend::direct::Context::handle_error
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:109:9
   6: <wgpu::backend::direct::Context as wgpu::Context>::command_encoder_end_render_pass
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1739:13
   7: <wgpu::RenderPass as core::ops::drop::Drop>::drop
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/lib.rs:2486:13
   8: core::ptr::drop_in_place<wgpu::RenderPass>
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:179:1
   9: core::mem::drop
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:895:24
  10: hello_world::main::{{closure}}
             at ./examples/hello_world.rs:219:17
  11: winit::platform_impl::platform::sticky_exit_callback
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:736:5
  12: winit::platform_impl::platform::x11::EventLoop<T>::run_return
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:330:17
  13: winit::platform_impl::platform::x11::EventLoop<T>::run
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/x11/mod.rs:398:9
  14: winit::platform_impl::platform::EventLoop<T>::run
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/linux/mod.rs:652:56
  15: winit::event_loop::EventLoop<T>::run
             at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/event_loop.rs:154:9
  16: hello_world::main
             at ./examples/hello_world.rs:106:5
  17: core::ops::function::FnOnce::call_once
             at ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[0.125825 ERROR]()(gpu_descriptor::allocator): `DescriptorAllocator` is dropped while some descriptor sets were not deallocated
[0.125940 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.125956 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.125970 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.125992 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.126007 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.126024 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.126042 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
[0.126062 ERROR]()(gpu_alloc::block): Memory block wasn't deallocated
Segmentation fault (core dumped)

Update to wgpu-rs 0.8

Hello!

wgpu-rs 0.8 was just released and had some minor changes to structure names and parameters. I have a fork ready which is updated to use wgpu 0.8, should I do a PR of that to bring this up to 0.8? :)

Power saving mode

Hi
I want to make a desktop app that doesn't need to run 60 fps all the time
could something like this be implemented fo wgpu here?

ocornut/imgui#2749

thank you

Widgets disappears when the containing window is moved

Description

I'm evaluating imgui-rs and different renderers, and when running the builtin demo in imgui-wgpu-rs I found that the widgets strangely disappears when I move the window:

imgui-wgpu

Repro steps

With commit 61ad787:

cargo run --example hello-world

System Information

MacBook Pro M1, MacOS Monterey 12.0.1

Blank screen

Running hello-world got a blank empty screen with several lines on terminal with message:

dropped frame: Outdated

Memory leak related to Renderer.render() method

In the latest commit, it appears calling Renderer's render() method introduces some form of memory leak on my system. This can even be seen when running the provided examples. If the method call is present, memory usage will constantly climb. Removing the call fixes the memory leak but obviously then you can't render the GUI.

I'm currently running on Windows 1909 with rustc 1.45.1 and NVIDIA drivers 452.06 on an RTX 2070.

EDIT: Currently trying to figure out how to profile it since a friend doesn't experience the leak on his system.

Delete texture uploaded using `upload_texture`?

Currently there is an exposed API, Renderer::upload_texture, which can be used to render custom textures .However, there is no corresponding Renderer::remove_texture(&mut self, TextureId) function to remove textures when they aren't used.

Another unrelated question: Can we have an API to directly add an wgpu::Texture to obtain TextureId? Current API makes many parameters of texture fixed, such as texture format and mipmap level.

Set HiDpiMode to Locked(1.0) cause invalid scissor rect on MacOS

Description

I change the HiDpiMode from Default to Locked(1.0) in the cube example, and add some dbg! on dbg-hidpi-1.0
It crash with these log and backtrace:

    Finished dev [unoptimized + debuginfo] target(s) in 0.44s
     Running `target/debug/examples/cube`
[examples/cube.rs:393] &size = PhysicalSize {
    width: 1600,
    height: 1200,
}
[0.533005 ERROR]()(no module): Unexpected varying type: Array { base: [1], size: Constant([5]), stride: 4 }
[0.708039 ERROR]()(no module): Unexpected varying type: Array { base: [1], size: Constant([5]), stride: 4 }
[src/lib.rs:542] &clip_off = [
    0.0,
    0.0,
]
[src/lib.rs:542] &clip_scale = [
    1.0,
    1.0,
]
[src/lib.rs:567] &scissors = (
    0,
    0,
    3200,
    2400,
)
[src/lib.rs:567] &scissors = (
    64,
    79,
    504,
    492,
)
wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 3, Metal)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters


thread 'main' panicked at 'Handling wgpu errors as fatal by default', /Users/fate/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.8.1/src/backend/direct.rs:1955:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

looks like that clip rect is bigger than frame size

System Information

image

How to supply a custom sampler to a texture?

At the moment the only way of creating a Texture with your own sampler (e.g. for nearest mag filtering) is to call Texture::from_raw_parts. However, to create a binding group we need to supply a shared reference to the texture layout which is currently a private field in the Renderer struct. The way I'm getting around it at the moment is to copy-paste the texture layout code from Renderer::new, but a better approach would be either for Renderer to have a function that returns the texture layout as a shared reference, or for Texture to have a new method that takes a SamplerDescriptor.

Random set_scissor_rect error

This is very weird and for some reason seems to be totally random, but once in a while and only since 0.7 update, my app sometimes crash with this error.

wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 82, Vulkan)>`
    In a set_scissor_rect command
    Invalid ScissorRect parameters

I wish I could show how to reproduce it, but since it's not consistent at all I don't really know what to give.
In the meantime, maybe there's a way to validate the set_scissor_rect here to avoid crashing or to print something more helpful when it happens ?

It might also be a problem upstream where imgui randomly (UB?) gives wrong scissor rect parameters

EDIT: Also, it doesn't appear to happen with the hello_world example

Windows build fails

Hi! I'm trying to run one of the examples on Windows platform, but it fails.

Description

Here's the build log:

   Compiling wgpu-core v0.13.2
   Compiling deflate v0.8.6
   Compiling miniz_oxide v0.3.7
   Compiling gpu-alloc v0.5.3
   Compiling imgui-sys v0.8.2
   Compiling windows-sys v0.36.1
   Compiling png v0.16.8
   Compiling aho-corasick v0.7.18
   Compiling spirv v0.2.0+1.5.4
   Compiling approx v0.4.0
   Compiling hashbrown v0.12.3
   Compiling regex v1.6.0
   Compiling winapi-util v0.1.5
   Compiling libloading v0.7.3
   Compiling atty v0.2.14
   Compiling gpu-descriptor v0.2.3
   Compiling parking_lot v0.12.1
   Compiling termcolor v1.1.3
   Compiling thiserror-impl v1.0.32
   Compiling bytemuck_derive v1.2.1
   Compiling d3d12 v0.5.0
   Compiling parking_lot v0.11.2
   Compiling codespan-reporting v0.11.1
   Compiling env_logger v0.9.0
   Compiling bytemuck v1.12.1
error[E0432]: unresolved import `crate::platform_impl::platform::event_loop::WindowLongPtr`
  --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\window.rs:44:51
   |
44 |         event_loop::{self, EventLoopWindowTarget, WindowLongPtr, DESTROY_MSG_ID},
   |                                                   ^^^^^^^^^^^^^ no `WindowLongPtr` in `platform_impl::platform::event_loop`

error[E0412]: cannot find type `WindowLongPtr` in this scope
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:654:58
    |
654 |             (winuser::WS_VISIBLE | winuser::WS_POPUP) as WindowLongPtr,
    |                                                          ^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `WindowLongPtr` in this scope
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\winit-0.26.1\src\platform_impl\windows\event_loop.rs:676:26
    |
676 |             input_ptr as WindowLongPtr,
    |                          ^^^^^^^^^^^^^ not found in this scope

   Compiling thiserror v1.0.32
   Compiling imgui v0.8.2
   Compiling image v0.23.14
Some errors have detailed explanations: E0412, E0432.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `winit` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\clipboard.rs:137:67
    |
137 |                     set_clipboard_text_fn(io.clipboard_user_data, self.scratch_txt(text));
    |                     ---------------------                         ^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                     |
    |                     arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\context.rs:205:44
    |
205 |         let data = unsafe { CStr::from_ptr(sys::igSaveIniSettingsToMemory(ptr::null_mut())) };
    |                             -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                             |
    |                             arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`
note: associated function defined here
   --> C:\Users\eugenebokhan\.rustup\toolchains\stable-aarch64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\c_str.rs:247:19
    |
247 |     pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
    |                   ^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\draw_list.rs:305:13
     |
305  |             sys::ImDrawList_AddText_Vec2(self.draw_list, pos.into(), col.into().into(), start, end)
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                -----  --- expected `u8`, found `i8`
     |                                                                                         |
     |                                                                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3723:12
     |
3723 |     pub fn ImDrawList_AddText_Vec2(
     |            ^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\input_widget.rs:868:9
     |
868  |         sys::ImGuiInputTextCallbackData_InsertChars(
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
871  |             start as *const c_char,
     |             ---------------------- expected `u8`, found `i8`
872  |             end as *const c_char,
     |             -------------------- expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3260:12
     |
3260 |     pub fn ImGuiInputTextCallbackData_InsertChars(
     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\stacks.rs:464:21
     |
464  |                     sys::igPushID_StrStr(start, end)
     |                     ^^^^^^^^^^^^^^^^^^^^ -----  --- expected `u8`, found `i8`
     |                                          |
     |                                          expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1924:12
     |
1924 |     pub fn igPushID_StrStr(str_id_begin: *const cty::c_char, str_id_end: *const cty::c_char);
     |            ^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:23:13
     |
23   |             sys::igTextUnformatted(start as *const c_char, end as *const c_char);
     |             ^^^^^^^^^^^^^^^^^^^^^^ ----------------------  -------------------- expected `u8`, found `i8`
     |                                    |
     |                                    expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1948:12
     |
1948 |     pub fn igTextUnformatted(text: *const cty::c_char, text_end: *const cty::c_char);
     |            ^^^^^^^^^^^^^^^^^

error[E0061]: this function takes at least 1 argument but 2 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:42:18
     |
42   |         unsafe { sys::igTextWrapped(fmt_ptr(), self.scratch_txt(text)) }
     |                  ^^^^^^^^^^^^^^^^^^ --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1960:12
     |
1960 |     pub fn igTextWrapped(fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^^^
help: remove the extra argument
     |
42   |         unsafe { sys::igTextWrapped(self.scratch_txt(text)) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 2 arguments but 3 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:48:18
     |
48   |         unsafe { sys::igLabelText(ptr_one, fmt_ptr(), ptr_two) }
     |                  ^^^^^^^^^^^^^^^^          --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1963:12
     |
1963 |     pub fn igLabelText(label: *const cty::c_char, fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^
help: remove the extra argument
     |
48   |         unsafe { sys::igLabelText(ptr_one, ptr_two) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 1 argument but 2 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\text.rs:53:18
     |
53   |         unsafe { sys::igBulletText(fmt_ptr(), self.scratch_txt(text)) }
     |                  ^^^^^^^^^^^^^^^^^ --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1966:12
     |
1966 |     pub fn igBulletText(fmt: *const cty::c_char, ...);
     |            ^^^^^^^^^^^^
help: remove the extra argument
     |
53   |         unsafe { sys::igBulletText(self.scratch_txt(text)) }
     |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0061]: this function takes at least 3 arguments but 4 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\tree.rs:259:21
     |
259  |                     sys::igTreeNodeEx_StrStr(id, self.flags.bits() as i32, fmt_ptr(), label)
     |                     ^^^^^^^^^^^^^^^^^^^^^^^^                               --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2549:12
     |
2549 |     pub fn igTreeNodeEx_StrStr(
     |            ^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
     |
259  |                     sys::igTreeNodeEx_StrStr(id, self.flags.bits() as i32, label)
     |

error[E0061]: this function takes at least 3 arguments but 4 arguments were supplied
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\widget\tree.rs:261:40
     |
261  |                 TreeNodeId::Ptr(id) => sys::igTreeNodeEx_Ptr(
     |                                        ^^^^^^^^^^^^^^^^^^^^^
...
264  |                     fmt_ptr(),
     |                     --------- argument of type `*const u8` unexpected
     |
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2557:12
     |
2557 |     pub fn igTreeNodeEx_Ptr(
     |            ^^^^^^^^^^^^^^^^
help: remove the extra argument
     |
261  ~                 TreeNodeId::Ptr(id) => sys::igTreeNodeEx_Ptr(id, self.flags.bits() as i32, match self.label {
262  +                         Some(v) => ui.scratch_txt(v),
263  +                         None => ui.scratch_txt(""),
264  ~                     }),
     |

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\window\child_window.rs:265:21
     |
265  |                     sys::igGetID_StrStr(start, end)
     |                     ^^^^^^^^^^^^^^^^^^^ -----  --- expected `u8`, found `i8`
     |                                         |
     |                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1939:12
     |
1939 |     pub fn igGetID_StrStr(
     |            ^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:99:36
    |
99  |         let bytes = CStr::from_ptr(sys::igGetVersion()).to_bytes();
    |                     -------------- ^^^^^^^^^^^^^^^^^^^ expected `i8`, found `u8`
    |                     |
    |                     arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`
note: associated function defined here
   --> C:\Users\eugenebokhan\.rustup\toolchains\stable-aarch64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ffi\c_str.rs:247:19
    |
247 |     pub unsafe fn from_ptr<'a>(ptr: *const c_char) -> &'a CStr {
    |                   ^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:305:21
     |
305  |                     sys::igGetID_StrStr(s1, s2)
     |                     ^^^^^^^^^^^^^^^^^^^ --  -- expected `u8`, found `i8`
     |                                         |
     |                                         expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:1939:12
     |
1939 |     pub fn igGetID_StrStr(
     |            ^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:569:17
     |
566  |             sys::igListBox_Str_arr(
     |             ---------------------- arguments to this function are incorrect
...
569  |                 items_inner.as_ptr() as *mut *const c_char,
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const *const u8`
                found raw pointer `*mut *const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:2615:12
     |
2615 |     pub fn igListBox_Str_arr(
     |            ^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-0.8.2\src\lib.rs:664:13
     |
664  |             sys::igCalcTextSize(
     |             ^^^^^^^^^^^^^^^^^^^
665  |                 &mut out,
666  |                 start as *const c_char,
     |                 ---------------------- expected `u8`, found `i8`
667  |                 end as *const c_char,
     |                 -------------------- expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`
note: function defined here
    --> C:\Users\eugenebokhan\.cargo\registry\src\github.com-1ecc6299db9ec823\imgui-sys-0.8.2\src\bindings.rs:3069:12
     |
3069 |     pub fn igCalcTextSize(
     |            ^^^^^^^^^^^^^^

Some errors have detailed explanations: E0061, E0308.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `imgui` due to 16 previous errors

System Information

Platform: Windows 10 ARM64

Dependencies:

[dependencies]
bytemuck = "1"
imgui = "0.8"
log = "0.4"
smallvec = "1"
wgpu = "0.13"

[dev-dependencies]
bytemuck = { version = "1.4", features = ["derive"] }
cgmath = "0.18"
env_logger = "0.9"
image = { version = "0.23", default-features = false, features = ["png"] }
imgui-winit-support = { version = "0.8", default-features = false, features = ["winit-26"] }
pollster = "0.2"
raw-window-handle = "0.4"
winit = "0.26"

Hello World example build fails

Hi, this looks really useful but the example build seems to fail out of the box.

error[E0308]: mismatched types
  --> examples/hello_world.rs:66:9
   |
66 |         &window,
   |         ^^^^^^^ expected struct `winit::window::Window`, found a different struct `winit::window::Window`
   |
   = note: expected reference `&winit::window::Window` (struct `winit::window::Window`)
              found reference `&winit::window::Window` (struct `winit::window::Window`)
   = note: perhaps two different versions of crate `winit` are being used?

It seems like quite a strange error as the types clearly match. I'm quite new to rust so the error may be on my part but any help would be appreciated. Thanks

Macos
rustc 1.49.0

Modal popups result in panic due to scissor rect problem

Description

When I create a modal popup, imgui crashes:

2023-04-28T19:49:10.076Z ERROR [wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 1129, Vulkan)>`
    In a set_scissor_rect command
    Scissor Rect { x: 0, y: 0, w: 1602, h: 902 } is not contained in the render target Extent3d { width: 1600, height: 900, depth_or_array_layers: 1 }

Repro steps

Run the demo example (and select the modal popup in the imgui demo window)

System Information

imgui = { version = "0.11.0", features = ["docking"] }
imgui-sys = { version = "0.11.0", features = ["docking"] }
imgui-wgpu = { git = "https://github.com/Yatekii/imgui-wgpu-rs" }
imgui-winit-support = "0.11.0"

Support for drawing many vertices using DrawCmd::vtx_offset

(Disclaimer: I'm not sure this even is the right place in the stack to ask this, but maybe if it's not, someone can point me to the correct place instead)

I've been using imgui-wgpu-rs with implot-rs for a while and it's been working well (aside from #44 (comment), which I've still not been able to fix :D) until I plot a large amount of data. At that point, I hit imgui's "large meshes" limit (https://github.com/ocornut/imgui/blob/master/imconfig.h#L91). With the Glium backend, things still work because it advertises that it supports VtxOffset through the backend flags.

imgui-wgpu-rs doesn't advertise this flag, and when I just overwrote it myself to see if it'd work anyway, I got visual artifacts. Now my question is: Would it be possible for imgui-wgpu-rs to add support for these VtxOffsets? I have no knowledge of imgui's internals so far, but I'd be willing to put some effort towards making such support happen. I'd probably need some pointers for where to get started though.

Thanks in advance for any help / explanations!

Update imgui-rs to 0.11

Would it be possible to update the version number of imgui-rs in Cargo.toml to target version 0.11 please?

Docking not Working ?

Description

Docking was Implementet in imgui-rs 0.9.0 since then it can be Enabled using the 'docking' feature, But it dosn't work i guess this is a WGPU Problem

System Information

Linux Arch.

imgui = { version = "0.10", features = [ "docking" ] }
imgui-winit-support = { version = "0.10"  }
imgui-wgpu = "0.22.0"

winit = "0.27.1"
wgpu = "0.15.1"

depth stencil parameter in renderpass

Hey there!

I was using this to add imgui to my renderer, however I'm using depth stencil parameter in renderpass, which is incompatible with this crate as it wants it to be None... Is there any workaround or changes to be done for fix?

The line I'm referring to from my engine

Thanks ๐Ÿ™

create texture for use with imgui::Image

Hey,
I'm rendering to a wgpu texture and I would like to be able to display it with imgui::Image. There's no obvious way for me to create this texture using imgui-wgpu-rs. If there is a way, can you please tell me? Otherwise, would you accept a pull request which adds this?

Thanks,
Luke

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.