Skip to content

Commit

Permalink
Document VERTEX_ID, INSTANCE_ID built-ins for vertex shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
kleonc committed Nov 2, 2023
1 parent e6c5c0b commit b20ab40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tutorials/shaders/shader_reference/canvas_item_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,18 @@ is usually:
+--------------------------------+----------------------------------------------------------------+
| in mat4 **PROJECTION_MATRIX** | View space to clip space transform. |
+--------------------------------+----------------------------------------------------------------+
| in int **INSTANCE_ID** | Instance ID for instancing. Not supported in GLES2 (returns |
| | 0). |
+--------------------------------+----------------------------------------------------------------+
| in vec4 **INSTANCE_CUSTOM** | Instance custom data. |
+--------------------------------+----------------------------------------------------------------+
| in bool **AT_LIGHT_PASS** | ``true`` if this is a light pass. |
+--------------------------------+----------------------------------------------------------------+
| inout vec2 **VERTEX** | Vertex, in image space. |
+--------------------------------+----------------------------------------------------------------+
| in int **VERTEX_ID** | The index of the current vertex in the vertex buffer. Not |
| | supported in GLES2 (returns 0). |
+--------------------------------+----------------------------------------------------------------+
| in vec2 **TEXTURE_PIXEL_SIZE** | Normalized pixel size of default 2D texture. |
| | For a Sprite with a texture of size 64x32px, |
| | **TEXTURE_PIXEL_SIZE** = :code:`vec2(1/64, 1/32)` |
Expand Down
6 changes: 5 additions & 1 deletion tutorials/shaders/shader_reference/spatial_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ shader, this value can be used as desired.
+--------------------------------------+--------------------------------------------------------+
| inout vec3 **VERTEX** | Vertex in local coordinates. |
+--------------------------------------+--------------------------------------------------------+
| in int **VERTEX_ID** | The index of the current vertex in the vertex buffer. |
| | Not supported in GLES2 (returns 0). |
+--------------------------------------+--------------------------------------------------------+
| out vec4 **POSITION** | If written to, overrides final vertex position. |
+--------------------------------------+--------------------------------------------------------+
| inout vec3 **NORMAL** | Normal in local coordinates. |
Expand All @@ -183,7 +186,8 @@ shader, this value can be used as desired.
+--------------------------------------+--------------------------------------------------------+
| inout float **POINT_SIZE** | Point size for point rendering. |
+--------------------------------------+--------------------------------------------------------+
| in int **INSTANCE_ID** | Instance ID for instancing. |
| in int **INSTANCE_ID** | Instance ID for instancing. Not supported in GLES2 |
| | (returns 0). |
+--------------------------------------+--------------------------------------------------------+
| in vec4 **INSTANCE_CUSTOM** | Instance custom data (for particles, mostly). |
+--------------------------------------+--------------------------------------------------------+
Expand Down

0 comments on commit b20ab40

Please sign in to comment.