1Name 2 3 NV_non_square_matrices 4 5Name Strings 6 7 GL_NV_non_square_matrices 8 9Contact 10 11 Nuno Subtil, NVIDIA (nsubtil 'at' nvidia.com) 12 13Contributors 14 15 Nuno Subtil 16 Mark Adams 17 18Status 19 20 Shipping on Tegra. 21 22Version 23 24 Last Modified Date: September 19, 2013 25 Author revision: 3 26 27Number 28 29 OpenGL ES Extension #160 30 31Dependencies 32 33 The OpenGL ES Shading Language (GLSL ES) is required. OpenGL ES 34 2.0 is required. 35 36 This extension is written against the OpenGL ES 2.0.25 37 specification and version 1.0.17 of the OpenGL ES Shading Language 38 specification. 39 40 EXT_separate_shader_objects interacts with this extension. 41 42Overview 43 44 This extension adds support for non-square matrix variables in GLSL shaders. 45 46New Procedures and Functions 47 48 void UniformMatrix2x3fvNV(int location, sizei count, 49 boolean transpose, const float *value); 50 51 void UniformMatrix3x2fvNV(int location, sizei count, 52 boolean transpose, const float *value); 53 54 void UniformMatrix2x4fvNV(int location, sizei count, 55 boolean transpose, const float *value); 56 57 void UniformMatrix4x2fvNV(int location, sizei count, 58 boolean transpose, const float *value); 59 60 void UniformMatrix3x4fvNV(int location, sizei count, 61 boolean transpose, const float *value); 62 63 void UniformMatrix4x3fvNV(int location, sizei count, 64 boolean transpose, const float *value); 65 66New Types 67 68 None. 69 70New Tokens 71 72 Returned by GetActiveAttrib and GetActiveUniform: 73 74 FLOAT_MAT2x3_NV 0x8B65 75 FLOAT_MAT2x4_NV 0x8B66 76 FLOAT_MAT3x2_NV 0x8B67 77 FLOAT_MAT3x4_NV 0x8B68 78 FLOAT_MAT4x2_NV 0x8B69 79 FLOAT_MAT4x3_NV 0x8B6A 80 81OpenGL ES 2.0 Specification Updates 82 83Additions to Chapter 2 - OpenGL ES Operation 84 85 Section 2.7 - Current Vertex State 86 Replace the first sentence of the third paragraph with 87 88 The VertexAttrib* commands can also be used to load attributes 89 declared as any matrix type in a vertex shader. 90 91 Section 2.10.4 - Shader Variables 92 Amend the second, third and fourth sentences of the second 93 paragraph under "Vertex Attributes": 94 95 When an attribute variable is declared as a mat2, mat3x2 or mat4x2, ... 96 97 When an attribute variable is declared as a mat2x3, mat3 or mat4x3, ... 98 99 When an attribute variable is declared as a mat2x4, mat3x4 or mat4, ... 100 101 Replace the last sentence of the 4th paragraph on page 33: 102 103 The type returned can be any of FLOAT, FLOAT_VEC2, FLOAT_VEC3, 104 FLOAT_VEC4, FLOAT_MAT2, FLOAT_MAT3, FLOAT_MAT4, FLOAT_MAT2x3_NV, 105 FLOAT_MAT2x4_NV, FLOAT_MAT3x2_NV, FLOAT_MAT3x4_NV, FLOAT_MAT4x2_NV 106 or FLOAT_MAT4x3_NV. 107 108 Replace the last sentence on page 36: 109 110 The type returned can be any of FLOAT, FLOAT_VEC2, FLOAT_VEC3, 111 FLOAT_VEC4, INT, INT_VEC2, INT_VEC3, INT_VEC4, BOOL, BOOL_VEC2, 112 BOOL_VEC3, BOOL_VEC4, FLOAT_MAT2, FLOAT_MAT3, FLOAT_MAT4, 113 FLOAT_MAT2x3_NV, FLOAT_MAT2x4_NV, FLOAT_MAT3x2_NV, 114 FLOAT_MAT3x4_NV, FLOAT_MAT4x2_NV, SAMPLER_2D, or SAMPLER_CUBE. 115 116 Add the following commands to the 4th paragraph on page 37: 117 118 void UniformMatrix2x3fvNV(int location, sizei count, 119 boolean transpose, const float *value); 120 121 void UniformMatrix3x2fvNV(int location, sizei count, 122 boolean transpose, const float *value); 123 124 void UniformMatrix2x4fvNV(int location, sizei count, 125 boolean transpose, const float *value); 126 127 void UniformMatrix4x2fvNV(int location, sizei count, 128 boolean transpose, const float *value); 129 130 void UniformMatrix3x4fvNV(int location, sizei count, 131 boolean transpose, const float *value); 132 133 void UniformMatrix4x3fvNV(int location, sizei count, 134 boolean transpose, const float *value); 135 136 Insert before the last paragraph on page 37: 137 138 The UniformMatrix{2x3,3x2,2x4,4x2,3x4,4x3}fvNV commands will load 139 count 2x3, 3x2, 2x4, 4x2, 3x4, or 4x3 matrices (corresponding to 140 the numbers in the command name) of floating-point values into a 141 uniform location defined as a matrix or an array of matrices. The 142 first number in the command name is the number of columns; the 143 second is the number of rows. For example, UniformMatrix2x4fvNV is 144 used to load a matrix consisting of two columns and four rows. The 145 <transpose> argument must be false and matrices are specified in 146 column major order. 147 148OpenGL ES Shading Language Specification v1.0.17 Updates 149 150 Including the following line in a shader can be used to control 151 the language features described in this extension: 152 153 #extension GL_NV_non_square_matrices : <behavior> 154 155 where <behavior> is as specified in section 3.3. 156 157 A new preprocessor #define is added to the OpenGL Shading 158 Language: 159 160 #define GL_NV_non_square_matrices 1 161 162 Add the following types to the Basic Types table in section 4.1: 163 164 mat2x3 - a 2x3 floating-point matrix 165 mat3x2 - a 3x2 floating-point matrix 166 mat2x4 - a 2x4 floating-point matrix 167 mat4x2 - a 4x2 floating-point matrix 168 mat3x4 - a 3x4 floating-point matrix 169 mat4x3 - a 4x3 floating-point matrix 170 171 Section 4.1.6 - Matrices 172 Replace the text under this section with 173 174 Matrices are another useful data type in computer graphics, and 175 the OpenGL ES Shading Language defines support for 2x2, 2x3, 2x4, 176 3x2, 3x3, 3x4, 4x2, 4x3 and 4x4 matrices of floating point 177 numbers. Matrices are read from and written to in column major 178 order. Example matrix declarations: 179 180 mat2 mat2D; 181 mat3 optMatrix; 182 mat4 view, projection; 183 mat2x3 a; 184 mat3x4 b; 185 186 Initialization of matrix values is done with constructors 187 (described in Section 5.4 "Constructors") in column-major order. 188 189 mat2 is an alias for mat2x2, not a distinct type. Similarly for 190 mat3 and mat4. The following is legal: 191 192 mat2 a; 193 mat2x2 b = a; 194 195 Section 4.3.3 - Attribute 196 Replace the sixth sentence with: 197 198 A mat2x4, mat3x4 or mat4 attribute will use up the equivalent of 4 199 vec4 attribute variable locations, a mat2x3, mat3 or mat4x3 will 200 use up the equivalent of 3 attribute variable locations, and a 201 mat2, mat3x2 or mat4x2 will use up 2 attribute variable locations. 202 203 Section 5.4.2 - Vector and Matrix constructors 204 Replace the last paragraph with: 205 206 A wide range of other possibilities exist, to construct a matrix 207 from vectors and scalars, as long as enough components are present 208 to initialize the matrix. To construct a matrix from a matrix: 209 210 mat3x3(mat4x4); // takes the upper-left 3x3 of the mat4x4 211 mat2x3(mat4x2); // takes the upper-left 2x2 of the mat4x4, last row is 0,0 212 mat4x4(mat3x3); // puts the mat3x3 in the upper-left, sets the lower right 213 // component to 1, and the rest to 0 214 215Interactions with EXT_separate_shader_objects 216 217 If EXT_separate_shader_objects is supported, then the 218 ProgramUniformMatrix{2x3,3x2,2x4,4x2,3x4,4x3}fvEXT functions will 219 be present in both OpenGL ES 2.0 and OpenGL ES 3.0 instead of only 220 in OpenGL ES 3.0. 221 222Errors 223 224 None. 225 226New State 227 228 None. 229 230New Implementation Dependent State 231 232 None. 233 234Revision History 235 236 06-06-12 nsubtil - Initial version 237 07-23-12 nsubtil - Added NV suffix to entry point and token names 238 Added return values for GetActiveAttrib and GetActiveUniform 239 Added extension pragma to the GLSL updates section 240 Disallow transpose = TRUE in UniformMatrix*x*fvNV 241 Added TBD interactions with SSO 242 09-19-13 marka - EXT_separate_shader_object interactions 243