Add support for non-square matrix uniforms in desktop GLSL. The notation is columns x rows, e.g. a mat4x2 has 4 columns and 2 rows.

Fixed the memory layout of matrices sent to shaders via Shader:send. Note that this is a breaking fix and will probably cause matrices designed to work with older versions of LÖVE to be transposed in shaders compared to what they were previously, if Shader:send or sendMatrix was used to put them in the shader.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-09-11 14:53:23 -03:00
parent a853ef6c3a
commit 593f96a08c
3 changed files with 105 additions and 29 deletions
+13 -2
View File
@@ -88,11 +88,21 @@ public:
std::string pixel;
};
struct MatrixSize
{
short columns;
short rows;
};
struct UniformInfo
{
int location;
int count;
int components;
union
{
int components;
MatrixSize matrix;
};
UniformType baseType;
std::string name;
};
@@ -195,7 +205,8 @@ private:
// Map active uniform names to their locations.
void mapActiveUniforms();
int getUniformTypeSize(GLenum type) const;
int getUniformTypeComponents(GLenum type) const;
MatrixSize getMatrixSize(GLenum type) const;
UniformType getUniformBaseType(GLenum type) const;
GLuint compileCode(ShaderStage stage, const std::string &code);