public void GetRegister(OperandType operandType, RegisterIndex registerIndex, out Number4[] register, out int index) { switch (operandType) { case OperandType.ConstantBuffer: register = _virtualMachine.ConstantBuffers[registerIndex.Index2D_0]; index = registerIndex.Index2D_1; return; case OperandType.Input: // Only GS requires 2-dimensional inputs, but for simplicity we always use a 2-dimensional input array. register = Inputs[registerIndex.Index2D_0]; index = registerIndex.Index2D_1; return; case OperandType.Output: register = Outputs; index = registerIndex.Index1D; return; case OperandType.Temp: register = Temps; index = registerIndex.Index1D; return; case OperandType.IndexableTemp: register = IndexableTemps[registerIndex.Index2D_0]; index = registerIndex.Index2D_1; return; default: throw new ArgumentException("Unsupported operand type: " + operandType); } }
/// <summary> /// Sets a callback to be used whenever texture data is requested by a shader. /// The callback will be passed the u, v and w coordinates. /// </summary> /// <typeparam name="TColor">Color type, i.e. Vector4.</typeparam> /// <param name="name">Name of the resource.</param> /// <param name="callback">The callback will be executed once for each texture fetch, /// and will be passed the u, v and w coordinates.</param> public void SetResource <TColor>(string name, ResourceCallback <TColor> callback) where TColor : struct { // Validate. var resourceIndex = _resourceBindings.FindIndex(x => x.Name == name); if (resourceIndex == -1) { throw new ArgumentException("Could not find resource named '" + name + "'", "name"); } if (StructUtility.SizeOf <TColor>() != Number4.SizeInBytes) { throw new ArgumentException(string.Format("Expected color struct to be {0} bytes, but was {1}'", Number4.SizeInBytes, StructUtility.SizeOf <TColor>())); } // Set resource into virtual machine. We also set a default sampler state. var registerIndex = new RegisterIndex((ushort)resourceIndex); _virtualMachine.SetSampler(registerIndex, new SamplerState()); _virtualMachine.SetTexture(registerIndex, new FakeTexture((u, v, w, i) => { var bytes = StructUtility.ToBytes(callback(u, v, w, i)); return(Number4.FromByteArray(bytes, 0)); })); }
public void CopyFrom(RSResolvableValueData inValue) { Mode = inValue.Mode; Value = inValue.Value; Query = inValue.Query; QueryArguments = CloneUtils.Clone(inValue.QueryArguments); Register = inValue.Register; }
static public NestedValue FromRegister(RegisterIndex inRegister) { return(new NestedValue() { m_Mode = ResolvableValueMode.Register, m_Register = inRegister }); }
public Number4 GetRegister(int contextIndex, OperandType registerType, RegisterIndex registerIndex) { Number4[] register; int index; _executionContexts[contextIndex].GetRegister(registerType, registerIndex, out register, out index); return(register[index]); }
public void SetRegister(int contextIndex, OperandType registerType, RegisterIndex registerIndex, ref Number4 value) { Number4[] register; int index; _executionContexts[contextIndex].GetRegister(registerType, registerIndex, out register, out index); if (index < register.Length) { register[index] = value; } }
public void Bootstrap() { foreach (var index in indexTypeContainer.Items) { foreach (var tenant in tenants.Tenants) { var id = new EventStoreIndexManagerId(index.GetContractId(), tenant); var command = new RegisterIndex(id); publisher.Publish(command); } } }
static public void SetAsRegister(ref RSResolvableValueData ioValue, RegisterIndex inRegister) { if (ioValue == null) { ioValue = new RSResolvableValueData(); } ioValue.Mode = ResolvableValueMode.Register; ioValue.Value = RSValue.Null; ioValue.Query = default(EntityScopedIdentifier); ioValue.QueryArguments = null; ioValue.Register = inRegister; }
public void Bootstrap() { if (cronusHostOptions.ApplicationServicesEnabled) { foreach (var index in indexTypeContainer.Items) { foreach (var tenant in tenants.Tenants) { var id = new EventStoreIndexManagerId(index.GetContractId(), tenant); var command = new RegisterIndex(id); publisher.Publish(command); } } } }
private static RegisterIndex GetRegisterIndex(ExecutionContext context, Operand operand) { var result = new RegisterIndex(); switch (operand.IndexDimension) { case OperandIndexDimension._1D: result.Index1D = EvaluateOperandIndex(context, operand.Indices[0]); break; case OperandIndexDimension._2D: result.Index2D_0 = EvaluateOperandIndex(context, operand.Indices[0]); result.Index2D_1 = EvaluateOperandIndex(context, operand.Indices[1]); break; } return(result); }
public ActionResult Index(RegisterIndex registerform) { var user = new Users() { id = registerform.kimlikno, name = registerform.ad, surname = registerform.soyad, telefon = registerform.telefon, password = registerform.sifre, email = registerform.e_mail, role = "user" }; Database.Session.Save(user); Database.Session.Flush(); return(RedirectToAction("MainPage", "Home")); }
public void Handle(RegisterIndex command) { EventStoreIndexManager ar = null; ReadResult <EventStoreIndexManager> result = repository.Load <EventStoreIndexManager>(command.Id); if (result.IsSuccess) { ar = result.Data; ar.Register(); } if (result.NotFound) { ar = new EventStoreIndexManager(command.Id); } repository.Save(ar); }
static private EntityScopeData DoEntityScopeField(GUIContent inLabel, EntityScopeData inScope, RSValidationFlags inFlags, RSValidationContext inContext) { bool bForceFirst = inFlags.Has(RSValidationFlags.RequireSingleEntity); EditorGUILayout.BeginVertical(); EntityScopeType currentType = inScope.Type; EntityScopeType nextType = ListGUILayout.Popup(inLabel, inScope.Type, RSEditorUtility.s_EntityScopeTypes); RSEntityId entityId = RSEntityId.Null; RSGroupId groupId = RSGroupId.Null; string search = string.Empty; bool useFirst = bForceFirst; string links = string.Empty; bool useFirstLinks = bForceFirst; RegisterIndex register = RegisterIndex.Register0; using (new EditorGUI.IndentLevelScope()) { switch (currentType) { case EntityScopeType.ObjectById: { entityId = RSEditorUtility.EditorPlugin.EntityIdGUIField(Content.EntityScopeEntityIdLabel, inScope.IdArg, inContext.Manager); if (entityId == RSEntityId.Null && !inFlags.Has(RSValidationFlags.AllowNullEntity)) { EditorGUILayout.HelpBox("Null entity not allowed in this context", MessageType.Error); } break; } case EntityScopeType.ObjectInRegister: { if (inFlags.Has(RSValidationFlags.DisallowRegisters)) { EditorGUILayout.HelpBox("Local vars not allowed in this context", MessageType.Error); } else { register = inScope.RegisterArg; register = (RegisterIndex)EnumGUILayout.EnumField(Content.EntityScopeRegisterLabel, register); } break; } case EntityScopeType.ObjectsWithGroup: { groupId = inScope.GroupArg; useFirst = bForceFirst || inScope.UseFirst; using (new EditorGUILayout.HorizontalScope()) { groupId = LibraryGUILayout.GroupSelector(Content.EntityScopeGroupLabel, groupId, inContext.Library); using (new EditorGUI.DisabledScope(bForceFirst)) using (new RSGUI.LabelWidthScope(100)) { useFirst = EditorGUILayout.Toggle(Content.EntityScopeGroupLabel, useFirst, GUILayout.Width(120)); } } break; } case EntityScopeType.ObjectsWithName: case EntityScopeType.ObjectsWithPrefab: { search = inScope.SearchArg; useFirst = bForceFirst || inScope.UseFirst; using (new EditorGUILayout.HorizontalScope()) { search = EditorGUILayout.TextField(currentType == EntityScopeType.ObjectsWithName ? Content.EntityScopeNameLabel : Content.EntityScopePrefabLabel, search); using (new EditorGUI.DisabledScope(bForceFirst)) using (new RSGUI.LabelWidthScope(100)) { useFirst = EditorGUILayout.Toggle(Content.EntityScopeUseFirstLabel, useFirst, GUILayout.Width(120)); } } break; } case EntityScopeType.Null: { if (!inFlags.Has(RSValidationFlags.AllowNullEntity)) { EditorGUILayout.HelpBox("Null entity not allowed in this context", MessageType.Error); } break; } case EntityScopeType.Invalid: { EditorGUILayout.HelpBox("Missing entity not allowed", MessageType.Error); break; } case EntityScopeType.Global: { if (!inFlags.Has(RSValidationFlags.AllowGlobalEntity)) { EditorGUILayout.HelpBox("Global entity not allowed in this context", MessageType.Error); } break; } case EntityScopeType.Argument: { if (inContext.Trigger == null) { EditorGUILayout.HelpBox("No argument available: No Trigger", MessageType.Error); } else if (inContext.Trigger.ParameterType == null) { EditorGUILayout.HelpBox(string.Format("No argument available: Trigger {0} has no argument", inContext.Trigger.Name), MessageType.Error); } else if (!inContext.Trigger.ParameterType.Type.CanConvert(RSBuiltInTypes.Entity)) { EditorGUILayout.HelpBox(string.Format("No argument available: Trigger {0} has incompatible argument type {1}, which cannot convert to an Entity", inContext.Trigger.Name, inContext.Trigger.ParameterType.Type), MessageType.Error); } break; } } if (inScope.SupportsLinks()) { links = inScope.LinksArg; useFirstLinks = bForceFirst || inScope.UseFirstLink; using (new EditorGUILayout.HorizontalScope()) { links = EditorGUILayout.TextField(Content.EntityScopeLinksLabel, links); using (new EditorGUI.DisabledScope(bForceFirst)) using (new RSGUI.LabelWidthScope(100)) { useFirstLinks = EditorGUILayout.Toggle(Content.EntityScopeUseFirstLinkLabel, useFirstLinks, GUILayout.Width(120)); } } } } EditorGUILayout.EndVertical(); switch (nextType) { case EntityScopeType.Self: return(EntityScopeData.Self().WithLinks(links, useFirstLinks)); case EntityScopeType.Argument: return(EntityScopeData.Argument().WithLinks(links, useFirstLinks)); case EntityScopeType.Global: return(EntityScopeData.Global()); case EntityScopeType.ObjectById: return(EntityScopeData.Entity(entityId).WithLinks(links, useFirstLinks)); case EntityScopeType.ObjectInRegister: return(EntityScopeData.Register(register).WithLinks(links, useFirstLinks)); case EntityScopeType.ObjectsWithGroup: return(EntityScopeData.WithGroup(groupId, useFirst).WithLinks(links, useFirstLinks)); case EntityScopeType.ObjectsWithName: return(EntityScopeData.WithName(search, useFirst).WithLinks(links, useFirstLinks)); case EntityScopeType.ObjectsWithPrefab: return(EntityScopeData.WithPrefab(search, useFirst).WithLinks(links, useFirstLinks)); case EntityScopeType.Invalid: return(EntityScopeData.Invalid()); case EntityScopeType.Null: default: return(EntityScopeData.Null()); } }
private void Write(RegisterIndex index, ushort value) { KIO.outpw(0x01CE, (ushort)index); KIO.outpw(0x01CF, value); }
static private NestedValue DoNestedValueField(GUIContent inLabel, NestedValue inValue, RSTypeInfo inExpectedType, RSValue inDefaultValue, RSValidationFlags inFlags, RSValidationContext inContext) { EditorGUILayout.BeginVertical(); ResolvableValueMode nextType = ListGUILayout.Popup(inLabel, inValue.Mode, RSEditorUtility.GetResolvableValueModes(inExpectedType, inFlags, inContext)); RSValue value = inDefaultValue; EntityScopedIdentifier query = new EntityScopedIdentifier(EntityScopeData.Self(), 0); RegisterIndex register = RegisterIndex.Register0; using (new EditorGUI.IndentLevelScope()) { switch (inValue.Mode) { case ResolvableValueMode.Argument: { if (inContext.Trigger == null) { EditorGUILayout.HelpBox("No parameter available: No Trigger", MessageType.Error); } else if (inContext.Trigger.ParameterType == null) { EditorGUILayout.HelpBox(string.Format("No parameter available - Trigger {0} has no parameter", inContext.Trigger.Name), MessageType.Error); } else if (inExpectedType != null && !inContext.Trigger.ParameterType.Type.CanConvert(inExpectedType)) { EditorGUILayout.HelpBox(string.Format("No parameter available - Trigger {0} has incompatible parameter type {1}, which cannot convert to {2}", inContext.Trigger.Name, inContext.Trigger.ParameterType.Type, inExpectedType), MessageType.Error); } break; } case ResolvableValueMode.Value: { if (inExpectedType == null || inExpectedType == RSBuiltInTypes.Any || inFlags.Has(RSValidationFlags.DisallowDirectValue)) { EditorGUILayout.HelpBox("Cannot specify a value in this context", MessageType.Error); } else { value = RSValueField(EditorGUIUtility.TrTempContent(inExpectedType.FriendlyName), inValue.Value, inExpectedType, inFlags, inContext); } break; } case ResolvableValueMode.Query: { query = ValueGUILayout.QueryField(RuleGUILayout.Content.ResolvableValueQueryLabel, inValue.Query, inExpectedType, inFlags.ForMethod(false), inContext); break; } case ResolvableValueMode.Register: { register = (RegisterIndex)EnumGUILayout.EnumField(RuleGUILayout.Content.ResolvableValueRegisterLabel, inValue.Register); break; } } } EditorGUILayout.EndVertical(); switch (nextType) { case ResolvableValueMode.Argument: return(NestedValue.FromArgument()); case ResolvableValueMode.Query: return(NestedValue.FromQuery(query)); case ResolvableValueMode.Register: return(NestedValue.FromRegister(register)); case ResolvableValueMode.Value: default: return(NestedValue.FromValue(value)); } }
public void LoadRegister(RegisterIndex inRegister, RSValue inValue) { Assert.True(m_Registers != null, "Execution Scope has no registers available"); m_Registers[(int)inRegister] = inValue; }
static public EntityScopeData Register(RegisterIndex inIndex) { return(new EntityScopeData(EntityScopeType.ObjectInRegister, (int)inIndex)); }
public RSValue PeekRegister(RegisterIndex inRegister) { Assert.True(m_Registers != null, "Execution Scope has no registers available"); return(m_Registers[(int)inRegister]); }
void IScriptContext.LoadRegister(RegisterIndex inRegister, object inValue) { LoadRegister(inRegister, RSInterop.ToRSValue(inValue)); }
object IScriptContext.PeekRegister(RegisterIndex inRegister) { throw new System.NotImplementedException("Registers are not valid on the RSEnvironment"); }
static private void DoResolvableValueData(UndoTarget inUndo, GUIContent inLabel, RSResolvableValueData ioValue, RSTypeInfo inExpectedType, RSValue inDefaultValue, RSValidationFlags inFlags, RSValidationContext inContext) { EditorGUILayout.BeginVertical(); bool bDisallowDirectValue = (inExpectedType == null || inExpectedType == RSBuiltInTypes.Any || inFlags.Has(RSValidationFlags.DisallowDirectValue)); ResolvableValueMode nextMode = ListGUILayout.Popup(inLabel, ioValue.Mode, RSEditorUtility.GetResolvableValueModes(inExpectedType, inFlags, inContext)); if (nextMode != ioValue.Mode) { inUndo.MarkDirty("Changed Resolvable Value Mode"); ioValue.Mode = nextMode; switch (nextMode) { case ResolvableValueMode.Argument: RSResolvableValueData.SetAsArgument(ref ioValue); break; case ResolvableValueMode.Query: RSResolvableValueData.SetAsQuery(ref ioValue, new EntityScopedIdentifier(EntityScopeData.Self(), 0)); break; case ResolvableValueMode.Value: RSResolvableValueData.SetAsValue(ref ioValue, inDefaultValue); break; case ResolvableValueMode.Register: RSResolvableValueData.SetAsRegister(ref ioValue, RegisterIndex.Register0); break; } } using (new EditorGUI.IndentLevelScope()) { switch (ioValue.Mode) { case ResolvableValueMode.Argument: { if (inContext.Trigger == null) { EditorGUILayout.HelpBox("No parameter available: No Trigger", MessageType.Error); } else if (inContext.Trigger.ParameterType == null) { EditorGUILayout.HelpBox(string.Format("No parameter available - Trigger {0} has no parameter", inContext.Trigger.Name), MessageType.Error); } else if (inExpectedType != null && !inContext.Trigger.ParameterType.Type.CanConvert(inExpectedType)) { EditorGUILayout.HelpBox(string.Format("No parameter available - Trigger {0} has incompatible parameter type {1}, which cannot convert to {2}", inContext.Trigger.Name, inContext.Trigger.ParameterType.Type, inExpectedType), MessageType.Error); } break; } case ResolvableValueMode.Value: { if (bDisallowDirectValue) { EditorGUILayout.HelpBox("Cannot specify a value in this context", MessageType.Error); } else { RSValue nextValue = ValueGUILayout.RSValueField(EditorGUIUtility.TrTempContent(inExpectedType.FriendlyName), ioValue.Value, inExpectedType, inFlags, inContext); if (nextValue != ioValue.Value) { inUndo.MarkDirty("Changed Resolvable Value Value"); ioValue.Value = nextValue; } } break; } case ResolvableValueMode.Register: { RegisterIndex nextRegister = (RegisterIndex)EnumGUILayout.EnumField(Content.ResolvableValueRegisterLabel, ioValue.Register); if (nextRegister != ioValue.Register) { inUndo.MarkDirty("Changed Resolvable Value Register"); ioValue.Register = nextRegister; } break; } case ResolvableValueMode.Query: { EntityScopedIdentifier query = ValueGUILayout.QueryField(Content.ResolvableValueQueryLabel, ioValue.Query, inExpectedType, inFlags.ForMethod(true), inContext); RSQueryInfo queryInfo = inContext.Library.GetQuery(query.Id); if (query != ioValue.Query) { bool bChangedId = query.Id != ioValue.Query.Id; inUndo.MarkDirty("Changed Resolvable Value Query", true); ioValue.Query = query; if (bChangedId) { if (queryInfo == null) { ioValue.QueryArguments = null; } else { queryInfo.PopulateDefaultArguments(ioValue); } } } int currentArgsLength = 0; if (ioValue.QueryArguments != null) { currentArgsLength = ioValue.QueryArguments.Length; } int desiredArgsLength = 0; if (queryInfo != null && queryInfo.Parameters != null) { desiredArgsLength = queryInfo.Parameters.Length; } if (desiredArgsLength == 0 && ioValue.QueryArguments != null) { inUndo.MarkDirtyWithoutUndo("Resizing Arguments", true); ioValue.QueryArguments = null; } else if (desiredArgsLength > 0 && currentArgsLength != desiredArgsLength) { inUndo.MarkDirtyWithoutUndo("Resizing Arguments", true); queryInfo.PopulateDefaultArguments(ioValue, currentArgsLength); } if (ioValue.QueryArguments != null && ioValue.QueryArguments.Length > 0) { using (new EditorGUI.IndentLevelScope()) { EditorGUILayout.Space(); EditorGUILayout.LabelField(Content.ResolvableValueQueryArgsLabel, RSGUIStyles.SubHeaderStyle); for (int i = 0; i < ioValue.QueryArguments.Length && i < queryInfo.Parameters.Length; ++i) { NestedValue nextValue = ValueGUILayout.NestedParameterField(queryInfo.Parameters[i], ioValue.QueryArguments[i], inFlags, inContext); if (nextValue != ioValue.QueryArguments[i]) { inUndo.MarkDirty("Changed Resolvable Value Query Argument"); ioValue.QueryArguments[i] = nextValue; } } } } break; } } } EditorGUILayout.EndVertical(); }
object IScriptContext.PeekRegister(RegisterIndex inRegister) { return(RSInterop.ToObject(PeekRegister(inRegister), this)); }
static private void LoadRegisterEntity(IScriptContext inContext, [RSParameter("Register")] RegisterIndex inRegister, [RSParameter("Value")] IRSRuntimeEntity inValue) { inContext?.Logger?.Log("Loading register {0} with value {1}", inRegister, inValue); inContext.LoadRegister(inRegister, inValue); }
/// <summary> /// Write value to VBE index. /// </summary> /// <param name="index">Register index.</param> /// <param name="value">Value.</param> private static void VBEWrite(RegisterIndex index, ushort value) { IO.VbeIndex.Word = (ushort)index; IO.VbeData.Word = value; }
public void SetRegister(int contextIndex, OperandType registerType, RegisterIndex registerIndex, Number4 value) { SetRegister(contextIndex, registerType, registerIndex, ref value); }
void IScriptContext.LoadRegister(RegisterIndex inRegister, object inValue) { throw new System.NotImplementedException("Registers are not valid on the RSEnvironment"); }
static private void LoadRegisterVector4(IScriptContext inContext, [RSParameter("Register")] RegisterIndex inRegister, [RSParameter("Value")] Vector4 inValue) { inContext?.Logger?.Log("Loading register {0} with value {1}", inRegister, inValue); inContext.LoadRegister(inRegister, inValue); }
public void SetTexture(RegisterIndex registerIndex, ITexture texture) { Textures[registerIndex.Index1D] = texture; }
private static ushort VBERead(RegisterIndex index) { IO.VbeIndex.Word = (ushort)index; return(IO.VbeData.Word); }
public void SetSampler(RegisterIndex registerIndex, SamplerState sampler) { Samplers[registerIndex.Index1D] = sampler; }