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

Image Resize makes images invisible #24

Open
ZanzyTHEbar opened this issue Aug 5, 2022 · 2 comments
Open

Image Resize makes images invisible #24

ZanzyTHEbar opened this issue Aug 5, 2022 · 2 comments

Comments

@ZanzyTHEbar
Copy link

ZanzyTHEbar commented Aug 5, 2022

I am loving Walnut - create application framework.

I've run into an issue where when i try to resize an image, using the built-in method, my images are invisible - but rendered.I know that are rendered as my screen scales relative to the image as if it were there - but i see no image. Very odd.

This is the error:

[vulkan] Debug report from ObjectType: 6
Message: Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x2138b368f40, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x2138b368f40[] expects VkImage 0x3fbcd60000000028[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_UNDEFINED.

I am using the resize method like so in the OnAttach() method.

m_Image->Resize(64, 64);
@x1nixmzeng
Copy link

Not the author, but this framework is to wrap ImGui functionality - you can draw an image at a smaller size without needing to resize the underlying data:

ImGui::Image((GLuint*)textureID, ImVec2(image_size,image_size));

Also worth pointing out that the implementation of Resize doesn't setup any data like the constructors do:

https://github.com/TheCherno/Walnut/blob/cc26ee1cc875db50884fe244e0a3195dd730a1ef/Walnut/src/Walnut/Image.cpp#L287-L288

https://github.com/TheCherno/Walnut/blob/cc26ee1cc875db50884fe244e0a3195dd730a1ef/Walnut/src/Walnut/Image.cpp#L74-L80

@ZanzyTHEbar
Copy link
Author

Yes, i am aware of the ImGui method - i was using ImGui::Image(m_Image->GetDescriptorSet(), { (float)m_Image->GetWidth(), (float)m_Image->GetHeight() }); to display the image as well as the simple: ImGui::Image(m_Image->GetDescriptorSet(), { (float)64, (float)64 }); The first method, i used after the call to Resize thinking i would get a cleaner image. The second method yields the result i am looking for (of course) but it's highly aliased - i have anti-aliasing turned as well in my init method :

ImGuiStyle& style = ImGui::GetStyle();
style.AntiAliasedFill = true;
style.AntiAliasedLines = true;
style.AntiAliasedLinesUseTex = true;

This does not change the way the image renders after resizing - it just looks like crap.

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

2 participants