Пример #1
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();


            dynamicEffectCompiler = new DynamicEffectCompiler(Services, "CustomEffect.CustomSubEffect");
            effectParameters      = new ParameterCollection();
            effectInstance        = new DefaultEffectInstance(effectParameters);
        }
Пример #2
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            if (EffectName == null) throw new ArgumentNullException("No EffectName specified");

            parameterCollections = new List<ParameterCollection> { Context.Parameters };
            parameterCollections.AddRange(SharedParameterCollections);
            parameterCollections.Add(Parameters);
            appliedParameterCollections = new List<ParameterCollection>();

            // Setup the effect compiler
            EffectInstance = new DefaultEffectInstance(parameterCollections);
            effectCompiler = new DynamicEffectCompiler(Context.Services, EffectName, -1); // Image effects are compiled with higher priority

            SetDefaultParameters();
        }
Пример #3
0
        // TODO Part of the graphics improvement XK-3052
        //  Do not use the RenderContext

        /// <summary>
        /// Initializes the core of the material, such as the shader generator and the parameter collection
        /// </summary>
        /// <param name="context">The current <see cref="RenderContext"/></param>
        protected virtual void InitializeCore(RenderContext context)
        {
            if (EffectName == null)
            {
                throw new ArgumentNullException("No EffectName specified");
            }

            ParameterCollections = new List <ParameterCollection> {
                parameters
            };

            NewParameterCollections = new FastListStruct <ParameterCollection>(8);
            OldParameterCollections = new FastListStruct <ParameterCollection>(8);

            // Setup the effect compiler
            effectInstance = new DefaultEffectInstance(ParameterCollections);             // Remove this
            effectCompiler = new DynamicEffectCompiler(context.Services, EffectName, -1); // Image effects are compiled with higher priority
        }
Пример #4
0
        public ComputeEffectShader(RenderContext context, params ParameterCollection[] sharedParameterCollections)
            : base(context, null)
        {
            parameterCollections = new List<ParameterCollection> { context.Parameters };
            if (sharedParameterCollections != null)
            {
                parameterCollections.AddRange(sharedParameterCollections);
            }
            parameterCollections.Add(Parameters);

            appliedParameterCollections = new List<ParameterCollection>();

            // Setup the effect compiler
            EffectInstance = new DefaultEffectInstance(parameterCollections);
            effectCompiler = new DynamicEffectCompiler(context.Services, "ComputeEffectShader");

            ThreadNumbers = new Int3(1);
            ThreadGroupCounts = new Int3(1);

            SetDefaultParameters();
        }
Пример #5
0
        /// <inheritdoc/>
        protected override void InitializeCore()
        {
            base.InitializeCore();

            if (EffectName == null)
            {
                throw new ArgumentNullException("No EffectName specified");
            }

            parameterCollections = new List <ParameterCollection> {
                Context.Parameters
            };
            parameterCollections.AddRange(SharedParameterCollections);
            parameterCollections.Add(Parameters);
            appliedParameterCollections = new List <ParameterCollection>();

            // Setup the effect compiler
            EffectInstance = new DefaultEffectInstance(parameterCollections);
            effectCompiler = new DynamicEffectCompiler(Context.Services, EffectName, -1); // Image effects are compiled with higher priority

            SetDefaultParameters();
        }
Пример #6
0
        public ComputeEffectShader(RenderContext context, params ParameterCollection[] sharedParameterCollections)
            : base(context, null)
        {
            parameterCollections = new List <ParameterCollection> {
                context.Parameters
            };
            if (sharedParameterCollections != null)
            {
                parameterCollections.AddRange(sharedParameterCollections);
            }
            parameterCollections.Add(Parameters);

            appliedParameterCollections = new List <ParameterCollection>();

            // Setup the effect compiler
            EffectInstance = new DefaultEffectInstance(parameterCollections);
            effectCompiler = new DynamicEffectCompiler(context.Services, "ComputeEffectShader");

            ThreadNumbers     = new Int3(1);
            ThreadGroupCounts = new Int3(1);

            SetDefaultParameters();
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImageEffectShader" /> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="effectName">Name of the shader.</param>
        /// <param name="sharedParameterCollections">The shared parameters.</param>
        /// <exception cref="System.ArgumentNullException">effectName</exception>
        public ImageEffectShader(ImageEffectContext context, string effectName, params ParameterCollection[] sharedParameterCollections)
            : base(context)
        {
            if (effectName == null)
            {
                throw new ArgumentNullException("effectName");
            }

            parameterCollections = new List <ParameterCollection> {
                context.Parameters
            };
            if (sharedParameterCollections != null)
            {
                parameterCollections.AddRange(sharedParameterCollections);
            }
            parameterCollections.Add(Parameters);

            // Setup the effect compiler
            effectInstance = new DefaultEffectInstance(parameterCollections);
            effectCompiler = new DynamicEffectCompiler(context.Services, effectName);

            SetDefaultParameters();
        }