Android openGL ES 3 support (#1147)
* Update GLImageFormats.java * Added basic support for openGL ES 3.0 and GLSL300 for android Added instancing support for android which is core feature in GLES3.0 Added fix for shadows in android * Fixed required types of GLES30.glDrawElementsInstanced * Properly check GLES3 version and setting precision for shaders for all GLSL ES versions * Added support for Opengl ES 3.1 and 3.2 and their shader versions Added proper checkings for new OpenGL ES versions Fixed some issues with shadow rendering in GLES 3.0 or better (strict type checking, OpenGL ES specific extensions and percision definition) Added GLSL320 and GLSL300 to Unshaded and Lighting materials * Added depth texture 24bit for OpenGL ES * Added geometry shaders and tessellation to GLES 3.1 as extension and GLES 3.2 as core Modified test materials to use GLSL310 * Added FB blit for android GLES30 * Added GlSL300 or better to all effects not able to run in GLSL100 Mods on Shadows.glsllib to try to fix android shadow rendering Fixed ssaoBlur.frag that was using a reserved word Fixed precision type missmatch from vertex to fragment shader * Partial multisample support Framebuffer MRT support * Temporarily removed texture multisampling (not being able to compile using GLES31) * Updated android.jar to api28 Enabled multisampling * Better checking for GLES3 * Removed insert precision for all shaders. This avoided some random precision missmatch error but created rendering issues * Removed border check for GLES, caused filtered shadows not to render on GLES2.0 devices Added texture compare mode for GLES3.0 and better to be able to use sampler2DShadow Modified base materials (Lighting and Unshaded) to use only GLSL100 for post shadow pass * Corrected texture comparison function that were incorrectly changed * Added precision to samplers for GLESSL300 also * Created a subclass of Glsl150ShaderGenerator (Glsl300ShaderGenerator) to support ShaderNodes in GLES SL30 and included it's usage in DesktopAssetManager. Nowadays just copied and overwrote the version string. Needs a full review Added image format RGB16F to be used as texture format only in GLES30 (cannot be used as FB format) Added GLSL300 and/or GLSL310 to different materials * Cleaned GLSL300 generator Fixed shadows glsl lib removing use of GL_EXT_gpu_shaders5 * Fixed usag of textureCubeLod in fragment shader of envMapping which is unsupported in GLES2.0 Modified PBRLighting frag to properly compile on GLES3 * Added GLSL300 and 310 to PostShadowFilter material definition * Make post shadow filter use GLSL100 for GLSL300 Set highp as default precision to fix glitched shadows caused because not enough precision * Changed water_normalmap.dds to uncompressed RGB8 because DXT1 is mostly unsupported in GLES * Fixed GLES30 compilation issues in Water shaders and added GLSL300 to LightScattering material. ** Not fully tested * Added RGB8 dds formatted FullskiesSunset to be used in any platform. Previous file moved to _dtx1.dds * Set GL_TEXTURE_MAX_LEVEL in GLES30 contexts fixing issue with not fully mipmapped images and PBR rendering * Fixed compilation of jme3-android-examples and upgraded sdk version to use * Fixed Geometry Shader and Tessellation Shaders in testdata package to properly compile on GLES320 * Added non-compressed textures to be able to run all examples on android Enabled texture arrays and 3d textures on opengl es 3.0. Peding to implement wrappers to android gl functions (currently getting NullPointerException) * More GLES30 functions included to properly support texture arrays, 3d textures and multisampling matching jme core code * Fixed 3D texture tests for GLES30 Fixed texture 3D and texture array example shader compilation on GLES30 Fixed some random missing precision compilation errors on GLES30 * Fixed TestTextureArray for GLES30 * Some multisample additions and removal of GLES3 multisampling enable caps Added RGBA16F as valid format for GLES32 and using it by default in env camera instead of RGB16F. kept fall back to RGB8 * added float and half float formats for gles30 added rgb10a2 format for gles30 fixed usage of glTexImage2D removed EnvironmentCamera fallback image format as it's useless now * Added more image formats for GLES30 Fixed rgb8 if having Caps.Rgba8 * Enabled RadialBlur for gles30 * Fixed luminance texture formats for gles * Added more depth image formats for gles3 * Enabled multisampling in gles3 * Added GLES30 functions to GLDebugES Reverted TestTexture3D and TestTextureArray to use RGB8 format Updated EnvMapping100.frag to use EXT_shader_texture_lod in gles sl 100 if available * Removed all aditional not used compressed dds files Removed also Pond and rock png files previously used in TestTextureArray * Removed compressed water_normalmap_dxt1.dds * Changed GLES_30 and AndroidGL implementing GL2 to avoid duplicated code checking GL2 vs GLES30 * Added aditional checking to avoid gles30 calls from gles20 only devicesfix-openal-soft-deadlink
parent
7ae1ff23af
commit
663c9776e8
@ -0,0 +1,46 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2009-2019 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
package com.jme3.renderer.opengl; |
||||||
|
|
||||||
|
import java.nio.ByteBuffer; |
||||||
|
|
||||||
|
/** |
||||||
|
* GL functions and constants only available on vanilla OpenGL ES 3.0. |
||||||
|
* |
||||||
|
* @author Jesus Oliver |
||||||
|
*/ |
||||||
|
public interface GLES_30 extends GL { |
||||||
|
|
||||||
|
public static final int GL_RGB10_A2 = 0x8059; |
||||||
|
public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2009-2012 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
package com.jme3.shader; |
||||||
|
|
||||||
|
import com.jme3.asset.AssetManager; |
||||||
|
import com.jme3.material.ShaderGenerationInfo; |
||||||
|
import com.jme3.shader.Shader.ShaderType; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* This shader Generator can generate Vertex and Fragment shaders from |
||||||
|
* ShaderNodes for GLESSL 3.0 |
||||||
|
* Nowdays it's just a subclass of Glsl150ShaderGenerator overriding the version |
||||||
|
* string because GLSL 1.5 is mostly compatible with GLESSL 3.0 |
||||||
|
* |
||||||
|
* @author Nehon |
||||||
|
* @author Joliver82 |
||||||
|
*/ |
||||||
|
public class Glsl300ShaderGenerator extends Glsl150ShaderGenerator { |
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a Glsl300ShaderGenerator |
||||||
|
* |
||||||
|
* @param assetManager the assetmanager |
||||||
|
*/ |
||||||
|
public Glsl300ShaderGenerator(AssetManager assetManager) { |
||||||
|
super(assetManager); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String getLanguageAndVersion(ShaderType type) { |
||||||
|
return "GLSL300"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,8 +1,17 @@ |
|||||||
#extension GL_ARB_shader_texture_lod : enable |
#extension GL_ARB_shader_texture_lod : enable |
||||||
|
#extension GL_EXT_shader_texture_lod : enable |
||||||
void main(){ |
void main(){ |
||||||
//@input vec3 refVec the reflection vector |
//@input vec3 refVec the reflection vector |
||||||
//@input samplerCube cubeMap the cube map |
//@input samplerCube cubeMap the cube map |
||||||
//@output vec4 color the output color |
//@output vec4 color the output color |
||||||
|
|
||||||
color = textureCubeLod(cubeMap, refVec, 0.0); |
#ifdef GL_ES |
||||||
} |
#ifdef GL_EXT_shader_texture_lod |
||||||
|
color = textureCubeLodEXT(cubeMap, refVec, 0.0); |
||||||
|
#else |
||||||
|
color = textureCube(cubeMap, refVec); |
||||||
|
#endif |
||||||
|
#else |
||||||
|
color = textureCubeLod(cubeMap, refVec, 0.0); |
||||||
|
#endif |
||||||
|
} |
||||||
|
Binary file not shown.
@ -1,7 +1,9 @@ |
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib" |
||||||
|
|
||||||
uniform sampler3D m_Texture; |
uniform sampler3D m_Texture; |
||||||
|
|
||||||
varying vec3 texCoord; |
varying vec3 texCoord; |
||||||
|
|
||||||
void main(){ |
void main(){ |
||||||
gl_FragColor= texture3D(m_Texture,texCoord); |
gl_FragColor= texture3D(m_Texture,texCoord); |
||||||
} |
} |
||||||
|
@ -1,3 +1,5 @@ |
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib" |
||||||
|
|
||||||
void main(){ |
void main(){ |
||||||
gl_FragColor=vec4(1.0,0.0,1.0,0.5); |
gl_FragColor=vec4(1.0,0.0,1.0,0.5); |
||||||
} |
} |
||||||
|
@ -1,5 +1,7 @@ |
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib" |
||||||
|
|
||||||
attribute vec3 inPosition; |
attribute vec3 inPosition; |
||||||
|
|
||||||
void main(){ |
void main(){ |
||||||
gl_Position=vec4(inPosition,1); |
gl_Position=vec4(inPosition,1); |
||||||
} |
} |
||||||
|
@ -1,3 +1,5 @@ |
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib" |
||||||
|
|
||||||
void main(){ |
void main(){ |
||||||
gl_FragColor=vec4(1.0,0.0,1.0,0.5); |
gl_FragColor=vec4(1.0,0.0,1.0,0.5); |
||||||
} |
} |
||||||
|
@ -1,5 +1,7 @@ |
|||||||
|
#import "Common/ShaderLib/GLSLCompat.glsllib" |
||||||
|
|
||||||
attribute vec3 inPosition; |
attribute vec3 inPosition; |
||||||
|
|
||||||
void main(){ |
void main(){ |
||||||
gl_Position=vec4(inPosition,1); |
gl_Position=vec4(inPosition,1); |
||||||
} |
} |
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue