Skip to content

Commit 81b937f

Browse files
[VFX] Update from vfx/staging (#489)
1 parent 7fb57f6 commit 81b937f

File tree

260 files changed

+69067
-63684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+69067
-63684
lines changed

TestProjects/VisualEffectGraph/Assets/AllTests/Editor/Tests/CopyPasteTest.vfx

Lines changed: 1 addition & 99 deletions
Large diffs are not rendered by default.

TestProjects/VisualEffectGraph/Assets/AllTests/Editor/Tests/Indeterminate Test.vfx

Lines changed: 2 additions & 373 deletions
Large diffs are not rendered by default.

TestProjects/VisualEffectGraph/Assets/AllTests/Editor/Tests/VFXExpressionTests.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,53 @@ public void ProcessExpressionMatrixToVector4s()
236236

237237
Assert.AreEqual(new Vector4(1, 0, 0, 0), reduced.Get<Vector4>());
238238
}
239+
240+
241+
[Test]
242+
public void OuputExpression_From_Slot_Mesh_Should_Be_Invalid_Constant()
243+
{
244+
var source = ScriptableObject.CreateInstance<VFXInlineOperator>();
245+
source.SetSettingValue("m_Type", (SerializableType)typeof(Mesh));
246+
var expressionOutput = source.outputSlots[0].GetExpression();
247+
248+
var context = new VFXExpression.Context(VFXExpressionContextOption.ConstantFolding);
249+
var reduced = context.Compile(expressionOutput);
250+
251+
Assert.IsTrue(expressionOutput.Is(VFXExpression.Flags.InvalidConstant));
252+
}
253+
254+
[Test]
255+
public void OuputExpression_From_Slot_Mesh_Should_Be_Invalid_Constant_Propagation()
256+
{
257+
var source = ScriptableObject.CreateInstance<VFXInlineOperator>();
258+
source.SetSettingValue("m_Type", (SerializableType)typeof(Mesh));
259+
260+
var meshCount = ScriptableObject.CreateInstance<Operator.MeshVertexCount>();
261+
meshCount.inputSlots[0].Link(source.outputSlots[0]);
262+
263+
var add = ScriptableObject.CreateInstance<Operator.Add>();
264+
add.SetOperandType(0, typeof(uint));
265+
add.SetOperandType(1, typeof(uint));
266+
add.inputSlots[1].value = 8u;
267+
268+
var expressionOutputBefore = add.outputSlots[0].GetExpression();
269+
var contextBefore = new VFXExpression.Context(VFXExpressionContextOption.ConstantFolding); //Used by runtime
270+
var reducedBeforeLink = contextBefore.Compile(expressionOutputBefore);
271+
272+
bool success = add.inputSlots[0].Link(meshCount.outputSlots[0]);
273+
Assert.IsTrue(success);
274+
275+
var expressionOutputAfter = add.outputSlots[0].GetExpression();
276+
var contextAfter = new VFXExpression.Context(VFXExpressionContextOption.ConstantFolding); //Used by runtime
277+
var reducedAfterLink = contextAfter.Compile(expressionOutputAfter);
278+
279+
var contextAfterCPUEvaluation = new VFXExpression.Context(VFXExpressionContextOption.CPUEvaluation | VFXExpressionContextOption.ConstantFolding); //Used by GUI
280+
var reducedAfterLinkCPUEvaluation = contextAfterCPUEvaluation.Compile(expressionOutputAfter);
281+
282+
Assert.IsAssignableFrom(typeof(VFXValue<uint>), reducedBeforeLink);
283+
Assert.IsAssignableFrom(typeof(VFXExpressionAdd), reducedAfterLink);
284+
Assert.IsAssignableFrom(typeof(VFXValue<uint>), reducedAfterLinkCPUEvaluation);
285+
}
239286
}
240287
}
241288
#endif

TestProjects/VisualEffectGraph/Assets/AllTests/Editor/Tests/VFXSlotContainerModelTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ public void DynamicSlots()
196196

197197

198198
model.SetSettingValue("slotSetting", 1);
199-
Assert.IsTrue(model.GetInputSlot(0).property.attributes.Length == 0);
199+
Assert.IsTrue(model.GetInputSlot(0).property.attributes.attributes.Count == 0);
200200

201201
model.SetSettingValue("slotSetting", 5);
202-
Assert.IsTrue(model.GetInputSlot(0).property.attributes.Length == 1);
202+
Assert.IsTrue(model.GetInputSlot(0).property.attributes.attributes.Count == 1);
203203
}
204204

205205
[Test]

0 commit comments

Comments
 (0)