コード例 #1
0
        internal EffectParameter(   EffectParameterClass class_, 
                                    EffectParameterType type, 
                                    string name, 
                                    int rowCount, 
                                    int columnCount,
                                    string semantic, 
                                    EffectAnnotationCollection annotations,
                                    EffectParameterCollection elements,
                                    EffectParameterCollection structMembers,
                                    object data )
		{
            ParameterClass = class_;
            ParameterType = type;

            Name = name;
            Semantic = semantic;
            Annotations = annotations;

            RowCount = rowCount;
			ColumnCount = columnCount;

            Elements = elements;
            StructureMembers = structMembers;

            Data = data;
            StateKey = unchecked(NextStateKey++);
		}
コード例 #2
0
ファイル: EffectParameter.cs プロジェクト: ustor/MonoGame
		internal EffectParameter(Effect parent, string paramName, int paramIndex, int userIndex, int uniformLocation,
		                         string paramSType, int paramLength)
		{
			_parentEffect = parent;
			name = paramName;
			internalIndex = paramIndex;
			internalLength = paramLength;
			
			this.userIndex = userIndex;
			this.uniformLocation = uniformLocation;
			
			switch (paramSType ){
			case "Float":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Scalar;
				rowCount = 1;
				colCount = 1;
				_cachedValue = 0.0f;
				break;				
			case "FloatVec2":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 2;
				_cachedValue = OpenTK.Vector2.Zero;
				break;
			case "FloatVec3":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 3;
				_cachedValue =OpenTK.Vector3.Zero;
				break;	
			case "FloatVec4":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 4;
				_cachedValue = OpenTK.Vector4.Zero;
				break;				
			case "Sampler2D":
				paramType = EffectParameterType.Texture2D;
				paramClass = EffectParameterClass.Object;
				rowCount = 0;
				colCount = 0;
				break;				
			case "FloatMat4":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Matrix;
				rowCount = 4;
				colCount = 4;
				_cachedValue = OpenTK.Matrix4.Identity;
				break;				
				
			}
				
			
			
		}
コード例 #3
0
        /// <summary>
        /// Gets (or creates) an entry to the DescriptorSetLayout and gets its index.
        /// </summary>
        /// <returns>The future entry index.</returns>
        public void AddBinding(ParameterKey key, string logicalGroup, EffectParameterClass @class, EffectParameterType type, int arraySize = 1, SamplerState immutableSampler = null)
        {
            hashBuilder.Write(key.Name);
            hashBuilder.Write(@class);
            hashBuilder.Write(arraySize);

            ElementCount += arraySize;
            Entries.Add(new Entry { Key = key, LogicalGroup = logicalGroup, Class = @class, Type = type, ArraySize = arraySize, ImmutableSampler = immutableSampler });
        }
コード例 #4
0
ファイル: EffectAnnotation.cs プロジェクト: Zeludon/FEZ
 internal EffectAnnotation(EffectParameterClass class_, EffectParameterType type, string name, int rowCount, int columnCount, string semantic, object data)
 {
   this.ParameterClass = class_;
   this.ParameterType = type;
   this.Name = name;
   this.RowCount = rowCount;
   this.ColumnCount = columnCount;
   this.Semantic = semantic;
 }
コード例 #5
0
ファイル: EffectParameter.cs プロジェクト: tanis2000/FEZ
 internal EffectParameter(EffectParameterClass class_, EffectParameterType type, string name, int rowCount, int columnCount, int registerCount, string semantic, EffectAnnotationCollection annotations, EffectParameterCollection elements, EffectParameterCollection structMembers, object data)
 {
   this.ParameterClass = class_;
   this.ParameterType = type;
   this.Name = name;
   this.Semantic = semantic;
   this.Annotations = annotations;
   this.RowCount = rowCount;
   this.ColumnCount = columnCount;
   this.RegisterCount = registerCount;
   this.Elements = elements;
   this.StructureMembers = structMembers;
   this.Data = data;
   this.StateKey = EffectParameter.NextStateKey++;
 }
コード例 #6
0
ファイル: EffectParameter.cs プロジェクト: AesteroidBlues/FNA
        internal EffectParameter(
			string name,
			string semantic,
			int rowCount,
			int columnCount,
			int elementCount,
			EffectParameterClass parameterClass,
			EffectParameterType parameterType,
			EffectParameterCollection structureMembers,
			EffectAnnotationCollection annotations,
			IntPtr data
		)
        {
            Name = name;
            Semantic = semantic;
            RowCount = rowCount;
            ColumnCount = columnCount;
            if (elementCount > 0)
            {
                List<EffectParameter> elements = new List<EffectParameter>(elementCount);
                for (int i = 0; i < elementCount; i += 1)
                {
                    // FIXME: Probably incomplete? -flibit
                    elements.Add(new EffectParameter(
                        null,
                        null,
                        rowCount,
                        columnCount,
                        0,
                        ParameterClass,
                        parameterType,
                        null, // FIXME: See mojoshader_effects.c:readvalue -flibit
                        null,
                        new IntPtr(
                            data.ToInt64() + (i * rowCount * columnCount)
                        )
                    ));
                }
                Elements = new EffectParameterCollection(elements);
            }
            ParameterClass = parameterClass;
            ParameterType = parameterType;
            StructureMembers = structureMembers;
            Annotations = annotations;
            values = data;
        }
コード例 #7
0
ファイル: EffectAnnotation.cs プロジェクト: BlueLineGames/FNA
		internal EffectAnnotation(
			string name,
			string semantic,
			int rowCount,
			int columnCount,
			EffectParameterClass parameterClass,
			EffectParameterType parameterType,
			IntPtr data
		) {
			Name = name;
			Semantic = semantic;
			RowCount = rowCount;
			ColumnCount = columnCount;
			ParameterClass = parameterClass;
			ParameterType = parameterType;
			values = data;
		}
コード例 #8
0
ファイル: EffectParameter.cs プロジェクト: exgqn/MonoGame
		internal EffectParameter(Effect parent, string paramName, int paramIndex, string paramSType, int paramLength)
		{
			_parentEffect = parent;
			name = paramName;
			internalIndex = paramIndex;
			internalLength = paramLength;
			
			switch (paramSType ){
			case "FloatVec2":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 2;
				_cachedValue = MonoMac.OpenGL.Vector2.Zero;
				break;
			case "FloatVec3":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 3;
				_cachedValue = MonoMac.OpenGL.Vector2.Zero;
				break;	
			case "FloatVec4":
				paramType = EffectParameterType.Single;
				paramClass = EffectParameterClass.Vector;
				rowCount = 1;
				colCount = 4;
				_cachedValue = MonoMac.OpenGL.Vector2.Zero;
				break;				
			case "Sampler2D":
				paramType = EffectParameterType.Texture2D;
				paramClass = EffectParameterClass.Object;
				rowCount = 0;
				colCount = 0;
				break;				
				
			}
				
			
			
		}
コード例 #9
0
ファイル: DescriptorTypeCount.cs プロジェクト: xen2/stride
 public DescriptorTypeCount(EffectParameterClass type, int count)
 {
     Type  = type;
     Count = count;
 }
コード例 #10
0
        public static DescriptorType ConvertDescriptorType(EffectParameterClass @class, EffectParameterType type)
        {
            switch (@class)
            {
                case EffectParameterClass.ConstantBuffer:
                    return DescriptorType.UniformBuffer;
                case EffectParameterClass.Sampler:
                    return DescriptorType.Sampler;
                case EffectParameterClass.ShaderResourceView:
                    switch (type)
                    {
                        case EffectParameterType.Texture:
                        case EffectParameterType.Texture1D:
                        case EffectParameterType.Texture2D:
                        case EffectParameterType.Texture3D:
                        case EffectParameterType.TextureCube:
                        case EffectParameterType.Texture1DArray:
                        case EffectParameterType.Texture2DArray:
                        case EffectParameterType.TextureCubeArray:
                            return DescriptorType.SampledImage;

                        case EffectParameterType.Buffer:
                            return DescriptorType.UniformTexelBuffer;

                        default:
                            throw new NotImplementedException();
                    }
                case EffectParameterClass.UnorderedAccessView:
                    return DescriptorType.StorageBuffer;
                default:
                    throw new NotImplementedException();
            }
        }
コード例 #11
0
        /// <summary>
        /// Creates a new instance of <see cref="D3D10EffectAnnotation"/>.
        /// </summary>
        /// <param name="annotation">The D3D10 effect annotation.</param>
        /// <param name="name">The annotation's name.</param>
        /// <param name="semantic">The annotation's semantic.</param>
        /// <param name="paramClass">The annotation's parameter class.</param>
        /// <param name="paramType">The annotation's parameter type.</param>
        internal D3D10EffectAnnotation(D3D.EffectVariable annotation, String name, String semantic, EffectParameterClass paramClass, EffectParameterType paramType)
        {
            _name       = name;
            _annotation = annotation;
            _semantic   = semantic;
            _paramClass = paramClass;

            //Need to find a way to properly get these values!
            _paramType   = paramType;
            _columnCount = 0;
            _rowCount    = 0;
        }
コード例 #12
0
ファイル: EffectParameter.cs プロジェクト: markmnl/FNA-1
        internal EffectParameter(
			string name,
			string semantic,
			int rowCount,
			int columnCount,
			int elementCount,
			EffectParameterClass parameterClass,
			EffectParameterType parameterType,
			EffectParameterCollection structureMembers,
			EffectAnnotationCollection annotations,
			IntPtr data
		)
        {
            Name = name;
            Semantic = semantic;
            RowCount = rowCount;
            ColumnCount = columnCount;
            if (elementCount > 0)
            {
                int curOffset = 0;
                List<EffectParameter> elements = new List<EffectParameter>(elementCount);
                for (int i = 0; i < elementCount; i += 1)
                {
                    EffectParameterCollection elementMembers = null;
                    if (structureMembers != null)
                    {
                        List<EffectParameter> memList = new List<EffectParameter>();
                        for (int j = 0; j < structureMembers.Count; j += 1)
                        {
                            int memElems = 0;
                            if (structureMembers[j].Elements != null)
                            {
                                memElems = structureMembers[j].Elements.Count;
                            }
                            memList.Add(new EffectParameter(
                                structureMembers[j].Name,
                                structureMembers[j].Semantic,
                                structureMembers[j].RowCount,
                                structureMembers[j].ColumnCount,
                                memElems,
                                structureMembers[j].ParameterClass,
                                structureMembers[j].ParameterType,
                                null, // FIXME: Nested structs! -flibit
                                structureMembers[j].Annotations,
                                new IntPtr(data.ToInt64() + curOffset)
                            ));
                            int memSize = structureMembers[j].RowCount * structureMembers[j].ColumnCount;
                            if (memElems > 0)
                            {
                                memSize *= memElems;
                            }
                            curOffset += memSize * 4;
                        }
                        elementMembers = new EffectParameterCollection(memList);
                    }
                    // FIXME: Probably incomplete? -flibit
                    elements.Add(new EffectParameter(
                        null,
                        null,
                        rowCount,
                        columnCount,
                        0,
                        ParameterClass,
                        parameterType,
                        elementMembers,
                        null,
                        new IntPtr(
                            data.ToInt64() + (i * 4 * rowCount * columnCount)
                        )
                    ));
                }
                Elements = new EffectParameterCollection(elements);
            }
            ParameterClass = parameterClass;
            ParameterType = parameterType;
            StructureMembers = structureMembers;
            Annotations = annotations;
            values = data;
        }
コード例 #13
0
using System;
コード例 #14
0
ファイル: EffectParameter.cs プロジェクト: syun002/FNA
        internal EffectParameter(
            string name,
            string semantic,
            int rowCount,
            int columnCount,
            int elementCount,
            EffectParameterClass parameterClass,
            EffectParameterType parameterType,
            EffectParameterCollection structureMembers,
            EffectAnnotationCollection annotations,
            IntPtr data,
            uint dataSizeBytes
            )
        {
            if (data == IntPtr.Zero)
            {
                throw new ArgumentNullException("data");
            }

            Name        = name;
            Semantic    = semantic ?? string.Empty;
            RowCount    = rowCount;
            ColumnCount = columnCount;
            if (elementCount > 0)
            {
                int curOffset = 0;
                List <EffectParameter> elements = new List <EffectParameter>(elementCount);
                for (int i = 0; i < elementCount; i += 1)
                {
                    EffectParameterCollection elementMembers = null;
                    if (structureMembers != null)
                    {
                        List <EffectParameter> memList = new List <EffectParameter>();
                        for (int j = 0; j < structureMembers.Count; j += 1)
                        {
                            int memElems = 0;
                            if (structureMembers[j].Elements != null)
                            {
                                memElems = structureMembers[j].Elements.Count;
                            }
                            int memSize = structureMembers[j].RowCount * 4;
                            if (memElems > 0)
                            {
                                memSize *= memElems;
                            }
                            memList.Add(new EffectParameter(
                                            structureMembers[j].Name,
                                            structureMembers[j].Semantic,
                                            structureMembers[j].RowCount,
                                            structureMembers[j].ColumnCount,
                                            memElems,
                                            structureMembers[j].ParameterClass,
                                            structureMembers[j].ParameterType,
                                            null,                     // FIXME: Nested structs! -flibit
                                            structureMembers[j].Annotations,
                                            new IntPtr(data.ToInt64() + curOffset),
                                            (uint)memSize * 4
                                            ));
                            curOffset += memSize * 4;
                        }
                        elementMembers = new EffectParameterCollection(memList);
                    }
                    // FIXME: Probably incomplete? -flibit
                    elements.Add(new EffectParameter(
                                     null,
                                     null,
                                     rowCount,
                                     columnCount,
                                     0,
                                     ParameterClass,
                                     parameterType,
                                     elementMembers,
                                     null,
                                     new IntPtr(
                                         data.ToInt64() + (i * rowCount * 16)
                                         ),
                                     // FIXME: Not obvious to me how to compute this -kg
                                     0
                                     ));
                }
                Elements = new EffectParameterCollection(elements);
            }
            ParameterClass   = parameterClass;
            ParameterType    = parameterType;
            StructureMembers = structureMembers;
            Annotations      = annotations;
            values           = data;
            valuesSizeBytes  = dataSizeBytes;
        }
コード例 #15
0
        internal EffectParameter(Effect parent, string paramName, int paramIndex, int userIndex, int uniformLocation,
                                 string paramSType, int paramLength)
        {
            _parentEffect  = parent;
            name           = paramName;
            internalIndex  = paramIndex;
            internalLength = paramLength;

            this.userIndex       = userIndex;
            this.uniformLocation = uniformLocation;

            switch (paramSType)
            {
            case "Float":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Scalar;
                rowCount     = 1;
                colCount     = 1;
                _cachedValue = 0.0f;
                break;

            case "FloatVec2":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 2;
                _cachedValue = OpenTK.Vector2.Zero;
                break;

            case "FloatVec3":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 3;
                _cachedValue = OpenTK.Vector3.Zero;
                break;

            case "FloatVec4":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 4;
                _cachedValue = OpenTK.Vector4.Zero;
                break;

            case "Sampler2D":
                paramType  = EffectParameterType.Texture2D;
                paramClass = EffectParameterClass.Object;
                rowCount   = 0;
                colCount   = 0;
                break;

            case "FloatMat4":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Matrix;
                rowCount     = 4;
                colCount     = 4;
                _cachedValue = OpenTK.Matrix4.Identity;
                break;
            }
        }
コード例 #16
0
ファイル: EffectParameter.cs プロジェクト: bobaiep/root-s2
 internal EffectParameter(
     string name,
     string semantic,
     int rowCount,
     int columnCount,
     int elementCount,
     EffectParameterClass parameterClass,
     EffectParameterType parameterType,
     EffectParameterCollection structureMembers,
     EffectAnnotationCollection annotations,
     IntPtr data
     )
 {
     Name        = name;
     Semantic    = semantic;
     RowCount    = rowCount;
     ColumnCount = columnCount;
     if (elementCount > 0)
     {
         int curOffset = 0;
         List <EffectParameter> elements = new List <EffectParameter>(elementCount);
         for (int i = 0; i < elementCount; i += 1)
         {
             EffectParameterCollection elementMembers = null;
             if (structureMembers != null)
             {
                 List <EffectParameter> memList = new List <EffectParameter>();
                 for (int j = 0; j < structureMembers.Count; j += 1)
                 {
                     int memElems = 0;
                     if (structureMembers[j].Elements != null)
                     {
                         memElems = structureMembers[j].Elements.Count;
                     }
                     memList.Add(new EffectParameter(
                                     structureMembers[j].Name,
                                     structureMembers[j].Semantic,
                                     structureMembers[j].RowCount,
                                     structureMembers[j].ColumnCount,
                                     memElems,
                                     structureMembers[j].ParameterClass,
                                     structureMembers[j].ParameterType,
                                     null,                     // FIXME: Nested structs! -flibit
                                     structureMembers[j].Annotations,
                                     new IntPtr(data.ToInt64() + curOffset)
                                     ));
                     int memSize = structureMembers[j].RowCount * 4;
                     if (memElems > 0)
                     {
                         memSize *= memElems;
                     }
                     curOffset += memSize * 4;
                 }
                 elementMembers = new EffectParameterCollection(memList);
             }
             // FIXME: Probably incomplete? -flibit
             elements.Add(new EffectParameter(
                              null,
                              null,
                              rowCount,
                              columnCount,
                              0,
                              ParameterClass,
                              parameterType,
                              elementMembers,
                              null,
                              new IntPtr(
                                  data.ToInt64() + (i * rowCount * 16)
                                  )
                              ));
         }
         Elements = new EffectParameterCollection(elements);
     }
     ParameterClass   = parameterClass;
     ParameterType    = parameterType;
     StructureMembers = structureMembers;
     Annotations      = annotations;
     values           = data;
 }
コード例 #17
0
 public DescriptorSetLayoutEntry(EffectParameterClass type, int arraySize = 1) : this()
 {
     Type      = type;
     ArraySize = arraySize;
 }
コード例 #18
0
        //Gets the class and type from the underlying parameter
        private void SetClassAndType(XFG.EffectParameterClass varClass, XFG.EffectParameterType varType)
        {
            switch (varClass)
            {
            case XFG.EffectParameterClass.Scalar:
                _paramClass = EffectParameterClass.Scalar;
                break;

            case XFG.EffectParameterClass.Vector:
                _paramClass = EffectParameterClass.Vector;
                break;

            case XFG.EffectParameterClass.Matrix:
                _paramClass = EffectParameterClass.Matrix;
                break;

            case XFG.EffectParameterClass.Object:
                _paramClass = EffectParameterClass.Object;
                break;

            case XFG.EffectParameterClass.Struct:
                _paramClass = EffectParameterClass.Struct;
                break;
            }
            switch (varType)
            {
            case XFG.EffectParameterType.Bool:
                _paramType = EffectParameterType.Bool;
                break;

            case XFG.EffectParameterType.Single:
                _paramType = EffectParameterType.Single;
                break;

            case XFG.EffectParameterType.Int32:
                _paramType = EffectParameterType.Int32;
                break;

            case XFG.EffectParameterType.String:
                _paramType = EffectParameterType.String;
                break;

            case XFG.EffectParameterType.Texture:
                _paramType = EffectParameterType.Texture;
                break;

            case XFG.EffectParameterType.Texture1D:
                _paramType = EffectParameterType.Texture1D;
                break;

            case XFG.EffectParameterType.Texture2D:
                _paramType = EffectParameterType.Texture2D;
                break;

            case XFG.EffectParameterType.Texture3D:
                _paramType = EffectParameterType.Texture3D;
                break;

            case XFG.EffectParameterType.TextureCube:
                _paramType = EffectParameterType.TextureCube;
                break;

            case XFG.EffectParameterType.Void:
                _paramType = EffectParameterType.Void;
                break;
            }
        }
コード例 #19
0
ファイル: EffectParameter.cs プロジェクト: valsavva/dynacat
        internal EffectParameter(Effect parent, string paramName, int paramIndex, int userIndex, int uniformLocation,
                                 string paramSType, int paramLength, int numOfElements)
        {
            _parentEffect = parent;

            internalIndex      = paramIndex;
            internalLength     = paramLength;
            this.numOfElements = numOfElements;

            this.userIndex       = userIndex;
            this.uniformLocation = uniformLocation;

            elements = new EffectParameterCollection();

            // Check if the parameter is an array
            if (numOfElements > 1)
            {
                // We have to strip off the [0] at the end so that the
                // parameter can be references with just the name with no
                // index specifications
                if (paramName.EndsWith("[0]"))
                {
                    paramName = paramName.Remove(paramName.Length - 3);
                }
            }

            name = paramName;

            switch (paramSType)
            {
            case "Float":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Scalar;
                rowCount     = 1;
                colCount     = 1;
                _cachedValue = 0.0f;
                break;

            case "FloatVec2":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 2;
                _cachedValue = MonoMac.OpenGL.Vector2.Zero;
                break;

            case "FloatVec3":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 3;
                _cachedValue = MonoMac.OpenGL.Vector3.Zero;
                break;

            case "FloatVec4":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Vector;
                rowCount     = 1;
                colCount     = 4;
                _cachedValue = MonoMac.OpenGL.Vector4.Zero;
                break;

            case "Sampler2D":
                paramType  = EffectParameterType.Texture2D;
                paramClass = EffectParameterClass.Object;
                rowCount   = 0;
                colCount   = 0;
                break;

            case "FloatMat4":
                paramType    = EffectParameterType.Single;
                paramClass   = EffectParameterClass.Matrix;
                rowCount     = 4;
                colCount     = 4;
                _cachedValue = MonoMac.OpenGL.Matrix4.Identity;
                break;
            }

            if (numOfElements > 1)
            {
                // Setup our elements
                for (int x = 0; x < numOfElements; x++)
                {
                    EffectParameter ep = new EffectParameter(parent, name, paramIndex, userIndex, uniformLocation,
                                                             paramType, paramClass, rowCount, colCount, _cachedValue, paramLength);
                    elements._parameters.Add(ep.Name + "[" + x + "]", ep);
                }
            }
        }
コード例 #20
0
 public DescriptorTypeCount(EffectParameterClass type, int count)
 {
     Type = type;
     Count = count;
 }