Browse Source

fix getUniformInfo(), See Issue #2883 (#2885)

云风 3 years ago
parent
commit
8207645355
2 changed files with 13 additions and 1 deletions
  1. 1 1
      src/bgfx_p.h
  2. 12 0
      tools/shaderc/shaderc_glsl.cpp

+ 1 - 1
src/bgfx_p.h

@@ -4103,7 +4103,7 @@ namespace bgfx
 				PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
 				if (PredefinedUniform::Count == predefined && UniformType::End != UniformType::Enum(type) )
 				{
-					uniforms[sr.m_num] = createUniform(name, UniformType::Enum(type), regCount);
+					uniforms[sr.m_num] = createUniform(name, UniformType::Enum(type), num);
 					sr.m_num++;
 				}
 			}

+ 12 - 0
tools/shaderc/shaderc_glsl.cpp

@@ -207,6 +207,18 @@ namespace bgfx { namespace glsl
 						un.num = num;
 						un.regIndex = 0;
 						un.regCount = num;
+						switch (un.type)
+						{
+						case UniformType::Mat3:
+							un.regCount *= 3;
+							break;
+						case UniformType::Mat4:
+							un.regCount *= 4;
+							break;
+						default:
+							break;
+						}
+
 						uniforms.push_back(un);
 					}