예제 #1
0
        public static EntryPointFunction GenerateEntryPointCopyFunction(FrontEndTranslator translator, ShaderType shaderType, string functionName)
        {
            ShaderOp thisOp         = null;
            var      shaderFunction = GenerateFunction_ShaderTypeParam(translator, shaderType, functionName, out thisOp);
            var      context        = new FrontEndContext();

            context.mCurrentBlock    = shaderFunction.mBlocks[0];
            context.mCurrentFunction = shaderFunction;

            var entryPointFunction = new EntryPointFunction();

            entryPointFunction.Context              = context;
            entryPointFunction.ShaderFunction       = shaderFunction;
            entryPointFunction.ShaderTypeInstanceOp = thisOp;
            return(entryPointFunction);
        }
예제 #2
0
        public static EntryPointFunction GenerateSpirVEntryPointFunction(FrontEndTranslator translator, ShaderType shaderType, string entryPointFnName)
        {
            EntryPointFunction entryPointFunction = new EntryPointFunction();

            var library  = translator.mCurrentLibrary;
            var voidType = library.FindType(new TypeKey(typeof(void)));

            entryPointFunction.ShaderFunction = translator.CreateFunctionAndType(shaderType, voidType, entryPointFnName, null, null);
            entryPointFunction.ShaderFunction.mBlocks.Add(new ShaderBlock());
            entryPointFunction.Context = new FrontEndContext();
            entryPointFunction.Context.mCurrentType     = shaderType;
            entryPointFunction.Context.mCurrentFunction = entryPointFunction.ShaderFunction;
            entryPointFunction.Context.mCurrentBlock    = entryPointFunction.ShaderFunction.mBlocks[0];

            return(entryPointFunction);
        }