anchor.diff:                  else
                       SampleVariants.Bias
   
  -            memberFunction
  -                "regular sampled texture-lookup"
  -                variant
  -                "Sample"
  -                (["coord", coordType] @ additionalArgs)
  -                returnType
  +            Write.MemberFunction(
  +                "Sample",
  +                (["coord", coordType] @ additionalArgs),
  +                returnType,
  +                comment = "regular sampled texture-lookup",
  +                variants = variant
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureOffset.xhtml
           if d <> SamplerDimension.SamplerCube && not m then
  -            memberFunction
  -                "regular sampled texture-lookup with offset"
  -                SampleVariants.Bias
  -                "SampleOffset"
  -                (["coord", coordType] @ additionalArgs @ ["offset", texelCoordType])
  -                returnType
  +            Write.MemberFunction(
  +                "SampleOffset",
  +                (["coord", coordType] @ additionalArgs @ ["offset", texelCoordType]),
  +                returnType,
  +                comment = "regular sampled texture-lookup with offset",
  +                variants = SampleVariants.Bias
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureProj.xhtml
           if d <> SamplerDimension.SamplerCube && not m && not a then
  -            memberFunction
  -                "projective sampled texture-lookup"
  -                SampleVariants.Bias
  -                "SampleProj"
  -                (["coord", projCoordType] @ additionalArgs)
  -                returnType
  +            Write.MemberFunction(
  +                "SampleProj",
  +                (["coord", projCoordType] @ additionalArgs),
  +                returnType,
  +                comment ="projective sampled texture-lookup",
  +                variants = SampleVariants.Bias
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureLod.xhtml
           if not m && not (s && d = SamplerDimension.SamplerCube) && not (s && a && d = SamplerDimension.Sampler2d) then
  -            memberFunction
  -                "sampled texture-lookup with given level"
  -                SampleVariants.None
  -                "SampleLevel"
  -                (["coord", coordType] @ additionalArgs @ ["level", "float"])
  -                returnType
  +            Write.MemberFunction(
  +                "SampleLevel",
  +                (["coord", coordType] @ additionalArgs @ ["level", "float"]),
  +                returnType,
  +                comment = "sampled texture-lookup with given level"
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureLodOffset.xhtml
           if not m && d <> SamplerDimension.SamplerCube && not (s && a && d = SamplerDimension.Sampler2d) then
  -            memberFunction
  -                "sampled texture-lookup with given level and offset"
  -                SampleVariants.None
  -                "SampleLevelOffset"
  -                (["coord", coordType] @ additionalArgs @ ["level", "float"; "offset", texelCoordType])
  -                returnType
  +            Write.MemberFunction(
  +                "SampleLevelOffset",
  +                (["coord", coordType] @ additionalArgs @ ["level", "float"; "offset", texelCoordType]),
  +                returnType,
  +                comment = "sampled texture-lookup with given level and offset"
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureGrad.xhtml
           if not m then
  -            memberFunction
  -                "sampled texture-lookup with explicit gradients"
  -                SampleVariants.None
  -                "SampleGrad"
  -                (["coord", coordType] @ additionalArgs @ ["dTdx", coordType; "dTdy", coordType])
  -                returnType
  +            Write.MemberFunction(
  +                "SampleGrad",
  +                (["coord", coordType] @ additionalArgs @ ["dTdx", coordType; "dTdy", coordType]),
  +                returnType,
  +                comment = "sampled texture-lookup with explicit gradients"
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureQueryLod.xhtml
           if not m then
  -            memberFunction
  -                "query lod levels"
  -                SampleVariants.None
  -                "QueryLod"
  -                ["coord", coordType]
  -                "V2d"
  +            Write.MemberFunction(
  +                "QueryLod",
  +                ["coord", coordType],
  +                "V2d",
  +                comment = "query lod levels"
  +            )
   
           // https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureGather.xhtml
           if (d = SamplerDimension.Sampler2d || d = SamplerDimension.SamplerCube) && not m then
  
positive.code: type SampleVariants =
      | None = 0x0
      | Bias = 0x1
      
  
  let memberFunctionAttributesDefaultArgs (comment : string) (attributes : Option<string>) (variants : SampleVariants) (name : string)
                                          (args : list<string * string * Option<string>>) (ret : string) =
      let args =
          args |> List.map (fun (n,t,o) ->
              match o with
              | Some def -> sprintf "[<Optional; DefaultParameterValue(%s)>] %s : %s" def n t
              | _ -> sprintf "%s : %s" n t
          ) |> String.concat ", "
  
  
      line "/// %s" comment
  
      match attributes with
      | Some attr -> line "%s" attr
      | _ -> ()
  
      line "member x.%s(%s) : %s = onlyInShaderCode \"%s\"" name args ret name
      line ""
  
      if (variants &&& SampleVariants.Bias) <> SampleVariants.None then
          line "/// %s with lod-bias" comment
          line "member x.%s(%s, lodBias : float) : %s = onlyInShaderCode \"%s\"" name args ret name
          line ""
  
  let memberFunctionDefaultArgs (comment : string) (variants : SampleVariants) (name : string)
                                (args : list<string * string * Option<string>>) (ret : string) =
      memberFunctionAttributesDefaultArgs comment None variants name args ret
  
  let memberFunctionAttributes (comment : string) (attributes : Option<string>) (variants : SampleVariants)
                               (name : string) (args : list<string * string>) (ret : string) =
      let args = args |> List.map (fun (n, t) -> n, t, None)
      memberFunctionAttributesDefaultArgs comment attributes variants name args ret
  
  let memberFunction (comment : string) (variants : SampleVariants)
                     (name : string) (args : list<string * string>) (ret : string) =
      memberFunctionAttributes comment None variants name args ret
  
  let propertyDefaultArgs (comment : string) (name : string) (setter : Option<String>) (args : list<string * string * Option<string>>) (ret : string) =
      let args =
          args |> List.map (fun (n,t,o) ->
              match o with
              | Some def -> sprintf "[<Optional; DefaultParameterValue(%s)>] %s : %s" def n t
              | _ -> sprintf "%s : %s" n t
          ) |> String.concat ", "
  
      line "/// %s" comment
      line "member x.Item"
      line "    with get (%s) : %s = onlyInShaderCode \"%s\"" args ret name
  
      match setter with
      | Some name ->
          line "    and set (%s) (data : %s) : unit = onlyInShaderCode \"%s\"" args ret name
      | _ ->
          ()
  
      line ""
  
  let property (comment : string) (name : string) (setter : Option<String>) (args : list<string * string>) (ret : string) =
      let args = args |> List.map (fun (n, t) -> n, t, None)
      propertyDefaultArgs comment name setter args ret
  
  let floatVec (c : int) =
      match c with
  
negative.code: 
          let itemArgs = args |> List.map (fun (n,t) -> sprintf "%s : %s" n t) |> String.concat ", "
  
          Write.MemberFunction(
              "Load",
              args,
              returnType,
              comment = "load single texel from image"
          )
  
          Write.MemberFunction(
              "Store",
              (args @ ["data", returnType]),
              "unit",
              comment = "write single texel into image",
              attributes = "[<FShade.Imperative.KeepCall>]"
          )
  
          Write.Property(
              "Load",
              args,
              returnType,
              setter = "Store",
              comment = "access single texel of image"
          )
  
          if t = SamplerType.Int then
              line "member x.AtomicAdd(%s, data : int) : int = onlyInShaderCode \"AtomicAdd\"" itemArgs
  