コード例 #1
0
		public override void BindGpuProgramParameters( GpuProgramType type, GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask )
		{
			if ( ( mask & GpuProgramParameters.GpuParamVariability.Global ) == GpuProgramParameters.GpuParamVariability.Global )
			{
				//Just copy
				parms.CopySharedParams();
			}

			switch ( type )
			{
				case GpuProgramType.Vertex:
					activeVertexGpuProgramParameters = parms;
					this.currentVertexProgram.BindProgramParameters( parms, (uint) mask );
					break;
				case GpuProgramType.Fragment:
					activeFragmentGpuProgramParameters = parms;
					this.currentFragmentProgram.BindProgramParameters( parms, (uint) mask );
					break;
				case GpuProgramType.Geometry:
				default:
					break;
			}
		}
コード例 #2
0
        public override void BindGpuProgramParameters(GpuProgramType gptype, GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability variability)
        {
            // special case pass iteration
            if (variability == GpuProgramParameters.GpuParamVariability.PassIterationNumber)
            {
                BindGpuProgramPassIterationParameters(gptype);
                return;
            }

            if ((variability & GpuProgramParameters.GpuParamVariability.Global) != 0)
            {
                // D3D9 doesn't support shared constant buffers, so use copy routine
                parms.CopySharedParams();
            }

            switch ( gptype )
            {
                case GpuProgramType.Vertex:
                    activeVertexGpuProgramParameters = parms;

                    if ( parms.HasFloatConstants )
                    {
                        for ( var index = 0; index < parms.FloatConstantCount; index++ )
                        {
                            var entry = parms.GetFloatConstant( index );

                            if ( entry.isSet )
                            {
                                ActiveD3D9Device.SetVertexShaderConstant(index, entry.val, 0, 1);
                            }
                        }
                    }
                    if (parms.HasIntConstants)
                    {
                        for (var index = 0; index < parms.IntConstantCount; index++)
                        {
                            var entry = parms.GetIntConstant(index);

                            if (entry.isSet)
                            {
                                ActiveD3D9Device.SetVertexShaderConstant(index, entry.val, 0, 1);
                            }
                        }
                    }

                    break;

                case GpuProgramType.Fragment:
                    activeFragmentGpuProgramParameters = parms;

                    if (parms.HasFloatConstants)
                    {
                        for (var index = 0; index < parms.FloatConstantCount; index++)
                        {
                            var entry = parms.GetFloatConstant(index);

                            if (entry.isSet)
                            {
                                ActiveD3D9Device.SetPixelShaderConstant(index, entry.val, 0, 1);
                            }
                        }
                    }
                    if ( parms.HasIntConstants )
                    {
                        for ( var index = 0; index < parms.IntConstantCount; index++ )
                        {
                            var entry = parms.GetIntConstant( index );

                            if ( entry.isSet )
                            {
                                ActiveD3D9Device.SetPixelShaderConstant(index, entry.val, 0, 1);
                            }
                        }
                    }

                    
                    break;
            }
        }
コード例 #3
0
ファイル: GLRenderSystem.cs プロジェクト: WolfgangSt/axiom
		public override void BindGpuProgramParameters( GpuProgramType type, GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask )
		{
            if ((mask & GpuProgramParameters.GpuParamVariability.Global) != 0)
            {
                // We could maybe use GL_EXT_bindable_uniform here to produce Dx10-style
                // shared constant buffers, but GPU support seems fairly weak?
                // for now, just copy
                parms.CopySharedParams();
            }

			// store the current program in use for eas unbinding later);
			switch (type)
			{
                case GpuProgramType.Vertex:
                    activeVertexGpuProgramParameters = parms;
				    currentVertexProgram.BindProgramParameters( parms, mask );
			        break;
                case GpuProgramType.Geometry:
                    activeGeometryGpuProgramParameters = parms;
                    currentGeometryProgram.BindProgramParameters(parms, mask);
                    break;
                case GpuProgramType.Fragment:
                    activeFragmentGpuProgramParameters = parms;
                    currentFragmentProgram.BindProgramParameters(parms, mask);
                    break;

			}
		}