Remove vsnprintf from OpenGL CTS, part 2
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Mon, 17 Jul 2017 12:50:41 +0000 (14:50 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 19 Jul 2017 21:39:28 +0000 (17:39 -0400)
This change replaces usage of vsnprintf with tcu::TestLog.

Components: OpenGL

VK-GL-CTS issue: 482

Affects:
KHR-GL40.texture_gather.*
KHR-GL44.tessellation_shader.compilation_and_linking_errors.*
KHR-GLES31.core.shader_image_size.*
KHR-GLES31.core.vertex_attrib_binding.*
KHR-GLES31.core.shader_atomic_counters.*
KHR-GLES31.core.shader_storage_buffer_object.*

Change-Id: I1c9395bb11e013b3ff7ab98a37b3fb088da8944a

external/openglcts/modules/gles31/es31cShaderAtomicCountersTests.cpp
external/openglcts/modules/gles31/es31cShaderImageLoadStoreTests.cpp
external/openglcts/modules/gles31/es31cShaderImageSizeTests.cpp
external/openglcts/modules/gles31/es31cShaderStorageBufferObjectTests.cpp
external/openglcts/modules/gles31/es31cTextureGatherTests.cpp
external/openglcts/modules/gles31/es31cVertexAttribBindingTests.cpp
external/openglcts/modules/glesext/tessellation_shader/esextcTessellationShaderErrors.cpp

index 115fe81..dba7d47 100644 (file)
@@ -43,33 +43,6 @@ using tcu::UVec4;
 namespace
 {
 
-static tcu::TestLog* currentLog;
-
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 class SACSubcaseBase : public glcts::SubcaseBase
 {
 public:
@@ -104,7 +77,7 @@ public:
                {
                        std::vector<GLchar> log(length);
                        glGetProgramInfoLog(program, length, NULL, &log[0]);
-                       Output("%s\n", &log[0]);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                }
                return status == GL_TRUE;
        }
@@ -154,7 +127,8 @@ public:
                glGetProgramInfoLog(program, sizeof(log), &length, log);
                if (length > 1)
                {
-                       Output("Program Info Log:\n%s\n", log);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                               << log << tcu::TestLog::EndMessage;
                }
        }
 
@@ -197,7 +171,8 @@ public:
                        glGetProgramInfoLog(program, sizeof(log), &length, log);
                        if (length > 1)
                        {
-                               Output("Program Info Log:\n%s\n", log);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                                       << log << tcu::TestLog::EndMessage;
                        }
                }
                return program;
@@ -338,11 +313,15 @@ public:
 
                GLint i;
                glGetIntegerv(e, &i);
-               Output("%s = %d\n", GLenumToString(e), i);
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << GLenumToString(e) << " = " << i << tcu::TestLog::EndMessage;
+
                if (i < expected)
                {
                        ok = false;
-                       Output("%s state is incorrect (GetIntegerv, is: %d, expected: %d)\n", GLenumToString(e), i, expected);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << GLenumToString(e) << " state is incorrect (GetIntegerv, is: " << i
+                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLint64 i64;
@@ -350,8 +329,9 @@ public:
                if (i64 < static_cast<GLint64>(expected))
                {
                        ok = false;
-                       Output("%s state is incorrect (GetInteger64v, is: %d, expected: %d)\n", GLenumToString(e),
-                                  static_cast<GLint>(i64), expected);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << GLenumToString(e)
+                                                                                               << " state is incorrect (GetInteger64v, is: " << static_cast<GLint>(i64)
+                                                                                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLfloat f;
@@ -359,7 +339,9 @@ public:
                if (f < static_cast<GLfloat>(expected))
                {
                        ok = false;
-                       Output("%s state is incorrect (GetFloatv, is: %f, expected: %d)\n", GLenumToString(e), f, expected);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << GLenumToString(e) << " state is incorrect (GetFloatv, is: " << f
+                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLboolean b;
@@ -377,7 +359,9 @@ public:
                if (i != expected)
                {
                        ok = false;
-                       Output("%s state is incorrect (GetIntegerv, is: %d, expected: %d)\n", GLenumToString(e), i, expected);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << GLenumToString(e) << " state is incorrect (GetIntegerv, is: " << i
+                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLint64 i64;
@@ -385,8 +369,9 @@ public:
                if (i64 != static_cast<GLint64>(expected))
                {
                        ok = false;
-                       Output("%s state is incorrect (GetInteger64v, is: %d, expected: %d)\n", GLenumToString(e),
-                                  static_cast<GLint>(i64), expected);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << GLenumToString(e)
+                                                                                               << " state is incorrect (GetInteger64v, is: " << static_cast<GLint>(i64)
+                                                                                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLfloat f;
@@ -394,7 +379,9 @@ public:
                if (f != static_cast<GLfloat>(expected))
                {
                        ok = false;
-                       Output("%s state is incorrect (GetFloatv, is: %f, expected: %d)\n", GLenumToString(e), f, expected);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << GLenumToString(e) << " state is incorrect (GetFloatv, is: " << f
+                               << ", expected: " << expected << ")" << tcu::TestLog::EndMessage;
                }
 
                GLboolean b;
@@ -402,8 +389,9 @@ public:
                if (b != (expected ? GL_TRUE : GL_FALSE))
                {
                        ok = false;
-                       Output("%s state is incorrect (GetBooleanv, is: %d, expected: %d)\n", GLenumToString(e), b,
-                                  expected ? GL_TRUE : GL_FALSE);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << GLenumToString(e) << " state is incorrect (GetBooleanv, is: " << b
+                               << ", expected: " << (expected ? GL_TRUE : GL_FALSE) << ")" << tcu::TestLog::EndMessage;
                }
 
                return ok;
@@ -418,9 +406,10 @@ public:
                if (i != binding)
                {
                        ok = false;
-                       Output("GL_ATOMIC_COUNTER_BUFFER_BINDING state is incorrect (GetIntegeri_v, is: %d, expected: %d, index: "
-                                  "%u)\n",
-                                  i, binding, index);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "GL_ATOMIC_COUNTER_BUFFER_BINDING state is incorrect (GetIntegeri_v, is: " << i
+                               << ", expected: " << binding << ", index: " << index << tcu::TestLog::EndMessage;
                }
 
                GLint64 i64;
@@ -428,26 +417,30 @@ public:
                if (i64 != static_cast<GLint64>(binding))
                {
                        ok = false;
-                       Output("GL_ATOMIC_COUNTER_BUFFER_BINDING state is incorrect (GetInteger64i_v, is: %d, expected: %d, index: "
-                                  "%u)\n",
-                                  static_cast<GLint>(i64), binding, index);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_ATOMIC_COUNTER_BUFFER_BINDING state is incorrect (GetInteger64i_v, is: "
+                               << static_cast<GLint>(i64) << ", expected: " << binding << ", index: " << index
+                               << tcu::TestLog::EndMessage;
                }
 
                glGetInteger64i_v(GL_ATOMIC_COUNTER_BUFFER_START, index, &i64);
                if (i64 != start)
                {
                        ok = false;
-                       Output("GL_ATOMIC_COUNTER_BUFFER_START state is incorrect (GetInteger64i_v, is: %d, expected: %d, index: "
-                                  "%u)\n",
-                                  static_cast<GLint>(i64), static_cast<GLint>(start), index);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "GL_ATOMIC_COUNTER_BUFFER_START state is incorrect (GetInteger64i_v, is: " << static_cast<GLint>(i64)
+                               << ", expected: " << static_cast<GLint>(start) << ", index: " << index << tcu::TestLog::EndMessage;
                }
                glGetInteger64i_v(GL_ATOMIC_COUNTER_BUFFER_SIZE, index, &i64);
                if (i64 != size && i64 != 0)
                {
                        ok = false;
-                       Output("GL_ATOMIC_COUNTER_BUFFER_SIZE state is incorrect (GetInteger64i_v, is: %d, expected: (%d or 0), "
-                                  "index: %u)\n",
-                                  static_cast<GLint>(i64), static_cast<GLint>(size), index);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "GL_ATOMIC_COUNTER_BUFFER_SIZE state is incorrect (GetInteger64i_v, is: " << static_cast<GLint>(i64)
+                               << ", expected: (" << static_cast<GLint>(size) << " or 0), index: " << index
+                               << tcu::TestLog::EndMessage;
                }
 
                return ok;
@@ -462,7 +455,9 @@ public:
                glGetUniformIndices(prog, 1, &uniform_name, &index);
                if (index != uniform_index)
                {
-                       Output("Uniform: %s: Bad index returned by glGetUniformIndices.\n", uniform_name);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name
+                               << ": Bad index returned by glGetUniformIndices." << tcu::TestLog::EndMessage;
                        ok = false;
                }
 
@@ -476,28 +471,36 @@ public:
                glGetProgramResourceName(prog, GL_UNIFORM, uniform_index, sizeof(name), &length, name);
                if (length != uniform_length)
                {
-                       Output("Uniform: %s: Length is %d should be %d.\n", uniform_name, length, uniform_length);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Length is " << length << " should be "
+                               << uniform_length << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniform(prog, uniform_index, sizeof(name), &length, &size, &type, name);
                if (strcmp(name, uniform_name))
                {
-                       Output("Uniform: %s: Bad name returned by glGetActiveUniform.\n", uniform_name);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Bad name returned by glGetActiveUniform."
+                               << tcu::TestLog::EndMessage;
                        ok = false;
                }
                if (length != uniform_length)
                {
-                       Output("Uniform: %s: Length is %d should be %d.\n", uniform_name, length, uniform_length);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Length is " << length << " should be "
+                               << uniform_length << tcu::TestLog::EndMessage;
                        ok = false;
                }
                if (size != uniform_size)
                {
-                       Output("Uniform: %s: Size is %d should be %d.\n", uniform_name, size, uniform_size);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Size is "
+                                                                                               << size << " should be " << uniform_size << tcu::TestLog::EndMessage;
                        ok = false;
                }
                if (type != static_cast<GLenum>(uniform_type))
                {
-                       Output("Uniform: %s: Type is %d should be %d.\n", uniform_name, type, uniform_type);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Type is "
+                                                                                               << type << " should be " << uniform_type << tcu::TestLog::EndMessage;
                        ok = false;
                }
 
@@ -505,51 +508,63 @@ public:
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_TYPE, &param);
                if (param != uniform_type)
                {
-                       Output("Uniform: %s: Type is %d should be %d.\n", uniform_name, param, uniform_type);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Uniform: " << uniform_name << ": Type is "
+                                                                                               << param << " should be " << uniform_type << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_SIZE, &param);
                if (param != uniform_size)
                {
-                       Output("Uniform: %s: GL_UNIFORM_SIZE is %d should be %d.\n", uniform_name, param, uniform_size);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_SIZE is " << param
+                               << " should be " << uniform_size << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_NAME_LENGTH, &param);
                if (param != (uniform_length + 1))
                {
-                       Output("Uniform: %s: GL_UNIFORM_NAME_LENGTH is %d should be %d.\n", uniform_name, param,
-                                  uniform_length + 1);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_NAME_LENGTH is " << param
+                               << " should be " << (uniform_length + 1) << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_BLOCK_INDEX, &param);
                if (param != -1)
                {
-                       Output("Uniform: %s: GL_UNIFORM_BLOCK_INDEX should be -1.\n", uniform_name);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Uniform: " << uniform_name
+                                                                                               << ": GL_UNIFORM_BLOCK_INDEX should be -1." << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_OFFSET, &param);
                if (param != uniform_offset)
                {
-                       Output("Uniform: %s: GL_UNIFORM_OFFSET is %d should be %d.\n", uniform_name, param, uniform_offset);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_OFFSET is " << param
+                               << " should be " << uniform_offset << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_ARRAY_STRIDE, &param);
                if (param != uniform_array_stride)
                {
-                       Output("Uniform: %s: GL_UNIFORM_ARRAY_STRIDE is %d should be %d.\n", uniform_name, param,
-                                  uniform_array_stride);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_ARRAY_STRIDE is " << param
+                               << " should be " << uniform_array_stride << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_MATRIX_STRIDE, &param);
                if (param != 0)
                {
-                       Output("Uniform: %s: GL_UNIFORM_MATRIX_STRIDE should be 0 is %d.\n", uniform_name, param);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_MATRIX_STRIDE should be 0 is "
+                               << param << tcu::TestLog::EndMessage;
                        ok = false;
                }
                glGetActiveUniformsiv(prog, 1, &uniform_index, GL_UNIFORM_IS_ROW_MAJOR, &param);
                if (param != 0)
                {
-                       Output("Uniform: %s: GL_UNIFORM_IS_ROW_MAJOR should be 0 is %d.\n", uniform_name, param);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Uniform: " << uniform_name << ": GL_UNIFORM_MATRIX_STRIDE should be 0 is "
+                               << param << tcu::TestLog::EndMessage;
                        ok = false;
                }
 
@@ -561,10 +576,11 @@ public:
                std::sort(values, values + size);
                for (GLuint i = 0; i < size; ++i)
                {
-                       Output("%u\n", values[i]);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << values[i] << tcu::TestLog::EndMessage;
                        if (values[i] != i + min_value)
                        {
-                               Output("Counter value is %u should be %u.\n", values[i], i + min_value);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Counter value is " << values[i]
+                                                                                                       << " should be " << i + min_value << tcu::TestLog::EndMessage;
                                return false;
                        }
                }
@@ -581,10 +597,11 @@ public:
                std::sort(values.begin(), values.end());
                for (GLuint i = 0; i < size; ++i)
                {
-                       Output("%u\n", values[i]);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << values[i] << tcu::TestLog::EndMessage;
                        if (values[i] != i + min_value)
                        {
-                               Output("Counter value is %u should be %u.\n", values[i], i + min_value);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Counter value is " << values[i]
+                                                                                                       << " should be " << i + min_value << tcu::TestLog::EndMessage;
                                return false;
                        }
                }
@@ -597,7 +614,8 @@ public:
                GLuint* value = static_cast<GLuint*>(glMapBufferRange(GL_ATOMIC_COUNTER_BUFFER, offset, 4, GL_MAP_READ_BIT));
                if (value[0] != expected_value)
                {
-                       Output("Counter value is %u should be %u.\n", value, expected_value);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Counter value is " << value
+                                                                                               << " should be " << expected_value << tcu::TestLog::EndMessage;
                        glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
                        glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0);
                        return false;
@@ -641,13 +659,16 @@ public:
                glGetBufferParameteri64v(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_SIZE, &i64);
                if (i64 != size_)
                {
-                       Output("BUFFER_SIZE is %d should be %d.\n", static_cast<GLint>(i64), static_cast<GLint>(size_));
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "BUFFER_SIZE is " << static_cast<GLint>(i64) << " should be "
+                               << static_cast<GLint>(size_) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetBufferParameteriv(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_USAGE, &i);
                if (i != static_cast<GLint>(usage_))
                {
-                       Output("BUFFER_USAGE is %d should be %d.\n", i, usage_);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "BUFFER_USAGE is " << i << " should be "
+                                                                                               << usage_ << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (this->m_context.getContextInfo().isExtensionSupported("GL_OES_mapbuffer"))
@@ -655,43 +676,54 @@ public:
                        glGetBufferParameteriv(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_ACCESS, &i);
                        if (i != static_cast<GLint>(access_))
                        {
-                               Output("BUFFER_ACCESS is %d should be %d.\n", i, access_);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "BUFFER_ACCESS is " << i
+                                                                                                       << " should be " << access_ << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
                else
                {
-                       Output("GL_OES_mapbuffer not supported, skipping GL_BUFFER_ACCESS enum");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_OES_mapbuffer not supported, skipping GL_BUFFER_ACCESS enum"
+                               << tcu::TestLog::EndMessage;
                }
                glGetBufferParameteriv(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_ACCESS_FLAGS, &i);
                if (i != access_flags_)
                {
-                       Output("BUFFER_ACCESS_FLAGS is %d should be %d.\n", i, access_flags_);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "BUFFER_ACCESS_FLAGS is " << i
+                                                                                               << " should be " << access_flags_ << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetBufferParameteriv(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_MAPPED, &i);
                if (i != mapped_)
                {
-                       Output("BUFFER_MAPPED is %d should be %d.\n", i, mapped_);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "BUFFER_MAPPED is " << i << " should be "
+                                                                                               << mapped_ << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetBufferParameteri64v(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_MAP_OFFSET, &i64);
                if (i64 != map_offset_)
                {
-                       Output("BUFFER_MAP_OFFSET is %d should be %d.\n", static_cast<GLint>(i64), static_cast<GLint>(map_offset_));
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "BUFFER_MAP_OFFSET is " << static_cast<GLint>(i64) << " should be "
+                               << static_cast<GLint>(map_offset_) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetBufferParameteri64v(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_MAP_LENGTH, &i64);
                if (i64 != map_length_)
                {
-                       Output("BUFFER_MAP_LENGTH is %d should be %d.\n", static_cast<GLint>(i64), static_cast<GLint>(map_length_));
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "BUFFER_MAP_LENGTH is " << static_cast<GLint>(i64) << " should be "
+                               << static_cast<GLint>(map_length_) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                void* ptr;
                glGetBufferPointerv(GL_ATOMIC_COUNTER_BUFFER, GL_BUFFER_MAP_POINTER, &ptr);
                if (ptr != map_pointer_)
                {
-                       Output("BUFFER_MAP_POINTER is %p should be %p.\n", ptr, map_pointer_);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "BUFFER_MAP_POINTER is " << reinterpret_cast<long>(static_cast<int*>(ptr))
+                               << " should be " << reinterpret_cast<long>(static_cast<int*>(map_pointer_)) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -827,25 +859,34 @@ public:
                                        switch (type)
                                        {
                                        case GL_VERTEX_SHADER:
-                                               Output("*** Vertex Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Vertex Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_TESS_CONTROL_SHADER:
-                                               Output("*** Tessellation Control Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Tessellation Control Shader ***"
+                                                       << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_TESS_EVALUATION_SHADER:
-                                               Output("*** Tessellation Evaluation Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Tessellation Evaluation Shader ***"
+                                                       << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_GEOMETRY_SHADER:
-                                               Output("*** Geometry Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Geometry Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_FRAGMENT_SHADER:
-                                               Output("*** Fragment Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Fragment Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_COMPUTE_SHADER:
-                                               Output("*** Compute Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Compute Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        default:
-                                               Output("*** Unknown Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Unknown Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        }
 
@@ -861,7 +902,8 @@ public:
                                        {
                                                std::vector<GLchar> source(length);
                                                glGetShaderSource(shaders[i], length, NULL, &source[0]);
-                                               Output("%s\n", &source[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &source[0] << tcu::TestLog::EndMessage;
                                        }
 
                                        // shader info log
@@ -870,7 +912,8 @@ public:
                                        {
                                                std::vector<GLchar> log(length);
                                                glGetShaderInfoLog(shaders[i], length, NULL, &log[0]);
-                                               Output("%s\n", &log[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                                        }
                                }
                        }
@@ -882,7 +925,7 @@ public:
                        {
                                std::vector<GLchar> log(length);
                                glGetProgramInfoLog(program, length, NULL, &log[0]);
-                               Output("%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -942,12 +985,16 @@ public:
                {
                        if (data[i] != data[i + 1])
                        {
-                               Output("Pair of values should be equal, got: %d, %d\n", data[i], data[i + 1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Pair of values should be equal, got: " << data[i] << ", "
+                                       << data[i + 1] << tcu::TestLog::EndMessage;
                                error = ERROR;
                        }
                        if (i < 510 && data[i] == data[i + 2])
                        {
-                               Output("Too many same values found: %d, index: %d\n", data[i], i);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Too many same values found: " << data[i] << ", index: " << i
+                                       << tcu::TestLog::EndMessage;
                                error = ERROR;
                        }
                }
@@ -1026,7 +1073,8 @@ class BasicBufferOperations : public SACSubcaseBase
                {
                        if (data[i] != i)
                        {
-                               Output("data[%u] is: %u should be: %u\n", i, data[i], i);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "data[" << i << "] is: " << data[i]
+                                                                                                       << " should be: " << i << tcu::TestLog::EndMessage;
                                res = ERROR;
                        }
                }
@@ -1056,7 +1104,8 @@ class BasicBufferOperations : public SACSubcaseBase
                {
                        if (data[i] != i * 2)
                        {
-                               Output("data[%u] is: %u should be: %u\n", i, data[i], i * 2);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "data[" << i << "] is: " << data[i]
+                                                                                                       << " should be: " << i * 2 << tcu::TestLog::EndMessage;
                                res = ERROR;
                        }
                }
@@ -1075,7 +1124,8 @@ class BasicBufferOperations : public SACSubcaseBase
                {
                        if (data[i] != i * 3)
                        {
-                               Output("data[%u] is: %u should be: %u\n", i, data[i], i * 3);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "data[" << i << "] is: " << data[i]
+                                                                                                       << " should be: " << i * 3 << tcu::TestLog::EndMessage;
                                res = ERROR;
                        }
                }
@@ -1166,7 +1216,8 @@ class BasicBufferBind : public SACSubcaseBase
        {
                GLint bindings;
                glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS, &bindings);
-               Output("MAX_ATOMIC_COUNTER_BUFFER_BINDINGS: %d\n", bindings);
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS: " << bindings << tcu::TestLog::EndMessage;
 
                if (!CheckGetCommands(GL_ATOMIC_COUNTER_BUFFER_BINDING, 0))
                        return ERROR;
@@ -1228,7 +1279,9 @@ class BasicBufferBind : public SACSubcaseBase
                glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING, &i);
                if (i != 0)
                {
-                       Output("Generic binding point should be 0 after deleting bound buffer object.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Generic binding point should be 0 after deleting bound buffer object."
+                               << tcu::TestLog::EndMessage;
                        res = ERROR;
                }
                for (GLint index = 0; index < bindings; ++index)
@@ -1236,7 +1289,9 @@ class BasicBufferBind : public SACSubcaseBase
                        glGetIntegeri_v(GL_ATOMIC_COUNTER_BUFFER_BINDING, static_cast<GLuint>(index), &i);
                        if (i != 0)
                        {
-                               Output("Binding point %u should be 0 after deleting bound buffer object.\n", index);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Binding point " << index
+                                       << " should be 0 after deleting bound buffer object." << tcu::TestLog::EndMessage;
                                res = ERROR;
                        }
                }
@@ -1360,7 +1415,8 @@ class BasicProgramQuery : public BasicUsageCS
                glGetProgramiv(prog_, GL_ACTIVE_ATOMIC_COUNTER_BUFFERS, reinterpret_cast<GLint*>(&active_buffers));
                if (active_buffers != 1)
                {
-                       Output("GL_ACTIVE_ATOMIC_COUNTER_BUFFERS is %u should be %d.\n", active_buffers, 1);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_ACTIVE_ATOMIC_COUNTER_BUFFERS is "
+                                                                                               << active_buffers << " should be 1." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -1370,7 +1426,8 @@ class BasicProgramQuery : public BasicUsageCS
                glGetProgramiv(prog_, GL_ACTIVE_UNIFORMS, reinterpret_cast<GLint*>(&active_uniforms));
                if (active_uniforms != 7)
                {
-                       Output("GL_ACTIVE_UNIFORMS is %u should be %d.\n", active_uniforms, 8);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_ACTIVE_UNIFORMS is " << active_uniforms
+                                                                                               << " should be 8." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                for (GLuint index = 0; index < active_uniforms; ++index)
@@ -1423,8 +1480,9 @@ class BasicProgramQuery : public BasicUsageCS
                data_out = static_cast<Vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(Vec4), GL_MAP_READ_BIT));
                if (data_out[0].x() != 0.0 || data_out[0].y() != 1.0 || data_out[0].z() != 0.0 || data_out[0].w() != 1.0)
                {
-                       Output("Expected vec4(0, 1, 0, 1) in the buffer, got: %f %f %f %f\n", data_out[0].x(), data_out[0].y(),
-                                  data_out[0].z(), data_out[0].w());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected vec4(0, 1, 0, 1) in the buffer, got: " << data_out[0].x() << " "
+                               << data_out[0].y() << " " << data_out[0].z() << " " << data_out[0].w() << tcu::TestLog::EndMessage;
                        error = ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -2143,7 +2201,8 @@ class AdvancedUsageDrawUpdateDraw : public SACSubcaseBase
                {
                        if (data[i].x() != 896)
                        {
-                               Output("Counter value is %u should be %u.\n", data[i].x(), 896);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Counter value is " << data[i].x()
+                                                                                                       << " should be 896." << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2154,7 +2213,8 @@ class AdvancedUsageDrawUpdateDraw : public SACSubcaseBase
                {
                        if (data[i].x() != 1152)
                        {
-                               Output("Counter value is %u should be %u.\n", data[i].x(), 896);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Counter value is " << data[i].x()
+                                                                                                       << " should be 896." << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2656,22 +2716,28 @@ class NegativeAPI : public SACSubcaseBase
                glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, res, buffer);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("glBindBufferBase should generate INVALID_VALUE when"
-                                  " index is greater than or equal GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindBufferBase should generate INVALID_VALUE when"
+                                                                                       " index is greater than or equal GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS."
+                               << tcu::TestLog::EndMessage;
                        error = ERROR;
                }
                glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, res, buffer, 0, 4);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("glBindBufferRange should generate INVALID_VALUE when"
-                                  " index is greater than or equal GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindBufferRange should generate INVALID_VALUE when"
+                                                                                       " index is greater than or equal GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS."
+                               << tcu::TestLog::EndMessage;
                        error = ERROR;
                }
                glBindBufferRange(GL_ATOMIC_COUNTER_BUFFER, res - 1, buffer, 3, 4);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("glBindBufferRange should generate INVALID_VALUE when"
-                                  " <offset> is not a multiple of four\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindBufferRange should generate INVALID_VALUE when"
+                                                                                       " <offset> is not a multiple of four"
+                               << tcu::TestLog::EndMessage;
                        error = ERROR;
                }
                return error;
@@ -2725,7 +2791,10 @@ class NegativeGLSL : public BasicUsageCS
                glLinkProgram(prog_);
                if (CheckProgram(prog_))
                {
-                       Output("Link should fail because ac_counter0 and ac_counter2 uses same binding and same offset.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "Link should fail because ac_counter0 and ac_counter2 uses same binding and same offset."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -2922,7 +2991,10 @@ class NegativeSSBO : public BasicUsageCS
                glLinkProgram(prog_);
                if (CheckProgram(prog_))
                {
-                       Output("Link should fail because atomic counters cannot be declared in the buffer block.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "Link should fail because atomic counters cannot be declared in the buffer block."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -2974,7 +3046,10 @@ class NegativeUBO : public BasicUsageCS
                glLinkProgram(prog_);
                if (CheckProgram(prog_))
                {
-                       Output("Link should fail because atomic counters cannot be declared in the uniform block.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "Link should fail because atomic counters cannot be declared in the uniform block."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3070,12 +3145,16 @@ class BasicUsageNoOffset : public BasicUsageCS
                {
                        if (data[i] != data[i + 1])
                        {
-                               Output("Pair of values should be equal, got: %d, %d\n", data[i], data[i + 1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Pair of values should be equal, got: " << data[i] << ", "
+                                       << data[i + 1] << tcu::TestLog::EndMessage;
                                error = ERROR;
                        }
                        if (i < 510 && data[i] == data[i + 2])
                        {
-                               Output("Too many same values found: %d, index: %d\n", data[i], i);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Too many same values found: " << data[i] << ", index: " << i
+                                       << tcu::TestLog::EndMessage;
                                error = ERROR;
                        }
                }
@@ -3153,7 +3232,9 @@ class NegativeUniform : public SACSubcaseBase
                glGetShaderiv(sh, GL_COMPILE_STATUS, &status_comp);
                if (status_comp != GL_TRUE)
                {
-                       Output("Unexpected error during vertex shader compilation.");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Unexpected error during vertex shader compilation."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glDeleteShader(sh);
@@ -3170,7 +3251,9 @@ class NegativeUniform : public SACSubcaseBase
                glGetProgramiv(prog_, GL_LINK_STATUS, &status);
                if (status_comp == GL_TRUE && status == GL_TRUE)
                {
-                       Output("Expected error during fragment shader compilation or linking.");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected error during fragment shader compilation or linking."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3223,7 +3306,10 @@ class NegativeArray : public BasicUsageCS
                glLinkProgram(prog_);
                if (CheckProgram(prog_))
                {
-                       Output("Link should fail because atomicCounterIncrement cannot be used on array of atomic counters.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "Link should fail because atomicCounterIncrement cannot be used on array of atomic counters."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3276,8 +3362,10 @@ class NegativeArithmetic : public BasicUsageCS
                glLinkProgram(prog_);
                if (CheckProgram(prog_))
                {
-                       Output(
-                               "Link should fail because atomic counters cannot be incremented by standard arithmetic operations.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "Link should fail because atomic counters cannot be incremented by standard arithmetic operations."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3380,7 +3468,8 @@ class AdvancedManyDrawCalls2 : public SACSubcaseBase
                        if (data[0] != 100)
                        {
                                status = ERROR;
-                               Output("AC buffer content is %u, sholud be 100.\n", data[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "AC buffer content is " << data[0]
+                                                                                                       << ", sholud be 100." << tcu::TestLog::EndMessage;
                        }
                        glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
                        glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0);
@@ -3395,7 +3484,8 @@ class AdvancedManyDrawCalls2 : public SACSubcaseBase
                                if (data[i] != i)
                                {
                                        status = ERROR;
-                                       Output("data[%u] is %u, should be %u.\n", i, data[i], i);
+                                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "data[" << i << " is " << data[i]
+                                                                                                               << ", sholud be " << i << tcu::TestLog::EndMessage;
                                }
                        }
                        glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -3472,7 +3562,8 @@ class AdvancedUsageMultipleComputeDispatches : public SACSubcaseBase
                        if (data[0] != 100)
                        {
                                status = ERROR;
-                               Output("AC buffer content is %u, sholud be 100.\n", data[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "AC buffer content is " << data[0]
+                                                                                                       << ", sholud be 100" << tcu::TestLog::EndMessage;
                        }
                        glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
                        glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0);
@@ -3487,7 +3578,8 @@ class AdvancedUsageMultipleComputeDispatches : public SACSubcaseBase
                                if (data[i] != i)
                                {
                                        status = ERROR;
-                                       Output("data[%u] is %u, should be %u.\n", i, data[i], i);
+                                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "data[" << i << "] is " << data[i]
+                                                                                                               << ", sholud be " << i << tcu::TestLog::EndMessage;
                                }
                        }
                        glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -3575,7 +3667,8 @@ public:
                data = static_cast<GLuint*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(GLuint), GL_MAP_READ_BIT));
                if (data[0] != 1u)
                {
-                       Output("Expected 1, got: %d", data[0]);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected 1, got: " << data[0] << tcu::TestLog::EndMessage;
                        error = ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -3605,7 +3698,6 @@ ShaderAtomicCountersTests::~ShaderAtomicCountersTests(void)
 void ShaderAtomicCountersTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "basic-buffer-operations", TestSubcase::Create<BasicBufferOperations>));
        addChild(new TestSubcase(m_context, "basic-buffer-state", TestSubcase::Create<BasicBufferState>));
        addChild(new TestSubcase(m_context, "basic-buffer-bind", TestSubcase::Create<BasicBufferBind>));
index 6b35b80..d81948e 100644 (file)
@@ -50,32 +50,6 @@ enum Target
        T2DA
 };
 
-static tcu::TestLog* currentLog;
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 const char* const kGLSLVer = "#version 310 es";
 
 const char* const kGLSLSIA = NL "#extension GL_OES_shader_image_atomic : require";
@@ -235,8 +209,9 @@ public:
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s.\n", i, ToString(map_data[i]).c_str(),
-                                          ToString(expected_value).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value) << tcu::TestLog::EndMessage;
                                return false;
                        }
                }
@@ -251,8 +226,9 @@ public:
                {
                        if (always)
                        {
-                               Output("[%d] Value is: %s. Value should be: %s.\n", i, ToString(map_data[i]).c_str(),
-                                          ToString(expected_value).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value) << tcu::TestLog::EndMessage;
                        }
                }
                return true;
@@ -277,11 +253,11 @@ public:
                                        fabs(fb[i + 1] / g_color_max[1] - expected[1]) > g_color_eps[1] ||
                                        fabs(fb[i + 2] / g_color_max[2] - expected[2]) > g_color_eps[2])
                                {
-
-                                       Output("Incorrect framebuffer color at pixel (%d %d). Color is (%f %f %f). "
-                                                  "Color should be (%f %f %f).\n",
-                                                  x, y, fb[i + 0] / g_color_max[0], fb[i + 1] / g_color_max[1], fb[i + 2] / g_color_max[2],
-                                                  expected[0], expected[1], expected[2]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Incorrect framebuffer color at pixel (" << x << " " << y
+                                               << "). Color is (" << fb[i + 0] / g_color_max[0] << " " << fb[i + 1] / g_color_max[1] << " "
+                                               << fb[i + 2] / g_color_max[2] << "Color should be (" << expected[0] << " " << expected[1] << " "
+                                               << expected[2] << ")." << tcu::TestLog::EndMessage;
                                        return false;
                                }
                        }
@@ -301,7 +277,8 @@ public:
                        glGetShaderInfoLog(shader, sizeof(log), &length, log);
                        if (length > 1)
                        {
-                               Output("Shader Info Log:\n%s\n", log);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                                       << log << tcu::TestLog::EndMessage;
                        }
                        return false;
                }
@@ -321,7 +298,8 @@ public:
                        glGetProgramInfoLog(program, sizeof(log), &length, log);
                        if (length > 1)
                        {
-                               Output("Program Info Log:\n%s\n", log);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                                       << log << tcu::TestLog::EndMessage;
                        }
                        return false;
                }
@@ -347,7 +325,8 @@ public:
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                return p;
                        }
                }
@@ -360,16 +339,19 @@ public:
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                return p;
                        }
                }
                if (!LinkProgram(p))
                {
                        if (src_vs)
-                               Output("%s%s\n", hvs.c_str(), src_vs);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << kGLSLVer << src_vs << tcu::TestLog::EndMessage;
                        if (src_fs)
-                               Output("%s%s\n", hfs.c_str(), src_fs);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << kGLSLVer << src_fs << tcu::TestLog::EndMessage;
                        return p;
                }
 
@@ -392,14 +374,15 @@ public:
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                return p;
                        }
                }
                if (!LinkProgram(p))
                {
                        if (!cs.empty())
-                               Output("%s%s\n", hcs.c_str(), cs.c_str());
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << hcs << cs << tcu::TestLog::EndMessage;
                        return p;
                }
 
@@ -416,7 +399,10 @@ public:
                {
                        GLchar log[1024];
                        glGetProgramInfoLog(p, sizeof(log), NULL, log);
-                       Output("Program Info Log:\n%s\n%s\n%s\n%s\n", log, src3[0], src3[1], src3[2]);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                               << src3[0] << "\n"
+                                                                                               << src3[1] << "\n"
+                                                                                               << src3[2] << tcu::TestLog::EndMessage;
                }
                return p;
        }
@@ -568,14 +554,16 @@ public:
                glGetIntegeri_v(GL_IMAGE_BINDING_NAME, unit, &i);
                if (static_cast<GLuint>(i) != texture)
                {
-                       Output("GL_IMAGE_BINDING_NAME is %d should be %d.\n", i, texture);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_NAME is " << i
+                                                                                               << " should be " << texture << tcu::TestLog::EndMessage;
                        return false;
                }
 
                glGetIntegeri_v(GL_IMAGE_BINDING_LEVEL, unit, &i);
                if (i != level)
                {
-                       Output("GL_IMAGE_BINDING_LEVEL is %d should be %d.\n", i, level);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_LEVEL is " << i
+                                                                                               << " should be " << level << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -583,28 +571,32 @@ public:
                glGetBooleani_v(GL_IMAGE_BINDING_LAYERED, unit, &b);
                if (i != layered || b != layered)
                {
-                       Output("GL_IMAGE_BINDING_LAYERED is %d should be %d.\n", i, layered);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_LAYERED is " << i
+                                                                                               << " should be " << layered << tcu::TestLog::EndMessage;
                        return false;
                }
 
                glGetIntegeri_v(GL_IMAGE_BINDING_LAYER, unit, &i);
                if (i != layer)
                {
-                       Output("GL_IMAGE_BINDING_LAYER is %d should be %d.\n", i, layer);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_LAYER is " << i
+                                                                                               << " should be " << layer << tcu::TestLog::EndMessage;
                        return false;
                }
 
                glGetIntegeri_v(GL_IMAGE_BINDING_ACCESS, unit, &i);
                if (static_cast<GLenum>(i) != access)
                {
-                       Output("GL_IMAGE_BINDING_ACCESS is %d should be %d.\n", i, access);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_ACCESS is " << i
+                                                                                               << " should be " << access << tcu::TestLog::EndMessage;
                        return false;
                }
 
                glGetIntegeri_v(GL_IMAGE_BINDING_FORMAT, unit, &i);
                if (static_cast<GLenum>(i) != format)
                {
-                       Output("GL_IMAGE_BINDING_FORMAT is %d should be %d.\n", i, format);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_IMAGE_BINDING_FORMAT is " << i
+                                                                                               << " should be " << format << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -846,32 +838,43 @@ class BasicAPIGet : public ShaderImageLoadStoreBase
        {
                if (!CheckMax(GL_MAX_IMAGE_UNITS, 4))
                {
-                       Output("GL_MAX_IMAGE_UNITS value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_IMAGE_UNITS value is invalid." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (!CheckMax(GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES, 4))
                {
-                       Output("GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES value is invalid."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (!CheckMax(GL_MAX_VERTEX_IMAGE_UNIFORMS, 0))
                {
-                       Output("GL_MAX_VERTEX_IMAGE_UNIFORMS value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_VERTEX_IMAGE_UNIFORMS value is invalid."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (!CheckMax(GL_MAX_FRAGMENT_IMAGE_UNIFORMS, 0))
                {
-                       Output("GL_MAX_FRAGMENT_IMAGE_UNIFORMS value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_FRAGMENT_IMAGE_UNIFORMS value is invalid."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (!CheckMax(GL_MAX_COMBINED_IMAGE_UNIFORMS, 4))
                {
-                       Output("GL_MAX_COMBINED_IMAGE_UNIFORMS value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_COMBINED_IMAGE_UNIFORMS value is invalid."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                if (!CheckMax(GL_MAX_COMPUTE_IMAGE_UNIFORMS, 4))
                {
-                       Output("GL_MAX_COMPUTE_IMAGE_UNIFORMS value is invalid.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_MAX_COMPUTE_IMAGE_UNIFORMS value is invalid."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -896,7 +899,8 @@ class BasicAPIBind : public ShaderImageLoadStoreBase
                {
                        if (!CheckBinding(index, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R32UI))
                        {
-                               Output("Binding point %d has invalid default state.\n", index);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Binding point " << index
+                                                                                                       << " has invalid default state." << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -931,7 +935,9 @@ class BasicAPIBind : public ShaderImageLoadStoreBase
                        glGetIntegeri_v(GL_IMAGE_BINDING_NAME, index, &name);
                        if (name != 0)
                        {
-                               Output("Binding point %d should be set to 0 after texture deletion.\n", index);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Binding point " << index
+                                       << " should be set to 0 after texture deletion." << tcu::TestLog::EndMessage;
                                status = false;
                        }
                        if (!CheckBinding(index, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R32UI))
@@ -1023,15 +1029,19 @@ class BasicAPITexParam : public ShaderImageLoadStoreBase
                glGetTexParameteriv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &i);
                if (i != GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE)
                {
-                       Output("GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should equal to "
-                                  "GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE for textures allocated by the GL.");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should equal to "
+                                                                                       "GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE for textures allocated by the GL."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetTexParameterfv(GL_TEXTURE_2D, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE, &f);
                if (static_cast<GLenum>(f) != GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE)
                {
-                       Output("GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should equal to "
-                                  "GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE for textures allocated by the GL.");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_IMAGE_FORMAT_COMPATIBILITY_TYPE should equal to "
+                                                                                       "GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE for textures allocated by the GL."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -1139,9 +1149,11 @@ class BasicAllFormatsStoreFS : public ShaderImageLoadStoreBase
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s. Format is: %s. Unit is: %d.\n", i,
-                                          ToString(map_data[i]).c_str(), ToString(expected_value).c_str(),
-                                          FormatEnumToString(internalformat).c_str(), unit);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value)
+                                       << ". Format is: " << FormatEnumToString(internalformat) << ". Unit is: " << unit
+                                       << tcu::TestLog::EndMessage;
                                glDeleteTextures(1, &texture);
                                glUseProgram(0);
                                glDeleteProgram(program);
@@ -1263,9 +1275,11 @@ class BasicAllFormatsStoreCS : public ShaderImageLoadStoreBase
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s. Format is: %s. Unit is: %d.\n", i,
-                                          ToString(map_data[i]).c_str(), ToString(expected_value).c_str(),
-                                          FormatEnumToString(internalformat).c_str(), unit);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value)
+                                       << ". Format is: " << FormatEnumToString(internalformat) << ". Unit is: " << unit
+                                       << tcu::TestLog::EndMessage;
                                glDeleteTextures(1, &texture);
                                glUseProgram(0);
                                glDeleteProgram(program);
@@ -1421,9 +1435,11 @@ class BasicAllFormatsLoadFS : public ShaderImageLoadStoreBase
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s. Format is: %s. Unit is: %d.\n", i,
-                                          ToString(map_data[i]).c_str(), ToString(expected_value).c_str(),
-                                          FormatEnumToString(internalformat).c_str(), unit);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value)
+                                       << ". Format is: " << FormatEnumToString(internalformat) << ". Unit is: " << unit
+                                       << tcu::TestLog::EndMessage;
                                glUseProgram(0);
                                glDeleteProgram(program);
                                glDeleteTextures(1, &texture);
@@ -1557,9 +1573,11 @@ class BasicAllFormatsLoadCS : public ShaderImageLoadStoreBase
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s. Format is: %s. Unit is: %d.\n", i,
-                                          ToString(map_data[i]).c_str(), ToString(expected_value).c_str(),
-                                          FormatEnumToString(internalformat).c_str(), unit);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value)
+                                       << ". Format is: " << FormatEnumToString(internalformat) << ". Unit is: " << unit
+                                       << tcu::TestLog::EndMessage;
                                glUseProgram(0);
                                glDeleteProgram(program);
                                glDeleteTextures(1, &texture);
@@ -1674,8 +1692,10 @@ class BasicAllFormatsLoadStoreComputeStage : public ShaderImageLoadStoreBase
                {
                        if (!Equal(map_data[i], expected_value, internalformat))
                        {
-                               Output("[%d] Value is: %s. Value should be: %s. Format is: %s.\n", i, ToString(map_data[i]).c_str(),
-                                          ToString(expected_value).c_str(), FormatEnumToString(internalformat).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[i])
+                                       << ". Value should be: " << ToString(expected_value)
+                                       << ". Format is: " << FormatEnumToString(internalformat) << tcu::TestLog::EndMessage;
                                glDeleteTextures(2, texture);
                                glUseProgram(0);
                                glDeleteProgram(program);
@@ -1870,7 +1890,9 @@ class BasicAllTargetsStoreFS : public ShaderImageLoadStoreBase
                        layers = 6;
                status   = CompareValues(map_data, kSize, expected_value, internalformat, layers);
                if (!status)
-                       Output("%d target, %s format failed. \n", target, FormatEnumToString(internalformat).c_str());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << target << " target, " << FormatEnumToString(internalformat)
+                               << ". format failed." << tcu::TestLog::EndMessage;
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
 
                glDeleteTextures(8, textures);
@@ -2107,7 +2129,9 @@ class BasicAllTargetsStoreCS : public ShaderImageLoadStoreBase
                        layers = 6;
                status   = CompareValues(map_data, kSize, expected_value, internalformat, layers);
                if (!status)
-                       Output("%d target, %s format failed. \n", target, FormatEnumToString(internalformat).c_str());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << target << " target, " << FormatEnumToString(internalformat)
+                               << ". format failed." << tcu::TestLog::EndMessage;
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
 
                glDeleteTextures(8, textures);
@@ -2359,7 +2383,9 @@ class BasicAllTargetsLoadFS : public ShaderImageLoadStoreBase
                        layers = 6;
                status   = CompareValues(map_data, kSize, expected_value, internalformat, layers);
                if (!status)
-                       Output("%d target, %s format failed. \n", target, FormatEnumToString(internalformat).c_str());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << target << " target, " << FormatEnumToString(internalformat)
+                               << ". format failed." << tcu::TestLog::EndMessage;
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
 
                glUseProgram(0);
@@ -2570,7 +2596,9 @@ class BasicAllTargetsLoadCS : public ShaderImageLoadStoreBase
                        layers = 6;
                status   = CompareValues(map_data, kSize, expected_value, internalformat, layers);
                if (!status)
-                       Output("%d target, %s format failed. \n", target, FormatEnumToString(internalformat).c_str());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << target << " target, " << FormatEnumToString(internalformat)
+                               << ". format failed." << tcu::TestLog::EndMessage;
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
 
                glUseProgram(0);
@@ -2769,8 +2797,10 @@ class BasicAllTargetsAtomicFS : public ShaderImageLoadStoreBase
                        if (!Equal(out_data[i], ivec4(10, 10, 10, 10), 0))
                        {
                                status = false;
-                               Output("[%d] Atomic operation check failed. (operation/target coded: %s) \n", i,
-                                          ToString(out_data[i]).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i
+                                       << "] Atomic operation check failed. (operation/target coded: " << ToString(out_data[i]) << ")"
+                                       << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -2950,7 +2980,9 @@ class LoadStoreMachine : public ShaderImageLoadStoreBase
                        if (!Equal(out_data[i], ivec4(0, 1, 0, 1), 0))
                        {
                                status = false;
-                               Output("[%d] load/store operation check failed. (%s) \n", i, ToString(out_data[i]).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] load/store operation check failed. ("
+                                       << ToString(out_data[i]) << ")" << tcu::TestLog::EndMessage;
                        }
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -3182,7 +3214,9 @@ class AtomicMachine : public ShaderImageLoadStoreBase
                        if (!Equal(out_data[i], ivec4(0, 1, 0, 1), 0))
                        {
                                status = false;
-                               Output("[%d] Atomic operation check failed. (%s) \n", i, ToString(out_data[i]).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Atomic operation check failed. ("
+                                       << ToString(out_data[i]) << ")" << tcu::TestLog::EndMessage;
                        }
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -3435,8 +3469,9 @@ class BasicGLSLMiscFS : public ShaderImageLoadStoreBase
                        if (!Equal(out_data[i], ivec4(5, 0, 0, 2), 0))
                        {
                                status = false;
-                               Output("[%d] Check failed. Received: %s instead of: %s \n", i, ToString(out_data[i]).c_str(),
-                                          ToString(ivec4(5, 0, 0, 2)).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Check failed. Received: " << ToString(out_data[i])
+                                       << " instead of: " << ToString(ivec4(5, 0, 0, 2)) << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -3516,8 +3551,9 @@ class BasicGLSLMiscCS : public ShaderImageLoadStoreBase
                        if (!Equal(out_data[i], ivec4(5, 0, 0, 2), 0))
                        {
                                status = false;
-                               Output("[%d] Check failed. Received: %s instead of: %s \n", i, ToString(out_data[i]).c_str(),
-                                          ToString(ivec4(5, 0, 0, 2)).c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "[" << i << "] Check failed. Received: " << ToString(out_data[i])
+                                       << " instead of: " << ToString(ivec4(5, 0, 0, 2)) << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -3744,8 +3780,9 @@ class BasicGLSLConst : public ShaderImageLoadStoreBase
 
                if (!Equal(map_data[0], ivec4(0, 1, 0, 1), 0))
                {
-                       Output("[%d] Value is: %s. Value should be: %s.\n", i, ToString(map_data[0]).c_str(),
-                                  ToString(ivec4(0, 1, 0, 1)).c_str());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "[" << i << "] Value is: " << ToString(map_data[0])
+                               << ". Value should be: " << ToString(ivec4(0, 1, 0, 1)) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -5010,7 +5047,10 @@ class NegativeUniform : public ShaderImageLoadStoreBase
 
                if (!status)
                {
-                       Output("glUniform* should generate INVALID_OPERATION if the location refers to an image variable.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "glUniform* should generate INVALID_OPERATION if the location refers to an image variable."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -5030,8 +5070,10 @@ class NegativeUniform : public ShaderImageLoadStoreBase
 
                if (!status)
                {
-                       Output(
-                               "glProgramUniform* should generate INVALID_OPERATION if the location refers to an image variable.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "glProgramUniform* should generate INVALID_OPERATION if the location refers to an image variable."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -5070,37 +5112,52 @@ class NegativeBind : public ShaderImageLoadStoreBase
                glBindImageTexture(max_image_units, m_texture, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("BindImageTexture should generate INVALID_VALUE if <unit> is greater than or equal to the value of "
-                                  "MAX_IMAGE_UNITS.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_VALUE if <unit> is greater than or equal to the value of "
+                                  "MAX_IMAGE_UNITS."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindImageTexture(0, 123, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("BindImageTexture should generate INVALID_VALUE if <texture> is not the name of an existing texture "
-                                  "object.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_VALUE if <texture> is not the name of an existing texture "
+                                  "object."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindImageTexture(1, m_texture, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("BindImageTexture should generate INVALID_VALUE if <format> is not a legal format.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_VALUE if <format> is not a legal format."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindImageTexture(1, m_texture, -1, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("BindImageTexture should generate INVALID_VALUE if <level> is less than zero.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_VALUE if <level> is less than zero."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindImageTexture(1, m_texture, 0, GL_FALSE, -1, GL_READ_ONLY, GL_RGBA32F);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("BindImageTexture should generate INVALID_VALUE if <layer> is less than zero.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_VALUE if <layer> is less than zero."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -5109,7 +5166,10 @@ class NegativeBind : public ShaderImageLoadStoreBase
                glBindImageTexture(1, m_texture2, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA32F);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("BindImageTexture should generate INVALID_OPERATION if <texture> is a mutable texture object.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "BindImageTexture should generate INVALID_OPERATION if <texture> is a mutable texture object."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -5206,7 +5266,8 @@ class NegativeCompileErrors : public ShaderImageLoadStoreBase
 
                GLchar log[1024];
                glGetShaderInfoLog(sh, sizeof(log), NULL, log);
-               Output("Shader Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                GLint status;
                glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
@@ -5214,7 +5275,8 @@ class NegativeCompileErrors : public ShaderImageLoadStoreBase
 
                if (status == GL_TRUE)
                {
-                       Output("Compilation should fail [compute shader].\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Compilation should fail [compute shader]." << tcu::TestLog::EndMessage;
                        return false;
                }
                const char* const fsVer   = "#version 310 es" NL "precision highp float;";
@@ -5224,14 +5286,16 @@ class NegativeCompileErrors : public ShaderImageLoadStoreBase
                glCompileShader(fsh);
 
                glGetShaderInfoLog(fsh, sizeof(log), NULL, log);
-               Output("Shader Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                glGetShaderiv(fsh, GL_COMPILE_STATUS, &status);
                glDeleteShader(fsh);
 
                if (status == GL_TRUE)
                {
-                       Output("Compilation should fail [fragment shader].\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Compilation should fail [fragment shader]." << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -5293,14 +5357,16 @@ class NegativeLinkErrors : public ShaderImageLoadStoreBase
                if (status == GL_FALSE)
                {
                        glDeleteProgram(p);
-                       Output("VS compilation should be ok.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "VS compilation should be ok." << tcu::TestLog::EndMessage;
                        return false;
                }
                glGetShaderiv(fsh, GL_COMPILE_STATUS, &status);
                if (status == GL_FALSE)
                {
                        glDeleteProgram(p);
-                       Output("FS compilation should be ok.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "FS compilation should be ok." << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -5308,14 +5374,16 @@ class NegativeLinkErrors : public ShaderImageLoadStoreBase
 
                GLchar log[1024];
                glGetProgramInfoLog(p, sizeof(log), NULL, log);
-               Output("Program Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                glGetProgramiv(p, GL_LINK_STATUS, &status);
                glDeleteProgram(p);
 
                if (status == GL_TRUE)
                {
-                       Output("Link operation should fail.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Link operation should fail." << tcu::TestLog::EndMessage;
                        return false;
                }
                return true;
@@ -5336,7 +5404,6 @@ ShaderImageLoadStoreTests::~ShaderImageLoadStoreTests(void)
 void ShaderImageLoadStoreTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "basic-api-get", TestSubcase::Create<BasicAPIGet>));
        addChild(new TestSubcase(m_context, "basic-api-bind", TestSubcase::Create<BasicAPIBind>));
        addChild(new TestSubcase(m_context, "basic-api-barrier", TestSubcase::Create<BasicAPIBarrier>));
index 0a612d5..70192bc 100644 (file)
@@ -42,32 +42,6 @@ typedef tcu::Vec4  vec4;
 typedef tcu::IVec4 ivec4;
 typedef tcu::UVec4 uvec4;
 
-static tcu::TestLog* currentLog;
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 const char* const kGLSLVer =
        "#version 310 es\n" NL "precision highp float;" NL "precision highp int;" NL "precision highp image2D;" NL
        "precision highp image3D;" NL "precision highp imageCube;" NL "precision highp image2DArray;" NL
@@ -219,32 +193,39 @@ class ImageSizeMachine : public glcts::GLWrapper
                                        switch (type)
                                        {
                                        case GL_VERTEX_SHADER:
-                                               Output("*** Vertex Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Vertex Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_FRAGMENT_SHADER:
-                                               Output("*** Fragment Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Fragment Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_COMPUTE_SHADER:
-                                               Output("*** Compute Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Compute Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        default:
-                                               Output("*** Unknown Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Unknown Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        }
+
                                        GLint length;
                                        glGetShaderiv(shaders[i], GL_SHADER_SOURCE_LENGTH, &length);
                                        if (length > 0)
                                        {
                                                std::vector<GLchar> source(length);
                                                glGetShaderSource(shaders[i], length, NULL, &source[0]);
-                                               Output("%s\n", &source[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &source[0] << tcu::TestLog::EndMessage;
                                        }
                                        glGetShaderiv(shaders[i], GL_INFO_LOG_LENGTH, &length);
                                        if (length > 0)
                                        {
                                                std::vector<GLchar> log(length);
                                                glGetShaderInfoLog(shaders[i], length, NULL, &log[0]);
-                                               Output("%s\n", &log[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                                        }
                                }
                        }
@@ -254,7 +235,7 @@ class ImageSizeMachine : public glcts::GLWrapper
                        {
                                std::vector<GLchar> log(length);
                                glGetProgramInfoLog(program, length, NULL, &log[0]);
-                               Output("%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                        }
                }
                return status == GL_TRUE ? true : false;
@@ -273,7 +254,8 @@ class ImageSizeMachine : public glcts::GLWrapper
                        glGetShaderInfoLog(shader, sizeof(log), &length, log);
                        if (length > 1)
                        {
-                               Output("Shader Info Log:\n%s\n", log);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                                       << log << tcu::TestLog::EndMessage;
                        }
                        return false;
                }
@@ -293,7 +275,8 @@ class ImageSizeMachine : public glcts::GLWrapper
                        glGetProgramInfoLog(program, sizeof(log), &length, log);
                        if (length > 1)
                        {
-                               Output("Program Info Log:\n%s\n", log);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                                       << log << tcu::TestLog::EndMessage;
                        }
                        return false;
                }
@@ -313,14 +296,16 @@ class ImageSizeMachine : public glcts::GLWrapper
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                return p;
                        }
                }
                if (!LinkProgram(p))
                {
                        if (!cs.empty())
-                               Output("%s%s\n", kGLSLVer, cs.c_str());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << kGLSLVer << cs << tcu::TestLog::EndMessage;
                        return p;
                }
 
@@ -340,7 +325,8 @@ class ImageSizeMachine : public glcts::GLWrapper
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                if (result)
                                        *result = false;
                                return p;
@@ -355,7 +341,8 @@ class ImageSizeMachine : public glcts::GLWrapper
                        glShaderSource(sh, 2, src, NULL);
                        if (!CompileShader(sh))
                        {
-                               Output("%s%s\n", src[0], src[1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << src[0] << src[1] << tcu::TestLog::EndMessage;
                                if (result)
                                        *result = false;
                                return p;
@@ -366,9 +353,11 @@ class ImageSizeMachine : public glcts::GLWrapper
                if (!LinkProgram(p))
                {
                        if (src_vs)
-                               Output("%s%s\n", kGLSLVer, src_vs);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << kGLSLVer << src_vs << tcu::TestLog::EndMessage;
                        if (src_fs)
-                               Output("%s%s\n", kGLSLVer, src_fs);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << kGLSLVer << src_fs << tcu::TestLog::EndMessage;
                        if (result)
                                *result = false;
                        return p;
@@ -558,9 +547,11 @@ public:
                {
                        if (!Equal(map_data[i], expected_result[i]))
                        {
-                               Output("Returned value is: (%d %d %d %d). Expected value is: (%d %d %d %d). Image unit is: %d.\n",
-                                          map_data[i][0], map_data[i][1], map_data[i][2], map_data[i][3], expected_result[i][0],
-                                          expected_result[i][1], expected_result[i][2], expected_result[i][3], i);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Returned value is: (" << map_data[i][0] << " " << map_data[i][1] << " "
+                                       << map_data[i][2] << " " << map_data[i][3] << "). Expected value is: (" << expected_result[i][0]
+                                       << " " << expected_result[i][1] << " " << expected_result[i][2] << " " << expected_result[i][3]
+                                       << "). Image unit is: " << i << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -727,7 +718,8 @@ class NegativeCompileTime : public ShaderImageSizeBase
 
                GLchar log[1024];
                glGetShaderInfoLog(sh, sizeof(log), NULL, log);
-               Output("Shader Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                GLint status;
                glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
@@ -735,7 +727,8 @@ class NegativeCompileTime : public ShaderImageSizeBase
 
                if (status == GL_TRUE)
                {
-                       Output("Compilation should fail.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Compilation should fail." << tcu::TestLog::EndMessage;
                        return false;
                }
                return true;
@@ -755,7 +748,6 @@ ShaderImageSizeTests::~ShaderImageSizeTests(void)
 void ShaderImageSizeTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "basic-nonMS-vs-float", TestSubcase::Create<BasicNonMS<vec4, 0> >));
        addChild(new TestSubcase(m_context, "basic-nonMS-vs-int", TestSubcase::Create<BasicNonMS<ivec4, 0> >));
        addChild(new TestSubcase(m_context, "basic-nonMS-vs-uint", TestSubcase::Create<BasicNonMS<uvec4, 0> >));
index 7e07955..cece92e 100644 (file)
@@ -71,32 +71,6 @@ enum BindingSeq
        bindrangesize
 };
 
-static tcu::TestLog* currentLog;
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 const char* const kGLSLVer = "#version 310 es" NL "precision highp float;" NL "precision highp int;";
 
 class ShaderStorageBufferObjectBase : public glcts::SubcaseBase
@@ -175,16 +149,16 @@ public:
                                        switch (type)
                                        {
                                        case GL_VERTEX_SHADER:
-                                               Output("*** Vertex Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Vertex Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_FRAGMENT_SHADER:
-                                               Output("*** Fragment Shader ***\n");
-                                               break;
-                                       case GL_COMPUTE_SHADER:
-                                               Output("*** Compute Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Fragment Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        default:
-                                               Output("*** Unknown Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Unknown Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        }
                                        GLint length;
@@ -193,14 +167,16 @@ public:
                                        {
                                                std::vector<GLchar> source(length);
                                                glGetShaderSource(shaders[i], length, NULL, &source[0]);
-                                               Output("%s\n", &source[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &source[0] << tcu::TestLog::EndMessage;
                                        }
                                        glGetShaderiv(shaders[i], GL_INFO_LOG_LENGTH, &length);
                                        if (length > 0)
                                        {
                                                std::vector<GLchar> log(length);
                                                glGetShaderInfoLog(shaders[i], length, NULL, &log[0]);
-                                               Output("%s\n", &log[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                                        }
                                }
                        }
@@ -210,7 +186,7 @@ public:
                        {
                                std::vector<GLchar> log(length);
                                glGetProgramInfoLog(program, length, NULL, &log[0]);
-                               Output("%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -276,11 +252,11 @@ public:
                        status = false;
 
                if (!status)
-                       Output("Incorrect framebuffer color at pixel (%d %d). Color is (%f %f %f). "
-                                  "Color should be (%f %f %f).\n",
-                                  x, y, c0[0] / color_max[0], c0[1] / color_max[1], c0[2] / color_max[2], expected[0], expected[1],
-                                  expected[2]);
-
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Incorrect framebuffer color at pixel (" << x << " " << y << "). Color is ("
+                               << c0[0] / color_max[0] << " " << c0[1] / color_max[1] << " " << c0[2] / color_max[2]
+                               << "). Color should be (" << expected[0] << " " << expected[1] << " " << expected[2] << ")."
+                               << tcu::TestLog::EndMessage;
                return status;
        }
 
@@ -303,11 +279,11 @@ public:
                                        fabs(fb[i + 1] / g_color_max[1] - expected[1]) > g_color_eps[1] ||
                                        fabs(fb[i + 2] / g_color_max[2] - expected[2]) > g_color_eps[2])
                                {
-
-                                       Output("Incorrect framebuffer color at pixel (%d %d). Color is (%f %f %f). "
-                                                  "Color should be (%f %f %f).\n",
-                                                  x, y, fb[i + 0] / g_color_max[0], fb[i + 1] / g_color_max[1], fb[i + 2] / g_color_max[2],
-                                                  expected[0], expected[1], expected[2]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Incorrect framebuffer color at pixel (" << x << " " << y
+                                               << "). Color is (" << fb[0] / g_color_max[0] << " " << fb[1] / g_color_max[1] << " "
+                                               << fb[2] / g_color_max[2] << "). Color should be (" << expected[0] << " " << expected[1] << " "
+                                               << expected[2] << ")." << tcu::TestLog::EndMessage;
                                        return false;
                                }
                        }
@@ -346,7 +322,9 @@ public:
                }
                if (!status)
                {
-                       Output("Left-bottom quad checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Left-bottom quad checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
                // right-bottom quad
@@ -364,7 +342,9 @@ public:
                }
                if (!status)
                {
-                       Output("right-bottom quad checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Right-bottom quad checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
                // right-top quad
@@ -382,7 +362,9 @@ public:
                }
                if (!status)
                {
-                       Output("right-top quad checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Right-top quad checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
                // left-top quad
@@ -400,7 +382,9 @@ public:
                }
                if (!status)
                {
-                       Output("left-top quad checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Left-top quad checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
                // middle horizontal line should be black
@@ -418,7 +402,9 @@ public:
                }
                if (!status)
                {
-                       Output("middle horizontal line checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Middle horizontal line checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
                // middle vertical line should be black
@@ -436,13 +422,17 @@ public:
                }
                if (!status)
                {
-                       Output("middle vertical line checking failed. Bad pixels: %d", bad);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Middle vertical line checking failed. Bad pixels: " << bad
+                               << tcu::TestLog::EndMessage;
                        //return status;
                }
 
                if (bad_pixels)
                        *bad_pixels = bad;
-               Output("Bad pixels:%d, counted bad:%d\n", bad_pixels == NULL ? 0 : *bad_pixels, bad);
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << "Bad pixels: " << (bad_pixels == NULL ? 0 : *bad_pixels)
+                       << ", counted bad: " << bad << tcu::TestLog::EndMessage;
                return status;
        }
 
@@ -626,7 +616,9 @@ class BasicMax : public ShaderStorageBufferObjectBase
 
                        if (!status)
                        {
-                               Output("%s is %d should be at least %d.\n", GLenumToString(e), i, static_cast<GLint>(value));
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << GLenumToString(e) << " is " << i << " should be at least "
+                                       << static_cast<GLint>(value) << tcu::TestLog::EndMessage;
                        }
                }
                else
@@ -640,7 +632,9 @@ class BasicMax : public ShaderStorageBufferObjectBase
 
                        if (!status)
                        {
-                               Output("%s is %d should be at most %d.\n", GLenumToString(e), i, static_cast<GLint>(value));
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << GLenumToString(e) << " is " << i << " should be at most "
+                                       << static_cast<GLint>(value) << tcu::TestLog::EndMessage;
                        }
                }
                return status;
@@ -700,7 +694,8 @@ class BasicBinding : public ShaderStorageBufferObjectBase
 
                if (!status)
                {
-                       Output("%s is %d should be %d.\n", GLenumToString(e), i, expected);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << GLenumToString(e) << " is " << i
+                                                                                               << " should be " << expected << tcu::TestLog::EndMessage;
                }
                return status;
        }
@@ -721,7 +716,8 @@ class BasicBinding : public ShaderStorageBufferObjectBase
 
                if (!status)
                {
-                       Output("%s at index %d is %d should be %d.\n", GLenumToString(e), index, i, expected);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << GLenumToString(e) << " at index " << index
+                                                                                               << " is " << i << " should be " << expected << tcu::TestLog::EndMessage;
                }
                return status;
        }
@@ -1249,7 +1245,9 @@ class BasicStdLayoutBaseVS : public ShaderStorageBufferObjectBase
                {
                        if (in_data[i] != out_data[i])
                        {
-                               Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i], in_data[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                       << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[i]) << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -1318,7 +1316,9 @@ class BasicStdLayoutBaseCS : public ShaderStorageBufferObjectBase
                {
                        if (in_data[i] != out_data[i])
                        {
-                               Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i], in_data[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                       << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[i]) << tcu::TestLog::EndMessage;
                                status = false;
                        }
                        else
@@ -2269,7 +2269,8 @@ class BasicAtomicCase1VSFS : public ShaderStorageBufferObjectBase
                                {
                                        if (data[i] != 7)
                                        {
-                                               Output("uData at index %d is %d should be %d.\n", i, data[i], 7);
+                                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "uData at index " << i << " is "
+                                                                                                                       << data[i] << " should be 7." << tcu::TestLog::EndMessage;
                                                return ERROR;
                                        }
                                }
@@ -2285,7 +2286,8 @@ class BasicAtomicCase1VSFS : public ShaderStorageBufferObjectBase
                                {
                                        if (data[i] != 7)
                                        {
-                                               Output("iData at index %d is %d should be %d.\n", i, data[i], 7);
+                                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "iData at index " << i << " is "
+                                                                                                                       << data[i] << " should be 7." << tcu::TestLog::EndMessage;
                                                return ERROR;
                                        }
                                }
@@ -2372,7 +2374,8 @@ class BasicAtomicCase1CS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != 7)
                                {
-                                       Output("uData at index %d is %d should be %d.\n", i, data[i], 7);
+                                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "uData at index " << i << " is "
+                                                                                                               << data[i] << " should be 7." << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -2388,7 +2391,8 @@ class BasicAtomicCase1CS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != 7)
                                {
-                                       Output("iData at index %d is %d should be %d.\n", i, data[i], 7);
+                                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "iData at index " << i << " is "
+                                                                                                               << data[i] << " should be 7." << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -2493,7 +2497,8 @@ class BasicAtomicCase3VSFS : public ShaderStorageBufferObjectBase
                        return ERROR;
                if (*u != 16)
                {
-                       Output("Data at offset 0 is %d should be %d.\n", *u, 16);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Data at offset 0 is " << *u
+                                                                                               << " should be 16." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -2502,7 +2507,8 @@ class BasicAtomicCase3VSFS : public ShaderStorageBufferObjectBase
                        return ERROR;
                if (*i != 16)
                {
-                       Output("Data at offset 0 is %d should be %d.\n", *i, 16);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Data at offset 0 is " << *i
+                                                                                               << " should be 16." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -2571,7 +2577,8 @@ class BasicAtomicCase3CS : public ShaderStorageBufferObjectBase
                        return ERROR;
                if (*u != 16)
                {
-                       Output("Data at offset 0 is %d should be %d.\n", *u, 16);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Data at offset 0 is " << *u
+                                                                                               << " should be 16." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -2580,7 +2587,8 @@ class BasicAtomicCase3CS : public ShaderStorageBufferObjectBase
                        return ERROR;
                if (*i != 16)
                {
-                       Output("Data at offset 0 is %d should be %d.\n", *i, 16);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "Data at offset 0 is " << *i
+                                                                                               << " should be 16." << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -2685,7 +2693,8 @@ class BasicAtomicCase4VSFS : public ShaderStorageBufferObjectBase
                {
                        if (udata[i] != i)
                        {
-                               Output("uData at index %d is %d should be %d.\n", i, udata[i], i);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "uData at index " << i << " is "
+                                                                                                       << udata[i] << " should be " << i << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2697,7 +2706,8 @@ class BasicAtomicCase4VSFS : public ShaderStorageBufferObjectBase
                {
                        if (idata[i] != i)
                        {
-                               Output("iData at index %d is %d should be %d.\n", i, idata[i], i);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "iData at index " << i << " is "
+                                                                                                       << idata[i] << " should be " << i << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2768,7 +2778,8 @@ class BasicAtomicCase4CS : public ShaderStorageBufferObjectBase
                {
                        if (udata[i] != i)
                        {
-                               Output("uData at index %d is %d should be %d.\n", i, udata[i], i);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "uData at index " << i << " is "
+                                                                                                       << udata[i] << " should be " << i << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2780,7 +2791,8 @@ class BasicAtomicCase4CS : public ShaderStorageBufferObjectBase
                {
                        if (idata[i] != i)
                        {
-                               Output("iData at index %d is %d should be %d.\n", i, idata[i], i);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "iData at index " << i << " is "
+                                                                                                       << idata[i] << " should be " << i << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -2861,8 +2873,10 @@ class BasicStdLayoutBase2VS : public ShaderStorageBufferObjectBase
                        {
                                if (in_data[j][i] != out_data[i])
                                {
-                                       Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i],
-                                                  in_data[j][i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                               << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[j][i])
+                                               << tcu::TestLog::EndMessage;
                                        status = false;
                                }
                        }
@@ -2940,8 +2954,10 @@ class BasicStdLayoutBase2CS : public ShaderStorageBufferObjectBase
                        {
                                if (in_data[j][i] != out_data[i])
                                {
-                                       Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i],
-                                                  in_data[j][i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                               << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[j][i])
+                                               << tcu::TestLog::EndMessage;
                                        status = false;
                                }
                        }
@@ -3615,7 +3631,9 @@ class BasicOperationsBaseVS : public ShaderStorageBufferObjectBase
                {
                        if (expected_data[i] != out_data[i])
                        {
-                               Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i], expected_data[i]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i)
+                                                                                                       << " is " << tcu::toHex(out_data[i]) << " should be "
+                                                                                                       << tcu::toHex(expected_data[i]) << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -3692,7 +3710,9 @@ class BasicOperationsBaseCS : public ShaderStorageBufferObjectBase
                {
                        if (expected_data[i] != out_data[i])
                        {
-                               Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i], expected_data[i]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i)
+                                                                                                       << " is " << tcu::toHex(out_data[i]) << " should be "
+                                                                                                       << tcu::toHex(expected_data[i]) << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -4003,8 +4023,10 @@ class BasicStdLayoutBase3VS : public ShaderStorageBufferObjectBase
                        {
                                if (in_data[j][i] != out_data[i])
                                {
-                                       Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i],
-                                                  in_data[j][i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                               << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[j][i])
+                                               << tcu::TestLog::EndMessage;
                                        status = false;
                                }
                        }
@@ -4089,8 +4111,10 @@ class BasicStdLayoutBase3CS : public ShaderStorageBufferObjectBase
                        {
                                if (in_data[j][i] != out_data[i])
                                {
-                                       Output("Byte at index %3d is %2x should be %2x.\n", static_cast<int>(i), out_data[i],
-                                                  in_data[j][i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Byte at index " << static_cast<int>(i) << " is "
+                                               << tcu::toHex(out_data[i]) << " should be " << tcu::toHex(in_data[j][i])
+                                               << tcu::TestLog::EndMessage;
                                        status = false;
                                }
                        }
@@ -4408,7 +4432,9 @@ class BasicMatrixOperationsBaseVS : public ShaderStorageBufferObjectBase
                {
                        if (!Equal(expected[i], out_data[i]))
                        {
-                               Output("Float at index %3d is %f should be %f.\n", static_cast<int>(i), out_data[i], expected[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Float at index " << static_cast<int>(i) << " is " << out_data[i]
+                                       << " should be " << expected[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -4486,7 +4512,9 @@ class BasicMatrixOperationsBaseCS : public ShaderStorageBufferObjectBase
                {
                        if (!Equal(expected[i], out_data[i]))
                        {
-                               Output("Float at index %3d is %f should be %f.\n", static_cast<int>(i), out_data[i], expected[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Float at index " << static_cast<int>(i) << " is " << out_data[i]
+                                       << " should be " << expected[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -5049,8 +5077,10 @@ class AdvancedSwitchBuffersCS : public ShaderStorageBufferObjectBase
                if (out_data[0] != expected[0] || out_data[1] != expected[1] || out_data[2] != expected[2] ||
                        out_data[3] != expected[3])
                {
-                       Output("Received: %x, %x, %x, %x, but expected: %x, %x, %x, %x\n", out_data[0], out_data[1], out_data[2],
-                                  out_data[3], expected[0], expected[1], expected[2], expected[3]);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Received: " << out_data[0] << ", " << out_data[1] << ", " << out_data[2]
+                               << ", " << out_data[3] << ", but expected: " << expected[0] << ", " << expected[1] << ", "
+                               << expected[2] << ", " << expected[3] << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -5069,8 +5099,11 @@ class AdvancedSwitchBuffersCS : public ShaderStorageBufferObjectBase
                if (out_data[0] != expected[0] || out_data[1] != expected[1] || out_data[2] != expected[2] ||
                        out_data[3] != expected[3])
                {
-                       Output("Received: %x, %x, %x, %x, but expected: %x, %x, %x, %x\n", out_data[0], out_data[1], out_data[2],
-                                  out_data[3], expected[0], expected[1], expected[2], expected[3]);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Received: " << tcu::toHex(out_data[0]) << ", " << tcu::toHex(out_data[1])
+                               << ", " << tcu::toHex(out_data[2]) << ", " << tcu::toHex(out_data[3])
+                               << ", but expected: " << tcu::toHex(expected[0]) << ", " << tcu::toHex(expected[1]) << ", "
+                               << tcu::toHex(expected[2]) << ", " << tcu::toHex(expected[3]) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -5278,8 +5311,11 @@ class AdvancedSwitchProgramsCS : public ShaderStorageBufferObjectBase
                if (out_data[0] != expected[0] || out_data[1] != expected[1] || out_data[2] != expected[2] ||
                        out_data[3] != expected[3])
                {
-                       Output("Received: %x, %x, %x, %x, but expected: %x, %x, %x, %x\n", out_data[0], out_data[1], out_data[2],
-                                  out_data[3], expected[0], expected[1], expected[2], expected[3]);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Received: " << tcu::toHex(out_data[0]) << ", " << tcu::toHex(out_data[1])
+                               << ", " << tcu::toHex(out_data[2]) << ", " << tcu::toHex(out_data[3])
+                               << ", but expected: " << tcu::toHex(expected[0]) << ", " << tcu::toHex(expected[1]) << ", "
+                               << tcu::toHex(expected[2]) << ", " << tcu::toHex(expected[3]) << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -5794,8 +5830,10 @@ class AdvancedIndirectAddressingCase1CS : public ShaderStorageBufferObjectBase
                        if (out_data[i * 4 + 0] != expected[i * 4 + 0] || out_data[i * 4 + 1] != expected[i * 4 + 1] ||
                                out_data[i * 4 + 2] != expected[i * 4 + 2])
                        {
-                               Output("Received: %f, %f, %f, but expected: %f, %f, %f\n", out_data[i * 4 + 0], out_data[i * 4 + 1],
-                                          out_data[i * 4 + 2], expected[i * 4 + 0], expected[i * 4 + 1], expected[i * 4 + 2]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data[i * 4 + 0] << ", " << out_data[i * 4 + 1]
+                                       << ", " << out_data[i * 4 + 2] << ", but expected: " << expected[i * 4 + 0] << ", "
+                                       << expected[i * 4 + 1] << ", " << expected[i * 4 + 2] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -5804,8 +5842,10 @@ class AdvancedIndirectAddressingCase1CS : public ShaderStorageBufferObjectBase
                        if (fabs(out_data[i * 2 + 0] - expected[i * 2 + 0]) > 1e-6 ||
                                fabs(out_data[i * 2 + 1] - expected[i * 2 + 1]) > 1e-6)
                        {
-                               Output("Received: %f, %f, but expected: %f, %f\n", out_data[i * 2 + 0], out_data[i * 2 + 1],
-                                          expected[i * 2 + 0], expected[i * 2 + 1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data[i * 2 + 0] << ", " << out_data[i * 2 + 1]
+                                       << ", but expected: " << expected[i * 2 + 0] << ", " << expected[i * 2 + 1]
+                                       << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -5847,8 +5887,10 @@ class AdvancedIndirectAddressingCase1CS : public ShaderStorageBufferObjectBase
                        if (out_data2[i * 4 + 0] != expected2[i * 4 + 0] || out_data2[i * 4 + 1] != expected2[i * 4 + 1] ||
                                out_data2[i * 4 + 2] != expected2[i * 4 + 2])
                        {
-                               Output("Received: %f, %f, %f, but expected: %f, %f, %f\n", out_data2[i * 4 + 0], out_data2[i * 4 + 1],
-                                          out_data2[i * 4 + 2], expected2[i * 4 + 0], expected2[i * 4 + 1], expected2[i * 4 + 2]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data2[i * 4 + 0] << ", " << out_data2[i * 4 + 1]
+                                       << ", " << out_data2[i * 4 + 2] << ", but expected: " << expected2[i * 4 + 0] << ", "
+                                       << expected2[i * 4 + 1] << ", " << expected2[i * 4 + 2] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -5857,8 +5899,10 @@ class AdvancedIndirectAddressingCase1CS : public ShaderStorageBufferObjectBase
                        if (fabs(out_data2[i * 2 + 0] - expected2[i * 2 + 0]) > 1e-6 ||
                                fabs(out_data2[i * 2 + 1] - expected2[i * 2 + 1]) > 1e-6)
                        {
-                               Output("Received: %f, %f, but expected: %f, %f\n", out_data2[i * 2 + 0], out_data2[i * 2 + 1],
-                                          expected2[i * 2 + 0], expected2[i * 2 + 1]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data2[i * 2 + 0] << ", " << out_data2[i * 2 + 1]
+                                       << ", but expected: " << expected2[i * 2 + 0] << ", " << expected2[i * 2 + 1]
+                                       << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -6113,8 +6157,10 @@ class AdvancedIndirectAddressingCase2CS : public ShaderStorageBufferObjectBase
                        if (out_data[i * 4 + 0] != expected[0] || out_data[i * 4 + 1] != expected[1] ||
                                out_data[i * 4 + 2] != expected[2])
                        {
-                               Output("Received: %f, %f, %f, but expected: %f, %f, %f\n", out_data[i * 4 + 0], out_data[i * 4 + 1],
-                                          out_data[i * 4 + 2], expected[0], expected[1], expected[2]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data[i * 4 + 0] << ", " << out_data[i * 4 + 1]
+                                       << ", " << out_data[i * 4 + 2] << ", but expected: " << expected[0] << ", " << expected[1] << ", "
+                                       << expected[2] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -6131,8 +6177,10 @@ class AdvancedIndirectAddressingCase2CS : public ShaderStorageBufferObjectBase
                        if (out_data[i * 4 + 0] != expected[0] || out_data[i * 4 + 1] != expected[1] ||
                                out_data[i * 4 + 2] != expected[2])
                        {
-                               Output("Received: %f, %f, %f, but expected: %f, %f, %f\n", out_data[i * 4 + 0], out_data[i * 4 + 1],
-                                          out_data[i * 4 + 2], expected[0], expected[1], expected[2]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data[i * 4 + 0] << ", " << out_data[i * 4 + 1]
+                                       << ", " << out_data[i * 4 + 2] << ", but expected: " << expected[0] << ", " << expected[1] << ", "
+                                       << expected[2] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -6308,8 +6356,9 @@ class AdvancedReadWriteCase1CS : public ShaderStorageBufferObjectBase
                {
                        if (out_data[i * 4 + 3] != data[i * 4])
                        {
-                               Output("Received: %d, but expected: %d -> %d -> %d\n", out_data[i * 4 + 3], data[i * 4],
-                                          out_data[i * 4 + 1], out_data[i * 4 + 2]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Received: " << out_data[i * 4 + 3] << ", but expected: " << data[i * 4]
+                                       << " -> " << out_data[i * 4 + 1] << " -> " << out_data[i * 4 + 2] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -6332,7 +6381,8 @@ class AdvancedReadWriteCase1CS : public ShaderStorageBufferObjectBase
                {
                        if (out_data[i * 4 + 3] != data[i * 4])
                        {
-                               Output("Received: %d, but expected: %d\n", out_data[i * 4 + 3], data[i * 4]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Received: " << out_data[i * 4 + 3]
+                                                                                                       << ", but expected: " << data[i * 4] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -6592,7 +6642,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer0] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer0] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6609,7 +6661,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer1] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer1] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6626,7 +6680,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer2] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer2] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6643,7 +6699,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer3] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer3] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6660,7 +6718,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer4] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer4] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6677,7 +6737,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer5] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer5] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6694,7 +6756,9 @@ class AdvancedUsageSyncVSFS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer6] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer6] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6819,7 +6883,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer0] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer0] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6836,7 +6902,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer1] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer1] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6853,7 +6921,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer2] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer2] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6870,7 +6940,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer3] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer3] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6887,7 +6959,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer4] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer4] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6904,7 +6978,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer5] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer5] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -6921,7 +6997,9 @@ class AdvancedUsageSyncCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer6] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer6] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -7008,7 +7086,9 @@ class AdvancedUsageOperatorsVS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer0] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer0] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -7025,7 +7105,9 @@ class AdvancedUsageOperatorsVS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer1] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer1] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -7102,7 +7184,9 @@ class AdvancedUsageOperatorsCS : public ShaderStorageBufferObjectBase
                        {
                                if (data[i] != ref_data[i])
                                {
-                                       Output("[Buffer0] Data at index %d is %d should be %d.\n", i, data[i], ref_data[i]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "[Buffer0] Data at index " << i << " is " << data[i]
+                                               << " should be " << ref_data[i] << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -7248,12 +7332,16 @@ class AdvancedUnsizedArrayLength : public ShaderStorageBufferObjectBase
                for (int i = 0; i < kBufs - 1; ++i)
                        if (dataout[i + 1] != sizes[i])
                        {
-                               Output("Array %d length is %d should be %d.\n", i, dataout[i + 1], sizes[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Array " << i << " length is " << dataout[i + 1] << " should be "
+                                       << sizes[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                if (dataout[0] != sizes[kBufs - 1] - 1)
                {
-                       Output("Array %d length is %d should be %d.\n", kBufs - 1, dataout[0], sizes[kBufs - 1] - 1);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Array " << (kBufs - 1) << " length is " << dataout[0] << " should be "
+                               << (sizes[kBufs - 1] - 1) << tcu::TestLog::EndMessage;
                        status = false;
                }
                glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -7501,12 +7589,16 @@ class AdvancedUnsizedArrayLength2 : public ShaderStorageBufferObjectBase
                                sizes[i] -= 2; // space constrained by offset of range size
                        if ((layout == std140 || layout == std430) && dataout[i] != sizes[i])
                        {
-                               Output("Array %d length is %d should be %d.\n", i, dataout[i], sizes[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Array " << i << " length is " << dataout[i] << " should be "
+                                       << sizes[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                        if ((layout == packed || layout == shared) && (dataout[i] > sizes[i]))
                        {
-                               Output("Array %d length is %d should be not greater that %d.\n", i, dataout[i], sizes[i]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Array " << i << " length is " << dataout[i]
+                                       << " should be not greater that " << sizes[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -7521,7 +7613,8 @@ class AdvancedUnsizedArrayLength2 : public ShaderStorageBufferObjectBase
                        int i = (sizes[4] - 2) * columns[etype][4] * scalars[etype][4];
                        if (dataout[i] != 82)
                        {
-                               Output("Array 4 index %d is %d should be 82.\n", i, dataout[i]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Array 4 index " << i << " is "
+                                                                                                       << dataout[i] << " should be 82" << tcu::TestLog::EndMessage;
                                status = false;
                        }
                        glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -7532,7 +7625,8 @@ class AdvancedUnsizedArrayLength2 : public ShaderStorageBufferObjectBase
                        i = (sizes[6] - 2) * columns[etype][6] * scalars[etype][6];
                        if (dataout[i] != 82)
                        {
-                               Output("Array 6 index %d is %d should be 82.\n", i, dataout[i]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Array 6 index " << i << " is "
+                                                                                                       << dataout[i] << " should be 82" << tcu::TestLog::EndMessage;
                                status = false;
                        }
                        glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
@@ -8013,7 +8107,8 @@ class AdvancedMatrixCS : public ShaderStorageBufferObjectBase
                {
                        if (out_data[i] != expected[i])
                        {
-                               Output("Received: %f, but expected: %f\n", out_data[i], expected[i]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Received: " << out_data[i]
+                                                                                                       << ", but expected: " << expected[i] << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -8043,25 +8138,33 @@ class NegativeAPIBind : public ShaderStorageBufferObjectBase
                GLint  alignment;
                GLuint buffer;
                glGetIntegerv(GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS, &bindings);
-               Output("Max storage buffer bindings %d\n", bindings);
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << "Max storage buffer bindings " << bindings << tcu::TestLog::EndMessage;
                glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &alignment);
-               Output("Storage buffer offset alignment %d\n", alignment);
+               m_context.getTestContext().getLog()
+                       << tcu::TestLog::Message << "Storage buffer offset alignment " << alignment << tcu::TestLog::EndMessage;
 
                glBindBufferBase(GL_SHADER_STORAGE_BUFFER, bindings, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE is generated by BindBufferBase if <target> is\n"
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE is generated by BindBufferBase if <target> is\n"
                                   "SHADER_STORAGE_BUFFER and <index> is greater than or equal to the value of\n"
-                                  "MAX_SHADER_STORAGE_BUFFER_BINDINGS.\n");
+                                  "MAX_SHADER_STORAGE_BUFFER_BINDINGS."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindBufferRange(GL_SHADER_STORAGE_BUFFER, bindings, 0, 0, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE is generated by BindBufferRange if <target> is\n"
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE is generated by BindBufferRange if <target> is\n"
                                   "SHADER_STORAGE_BUFFER and <index> is greater than or equal to the value of\n"
-                                  "MAX_SHADER_STORAGE_BUFFER_BINDINGS.\n");
+                                  "MAX_SHADER_STORAGE_BUFFER_BINDINGS."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -8069,9 +8172,11 @@ class NegativeAPIBind : public ShaderStorageBufferObjectBase
                glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 0, buffer, alignment - 1, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE is generated by BindBufferRange if <target> is\n"
-                                  "SHADER_STORAGE_BUFFER and <offset> is not a multiple of the value of\n"
-                                  "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE is generated by BindBufferRange if <target> is\n"
+                                                                                       "SHADER_STORAGE_BUFFER and <offset> is not a multiple of the value of\n"
+                                                                                       "SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -8209,7 +8314,8 @@ class NegativeGLSLCompileTime : public ShaderStorageBufferObjectBase
 
                GLchar log[1024];
                glGetShaderInfoLog(sh, sizeof(log), NULL, log);
-               Output("Shader Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Shader Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                GLint status;
                glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
@@ -8217,7 +8323,8 @@ class NegativeGLSLCompileTime : public ShaderStorageBufferObjectBase
 
                if (status == GL_TRUE)
                {
-                       Output("Compilation should fail.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Compilation should fail." << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -8274,7 +8381,8 @@ class NegativeGLSLLinkTime : public ShaderStorageBufferObjectBase
                        glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
                        if (status == GL_FALSE)
                        {
-                               Output("VS compilation should be ok.\n");
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "VS compilation should be ok." << tcu::TestLog::EndMessage;
                                CheckProgram(p);
                                glDeleteProgram(p);
                                return false;
@@ -8293,7 +8401,8 @@ class NegativeGLSLLinkTime : public ShaderStorageBufferObjectBase
                        glGetShaderiv(sh, GL_COMPILE_STATUS, &status);
                        if (status == GL_FALSE)
                        {
-                               Output("FS compilation should be ok.\n");
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "FS compilation should be ok." << tcu::TestLog::EndMessage;
                                CheckProgram(p);
                                glDeleteProgram(p);
                                return false;
@@ -8304,7 +8413,8 @@ class NegativeGLSLLinkTime : public ShaderStorageBufferObjectBase
 
                GLchar log[1024];
                glGetProgramInfoLog(p, sizeof(log), NULL, log);
-               Output("Program Info Log:\n%s\n", log);
+               m_context.getTestContext().getLog() << tcu::TestLog::Message << "Program Info Log:\n"
+                                                                                       << log << tcu::TestLog::EndMessage;
 
                GLint status;
                glGetProgramiv(p, GL_LINK_STATUS, &status);
@@ -8312,7 +8422,8 @@ class NegativeGLSLLinkTime : public ShaderStorageBufferObjectBase
 
                if (status == GL_TRUE)
                {
-                       Output("Link operation should fail.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Link operation should fail." << tcu::TestLog::EndMessage;
                        return false;
                }
 
@@ -8334,7 +8445,6 @@ ShaderStorageBufferObjectTests::~ShaderStorageBufferObjectTests(void)
 void ShaderStorageBufferObjectTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "basic-basic-vs", TestSubcase::Create<BasicBasicVS>));
        addChild(new TestSubcase(m_context, "basic-basic-cs", TestSubcase::Create<BasicBasicCS>));
        addChild(new TestSubcase(m_context, "basic-max", TestSubcase::Create<BasicMax>));
index c1adc11..e6ebdde 100644 (file)
@@ -45,33 +45,6 @@ using tcu::UVec4;
 namespace
 {
 
-static tcu::TestLog* currentLog;
-
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 class TGBase : public glcts::SubcaseBase
 {
 public:
@@ -176,17 +149,20 @@ public:
                                        switch (type)
                                        {
                                        case GL_VERTEX_SHADER:
-                                               Output("*** Vertex Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Vertex Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_FRAGMENT_SHADER:
-                                               Output("*** Fragment Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Fragment Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_COMPUTE_SHADER:
-                                               Output("*** Compute Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Compute Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        default:
-                                               Output("*** Unknown Shader ***\n");
-                                               break;
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Unknown Shader ***" << tcu::TestLog::EndMessage;
                                        }
 
                                        GLint res;
@@ -200,7 +176,8 @@ public:
                                        {
                                                std::vector<GLchar> source(length);
                                                glGetShaderSource(shaders[i], length, NULL, &source[0]);
-                                               Output("%s\n", &source[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &source[0] << tcu::TestLog::EndMessage;
                                        }
 
                                        glGetShaderiv(shaders[i], GL_INFO_LOG_LENGTH, &length);
@@ -208,7 +185,8 @@ public:
                                        {
                                                std::vector<GLchar> log(length);
                                                glGetShaderInfoLog(shaders[i], length, NULL, &log[0]);
-                                               Output("%s\n", &log[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                                        }
                                }
                        }
@@ -219,7 +197,7 @@ public:
                        {
                                std::vector<GLchar> log(length);
                                glGetProgramInfoLog(program, length, NULL, &log[0]);
-                               Output("%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                        }
                }
 
@@ -885,7 +863,9 @@ public:
                glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
                if (data[0] != 0 || data[1] != 255 || data[2] != 0 || data[3] != 255)
                {
-                       Output("Expected Vec4(0, 255, 0, 255), got: %d, %d, %d, %d", data[0], data[1], data[2], data[3]);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected Vec4(0, 255, 0, 255), got: " << data[0] << ", " << data[1] << ", "
+                               << data[2] << ", " << data[3] << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -1003,8 +983,9 @@ public:
                data = static_cast<Vec4*>(glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, sizeof(Vec4), GL_MAP_READ_BIT));
                if (data[0] != Vec4(0, 1, 0, 1))
                {
-                       Output("Expected Vec4(0, 1, 0, 1), got: %f, %f, %f, %f", data[0].x(), data[0].y(), data[0].z(),
-                                  data[0].w());
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Expected Vec4(0, 1, 0, 1), got: " << data[0].x() << ", " << data[0].y()
+                               << ", " << data[0].z() << ", " << data[0].w() << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -1705,7 +1686,9 @@ class TriangleDraw : public GatherBase
                        Vec4               rvec(rdata[0], rdata[1], rdata[2], rdata[3]);
                        if (rvec != Vec4(0.75))
                        {
-                               Output("Got: %f %f %f %f, expected vec4(0.75)", rvec.x(), rvec.y(), rvec.z(), rvec.w());
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Got: " << rvec.x() << " " << rvec.y() << " " << rvec.z() << " "
+                                       << rvec.w() << ", expected vec4(0.75)" << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -1838,7 +1821,6 @@ TextureGatherTests::~TextureGatherTests(void)
 void TextureGatherTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "api-enums", TestSubcase::Create<GatherEnumsTest>));
        addChild(new TestSubcase(m_context, "gather-glsl-compile", TestSubcase::Create<GatherGLSLCompile>));
        addChild(new TestSubcase(m_context, "plain-gather-float-2d", TestSubcase::Create<PlainGatherFloat2D>));
index 88babe9..2fb8ad6 100644 (file)
@@ -46,33 +46,6 @@ using tcu::Mat4;
 namespace
 {
 
-static tcu::TestLog* currentLog;
-
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
 class VertexAttribBindingBase : public glcts::SubcaseBase
 {
        virtual std::string Title()
@@ -162,13 +135,16 @@ public:
                                        switch (type)
                                        {
                                        case GL_VERTEX_SHADER:
-                                               Output("*** Vertex Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Vertex Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        case GL_FRAGMENT_SHADER:
-                                               Output("*** Fragment Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Fragment Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        default:
-                                               Output("*** Unknown Shader ***\n");
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << "*** Unknown Shader ***" << tcu::TestLog::EndMessage;
                                                break;
                                        }
                                        GLint length;
@@ -177,14 +153,16 @@ public:
                                        {
                                                std::vector<GLchar> source(length);
                                                glGetShaderSource(shaders[i], length, NULL, &source[0]);
-                                               Output("%s\n", &source[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &source[0] << tcu::TestLog::EndMessage;
                                        }
                                        glGetShaderiv(shaders[i], GL_INFO_LOG_LENGTH, &length);
                                        if (length > 0)
                                        {
                                                std::vector<GLchar> log(length);
                                                glGetShaderInfoLog(shaders[i], length, NULL, &log[0]);
-                                               Output("%s\n", &log[0]);
+                                               m_context.getTestContext().getLog()
+                                                       << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                                        }
                                }
                        }
@@ -194,7 +172,7 @@ public:
                        {
                                std::vector<GLchar> log(length);
                                glGetProgramInfoLog(program, length, NULL, &log[0]);
-                               Output("%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << &log[0] << tcu::TestLog::EndMessage;
                        }
                }
                return status == GL_TRUE ? true : false;
@@ -244,11 +222,11 @@ public:
                                        fabs(fb[i + 1] / g_color_max[1] - expected[1]) > g_color_eps[1] ||
                                        fabs(fb[i + 2] / g_color_max[2] - expected[2]) > g_color_eps[2])
                                {
-
-                                       Output("Incorrect framebuffer color at pixel (%d %d). Color is (%f %f %f). "
-                                                  "Color should be (%f %f %f).\n",
-                                                  x, y, fb[i + 0] / g_color_max[0], fb[i + 1] / g_color_max[1], fb[i + 2] / g_color_max[2],
-                                                  expected[0], expected[1], expected[2]);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Incorrect framebuffer color at pixel (" << x << " " << y
+                                               << "). Color is (" << fb[i + 0] / g_color_max[0] << " " << fb[i + 1] / g_color_max[1] << " "
+                                               << fb[i + 2] / g_color_max[2] << ". Color should be (" << expected[0] << " " << expected[1]
+                                               << " " << expected[2] << ")." << tcu::TestLog::EndMessage;
                                        return false;
                                }
                        }
@@ -536,9 +514,11 @@ protected:
                {
                        if (!ColorEqual(expected_data[i], data[i], Vec4(0.01f)))
                        {
-                               Output("Data is: %f %f %f %f, data should be: %f %f %f %f, index is: %d.\n", data[i][0], data[i][1],
-                                          data[i][2], data[i][3], expected_data[i][0], expected_data[i][1], expected_data[i][2],
-                                          expected_data[i][3], i);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Data is: " << data[i][0] << " " << data[i][1] << " " << data[i][2]
+                                       << " " << data[i][3] << ", data should be: " << expected_data[i][0] << " " << expected_data[i][1]
+                                       << " " << expected_data[i][2] << " " << expected_data[i][3] << ", index is: " << i
+                                       << tcu::TestLog::EndMessage;
                                status = ERROR;
                                break;
                        }
@@ -1591,18 +1571,22 @@ protected:
                        {
                                if (!IsEqual(expected_datai[i * 8 + j], datai[i * 15 + j]))
                                {
-                                       Output("Datai is: %d %d %d %d, datai should be: %d %d %d %d, index is: %d.\n", datai[i * 15 + j][0],
-                                                  datai[i * 15 + j][1], datai[i * 15 + j][2], datai[i * 15 + j][3],
-                                                  expected_datai[i * 8 + j][0], expected_datai[i * 8 + j][1], expected_datai[i * 8 + j][2],
-                                                  expected_datai[i * 8 + j][3], i * 8 + j);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Datai is: " << datai[i * 15 + j][0] << " " << datai[i * 15 + j][1]
+                                               << " " << datai[i * 15 + j][2] << " " << datai[i * 15 + j][3]
+                                               << ", data should be: " << expected_datai[i * 8 + j][0] << " " << expected_datai[i * 8 + j][1]
+                                               << " " << expected_datai[i * 8 + j][2] << " " << expected_datai[i * 8 + j][3]
+                                               << ", index is: " << i * 8 + j << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                                if (j != 7 && !IsEqual(expected_dataui[i * 8 + j], dataui[i * 15 + j]))
                                {
-                                       Output("Dataui is: %u %u %u %u, dataui should be: %u %u %u %u, index is: %d.\n",
-                                                  dataui[i * 15 + j][0], dataui[i * 15 + j][1], dataui[i * 15 + j][2], dataui[i * 15 + j][3],
-                                                  expected_dataui[i * 8 + j][0], expected_dataui[i * 8 + j][1], expected_dataui[i * 8 + j][2],
-                                                  expected_dataui[i * 8 + j][3], i * 8 + j);
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Dataui is: " << dataui[i * 15 + j][0] << " "
+                                               << dataui[i * 15 + j][1] << " " << dataui[i * 15 + j][2] << " " << dataui[i * 15 + j][3]
+                                               << ", data should be: " << expected_datai[i * 8 + j][0] << " " << expected_datai[i * 8 + j][1]
+                                               << " " << expected_datai[i * 8 + j][2] << " " << expected_datai[i * 8 + j][3]
+                                               << ", index is: " << i * 8 + j << tcu::TestLog::EndMessage;
                                        return ERROR;
                                }
                        }
@@ -1943,69 +1927,89 @@ public:
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &p);
                if (p != array_enabled)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_ENABLED(%d) is %d should be %d.\n", index, p, array_enabled);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_ENABLED(" << index << ") is " << p << " should be "
+                               << array_enabled << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_SIZE, &p);
                if (p != array_size)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_SIZE(%d) is %d should be %d.\n", index, p, array_size);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_SIZE(" << index << ") is " << p << " should be "
+                               << array_size << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &p);
                if (p != array_stride)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_STRIDE(%d) is %d should be %d.\n", index, p, array_stride);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_STRIDE(" << index << ") is " << p << " should be "
+                               << array_stride << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_TYPE, &p);
                if (p != array_type)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_TYPE(%d) is 0x%x should be 0x%x.\n", index, p, array_type);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_TYPE(" << index << ") is " << tcu::toHex(p)
+                               << " should be " << tcu::toHex(array_type) << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &p);
                if (p != array_normalized)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_NORMALIZED(%d) is %d should be %d.\n", index, p, array_normalized);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_NORMALIZED(" << index << ") is " << p
+                               << " should be " << array_normalized << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_INTEGER, &p);
                if (p != array_integer)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_INTEGER(%d) is %d should be %d.\n", index, p, array_integer);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_INTEGER(" << index << ") is " << p << " should be "
+                               << array_integer << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &p);
                if (p != array_divisor)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_DIVISOR(%d) is %d should be %d.\n", index, p, array_divisor);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_DIVISOR(" << index << ") is " << p << " should be "
+                               << array_divisor << tcu::TestLog::EndMessage;
                        status = false;
                }
                void* pp;
                glGetVertexAttribPointerv(index, GL_VERTEX_ATTRIB_ARRAY_POINTER, &pp);
                if (reinterpret_cast<deUintptr>(pp) != array_pointer)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_POINTER(%d) is %p should be %p.\n", index, pp,
-                                  reinterpret_cast<void*>(array_pointer));
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_POINTER(" << index << ") is " << pp << " should be "
+                               << reinterpret_cast<void*>(array_pointer) << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &p);
                if (p != array_buffer_binding)
                {
-                       Output("GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING(%d) is %d should be %d.\n", index, p, array_buffer_binding);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING(" << index << ") is " << p
+                               << " should be " << array_buffer_binding << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_BINDING, &p);
                if (static_cast<GLint>(binding) != p)
                {
-                       Output("GL_VERTEX_ATTRIB_BINDING(%d) is %d should be %d.\n", index, p, binding);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_BINDING(" << index
+                                                                                               << ") is " << p << " should be " << binding << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetVertexAttribiv(index, GL_VERTEX_ATTRIB_RELATIVE_OFFSET, &p);
                if (p != relative_offset)
                {
-                       Output("GL_VERTEX_ATTRIB_RELATIVE_OFFSET(%d) is %d should be %d.\n", index, p, relative_offset);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_ATTRIB_RELATIVE_OFFSET(" << index << ") is " << p
+                               << " should be " << relative_offset << tcu::TestLog::EndMessage;
                        status = false;
                }
                return status;
@@ -2030,26 +2034,31 @@ public:
                glGetIntegeri_v(GL_VERTEX_BINDING_BUFFER, index, &p);
                if (p != buffer)
                {
-                       Output("GL_VERTEX_BINDING_BUFFER(%d) is %d should be %d.\n", index, p, buffer);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_VERTEX_BINDING_BUFFER(" << index
+                                                                                               << ") is " << p << " should be " << buffer << tcu::TestLog::EndMessage;
                        status = false;
                }
                GLint64 p64;
                glGetInteger64i_v(GL_VERTEX_BINDING_OFFSET, index, &p64);
                if (p64 != offset)
                {
-                       Output("GL_VERTEX_BINDING_OFFSET(%d) is %ld should be %ld.\n", index, p64, offset);
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "GL_VERTEX_BINDING_OFFSET(" << index << ") is " << p64 << " should be "
+                               << offset << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetIntegeri_v(GL_VERTEX_BINDING_STRIDE, index, &p);
                if (p != stride)
                {
-                       Output("GL_VERTEX_BINDING_STRIDE(%d) is %d should be %d.\n", index, p, stride);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_VERTEX_BINDING_STRIDE(" << index
+                                                                                               << ") is " << p << " should be " << stride << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetIntegeri_v(GL_VERTEX_BINDING_DIVISOR, index, &p);
                if (p != divisor)
                {
-                       Output("GL_VERTEX_BINDING_DIVISOR(%d) is %d should be %d.\n", index, p, divisor);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_VERTEX_BINDING_DIVISOR(" << index
+                                                                                               << ") is " << p << " should be " << divisor << tcu::TestLog::EndMessage;
                        status = false;
                }
                return status;
@@ -2092,19 +2101,22 @@ class BasicState1 : public VertexAttribBindingBase
                glGetIntegerv(GL_MAX_VERTEX_ATTRIB_BINDINGS, &p);
                if (p < 16)
                {
-                       Output("GL_MAX_VERTEX_ATTRIB_BINDINGS is %d but must be at least 16.\n", p);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_MAX_VERTEX_ATTRIB_BINDINGS is" << p
+                                                                                               << "but must be at least 16." << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetIntegerv(GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET, &p);
                if (p < 2047)
                {
-                       Output("GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET is %d but must be at least 2047.\n", p);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET is"
+                                                                                               << p << "but must be at least 2047." << tcu::TestLog::EndMessage;
                        status = false;
                }
                glGetIntegerv(GL_MAX_VERTEX_ATTRIB_STRIDE, &p);
                if (p < 2048)
                {
-                       Output("GL_MAX_VERTEX_ATTRIB_STRIDE is %d but must be at least 2048.\n", p);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_MAX_VERTEX_ATTRIB_STRIDE is" << p
+                                                                                               << "but must be at least 2048." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2113,7 +2125,8 @@ class BasicState1 : public VertexAttribBindingBase
                glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &p);
                if (0 != p)
                {
-                       Output("GL_ELEMENT_ARRAY_BUFFER_BINDING is %d should be %d.\n", p, 0);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << "GL_ELEMENT_ARRAY_BUFFER_BINDING is" << p
+                                                                                               << "should be 0." << tcu::TestLog::EndMessage;
                        status = false;
                }
                for (GLuint i = 0; i < 16; ++i)
@@ -2130,7 +2143,8 @@ class BasicState1 : public VertexAttribBindingBase
                }
                if (!status)
                {
-                       Output("Default state check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "Default state check failed." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2143,7 +2157,9 @@ class BasicState1 : public VertexAttribBindingBase
                glVertexAttribFormat(0, 2, GL_BYTE, GL_TRUE, 16);
                if (!va0.stateVerify() || !vb0.stateVerify())
                {
-                       Output("glVertexAttribFormat state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribFormat state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2156,7 +2172,9 @@ class BasicState1 : public VertexAttribBindingBase
                glVertexAttribIFormat(2, 3, GL_INT, 512);
                if (!va2.stateVerify() || !vb2.stateVerify())
                {
-                       Output("glVertexAttribIFormat state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribIFormat state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2167,7 +2185,8 @@ class BasicState1 : public VertexAttribBindingBase
                glBindVertexBuffer(0, m_vbo[0], 2048, 128);
                if (!va0.stateVerify() || !vb0.stateVerify())
                {
-                       Output("glBindVertexBuffer state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindVertexBuffer state change check failed." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2178,7 +2197,8 @@ class BasicState1 : public VertexAttribBindingBase
                glBindVertexBuffer(2, m_vbo[2], 64, 256);
                if (!va2.stateVerify() || !vb2.stateVerify())
                {
-                       Output("glBindVertexBuffer state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindVertexBuffer state change check failed." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2187,7 +2207,9 @@ class BasicState1 : public VertexAttribBindingBase
                va2.array_buffer_binding = m_vbo[0];
                if (!va0.stateVerify() || !vb0.stateVerify() || !va2.stateVerify() || !vb2.stateVerify())
                {
-                       Output("glVertexAttribBinding state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribBinding state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2198,7 +2220,9 @@ class BasicState1 : public VertexAttribBindingBase
                va0.array_buffer_binding = 0;
                if (!va0.stateVerify() || !vb0.stateVerify() || !va15.stateVerify() || !vb15.stateVerify())
                {
-                       Output("glVertexAttribBinding state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribBinding state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2210,7 +2234,8 @@ class BasicState1 : public VertexAttribBindingBase
                vb15.stride                               = 32;
                if (!va0.stateVerify() || !vb0.stateVerify() || !va15.stateVerify() || !vb15.stateVerify())
                {
-                       Output("glBindVertexBuffer state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindVertexBuffer state change check failed." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2221,7 +2246,9 @@ class BasicState1 : public VertexAttribBindingBase
                if (!va0.stateVerify() || !vb0.stateVerify() || !va2.stateVerify() || !vb2.stateVerify() ||
                        !va15.stateVerify() || !vb15.stateVerify())
                {
-                       Output("glVertexAttribFormat state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribFormat state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2243,7 +2270,9 @@ class BasicState1 : public VertexAttribBindingBase
                if (!va0.stateVerify() || !vb0.stateVerify() || !va2.stateVerify() || !vb2.stateVerify() ||
                        !va15.stateVerify() || !vb15.stateVerify())
                {
-                       Output("glVertexAttribPointer state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribPointer state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2256,7 +2285,8 @@ class BasicState1 : public VertexAttribBindingBase
                if (!va0.stateVerify() || !vb0.stateVerify() || !va2.stateVerify() || !vb2.stateVerify() ||
                        !va15.stateVerify() || !vb15.stateVerify())
                {
-                       Output("glBindVertexBuffer state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glBindVertexBuffer state change check failed." << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2300,7 +2330,9 @@ class BasicState2 : public VertexAttribBindingBase
                        vb.divisor               = i + 7;
                        if (!va.stateVerify() || !vb.stateVerify())
                        {
-                               Output("glVertexAttribDivisor state change check failed.\n");
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "glVertexAttribDivisor state change check failed."
+                                       << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -2313,7 +2345,9 @@ class BasicState2 : public VertexAttribBindingBase
                        vb.divisor               = i;
                        if (!va.stateVerify() || !vb.stateVerify())
                        {
-                               Output("glVertexBindingDivisor state change check failed.\n");
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "glVertexBindingDivisor state change check failed."
+                                       << tcu::TestLog::EndMessage;
                                status = false;
                        }
                }
@@ -2330,7 +2364,9 @@ class BasicState2 : public VertexAttribBindingBase
                va2.binding = 5;
                if (!va5.stateVerify() || !vb5.stateVerify() || !va2.stateVerify() || !vb2.stateVerify())
                {
-                       Output("glVertexAttribBinding state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribBinding state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2340,7 +2376,9 @@ class BasicState2 : public VertexAttribBindingBase
                vb2.divisor               = 23;
                if (!va5.stateVerify() || !vb5.stateVerify() || !va2.stateVerify() || !vb2.stateVerify())
                {
-                       Output("glVertexAttribDivisor state change check failed.\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "glVertexAttribDivisor state change check failed."
+                               << tcu::TestLog::EndMessage;
                        status = false;
                }
 
@@ -2729,8 +2767,9 @@ class AdvancedIterations : public VertexAttribBindingBase
                                static_cast<IVec4*>(glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(IVec4), GL_MAP_READ_BIT));
                        if (!IsEqual(*data, IVec4(10)))
                        {
-                               Output("Data is: %d %d %d %d, data should be: 10 10 10 10.\n", (*data)[0], (*data)[1], (*data)[2],
-                                          (*data)[3]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Data is: " << (*data)[0] << " " << (*data)[1] << " " << (*data)[2]
+                                       << " " << (*data)[3] << ", data should be: 10 10 10 10." << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                        glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
@@ -2767,8 +2806,9 @@ class AdvancedIterations : public VertexAttribBindingBase
                                static_cast<IVec4*>(glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(IVec4), GL_MAP_READ_BIT));
                        if (!IsEqual(*data, IVec4(20)))
                        {
-                               Output("Data is: %d %d %d %d, data should be: 20 20 20 20.\n", (*data)[0], (*data)[1], (*data)[2],
-                                          (*data)[3]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Data is: " << (*data)[0] << " " << (*data)[1] << " " << (*data)[2]
+                                       << " " << (*data)[3] << ", data should be: 20 20 20 20." << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                        glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
@@ -2796,8 +2836,9 @@ class AdvancedIterations : public VertexAttribBindingBase
                                static_cast<IVec4*>(glMapBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, sizeof(IVec4), GL_MAP_READ_BIT));
                        if (!IsEqual(*data, IVec4(30)))
                        {
-                               Output("Data is: %d %d %d %d, data should be: 30 30 30 30.\n", (*data)[0], (*data)[1], (*data)[2],
-                                          (*data)[3]);
+                               m_context.getTestContext().getLog()
+                                       << tcu::TestLog::Message << "Data is: " << (*data)[0] << " " << (*data)[1] << " " << (*data)[2]
+                                       << " " << (*data)[3] << ", data should be: 30 30 30 30." << tcu::TestLog::EndMessage;
                                return ERROR;
                        }
                }
@@ -3073,7 +3114,9 @@ class NegativeBindVertexBuffer : public VertexAttribBindingBase
                glBindVertexBuffer(0, 1234, 0, 12);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (buffer name not genned).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (buffer name not genned)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -3082,20 +3125,27 @@ class NegativeBindVertexBuffer : public VertexAttribBindingBase
                glBindVertexBuffer(p + 1, m_vbo, 0, 12);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIB_BINDINGS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIB_BINDINGS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
                glBindVertexBuffer(0, m_vbo, -10, 12);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (negative offset).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (negative offset)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glBindVertexBuffer(0, m_vbo, 0, -12);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (negative stride).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (negative stride)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -3103,7 +3153,10 @@ class NegativeBindVertexBuffer : public VertexAttribBindingBase
                glBindVertexBuffer(0, m_vbo, 0, p + 4);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (stride greater than GL_MAX_VERTEX_ATTRIB_STRIDE).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (stride greater than GL_MAX_VERTEX_ATTRIB_STRIDE)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -3111,7 +3164,9 @@ class NegativeBindVertexBuffer : public VertexAttribBindingBase
                glBindVertexBuffer(0, m_vbo, 0, 12);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (default VAO).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (default VAO)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
 
@@ -3170,77 +3225,104 @@ class NegativeVertexAttribFormat : public VertexAttribBindingBase
                glVertexAttribFormat(p + 1, 4, GL_FLOAT, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribIFormat(p + 2, 4, GL_INT, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribFormat(0, 0, GL_FLOAT, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (invalid number of components).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (invalid number of components)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribFormat(0, 5, GL_FLOAT, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (invalid number of components).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (invalid number of components)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribIFormat(0, 5, GL_INT, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (invalid number of components).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (invalid number of components)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribFormat(0, 4, GL_R32F, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_ENUM)
                {
-                       Output("INVALID_ENUM should be generated (invalid type).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_ENUM should be generated (invalid type)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribIFormat(0, 4, GL_FLOAT, 0);
                if (glGetError() != GL_INVALID_ENUM)
                {
-                       Output("INVALID_ENUM should be generated (invalid type).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_ENUM should be generated (invalid type)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribFormat(0, 3, GL_INT_2_10_10_10_REV, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (invalid number of components for packed type).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_OPERATION should be generated (invalid number of components for packed type)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetIntegerv(GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET, &p);
                glVertexAttribFormat(0, 4, GL_FLOAT, GL_FALSE, p + 10);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (relativeoffset greater than "
-                                  "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (relativeoffset greater than "
+                                                                                       "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribIFormat(0, 4, GL_INT, p + 10);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (relativeoffset greater than "
-                                  "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_VALUE should be generated (relativeoffset greater than "
+                                                                                       "GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glBindVertexArray(0);
                glVertexAttribFormat(0, 4, GL_FLOAT, GL_FALSE, 0);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (default VAO).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (default VAO)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glVertexAttribIFormat(0, 4, GL_INT, 0);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (default VAO).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (default VAO)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3283,21 +3365,29 @@ class NegativeVertexAttribBinding : public VertexAttribBindingBase
                glVertexAttribBinding(p + 1, 0);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (attribindex greater than GL_MAX_VERTEX_ATTRIBS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glGetIntegerv(GL_MAX_VERTEX_ATTRIB_BINDINGS, &p);
                glVertexAttribBinding(0, p + 1);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIB_BINDINGS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIB_BINDINGS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glBindVertexArray(0);
                glVertexAttribBinding(0, 0);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (default VAO).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (default VAO)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3338,14 +3428,19 @@ class NegativeVertexAttribDivisor : public VertexAttribBindingBase
                glVertexBindingDivisor(p + 1, 1);
                if (glGetError() != GL_INVALID_VALUE)
                {
-                       Output("INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIBS).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message
+                               << "INVALID_VALUE should be generated (bindingIndex greater than GL_MAX_VERTEX_ATTRIBS)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                glBindVertexArray(0);
                glVertexBindingDivisor(0, 1);
                if (glGetError() != GL_INVALID_OPERATION)
                {
-                       Output("INVALID_OPERATION should be generated (default VAO).\n");
+                       m_context.getTestContext().getLog()
+                               << tcu::TestLog::Message << "INVALID_OPERATION should be generated (default VAO)."
+                               << tcu::TestLog::EndMessage;
                        return ERROR;
                }
                return NO_ERROR;
@@ -3366,7 +3461,6 @@ VertexAttribBindingTests::~VertexAttribBindingTests(void)
 void VertexAttribBindingTests::init()
 {
        using namespace glcts;
-       setOutput(m_context.getTestContext().getLog());
        addChild(new TestSubcase(m_context, "basic-usage", TestSubcase::Create<BasicUsage>));
        addChild(new TestSubcase(m_context, "basic-input-case1", TestSubcase::Create<BasicInputCase1>));
        addChild(new TestSubcase(m_context, "basic-input-case2", TestSubcase::Create<BasicInputCase2>));
index 54ae8ce..bd85027 100644 (file)
 namespace glcts
 {
 
-namespace
-{
-
-static tcu::TestLog* currentLog;
-
-void setOutput(tcu::TestLog& log)
-{
-       currentLog = &log;
-}
-
-void Output(const char* format, ...)
-{
-       va_list args;
-       va_start(args, format);
-
-       const int   MAX_OUTPUT_STRING_SIZE = 40000;
-       static char temp[MAX_OUTPUT_STRING_SIZE];
-
-       vsnprintf(temp, MAX_OUTPUT_STRING_SIZE - 1, format, args);
-       temp[MAX_OUTPUT_STRING_SIZE - 1] = '\0';
-
-       char* logLine = strtok(temp, "\n");
-       while (logLine != NULL)
-       {
-               currentLog->writeMessage(logLine);
-               logLine = strtok(NULL, "\n");
-       }
-       va_end(args);
-}
-
-} // anonymous namespace
-
 /** Constructor
  *
  * @param context       Test context
@@ -84,7 +52,6 @@ TessellationShaderErrors::TessellationShaderErrors(Context& context, const ExtPa
 /* Instantiates all tests and adds them as children to the node */
 void TessellationShaderErrors::init(void)
 {
-       setOutput(m_context.getTestContext().getLog());
        addChild(new glcts::TessellationShaderError1InputBlocks(m_context, m_extParams));
        addChild(new glcts::TessellationShaderError1InputVariables(m_context, m_extParams));
        addChild(new glcts::TessellationShaderError2OutputBlocks(m_context, m_extParams));
@@ -366,14 +333,17 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                        gl.getShaderiv(*so_id_ptr, GL_COMPILE_STATUS, &compile_status);
                        GLU_EXPECT_NO_ERROR(gl.getError(), "glGetShaderiv() failed");
 
-                       Output("%s shader source:\n%s", so_type.c_str(), so_code_ptr);
+                       m_context.getTestContext().getLog() << tcu::TestLog::Message << so_type << " shader source:\n"
+                                                                                               << so_code_ptr << tcu::TestLog::EndMessage;
+
                        glw::GLint length = 0;
                        gl.getShaderiv(*so_id_ptr, GL_INFO_LOG_LENGTH, &length);
                        if (length > 1)
                        {
                                std::vector<glw::GLchar> log(length);
                                gl.getShaderInfoLog(*so_id_ptr, length, NULL, &log[0]);
-                               Output("shader info log\n%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "shader info log\n"
+                                                                                                       << &log[0] << tcu::TestLog::EndMessage;
                        }
 
                        switch (expected_compilation_result)
@@ -385,12 +355,14 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                                        /* OK, this is valid. However, it no longer makes sense to try to
                                         * link the program object at this point. */
                                        should_try_to_link = false;
-                                       Output("Compilation failed as allowed.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Compilation failed as allowed." << tcu::TestLog::EndMessage;
                                }
                                else
                                {
                                        /* That's fine. */
-                                       Output("Compilation passed as allowed.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Compilation passed as allowed." << tcu::TestLog::EndMessage;
                                }
 
                                break;
@@ -408,7 +380,8 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                                {
                                        /* OK. Mark the program object as non-linkable */
                                        should_try_to_link = false;
-                                       Output("Compilation failed as expected.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Compilation failed as expected." << tcu::TestLog::EndMessage;
                                }
 
                                break;
@@ -425,7 +398,8 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                                else
                                {
                                        /* That's fine. */
-                                       Output("Compilation successful as expected.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Compilation successful as expected." << tcu::TestLog::EndMessage;
                                }
 
                                break;
@@ -464,7 +438,8 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                        {
                                std::vector<glw::GLchar> log(length);
                                gl.getProgramInfoLog(m_po_ids[n_po], length, NULL, &log[0]);
-                               Output("program info log\n%s\n", &log[0]);
+                               m_context.getTestContext().getLog() << tcu::TestLog::Message << "program info log\n"
+                                                                                                       << &log[0] << tcu::TestLog::EndMessage;
                        }
 
                        switch (expected_linking_result)
@@ -478,7 +453,8 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                                else
                                {
                                        /* That's OK */
-                                       Output("Linking failed as expected.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Linking failed as expected." << tcu::TestLog::EndMessage;
                                }
 
                                break;
@@ -493,7 +469,8 @@ tcu::TestNode::IterateResult TessellationShaderErrorsTestCaseBase::iterate()
                                else
                                {
                                        /* That's OK */
-                                       Output("Linking succeeded as expected.\n");
+                                       m_context.getTestContext().getLog()
+                                               << tcu::TestLog::Message << "Linking succeeded as expected." << tcu::TestLog::EndMessage;
                                }
 
                                break;