[Mesa-dev] [PATCH 2/5] anv/cmd_buffer: Delay variable assignment in HZ function
Nanley Chery
nanleychery at gmail.com
Mon Oct 10 22:32:41 UTC 2016
Delay the assignment of some variables until we know they will be used.
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/intel/vulkan/gen8_cmd_buffer.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index 02c2d7c..e88ab02 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -410,7 +410,6 @@ void
genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
enum blorp_hiz_op op)
{
- struct anv_cmd_state *cmd_state = &cmd_buffer->state;
const struct anv_image_view *iview =
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
@@ -421,21 +420,9 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
if (cmd_buffer->state.pass->subpass_count > 1)
return;
+ struct anv_cmd_state *cmd_state = &cmd_buffer->state;
const uint32_t ds = cmd_state->subpass->depth_stencil_attachment;
-
- /* Section 7.4. of the Vulkan 1.0.27 spec states:
- *
- * "The render area must be contained within the framebuffer dimensions."
- *
- * Therefore, the only way the extent of the render area can match that of
- * the image view is if the render area offset equals (0, 0).
- */
- const bool full_surface_op =
- cmd_state->render_area.extent.width == iview->extent.width &&
- cmd_state->render_area.extent.height == iview->extent.height;
- if (full_surface_op)
- assert(cmd_state->render_area.offset.x == 0 &&
- cmd_state->render_area.offset.y == 0);
+ bool full_surface_op;
/* This variable corresponds to the Pixel Dim column in the table below */
struct isl_extent2d px_dim;
@@ -447,6 +434,21 @@ genX(cmd_buffer_emit_hz_op)(struct anv_cmd_buffer *cmd_buffer,
VK_ATTACHMENT_LOAD_OP_CLEAR)
return;
+ /* Section 7.4. of the Vulkan 1.0.27 spec states:
+ *
+ * "The render area must be contained within the framebuffer dimensions."
+ *
+ * Therefore, the only way the extent of the render area can match that of
+ * the image view is if the render area offset equals (0, 0).
+ */
+ full_surface_op =
+ cmd_state->render_area.extent.width == iview->extent.width &&
+ cmd_state->render_area.extent.height == iview->extent.height;
+ if (full_surface_op)
+ assert(cmd_state->render_area.offset.x == 0 &&
+ cmd_state->render_area.offset.y == 0);
+
+
/* Apply alignment restrictions. Despite the BDW PRM mentioning this is
* only needed for a depth buffer surface type of D16_UNORM, testing
* showed it to be necessary for other depth formats as well
--
2.10.0
More information about the mesa-dev
mailing list