freedreno/a6xx, tu: GRAS_CL_CNTL::UNK5 is Z_CLAMP_ENABLE
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 28 Sep 2022 10:47:38 +0000 (12:47 +0200)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Sep 2022 10:47:52 +0000 (10:47 +0000)
This changes the behavior for freedreno but it should ultimately be the
same for GL/GLES, given what mesa/st does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18861>

src/freedreno/registers/adreno/a6xx.xml
src/freedreno/vulkan/tu_pipeline.c
src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c

index b6abf5f..9d09406 100644 (file)
@@ -1525,8 +1525,7 @@ to upconvert to 32b float internally?
                <bitfield name="CLIP_DISABLE" pos="0" type="boolean"/>
                <bitfield name="ZNEAR_CLIP_DISABLE" pos="1" type="boolean"/>
                <bitfield name="ZFAR_CLIP_DISABLE" pos="2" type="boolean"/>
-               <!-- set with depthClampEnable, not clear what it does -->
-               <bitfield name="UNK5" pos="5" type="boolean"/>
+               <bitfield name="Z_CLAMP_ENABLE" pos="5" type="boolean"/>
                <!-- controls near z clip behavior (set for vulkan) -->
                <bitfield name="ZERO_GB_SCALE_Z" pos="6" type="boolean"/>
                <!-- guess based on a3xx and meaning of bits 8 and 9
index e63c125..cdc6d8f 100644 (file)
@@ -4036,8 +4036,7 @@ tu_pipeline_builder_parse_rasterization(struct tu_pipeline_builder *builder,
                    A6XX_GRAS_CL_CNTL(
                      .znear_clip_disable = builder->depth_clip_disable,
                      .zfar_clip_disable = builder->depth_clip_disable,
-                     /* TODO should this be depth_clip_disable instead? */
-                     .unk5 = rast_info->depthClampEnable,
+                     .z_clamp_enable = rast_info->depthClampEnable,
                      .zero_gb_scale_z = pipeline->viewport.z_negative_one_to_one ? 0 : 1,
                      .vp_clip_code_ignore = 1));
 
index 80c6e9e..d9ea15c 100644 (file)
@@ -54,8 +54,7 @@ __fd6_setup_rasterizer_stateobj(struct fd_context *ctx,
 
    OUT_REG(ring, A6XX_GRAS_CL_CNTL(.znear_clip_disable = !cso->depth_clip_near,
                                    .zfar_clip_disable = !cso->depth_clip_far,
-                                   .unk5 = !cso->depth_clip_near ||
-                                           !cso->depth_clip_far,
+                                   .z_clamp_enable = cso->depth_clamp,
                                    .vp_clip_code_ignore = 1,
                                    .zero_gb_scale_z = cso->clip_halfz));