From 34b3b92bbee1f68a9c121cd26e30e113c8cd39a8 Mon Sep 17 00:00:00 2001 From: Alejandro PiƱeiro Date: Thu, 14 Mar 2019 11:02:52 +0100 Subject: nir/xfb: move varyings info out of nir_xfb_info When varyings was added we moved to use to dynamycally allocated pointers, instead of allocating just one block for everything. That breaks some assumptions of some vulkan drivers (like anv), that make serialization and copying easier. And at the same time, varyings are not needed for vulkan. So this commit moves them out. Although it seems a little an overkill, fixing the anv side would require a similar, or more, changes, so in the end it is about to decide where do we want to put our effort. v2: (from Jason review) * Don't use a temp variable on the _create methods, just return result of rzalloc_size * Wrap some lines too long. Fixes: cf0b2ad486c9 ("nir/xfb: adding varyings on nir_xfb_info and gather_info") Reviewed-by: Jason Ekstrand --- src/compiler/nir/nir_xfb_info.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/compiler/nir/nir_xfb_info.h') diff --git a/src/compiler/nir/nir_xfb_info.h b/src/compiler/nir/nir_xfb_info.h index f0b222b325d..8bdfa808062 100644 --- a/src/compiler/nir/nir_xfb_info.h +++ b/src/compiler/nir/nir_xfb_info.h @@ -55,16 +55,15 @@ typedef struct nir_xfb_info { nir_xfb_buffer_info buffers[NIR_MAX_XFB_BUFFERS]; uint8_t buffer_to_stream[NIR_MAX_XFB_STREAMS]; - uint16_t varying_count; - nir_xfb_varying_info *varyings; - uint16_t output_count; - nir_xfb_output_info *outputs; + nir_xfb_output_info outputs[0]; } nir_xfb_info; -/* This method doesn't take into account varyings, as it is used to compute - * how much size is needed to copy only the outputs. - */ +typedef struct nir_xfb_varyings_info { + uint16_t varying_count; + nir_xfb_varying_info varyings[0]; +} nir_xfb_varyings_info; + static inline size_t nir_xfb_info_size(uint16_t output_count) { @@ -74,4 +73,8 @@ nir_xfb_info_size(uint16_t output_count) nir_xfb_info * nir_gather_xfb_info(const nir_shader *shader, void *mem_ctx); +nir_xfb_info * +nir_gather_xfb_info_with_varyings(const nir_shader *shader, + void *mem_ctx, + nir_xfb_varyings_info **varyings_info); #endif /* NIR_XFB_INFO_H */ -- cgit v1.2.3