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

Structured Binding compile error on createComputePipelineUnique #52

Open
oceanusxiv opened this issue Aug 21, 2022 · 0 comments
Open

Structured Binding compile error on createComputePipelineUnique #52

oceanusxiv opened this issue Aug 21, 2022 · 0 comments

Comments

@oceanusxiv
Copy link

oceanusxiv commented Aug 21, 2022

I think the fixes in #49 now causes incompatibility with the old vulkan 1.2 headers. Now you get when you compile.

error: cannot decompose inaccessible member ‘vk::UniqueHandle<vk::Pipeline, vk::DispatchLoaderStatic>::m_value’ of ‘vk::UniqueHandle<vk::Pipeline, vk::DispatchLoaderStatic>’

More specifically, it appears that at least on Ubuntu 20.04, the Vulkan headers being installed look like

  template<typename Dispatch>
  VULKAN_HPP_INLINE typename ResultValueType<UniqueHandle<Pipeline,Dispatch>>::type Device::createComputePipelineUnique( VULKAN_HPP_NAMESPACE::PipelineCache pipelineCache, const ComputePipelineCreateInfo & createInfo, Optional<const AllocationCallbacks> allocator, Dispatch const &d ) const
  {
    Pipeline pipeline;
    Result result = static_cast<Result>( d.vkCreateComputePipelines( m_device, static_cast<VkPipelineCache>( pipelineCache ), 1 , reinterpret_cast<const VkComputePipelineCreateInfo*>( &createInfo ), reinterpret_cast<const VkAllocationCallbacks*>( static_cast<const AllocationCallbacks*>( allocator ) ), reinterpret_cast<VkPipeline*>( &pipeline ) ) );

    ObjectDestroy<Device,Dispatch> deleter( *this, allocator, d );
    return createResultValue<Pipeline,Dispatch>( result, pipeline, VULKAN_HPP_NAMESPACE_STRING"::Device::createComputePipelineUnique", deleter );
  }

which returns ResultValueType instead of just ResultValue, which looks like

  template <typename T>
  struct ResultValueType
  {
#ifdef VULKAN_HPP_NO_EXCEPTIONS
    typedef ResultValue<T>  type;
#else
    typedef T               type;
#endif
  };

This is important because if you then do not define VULKAN_HPP_NO_EXCEPTIONS which by default is not defined, the contained type, which in this case is UniqueHandle would directly be forwarded, causing the structured binding breakage.

Given that structured binding for called results have not been used anywhere else in vku, I would say the assumption of the project is that VULKAN_HPP_NO_EXCEPTIONS is not defined, so I think the change made in https://github.com/tomix1024/Vookoo/blob/2b0f8f218b634e43b976408968a440bf63e3bc8a/include/vku/vku.hpp#L1333 and https://github.com/tomix1024/Vookoo/blob/2b0f8f218b634e43b976408968a440bf63e3bc8a/include/vku/vku.hpp#L1041 should be reverted to be in line with all the other return call handles.

@oceanusxiv oceanusxiv changed the title UniqueHandle breakages Structured Binding compile error on createComputePipelineUnique Aug 21, 2022
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

1 participant