i965: check if upload is 0 explicitely, when downsizing a format
authorAndres Gomez <agomez@igalia.com>
Thu, 1 Feb 2018 15:15:14 +0000 (17:15 +0200)
committerAndres Gomez <agomez@igalia.com>
Fri, 2 Feb 2018 14:32:30 +0000 (16:32 +0200)
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@igalia.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
src/mesa/drivers/dri/i965/genX_state_upload.c

index a39a254dacd5593909577e060de49d7bf65f93e4..45636fe69df3e111fd65806e56e3f870f81f7516 100644 (file)
@@ -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):