From 80cba960dc772aa0c4feb74d32fc3b6642407f7a Mon Sep 17 00:00:00 2001 From: Pyry Haulos Date: Fri, 17 Apr 2015 10:19:06 -0700 Subject: [PATCH] Fix more valgrind warnings in negative API tests Change-Id: Ic3ea9d41b45da5f904b970c74a230c94539f54b6 --- .../functional/es3fNegativeShaderApiTests.cpp | 8 +++--- .../gles3/functional/es3fNegativeStateApiTests.cpp | 30 +++++++++++----------- .../functional/es3fNegativeTextureApiTests.cpp | 4 +-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/gles3/functional/es3fNegativeShaderApiTests.cpp b/modules/gles3/functional/es3fNegativeShaderApiTests.cpp index 81b5fe7..cd3fe1d 100644 --- a/modules/gles3/functional/es3fNegativeShaderApiTests.cpp +++ b/modules/gles3/functional/es3fNegativeShaderApiTests.cpp @@ -511,7 +511,7 @@ void NegativeShaderApiTests::init (void) }); ES3F_ADD_API_CASE(get_sampler_parameteriv, "Invalid glGetSamplerParameteriv() usage", { - int params; + int params = -1; GLuint sampler; glGenSamplers (1, &sampler); @@ -529,7 +529,7 @@ void NegativeShaderApiTests::init (void) }); ES3F_ADD_API_CASE(get_sampler_parameterfv, "Invalid glGetSamplerParameterfv() usage", { - float params; + float params = 0.0f; GLuint sampler; glGenSamplers (1, &sampler); @@ -564,7 +564,7 @@ void NegativeShaderApiTests::init (void) }); ES3F_ADD_API_CASE(sampler_parameteriv, "Invalid glSamplerParameteriv() usage", { - int params; + int params = -1; GLuint sampler; glGenSamplers (1, &sampler); @@ -601,7 +601,7 @@ void NegativeShaderApiTests::init (void) }); ES3F_ADD_API_CASE(sampler_parameterfv, "Invalid glSamplerParameterfv() usage", { - float params; + float params = 0.0f; GLuint sampler; glGenSamplers (1, &sampler); diff --git a/modules/gles3/functional/es3fNegativeStateApiTests.cpp b/modules/gles3/functional/es3fNegativeStateApiTests.cpp index 958f523..4254507 100644 --- a/modules/gles3/functional/es3fNegativeStateApiTests.cpp +++ b/modules/gles3/functional/es3fNegativeStateApiTests.cpp @@ -233,10 +233,10 @@ void NegativeStateApiTests::init (void) }); ES3F_ADD_API_CASE(get_shader_info_log, "Invalid glGetShaderInfoLog() usage", { - GLuint shader = glCreateShader(GL_VERTEX_SHADER); - GLuint program = glCreateProgram(); - GLsizei length[1]; - char infoLog[128]; + GLuint shader = glCreateShader(GL_VERTEX_SHADER); + GLuint program = glCreateProgram(); + GLsizei length[1] = { 0 }; + char infoLog[128] = { 0 }; m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); glGetShaderInfoLog(-1, 128, &length[0], &infoLog[0]); @@ -279,8 +279,8 @@ void NegativeStateApiTests::init (void) }); ES3F_ADD_API_CASE(get_shader_source, "Invalid glGetShaderSource() usage", { - GLsizei length[1]; - char source[1]; + GLsizei length[1] = { 0 }; + char source[1] = { 0 }; GLuint program = glCreateProgram(); GLuint shader = glCreateShader(GL_VERTEX_SHADER); @@ -331,10 +331,10 @@ void NegativeStateApiTests::init (void) }); ES3F_ADD_API_CASE(get_program_info_log, "Invalid glGetProgramInfoLog() usage", { - GLuint program = glCreateProgram(); - GLuint shader = glCreateShader(GL_VERTEX_SHADER); - GLsizei length[1]; - char infoLog[1]; + GLuint program = glCreateProgram(); + GLuint shader = glCreateShader(GL_VERTEX_SHADER); + GLsizei length[1] = { 0 }; + char infoLog[1] = { 0 }; m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); glGetProgramInfoLog (-1, 1, &length[0], &infoLog[0]); @@ -359,7 +359,7 @@ void NegativeStateApiTests::init (void) ES3F_ADD_API_CASE(get_tex_parameterfv, "Invalid glGetTexParameterfv() usage", { - GLfloat params[1]; + GLfloat params[1] = { 0.0f }; m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not an accepted value."); glGetTexParameterfv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]); @@ -372,7 +372,7 @@ void NegativeStateApiTests::init (void) }); ES3F_ADD_API_CASE(get_tex_parameteriv, "Invalid glGetTexParameteriv() usage", { - GLint params[1]; + GLint params[1] = { 0 }; m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target or pname is not an accepted value."); glGetTexParameteriv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]); @@ -394,7 +394,7 @@ void NegativeStateApiTests::init (void) GLuint shader = glCreateShader(GL_VERTEX_SHADER); GLuint programEmpty = glCreateProgram(); - GLfloat params[4]; + GLfloat params[4] = { 0.0f }; m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); glGetUniformfv (-1, unif, ¶ms[0]); @@ -430,7 +430,7 @@ void NegativeStateApiTests::init (void) GLuint shader = glCreateShader(GL_VERTEX_SHADER); GLuint programEmpty = glCreateProgram(); - GLint params[4]; + GLint params[4] = { 0 }; m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); glGetUniformiv (-1, unif, ¶ms[0]); @@ -466,7 +466,7 @@ void NegativeStateApiTests::init (void) GLuint shader = glCreateShader(GL_VERTEX_SHADER); GLuint programEmpty = glCreateProgram(); - GLuint params[4]; + GLuint params[4] = { 0 }; m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); glGetUniformuiv (-1, unif, ¶ms[0]); diff --git a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp index 4d74c14..8e4d61b 100644 --- a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp +++ b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp @@ -2833,7 +2833,7 @@ void NegativeTextureApiTests::init (void) glBindTexture (GL_TEXTURE_2D, texture); m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); - deInt32 immutable; + deInt32 immutable = -1; glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; glTexStorage2D (GL_TEXTURE_2D, 1, GL_RGBA8, 16, 16); @@ -2923,7 +2923,7 @@ void NegativeTextureApiTests::init (void) glBindTexture (GL_TEXTURE_3D, texture); m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if the texture object currently bound to target already has GL_TEXTURE_IMMUTABLE_FORMAT set to GL_TRUE."); - deInt32 immutable; + deInt32 immutable = -1; glGetTexParameteriv(GL_TEXTURE_3D, GL_TEXTURE_IMMUTABLE_FORMAT, &immutable); m_log << TestLog::Message << "// GL_TEXTURE_IMMUTABLE_FORMAT = " << ((immutable != 0) ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; glTexStorage3D (GL_TEXTURE_3D, 1, GL_RGBA8, 4, 4, 4); -- 2.7.4