{"id":312,"date":"2011-10-04T19:34:20","date_gmt":"2011-10-04T23:34:20","guid":{"rendered":"http:\/\/jausoft.com\/blog\/?p=312"},"modified":"2019-05-14T04:48:50","modified_gmt":"2019-05-14T08:48:50","slug":"bug-hunting-on-android","status":"publish","type":"post","link":"https:\/\/jausoft.com\/blog\/2011\/10\/04\/bug-hunting-on-android\/","title":{"rendered":"Bug Hunting on Android &#8230;"},"content":{"rendered":"<p>While fixing <a href=\"http:\/\/jogamp.org\/\">JOGL<\/a> for Android,<br \/>\n<a href=\"http:\/\/ramisantina.com\/blog\/\">Rami<\/a> and I are testing the code against the consumer devices:<\/p>\n<ol>\n<li>Asus Transformer, Android 3.2, NV Tegra2<\/li>\n<li>Samsung Galaxy Tab 10.1, Android 3.1, NV Tegra2<\/li>\n<li>Samsung Galaxy S2, Android 2.3, ARM Mali 400 MP<\/li>\n<li>Samsung Galaxy S1, Android 2.3, Omap 34xx<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<p>We have expected glitches in the OpenGL drivers and\/or Android environment<br \/>\nand even found bugs which does not exist on a similar device, ie device 1 and 2.<\/p>\n<p>Device 3 works absolutely flawless, <strong>kudos<\/strong> to the ARM developer<br \/>\nof the MALI silicon and it&#8217;s drivers! No workaround is necessary and our demos worked<br \/>\nstraight out of the box, even w\/ multisampling enabled.<\/p>\n<p>Device 4 shows flickering on <strong>all<\/strong> demos, where the FPS value<br \/>\nis always just around 18-23, hence below V-Sync.<br \/>\nWe actually have no clue why, since device 3 works perfect. Since both devices are mostly equal<br \/>\nbut it&#8217;s GPU .. we must assume it&#8217;s about the Omap3 driver.<\/p>\n<p>The Tegra2 devices gave us quite a headache \ud83d\ude41<\/p>\n<p>Device 1 and 2 (hence Tegra2) exposes the following bugs:<\/p>\n<ul>\n<li> <strong>discard<\/strong> in fragment shader freezes the GLSL compiler<\/li>\n<li> mixing sampler2D w\/ a non texture code path let&#8217;s GLSL compiler result in error<br \/>\n        <code>P1202 Texture's gl states do not match with shader's<\/code><\/li>\n<\/ul>\n<p>Device 2 also exposes an <em>interesting<\/em> bug not <em>available<\/em> on the other Tegra2 device,<br \/>\nwhich rendered all our demos invisible, ie. resulting in a<strong> blank screen<\/strong>, where only the clear color was shown.<br \/>\nHunting down this one took also quite a while, but after stumbling over <a href=\"http:\/\/developer.nvidia.com\/nvidia-perfhud-es\">NV&#8217;s PerfHud ES<\/a> and some hints about <a href=\"http:\/\/developer.nvidia.com\/beta-forum#\/discussion\/541\/instrumented-opengl-es-drivers-for-end-user-device-to-use-perfhud-es\">how to enable it on consumer devices<\/a> the culprit was found.<br \/>\nThe <em>GLState Viewer<\/em> exposed that our <code>uniform mat4 mgl_PMVMatrix[2];<\/code> wasn&#8217;t set via <code>glUniformMatrix4fv(..)<\/code>,<del datetime=\"2011-10-04T23:34:39+00:00\"> probably a bug within the OpenGL ES 2.0 driver code.<br \/>\nActually device 1 and 2&#8217;s <code>libGLESv2_tegra.so<\/code> differ where the other EGL\/GL driver files are the same. However, replacing it did not do the trick.<\/del><br \/>\n<del datetime=\"2011-10-04T23:34:39+00:00\">Replacing the mat4 array with a simple <code>uniform mat4 mgl_PMVMatrix;<\/code> did the trick, ofc we need a better workaround for this case.<\/del><\/p>\n<p><strong>Update:<\/strong> The mat4 array bug turns out to be <a href=\"http:\/\/code.google.com\/p\/android\/issues\/detail?id=16434\">Android 3.0 Dalvik Issue 16434<\/a>. A simple workaround for our <a href=\"http:\/\/jogamp.org\/git\/?p=jogl.git;a=commit;h=54fe0a4a5ccc74030e6c00fd13b29fc443620c8f\">PMVMatrix<\/a> <a href=\"http:\/\/jogamp.org\/git\/?p=jogl.git;a=blob;f=src\/jogl\/classes\/com\/jogamp\/opengl\/util\/PMVMatrix.java;hb=HEAD#l129\">is submitted<\/a>.<\/p>\n<p>Further more Tegra2 doesn&#8217;t support the old fashioned <a href=\"http:\/\/developer.nvidia.com\/archived-tegra-forums\/forum\/msaa\">MSAA<\/a>, but their own <em>new<\/em> extension<br \/>\n<a href=\"http:\/\/www.khronos.org\/registry\/gles\/extensions\/NV\/EGL_NV_coverage_sample.txt\">EGL_NV_coverage_sample<\/a>, to which we will have to revert to in our multisample GLCapabilties.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While fixing JOGL for Android, Rami and I are testing the code against the consumer devices: Asus Transformer, Android 3.2, NV Tegra2 Samsung Galaxy Tab 10.1, Android 3.1, NV Tegra2 Samsung Galaxy S2, Android 2.3, ARM Mali 400 MP Samsung Galaxy S1, Android 2.3, Omap 34xx<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[7,3,8],"tags":[9,27,16,44,17,28],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-3d-opengl","category-computer-stuff","category-jogamp","tag-3d","tag-android","tag-java","tag-jogamp","tag-opengl","tag-tegra2"],"_links":{"self":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":12,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"predecessor-version":[{"id":578,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions\/578"}],"wp:attachment":[{"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jausoft.com\/blog\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}