[ShaderGraph] [2022.1] [Ruby] Bool <-> Vector casts#5718
Conversation
|
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. Shader Graph Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
|
I went over this with Alex and we both love it! Thanks a lot for figuring out how to do this. |
👍 |
| case ConcreteSlotValueType.Vector2: | ||
| case ConcreteSlotValueType.Vector3: | ||
| case ConcreteSlotValueType.Vector4: | ||
| return string.Format("((bool) {0}.x)", rawOutput); |
There was a problem hiding this comment.
Does this mean that vector -> bool casts only take the x component? Should that be the behavior or should it be using either any/all?
There was a problem hiding this comment.
Probably taking the first one has the least chance of unintentional behavior...
| return ordered.FirstOrDefault(); | ||
| { | ||
| var first = ordered.FirstOrDefault(); | ||
| if (first == ConcreteSlotValueType.Boolean) |
There was a problem hiding this comment.
This isn't clear to me as you remove Boolean from the list but you handle the case of boolean here. Can this actually happen and if so why?
There was a problem hiding this comment.
Yeah the inner case here can be removed, as the outer case handles it. Didn't have the outer check originally, but it's needed to make bool act like Vector1 in terms of allowing upcasts.
joshua-davis
left a comment
There was a problem hiding this comment.
Looks good and the questions I had were answered.
# Conflicts: # com.unity.shadergraph/CHANGELOG.md
…orrect value. Also fixed an issue with existing tests
Purpose of this PR
Fix for https://fogbugz.unity3d.com/f/cases/1359160/
Add bool <-> vector casts:

Testing status
Describe what manual/automated tests were performed for this PR
Added automated tests:
PR ShaderGraph: 🟢
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Fbool-cast/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_trunk/9198270/job/pipeline
master: c722c5d
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fall-
shadergraph.yml%2523PR_ShaderGraph_trunk/9173313/job/pipeline
PR HDRP: 🟡 -- failures match master behavior
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Fbool-cast/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/9221605/job/pipeline
master: c722c5d
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fall-hdrp.yml%2523PR_HDRP_trunk/9193640/job/pipeline
failures:
HDRP on OSX_Metal_playmode_mono_Linear on version trunk -- non-test failure on both 🟡
HDRP on Linux_Vulkan_playmode_mono_Linear on version trunk -- non-test-failure on both 🟡
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fhdrp-linux-vulkan.yml%2523HDRP_Linux_Vulkan_playmode_mono_Linear_trunk/9224677/job
HDRP on Win_DX11_playmode_XR_mono_Linear on version trunk -- green on rerun 🟢
PR URP: 🟡 -- failures match master behavior
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/sg%252Fbool-cast/.yamato%252Fall-urp.yml%2523PR_URP_trunk/9198473/job/pipeline
master: c722c5d
failures:
URP_Terrain on Android_Vulkan_Standalone_il2cpp_Linear on version trunk -- non-test failure on both 🟡
URP_Foundation on OSX_Metal_playmode_mono_Linear on version trunk -- non-test failure on both after master rerun 🟡
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Furp_foundation-osx-metal.yml%2523URP_Foundation_OSX_Metal_playmode_mono_Linear_trunk/9227199/job
URP_Foundation on Android_OpenGLES3_Standalone_il2cpp_Linear on version trunk -- green on rerun 🟢
URP_PostPro on OSX_Metal_playmode_mono_Linear on version trunk -- non-test failure on both after master rerun 🟡
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Furp_postpro-osx-metal.yml%2523URP_PostPro_OSX_Metal_playmode_mono_Linear_trunk/9226818/job
Universal_Stereo on Win__Standalone_mono_Linear on version trunk -- same 1 test failed on both 🟡
ShaderGraph on OSX_Metal_playmode_mono_Linear on version trunk -- non-test failure on both after master rerun 🟡
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fshadergraph-osx-metal.yml%2523ShaderGraph_OSX_Metal_playmode_mono_Linear_trunk/9226817/job
Comments to reviewers
Notes for the reviewers you have assigned.