{
"name": "PipelineName",
"permutations": {
},
"imports": {
},
"options": {
},
"useVariables": {
},
"inputs": {
},
"outputs": {
},
"resources": {
},
"tasks": {
}
}
Unique name for the pipeline.
Not used. Sometimes set to 'Full'.
The imports section may contained named imported pipelines, which may in turn be used like tasks.
Imports are defined as "key": "value" pairs, where the key is a unique identifier used to reference the pipeline, and the value is the path to a valid pipeline file.
{
"imports": {
"Imported": "Pipelines/Other.pipeline"
}
// ...
"tasks": {
"MyImportedTask": {
"type": "$Imported",
// ...
}
}
}
The options section may contain per pipeline options that control resource availability and task flow. The following example shows how to use the Cogs runtime variable mysettings.value to change the pipeline behaviour depending on its value at the pipeline startup.
{
"options": {
"MyOption": {
"values": [ "MyValueA", "MyValueB" ],
"setting": "mysettings.value"
},
},
// ...
"tasks": {
"$MyOption==MyValueA": {
"MyTask": {
// ...
}
},
"$MyOption==MyValueB": {
"MyOtherTask": {
// ...
}
},
}
}
The useVariables section defines variables which will be bound to Cogs runtime variables, including their default values (if variable was not defined).
{
"useVariables": {
"lightScale": "renderer.lightScale 1.0",
"radius": "renderer.postProcess.bloom.radius 5.0",
"rampThreshold": "renderer.postProcess.bloom.rampThreshold 3.0",
"rampWidth": "renderer.postProcess.bloom.rampWidth 2.0",
"intensity": "renderer.postProcess.bloom.intensity 0.2"
}
}
The inputs section defines named input slots used to bind input resources to the pipeline.
Input slots are defined as "key": "value" pairs where the key is an identifier used to refer to the resource and value is a resource type.
{
"inputs": {
"Color": "Texture2D",
"Depth": "Texture2D",
}
}
The outputs section defines named output slots used to bind output resources to the pipeline.
Output slots are defined as "key": "value" pairs where the key is an identifier used to refer to the resource and value is a resource type.
{
"outputs": {
"Color": "RenderTarget",
"Compute": "RenderBuffer"
}
}
The resources section defines resources and resource aliases to be used by tasks.
{
"resources": {
"MyTexture": {
"type": "Texture2D",
"format": "R8G8B8A8_UNORM_SRGB",
"width": 1024,
"height": 1024
},
"MyRenderTarget": {
"type": "RenderTarget",
"textures": [ "MyTexture" ],
},
"MyAliasTexture": "Texture2D MyTexture"
}
}
Resource types {#resourceTypes}
format: e.g R32_TYPELESSflags: e.g "Depth"widthheightsamples number of MSAA sampleslevels number of mipmap levelspersistent content persists over frames, defaults to falseflags: "Structured" | "StructuredWithCounter" | "Raw"elementSize:elementCount: ,fill:persistent: content persists over frames, defaults to falseThe tasks section defines the set of tasks that should be instantiated for the pipeline.
{
"tasks": {,
"MyFilterTask": {
"type": "Filter",
"input": [ "Cogs.RenderList" ],
"output": "MyRenderList",
"bucketMask": "All",
"permutation": "Forward"
},
"MyRenderTask": {
"type": "RenderList",
"input": "MyRenderList",
"output": "MyRenderTarget",
"permutation": "Forward"
}
}
}
All tasks must specify their input and output and the task type, inputs and outputs will be used also to chain the pipeline togeher in the right order.
The type can be an application defined value (defined by the key parameter specified when calling Cogs::Core::addTaskType
to register a Cogs::Core::RenderTask derived class), or one of the following:
ClearResource
"fill": "datatype fillvalue"ComputeCopyResourceDeferredLightingFilterGenerateListMipLevels Compute mip pyramid by either upscaling or downscaling the image by a factor of 2 for each level. Assumes that the input texture is genrated with mip levels and that the output rendertarget contains the texture as a color attachment.
firstLevel: "0",lastLevel: "999999",effect Specifies the shader and other effect parameters for up / downscaling the image.PostProcess
effectblendMode: "Blend" | "Add" | "PremultipliedBlend" | "AlphaToCoverage" | "None" | "Zero" | "One_One_Zero_InverseSourceAlpha" | "InverseSourceAlpha_SourceAlpha"clear: true | false,ReadbackRenderListResolveResourceTransparencyMergeTransparencyRenderTransparencyTemporalUpscaleTransparencyUpscaleType names are case sensitive.
Some of the task types expects an effect to be defined. The description will be used together with a shaderbuilder to create an effect.
{
"tasks": {,
"MyPostProcess": {
"type": "PostProcess",
"input": {
"List": "FilteredList", // A renderlist is often provided to get camera parameters
"ColorTex": "ColorTex"
},
"output": "MyRenderTarget",
"effect": {
"source": "Pipelines/MyShader.hlsl", // always use the .hlsl extension
"properties": {
"colorTexture": "Texture2D ColorTex",
"normalTexture": "Texture2D NormalTex uint4", //
"depthTexture": "Texture2D DepthTex depth",
"SceneBuffer": "ConstantBuffer Cogs.SceneBuffer"
},
"options": {
"target_0": "fragColor float4",
"target_1": "normal uint4"
}
}
}
}
Each property as key value pair, where the key is the name of the property and the value a string starting with the property type followed by its name inside the shader and any potential options specifying the sampler data type (defaults to float4) and depth. The outputs in the specified rendertarget can be listed as options to the effect. If none is listed it is expected to be one, called fragColor of type float4. The shaderbuilder will use the render pipeline description to generate the input and outputs of the shader, while the main function is written in the given shader file. Note that the input and output structures definitions will be generated by the shaderbuilder and should not be part of the shader file.
source Relative path to the shader file with .hlsl suffix, the suffix will be replaced to match the expected suffix for the render backend.
properties Key value pair where the key matches the property name inside the shader and the value is a string consisting of parameter type, name matchin the task input and potential options. Types not listed in the list below will be collected in a constantbuffer named EffectParameters.
Texture2D takes optional parameters samplertype (defaults to float4) and depth for depth type sampler. For backends that seperate samplers from textures there will also be generated a sampler with the same name as the texture with Sampler appended.ConstantBuffer Note There is no check if the constant buffer is available for the current effect. If is undefined behaviour to request unavailable buffers. Some render backends will generate errors.
Sampler Creates a sampler object with the following options TODO
options
definitions
writeDepth
blendMode
Filter render items based on state in a render list.
Execute a render list. This will setup the render targets, buffers, and other state before doing the draw calls for render items in the render list.