[Mesa-dev] [PATCH] radv: disable depth writes when depth test is not enabled

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Oct 27 16:58:16 UTC 2017



On 10/27/2017 06:49 PM, Marek Olšák wrote:
> The hw disables depth writes automatically.

Okay, good to know. Thanks!

> 
> Marek
> 
> On Fri, Oct 27, 2017 at 6:27 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> Found by inspection.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/amd/vulkan/radv_pipeline.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
>> index c25642c966..f5ebcda883 100644
>> --- a/src/amd/vulkan/radv_pipeline.c
>> +++ b/src/amd/vulkan/radv_pipeline.c
>> @@ -741,8 +741,14 @@ radv_pipeline_init_depth_stencil_state(struct radv_pipeline *pipeline,
>>          bool has_stencil_attachment = vk_format_is_stencil(attachment->format);
>>
>>          if (has_depth_attachment) {
>> +               /* Depth writes are always disabled when depthTestEnable is
>> +                * VK_FALSE.
>> +                */
>> +               bool z_write_enable =
>> +                       vkds->depthTestEnable && vkds->depthWriteEnable;
>> +
>>                  ds->db_depth_control = S_028800_Z_ENABLE(vkds->depthTestEnable ? 1 : 0) |
>> -                                      S_028800_Z_WRITE_ENABLE(vkds->depthWriteEnable ? 1 : 0) |
>> +                                      S_028800_Z_WRITE_ENABLE(z_write_enable ? 1 : 0) |
>>                                         S_028800_ZFUNC(vkds->depthCompareOp) |
>>                                         S_028800_DEPTH_BOUNDS_ENABLE(vkds->depthBoundsTestEnable ? 1 : 0);
>>          }
>> --
>> 2.14.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list