Phase 6 updates

Phase 6 · Slice 61 ·

Graphics.Blit with a material

  • Graphics.Blit(source, dest, material, pass) into a render texture runs a project shader: the source becomes the material's _MainTex (as Unity sets it), and the pass (or every pass, for -1) is queued as a texture op (RenderBlitMaterial, API 56), in order with the other blits, copies and GL draws.
  • The renderer draws it over the target's contents (Renderer::blit_material): vertex functions reading vertices get Unity's blit quad (0 to 1, through GL.LoadOrtho's camera, identity object matrix, Geometry::Blit: mesh vertices, no depth), ones making the full-screen triangle from vertex IDs get that. A material reading its own target is refused. Built-in shaders' materials still copy the source, with a warning.
  • UnityCG's appdata_base/tan/full/img carry their input locations in the include (the rewrite only saw the shader's own structs, so vert_img's UVs read the normals) and the rewrite decodes their first UVs and colors.
  • Checked by material_blits_draw_quads_and_full_screen_triangles_the_right_way_up and graphics_blit_runs_a_project_shaders_passes.
  • Next: Graphics.Blit with a material onto the screen (OnRenderImage); Shader Graph; SSAO.