瀏覽代碼

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 年之前
父節點
當前提交
05e9734e36
共有 1 個文件被更改,包括 7 次插入1 次删除
  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);
 		}