本文整理汇总了C#中Axiom.Graphics.GpuProgramParameters类的典型用法代码示例。如果您正苦于以下问题:C# GpuProgramParameters类的具体用法?C# GpuProgramParameters怎么用?C# GpuProgramParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GpuProgramParameters类属于Axiom.Graphics命名空间,在下文中一共展示了GpuProgramParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UniformParameter
public UniformParameter( GpuProgramParameters.AutoConstantType autoConstantType, Real autoConstantData, int size,
GpuProgramParameters.GpuConstantType type )
: base(
Parameter.AutoParameters[ autoConstantType ].Type, Parameter.AutoParameters[ autoConstantType ].Name,
SemanticType.Unknown, -1, ContentType.Unknown, size )
{
AutoShaderParameter parameterDef = Parameter.AutoParameters[ autoConstantType ];
_name = parameterDef.Name;
if ( autoConstantData != 0.0 )
{
_name += autoConstantData.ToString();
//replace possible illegal point character in name
_name = _name.Replace( '.', '_' );
}
_type = type;
_semantic = SemanticType.Unknown;
_index = -1;
_content = Parameter.ContentType.Unknown;
this.isAutoConstantReal = true;
this.isAutoConstantInt = false;
this.autoConstantType = autoConstantType;
this.autoConstantRealData = autoConstantData;
this.variability = (int)GpuProgramParameters.GpuParamVariability.Global;
this._params = null;
this.physicalIndex = -1;
_size = size;
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:27,代码来源:UniformParameter.cs
示例2: BindParameters
public override void BindParameters(GpuProgramParameters parameters)
{
// activate the link program object
GLSLLinkProgram linkProgram = GLSLLinkProgramManager.Instance.ActiveLinkProgram;
// pass on parameters from params to program object uniforms
linkProgram.UpdateUniforms(parameters);
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:8,代码来源:GLSLGpuProgram.cs
示例3: SetConstantFloatArray
public void SetConstantFloatArray()
{
float[] expected = new[] { (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom() };
float[] actual;
GpuProgramParameters parameters = new GpuProgramParameters();
//var floatLogical = new GpuLogicalBufferStruct();
//parameters._setLogicalIndexes( floatLogical, new GpuLogicalBufferStruct() );
parameters.SetConstant( 0, expected );
Assert.IsTrue( parameters.GetFloatConstant( 0 ).isSet );
actual = parameters.GetFloatConstant( 0 ).val;
Assert.AreEqual( expected, actual );
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:14,代码来源:GpuProgramParametersTestFixture.cs
示例4: BindParameters
/// <summary>
/// Binds named parameters to fp30 programs.
/// </summary>
/// <param name="parms"></param>
public override void BindParameters(GpuProgramParameters parms)
{
if(parms.HasFloatConstants) {
for(int index = 0; index < parms.FloatConstantCount; index++) {
string name = parms.GetNameByIndex(index);
if(name != null) {
GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant(index);
// send the params 4 at a time
Gl.glProgramNamedParameter4fvNV(programId, name.Length, name, entry.val);
}
}
}
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:19,代码来源:NV3xGpuProgram.cs
示例5: BindParameters
/// <summary>
/// Called to pass parameters to the Nvparse program.
/// </summary>
/// <param name="parms"></param>
public override void BindParameters(GpuProgramParameters parms)
{
// Register combiners uses 2 constants per texture stage (0 and 1)
// We have stored these as (stage * 2) + const_index
if(parms.HasFloatConstants) {
for(int index = 0; index < parms.FloatConstantCount; index++) {
GpuProgramParameters.FloatConstantEntry entry = parms.GetFloatConstant(index);
if(entry.isSet) {
int combinerStage = Gl.GL_COMBINER0_NV + (index / 2);
int pname = Gl.GL_CONSTANT_COLOR0_NV + (index % 2);
// send the params 4 at a time
Gl.glCombinerStageParameterfvNV(combinerStage, pname, entry.val);
}
}
}
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:22,代码来源:NvparseFragmentProgram.cs
示例6: ResolveAutoParameterReal
/// <summary>
/// Resolve uniform auto constant parameter with associated real data of this program
/// </summary>
/// <param name="autoType"> The auto type of the desired parameter </param>
/// <param name="data"> The data to associate with the auto parameter </param>
/// <param name="size"> number of elements in the parameter </param>
/// <returns> parameter instance in case of that resolve operation succeeded, otherwise null </returns>
public UniformParameter ResolveAutoParameterReal( GpuProgramParameters.AutoConstantType autoType, Real data,
int size )
{
UniformParameter param = null;
//check if parameter already exists.
param = GetParameterByAutoType( autoType );
if ( param != null )
{
if ( param.IsAutoConstantRealParameter && param.AutoConstantRealData == data )
{
param.Size = Axiom.Math.Utility.Max( size, param.Size );
return param;
}
}
//Create new parameter
param = new UniformParameter( autoType, data, size );
AddParameter( param );
return param;
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:29,代码来源:Program.cs
示例7: InitShadowDebugPass
private void InitShadowDebugPass()
{
Material matDebug = (Material)MaterialManager.Instance[ SHADOW_VOLUMES_MATERIAL ];
if ( matDebug == null )
{
// Create
matDebug =
(Material)
MaterialManager.Instance.Create( SHADOW_VOLUMES_MATERIAL,
ResourceGroupManager.InternalResourceGroupName );
this.shadowDebugPass = matDebug.GetTechnique( 0 ).GetPass( 0 );
this.shadowDebugPass.SetSceneBlending( SceneBlendType.Add );
this.shadowDebugPass.LightingEnabled = false;
this.shadowDebugPass.DepthWrite = false;
TextureUnitState t = this.shadowDebugPass.CreateTextureUnitState();
t.SetColorOperationEx(
LayerBlendOperationEx.Modulate,
LayerBlendSource.Manual,
LayerBlendSource.Current,
new ColorEx( 0.7f, 0.0f, 0.2f ) );
this.shadowDebugPass.CullingMode = CullingMode.None;
if ( this.targetRenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) )
{
ShadowVolumeExtrudeProgram.Initialize();
// Enable the (infinite) point light extruder for now, just to get some params
this.shadowDebugPass.SetVertexProgram(
ShadowVolumeExtrudeProgram.GetProgramName( ShadowVolumeExtrudeProgram.Programs.PointLight ) );
this.infiniteExtrusionParams = this.shadowDebugPass.VertexProgramParameters;
this.infiniteExtrusionParams.SetAutoConstant( 0, GpuProgramParameters.AutoConstantType.WorldViewProjMatrix );
this.infiniteExtrusionParams.SetAutoConstant( 4, GpuProgramParameters.AutoConstantType.LightPositionObjectSpace );
// Note ignored extra parameter - for compatibility with finite extrusion vertex program
this.infiniteExtrusionParams.SetAutoConstant( 5, GpuProgramParameters.AutoConstantType.ShadowExtrusionDistance );
}
matDebug.Compile();
}
else
{
this.shadowDebugPass = matDebug.GetTechnique( 0 ).GetPass( 0 );
if ( this.targetRenderSystem.Capabilities.HasCapability( Capabilities.VertexPrograms ) )
{
this.infiniteExtrusionParams = this.shadowDebugPass.VertexProgramParameters;
}
}
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:50,代码来源:SceneManager.cs
示例8: UpdateCustomGpuParameter
public void UpdateCustomGpuParameter( GpuProgramParameters.AutoConstantEntry entry, GpuProgramParameters gpuParams )
{
if ( customParams[ entry.Data ] != null )
{
gpuParams.SetConstant( entry.PhysicalIndex, (Vector4)customParams[ entry.Data ] );
}
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:7,代码来源:OverlayElement.cs
示例9: BindProgramParameters
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;
}
}
}
}
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:28,代码来源:ARBGpuProgram.cs
示例10: UpdateCustomGpuParameter
/// <summary>
/// Update a custom GpuProgramParameters constant which is derived from
/// information only this Renderable knows.
/// </summary>
/// <remarks>
/// This method allows a Renderable to map in a custom GPU program parameter
/// based on it's own data. This is represented by a GPU auto parameter
/// of AutoConstants.Custom, and to allow there to be more than one of these per
/// Renderable, the 'data' field on the auto parameter will identify
/// which parameter is being updated. The implementation of this method
/// must identify the parameter being updated, and call a 'SetConstant'
/// method on the passed in <see cref="GpuProgramParameters"/> object, using the details
/// provided in the incoming auto constant setting to identify the index
/// at which to set the parameter.
/// </remarks>
/// <param name="constant">The auto constant entry referring to the parameter being updated.</param>
/// <param name="parameters">The parameters object which this method should call to set the updated parameters.</param>
public void UpdateCustomGpuParameter(GpuProgramParameters.AutoConstantEntry constant, GpuProgramParameters parameters)
{
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:20,代码来源:BspGeometry.cs
示例11: PopulateParameterNames
protected override void PopulateParameterNames( GpuProgramParameters parms )
{
parms.NamedConstants = ConstantDefinitions;
// Don't set logical / physical maps here, as we can't access parameters by logical index in GLHL.
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:5,代码来源:GLSLESProgram.cs
示例12: UpdateUniforms
/// <summary>
/// Updates program object uniforms using data from GpuProgramParameters.
/// normally called by GLSLGpuProgram.BindParameters() just before rendering occurs.
/// </summary>
/// <param name="parameters">GPU Parameters to use to update the uniforms params.</param>
public void UpdateUniforms(GpuProgramParameters parameters)
{
for(int i = 0; i < uniformReferences.Count; i++) {
UniformReference uniformRef = (UniformReference)uniformReferences[i];
GpuProgramParameters.FloatConstantEntry currentFloatEntry = null;
GpuProgramParameters.IntConstantEntry currentIntEntry = null;
if(uniformRef.isFloat) {
currentFloatEntry = parameters.GetNamedFloatConstant(uniformRef.name);
if(currentFloatEntry != null) {
if(currentFloatEntry.isSet) {
switch(uniformRef.elementCount) {
case 1:
Gl.glUniform1fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 2:
Gl.glUniform2fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 3:
Gl.glUniform3fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
case 4:
Gl.glUniform4fvARB(uniformRef.location, 1, currentFloatEntry.val);
break;
} // end switch
}
}
}
else {
currentIntEntry = parameters.GetNamedIntConstant(uniformRef.name);
if(currentIntEntry != null) {
if(currentIntEntry.isSet) {
switch(uniformRef.elementCount) {
case 1:
Gl.glUniform1ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 2:
Gl.glUniform2ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 3:
Gl.glUniform3ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
case 4:
Gl.glUniform4ivARB(uniformRef.location, 1, currentIntEntry.val);
break;
} // end switch
}
}
}
}
}
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:65,代码来源:GLSLLinkProgram.cs
示例13: UpdateCustomGpuParameter
public void UpdateCustomGpuParameter(GpuProgramParameters.AutoConstantEntry constant, GpuProgramParameters parameters)
{
parameters.SetNamedConstant(_scaleFactorName, ScaleFactor);
parameters.SetNamedConstant(_fineBlockOriginName, FineBlockOrigin);
}
开发者ID:hach-que,项目名称:SLSharp,代码行数:5,代码来源:PatchRenderable.cs
示例14: MapTypeAndElementSize
private void MapTypeAndElementSize(int cgType, bool isRegisterCombiner, GpuProgramParameters.GpuConstantDefinition def)
{
if ( isRegisterCombiner )
{
// register combiners are the only single-float entries in our buffer
def.ConstantType = GpuProgramParameters.GpuConstantType.Float1;
def.ElementSize = 1;
}
else
{
switch ( cgType )
{
case Cg.CG_FLOAT:
case Cg.CG_FLOAT1:
case Cg.CG_HALF:
case Cg.CG_HALF1:
def.ConstantType = GpuProgramParameters.GpuConstantType.Float1;
break;
case Cg.CG_FLOAT2:
case Cg.CG_HALF2:
def.ConstantType = GpuProgramParameters.GpuConstantType.Float2;
break;
case Cg.CG_FLOAT3:
case Cg.CG_HALF3:
def.ConstantType = GpuProgramParameters.GpuConstantType.Float3;
break;
case Cg.CG_FLOAT4:
case Cg.CG_HALF4:
def.ConstantType = GpuProgramParameters.GpuConstantType.Float4;
break;
case Cg.CG_FLOAT2x2:
case Cg.CG_HALF2x2:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_2X2;
break;
case Cg.CG_FLOAT2x3:
case Cg.CG_HALF2x3:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_2X3;
break;
case Cg.CG_FLOAT2x4:
case Cg.CG_HALF2x4:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_2X4;
break;
case Cg.CG_FLOAT3x2:
case Cg.CG_HALF3x2:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_3X2;
break;
case Cg.CG_FLOAT3x3:
case Cg.CG_HALF3x3:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_3X3;
break;
case Cg.CG_FLOAT3x4:
case Cg.CG_HALF3x4:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_3X4;
break;
case Cg.CG_FLOAT4x2:
case Cg.CG_HALF4x2:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_4X2;
break;
case Cg.CG_FLOAT4x3:
case Cg.CG_HALF4x3:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_4X3;
break;
case Cg.CG_FLOAT4x4:
case Cg.CG_HALF4x4:
def.ConstantType = GpuProgramParameters.GpuConstantType.Matrix_4X4;
break;
case Cg.CG_INT:
case Cg.CG_INT1:
def.ConstantType = GpuProgramParameters.GpuConstantType.Int1;
break;
case Cg.CG_INT2:
def.ConstantType = GpuProgramParameters.GpuConstantType.Int2;
break;
case Cg.CG_INT3:
def.ConstantType = GpuProgramParameters.GpuConstantType.Int3;
break;
case Cg.CG_INT4:
def.ConstantType = GpuProgramParameters.GpuConstantType.Int4;
break;
default:
def.ConstantType = GpuProgramParameters.GpuConstantType.Unknown;
break;
}
// Cg pads
def.ElementSize = GpuProgramParameters.GpuConstantDefinition.GetElementSize( def.ConstantType, true );
}
}
开发者ID:WolfgangSt,项目名称:axiom,代码行数:87,代码来源:CgProgram.cs
示例15: ChangePage
/// <summary>
///
/// </summary>
/// <param name="pageNum"></param>
protected void ChangePage( int pageNum )
{
if ( this.materialControlsContainer.Count == 0 )
{
return;
}
this.currentPage = ( pageNum == -1 ) ? ( this.currentPage + 1 )%this.numPages : pageNum;
string pageText = string.Format( "Parameters {0} / {1}", this.currentPage + 1, this.numPages );
( (Button)TrayManager.GetWidget( "PageButtonControl" ) ).Caption = pageText;
if ( this.activeMaterial != null && this.activeMaterial.SupportedTechniques.Count > 0 )
{
Technique currentTechnique = this.activeMaterial.SupportedTechniques[ 0 ];
if ( currentTechnique != null )
{
this.activePass = currentTechnique.GetPass( 0 );
if ( this.activePass != null )
{
if ( this.activePass.HasFragmentProgram )
{
this.activeFragmentProgram = this.activePass.FragmentProgram;
this.activeFragmentParameters = this.activePass.FragmentProgramParameters;
}
if ( this.activePass.HasVertexProgram )
{
this.activeVertexProgram = this.activePass.VertexProgram;
this.activeVertexParameters = this.activePass.VertexProgramParameters;
}
int activeControlCount = this.materialControlsContainer[ this.currentMaterial ].ShaderControlsCount;
int startControlIndex = this.currentPage*ControlsPerPage;
int numControls = activeControlCount - startControlIndex;
if ( numControls <= 0 )
{
this.currentPage = 0;
startControlIndex = 0;
numControls = activeControlCount;
}
for ( int i = 0; i < ControlsPerPage; i++ )
{
Slider shaderControlSlider = this.shaderControls[ i ];
if ( i < numControls )
{
shaderControlSlider.Show();
int controlIndex = startControlIndex + i;
ShaderControl activeShaderDef =
this.materialControlsContainer[ this.currentMaterial ].GetShaderControl( controlIndex );
shaderControlSlider.SetRange( activeShaderDef.MinVal, activeShaderDef.MaxVal, 50, false );
shaderControlSlider.Caption = activeShaderDef.Name;
shaderControlSlider.SliderMoved += new SliderMovedHandler( shaderControlSlider_SliderMoved );
float uniformVal = 0.0f;
switch ( activeShaderDef.Type )
{
case ShaderType.GpuVertex:
case ShaderType.GpuFragment:
{
GpuProgramParameters activeParameters = ( activeShaderDef.Type == ShaderType.GpuVertex )
? this.activeVertexParameters
: this.activeFragmentParameters;
if ( activeParameters != null )
{
throw new NotImplementedException( "Fix this" );
//int idx = activeParameters.GetParamIndex( activeShaderDef.ParamName );
//activeShaderDef.PhysicalIndex = idx;
//uniformVal = activeParameters.GetNamedFloatConstant( activeShaderDef.ParamName ).val[ activeShaderDef.ElementIndex ];
}
}
break;
case ShaderType.MatSpecular:
{
// get the specular values from the material pass
ColorEx oldSpec = this.activePass.Specular;
int x = activeShaderDef.ElementIndex;
uniformVal = x == 0 ? oldSpec.r : x == 1 ? oldSpec.g : x == 2 ? oldSpec.b : x == 3 ? oldSpec.a : 0;
}
break;
case ShaderType.MatDiffuse:
{
// get the specular values from the material pass
ColorEx oldSpec = this.activePass.Diffuse;
int x = activeShaderDef.ElementIndex;
uniformVal = x == 0 ? oldSpec.r : x == 1 ? oldSpec.g : x == 2 ? oldSpec.b : x == 3 ? oldSpec.a : 0;
}
break;
case ShaderType.MatAmbient:
{
// get the specular values from the material pass
ColorEx oldSpec = this.activePass.Ambient;
int x = activeShaderDef.ElementIndex;
//.........这里部分代码省略.........
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:101,代码来源:OceanSample.cs
示例16: BindProgramParameters
public override void BindProgramParameters( GpuProgramParameters parms, GpuProgramParameters.GpuParamVariability mask )
{
// 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.GetFloatPointer( i.Value.PhysicalIndex ).Pointer;
// Iterate over the params, set in 4-float chunks (low-level)
for ( var j = 0; j < i.Value.CurrentSize; j += 4 )
{
Gl.glSetFragmentShaderConstantATI( Gl.GL_CON_0_ATI + logicalIndex, pFloat.Pin() );
pFloat.UnPin();
pFloat += 4;
++logicalIndex;
}
}
}
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:22,代码来源:ATIFragmentShaderGpuProgram.cs
示例17: CopyConstantsFrom
public void CopyConstantsFrom( GpuProgramParameters source )
{
this.floatConstants.Clear();
this.floatConstants.AddRange( source.floatConstants );
this.intConstants.Clear();
this.intConstants.AddRange( source.intConstants );
// Iterate over auto parameters
// Clear existing auto constants
ClearAutoConstants();
this.autoConstants.AddRange( source.autoConstants.Select( x => x.Clone() ) );
this._combinedVariability = source._combinedVariability;
CopySharedParamSetUsage( source._sharedParamSets );
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:16,代码来源:GpuProgramParameters.cs
示例18: SetConstantMatrix4
public void SetConstantMatrix4()
{
float[] expected = new[] { (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
(float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
(float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(),
(float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom(), (float)Utility.SymmetricRandom() };
float[] actual = new float[16];
GpuProgramParameters parameters = new GpuProgramParameters();
//var floatLogical = new GpuLogicalBufferStruct();
//parameters._setLogicalIndexes( floatLogical, new GpuLogicalBufferStruct() );
parameters.SetConstant( 0, new Matrix4( expected[ 0 ], expected[ 1 ], expected[ 2 ], expected[ 3 ],
expected[ 4 ], expected[ 5 ], expected[ 6 ], expected[ 7 ],
expected[ 8 ], expected[ 9 ], expected[ 10 ], expected[ 11 ],
expected[ 12 ], expected[ 13 ], expected[ 14 ], expected[ 15 ] ) );
GpuProgramParameters.FloatConstantEntry fcEntry;
for (int i = 0; i < 4; i++)
{
fcEntry = parameters.GetFloatConstant(i);
Assert.IsTrue(fcEntry.isSet);
fcEntry.val.CopyTo(actual, i * 4);
}
Assert.AreEqual( expected, actual );
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:28,代码来源:GpuProgramParametersTestFixture.cs
示例19: CopyMatchingNamedConstantsFrom
public void CopyMatchingNamedConstantsFrom( GpuProgramParameters source )
{
if ( this._namedConstants == null || source == null )
{
return;
}
var srcToDestNamedMap = new Dictionary<int, string>();
foreach ( var i in source._namedConstants.Map )
{
var paramName = i.Key;
var olddef = i.Value;
var newdef = FindNamedConstantDefinition( paramName, false );
if ( newdef == null )
{
continue;
}
// Copy data across, based on smallest common definition size
var srcsz = olddef.ElementSize*olddef.ArraySize;
var destsz = newdef.ElementSize*newdef.ArraySize;
var sz = Utility.Min( srcsz, destsz );
if ( newdef.IsFloat )
{
Memory.Copy( source.GetFloatPointer( olddef.PhysicalIndex ).Pointer,
GetFloatPointer( newdef.PhysicalIndex ).Pointer, sz*sizeof ( float ) );
}
else
{
Memory.Copy( source.GetIntPointer( olddef.PhysicalIndex ).Pointer, GetIntPointer( newdef.PhysicalIndex ).Pointer,
sz*sizeof ( int ) );
}
// we'll use this map to resolve autos later
// ignore the [0] aliases
if ( !paramName.EndsWith( "[0]" ) )
{
srcToDestNamedMap.Add( olddef.PhysicalIndex, paramName );
}
}
foreach ( var i in source.autoConstants )
{
var autoEntry = i;
// find dest physical index
if ( srcToDestNamedMap.ContainsKey( autoEntry.PhysicalIndex ) )
{
var miSecond = srcToDestNamedMap[ autoEntry.PhysicalIndex ];
if ( autoEntry.FData != 0 )
{
SetNamedAutoConstantReal( miSecond, autoEntry.Type, autoEntry.FData );
}
else
{
SetNamedAutoConstant( miSecond, autoEntry.Type, autoEntry.Data );
}
}
}
// Copy shared param sets
foreach ( var usage in source._sharedParamSets )
{
if ( !IsUsingSharedParameters( usage.Name ) )
{
AddSharedParameters( usage.SharedParameters );
}
}
}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:67,代码来源:GpuProgramParameters.cs
示例20: PopulateParameterNames
protected override void PopulateParameterNames( GpuProgramParameters parms )
{
// getConstantDefinitions() not needed in Axiom as the getter already does this implicitly
parms.SetNamedConstants(ConstantDefinitions);
// Don't set logical / physical maps here, as we can't access parameters by logical index in GLHL.
}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:6,代码来源:GLSLProgram.cs
注:本文中的Axiom.Graphics.GpuProgramParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论