diff --git a/tools/shaderc/shaderc.cpp b/tools/shaderc/shaderc.cpp index c4a1ef8f8..9004fdf88 100644 --- a/tools/shaderc/shaderc.cpp +++ b/tools/shaderc/shaderc.cpp @@ -2313,49 +2313,6 @@ namespace bgfx bx::stringPrintf(code, "precision highp float;\n"); bx::stringPrintf(code, "precision highp int;\n"); } - else - { - code += - "mat2 transpose(mat2 _mtx)\n" - "{\n" - " vec2 v0 = _mtx[0];\n" - " vec2 v1 = _mtx[1];\n" - "\n" - " return mat2(\n" - " vec2(v0.x, v1.x)\n" - " , vec2(v0.y, v1.y)\n" - " );\n" - "}\n" - "\n" - "mat3 transpose(mat3 _mtx)\n" - "{\n" - " vec3 v0 = _mtx[0];\n" - " vec3 v1 = _mtx[1];\n" - " vec3 v2 = _mtx[2];\n" - "\n" - " return mat3(\n" - " vec3(v0.x, v1.x, v2.x)\n" - " , vec3(v0.y, v1.y, v2.y)\n" - " , vec3(v0.z, v1.z, v2.z)\n" - " );\n" - "}\n" - "\n" - "mat4 transpose(mat4 _mtx)\n" - "{\n" - " vec4 v0 = _mtx[0];\n" - " vec4 v1 = _mtx[1];\n" - " vec4 v2 = _mtx[2];\n" - " vec4 v3 = _mtx[3];\n" - "\n" - " return mat4(\n" - " vec4(v0.x, v1.x, v2.x, v3.x)\n" - " , vec4(v0.y, v1.y, v2.y, v3.y)\n" - " , vec4(v0.z, v1.z, v2.z, v3.z)\n" - " , vec4(v0.w, v1.w, v2.w, v3.w)\n" - " );\n" - "}\n" - ; - } // Pretend that all extensions are available. // This will be stripped later. @@ -2419,6 +2376,50 @@ namespace bgfx , "#extension GL_EXT_texture_array : enable\n" ); } + + if (glsl_profile == 100) + { + code += + "mat2 transpose(mat2 _mtx)\n" + "{\n" + " vec2 v0 = _mtx[0];\n" + " vec2 v1 = _mtx[1];\n" + "\n" + " return mat2(\n" + " vec2(v0.x, v1.x)\n" + " , vec2(v0.y, v1.y)\n" + " );\n" + "}\n" + "\n" + "mat3 transpose(mat3 _mtx)\n" + "{\n" + " vec3 v0 = _mtx[0];\n" + " vec3 v1 = _mtx[1];\n" + " vec3 v2 = _mtx[2];\n" + "\n" + " return mat3(\n" + " vec3(v0.x, v1.x, v2.x)\n" + " , vec3(v0.y, v1.y, v2.y)\n" + " , vec3(v0.z, v1.z, v2.z)\n" + " );\n" + "}\n" + "\n" + "mat4 transpose(mat4 _mtx)\n" + "{\n" + " vec4 v0 = _mtx[0];\n" + " vec4 v1 = _mtx[1];\n" + " vec4 v2 = _mtx[2];\n" + " vec4 v3 = _mtx[3];\n" + "\n" + " return mat4(\n" + " vec4(v0.x, v1.x, v2.x, v3.x)\n" + " , vec4(v0.y, v1.y, v2.y, v3.y)\n" + " , vec4(v0.z, v1.z, v2.z, v3.z)\n" + " , vec4(v0.w, v1.w, v2.w, v3.w)\n" + " );\n" + "}\n" + ; + } } } else