vulkan
Use when the user asks about Vulkan, swapchain recreation on window resize, vkQueueSubmit, dynamic rendering, pipeline barriers, synchronization2, descriptor…
от j4flmao★ 47 звёзд на GitHub
Установить vulkan в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- 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
Что делает скилл vulkan?
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).
Как установить скилл vulkan?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vulkan запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
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…