From: bugzilla-daemon@freedesktop.org
To: dri-devel@lists.freedesktop.org
Subject: [Bug 104492] Compute Shader: Wrong alignment when assigning struct value to structured SSBO
Date: Thu, 04 Jan 2018 14:45:22 +0000 [thread overview]
Message-ID: <bug-104492-502@http.bugs.freedesktop.org/> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2720 bytes --]
https://bugs.freedesktop.org/show_bug.cgi?id=104492
Bug ID: 104492
Summary: Compute Shader: Wrong alignment when assigning struct
value to structured SSBO
Product: Mesa
Version: 17.2
Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
Severity: normal
Priority: medium
Component: Drivers/Gallium/radeonsi
Assignee: dri-devel@lists.freedesktop.org
Reporter: florian.will@googlemail.com
QA Contact: dri-devel@lists.freedesktop.org
Created attachment 136547
--> https://bugs.freedesktop.org/attachment.cgi?id=136547&action=edit
Code to reproduce this issue. Requires SDL2.
Hi,
I'm trying to get the Banshee 3D engine
<https://github.com/BearishSun/BansheeEngine> working on my hardware (HD 7870)
using Mesa radeonsi (amdgpu kernel module). I use 17.2.4-0ubuntu1~17.10.1 from
the Ubuntu artful-proposed archive.
It uses a compute shader that reads a texture cube and writes 6 sets of
coefficients into a shader storage buffer object. Details are not important as
I have isolated the (probably) incorrect driver behaviour and created a much
simpler program that triggers the same issue.
In short: Let's say we have a GLSL struct and access the SSBO through a
dynamically-sized array of that struct type using the std430 layout, like this:
struct ResultRecord
{
float a[10];
float b[10];
float c[10];
float weight;
};
layout(std430) buffer gOutput
{
ResultRecord ssb[];
};
Then a simple assignment of a local variable of the same struct type to ssb[i]
writes the floats into incorrect buffer offsets, because b, c and "weight" are
placed as if the array elements in a, b and c were vec4-aligned instead of
float-aligned, tripling the size of a, b and c.
Code that triggers it is like this, which should hopefully be valid GLSL (and
makes more sense the way it is used in Banshee 3D):
ResultRecord result;
// ... populate result ...
ssb[gl_LocalInvocationIndex] = result;
The test program is available here and contains a (maybe too) detailed
explanation and three program variations that fix the issue:
https://gist.github.com/w-flo/b1a5791749eea5f36cb54628037ba2bf
But I'll also attach it to this bug report.
Looking at the RADEON_DUMP_SHADERS=1 output, I think that the bug is already
visible in the TGSI dump, as explained in the comment at the top of my
reproducer program. I'll attach the output (it's possibly based on an older
version of the reproducer).
--
You are receiving this mail because:
You are the assignee for the bug.
[-- Attachment #1.2: Type: text/html, Size: 4433 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2018-01-04 14:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 14:45 bugzilla-daemon [this message]
2018-01-04 14:46 ` [Bug 104492] Compute Shader: Wrong alignment when assigning struct value to structured SSBO bugzilla-daemon
2018-01-04 16:49 ` bugzilla-daemon
2018-01-04 18:48 ` bugzilla-daemon
2018-01-04 18:49 ` bugzilla-daemon
2018-01-04 21:44 ` bugzilla-daemon
2018-01-05 13:07 ` bugzilla-daemon
2018-01-08 2:45 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-104492-502@http.bugs.freedesktop.org/ \
--to=bugzilla-daemon@freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.