[Tizen] Temperally print all shader codes if compile failed
authorWoochan Lee <wc0917.lee@samsung.com>
Tue, 7 Jan 2025 06:56:24 +0000 (15:56 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Tue, 7 Jan 2025 06:56:45 +0000 (15:56 +0900)
This reverts commit ec399c4384d41712683d5039abc42cbd69f1b407.

dali/internal/graphics/gles-impl/gles-graphics-shader.cpp

index 7dbd23a48e06871367e8191601622c3214375fe0..1c91b0ae510529de27ca6b305b6d354afd42c267 100644 (file)
@@ -120,7 +120,34 @@ struct ShaderImpl::Impl
           char    output[4096];
           GLsizei outputSize{0u};
           gl->GetShaderInfoLog(shader, 4096, &outputSize, output);
-          DALI_LOG_ERROR("Code: %.*s\n", size, reinterpret_cast<const char*>(src));
+          DALI_LOG_ERROR("Shader code : (preprocessed?%d)\n", sourcePreprocessed.empty());
+
+          // TODO : Some device don't allow to print logs multiple lines. Let we print line by line, for temperally.
+          {
+            int i          = 0;
+            int lineNumber = 0;
+
+            std::ostringstream line;
+            while(i < size)
+            {
+              const char c = static_cast<const char>(src[i++]);
+              if(c == '\0')
+              {
+                break;
+              }
+              if(c == '\n')
+              {
+                DALI_LOG_ERROR("%4d > %s\n", ++lineNumber, line.str().c_str());
+                line = std::ostringstream();
+              }
+              else
+              {
+                line << c;
+              }
+            }
+            DALI_LOG_ERROR("%4d > %s\n", ++lineNumber, line.str().c_str());
+          }
+          //DALI_LOG_ERROR("Code: %.*s\n", size, reinterpret_cast<const char*>(src));
           DALI_LOG_ERROR("glCompileShader() failed: \n%s\n", output);
           gl->DeleteShader(shader);
           return false;