diff options
author | marha <marha@users.sourceforge.net> | 2015-03-22 14:10:47 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2015-03-22 14:10:47 +0100 |
commit | 3bc24b271f45f9f33484b8cf53b44f33f7e8a237 (patch) | |
tree | 193651a94adb3804e800747e993d07b92688e4d4 /mesalib/src/mesa/main/shaderapi.c | |
parent | c646056120fe14e4c4ccf81bac5d78d61225a8e8 (diff) | |
parent | 82c8df11062f72a7d467e26cedbbd8b322ff7a70 (diff) | |
download | vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.gz vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.bz2 vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/src/mapi/glapi/glapi.h
mesalib/src/mapi/glapi/glapi_nop.c
mesalib/src/mesa/main/bufferobj.c
Diffstat (limited to 'mesalib/src/mesa/main/shaderapi.c')
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 5731d581a..30716f5e3 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -1027,15 +1027,14 @@ _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, static void -use_shader_program(struct gl_context *ctx, GLenum type, +use_shader_program(struct gl_context *ctx, gl_shader_stage stage, struct gl_shader_program *shProg, struct gl_pipeline_object *shTarget) { struct gl_shader_program **target; - gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type); target = &shTarget->CurrentProgram[stage]; - if ((shProg == NULL) || (shProg->_LinkedShaders[stage] == NULL)) + if ((shProg != NULL) && (shProg->_LinkedShaders[stage] == NULL)) shProg = NULL; if (*target != shProg) { @@ -1048,17 +1047,17 @@ use_shader_program(struct gl_context *ctx, GLenum type, * it from that binding point as well. This ensures that the correct * semantics of glDeleteProgram are maintained. */ - switch (type) { - case GL_VERTEX_SHADER: + switch (stage) { + case MESA_SHADER_VERTEX: /* Empty for now. */ break; - case GL_GEOMETRY_SHADER_ARB: + case MESA_SHADER_GEOMETRY: /* Empty for now. */ break; - case GL_COMPUTE_SHADER: + case MESA_SHADER_COMPUTE: /* Empty for now. */ break; - case GL_FRAGMENT_SHADER: + case MESA_SHADER_FRAGMENT: if (*target == ctx->_Shader->_CurrentFragmentProgram) { _mesa_reference_shader_program(ctx, &ctx->_Shader->_CurrentFragmentProgram, @@ -1079,10 +1078,9 @@ use_shader_program(struct gl_context *ctx, GLenum type, void _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg) { - use_shader_program(ctx, GL_VERTEX_SHADER, shProg, &ctx->Shader); - use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg, &ctx->Shader); - use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg, &ctx->Shader); - use_shader_program(ctx, GL_COMPUTE_SHADER, shProg, &ctx->Shader); + int i; + for (i = 0; i < MESA_SHADER_STAGES; i++) + use_shader_program(ctx, i, shProg, &ctx->Shader); _mesa_active_program(ctx, shProg, "glUseProgram"); if (ctx->Driver.UseProgram) @@ -1460,7 +1458,7 @@ read_shader(const char *fname) fclose(f); - shader = _mesa_strdup(buffer); + shader = strdup(buffer); free(buffer); return shader; @@ -1889,7 +1887,8 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type, struct gl_shader_program *shProg, struct gl_pipeline_object *shTarget) { - use_shader_program(ctx, type, shProg, shTarget); + gl_shader_stage stage = _mesa_shader_enum_to_shader_stage(type); + use_shader_program(ctx, stage, shProg, shTarget); if (ctx->Driver.UseProgram) ctx->Driver.UseProgram(ctx, shProg); |