#How to use vulkan-hpp vk::ShaderCreateInfoEXT constructor

1 messages · Page 1 of 1 (latest)

sacred belfry
#

Anybody know why I can't use the constructor for vk::ShaderCreateInfoEXT? This is the error that Visual Studio gives me. I am able to use the constructor that takes a pointer+size.

'vk::ShaderCreateInfoEXT::ShaderCreateInfoEXT(vk::ShaderCreateFlagsEXT,vk::ShaderStageFlagBits,vk::ShaderStageFlags,vk::ShaderCodeTypeEXT,const vk::ArrayProxyNoTemporaries<const T> &,const char *,const vk::ArrayProxyNoTemporaries<const vk::DescriptorSetLayout> &,const vk::ArrayProxyNoTemporaries<const vk::PushConstantRange> &,const vk::SpecializationInfo *,const void *)': could not deduce template argument for 'const vk::ArrayProxyNoTemporaries<const T> &' from 'std::vector<uint32_t,std::allocator<uint32_t>>'

    vector<uint32_t> vertShaderCode = { 1,2,3 };

    vk::ShaderCreateInfoEXT vertexShaderInfo(
        vk::ShaderCreateFlagBitsEXT::eLinkStage,
        vk::ShaderStageFlagBits::eVertex,
        vk::ShaderStageFlagBits::eFragment,
        vk::ShaderCodeTypeEXT::eSpirv,
        vertShaderCode,
        "main"
    );

mighty bone
#

I believe it's because of the const requirement in the array proxy. Try std::vector<const uint32_t> for your code array

sacred belfry
#

Doesn't work. I can't change the vector template parameter to <const uint32_t> otherwise I get

static_assert failed: 'The C++ Standard forbids containers of const elements because allocator<const T> is ill-formed.'

mighty bone
#

...Ah, right. Of course. That's really weird though, the array proxy should accept literally any type that has a data() and size()...