Esempio n. 1
0
 public ShaderOp GetFieldInstance(FrontEndTranslator translator, ShaderInterfaceField interfaceField, FrontEndContext context)
 {
     if (interfaceField.GetInstance == null)
     {
         return(null);
     }
     return(interfaceField.GetInstance(translator, interfaceField, context));
 }
Esempio n. 2
0
        public static void CollectStageInputsOuputs(FrontEndTranslator translator, ShaderType shaderType, EntryPointInterfaceInfo interfaceInfo)
        {
            foreach (var field in shaderType.mFields)
            {
                var attributes = field.mMeta.mAttributes;
                ShaderAttributes.AttributeCallback stageInputCallback = (ShaderAttribute attribute) =>
                {
                    interfaceInfo.StageInputs.Add(new ShaderInterfaceField()
                    {
                        ShaderField = field
                    });
                };
                ShaderAttributes.AttributeCallback stageOutputCallback = (ShaderAttribute attribute) =>
                {
                    interfaceInfo.StageOutputs.Add(new ShaderInterfaceField()
                    {
                        ShaderField = field
                    });
                };
                ShaderAttributes.AttributeCallback hardwareBuiltInInputCallback = (ShaderAttribute attribute) =>
                {
                    var arg0           = attribute.Attribute.ConstructorArguments[0];
                    var interfaceField = new ShaderInterfaceField()
                    {
                        ShaderField = field
                    };
                    interfaceField.BuiltInType = (Spv.BuiltIn)Enum.Parse(typeof(Spv.BuiltIn), Enum.GetName(typeof(Shader.HardwareBuiltinType), arg0.Value), true);
                    interfaceInfo.HardwareBuiltInInputs.Add(interfaceField);
                };
                ShaderAttributes.AttributeCallback hardwareBuiltInOutputCallback = (ShaderAttribute attribute) =>
                {
                    var arg0           = attribute.Attribute.ConstructorArguments[0];
                    var interfaceField = new ShaderInterfaceField()
                    {
                        ShaderField = field
                    };
                    interfaceField.BuiltInType = (Spv.BuiltIn)Enum.Parse(typeof(Spv.BuiltIn), Enum.GetName(typeof(Shader.HardwareBuiltinType), arg0.Value), true);
                    interfaceInfo.HardwareBuiltInOutputs.Add(interfaceField);
                };

                attributes.ForeachAttribute(typeof(Shader.StageInput), stageInputCallback);
                attributes.ForeachAttribute(typeof(Shader.StageOutput), stageOutputCallback);
                attributes.ForeachAttribute(typeof(Shader.HardwareBuiltInInput), hardwareBuiltInInputCallback);
                attributes.ForeachAttribute(typeof(Shader.HardwareBuiltInOutput), hardwareBuiltInOutputCallback);
            }
        }
Esempio n. 3
0
 public void Add(ShaderInterfaceField interfaceField)
 {
     Fields.Add(interfaceField);
 }