PowerVR support patch

PowerVR support patch

See more details: http://www.imgtec.com/forum/forum_posts.asp?TID=1952

[patch]

— Base (BASE)

+++ Locally Modified (Based On LOCAL)

@@ -1025,13 +1025,19 @@

if (verboseLogging) {

logger.info("GLES20.glShaderSource(" + id + ")");

}

-

  •    if (source.getType().equals(ShaderType.Vertex)<br />
    
  •            &amp;&amp; GLES20.glGetString(GLES20.GL_RENDERER).indexOf(&quot;PowerVR&quot;)&gt;=0) {<br />
    

GLES20.glShaderSource(

id,

  •                 source.getDefines()<br />
    
  •                + source.getSource());<br />
    
  •    } else {<br />
    
  •        GLES20.glShaderSource(<br />
    
  •                id,<br />
    

"precision mediump float;n"

  • source.getDefines()
  • source.getSource());

    -
  •    }<br />
    

checkGLError();



if (verboseLogging) {

[/patch]



Now, my app works fine on Galaxy S.



http://www.youtube.com/watch?v=RutSD6ANBIU



Android market(free)
https://market.android.com/details?id=jp.co.pscnet.mms.tinyar
1 Like

For where and what is this supposed to be?

The driver of PowreVR SGX540,530 doesn’t support “precision mediump float”.

It causes a compilation error randomly.

Please see the link in previous message for more details.

Yeah I got that much… It would be cool if you could post proper patches with a path.

Sorry.

[patch]

diff -r f8eeae42eed4 -r 13050bcd3696 engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java

— a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java Thu Feb 02 16:05:11 2012 +0900

+++ b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java Mon Feb 06 07:01:14 2012 +0900

@@ -1025,13 +1025,19 @@

if (verboseLogging) {

logger.info("GLES20.glShaderSource(" + id + ")");

}

-

  •    GLES20.glShaderSource(<br />
    
  •            id,<br />
    
  •            &quot;precision mediump float;n&quot;<br />
    
  •            + source.getDefines()<br />
    
  •            + source.getSource());<br />
    

-

  •    if (source.getType().equals(ShaderType.Vertex)<br />
    
  •            &amp;&amp; GLES20.glGetString(GLES20.GL_RENDERER).indexOf(&quot;PowerVR&quot;)&gt;=0) {<br />
    
  •        GLES20.glShaderSource(<br />
    
  •                id,<br />
    
  •                 source.getDefines()<br />
    
  •                + source.getSource());<br />
    
  •    } else {<br />
    
  •        GLES20.glShaderSource(<br />
    
  •                id,<br />
    
  •                &quot;precision mediump float;n&quot;<br />
    
  •                + source.getDefines()<br />
    
  •                + source.getSource());<br />
    
  •    }<br />
    

checkGLError();



if (verboseLogging) {

[/patch]

I looked in the GLSL specification for OpenGL ES and this statement is proper for both vertex shaders and fragment shaders. It seems to me that PowerVR breaks the spec. In any case, it seems that only for the fragment shader this statement is actually required so perhaps can we make the condition for putting it only if the shader is fragment?

I looked in the GLSL specification for OpenGL ES and this statement is proper for both vertex shaders and fragment shaders.



It’s so.

However, this statement often causes a compile error if the shader is vertex.

This is a bug of the driver of PowerVR.

OK commited to svn