Exemplo n.º 1
0
        public LogicalGroupReference CreateDrawLogicalGroup(string logicalGroup)
        {
            // Check existing slots
            for (int i = 0; i < drawLogicalGroups.Count; i++)
            {
                if (drawLogicalGroups[i].Variable.Equals(logicalGroup))
                {
                    return(new LogicalGroupReference(i));
                }
            }

            // Need a new slot
            var slotReference = new LogicalGroupReference(drawLogicalGroups.Count);

            drawLogicalGroups.Add(new NamedSlotDefinition(logicalGroup));

            // Update existing instantiated buffers
            foreach (var effect in InstantiatedEffects)
            {
                var resourceGroupLayout = effect.Value.PerDrawLayout;

                // Ensure there is enough space
                if (resourceGroupLayout.LogicalGroups == null || resourceGroupLayout.LogicalGroups.Length < drawLogicalGroups.Count)
                {
                    Array.Resize(ref resourceGroupLayout.LogicalGroups, drawLogicalGroups.Count);
                }

                ResolveLogicalGroup(resourceGroupLayout, slotReference.Index, logicalGroup);
            }

            return(slotReference);
        }
Exemplo n.º 2
0
 public LogicalGroup GetLogicalGroup(LogicalGroupReference logicalGroupReference)
 {
     return(LogicalGroups[logicalGroupReference.Index]);
 }
        public LogicalGroupReference CreateDrawLogicalGroup(string logicalGroup)
        {
            // Check existing slots
            for (int i = 0; i < drawLogicalGroups.Count; i++)
            {
                if (drawLogicalGroups[i].Variable.Equals(logicalGroup))
                    return new LogicalGroupReference(i);
            }

            // Need a new slot
            var slotReference = new LogicalGroupReference(drawLogicalGroups.Count);
            drawLogicalGroups.Add(new NamedSlotDefinition(logicalGroup));

            // Update existing instantiated buffers
            foreach (var effect in InstantiatedEffects)
            {
                var resourceGroupLayout = effect.Value.PerDrawLayout;

                // Ensure there is enough space
                if (resourceGroupLayout.LogicalGroups == null || resourceGroupLayout.LogicalGroups.Length < drawLogicalGroups.Count)
                    Array.Resize(ref resourceGroupLayout.LogicalGroups, drawLogicalGroups.Count);

                ResolveLogicalGroup(resourceGroupLayout, slotReference.Index, logicalGroup);
            }

            return slotReference;
        }
 public LogicalGroup GetLogicalGroup(LogicalGroupReference logicalGroupReference)
 {
     return LogicalGroups[logicalGroupReference.Index];
 }