-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix compiler errors on newer vulkan implementations #71
base: master
Are you sure you want to change the base?
Conversation
Newer versions of the STL (or vulkan headers?) don't include as many things anymore, so we need to include stuff like <memory> ouselves
Before, we tried to just return the ResultValue which led to compiler errors.
Ah, my bad!
Yes, assert is not a good way to handle the failure to create the pipeline. The best way would probably be to comply with the change in the vk interface and return a |
LGTM |
Sure, I'll look into it! |
Maybe we could do something like the like in EDIT: It looks like MSVC does not support Statement Expressions. VUH_TRY(_device.createPipeline(...), pipeline);
_pipeline = std::move(pipeline); |
This macro is intented to be used with the vk::ResultValue type. It evaluates the given expression and returns early from the function if it did not return eSuccess. Requires the surrounding function to return a type constructible from vk::Result
Ah, thanks for approving but the current system silently swallows errors. |
This class represents the result of an operation that might fail. It contains an optional value and an error code of type vk::Result. To get the value of a Result, first ensure that no error occured by calling is_error() and retrieve the value using value() Calling value() when no value is present invokes undefined behaviour!
The bodies will follow in the later commit
The caller of a function returning Result is obligated to check the return type because failing to handle an error properly might put the library into an unspecified and invalid state!
So, just finished the overhaul. The new |
LGTM |
Hey there,
I was interested in using this library but found out that it didn't compile on my Arch machine with newest version of everything.
There were two errors:
delayed.hpp:96:22: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
: This is simply fixed by including<memory>
device.cpp: In member function ‘vk::Pipeline vuh::Device::createPipeline(vk::PipelineLayout, vk::PipelineCache, const vk::PipelineShaderStageCreateInfo&, vk::PipelineCreateFlags)’: /home/weckyy702/Documents/dev/vuh/src/device.cpp:221:45: error: could not convert ‘((vuh::Device*)this)->vuh::Device::<anonymous>.vk::Device::createComputePipeline<>(pipe_cache, pipelineCI, vk::Optional<const vk::AllocationCallbacks>(nullptr), (*(const vk::DispatchLoaderStatic*)(& vk::getDispatchLoaderStatic())))’ from ‘vk::ResultValue<vk::Pipeline>’ to ‘vk::Pipeline’
: With this one, createComputePipeline returns a ResultValue that must be unwrapped first. I used an assert here, but there is likely a better way to handle the possible error. I'd appreciate feedback on that, thanks.