Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to make an ImageViewer using (Dear) ImGui NET: Veldrid.VeldridException: Unable to get image pixelspan. on huge images #504

Open
KyodaiKen opened this issue Apr 18, 2023 · 0 comments

Comments

@KyodaiKen
Copy link

KyodaiKen commented Apr 18, 2023

Package versions:

image

I'm trying to make a simple image viewer that can also load huge images.

When trying to load an image that is the size of 32000x19279 RGBA as a texture using the code example to load it:

001         _img = new ImageSharpTexture(image, false, true);

002         var dimg = _img.CreateDeviceTexture(_gd, _gd.ResourceFactory);

003         var viewDesc = new TextureViewDescription(dimg, Veldrid.PixelFormat.R8_G8_B8_A8_UNorm);
004         var textureView = _gd.ResourceFactory.CreateTextureView(viewDesc);

005         _imgPtr = _controller.GetOrCreateImGuiBinding(_gd.ResourceFactory, textureView);

I get this exception at statement 002:

Unhandled exception. Veldrid.VeldridException: Unable to get image pixelspan.
   at Veldrid.ImageSharp.ImageSharpTexture.CreateTextureViaUpdate(GraphicsDevice gd, ResourceFactory factory)
   at Veldrid.ImageSharp.ImageSharpTexture.CreateDeviceTexture(GraphicsDevice gd, ResourceFactory factory)
   at ImGuiNET.Program.LoadBNG() in D:\data\GIT\BNG\src\BNGView\Program.cs:line 144
   at ImGuiNET.Program.LoadImage() in D:\data\GIT\BNG\src\BNGView\Program.cs:line 169
   at ImGuiNET.Program.Main(String[] args) in D:\data\GIT\BNG\src\BNGView\Program.cs:line 68

Here is the project Github page. It's the BNGViewer that uses Veldrid and ImGui NET:
https://github.com/KyodaiKen/BNG

Could it be that internally int is used as a datatype to read the size of the ImageSharp plane?

What grinds my gears since decades is why NET and others are using signed integers for lengths of fields like arrays. ulong should be used for 64 bit targets and uint for 32 bit targets.

But I digress. I'd like to know if this maybe is also a graphics API limitation, thus needing to split the texture into multiple ones and render them tile based.

Thanks for letting me know anything about this topic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant