slang-shader-engineer

Write, review, and optimize Slang shaders for cross-platform GPU pipelines.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill slang-shader-engineer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: slang-shader-engineer
Source: https://github.com/github/awesome-copilot/tree/main/skills/slang-shader-engineer
Command: npx skills add https://github.com/github/awesome-copilot --skill slang-shader-engineer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing portable, production-quality Slang shader code requires deep knowledge of modules, generics, parameter blocks, capabilities, and cross-compilation targets, and mistakes in these areas cause subtle backend-specific bugs.

Core Features & Use Cases

  • Shader Authoring and Review: Write, refactor, and review Slang code for graphics, compute, tessellation, and ray tracing stages with correctness, portability, and performance checks.
  • Cross-Compilation Guidance: Compile Slang to SPIR-V, DXIL, GLSL, Metal, CUDA, and CPU targets using slangc with explicit capability and layout handling.
  • Engine Integration: Design reflection-driven C++ host integration with parameter blocks, binding layouts, and CMake setup.
  • Use Case: Ask for a PBR vertex/fragment shader pair using parameter blocks targeting Vulkan, and receive validated Slang code with binding summaries and host-side assumptions.

Quick Start

Ask the assistant to write a Slang compute shader with parameter blocks that compiles to both SPIR-V and DXIL.

Frequently Asked Questions about slang-shader-engineer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Slang shader that compiles to both Vulkan and D3D12?

Write standard Slang code and compile with slangc using multiple targets, for example slangc shader.slang -target spirv -o shader.spv -target dxil -o shader.dxil. Use parameter blocks and capability attributes to handle backend differences explicitly.

How do I use parameter blocks in Slang shaders?

Define a struct with your parameters and declare it as ParameterBlock<T>, which maps to a single descriptor table in D3D12 or descriptor set in Vulkan. Group parameters by update frequency such as per-frame, per-object, and per-material blocks.

Does Slang support automatic differentiation in shaders?

Yes, Slang provides first-class autodiff with fwd_diff and bwd_diff operators, the [Differentiable] attribute, and DifferentialPair<T> types. Custom derivatives can be defined with [ForwardDerivative] and [BackwardDerivative] attributes.

What is the difference between import and #include in Slang?

Slang's import loads a module once with no preprocessor macro sharing, unlike textual #include. Use __exported import to re-export another module's declarations, and __include for multi-file modules.

Which Slang features are not portable across all GPU targets?

Pointers only work on SPIR-V, C++, and CUDA targets. Tessellation is unavailable on Vulkan, ray tracing requires D3D12 or Vulkan, and Metal lacks double precision support. Use [require(...)] capability attributes to gate target-specific features.