In given code what is the use RenderPass and filterKeys, how does it works?
FilterKey { name: "pass"; value: "shadowmap" }
In above statement who uses these name and value?
Technique {
graphicsApiFilter {
api: GraphicsApiFilter.OpenGL
profile: GraphicsApiFilter.CoreProfile
majorVersion: 3
minorVersion: 2
}
renderPasses: [
RenderPass {
filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/shadowmap.vert")
fragmentShaderCode: loadSource("qrc:/shaders/shadowmap.frag")
}
renderStates: [
PolygonOffset { scaleFactor: 4; depthSteps: 4 },
DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/ads.vert")
fragmentShaderCode: loadSource("qrc:/shaders/ads.frag")
}
// no special render state set => use the default set of states
}
]
}
The filter keys will need to match the corresponding filter keys in the RenderPassFilter in the frame graph.
For instance, if you want to have a frame graph that only renders with the shaders specified in the forward pass, you could write something like:
RenderSettings{
activeFrameGraph: Viewport {
RenderPassFilter {
matchAny: [FilterKey { name: "pass"; value: "forward" }]
RenderSurfaceSelector {
ClearBuffers {
}
}
}
}
}
You can have multiple RenderPassFilters in the same frame graph. This allows you to render the same scene with different shaders, for instance to show the scene with different effects in different viewports, or to draw to different textures and blend them together in final pass.