[Mesa-dev] [PATCH] i965: check if compare is 0 explicitely, when downsizing a format

Andres Gomez agomez at igalia.com
Thu Feb 1 15:03:48 UTC 2018


downsize_format_if_needed takes an integer as number of uploads
parameter. Hence, let's do an integer comparation instead of a boolean
check, since that is confusing.

Since we are at it, fix a couple of wrongly tabbed indents.

Cc: Alejandro PiƱeiro <apinheiro at igalia.com>
Cc: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Andres Gomez <agomez at igalia.com>
---
 src/mesa/drivers/dri/i965/genX_state_upload.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index a39a254dacd..45636fe69df 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -365,7 +365,7 @@ is_passthru_format(uint32_t format)
 
 UNUSED static int
 uploads_needed(uint32_t format,
-	       bool is_dual_slot)
+               bool is_dual_slot)
 {
    if (!is_passthru_format(format))
       return 1;
@@ -409,14 +409,14 @@ downsize_format_if_needed(uint32_t format,
     */
    switch (format) {
    case ISL_FORMAT_R64_PASSTHRU:
-      return !upload ? ISL_FORMAT_R32G32_FLOAT
-                     : ISL_FORMAT_R32_FLOAT;
+      return upload == 0 ? ISL_FORMAT_R32G32_FLOAT
+                         : ISL_FORMAT_R32_FLOAT;
    case ISL_FORMAT_R64G64_PASSTHRU:
-      return !upload ? ISL_FORMAT_R32G32B32A32_FLOAT
-                     : ISL_FORMAT_R32_FLOAT;
+      return upload == 0 ? ISL_FORMAT_R32G32B32A32_FLOAT
+                         : ISL_FORMAT_R32_FLOAT;
    case ISL_FORMAT_R64G64B64_PASSTHRU:
-      return !upload ? ISL_FORMAT_R32G32B32A32_FLOAT
-                     : ISL_FORMAT_R32G32_FLOAT;
+      return upload == 0 ? ISL_FORMAT_R32G32B32A32_FLOAT
+                         : ISL_FORMAT_R32G32_FLOAT;
    case ISL_FORMAT_R64G64B64A64_PASSTHRU:
       return ISL_FORMAT_R32G32B32A32_FLOAT;
    default:
@@ -635,7 +635,7 @@ genX(emit_vertices)(struct brw_context *brw)
       uint32_t comp2 = VFCOMP_STORE_SRC;
       uint32_t comp3 = VFCOMP_STORE_SRC;
       const unsigned num_uploads = GEN_GEN < 8 ?
-	 uploads_needed(format, input->is_dual_slot) : 1;
+         uploads_needed(format, input->is_dual_slot) : 1;
 
 #if GEN_GEN >= 8
       /* From the BDW PRM, Volume 2d, page 588 (VERTEX_ELEMENT_STATE):
-- 
2.15.1



More information about the mesa-dev mailing list