mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-03 13:00:37 +01:00
asahi: Identify the separate varying count fields
Flat/goraud/linear and 32/16 need to be specified separately. This change identifies the new fields but should be a functional no-op. Signed-off-by: Asahi Lina <lina@asahilina.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23998>
This commit is contained in:
parent
d9bf52e00f
commit
49994dc8cb
5 changed files with 61 additions and 39 deletions
|
|
@ -39,41 +39,66 @@ of the shader in the "Bind Vertex Pipeline" packet. The value may be interpreted
|
|||
consist of a single 32-bit value or an aligned 16-bit register pair, depending
|
||||
on whether interpolation should happen at 32-bit or 16-bit. Vertex outputs are
|
||||
indexed starting from 0, with the *vertex position* always coming first, the
|
||||
32-bit user varyings coming next, then 16-bit user varyings, and finally *point
|
||||
size* and *clip distances* at the end if present. Note that *clip distances* are
|
||||
not accessible from the fragment shader; if the fragment shader needs to read
|
||||
the interpolated clip distance, the vertex shader must *also* write the clip
|
||||
distance values to a user varying for the fragment shader to interpolate. Also
|
||||
note there is no clip plane enable mask anywhere; that must lowered for APIs
|
||||
that require this (OpenGL but not Vulkan).
|
||||
32-bit user varyings coming next with perspective, flat, and linear interpolated
|
||||
varyings grouped in that order, then 16-bit user varyings with the same groupings,
|
||||
and finally *point size* and *clip distances* at the end if present. Note that
|
||||
*clip distances* are not accessible from the fragment shader; if the fragment
|
||||
shader needs to read the interpolated clip distance, the vertex shader must
|
||||
*also* write the clip distance values to a user varying for the fragment shader
|
||||
to interpolate. Also note there is no clip plane enable mask anywhere; that must
|
||||
lowered for APIs that require this (OpenGL but not Vulkan).
|
||||
|
||||
.. list-table:: Ordering of vertex outputs with all outputs used
|
||||
:widths: 25 75
|
||||
:header-rows: 1
|
||||
|
||||
* - Index
|
||||
* - Size (words)
|
||||
- Value
|
||||
* - 0
|
||||
- Vertex position
|
||||
* - 4
|
||||
- 32-bit varying 0
|
||||
- Vertex position
|
||||
* - 1
|
||||
- 32-bit smooth varying 0
|
||||
* -
|
||||
- ...
|
||||
* - 4 + m
|
||||
- 32-bit varying m
|
||||
* - 4 + m + 1
|
||||
- Packed pair of 16-bit varyings 0
|
||||
* - 1
|
||||
- 32-bit smooth varying m
|
||||
* - 1
|
||||
- 32-bit flat varying 0
|
||||
* -
|
||||
- ...
|
||||
* - 4 + m + 1 + n
|
||||
- Packed pair of 16-bit varyings n
|
||||
* - 4 + m + 1 + n + 1
|
||||
* - 1
|
||||
- 32-bit flat varying n
|
||||
* - 1
|
||||
- 32-bit linear varying 0
|
||||
* -
|
||||
- ...
|
||||
* - 1
|
||||
- 32-bit linear varying o
|
||||
* - 1
|
||||
- Packed pair of 16-bit smooth varyings 0
|
||||
* -
|
||||
- ...
|
||||
* - 1
|
||||
- Packed pair of 16-bit smooth varyings p
|
||||
* - 1
|
||||
- Packed pair of 16-bit flat varyings 0
|
||||
* -
|
||||
- ...
|
||||
* - 1
|
||||
- Packed pair of 16-bit flat varyings q
|
||||
* - 1
|
||||
- Packed pair of 16-bit linear varyings 0
|
||||
* -
|
||||
- ...
|
||||
* - 1
|
||||
- Packed pair of 16-bit linear varyings r
|
||||
* - 1
|
||||
- Point size
|
||||
* - 4 + m + 1 + n + 2 + 0
|
||||
* - 1
|
||||
- Clip distance for plane 0
|
||||
* -
|
||||
- ...
|
||||
* - 4 + m + 1 + n + 2 + 15
|
||||
* - 1
|
||||
- Clip distance for plane 15
|
||||
|
||||
Remapping
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ agx_ppp_update_size(struct AGX_PPP_HEADER *present)
|
|||
PPP_CASE(viewport, VIEWPORT);
|
||||
PPP_CASE(w_clamp, W_CLAMP);
|
||||
PPP_CASE(output_select, OUTPUT_SELECT);
|
||||
PPP_CASE(varying_word_0, VARYING_0);
|
||||
PPP_CASE(varying_word_1, VARYING_1);
|
||||
PPP_CASE(varying_counts_32, VARYING_COUNTS);
|
||||
PPP_CASE(varying_counts_16, VARYING_COUNTS);
|
||||
PPP_CASE(cull, CULL);
|
||||
PPP_CASE(cull_2, CULL_2);
|
||||
PPP_CASE(fragment_shader, FRAGMENT_SHADER);
|
||||
|
|
|
|||
|
|
@ -361,8 +361,8 @@
|
|||
<field name="Viewport" size="1" start="11" type="bool"/>
|
||||
<field name="W clamp" size="1" start="16" type="bool"/>
|
||||
<field name="Output select" size="1" start="17" type="bool"/>
|
||||
<field name="Varying word 0" size="1" start="18" type="bool"/>
|
||||
<field name="Varying word 1" size="1" start="19" type="bool"/>
|
||||
<field name="Varying counts 32" size="1" start="18" type="bool"/>
|
||||
<field name="Varying counts 16" size="1" start="19" type="bool"/>
|
||||
<field name="Cull" size="1" start="21" type="bool"/>
|
||||
<field name="Cull 2" size="1" start="22" type="bool"/>
|
||||
<field name="Fragment shader" size="1" start="23" type="bool"/>
|
||||
|
|
@ -485,13 +485,10 @@
|
|||
<field name="Rasterizer discard" size="1" start="17" type="bool"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Varying 0" size="4">
|
||||
<!-- TODO: 16-bit is separate AFAIU -->
|
||||
<field name="Count" size="32" start="0" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Varying 1" size="4">
|
||||
<!-- TODO -->
|
||||
<struct name="Varying Counts" size="4">
|
||||
<field name="Smooth" size="8" start="0" type="uint"/>
|
||||
<field name="Flat" size="8" start="8" type="uint"/>
|
||||
<field name="Linear" size="8" start="16" type="uint"/>
|
||||
</struct>
|
||||
|
||||
<struct name="Varying 2" size="8">
|
||||
|
|
|
|||
|
|
@ -438,8 +438,8 @@ agxdecode_record(uint64_t va, size_t size, bool verbose)
|
|||
PPP_PRINT(map, viewport, VIEWPORT, "Viewport");
|
||||
PPP_PRINT(map, w_clamp, W_CLAMP, "W clamp");
|
||||
PPP_PRINT(map, output_select, OUTPUT_SELECT, "Output select");
|
||||
PPP_PRINT(map, varying_word_0, VARYING_0, "Varying word 0");
|
||||
PPP_PRINT(map, varying_word_1, VARYING_1, "Varying word 1");
|
||||
PPP_PRINT(map, varying_counts_32, VARYING_COUNTS, "Varying counts 32");
|
||||
PPP_PRINT(map, varying_counts_16, VARYING_COUNTS, "Varying counts 16");
|
||||
PPP_PRINT(map, cull, CULL, "Cull");
|
||||
PPP_PRINT(map, cull_2, CULL_2, "Cull 2");
|
||||
|
||||
|
|
|
|||
|
|
@ -2199,7 +2199,7 @@ agx_batch_init_state(struct agx_batch *batch)
|
|||
struct agx_ppp_update ppp =
|
||||
agx_new_ppp_update(&batch->pool, (struct AGX_PPP_HEADER){
|
||||
.w_clamp = true,
|
||||
.varying_word_1 = true,
|
||||
.varying_counts_16 = true,
|
||||
.cull_2 = true,
|
||||
.occlusion_query_2 = true,
|
||||
.output_unknown = true,
|
||||
|
|
@ -2208,7 +2208,7 @@ agx_batch_init_state(struct agx_batch *batch)
|
|||
|
||||
/* clang-format off */
|
||||
agx_ppp_push(&ppp, W_CLAMP, cfg) cfg.w_clamp = 1e-10;
|
||||
agx_ppp_push(&ppp, VARYING_1, cfg);
|
||||
agx_ppp_push(&ppp, VARYING_COUNTS, cfg);
|
||||
agx_ppp_push(&ppp, CULL_2, cfg);
|
||||
agx_ppp_push(&ppp, FRAGMENT_OCCLUSION_QUERY_2, cfg);
|
||||
agx_ppp_push(&ppp, OUTPUT_UNKNOWN, cfg);
|
||||
|
|
@ -2402,7 +2402,7 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines,
|
|||
.fragment_back_face_2 = object_type_dirty || IS_DIRTY(FS_PROG),
|
||||
.fragment_back_stencil = IS_DIRTY(ZS),
|
||||
.output_select = IS_DIRTY(VS_PROG) || IS_DIRTY(FS_PROG),
|
||||
.varying_word_0 = IS_DIRTY(VS_PROG),
|
||||
.varying_counts_32 = IS_DIRTY(VS_PROG),
|
||||
.cull = IS_DIRTY(RS),
|
||||
.fragment_shader =
|
||||
IS_DIRTY(FS) || varyings_dirty || IS_DIRTY(SAMPLE_MASK),
|
||||
|
|
@ -2493,9 +2493,9 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines,
|
|||
}
|
||||
}
|
||||
|
||||
if (dirty.varying_word_0) {
|
||||
agx_ppp_push(&ppp, VARYING_0, cfg) {
|
||||
cfg.count = agx_num_general_outputs(&ctx->vs->info.varyings.vs);
|
||||
if (dirty.varying_counts_32) {
|
||||
agx_ppp_push(&ppp, VARYING_COUNTS, cfg) {
|
||||
cfg.smooth = agx_num_general_outputs(&ctx->vs->info.varyings.vs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue