vkCreateDevice() issues

I am new to Vulkan. I am following some tutorials to setup Vulkan basic stuffs. However, when I run my program, the validation layer gives me something like:’

vkCreateSampler: value of pCreateInfo->flags contains flag bits that are note recognized members of VkSamplerCreateFlagBits
vkCreateSampler: value of pCrreateInfo->anisotropyEnable (524657200) is nether VK_TRUE nor VK_FALSE
vkCreateSampler: value of pCreateInfo0>compareEnable (-2) is neither VK_TRUE nor VK_FALSE

I track my codes and find that these infomations come from calling vkCreateDevice(). Although the creation function returns VK_SUCCESS, these validation layer information makes me feel something wrong.
Can somebody help me explain this? Thanks a lot.

Are you sure that’s caused by vkCreateDevice? It sounds more like an error related to the creation of image samplers. Can you post the code of you device creation?

Please initialize variables, before first using, like as:

VkSamplerCreateInfo vkSamplerCreateInfo = {};

vkCreateSampler(..., &vkSamplerCreateInfo ,...);

But, I haven’t used VkSamplerCreateInfo yet. It is weird.

Yep. It looks like something wrong with image samplers. But I haven’t used VkSamplerCreateInfo yet. I run my code in debug mode and set several breakpoints to see when these information pop up. And just after executing vkCreateDevice(), these information pops up in the console.

Can you please post the code which executed vkCreateDevice? otherwise I don’t think we have a chance of understanding the problem :slight_smile:

It occurs to me that you filled out some structure incorrectly. Look how it says “contains flag bits that are note recognized…”

These are my codes for creating device:

QueueFamilyIndices indices = findQueueFamilies(m_physicalDevice);
float queuePriority = 1.0f;
VkDeviceQueueCreateInfo queueCreateInfo = {};
queueCreateInfo.queueFamilyIndex = indices.graphicsFamily.value();
queueCreateInfo.queueCount = 1;
queueCreateInfo.pQueuePriorities = &queuePriority;

VkPhysicalDeviceFeatures deviceFeatures = {};

VkDeviceCreateInfo createInfo = {};
createInfo.pQueueCreateInfos = &queueCreateInfo; 
createInfo.queueCreateInfoCount = 1; 
createInfo.pEnabledFeatures = &deviceFeatures;
createInfo.enabledExtensionCount = 0;
if (vkCreateDevice(m_physicalDevice, &createInfo, nullptr, &m_device) != VK_SUCCESS)
	throw std::runtime_error("failed to create logical device!");

Same as https://www.reddit.com/r/vulkan/comments/fjreue/creating_a_device_does_a_lot_more_when_using_c/

Those calls possibly belong to some obsolete implicit layer you have installed.

After reading certain documents and references, I finally figured it out!
These API calls come from one implicit layer on my system, which is VK_LAYER_bandicam_helper.
When I run my program after checking out the layer json file and setting its ‘disable_environment’ variable to 1, everything is all right.
Thanks for all your suggestions.