From d8df87056c528617defe9412478c24674471c33b Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 1 Jun 2022 13:32:20 -0500 Subject: [PATCH] nir: xfb_buffer_info::stride is in bytes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the NIR XFB gathering as well as all the Vulkan drivers, buffer strides in nir_xfb_info are in bytes. When Marek started using nir_xfb_info for GLSL on radeonsi, he copied directly from the GLSL struct which has strides in dwords. This inconsistency didn't show up until I went through and started us using the NIR passes for GL drivers directly without going through the GLSL structs. We could change the nir_xfb_buffer_info field to be in dwords to be consistent with shader_info but that would mean changing all the Vulkan drivers but, for now, it's easier to always use bytes in nir_xfb_info. Fixes: 2a22885a457e ("st,nir: Use nir_shader::xfb_info in nir_lower_io_passes") Reviewed-by: Alyssa Rosenzweig Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/gl_nir_link_xfb.c | 2 +- src/compiler/nir/nir_lower_io.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/gl_nir_link_xfb.c b/src/compiler/glsl/gl_nir_link_xfb.c index a611d24b5e5..3492ccdc5a9 100644 --- a/src/compiler/glsl/gl_nir_link_xfb.c +++ b/src/compiler/glsl/gl_nir_link_xfb.c @@ -208,7 +208,7 @@ gl_to_nir_xfb_info(struct gl_transform_feedback_info *info, void *mem_ctx) xfb->output_count = info->NumOutputs; for (unsigned i = 0; i < MAX_FEEDBACK_BUFFERS; i++) { - xfb->buffers[i].stride = info->Buffers[i].Stride; + xfb->buffers[i].stride = info->Buffers[i].Stride * 4; xfb->buffers[i].varying_count = info->Buffers[i].NumVaryings; xfb->buffer_to_stream[i] = info->Buffers[i].Stream; } diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 1e9e60d7b49..8554bcd407b 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -2950,7 +2950,7 @@ nir_add_xfb_info(nir_shader *nir) bool progress = false; for (unsigned i = 0; i < NIR_MAX_XFB_BUFFERS; i++) - nir->info.xfb_stride[i] = nir->xfb_info->buffers[i].stride; + nir->info.xfb_stride[i] = nir->xfb_info->buffers[i].stride / 4; nir_foreach_block (block, impl) { nir_foreach_instr_safe (instr, block) {