Browse Source

WIP: Getting OpenGL up to date
- GLSL strings are now passed to the compiler as one long string instead of individual lines, in order to aid the debugging tools reading them

BearishSun 8 years ago
parent
commit
05e9734e36
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Source/BansheeGLRenderAPI/GLSL/BsGLSLGpuProgram.cpp

+ 7 - 1
Source/BansheeGLRenderAPI/GLSL/BsGLSLGpuProgram.cpp

@@ -213,7 +213,9 @@ namespace bs { namespace ct
 				numInsertedLines++;
 			}
 
-			mGLHandle = glCreateShaderProgramv(shaderType, (GLsizei)lines.size(), (const GLchar**)lines.data());
+			StringStream codeStream;
+			for(auto& entry : lines)
+				codeStream << entry;
 
 			for (INT32 i = numInsertedLines - 1; i >= 0; i--)
 				bs_stack_free(lines[extraLineOffset + i]);
@@ -224,6 +226,10 @@ namespace bs { namespace ct
 			for (auto iter = lines.rbegin(); iter != lines.rend(); ++iter)
 				bs_stack_free(*iter);
 
+			String code = codeStream.str();
+			const char* codeRaw = code.c_str();
+			mGLHandle = glCreateShaderProgramv(shaderType, 1, (const GLchar**)&codeRaw);
+
 			mCompileError = "";
 			mIsCompiled = !checkForGLSLError(mGLHandle, mCompileError);
 		}