The Effect Designer is a modal window for authoring custom shader effects directly inside ShaderLab. It supports three shader types:
| Type | Target | Execution | Output |
|---|---|---|---|
| Pixel Shader | ps_5_0 |
D2D render pipeline | Image (RGBA) |
| D2D Compute Shader | cs_5_0 |
D2D per-tile dispatch | Image or analysis data |
| D3D11 Compute Shader | cs_5_0 |
Host-side D3D11 dispatch | Analysis data only |
D3D11 compute shaders run outside D2D's tiling system, enabling full-image reductions with atomics and groupshared memory. The Effect Designer generates a scaffold with the stride-based reduction pattern:
Texture2D<float4> Source : register(t0);
RWStructuredBuffer<float4> Result : register(u0);
cbuffer Constants : register(b0)
{
uint Width; // Auto-injected
uint Height; // Auto-injected
// User parameters start at offset 8
};
groupshared float4 gs_sum[32 * 32];
[numthreads(32, 32, 1)]
void main(uint3 GTid : SV_GroupThreadID)
{
uint tid = GTid.y * 32 + GTid.x;
float4 acc = float4(0, 0, 0, 0);
// Stride over entire image
for (uint y = GTid.y; y < Height; y += 32)
for (uint x = GTid.x; x < Width; x += 32)
acc += Source.Load(int3(x, y, 0));
gs_sum[tid] = acc;
GroupMemoryBarrierWithGroupSync();
// Parallel reduction
for (uint s = 512; s > 0; s >>= 1) {
if (tid < s) gs_sum[tid] += gs_sum[tid + s];
GroupMemoryBarrierWithGroupSync();
}
if (tid == 0)
Result[0] = gs_sum[0] / float(Width * Height);
}Key differences from D2D compute:
- No
_TileOffset— single dispatch covers the full image Width/Heightauto-injected at cbuffer offset 0 (user params at offset 8)- Output is
RWStructuredBuffer<float4>(notRWTexture2D<float4>) - Results map to typed analysis output fields (one
float4per field) - Supports atomics, full-image groupshared memory, and arbitrary reduction patterns
ShaderLab's built-in effects can be opened in the Effect Designer via the "Edit in Effect Designer" button in the Properties panel. The designer loads the effect's HLSL source, parameters, and analysis field definitions. Edits can be compiled and pushed back into the running graph.
The Effect Designer will support exporting D3D11 compute effects as standalone C++ header/module files. The export includes the HLSL source, input/parameter/output schema, and the dispatch contract. Developers can then customize the C++ post-processing (e.g., histogram → median computation) in their own codebase.
ShaderLab does not currently support importing a fully compiled effect from an external DLL or binary module. All effects are either built-in (registered at startup) or authored within the Effect Designer from HLSL source. A future release will add the ability to load pre-compiled D2D effect DLLs (implementing ID2D1EffectImpl) and D3D11 compute shader binaries (.cso files) directly into the graph, enabling teams to develop effects in external toolchains and test them inside ShaderLab without providing source code.