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

Recompiling With /std:c++latest in Visual Studio Breaks The Project #14

Open
trutty2 opened this issue Mar 30, 2021 · 4 comments
Open

Comments

@trutty2
Copy link

trutty2 commented Mar 30, 2021

CookbookSampleFramework.h / OS.cpp cannot be recompiled in a project with C++20 features enabled in Visual Studio (it seems to work fine as long as changes aren't made to these files). I have limited experience in C++ (and none in template metaprogramming) as of right now, but from what I gather it's because of the VkDestroyer template code relying on some features that are removed from the language past C++17.

Here's the error message:

Error C2664 'VulkanCookbook::FrameResources::FrameResources(VkCommandBuffer &,VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkFenceWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkImageViewWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkFramebufferWrapper &)': cannot convert argument 2 from '_Ty' to 'VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &'

@sohailshafii
Copy link

I have the same problem as well. I tried create a version of the constructor that uses Rvalue references, and that gets the code to compile. However I don't think that the frame resources are created correctly anyway as the DrawingFInishedFence is in some state that always returns a time out value when I wait for it.

@sohailshafii
Copy link

sohailshafii commented Apr 27, 2021

CookbookSampleFramework.h / OS.cpp cannot be recompiled in a project with C++20 features enabled in Visual Studio (it seems to work fine as long as changes aren't made to these files). I have limited experience in C++ (and none in template metaprogramming) as of right now, but from what I gather it's because of the VkDestroyer template code relying on some features that are removed from the language past C++17.

Here's the error message:

Error C2664 'VulkanCookbook::FrameResources::FrameResources(VkCommandBuffer &,VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkFenceWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkImageViewWrapper &,VulkanCookbook::VkDestroyerVulkanCookbook::VkFramebufferWrapper &)': cannot convert argument 2 from '_Ty' to 'VulkanCookbook::VkDestroyerVulkanCookbook::VkSemaphoreWrapper &'

Try this:

FrameResources(VkCommandBuffer& commandBuffer,
			VkDestroyer(VkSemaphore)&& imageAcquiredSemaphore,
			VkDestroyer(VkSemaphore)&& readyToPresentSemaphore,
			VkDestroyer(VkFence)&& drawingFinishedFence,
			VkDestroyer(VkImageView)&& depthAttachment,
			VkDestroyer(VkFramebuffer)&& frameBuffer) :
			CommandBuffer(commandBuffer),
			ImageAcquiredSemaphore(std::move(imageAcquiredSemaphore)),
			ReadyToPresentSemaphore(std::move(readyToPresentSemaphore)),
			DrawingFinishedFence(std::move(drawingFinishedFence)),
			DepthAttachment(std::move(depthAttachment)),
			Framebuffer(std::move(frameBuffer)) {
		}

Here's how I create the frame resources:
VkDestroyer(VkFramebuffer) frameBuffer; FrameResourcesVec.emplace_back( commandBuffer[0], std::move(imageAcquiredSemaphore), std::move(readyToPresentSemaphore), std::move(drawingFinishedFence), std::move(depthAttachment), std::move(frameBuffer));

@richardebel
Copy link

I discovered this also using mingw-64 GCC. Any c++ standard fails. I also fixed it the same as you. Too bad I didn't read your post first. I could have saved a lot of time.

@sohailshafii
Copy link

Well, hopefully the source files get corrected at some point.

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

No branches or pull requests

3 participants