Skip to content

Commit 42cafac

Browse files
AIGRIND-LLCminggo
authored andcommitted
Support new Mali GPUs (#19411)
* Support new Mali GPUs Some new Mali GPUs use FP16 for matrix that is not precise enough. Should be FP32. Tested on Mali-T880. The same issue is described here: https://discuss.cocos2d-x.org/t/critical-issue-regarding-rendering-on-devices-with-renderer-type-mali/45568 * More convenient way to fix the shader precision.
1 parent 415ae3a commit 42cafac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: cocos/renderer/CCGLProgram.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,9 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source
489489
// Bugfix to make shader variables types constant to be understood by the current Android Virtual Devices or Emulators. This will also eliminate the 0x501 and 0x502 OpenGL Errors during emulation.
490490
// Changed shader data types mediump to highp to remove possible sprite joggling on some Android phones.
491491
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
492-
headersDef = "#version 100\n precision highp float;\n precision highp int;\n";
492+
headersDef = (type == GL_VERTEX_SHADER ?
493+
"#version 100\n precision highp float;\n precision highp int;\n" :
494+
"#version 100\n precision mediump float;\n precision mediump int;\n");
493495
#elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
494496
headersDef = (type == GL_VERTEX_SHADER ? "precision highp float;\n precision highp int;\n" : "precision mediump float;\n precision mediump int;\n");
495497
#endif

0 commit comments

Comments
 (0)