Get Vulkan required extensions return random number


#1

Hi,
I am getting started with vulkan but I have some problems to initialize it.
The function glfwGetRequiredInstanceExtensions is returning random numbers each time I start the application.
I also noticed vkEnumerateInstanceExtensionProperties returns exactly the same number.

For example:
0xB50FF5D8
0x4DB4F5B8
0x3076F448
0x5A36F6B8

Any idea whats causing this and how to fix it?

EDIT:
I am sorry, I found the mistake.
It is neither related to Vulkan or GLFW.
It’s a bug in my apLog function.

Windows 10 64 Bit
Visual Studio 2015 64 Bit
LunarG SDK 1.0.42.1
GLFW 3.2.1

INT APIENTRY wWinMain(HINSTANCE pInstance, HINSTANCE pPrevInstance, WCHAR * pCmdLine, INT pCmdShow)
{
	if (glfwInit() != GLFW_TRUE)
	{
		apLog("glfwInit failure!\n");
		return -1;
	}

	if (glfwVulkanSupported() != GLFW_TRUE)
	{
		apLog("glfwVulkanSupported failure!");
		return -1;
	}

	glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
	glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
	GLFWwindow * lWindow = glfwCreateWindow(800, 800, u8"Vulkan Demo", nullptr, nullptr);

	if (lWindow == nullptr)
	{
		apLog("glfwCreateWindow failure!\n");
		return -1;
	}

	uint32_t lVkExtensionCount = 0;
	if (vkEnumerateInstanceExtensionProperties(nullptr, &lVkExtensionCount, nullptr) != VK_SUCCESS)
	{
		apLog("vkEnumerateInstanceExtensionProperties failure!\n");
		return -1;
	}

	apLog("Vulkan extensions (%X)\n", lVkExtensionCount);

	uint32_t lExtensionCount;
	const char ** lExtensionNames = glfwGetRequiredInstanceExtensions(&lExtensionCount);

	if (lExtensionNames == nullptr)
	{
		apLog("glfwGetRequiredInstanceExtensions failure!\n");
		return -1;
	}

	apLog("GLFW Extensions (%X):\n", lExtensionCount);

	while (!glfwWindowShouldClose(lWindow))
	{
		glfwPollEvents();
	}

	glfwDestroyWindow(lWindow);

	glfwTerminate();

	return 0;
}

#2

Glad you found the solution, good luck with the rest of your progress.

Note that there is a simple GLFW example for Vulkan in the tests folder which can be built using Visual Studio solution file created using cmake.