Merge pull request #1392 from mapbox/valgrind
Fix some bugs found via valgrind
This commit is contained in:
@@ -9,7 +9,7 @@ namespace mbgl {
|
||||
template <typename T>
|
||||
class Uniform {
|
||||
public:
|
||||
Uniform(const GLchar* name, const Shader& shader) {
|
||||
Uniform(const GLchar* name, const Shader& shader) : current() {
|
||||
location = MBGL_CHECK_ERROR(glGetUniformLocation(shader.program, name));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class UniformMatrix {
|
||||
public:
|
||||
typedef std::array<float, C*R> T;
|
||||
|
||||
UniformMatrix(const GLchar* name, const Shader& shader) {
|
||||
UniformMatrix(const GLchar* name, const Shader& shader) : current() {
|
||||
location = MBGL_CHECK_ERROR(glGetUniformLocation(shader.program, name));
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ void matrix::copy(mat4& out, const mat4& a) {
|
||||
}
|
||||
|
||||
void matrix::translate(mat4& out, const mat4& a, float x, float y, float z) {
|
||||
if (a == out) {
|
||||
if (&a == &out) {
|
||||
out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
|
||||
out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
|
||||
out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
|
||||
@@ -124,7 +124,7 @@ void matrix::rotate_z(mat4& out, const mat4& a, float rad) {
|
||||
a12 = a[6],
|
||||
a13 = a[7];
|
||||
|
||||
if (a != out) { // If the source and destination differ, copy the unchanged last row
|
||||
if (&a != &out) { // If the source and destination differ, copy the unchanged last row
|
||||
out[8] = a[8];
|
||||
out[9] = a[9];
|
||||
out[10] = a[10];
|
||||
|
||||
Reference in New Issue
Block a user