World/Udon Bugs & Feature Requests

Post about current World or Udon bugs feature requests. One item per post!
Non-constructive and off-topic posts will be moved or deleted.
Expose Graphics.SetRandomWriteTarget
Note: This request is an excerpt of this document which contains some additional context and suggestions for a implementation. With the introduction of VRCGraphics.Blit and asynchronous readback feature, we are closer than ever before to having compute-shader-like capabilities in VRChat. However, we are still missing a critical component: Random writes! Random writes are the ability to write to any location in a block of memory, represented as an unordered access view (UAV) - in our case, these UAVs concretely are just RenderTextures. Random writes are hugely useful for making compute-shader-like code performant, and for many of the things that people tend to use real compute shaders for, they are downright required. This is due in part to the fact that they enable the use of atomic operations (example), which open up the doors to a bunch of algorithms that are infeasible or very tricky to implement without. We could get very close to approximating compute shaders today with the addition of one single piece of API: Graphics.SetRandomWriteTarget . With this API, you can do random writes in fragment shaders, which brings them much closer to compute shaders (see the initial link for example code). Here are some examples of possible use cases: Persistent data storage in a shader without jank. No need for GrabPass abuse, Custom Render Textures, or Camera loops. Just bind a RenderTexture and you are good to go. Communication between shaders without jank. Simply bind your render texture, and any fragment shader can now access it with both read and write access. Custom realtime GI systems. I implemented a system that places and integrates light probes dynamically based on camera depth using this piece of API. Better fluid simulations. In general, pretty much any kind of shader-based simulation can benefit from this. Either by being made simpler to implement, faster, or becoming feasible in the first place. Potentially speedup for AudioLink's DFT algorithm? Fast reduce-style operations such as summing or maxing over a domain. GPU based sorting.
2
·
Feature Requests
T[] in a generic method is compiled to an incorrect array type
Summary The UdonSharp compiler compiles T[] declarations inside generic methods to an incorrect array type instead of the array type corresponding to the type argument. This issue occurs when T[] is used only within the method body and does not appear in the method's return type or parameters. Steps to Reproduce Create a UdonSharp script using the code below. Compile the script and inspect the generated Udon assembly, focusing on the code corresponding to each generic method invocation. Expected Result The array type should correspond to the specified type argument: GenericMethod<int>() : SystemInt32Array GenericMethod<float>() : SystemSingleArray GenericMethod<string>() : SystemStringArray Actual Result SystemInt32Array is used for all invocations. The corresponding array types for float[] and string[] are not generated. Reproduction Code using UdonSharp; public class GenericsArrayTypeBug : UdonSharpBehaviour { void Start() { GenericMethod<int>(); GenericMethod<float>(); GenericMethod<string>(); } public static void GenericMethod<T>() { T[] array = new T[0]; } } Generated Udon Assembly With SDK 3.10.5, the generated assembly uses SystemInt32Array for all three invocations, as shown in the following variable declarations: __lcl_array_SystemInt32Array_0: %SystemInt32Array, null __lcl_array_SystemInt32Array_1: %SystemInt32Array, null __lcl_array_SystemInt32Array_2: %SystemInt32Array, null The array constructor calls also use SystemInt32Array in all three cases: EXTERN, "SystemInt32Array.__ctor__SystemInt32__SystemInt32Array" Therefore, even when float or string is specified as the type argument, the array is compiled as the equivalent of int[] . Additional Observation When T[] is included in the method's return type or parameters, this issue does not occur, and the array type is generated correctly. Environment VRChat Worlds SDK: 3.10.5 Unity: 2022.3.22f1
0
·
Bug Reports
Load More
→