#pragma, vert_img
# is a Directive, a way of talking directly to the compiler.
pragma states you wish to use implementation-dependent features specific to the current language.
In laymans terms, #pragma vertex vert tells the HLSL compiler that you want to access a specific feature of HLSL shaders, and assign the “vertex” output function to be your own custom “vert” function.
Unity has done a ton of work that we can reuse, and one such case is with UnityCG.cginc. The UnityCG.cginc is a shader snippet, filled with TONS of code and values you can use in your own shaders. By using the #include directive, you’re telling HLSL to reference from that snippet in your own shader file.
With UnityCG.cginc included, you now have access to vert_img, one of the many premade functions Unity has already provided. Instead of writing your own vertex function for your image effects shader every time, you can just use theirs instead.
In conclusion: #pragma vertex vert_img is telling your shader to use Unity’s premade image effects vertex function as your own, and therefore skipping the need to rewrite something that’s routinely the same for each image effects shader.
For the record, you can view the UnityGC.cginc file by checking your “Unity\Editor\Data\CGIncludes” folder and dragging and dropping the file into your code editor. There is a massive amount of shader code in that folder for you to poke around in. You can check out what makes vert_img tick from there.
You can also create your own code snippets by simply creating an empty text file with .cginc as the extension, and then using the #include “MyCustomSnippet.cginc” into your shader.