asahi: Update viewport descriptor depth fields

Acts like a translate/scale pair more generally, not specific to near/far
planes.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11084>
This commit is contained in:
Alyssa Rosenzweig 2021-05-31 01:55:19 +05:30 committed by Marge Bot
parent f43bb36cac
commit 6fbc1cb52a
2 changed files with 11 additions and 4 deletions

View File

@ -153,8 +153,15 @@
<field name="Scale X" size="32" start="5:0" type="float"/>
<field name="Translate Y" size="32" start="6:0" type="float"/>
<field name="Scale Y" size="32" start="7:0" type="float"/>
<field name="Near Z" size="32" start="8:0" type="float"/>
<field name="Z Range" size="32" start="9:0" type="float"/>
<!-- Specifies an affine transformation from clip coordinates to viewport
depth coordinates. For APIs with clip coordinates [0, 1], this cooresponds
to near z and (far z - near z) respectively. In general, given clip
coordinate z_in, the viewport depth is given as (z_in * scale_z) +
translate_z. For example, the default [0, 1] depth buffer in OpenGL with
[-1, +1] clip coordinates is specified as scale = 1/2, bias = 1/2 -->
<field name="Translate Z" size="32" start="8:0" type="float"/>
<field name="Scale Z" size="32" start="9:0" type="float"/>
</struct>
<!--- Pointed to from the command buffer -->

View File

@ -477,8 +477,8 @@ agx_upload_viewport(struct agx_pool *pool,
cfg.translate_y = vp->translate[1];
cfg.scale_x = vp->scale[0];
cfg.scale_y = vp->scale[1];
cfg.near_z = near_z;
cfg.z_range = far_z - near_z;
cfg.translate_z = near_z;
cfg.scale_z = far_z - near_z;
};
return T.gpu;