Skip to contentSkip to conversation

New: UBO matrix in std140 struct does not work

Bug 82586 [email protected] 1 participant 12 messages Aug 13, 2014 – Aug 17, 2014

lore
Share & tools
lore
#0 lore raw

https://bugs.freedesktop.org/show_bug.cgi?id=82586

Priority: medium
Bug ID: 82586
Assignee: [email protected]
Summary: UBO matrix in std140 struct does not work
Severity: normal
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: Other
Status: NEW
Version: git
Component: Drivers/Gallium/r600
Product: Mesa

I am not sure if the problem is actually in my code, but I tested it on nVidia driver and it worked (but their compiler might have a fix for it internally).

Here is vertex shader:

#version 330

layout(location = 0) in vec4 position;

layout(std140) uniform Matrices {
    mat4 model;
    mat4 view;
    mat4 projection;
} matrices;
out gl_PerVertex {
    vec4 gl_Position;
};

/* interpolate to compute normal in fragment shader */ out vec3 v_position;

void main(void)
{
v_position = vec3(matrices.view * matrices.model * position); gl_Position = matrices.projection * matrices.view * matrices.model *
position;
}

If I use only one matrix from the uniform it works. I have printed UBOs values and they are just identity matrices.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

https://bugs.freedesktop.org/show_bug.cgi?id=82586

Ian Romanick <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO

--- Comment #1 from Ian Romanick <[email protected]> ---
What is the failure mode? A bunch of changes recently occurred in the GLSL compiler (especially in the linker) for UBO matrices. What version of Mesa are you on? Can you try a build of master?

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #2 from [email protected] ---
"What is the failure mode?"
Don't follow

"What version of Mesa are you on?"
https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers
Seem couple days old.

"Can you try a build of master?"
Can't I just wait for new build in PPA?

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #3 from Ian Romanick <[email protected]> --- (In reply to comment #2)

Quoted 2 lines

"What is the failure mode?"
Don't follow

You say it doesn't work. That's pretty vague. If it fails in some way, what is the mode of the failure? (See also
http://en.wikipedia.org/wiki/Failure_causes#Component_failure)

Are the member locations incorrect (query through the API)? Is the row-major / column-major orientation of the matrices incorrect (query through the API)? Is the generated code reading the wrong locations? Does it crash in the driver? Does your computer catch on fire?

Without any information about how it actually fails, it's pretty much impossible to fix.

Quoted 3 lines

"What version of Mesa are you on?"
https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers
Seem couple days old.

When I check it now, it should have everything. The other question: does this work on older Mesa? Say... a 10.2 stable release?

Quoted 2 lines

"Can you try a build of master?"
Can't I just wait for new build in PPA?

You can... at some point there will probably be a patch for you to test, and that won't be in PPA. You can probably wait to worry about it until such a patch exists.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #4 from [email protected] ---
(In reply to comment #3)

Quoted 3 lines

You say it doesn't work. That's pretty vague. If it fails in some way, what is the mode of the failure? (See also
http://en.wikipedia.org/wiki/Failure_causes#Component_failure)

It just does not display anything, hence either whole pipeline crashes (and OpenGL KHR_debug does not print it out) or the transform moves vertices outside clipping region (I might try transform feedback over weekend).

Quoted 4 lines

Are the member locations incorrect (query through the API)? Is the row-major / column-major orientation of the matrices incorrect (query through the API)? Is the generated code reading the wrong locations? Does it crash in the driver? Does your computer catch on fire?

Locations are correct (at least if gl query returns them properly). I do not know, I do not read anything (or I do not follow). How do I know if it crashes in driver? No, though DPM is really bad.

Quoted 2 lines

Without any information about how it actually fails, it's pretty much impossible to fix.

If I apply one of the matrices, it works, if I multiply two of them, it does not.

Quoted 2 lines

When I check it now, it should have everything. The other question: does this work on older Mesa? Say... a 10.2 stable release?

Yes, it works on 10.2.5

Quoted 3 lines

You can... at some point there will probably be a patch for you to test, and that won't be in PPA. You can probably wait to worry about it until such a patch exists.

Ok, hope the process is seamless.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #5 from [email protected] ---
I have got new mesa from PPA and problem seems to be gone. How can I find exact commit fixing this, please?

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #6 from Roland Scheidegger <[email protected]> --- (In reply to comment #5)

Quoted 2 lines

I have got new mesa from PPA and problem seems to be gone. How can I find exact commit fixing this, please?

Just use git bisect. That of course requires you to build mesa yourself.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #7 from Ilia Mirkin <[email protected]> --- Probably one of

http://cgit.freedesktop.org/mesa/mesa/commit/?id=d52202141ebe28cd9f8d305827552fafccb279fd
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da9c3ed304be5d08ff989d61c6e2d1be8a845767

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #8 from [email protected] ---
I have tried to compile mesa, but all I get is GL 2.1

OpenGL version string: 2.1 Mesa 10.3.0-devel (git-9d9879a)

I just build master without any non-default flags. Can you help, please? (I would like to bisect, and I reported other bug which I want to test)

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #9 from Ilia Mirkin <[email protected]> --- --enable-texture-float

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

[email protected] changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from [email protected] ---
Thanks, I am not sure if I done it correctly, but bisect gave me this as first bad commit (if I understand it means the bug was introduced in it)

http://cgit.freedesktop.org/mesa/mesa/commit/?id=01bf8bb87565ed3677e43c6b6deeb90378d88647

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

[Bug 82586] UBO matrix in std140 struct does not work

In reply to [email protected]

https://bugs.freedesktop.org/show_bug.cgi?id=82586

--- Comment #11 from [email protected] ---
Fixed here, thanks.

http://cgit.freedesktop.org/mesa/mesa/commit/?id=da9c3ed304be5d08ff989d61c6e2d1be8a845767

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel