Added API to query for active attribs and uniforms. These functions are modeled after glGetShaderiv, glGetProgramiv, glGetActiveAttrib, and glGetActiveUniform. The main difference between this and OpenGL API is that we do not have programs - just shaders.
BUG=26
Review URL: http://codereview.appspot.com/2183041
git-svn-id: https://angleproject.googlecode.com/svn/trunk@425 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Shader.cpp b/src/libGLESv2/Shader.cpp
index 0863a39..83961d1 100644
--- a/src/libGLESv2/Shader.cpp
+++ b/src/libGLESv2/Shader.cpp
@@ -281,21 +281,23 @@
delete[] mInfoLog;
mInfoLog = NULL;
- int result = ShCompile(compiler, &mSource, 1, EShOptNone, EDebugOpNone);
- const char *obj = ShGetObjectCode(compiler);
- const char *info = ShGetInfoLog(compiler);
+ int result = ShCompile(compiler, &mSource, 1, EShOptObjectCode);
if (result)
{
- mHlsl = new char[strlen(obj) + 1];
- strcpy(mHlsl, obj);
+ int objCodeLen = 0;
+ ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &objCodeLen);
+ mHlsl = new char[objCodeLen];
+ ShGetObjectCode(compiler, mHlsl);
TRACE("\n%s", mHlsl);
}
else
{
- mInfoLog = new char[strlen(info) + 1];
- strcpy(mInfoLog, info);
+ int infoLogLen = 0;
+ ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &infoLogLen);
+ mInfoLog = new char[infoLogLen];
+ ShGetInfoLog(compiler, mInfoLog);
TRACE("\n%s", mInfoLog);
}