Skip to content

Commit 06e1d95

Browse files
markg-unityEvergreen
authored andcommitted
[Port] [2021.3] DOCG-5799 Clarify Sample Graphics Buffer and custom types
1 parent 4dbbb8b commit 06e1d95

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

Packages/com.unity.visualeffectgraph/Documentation~/Operator-SampleBuffer.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22

3-
# Sample Buffer
3+
# Sample Graphics Buffer
44

5-
**Menu Path : Operator > Sampling > Sample Buffer**
5+
**Menu Path : Operator > Sampling > Sample Graphics Buffer**
66

7-
The Sample Buffer Operator enables you to fetch and sample a structured buffer. A structured buffer is a [GraphicsBuffer](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.html) created using the [Structured](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.Target.Structured.html) target.
7+
The Sample Graphics Buffer Operator enables you to fetch and sample a structured buffer. A structured buffer is a [GraphicsBuffer](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.html) created using the [Structured](https://docs.unity3d.com/ScriptReference/GraphicsBuffer.Target.Structured.html) target.
88

99
## Operator settings
1010

@@ -17,7 +17,7 @@ The Sample Buffer Operator enables you to fetch and sample a structured buffer.
1717
| **Input** | **Type** | **Description** |
1818
| ---------- | --------------------------------------- | ------------------------------------------------------------ |
1919
| **Input** | [Configurable](#operator-configuration) | The structure type. |
20-
| **Buffer** | GraphicsBuffer | The structured buffer to fetch. You can only connect an exposed property to this input port. |
20+
| **Buffer** | Graphics Buffer [property](Properties.md)| The structured buffer to fetch. You can only connect an exposed property to this input port. |
2121
| **Index** | uint | The index of the element to fetch. |
2222

2323
| **Output** | **Type** | **Description** |
@@ -26,33 +26,35 @@ The Sample Buffer Operator enables you to fetch and sample a structured buffer.
2626

2727
## Operator configuration
2828

29-
To view the Operator's configuration, click the **cog** icon in the Operator's header.
29+
To set the struct type, select the cog icon. The available types are:
3030

31-
### Available types
32-
This Operator supports sampling structured buffers that use blittable types. The list of built-in blittable types is:
33-
- bool
34-
- float*
35-
- int
36-
- uint
37-
- Vector2
38-
- Vector3
39-
- Vector4
40-
- Matrix4x4
31+
- bool
32+
- float
33+
- int
34+
- uint
35+
- Vector2
36+
- Vector3
37+
- Vector4
38+
- Matrix4x4
4139

42-
You can also declare custom types. To do this, add the `[VFXType]` attribute to a struct, and use the `VFXTypeAttribute.Usage.GraphicsBuffer` type. For example:
40+
### Add a custom type
41+
42+
To add a custom type to the list, add the `[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]` attribute to a struct. For example, the following script adds a **MyCustomData** type:
4343

4444
```c#
4545
using UnityEngine;
4646
using UnityEngine.VFX;
4747

4848
[VFXType(VFXTypeAttribute.Usage.GraphicsBuffer)]
49-
struct CustomData
49+
struct MyCustomData
5050
{
51-
public Vector3 color;
52-
public Vector3 position;
51+
public Vector3 myColor;
52+
public Vector3 myPosition;
5353
}
5454
```
5555

56+
After you set a custom type, open the **s** dropdown to display the properties of the struct and connect them to other Operators and [Contexts](Contexts.md).
57+
5658
## Limitations
5759
The Operator has the following limitations:
5860

0 commit comments

Comments
 (0)