i965/clear: clear_value better precision

Test-case with depth-clear 0.5 and format
MESA_FORMAT_Z24_UNORM_X8_UINT fails due inconsistent
clear-value of 0.4999997.
Maybe its better to improve?

CC: Jason Ekstrand <jason.ekstrand@intel.com>
Fixes: 0ae9ce0f29 (i965/clear: Quantize the depth clear value based on the format)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111113
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
Sergii Romantsov 2019-07-12 16:46:45 +03:00 committed by Jason Ekstrand
parent e8110e51c6
commit a86eccfb78
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ brw_fast_clear_depth(struct gl_context *ctx)
*/
float clear_value =
mt->format == MESA_FORMAT_Z_FLOAT32 ? ctx->Depth.Clear :
(unsigned)(ctx->Depth.Clear * fb->_DepthMax) / (float)fb->_DepthMax;
_mesa_lroundeven(ctx->Depth.Clear * fb->_DepthMax) / (float)(fb->_DepthMax);
const uint32_t num_layers = depth_att->Layered ? depth_irb->layer_count : 1;