Exemplo n.º 1
0
 public ShanqQueryExecutor(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary, string entryPointName)
 {
     this.model          = model;
     this.outputStream   = outputStream;
     this.vectorLibrary  = vectorLibrary;
     this.entryPointName = entryPointName;
 }
Exemplo n.º 2
0
        private static ShaderModule CreateModule <TOutput>(Device device, IVectorTypeLibrary vectorLibrary, ExecutionModel model, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction)
        {
            var shaderStream = new MemoryStream();

            Create(model, shaderStream, vectorLibrary, shaderFunction);

            int shaderLength = (int)shaderStream.Length;

            var shaderBytes = shaderStream.GetBuffer();

            var shaderData = LoadShaderData(shaderBytes, shaderLength);

            return(device.CreateShaderModule(shaderLength, shaderData));
        }
Exemplo n.º 3
0
        public ShanqExpressionVisitor(SpirvFile file, IVectorTypeLibrary vectorLibrary)
        {
            var visitMethods = this.GetType()
                               .GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
                               .Where(method => method.GetCustomAttribute <NodeTypeAttribute>() != null);

            foreach (var method in visitMethods)
            {
                var attribute = method.GetCustomAttribute <NodeTypeAttribute>();

                this.expressionVisitors.Add(attribute.NodeType, x => (ResultId)method.Invoke(this, new object[] { x }));
            }

            this.file          = file;
            this.vectorLibrary = vectorLibrary;
        }
Exemplo n.º 4
0
 public static ShaderModule CreateFragmentModule <TOutput>(Device device, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction)
 {
     return(CreateModule(device, vectorLibrary, ExecutionModel.Fragment, shaderFunction));
 }
Exemplo n.º 5
0
 public static void CreateFragment <TOutput>(Stream outputStream, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction)
 {
     Create(ExecutionModel.Fragment, outputStream, vectorLibrary, shaderFunction);
 }
Exemplo n.º 6
0
        public static void Create <TOutput>(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction)
        {
            var factory = new ShanqFactory(model, outputStream, vectorLibrary);

            shaderFunction(factory).ToArray();
        }
Exemplo n.º 7
0
 public ShanqFactory(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary)
 {
     this.executor = new ShanqQueryExecutor(model, outputStream, vectorLibrary);
 }
Exemplo n.º 8
0
 public static ShaderModule CreateVertexModule <TOutput>(Device device, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction, string entryPointName = DefaultModuleEntryPoint)
 {
     return(CreateModule(device, vectorLibrary, ExecutionModel.Vertex, shaderFunction));
 }
Exemplo n.º 9
0
 public static void CreateFragment <TOutput>(Stream outputStream, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction, string entryPointName = DefaultModuleEntryPoint)
 {
     Create(ExecutionModel.Fragment, outputStream, vectorLibrary, shaderFunction);
 }
Exemplo n.º 10
0
        public static void Create <TOutput>(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary, Func <IShanqFactory, IQueryable <TOutput> > shaderFunction, string entryPointName = DefaultModuleEntryPoint)
        {
            var factory = new ShanqFactory(model, outputStream, vectorLibrary, entryPointName);

            shaderFunction(factory).ToArray();
        }
Exemplo n.º 11
0
 public ShanqFactory(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary, string entryPointName)
 {
     this.executor = new ShanqQueryExecutor(model, outputStream, vectorLibrary, entryPointName);
 }
Exemplo n.º 12
0
 public ShanqQueryExecutor(ExecutionModel model, Stream outputStream, IVectorTypeLibrary vectorLibrary)
 {
     this.model         = model;
     this.outputStream  = outputStream;
     this.vectorLibrary = vectorLibrary;
 }