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

Free functions vs. context functions? #108

Open
johannesugb opened this issue Jul 29, 2021 · 0 comments
Open

Free functions vs. context functions? #108

johannesugb opened this issue Jul 29, 2021 · 0 comments
Labels
C++ C++-centric task question Further information is requested

Comments

@johannesugb
Copy link
Member

E.g. gvk::create_image_from_file... and similar functions can be used freely. Is that actually okay? Shouldn't they also be accessible via gvk::context()?

If it can be argued that there's no use in having them defined as context-functions and free functions are fine in terms of the Gears-Vk structure... wouldn't it be better to make them context-functions regardless... just because of consistency reasons alone?!

Consider the following example from the compute_image_processing example application:

mInputImageAndSampler = gvk::context().create_image_sampler(
	gvk::context().create_image_view(gvk::create_image_from_file("assets/lion.png", false, false, true, 4, avk::memory_usage::device, avk::image_usage::general_storage_image)), // TODO: We could bind the image as a texture instead of a (readonly) storage image, then we would not need the "storage_image" usage type
	gvk::context().create_sampler(avk::filter_mode::bilinear, avk::border_handling_mode::clamp_to_edge)
);

How can it be justified to create the image view via a context-function (gvk::context().create_image_view) and the image itself via a free function (gvk::create_image_from_file)? After all, within gvk::create_image_from_file a context function is called anyways (namely context().create_image).

@johannesugb johannesugb added question Further information is requested C++ C++-centric task labels Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C++ C++-centric task question Further information is requested
Development

No branches or pull requests

1 participant