diff options
author | Rafael Antognolli <[email protected]> | 2018-02-27 17:06:13 -0800 |
---|---|---|
committer | Rafael Antognolli <[email protected]> | 2018-04-05 07:42:45 -0700 |
commit | 3f96b459f425d05dfb1c809b2b9c2f66f8763743 (patch) | |
tree | 4a0b84ddb946a3876aa423ee280bbfd175a70271 /src/intel/vulkan/anv_private.h | |
parent | 7987d041fda0c98b243e540a46ac3a57a23cad26 (diff) |
anv: Add a helper to extract clear color from the attachment.
Extract the code from color_attachment_compute_aux_usage, so we can
later reuse it to update the clear color state buffer.
Signed-off-by: Rafael Antognolli <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_private.h')
-rw-r--r-- | src/intel/vulkan/anv_private.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index d7a04438165..b2d8079f3c9 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2902,6 +2902,26 @@ void anv_fill_buffer_surface_state(struct anv_device *device, uint32_t offset, uint32_t range, uint32_t stride); +static inline void +anv_clear_color_from_att_state(union isl_color_value *clear_color, + const struct anv_attachment_state *att_state, + const struct anv_image_view *iview) +{ + const struct isl_format_layout *view_fmtl = + isl_format_get_layout(iview->planes[0].isl.format); + +#define COPY_CLEAR_COLOR_CHANNEL(c, i) \ + if (view_fmtl->channels.c.bits) \ + clear_color->u32[i] = att_state->clear_value.color.uint32[i] + + COPY_CLEAR_COLOR_CHANNEL(r, 0); + COPY_CLEAR_COLOR_CHANNEL(g, 1); + COPY_CLEAR_COLOR_CHANNEL(b, 2); + COPY_CLEAR_COLOR_CHANNEL(a, 3); + +#undef COPY_CLEAR_COLOR_CHANNEL +} + struct anv_ycbcr_conversion { const struct anv_format * format; |