Multi-Execution Matchbox

There’s a code example for a multi-execution matchbox in
/opt/Autodesk/presets//matchbox/shaders/EXAMPLES

The ability to run multiple passes in one shader sounds interesting, but I can’t find any documentation on this.

The example file (MultiExecutionSeparableGaussianBlur) isn’t listed here:
https://help.autodesk.com/view/FLAME/2022/ENU/?guid=Flame_API_Shader_Builder_Creating_a_Matchbox_Shader_Matchbox_Shader_Examples_html

The codes uses a uniform (adsk_result_execution) that isn’t listed here:
https://help.autodesk.com/view/FLAME/2022/ENU/?guid=Flame_API_Shader_Builder_Shader_API_Documentation_html

And the XML uses a Shader attribute (NbExecutions) that isn’t listed here:
https://help.autodesk.com/view/FLAME/2022/ENU/?guid=Flame_API_Shader_Builder_About_shader_builder_XML_html

Does any documentation exist?
Or does anyone have any experience with it?

-Ted

1 Like

I’m not sure what’s going on with the documentation either but I used it in the firefly-fixing shader linked below if you want an example… the slightly annoying thing was that you have to specify how many times to repeat in the XML, it can’t be set from a UI control, so if you do want it to be variable you have to write the logic for that yourself by checking the adsk_result_execution uniform and either running your process or just doing nothing and passing the input through. Actually I made it so that it can repeat the median process, or figure out that it’s on the last iteration and run some other stuff instead :fast_forward:

Pretty cool if you want to do a similar process a few times, it avoids having to have loads of .glsl passes which are very similar, something I have definitely been guilty of in some shaders and I’m pretty sure wastes GPU memory!!

Thank you!!

So is the result always adsk_results_pass1 no matter how many times the shader has been run?

-Ted

Yeah exactly - feels weird to be reading from the pass you’re currently executing but you actually get the results from the previous iteration instead :cyclone:

I haven’t tried but I think you could have other passes after the multi-execution one, and if you read adsk_results_pass1 from those you’d get the last iteration…

You are correct, I’m using a pass after a multi-execution pass.
It took a lot of trial & error, and when I finally got it to work it still didn’t quite make sense to me :face_with_spiral_eyes:

-Ted