vulkan
Use when the user asks about Vulkan, swapchain recreation on window resize, vkQueueSubmit, dynamic rendering, pipeline barriers, synchronization2, descriptor…
by j4flmao★ 47 GitHub stars
Install vulkan in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Vulkan Deep Engineering Guide
Purpose
Vulkan is a low-overhead, explicit GPU API. It gives fine control over every GPU step: no hidden state, no driver magic, no automatic synchronization. Performance is yours to manage - and so is every bug that comes with it.
Agent Protocol
Trigger
"vulkan", "vkQueueSubmit", "swapchain", "render pass", "dynamic rendering", "pipeline barrier", "synchronization2", "descriptor sets", "VMA", "vulkan validation".
Input Context
- Vulkan API version and required extensions
- Target GPUs/platforms (desktop, Android, MoltenVK)
- Validation layer output if debugging
Output Artifact
C/C++ Vulkan code and a synchronization explanation. No file unless requested.
Response Format
API: Vulkan {1.x} + {extensions}
Stage: {setup | swapchain | record | sync | memory}
Code: {snippet}
Sync: {src stage/access -> dst stage/access}
Validation: {clean | messages}
1. Vulkan & The Explicit Model
1.1 Explicit vs Implicit (OpenGL/WebGL)
| Aspect | OpenGL | Vulkan |
|---|---|---|
| State | Hidden global state machine | Everything explicit (pipeline state objects) |
| Threads | Single-threaded context | Record command buffers on any thread |
| Synchronization | Driver syncs | You place barriers/fences/semaphores |
| Memory | Driver allocates VRAM | You allocate VkDeviceMemory |
| Validation | Undefined behavior | Validation layers in debug builds |
| Errors | Some checks | vkGetDeviceProcAddr + validation callbacks |
1.2 The GPU Pipeline (Conceptual)
CommandBuffer (CPU records) -> Submit to Queue -> GPU executes -> Swapchain present
1.3 When to Use Vulkan
- Building a custom engine or renderer where OpenGL/WebGL abstraction is too slow.
- You need access to compute shaders, mesh shaders, ray tracing, async compute.
- Target PC/console/mobile where very low overhead matters.
- Portability across Windows/Linux/Android/macOS via the same API.
2. Initialization: Instance -> Device -> Queue
2.1 Instance
VkApplicationInfo app{};
app.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app.apiVersion = VK_API_VERSION_1_3; // highest version you use; 1.4 where available
VkInstanceCreateInfo ci{};
ci.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
ci.pApplicationInfo = &app;
ci.enabledLayerCount = (uint32_t)debugLayers.size(); // "VK_LAYER_KHRONOS_validation"
ci.ppEnabledLayerNames = debugLayers.data();
ci.enabledExtensionCount = (uint32_t)instanceExtensions.size();
ci.ppEnabledExtensionNames = instanceExtensions.data();
VkInstance instance;
vkCreateInstance(&ci, nullptr, &instance);
Required instance extensions: VK_KHR_surface (swapchain present), VK_EXT_debug_utils (debug callbacks). For windowing you also need the platform surface extension (VK_KHR_win32_surface, VK_KHR_xcb_surface, etc.).
2.2 Physical Device (GPU Selection)
uint32_t count = 0;
vkEnumeratePhysicalDevices(instance, &count, nullptr);
std::vector<VkPhysicalDevice> devices(count);
vkEnumeratePhysicalDevices(instance, &count, devices.data());
for (VkPhysicalDevice dev : devices) {
VkPhysicalDeviceProperties props;
vkGetPhysicalDeviceProperties(dev, &props);
// score by: VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU, queue family support,
// feature support (geometryShader, tessellationShader, rayTracingPipeline)
}
2.3 Queue Families
A GPU exposes queue families (graphics, compute, transfer, present):
uint32_t familyCount = 0;
vkGetPhysicalDeviceQueueFamilyProperties(physDev, &familyCount, nullptr);
std::vector<VkQueueFamilyProperties> families(familyCount);
vkGetPhysicalDeviceQueueFamilyProperties(physDev, &familyCount, families.data());
int gfxFamily = -1, computeFamily = -1, presentFamily = -1;
for (uint32_t i = 0; i < families.size(); ++i) {
if (families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) gfxFamily = i;
if (families[i].queueFlags & VK_QUEUE_COMPUTE_BIT) computeFamily = i;
// presentFamily: vkGetPhysicalDeviceSurfaceSupportKHR(dev, i, surface, &supported)
}
2.4 Logical Device
VkDeviceCreateInfo dci{};
dci.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
dci.queueCreateInfoCount = 1;
dci.pQueueCreateInfos = &queueCreateInfo; // { familyIndex = gfxFamily, queueCount = 1 }
dci.enabledExtensionCount = (uint32_t)deviceExtensions.size();
dci.ppEnabledExtensionNames = deviceExtensions.data();
// deviceExtensions: VK_KHR_swapchain, optional: VK_KHR_ray_tracing_pipeline,
// VK_EXT_descriptor_indexing, VK_KHR_buffer_device_address
VkDevice device;
vkCreateDevice(physDev, &dci, nullptr, &device);
vkGetDeviceQueue(device, gfxFamily, 0, &graphicsQueue);
2.5 Validation Layers
if (enableValidation) {
layers.emplace_back("VK_LAYER_KHRONOS_validation");
VkDebugUtilsMessengerCreateInfoEXT msgCI{};
msgCI.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT
| VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_E
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- references/compute-and-ray-tracing.md
- references/memory-and-upload.md
- references/render-passes-and-pipelines.md
- references/swapchain-and-present.md
- references/synchronization-deep-dive.md
- references/vulkan-initialization.md
- references/vulkan-rendering.md
FAQ
What does the vulkan skill do?
Use when the user asks about Vulkan, swapchain recreation on window resize, vkQueueSubmit, dynamic rendering, pipeline barriers, synchronization2, descriptor sets, VMA or validation layer errors. Produces explicit Vulkan setup, sync and memory code. Not for engine-agnostic frame graph design (use render-graph).
How do I install the vulkan skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the vulkan skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…