Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About mefesto

  • Rank

Personal Information

  • Interests
  1. I was looking at some of Sascha Willems' examples, specifically `multithreading.cpp`, and was surprised to see that he is creating a secondary command buffer per object. I'm curious to know if this is a fairly standard approach? Also, it made we wonder how expensive it is to bind the same pipeline (phong), once per secondary command buffer, but once these buffers have been executed (concatenated into a primary cbuffer) you effectively have a pipeline bind per object. Being that pipelines are immutable, is it fairly cheap after the first phong pipeline is bound and therefore any subsequent phong binds don't really impact things much? https://github.com/SaschaWillems/Vulkan/blob/master/examples/multithreading/multithreading.cpp Thanks
  2. There are only a handful of Vulkan functions you need to be aware of with SDL: http://wiki.libsdl.org/CategoryVulkan Assuming you are already familiar with SDL here are some code snippets that may help... // be sure to initialize your SDL window with the vulkan flag window = SDL_CreateWindow("My App", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_VULKAN); // initialize the vulkan instance #include <SDL.h> #include <SDL_vulkan.h> #include <vector> // in some init function... uint32_t extensionCount; SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, nullptr); std::vector<const char *> extensionNames(extensionCount); SDL_Vulkan_GetInstanceExtensions(window, &extensionCount, extensionNames.data()); VkApplicationInfo appInfo {}; // TODO: fill this out std::vector<const char *> layerNames {}; // uncomment below if you want to use validation layers // layerNames.push_back("VK_LAYER_LUNARG_standard_validation"); VkInstanceCreateInfo info {}; info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; info.pApplicationInfo = &appInfo; info.enabledLayerCount = layerNames.size(); info.ppEnabledLayerNames = layerNames.data(); info.enabledExtensionCount = extensionNames.size(); info.ppEnabledExtensionNames = extensionNames.data(); VkResult res; VkInstance instance; res = vkCreateInstance(&info, nullptr, &instance); if (res != VK_SUCCESS) { // do some error checking } // now that you have a window and a vulkan instance you need a surface VkSurfaceKHR surface; if (!SDL_Vulkan_CreateSurface(window, instance, &surface)) { // failed to create a surface! } // at this point you have a window, vulkan instance and a vulkan surface // SDL is out of your way and you can use the vulkan api to enumerate the // physical devices, create a logical device plus queues, and create your // swapchain. Hope that helps.
  3. If I understand correctly, you want fully lit pixels to have zero ambient color and fully unlit pixels to use the ambient color. This way the fully lit pixels should match that first screenshot. If this is true, then making this happen isn't a "hack" but simply your particular requirement. However, I agree with Aceticon that your PBR is already hacked so it doesn't really matter. Something like the following could work: float factor = max(dot(normal,sunNormal), 0.0); color = vec4(mix(ambientLight, directionalLightColor, factor), 1.0);
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!