[Tizen] Temperally print all shader codes if compile failed
authorjoogab.yun <joogab.yun@samsung.com>
Tue, 10 Dec 2024 06:16:53 +0000 (15:16 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 17 Dec 2024 05:58:36 +0000 (14:58 +0900)
This reverts commit 4b4fdeeb31bd620c783219f8c6cf610f50420f6d.

Change-Id: I98cbee32cf724db9c11eee888bb917b6c831e867

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;