GET_SHADER(sha, shaderObj, "glShaderSourceARB");
if (sha == NULL)
- return;\r
-\r
- if (string == NULL)\r
- {\r
- RELEASE_SHADER(sha);\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");\r
- return;\r
+ return;
+
+ if (string == NULL)
+ {
+ RELEASE_SHADER(sha);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
}
/*
}
for (i = 0; i < count; i++)
- {\r
- if (string[i] == NULL)\r
- {\r
- _mesa_free ((GLvoid *) offsets);\r
- RELEASE_SHADER(sha);\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");\r
- return;\r
+ {
+ if (string[i] == NULL)
+ {
+ _mesa_free ((GLvoid *) offsets);
+ RELEASE_SHADER(sha);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
}
if (length == NULL || length[i] < 0)
offsets[i] = _mesa_strlen (string[i]);
if (pro != NULL)
{
- (**pro).Link (pro);\r
- if (pro == ctx->ShaderObjects.CurrentProgram)\r
- {\r
- if ((**pro).GetLinkStatus (pro))\r
- _mesa_UseProgramObjectARB (programObj);\r
- else\r
- _mesa_UseProgramObjectARB (0);\r
+ (**pro).Link (pro);
+ if (pro == ctx->ShaderObjects.CurrentProgram)
+ {
+ if ((**pro).GetLinkStatus (pro))
+ _mesa_UseProgramObjectARB (programObj);
+ else
+ _mesa_UseProgramObjectARB (0);
}
RELEASE_PROGRAM(pro);
}
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (programObj != 0)
- {\r
+ {
GET_PROGRAM(pro, programObj, "glUseProgramObjectARB");
if (pro == NULL)
return;
}
- program = pro;\r
-\r
- ctx->ShaderObjects._VertexShaderPresent = (**pro).IsShaderPresent (pro, GL_VERTEX_SHADER_ARB);\r
- ctx->ShaderObjects._FragmentShaderPresent = (**pro).IsShaderPresent (pro,\r
+ program = pro;
+
+ ctx->ShaderObjects._VertexShaderPresent = (**pro).IsShaderPresent (pro, GL_VERTEX_SHADER_ARB);
+ ctx->ShaderObjects._FragmentShaderPresent = (**pro).IsShaderPresent (pro,
GL_FRAGMENT_SHADER_ARB);
- }\r
- else\r
- {\r
- ctx->ShaderObjects._VertexShaderPresent = GL_FALSE;\r
- ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;\r
+ }
+ else
+ {
+ ctx->ShaderObjects._VertexShaderPresent = GL_FALSE;
+ ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;
}
if (ctx->ShaderObjects.CurrentProgram != NULL)
_mesa_Uniform1fARB (GLint location, GLfloat v0)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1fARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1fARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform2fARB (GLint location, GLfloat v0, GLfloat v1)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2fARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2fARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLfloat v[2] = { v0, v1 };
+ GLfloat v[2];
+ v[0] = v0;
+ v[1] = v1;
if (!_slang_write_uniform (pro, location, 1, v, GL_FLOAT_VEC2))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fARB");
_mesa_Uniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3fARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3fARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLfloat v[3] = { v0, v1, v2 };
+ GLfloat v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
if (!_slang_write_uniform (pro, location, 1, v, GL_FLOAT_VEC3))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fARB");
_mesa_Uniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4fARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4fARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLfloat v[4] = { v0, v1, v2, v3 };
+ GLfloat v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
if (!_slang_write_uniform (pro, location, 1, v, GL_FLOAT_VEC4))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fARB");
_mesa_Uniform1iARB (GLint location, GLint v0)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1iARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1iARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform2iARB (GLint location, GLint v0, GLint v1)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2iARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2iARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLint v[2] = { v0, v1 };
+ GLint v[2];
+ v[0] = v0;
+ v[1] = v1;
if (!_slang_write_uniform (pro, location, 1, v, GL_INT_VEC2))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2iARB");
_mesa_Uniform3iARB (GLint location, GLint v0, GLint v1, GLint v2)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3iARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3iARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLint v[3] = { v0, v1, v2 };
+ GLint v[3];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
if (!_slang_write_uniform (pro, location, 1, v, GL_INT_VEC3))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3iARB");
_mesa_Uniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4iARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4iARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
{
- GLint v[4] = { v0, v1, v2, v3 };
+ GLint v[4];
+ v[0] = v0;
+ v[1] = v1;
+ v[2] = v2;
+ v[3] = v3;
if (!_slang_write_uniform (pro, location, 1, v, GL_INT_VEC4))
_mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4iARB");
_mesa_Uniform1fvARB (GLint location, GLsizei count, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform2fvARB (GLint location, GLsizei count, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform3fvARB (GLint location, GLsizei count, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform4fvARB (GLint location, GLsizei count, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform1ivARB (GLint location, GLsizei count, const GLint *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1ivARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform1ivARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform2ivARB (GLint location, GLsizei count, const GLint *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2ivARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform2ivARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform3ivARB (GLint location, GLsizei count, const GLint *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3ivARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform3ivARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_Uniform4ivARB (GLint location, GLsizei count, const GLint *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4ivARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniform4ivARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_UniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix2fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix2fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_UniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix3fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix3fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
_mesa_UniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
{
GET_CURRENT_CONTEXT(ctx);
- GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix4fvARB");\r
-\r
+ GET_CURRENT_LINKED_PROGRAM(pro, "glUniformMatrix4fvARB");
+
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
if (pro != NULL)
}
}
+
+/**
+ * Copy string from <src> to <dst>, up to maxLength characters, returning
+ * length of <dst> in <length>.
+ * \param src the strings source
+ * \param maxLength max chars to copy
+ * \param length returns numberof chars copied
+ * \param dst the string destination
+ */
static GLvoid
-_mesa_get_string (const GLcharARB *src, GLsizei maxLength, GLsizei *length, GLcharARB *str)
+copy_string(const GLcharARB *src, GLsizei maxLength, GLsizei *length,
+ GLcharARB *dst)
{
GLsizei len;
-
- if (maxLength == 0)
- {
- if (length != NULL)
- *length = 0;
- return;
- }
-
- if (src == NULL)
- src = "";
-
- len = _mesa_strlen (src);
- if (len >= maxLength)
- len = maxLength - 1;
-
- _mesa_memcpy (str, src, len * sizeof (GLcharARB));
- str[len] = '\0';
- if (length != NULL)
+ for (len = 0; len < maxLength - 1 && src && src[len]; len++)
+ dst[len] = src[len];
+ if (maxLength > 0)
+ dst[len] = 0;
+ if (length)
*length = len;
}
+
GLvoid GLAPIENTRY
_mesa_GetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog)
{
if (gen != NULL)
{
- _mesa_get_string ((**gen).GetInfoLog (gen), maxLength, length, infoLog);
+ copy_string((**gen).GetInfoLog (gen), maxLength, length, infoLog);
RELEASE_GENERIC(gen);
}
}
if (sha != NULL)
{
- _mesa_get_string ((**sha).GetSource (sha), maxLength, length, source);
+ copy_string((**sha).GetSource (sha), maxLength, length, source);
RELEASE_SHADER(sha);
}
}
GLvoid
_mesa_init_shaderobjects (GLcontext *ctx)
{
- ctx->ShaderObjects.CurrentProgram = NULL;\r
- ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;\r
+ ctx->ShaderObjects.CurrentProgram = NULL;
+ ctx->ShaderObjects._FragmentShaderPresent = GL_FALSE;
ctx->ShaderObjects._VertexShaderPresent = GL_FALSE;
_mesa_init_shaderobjects_3dlabs (ctx);