mojoshader_opengl.c
branchtrunk
changeset 435 88abca0babe9
parent 432 6c59f6c0456a
child 436 304072996bda
equal deleted inserted replaced
434:9d36ff50e897 435:88abca0babe9
  1532         {
  1532         {
  1533             GLfloat *f = &regf[index * 4];
  1533             GLfloat *f = &regf[index * 4];
  1534             const size_t len = size * sizeof (GLfloat) * 4;
  1534             const size_t len = size * sizeof (GLfloat) * 4;
  1535 
  1535 
  1536             GLfloat *current = map->uniform_array_buffer;
  1536             GLfloat *current = map->uniform_array_buffer;
  1537             if (memcmp(current, f, len) != 0)
  1537             //if (memcmp(current, f, len) != 0)
  1538             {
  1538             {
  1539                 // array has changed, upload it.
  1539                 // array has changed, upload it.
  1540                 ctx->profileUniform4fv(pd, location, size, f);
  1540                 ctx->profileUniform4fv(pd, location, size, f);
  1541                 memcpy(current, f, len);
  1541                 memcpy(current, f, len);
  1542             } // if
  1542             } // if
  1545         else
  1545         else
  1546         {
  1546         {
  1547             if (type == MOJOSHADER_UNIFORM_FLOAT)
  1547             if (type == MOJOSHADER_UNIFORM_FLOAT)
  1548             {
  1548             {
  1549                 GLfloat *f = &regf[index * 4];
  1549                 GLfloat *f = &regf[index * 4];
  1550                 if (memcmp(map->value.f, f, sizeof (map->value.f)) != 0)
  1550                 //if (memcmp(map->value.f, f, sizeof (map->value.f)) != 0)
  1551                 {
  1551                 {
  1552                     memcpy(map->value.f, f, sizeof (map->value.f));
  1552                     memcpy(map->value.f, f, sizeof (map->value.f));
  1553                     ctx->profileUniform4fv(pd, location, 1, f);
  1553                     ctx->profileUniform4fv(pd, location, 1, f);
  1554                 } // if
  1554                 } // if
  1555             } // if
  1555             } // if
  1556             else if (type == MOJOSHADER_UNIFORM_INT)
  1556             else if (type == MOJOSHADER_UNIFORM_INT)
  1557             {
  1557             {
  1558                 GLint *i = &regi[index * 4];
  1558                 GLint *i = &regi[index * 4];
  1559                 if (memcmp(map->value.i, i, sizeof (map->value.i)) != 0)
  1559                 //if (memcmp(map->value.i, i, sizeof (map->value.i)) != 0)
  1560                 {
  1560                 {
  1561                     memcpy(map->value.i, i, sizeof (map->value.i));
  1561                     memcpy(map->value.i, i, sizeof (map->value.i));
  1562                     ctx->profileUniform4iv(pd, location, 1, i);
  1562                     ctx->profileUniform4iv(pd, location, 1, i);
  1563                 } // if
  1563                 } // if
  1564             } // else if
  1564             } // else if
  1565             else if (type == MOJOSHADER_UNIFORM_BOOL)
  1565             else if (type == MOJOSHADER_UNIFORM_BOOL)
  1566             {
  1566             {
  1567                 const GLint b = regb[index];
  1567                 const GLint b = regb[index];
  1568                 if (b != map->value.b)
  1568                 //if (b != map->value.b)
  1569                 {
  1569                 {
  1570                     map->value.b = b;
  1570                     map->value.b = b;
  1571                     ctx->profileUniform1i(pd, location, b);
  1571                     ctx->profileUniform1i(pd, location, b);
  1572                 } // if
  1572                 } // if
  1573             } // else if
  1573             } // else if