summaryrefslogtreecommitdiffstats
path: root/src/glsl/main.cpp
diff options
context:
space:
mode:
authorChristian König <[email protected]>2011-02-24 22:02:42 +0100
committerChristian König <[email protected]>2011-02-24 22:02:42 +0100
commitb922a0ce12916a91cfc3e56714913fcf63279ff2 (patch)
treee24fa039925220882d155ccb987f7914e83f4372 /src/glsl/main.cpp
parentf013b4f8f1329982727691a55cc263e3011d02bf (diff)
parentc0ad70ae31ee5501281b434d56e389fc92b13a3a (diff)
Merge remote branch 'origin/master' into pipe-video
Conflicts: configure.ac src/gallium/auxiliary/Makefile src/gallium/auxiliary/SConscript src/gallium/drivers/r600/r600_asm.c src/gallium/drivers/r600/r600_asm.h src/gallium/drivers/r600/r600_shader.c src/gallium/drivers/r600/r600_state_inlines.h src/gallium/drivers/r600/r600_texture.c
Diffstat (limited to 'src/glsl/main.cpp')
-rw-r--r--src/glsl/main.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 9b041aafe42..096da93dcef 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -20,8 +20,6 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
-#include <cstdlib>
-#include <cstdio>
#include <getopt.h>
#include "ast.h"
@@ -56,7 +54,7 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
(void) ctx;
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
- shader = talloc_zero(NULL, struct gl_shader);
+ shader = rzalloc(NULL, struct gl_shader);
if (shader) {
shader->Type = type;
shader->Name = name;
@@ -72,12 +70,18 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->API = api;
+ ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
ctx->Extensions.ARB_draw_buffers = GL_TRUE;
ctx->Extensions.ARB_draw_instanced = GL_TRUE;
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
ctx->Extensions.EXT_texture_array = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
+ /* GLSL 1.30 isn't fully supported, but we need to advertise 1.30 so that
+ * the built-in functions for 1.30 can be built.
+ */
+ ctx->Const.GLSLVersion = 130;
+
/* 1.10 minimums. */
ctx->Const.MaxLights = 8;
ctx->Const.MaxClipPlanes = 8;
@@ -101,7 +105,7 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Driver.NewShader = _mesa_new_shader;
}
-/* Returned string will have 'ctx' as its talloc owner. */
+/* Returned string will have 'ctx' as its ralloc owner. */
static char *
load_text_file(void *ctx, const char *file_name)
{
@@ -118,7 +122,7 @@ load_text_file(void *ctx, const char *file_name)
size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
- text = (char *) talloc_size(ctx, size + 1);
+ text = (char *) ralloc_size(ctx, size + 1);
if (text != NULL) {
do {
size_t bytes = fread(text + total_read,
@@ -236,14 +240,14 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader)
shader->num_builtins_to_link = state->num_builtins_to_link;
if (shader->InfoLog)
- talloc_free(shader->InfoLog);
+ ralloc_free(shader->InfoLog);
shader->InfoLog = state->info_log;
/* Retain any live IR, but trash the rest. */
reparent_ir(shader->ir, shader);
- talloc_free(state);
+ ralloc_free(state);
return;
}
@@ -268,16 +272,16 @@ main(int argc, char **argv)
struct gl_shader_program *whole_program;
- whole_program = talloc_zero (NULL, struct gl_shader_program);
+ whole_program = rzalloc (NULL, struct gl_shader_program);
assert(whole_program != NULL);
for (/* empty */; argc > optind; optind++) {
- whole_program->Shaders = (struct gl_shader **)
- talloc_realloc(whole_program, whole_program->Shaders,
- struct gl_shader *, whole_program->NumShaders + 1);
+ whole_program->Shaders =
+ reralloc(whole_program, whole_program->Shaders,
+ struct gl_shader *, whole_program->NumShaders + 1);
assert(whole_program->Shaders != NULL);
- struct gl_shader *shader = talloc_zero(whole_program, gl_shader);
+ struct gl_shader *shader = rzalloc(whole_program, gl_shader);
whole_program->Shaders[whole_program->NumShaders] = shader;
whole_program->NumShaders++;
@@ -320,9 +324,9 @@ main(int argc, char **argv)
}
for (unsigned i = 0; i < MESA_SHADER_TYPES; i++)
- talloc_free(whole_program->_LinkedShaders[i]);
+ ralloc_free(whole_program->_LinkedShaders[i]);
- talloc_free(whole_program);
+ ralloc_free(whole_program);
_mesa_glsl_release_types();
_mesa_glsl_release_functions();