Shader:send now optionally accepts a Data object (with optional byte offset and size parameters). Resolves issue #1343.

Also changed the optional 'columnMajor' argument of the matrix variant of Shader:send and Transform:setMatrix to accept enum constants instead. Valid values are "row" and "column".

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-09-23 19:47:57 -03:00
parent 77663ed847
commit 5f64737956
6 changed files with 178 additions and 26 deletions
+11 -11
View File
@@ -219,35 +219,35 @@ void Shader::mapActiveUniforms()
}
else
{
size_t datasize = 0;
u.dataSize = 0;
switch (u.baseType)
{
case UNIFORM_FLOAT:
datasize = sizeof(float) * u.components * u.count;
u.data = malloc(datasize);
u.dataSize = sizeof(float) * u.components * u.count;
u.data = malloc(u.dataSize);
break;
case UNIFORM_INT:
case UNIFORM_BOOL:
case UNIFORM_SAMPLER:
datasize = sizeof(int) * u.components * u.count;
u.data = malloc(datasize);
u.dataSize = sizeof(int) * u.components * u.count;
u.data = malloc(u.dataSize);
break;
case UNIFORM_UINT:
datasize = sizeof(unsigned int) * u.components * u.count;
u.data = malloc(datasize);
u.dataSize = sizeof(unsigned int) * u.components * u.count;
u.data = malloc(u.dataSize);
break;
case UNIFORM_MATRIX:
datasize = sizeof(float) * (u.matrix.rows * u.matrix.columns) * u.count;
u.data = malloc(datasize);
u.dataSize = sizeof(float) * (u.matrix.rows * u.matrix.columns) * u.count;
u.data = malloc(u.dataSize);
break;
default:
break;
}
if (datasize > 0)
if (u.dataSize > 0)
{
memset(u.data, 0, datasize);
memset(u.data, 0, u.dataSize);
if (u.baseType == UNIFORM_SAMPLER)
{