示例#1
0
        private void Initialize(ParameterCollection usedParameters)
        {
            program    = EffectProgram.New(graphicsDeviceDefault, bytecode);
            reflection = bytecode.Reflection;

            // prepare resource bindings used internally
            resourceBindings = new EffectParameterResourceBinding[bytecode.Reflection.ResourceBindings.Count];
            for (int i = 0; i < resourceBindings.Length; i++)
            {
                resourceBindings[i].Description = bytecode.Reflection.ResourceBindings[i];
            }
            defaultParameters = new ParameterCollection();
            inputSignature    = program.InputSignature;
            LoadDefaultParameters();

            CompilationParameters        = new ParameterCollection();
            DefaultCompilationParameters = new ParameterCollection();
            if (usedParameters != null)
            {
                foreach (var parameter in usedParameters)
                {
                    if (parameter.Key != CompilerParameters.DebugKey && parameter.Key != CompilerParameters.GraphicsPlatformKey && parameter.Key != CompilerParameters.GraphicsProfileKey)
                    {
                        CompilationParameters.SetObject(parameter.Key, parameter.Value);
                    }
                }
            }

            foreach (var key in CompilationParameters.Keys)
            {
                DefaultCompilationParameters.RegisterParameter(key, false);
            }
        }
示例#2
0
        private void Initialize(ParameterCollection usedParameters)
        {
            program    = EffectProgram.New(graphicsDeviceDefault, bytecode);
            reflection = program.Reflection;

            // prepare resource bindings used internally
            resourceBindings = new EffectParameterResourceBinding[reflection.ResourceBindings.Count];
            for (int i = 0; i < resourceBindings.Length; i++)
            {
                resourceBindings[i].Description = reflection.ResourceBindings[i];
            }
            defaultParameters = new ParameterCollection();
            inputSignature    = program.InputSignature;
            LoadDefaultParameters();
        }