public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); Avx.MaskStore((Double *)_dataTable.outArrayPtr, _fld1, _fld2); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); }
public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); Avx.MaskStore((Double *)_dataTable.outArrayPtr, test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); }
public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new StoreBinaryOpTest__MaskStoreDouble(); Avx.MaskStore((Double *)_dataTable.outArrayPtr, test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); }
public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var left = Unsafe.Read <Vector128 <Double> >(_dataTable.inArray1Ptr); var right = Unsafe.Read <Vector128 <Double> >(_dataTable.inArray2Ptr); Avx.MaskStore((Double *)_dataTable.outArrayPtr, left, right); ValidateResult(left, right, _dataTable.outArrayPtr); }
public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var left = Avx.LoadAlignedVector128((Double *)(_dataTable.inArray1Ptr)); var right = Avx.LoadAlignedVector128((Double *)(_dataTable.inArray2Ptr)); Avx.MaskStore((Double *)_dataTable.outArrayPtr, left, right); ValidateResult(left, right, _dataTable.outArrayPtr); }
public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); Avx.MaskStore( (Double *)_dataTable.outArrayPtr, Avx.LoadAlignedVector128((Double *)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector128((Double *)(_dataTable.inArray2Ptr)) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); }
public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); Avx.MaskStore( (Double *)_dataTable.outArrayPtr, Unsafe.Read <Vector128 <Double> >(_dataTable.inArray1Ptr), Unsafe.Read <Vector128 <Double> >(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); }
public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); Avx.MaskStore( (Single *)_dataTable.outArrayPtr, _clsVar1, _clsVar2 ); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); }
public void RunStructFldScenario(StoreBinaryOpTest__MaskStoreDouble testClass) { Avx.MaskStore((Double *)testClass._dataTable.outArrayPtr, _fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); }
public override void ProcessBlock(float deltaTime, BlockAccessor block) { var rbs = block.GetComponentData <RigidBody>(); var pos = block.GetComponentData <Position>(); var rot = block.GetComponentData <Rotation>(); var vel = block.GetReadOnlyComponentData <Velocity>(); var avel = block.GetReadOnlyComponentData <AngularVelocity>(); if (Fma.IsSupported && Avx.IsSupported) { unsafe { Vector128 <float> deltaF = Vector128.Create(deltaTime); fixed(float *oldPosFloats = pos.Cast <Position, float>()) fixed(float *posFloats = pos.Cast <Position, float>()) fixed(float *velFloats = vel.Cast <Velocity, float>()) { int i = 0; for (; i < block.length; i += 4) { var op = Sse.LoadAlignedVector128(&oldPosFloats[i]); var p = Sse.LoadAlignedVector128(&posFloats[i]); var v = Sse.LoadAlignedVector128(&velFloats[i]); var result = Fma.MultiplyAdd(deltaF, v, p); var bools = Sse.CompareEqual(op, p); Avx.MaskStore(&posFloats[i], bools, result); } for (i -= 4; i < block.length; i++) { if (oldPosFloats[i] == posFloats[i]) { posFloats[i] = posFloats[i] + velFloats[i] * deltaTime; } } } } for (int i = 0; i < block.length; i++) { if (pos[i].value == rbs[i].lastPosition && rot[i].value == rbs[i].lastRotation) { quat x = quat.FromAxisAngle(avel[i].value.x * deltaTime, vec3.UnitX); quat y = quat.FromAxisAngle(avel[i].value.y * deltaTime, vec3.UnitY); quat z = quat.FromAxisAngle(avel[i].value.z * deltaTime, vec3.UnitZ); rot[i].value = rot[i].value * x * y * z; rbs[i].lastPosition = pos[i].value; rbs[i].lastRotation = rot[i].value; } } } else { for (int i = 0; i < block.length; i++) { if (pos[i].value == rbs[i].lastPosition && rot[i].value == rbs[i].lastRotation) { pos[i].value += vel[i].value * deltaTime; quat x = quat.FromAxisAngle(avel[i].value.x * deltaTime, vec3.UnitX); quat y = quat.FromAxisAngle(avel[i].value.y * deltaTime, vec3.UnitY); quat z = quat.FromAxisAngle(avel[i].value.z * deltaTime, vec3.UnitZ); rot[i].value = rot[i].value * x * y * z; rbs[i].lastPosition = pos[i].value; rbs[i].lastRotation = rot[i].value; } } } }