private void ParseImgCmd(Compiler.Command cmd, Dict classes, CompileException err) { if (cmd.ArgCount != 1 && cmd.ArgCount != 6) { err.Add("Arguments of the 'img' command are invalid.", cmd); return; } // specify argument types var types = new[] { typeof(GLTexture), typeof(int), typeof(int), typeof(int), typeof(TextureAccess), typeof(GpuFormat), typeof(string) }; // specify mandatory arguments var mandatory = new[] { new[] { true, true, true, true, true, true, false }, new[] { false, true, false, false, false, false, false }, }; // parse command arguments (var values, var unused) = cmd.Parse(types, mandatory, classes, err); // if there are no errors, add the object to the pass if (!err.HasErrors) { texImages.Add(new ResTexImg(values)); } }
private void ParseSampCmd(Compiler.Command cmd, Dict classes, CompileException err) { if (cmd.ArgCount != 1 && cmd.ArgCount != 2) { err.Add("Arguments of the 'samp' command are invalid.", cmd); return; } // specify argument types var types = new[] { typeof(GLSampler), typeof(int), typeof(string) }; // specify mandatory arguments var mandatory = new[] { new[] { true, true, false }, new[] { false, true, false } }; // parse command arguments (var values, var unused) = cmd.Parse(types, mandatory, classes, err); // if there are no errors, add the object to the pass if (!err.HasErrors) { sampler.Add(new Res <GLSampler>(values)); } }