Browse Source

Adding forgoten files

Panagiotis Christopoulos Charitos 9 years ago
parent
commit
fde06f7d2b
4 changed files with 46 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 2 0
      samples/CMakeLists.txt
  3. 2 0
      samples/simple_scene/CMakeLists.txt
  4. 41 0
      src/gr/Common.cpp

+ 1 - 0
.gitignore

@@ -8,4 +8,5 @@
 !*.glsl
 !*.py
 !*.xml
+!CMakeLists.txt
 build/*

+ 2 - 0
samples/CMakeLists.txt

@@ -0,0 +1,2 @@
+add_definitions(-UANKI_BUILD)
+add_subdirectory(simple_scene)

+ 2 - 0
samples/simple_scene/CMakeLists.txt

@@ -0,0 +1,2 @@
+add_executable(simple_scene Main.cpp)
+target_link_libraries(simple_scene anki)

+ 41 - 0
src/gr/Common.cpp

@@ -0,0 +1,41 @@
+// Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
+// All rights reserved.
+// Code licensed under the BSD License.
+// http://www.anki3d.org/LICENSE
+
+#include <anki/gr/Common.h>
+#include <anki/util/StringList.h>
+
+namespace anki
+{
+
+//==============================================================================
+void logShaderErrorCode(const CString& error,
+	const CString& source,
+	GenericMemoryPoolAllocator<U8> alloc)
+{
+	StringAuto prettySrc(alloc);
+	StringListAuto lines(alloc);
+
+	static const char* padding = "======================================="
+								 "=======================================";
+
+	lines.splitString(source, '\n');
+
+	I lineno = 0;
+	for(auto it = lines.getBegin(); it != lines.getEnd(); ++it)
+	{
+		StringAuto tmp(alloc);
+
+		tmp.sprintf("%4d: %s\n", ++lineno, &(*it)[0]);
+		prettySrc.append(tmp);
+	}
+
+	ANKI_LOGE("Shader compilation failed:\n%s\n%s\n%s\n%s",
+		padding,
+		&error[0],
+		padding,
+		&prettySrc[0]);
+}
+
+} // end namespace anki