Esempio n. 1
0
        public static void CopyInterfaceFields(FrontEndTranslator translator, ShaderOp thisOp, ShaderInterfaceSet interfaceSet, InterfaceFieldCopyMode copyMode, FrontEndContext context)
        {
            foreach (var interfaceField in interfaceSet)
            {
                var interfaceInstance = interfaceSet.GetFieldInstance(translator, interfaceField, context);
                if (interfaceInstance == null)
                {
                    continue;
                }

                var shaderFieldInstance = translator.GenerateAccessChain(thisOp, interfaceField.ShaderField.mMeta.mName, context);
                if (copyMode == InterfaceFieldCopyMode.Input)
                {
                    translator.CreateStoreOp(context.mCurrentBlock, shaderFieldInstance, interfaceInstance);
                }
                else
                {
                    translator.CreateStoreOp(context.mCurrentBlock, interfaceInstance, shaderFieldInstance);
                }
            }
        }