[Mesa-dev] [PATCH 3/3] anv/cmd_buffer: Simplify range member assignment

Nanley Chery nanleychery at gmail.com
Wed Jul 13 22:34:09 UTC 2016


A ternary is clearer because the range member is assigned one of two values
dependant on one condition.

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/intel/vulkan/anv_cmd_buffer.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 9ceb194..6256df8 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -646,11 +646,9 @@ void anv_CmdBindDescriptorSets(
 
                unsigned array_size = set_layout->binding[b].array_size;
                for (unsigned j = 0; j < array_size; j++) {
-                  uint32_t range = 0;
-                  if (desc->buffer_view)
-                     range = desc->buffer_view->range;
                   push->dynamic[d].offset = *(offsets++);
-                  push->dynamic[d].range = range;
+                  push->dynamic[d].range = (desc->buffer_view) ?
+                                            desc->buffer_view->range : 0;
                   desc++;
                   d++;
                }
-- 
2.9.0



More information about the mesa-dev mailing list