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

Updated version to vulkano 0.30 #10

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Wicpar
Copy link

@Wicpar Wicpar commented Aug 8, 2022

a few important changes happened due to storage images having conflicts if not readonly, thus it was necessary to transition to immutable ones.
A performance issue that seems to have arisen is with the hovers over textboxes that create a lag spike. but it could have been there before.

Copy link
Owner

@derivator derivator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
Please format with rustfmt and make sure there are no (new) compiler warnings. I also have some questions still that I added as comments.

As I said on the other PR, I would prefer if you kept this separate from the scaling fix.

let instance = Instance::new(InstanceCreateInfo {
enabled_extensions: required_extensions,
enabled_layers: vec!["VK_LAYER_KHRONOS_validation".into()],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not opposed to enabling this, but please check if it's available. I don't have it, so this just crashes with error LayerNotPresent for me.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that can be removed, i forgot to remove it when pushing.

.unwrap();

}).unwrap();
let _callback = unsafe {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks confusing, because it just looks like an unused variable. Apparently this is supposed to work as long as the variable remains in scope? If so, maybe add a comment explaining this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is my debug implementation i forgot to remove. it doesn't work properly anyway.

FenceSignalFuture(FenceSignalFuture<F>),
BoxedFuture(Box<dyn GpuFuture>),
}
pub struct FrameEndFuture(Box<dyn GpuFuture>);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is not used any more and could be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed i forgot to remove it

&mut self,
textures_delta: TexturesDelta,
builder: &mut AutoCommandBufferBuilder<PrimaryAutoCommandBuffer<P::Alloc>, P>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit why you did this, I'm not sure I understand it 100% yet. I guess you want to use your own command buffer so you can return a future that you can join later? Does this have implications for performance? https://developer.nvidia.com/blog/vulkan-dos-donts/ seems to suggest that there is some cost associated with creating a command buffer.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.30 crashes when you try to use the old way to change the textures as it added a runtime check for non-readonly textures. this was necessary to get it to work. However with further testing it is bugged, to reproduce use the font atlas widget and change the size rapidly to a big one. I could not find exactly where the issue is yet.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, that seems to work without problems for me. Maybe because I don't have the validation layer enabled?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to create a lag spike during texture generation. It happens without the validation layers as well.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought by "bugged" you meant a crash or something.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it panics if there is a lag spike

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting. What's the error message?

Copy link
Author

@Wicpar Wicpar Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't reproduce as i changed to a more performant computer, but it was due to a readonly texture being written to at the same time as it is read. this happens if the nect frame starts processing when the first frame hasn't finished uploading the texture.
i suppose it can be simulated with a 1 second sleep before uploading the texture.

) -> Result<UpdateTexturesResult, UpdateTexturesError>
where
P: CommandPoolBuilderAlloc,
) -> Result<impl GpuFuture, UpdateTexturesError>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about returning Result<Option<impl GpuFuture>, UpdateTexturesError> and not creating any command buffer at all if there are no texture changes? Right now it seems we are submitting an empty command buffer in that case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do that, the advantage to this version is that it is easier to sync in the queue. it is probably related to the crash during texture regeneration. (0.30 vulkano got a lot stricter with the runtime checks)

/// Create a Vulkano image for the given egui texture
fn create_image(
queue: Arc<Queue>,
fn create_immutable_image_full(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a lot of code duplication between this and create_immutable_image_part. Maybe refactor the shared parts into a separate function?

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

Successfully merging this pull request may close these issues.

2 participants