[FIXED] OpenGL ES 2 missing nglGetVertexAttribPointerv

Started by xranby, October 12, 2011, 00:17:23

Previous topic - Next topic

xranby

Quote from: spasi on June 08, 2011, 14:39:05
Hey frostybeard, any news?

Has anyone else tried building and testing the ES branch?

Hi I have today managed to build the lwjgl 2.8.0 release on a ARM TrimSlice Ubuntu 11.04 machine powered by a Nvidia Tegra 250.

I had to patch the project a little to get it building by first fix and apply the latest Debian lwjgl 2.7 patches and then add a opengl-es patch that enabled the opengl-es compilation.
I have uploaded my patched and compiled source tree to:
http://openjdk.gudinna.com/lwjgl-es/LWJGL-2.8.0-armel-ubuntu-es.tar.gz (42mb)
sha256sum 9e6558aa3017f288d9eb3fdb72e3197faec39ecac368adc2a79c60e3be3fcf7d
You can also check the
http://openjdk.gudinna.com/lwjgl-es/LWJGL-2.8.0-armel-ubuntu-es-patches/
folder for.. patches!

When I run it I then hit what looks like an unimplemented part of the
"Linux for Tegra release 12 Alpha 1" Nvidia Tegra 250 opengl-es 2.0 driver.
LWJGL-2.8.0-armel-ubuntu-es$ ./test-es2.0.sh
java -cp libs/lwjgles_test.jar:libs/lwjgles.jar:libs/lwjgl_util.jar -Djava.library.path=bin/lwjgles org.lwjgl.test.opengles.Gears
org.lwjgl.LWJGLException: java.lang.NoSuchMethodError: nglGetVertexAttribPointerv
   at org.lwjgl.opengles.GLContext.doInitNativeStubs(GLContext.java:224)
   at org.lwjgl.opengles.ContextCapabilities.initAllStubs(ContextCapabilities.java:109)
   at org.lwjgl.opengles.ContextCapabilities.<init>(ContextCapabilities.java:188)
   at org.lwjgl.opengles.GLContext.useContext(GLContext.java:268)
   at org.lwjgl.opengl.ContextGLES.makeCurrent(ContextGLES.java:146)
   at org.lwjgl.opengl.DrawableGLES.makeCurrent(DrawableGLES.java:190)
   at org.lwjgl.opengl.Display.makeCurrent(Display.java:731)
   at org.lwjgl.opengl.Display.makeCurrentAndSetSwapInterval(Display.java:1076)
   at org.lwjgl.opengl.Display.create(Display.java:1040)
   at org.lwjgl.opengl.Display.create(Display.java:940)
   at org.lwjgl.test.opengles.Gears.init(Gears.java:294)
   at org.lwjgl.test.opengles.Gears.execute(Gears.java:121)
   at org.lwjgl.test.opengles.Gears.main(Gears.java:112)
Caused by: java.lang.NoSuchMethodError: nglGetVertexAttribPointerv
   at org.lwjgl.opengles.GLES20.initNativeStubs(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:616)
   at org.lwjgl.opengles.GLContext$1.run(GLContext.java:217)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.opengles.GLContext.doInitNativeStubs(GLContext.java:214)
   ... 12 more
Failed to initialize Gears.

Cheers
Xerxes

spasi

Try adding an @Optional annotation on templates/org/lwjgl/opengles/GLES20.glGetVertexAttribPointerv, do a generate-all, then build again.

xranby

Quote from: spasi on October 12, 2011, 11:07:24
Try adding an @Optional annotation on templates/org/lwjgl/opengles/GLES20.glGetVertexAttribPointerv, do a generate-all, then build again.

Unfortunally adding the @Optional annotation did not work...
i kept hitting the same error while init GLES20

I ended up  testing:
Index: LWJGL/src/templates/org/lwjgl/opengles/GLES20.java
===================================================================
--- LWJGL.orig/src/templates/org/lwjgl/opengles/GLES20.java   2011-10-12 16:08:03.905876001 +0200
+++ LWJGL/src/templates/org/lwjgl/opengles/GLES20.java   2011-10-12 16:18:40.675876002 +0200
@@ -824,7 +824,7 @@

   @Alternate("glGetUniformLocation")
   int glGetUniformLocation(@GLuint int program, @NullTerminated CharSequence name);
-
+/*
   @StripPostfix("params")
   @Optional(reason = "Nvidia does not expose this (last driver checked: Linux for Tegra release 12 Alpha 1)")
   void glGetVertexAttribfv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params);
@@ -836,7 +836,7 @@
   @StripPostfix("pointer")
   @Optional(reason = "Nvidia does not expose this (last driver checked: Linux for Tegra release 12 Alpha 1)")
   void glGetVertexAttribPointerv(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer pointer);
-
+*/
   void glHint(@GLenum int target, @GLenum int mode);

   @GLboolean
@@ -897,11 +897,12 @@
   @Alternate("glShaderSource")
   void glShaderSource2(@GLuint int shader, @Constant("1") @GLsizei int count, CharSequence string, @Constant("string.length()") @Indirect @Const int length);

+/*
   @Alternate(value = "glShaderSource", nativeAlt = true)
   void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count,
                        @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
                        @Constant("APIUtil.getLengths(strings)") @Const IntBuffer length);
-
+*/
   void glStencilFunc(@GLenum int func, @GLint int ref, @GLuint int mask);

   void glStencilFuncSeparate(@GLenum int face, @GLenum int func, @GLint int ref, @GLuint int mask);


While i did not want to dig down into annotations today i simply commented out the problematic blocks and by doing so the following niceness happened...

http://openjdk.gudinna.com/lwjgl-es/IMG_0669.JPG  here tested on a ac100 running Ubuntu 11.10 oneiric using the same Nvidia tegra driver.

GL RENDERER: NVIDIA Tegra
GL VENDOR: NVIDIA Corporation
GL VERSION: OpenGL ES 2.0
GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL 1.00
GL_EXTENSIONS = GL_NV_platform_binary GL_OES_rgb8_rgba8 GL_OES_EGL_sync GL_OES_fbo_render_mipmap GL_NV_depth_nonlinear GL_NV_draw_path GL_NV_texture_npot_2D_mipmap GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_vertex_half_float GL_NV_framebuffer_vertex_attrib_array GL_NV_coverage_sample GL_OES_mapbuffer GL_ARB_draw_buffers GL_EXT_Cg_shader GL_EXT_packed_float GL_OES_texture_half_float GL_OES_texture_float GL_EXT_texture_array GL_OES_compressed_ETC1_RGB8_texture GL_EXT_texture_compression_latc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_NV_get_tex_image GL_NV_read_buffer GL_NV_shader_framebuffer_fetch GL_NV_fbo_color_attachments GL_EXT_bgra GL_EXT_texture_format_BGRA8888 GL_EXT_unpack_subimage

GL_AMD_compressed_3DC_texture - false
GL_AMD_compressed_ATC_texture - false
GL_AMD_performance_monitor - false
GL_AMD_program_binary_Z400 - false
GL_ANGLE_framebuffer_blit - false
GL_ANGLE_framebuffer_multisample - false
GL_APPLE_framebuffer_multisample - false
GL_APPLE_rgb_422 - false
GL_APPLE_texture_format_BGRA8888 - false
GL_APPLE_texture_max_level - false
GL_ARB_draw_buffers - true
GL_ARB_half_float_pixel - false
GL_ARB_texture_rectangle - false
GL_ARM_mali_shader_binary - false
GL_ARM_rgba8 - false
GL_DMP_shader_binary - false
GL_EXT_Cg_shader - true
GL_EXT_bgra - true
GL_EXT_blend_minmax - false
GL_EXT_discard_framebuffer - false
GL_EXT_frag_depth - false
GL_EXT_multi_draw_arrays - false
GL_EXT_packed_float - true
GL_EXT_read_format_bgra - false
GL_EXT_shader_texture_lod - false
GL_EXT_texture_array - true
GL_EXT_texture_compression_dxt1 - true
GL_EXT_texture_compression_latc - true
GL_EXT_texture_compression_s3tc - true
GL_EXT_texture_filter_anisotropic - true
GL_EXT_texture_format_BGRA8888 - true
GL_EXT_texture_lod_bias - false
GL_EXT_texture_type_2_10_10_10_REV - false
GL_EXT_unpack_subimage - true
GL_IMG_multisamples_render_to_texture - false
GL_IMG_program_binary - false
GL_IMG_shader_binary - false
GL_IMG_texture_compression_pvrtc - false
GL_NV_coverage_sample - true
GL_NV_depth_nonlinear - true
GL_NV_draw_buffers - false
GL_NV_draw_path - true
GL_NV_fbo_color_attachments - true
GL_NV_fence - false
GL_NV_framebuffer_vertex_attrib_array - true
GL_NV_get_tex_image - true
GL_NV_read_buffer - true
GL_NV_read_depth_stencil - false
GL_NV_shader_framebuffer_fetch - true
GL_NV_system_time - false
GL_NV_texture_compression_s3tc_update - false
GL_NV_texture_npot_2D_mipmap - true
GL_OES_EGL_image - true
GL_OES_EGL_image_external - true
GL_OES_EGL_sync - true
GL_OES_blend_equation_separate - false
GL_OES_blend_func_separate - false
GL_OES_blend_subtract - false
GL_OES_compressed_ETC1_RGB8_texture - true
GL_OES_compressed_paletted_texture - false
GL_OES_depth24 - false
GL_OES_depth32 - false
GL_OES_depth_texture - false
GL_OES_element_index_uint - false
GL_OES_fbo_render_mipmap - true
GL_OES_framebuffer_object - false
GL_OES_get_program_binary - false
GL_OES_mapbuffer - false
GL_OES_packed_depth_stencil - false
GL_OES_rgb8_rgba8 - true
GL_OES_standard_derivatives - false
GL_OES_stencil1 - false
GL_OES_stencil4 - false
GL_OES_stencil8 - false
GL_OES_texture_3D - false
GL_OES_texture_float - true
GL_OES_texture_float_linear - false
GL_OES_texture_half_float - true
GL_OES_texture_half_float_linear - false
GL_OES_texture_npot - false
GL_OES_vertex_array_object - false
GL_OES_vertex_half_float - true
GL_OES_vertex_type_10_10_10_2 - false
GL_QCOM_driver_control - false
GL_QCOM_extended_get - false
GL_QCOM_extended_get2 - false
GL_QCOM_performance_monitor_global_mode - false
GL_QCOM_tiled_rendering - false
GL_QCOM_writeonly_rendering - false
GL_VIV_shader_binary - false

-- No LWJGL support for extension: GL_NV_platform_binary
-- Extension exposed but functions are missing: GL_OES_mapbuffer
679 frames in 5.0 seconds = 135.8
656 frames in 4.995 seconds = 131.33133
694 frames in 4.996 seconds = 138.91113
433 frames in 4.995 seconds = 86.68669
670 frames in 4.997 seconds = 134.08044
697 frames in 4.994 seconds = 139.56749
679 frames in 5.0 seconds = 135.8
664 frames in 4.999 seconds = 132.82657
677 frames in 5.0 seconds = 135.4
656 frames in 4.993 seconds = 131.38394
632 frames in 4.993 seconds = 126.57721
656 frames in 4.997 seconds = 131.27876
712 frames in 4.996 seconds = 142.51402
636 frames in 4.999 seconds = 127.22544
674 frames in 5.0 seconds = 134.8
660 frames in 5.0 seconds = 132.0
674 frames in 4.995 seconds = 134.93494
646 frames in 4.994 seconds = 129.35522
712 frames in 4.99 seconds = 142.68538
750 frames in 4.999 seconds = 150.03
xranby@ac100-oneiric:~/lwjgl/LWJGL$

spasi

Nice!

Could you please do an svn update? I've fixed @Optional and it should work on GLES functions now. Looks like OES_mapbuffer needs an @Optional too, I'm guessing on glGetBufferPointervOES (run with org.lwjgl.util.Debug=true to verify).

I've also added support for NV_platform_binary.

xranby

Quote from: spasi on October 12, 2011, 18:08:57
Nice!

Could you please do an svn update? I've fixed @Optional and it should work on GLES functions now. Looks like OES_mapbuffer needs an @Optional too, I'm guessing on glGetBufferPointervOES (run with org.lwjgl.util.Debug=true to verify).

I've also added support for NV_platform_binary.

Thank you, after the update the @Optional annotation *almost* work... the missing part are that the
if (ext_func_pointer == NULL)   in  src/native/common/common_tools.c never turns true since ext_func_pointer are not NULL when nglGetVertexAttribPointerv are missing . Observe in the first log that the throwException(env, "Missing driver symbols"); never gets executed...  :-\ ... i am still working on this bug.

spasi

Ouch...

Ignore what I said about @Optional, I've fixed the real problem. Update and build again please.

xranby

Quote from: spasi on October 13, 2011, 16:58:58
Ouch...

Ignore what I said about @Optional, I've fixed the real problem. Update and build again please.

Work!
Thanks a lot!
I have tested it running the following three demos:
#src/java/org/lwjgl/test/opengles/FullScreenWindowedTest.java
java -cp libs/lwjgles_test.jar:libs/lwjgles.jar:libs/lwjgl_util.jar -Djava.library.path=bin/lwjgles org.lwjgl.test.opengles.FullScreenWindowedTest

#src/java/org/lwjgl/test/opengles/MappedIndexedVBOTest.java
java -cp libs/lwjgles_test.jar:libs/lwjgles.jar:libs/lwjgl_util.jar -Djava.library.path=bin/lwjgles org.lwjgl.test.opengles.MappedIndexedVBOTest

#src/java/org/lwjgl/test/opengles/Gears.java
java -cp libs/lwjgles_test.jar:libs/lwjgles.jar:libs/lwjgl_util.jar -Djava.library.path=bin/lwjgles org.lwjgl.test.opengles.Gears


The attached patch are now all needed to make LWJGL work out of the box using the "Linux for Tegra release 12 Alpha 1" drivers!.

spasi

Are you sure that patch is needed? Have you tried removing @Optional from glGetVertexAttribPointerv and glShaderSource3?

xranby

Quote from: spasi on October 13, 2011, 20:01:46
Are you sure that patch is needed? Have you tried removing @Optional from glGetVertexAttribPointerv and glShaderSource3?

I was not sure, I have now tested without the patch.. and it work as well!
This bug are fixed! cool!