Similarly, you should call the glValidateProgram function only in development builds. GlGetProgramInfoLog(prog, logLen, &logLen, log) įprintf(stderr, “Prog Info Log: %s\n”, log) GlGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLen) ![]() After calling glCompileShader, glLinkProgram, or similar Listing 10-1 Read shader compile/link logs only in development builds Use OpenGL ES functions to read shader compile or link logs only in development builds of your app, as shown in Listing 10-1. Reading diagnostic information after compiling or linking a shader program is not necessary in a Release build of your app and can reduce performance. Check for Shader Program Errors When Debugging Once you’ve created all your shaders, the app can efficiently switch between them by calling glUseProgram. ![]() Compile, link, and validate your programs when your app is initialized. Compile and Link Shaders During InitializationĬreating a shader program is an expensive operation compared to other OpenGL ES state changes. Shaders provide great flexibility, but they can also be a significant bottleneck if you perform too many calculations or perform them inefficiently. To create high-performance code on GPUs, use the Metal framework instead.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |