... | @@ -7,12 +7,14 @@ Tessellation enables custom tessellation of arbitrary geometry. In order to achi |
... | @@ -7,12 +7,14 @@ Tessellation enables custom tessellation of arbitrary geometry. In order to achi |
|
|
|
|
|
Each patch is then fed into a hardware tessellation unit. Additionally, the tessellator consumes tessellation factors, determined by the hull shader, as well as more global configuration, like the domain mode, whether the output primitives should be connected, and if they are to be connected, their faceness (CW vs CCW). Based on the tessellation factors and mode, the tessellator invokes the domain shader for some number of points in the "generic" domain, with its position determined via `gl_TessCoord` (which has different meanings for different modes). The domain shader has access to the full patch and generates a single vertex's worth of data, which is then assembled into primitives by the tessellator.
|
|
Each patch is then fed into a hardware tessellation unit. Additionally, the tessellator consumes tessellation factors, determined by the hull shader, as well as more global configuration, like the domain mode, whether the output primitives should be connected, and if they are to be connected, their faceness (CW vs CCW). Based on the tessellation factors and mode, the tessellator invokes the domain shader for some number of points in the "generic" domain, with its position determined via `gl_TessCoord` (which has different meanings for different modes). The domain shader has access to the full patch and generates a single vertex's worth of data, which is then assembled into primitives by the tessellator.
|
|
|
|
|
|
In order to trigger a draw with tessellation, the draw packet's `TESS_MODE` needs to be set to `0xc (TODO)`, and the `PRIM_TYPE` should be `0x1f + PATCH_VERTICES` (so for the default `PATCH_VERTICES = 3`, we would use `0x22`). Additionally the `PC_HS_PARAM` register contains settings for the number of output vertices from HS, as well as tessellator parameters (spacing, domain type). These are derived from both hull and domain shader properties.
|
|
In order to trigger a draw with tessellation, the draw packet's `TESS_MODE` needs to be set to `0xc` for quads, `0xd` for triangles, and `0xe` for isolines. The `PRIM_TYPE` should be `0x1f + PATCH_VERTICES` (so for the default `PATCH_VERTICES = 3`, we would use `0x22`). Additionally the `PC_HS_PARAM` register contains settings for the number of output vertices from HS, as well as tessellator parameters (spacing, connectivity, faceness). These are derived from both hull and domain shader properties.
|
|
|
|
|
|
```
|
|
```
|
|
PC_HS_PARAM: { VERTICES_OUT = 32 | SPACING = EVEN_SPACING | PRIMTYPE = PC_DRAW_TRIANGLES }
|
|
PC_HS_PARAM: { VERTICES_OUT = 32 | SPACING = EVEN_SPACING | CW | CONNECTED }
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Note that for isolines, CW actually represents the CONNECTED setting. (Similarly to NVIDIA hw, curiously enough.)
|
|
|
|
|
|
Tessellation Control Shaders
|
|
Tessellation Control Shaders
|
|
----------------------------
|
|
----------------------------
|
|
|
|
|
... | | ... | |