diff options
Diffstat (limited to 'linden/indra/newview/llglslshader.cpp')
-rw-r--r-- | linden/indra/newview/llglslshader.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/linden/indra/newview/llglslshader.cpp b/linden/indra/newview/llglslshader.cpp index 9c3d707..cc440c4 100644 --- a/linden/indra/newview/llglslshader.cpp +++ b/linden/indra/newview/llglslshader.cpp | |||
@@ -180,7 +180,7 @@ static LLString get_object_log(GLhandleARB ret) | |||
180 | //the log could be any size, so allocate appropriately | 180 | //the log could be any size, so allocate appropriately |
181 | GLcharARB* log = new GLcharARB[length]; | 181 | GLcharARB* log = new GLcharARB[length]; |
182 | glGetInfoLogARB(ret, length, &length, log); | 182 | glGetInfoLogARB(ret, length, &length, log); |
183 | res = LLString(log); | 183 | res = LLString((char *)log); |
184 | delete[] log; | 184 | delete[] log; |
185 | } | 185 | } |
186 | return res; | 186 | return res; |
@@ -249,11 +249,12 @@ GLhandleARB LLShaderMgr::loadShader(const LLString& filename, S32 cls, GLenum ty | |||
249 | GLcharARB* text[1024]; | 249 | GLcharARB* text[1024]; |
250 | GLuint count = 0; | 250 | GLuint count = 0; |
251 | 251 | ||
252 | |||
252 | //copy file into memory | 253 | //copy file into memory |
253 | while(fgets(buff, 1024, file) != NULL) | 254 | while(fgets((char *)buff, 1024, file) != NULL && count < (sizeof(buff)/sizeof(buff[0]))) |
254 | { | 255 | { |
255 | text[count++] = strdup(buff); | 256 | text[count++] = (GLcharARB *)strdup((char *)buff); |
256 | } | 257 | } |
257 | fclose(file); | 258 | fclose(file); |
258 | 259 | ||
259 | //create shader object | 260 | //create shader object |
@@ -1036,7 +1037,7 @@ BOOL LLGLSLShader::mapAttributes(const char** attrib_names, S32 count) | |||
1036 | for (S32 i = 0; i < (S32) LLShaderMgr::sReservedAttribCount; i++) | 1037 | for (S32 i = 0; i < (S32) LLShaderMgr::sReservedAttribCount; i++) |
1037 | { | 1038 | { |
1038 | const char* name = LLShaderMgr::sReservedAttribs[i]; | 1039 | const char* name = LLShaderMgr::sReservedAttribs[i]; |
1039 | S32 index = glGetAttribLocationARB(mProgramObject, name); | 1040 | S32 index = glGetAttribLocationARB(mProgramObject, (GLcharARB *)name); |
1040 | if (index != -1) | 1041 | if (index != -1) |
1041 | { | 1042 | { |
1042 | mAttribute[i] = index; | 1043 | mAttribute[i] = index; |
@@ -1047,7 +1048,7 @@ BOOL LLGLSLShader::mapAttributes(const char** attrib_names, S32 count) | |||
1047 | for (S32 i = 0; i < count; i++) | 1048 | for (S32 i = 0; i < count; i++) |
1048 | { | 1049 | { |
1049 | const char* name = attrib_names[i]; | 1050 | const char* name = attrib_names[i]; |
1050 | S32 index = glGetAttribLocationARB(mProgramObject, name); | 1051 | S32 index = glGetAttribLocationARB(mProgramObject, (GLcharARB *)name); |
1051 | if (index != -1) | 1052 | if (index != -1) |
1052 | { | 1053 | { |
1053 | mAttribute[LLShaderMgr::sReservedAttribCount + i] = index; | 1054 | mAttribute[LLShaderMgr::sReservedAttribCount + i] = index; |
@@ -1074,7 +1075,7 @@ void LLGLSLShader::mapUniform(GLint index, const char** uniform_names, S32 count | |||
1074 | char name[1024]; /* Flawfinder: ignore */ | 1075 | char name[1024]; /* Flawfinder: ignore */ |
1075 | name[0] = 0; | 1076 | name[0] = 0; |
1076 | 1077 | ||
1077 | glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, name); | 1078 | glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name); |
1078 | 1079 | ||
1079 | //find the index of this uniform | 1080 | //find the index of this uniform |
1080 | for (S32 i = 0; i < (S32) LLShaderMgr::sReservedUniformCount; i++) | 1081 | for (S32 i = 0; i < (S32) LLShaderMgr::sReservedUniformCount; i++) |
@@ -1082,7 +1083,7 @@ void LLGLSLShader::mapUniform(GLint index, const char** uniform_names, S32 count | |||
1082 | if (mUniform[i] == -1 && !strncmp(LLShaderMgr::sReservedUniforms[i],name, strlen(LLShaderMgr::sReservedUniforms[i]))) /* Flawfinder: ignore */ | 1083 | if (mUniform[i] == -1 && !strncmp(LLShaderMgr::sReservedUniforms[i],name, strlen(LLShaderMgr::sReservedUniforms[i]))) /* Flawfinder: ignore */ |
1083 | { | 1084 | { |
1084 | //found it | 1085 | //found it |
1085 | S32 location = glGetUniformLocationARB(mProgramObject, name); | 1086 | S32 location = glGetUniformLocationARB(mProgramObject, (GLcharARB *)name); |
1086 | mUniform[i] = location; | 1087 | mUniform[i] = location; |
1087 | llinfos << "Uniform " << name << " is at location " << location << llendl; | 1088 | llinfos << "Uniform " << name << " is at location " << location << llendl; |
1088 | mTexture[i] = mapUniformTextureChannel(location, type); | 1089 | mTexture[i] = mapUniformTextureChannel(location, type); |
@@ -1096,7 +1097,7 @@ void LLGLSLShader::mapUniform(GLint index, const char** uniform_names, S32 count | |||
1096 | !strncmp(uniform_names[i],name, strlen(uniform_names[i]))) /* Flawfinder: ignore */ | 1097 | !strncmp(uniform_names[i],name, strlen(uniform_names[i]))) /* Flawfinder: ignore */ |
1097 | { | 1098 | { |
1098 | //found it | 1099 | //found it |
1099 | S32 location = glGetUniformLocationARB(mProgramObject, name); | 1100 | S32 location = glGetUniformLocationARB(mProgramObject, (GLcharARB *)name); |
1100 | mUniform[i+LLShaderMgr::sReservedUniformCount] = location; | 1101 | mUniform[i+LLShaderMgr::sReservedUniformCount] = location; |
1101 | llinfos << "Uniform " << name << " is at location " << location << " stored in index " << | 1102 | llinfos << "Uniform " << name << " is at location " << location << " stored in index " << |
1102 | (i+LLShaderMgr::sReservedUniformCount) << llendl; | 1103 | (i+LLShaderMgr::sReservedUniformCount) << llendl; |
@@ -1215,7 +1216,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) | |||
1215 | void LLScatterShader::init(GLhandleARB shader, int map_stage) | 1216 | void LLScatterShader::init(GLhandleARB shader, int map_stage) |
1216 | { | 1217 | { |
1217 | glUseProgramObjectARB(shader); | 1218 | glUseProgramObjectARB(shader); |
1218 | glUniform1iARB(glGetUniformLocationARB(shader, "scatterMap"), map_stage); | 1219 | glUniform1iARB(glGetUniformLocationARB(shader, (GLcharARB *)"scatterMap"), map_stage); |
1219 | glUseProgramObjectARB(0); | 1220 | glUseProgramObjectARB(0); |
1220 | } | 1221 | } |
1221 | 1222 | ||