Mesa (main): nir: xfb_buffer_info::stride is in bytes
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 2 14:44:50 UTC 2022
Module: Mesa
Branch: main
Commit: d8df87056c528617defe9412478c24674471c33b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8df87056c528617defe9412478c24674471c33b
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Wed Jun 1 13:32:20 2022 -0500
nir: xfb_buffer_info::stride is in bytes
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 <alyssa.rosenzweig at collabora.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16819>
---
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) {
More information about the mesa-commit
mailing list