summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/shader_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/shader_api.c')
-rw-r--r--src/mesa/shader/shader_api.c84
1 files changed, 44 insertions, 40 deletions
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index e8eaa9c1031..940fe2d03ce 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -46,7 +46,7 @@
#include "shader/shader_api.h"
#include "shader/slang/slang_compile.h"
#include "shader/slang/slang_link.h"
-#include "glapi/dispatch.h"
+#include "main/dispatch.h"
/**
@@ -115,12 +115,12 @@ _mesa_free_shader_program_data(GLcontext *ctx,
shProg->NumShaders = 0;
if (shProg->Shaders) {
- _mesa_free(shProg->Shaders);
+ free(shProg->Shaders);
shProg->Shaders = NULL;
}
if (shProg->InfoLog) {
- _mesa_free(shProg->InfoLog);
+ free(shProg->InfoLog);
shProg->InfoLog = NULL;
}
}
@@ -134,7 +134,7 @@ _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
{
_mesa_free_shader_program_data(ctx, shProg);
- _mesa_free(shProg);
+ free(shProg);
}
@@ -262,11 +262,11 @@ void
_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh)
{
if (sh->Source)
- _mesa_free((void *) sh->Source);
+ free((void *) sh->Source);
if (sh->InfoLog)
- _mesa_free(sh->InfoLog);
+ free(sh->InfoLog);
_mesa_reference_program(ctx, &sh->Program, NULL);
- _mesa_free(sh);
+ free(sh);
}
@@ -374,21 +374,21 @@ get_shader_flags(void)
const char *env = _mesa_getenv("MESA_GLSL");
if (env) {
- if (_mesa_strstr(env, "dump"))
+ if (strstr(env, "dump"))
flags |= GLSL_DUMP;
- if (_mesa_strstr(env, "log"))
+ if (strstr(env, "log"))
flags |= GLSL_LOG;
- if (_mesa_strstr(env, "nopvert"))
+ if (strstr(env, "nopvert"))
flags |= GLSL_NOP_VERT;
- if (_mesa_strstr(env, "nopfrag"))
+ if (strstr(env, "nopfrag"))
flags |= GLSL_NOP_FRAG;
- if (_mesa_strstr(env, "nopt"))
+ if (strstr(env, "nopt"))
flags |= GLSL_NO_OPT;
- else if (_mesa_strstr(env, "opt"))
+ else if (strstr(env, "opt"))
flags |= GLSL_OPT;
- if (_mesa_strstr(env, "uniform"))
+ if (strstr(env, "uniform"))
flags |= GLSL_UNIFORMS;
- if (_mesa_strstr(env, "useprog"))
+ if (strstr(env, "useprog"))
flags |= GLSL_USE_PROG;
}
@@ -709,7 +709,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
/* alloc new, smaller array */
newList = (struct gl_shader **)
- _mesa_malloc((n - 1) * sizeof(struct gl_shader *));
+ malloc((n - 1) * sizeof(struct gl_shader *));
if (!newList) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
return;
@@ -719,7 +719,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
while (++i < n)
newList[j++] = shProg->Shaders[i];
- _mesa_free(shProg->Shaders);
+ free(shProg->Shaders);
shProg->Shaders = newList;
shProg->NumShaders = n - 1;
@@ -769,6 +769,8 @@ sizeof_glsl_type(GLenum type)
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_2D_RECT_ARB:
case GL_SAMPLER_2D_RECT_SHADOW_ARB:
+ case GL_SAMPLER_1D_ARRAY_EXT:
+ case GL_SAMPLER_2D_ARRAY_EXT:
case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_CUBE_SHADOW_EXT:
@@ -848,6 +850,8 @@ is_sampler_type(GLenum type)
case GL_SAMPLER_2D_RECT_SHADOW_ARB:
case GL_SAMPLER_1D_ARRAY_EXT:
case GL_SAMPLER_2D_ARRAY_EXT:
+ case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
+ case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
return GL_TRUE;
default:
return GL_FALSE;
@@ -1377,15 +1381,15 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
if (c) {
/* truncate name at [ */
const GLint len = c - name;
- GLchar *newName = _mesa_malloc(len + 1);
+ GLchar *newName = malloc(len + 1);
if (!newName)
return -1; /* out of mem */
- _mesa_memcpy(newName, name, len);
+ memcpy(newName, name, len);
newName[len] = 0;
location = _mesa_lookup_uniform(shProg->Uniforms, newName);
if (location >= 0) {
- const GLint element = _mesa_atoi(c + 1);
+ const GLint element = atoi(c + 1);
if (element > 0) {
/* get type of the uniform array element */
struct gl_program_parameter *p;
@@ -1400,7 +1404,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
}
}
- _mesa_free(newName);
+ free(newName);
}
}
@@ -1431,7 +1435,7 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
/* free old shader source string and install new one */
if (sh->Source) {
- _mesa_free((void *) sh->Source);
+ free((void *) sh->Source);
}
sh->Source = source;
sh->CompileStatus = GL_FALSE;
@@ -1483,12 +1487,12 @@ _mesa_link_program(GLcontext *ctx, GLuint program)
if (0) {
GLuint i;
- _mesa_printf("Link %u shaders in program %u: %s\n",
+ printf("Link %u shaders in program %u: %s\n",
shProg->NumShaders, shProg->Name,
shProg->LinkStatus ? "Success" : "Failed");
for (i = 0; i < shProg->NumShaders; i++) {
- _mesa_printf(" shader %u, type 0x%x\n",
+ printf(" shader %u, type 0x%x\n",
shProg->Shaders[i]->Name,
shProg->Shaders[i]->Type);
}
@@ -1504,7 +1508,7 @@ print_shader_info(const struct gl_shader_program *shProg)
{
GLuint i;
- _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name);
+ printf("Mesa: glUseProgram(%u)\n", shProg->Name);
for (i = 0; i < shProg->NumShaders; i++) {
const char *s;
switch (shProg->Shaders[i]->Type) {
@@ -1520,14 +1524,14 @@ print_shader_info(const struct gl_shader_program *shProg)
default:
s = "";
}
- _mesa_printf(" %s shader %u, checksum %u\n", s,
- shProg->Shaders[i]->Name,
- shProg->Shaders[i]->SourceChecksum);
+ printf(" %s shader %u, checksum %u\n", s,
+ shProg->Shaders[i]->Name,
+ shProg->Shaders[i]->SourceChecksum);
}
if (shProg->VertexProgram)
- _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
+ printf(" vert prog %u\n", shProg->VertexProgram->Base.Id);
if (shProg->FragmentProgram)
- _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
+ printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id);
}
@@ -1697,8 +1701,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program,
/* This maps a sampler to a texture unit: */
if (sampler < MAX_SAMPLERS) {
#if 0
- _mesa_printf("Set program %p sampler %d '%s' to unit %u\n",
- program, sampler, param->Name, texUnit);
+ printf("Set program %p sampler %d '%s' to unit %u\n",
+ program, sampler, param->Name, texUnit);
#endif
if (program->SamplerUnits[sampler] != texUnit) {
program->SamplerUnits[sampler] = texUnit;
@@ -1861,21 +1865,21 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
if (ctx->Shader.Flags & GLSL_UNIFORMS) {
GLint i;
- _mesa_printf("Mesa: set program %u uniform %s (loc %d) to: ",
- shProg->Name, uniform->Name, location);
+ printf("Mesa: set program %u uniform %s (loc %d) to: ",
+ shProg->Name, uniform->Name, location);
if (basicType == GL_INT) {
const GLint *v = (const GLint *) values;
for (i = 0; i < count * elems; i++) {
- _mesa_printf("%d ", v[i]);
+ printf("%d ", v[i]);
}
}
else {
const GLfloat *v = (const GLfloat *) values;
for (i = 0; i < count * elems; i++) {
- _mesa_printf("%g ", v[i]);
+ printf("%g ", v[i]);
}
}
- _mesa_printf("\n");
+ printf("\n");
}
/* A uniform var may be used by both a vertex shader and a fragment
@@ -2077,8 +2081,8 @@ validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg)
target = prog->SamplerTargets[sampler];
if (targetUsed[unit] != -1 && targetUsed[unit] != target) {
_mesa_snprintf(errMsg, 100,
- "Texture unit %d is accessed both as %s and %s",
- unit, targetName[targetUsed[unit]], targetName[target]);
+ "Texture unit %d is accessed both as %s and %s",
+ unit, targetName[targetUsed[unit]], targetName[target]);
return GL_FALSE;
}
targetUsed[unit] = target;
@@ -2155,7 +2159,7 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
if (!shProg->Validated) {
/* update info log */
if (shProg->InfoLog) {
- _mesa_free(shProg->InfoLog);
+ free(shProg->InfoLog);
}
shProg->InfoLog = _mesa_strdup(errMsg);
}