Example #1
0
        public override void BindProgramParameters(GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask)
        {
            var type = programType;

            // only supports float constants
            var floatStruct = parms.FloatLogicalBufferStruct;

            foreach (var i in floatStruct.Map)
            {
                if ((i.Value.Variability & mask) != 0)
                {
                    var logicalIndex = i.Key;
                    var pFloat       = parms.GetFloatConstantList();
                    var ptr          = i.Value.PhysicalIndex;
                    {
                        for (var j = 0; j < i.Value.CurrentSize; j += 4)
                        {
                            var x = pFloat[ptr + j];
                            var y = pFloat[ptr + j + 1];
                            var z = pFloat[ptr + j + 2];
                            var w = pFloat[ptr + j + 3];
                            Gl.glProgramLocalParameter4fARB(type, logicalIndex, x, y, z, w);
                            ++logicalIndex;
                        }
                    }
                }
            }
        }
Example #2
0
        public override void BindProgramParameters(GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask)
        {
            // Register combiners uses 2 constants per texture stage (0 and 1)
            // We have stored these as (stage * 2) + const_index in the physical buffer
            // There are no other parameters in a register combiners shader
            var floatList = parms.GetFloatConstantList();
            var index     = 0;

            for (var i = 0; i < floatList.Length; ++i, ++index)
            {
                var combinerStage = Gl.GL_COMBINER0_NV + (index / 2);
                var pname         = Gl.GL_CONSTANT_COLOR0_NV + (index % 2);

                Gl.glCombinerStageParameterfvNV(combinerStage, pname, ref floatList[i]);
            }
        }