Bug 99214 - Crash in library libswrAVX.so when assigning vertex buffer object pointers with elements of type GL_DOUBLE
Summary: Crash in library libswrAVX.so when assigning vertex buffer object pointers wi...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/swr (show other bugs)
Version: 13.0
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-28 20:53 UTC by chris
Modified: 2017-01-05 20:21 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chris 2016-12-28 20:53:04 UTC
/**pseudo snippet


glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

assert(VertexBuff size == NormalBuff size);

// Vertices binding
[Vertex Buffer Object] ->bind();
glVertexPointer(3, GL_DOUBLE, 0, NULL);

// Normals binding
[Normals Buffer Object] ->bind();
glNormalPointer(GL_DOUBLE, 0, NULL);

// !! Crash on glDrawArrays in libswrAVX.so
glDrawArrays(GL_QUAD_STRIP, 0, [Elements count]);
glPopClientAttrib();

 **/

- Crashes on GL_DOUBLE type
- Does not crash on GL_FLOAT
- Verified contents of both buffers to be correct geometry in both instances.


Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
Flags:
fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx hyperv
Comment 1 chris 2016-12-28 21:14:01 UTC
I suspect this is due to dynamic detection of AVX2.

This is not an issue on AVX2 enabled CPUs.

The particular machine in question does not have the AVX2 flag, however this should not end in a crash.
Comment 2 Ilia Mirkin 2016-12-28 21:35:08 UTC
(In reply to chris from comment #1)
> I suspect this is due to dynamic detection of AVX2.

Not at all. GL_DOUBLE is just plain not supported on swr. If AVX2 presence/absence causes changes in behaviour, you have some configuration issue on your end (e.g. perhaps you're using llvmpipe with one, and swr with the other).

[Note that GL_DOUBLE is an almost completely pointless feature - the "GPU" will still convert your doubles to 32-bit floats. If you want to feed actual fp64 values to your vertices, you need GL_ARB_vertex_attrib_fp64 or whatever.]
Comment 3 chris 2016-12-28 21:39:36 UTC
Yes, you are correct. Just confirmed my other config is llvm-pipe as you mentioned.


That's unfortunate. Spec indicates GL_DOUBLE as an accepted value. 
https://www.opengl.org/sdk/docs/man2/xhtml/glVertexPointer.xml

Noted, will avoid in the future.

Thanks for the info!
Comment 4 Ilia Mirkin 2016-12-28 21:56:07 UTC
(In reply to chris from comment #3)
> That's unfortunate. Spec indicates GL_DOUBLE as an accepted value. 
> https://www.opengl.org/sdk/docs/man2/xhtml/glVertexPointer.xml

Correct - it was one of the features added in GL 2.0, I believe. But swr is not a fully conformant driver, and this is one of the items that's lacking. Patches welcome!
Comment 5 Roland Scheidegger 2016-12-28 22:19:53 UTC
(In reply to Ilia Mirkin from comment #4)
> (In reply to chris from comment #3)
> > That's unfortunate. Spec indicates GL_DOUBLE as an accepted value. 
> > https://www.opengl.org/sdk/docs/man2/xhtml/glVertexPointer.xml
> 
> Correct - it was one of the features added in GL 2.0, I believe. But swr is
> not a fully conformant driver, and this is one of the items that's lacking.
> Patches welcome!

double type for vertex attributes is a 1.0 feature, actually. Albeit prior to 1.1 you couldn't use glVertexPointer and friends... Not to mention buffer objects...

(Albeit I'd say you really should avoid it usually in any case, it will just get converted to float somewhere. Unless your data naturally comes as doubles, so it has to be converted somewhere no matter what.)
Comment 6 Tim Rowley 2017-01-05 20:21:40 UTC
GL_DOUBLE support added to mesa-master as commit 33fa4c99f7fa68fd8c33c75c4fe66c4cca76779f


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.