mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	option -dgl to debug shaders
This commit is contained in:
		| @@ -797,6 +797,9 @@ int read_cheat_args() { | |||||||
|     fixseed = true; autocheat = true; |     fixseed = true; autocheat = true; | ||||||
|     shift(); steplimit = argi(); |     shift(); steplimit = argi(); | ||||||
|     } |     } | ||||||
|  |   else if(argis("-dgl")) { | ||||||
|  |     debug_gl = true; | ||||||
|  |     } | ||||||
|   else if(argis("-W")) { |   else if(argis("-W")) { | ||||||
|     PHASEFROM(2); |     PHASEFROM(2); | ||||||
|     shift();  |     shift();  | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								glhr.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								glhr.cpp
									
									
									
									
									
								
							| @@ -255,12 +255,21 @@ struct GLprogram { | |||||||
|  |  | ||||||
| EX shared_ptr<GLprogram> current_glprogram = nullptr; | EX shared_ptr<GLprogram> current_glprogram = nullptr; | ||||||
|  |  | ||||||
|  | EX bool debug_gl; | ||||||
|  |  | ||||||
| EX int compileShader(int type, const string& s) { | EX int compileShader(int type, const string& s) { | ||||||
|   GLint status; |   GLint status; | ||||||
|  |  | ||||||
| #if DEBUG_GL   |   if(debug_gl) { | ||||||
|   printf("===\n%s\n===\n", s.c_str()); |     println(hlog, "===\n"); | ||||||
| #endif |     int lineno = 1; | ||||||
|  |     string cline = ""; | ||||||
|  |     for(char c: s+"\n") { | ||||||
|  |       if(c == '\n') println(hlog, format("%4d : ", lineno), cline), lineno++, cline = ""; | ||||||
|  |       else cline += c; | ||||||
|  |       } | ||||||
|  |     println(hlog, "==="); | ||||||
|  |     } | ||||||
|    |    | ||||||
|   GLint shader = glCreateShader(type); |   GLint shader = glCreateShader(type); | ||||||
|   const char *ss = s.c_str(); |   const char *ss = s.c_str(); | ||||||
| @@ -274,6 +283,7 @@ EX int compileShader(int type, const string& s) { | |||||||
|     glGetShaderInfoLog(shader, logLength, &logLength, log.data()); |     glGetShaderInfoLog(shader, logLength, &logLength, log.data()); | ||||||
|     if(logLength > 0) |     if(logLength > 0) | ||||||
|       printf("compiler log (%d): '%s'\n", logLength, log.data()); |       printf("compiler log (%d): '%s'\n", logLength, log.data()); | ||||||
|  |     if(debug_gl) exit(1); | ||||||
|     } |     } | ||||||
|    |    | ||||||
|   glGetShaderiv(shader, GL_COMPILE_STATUS, &status); |   glGetShaderiv(shader, GL_COMPILE_STATUS, &status); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue