From 7ce186358e881d1e30eda716a8dea73d2dab2ee9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 8 Dec 2010 18:25:38 -0700 Subject: glsl: add support for system values and GL_ARB_draw_instanced --- src/glsl/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl/main.cpp') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 33028512644..36597d0bcd0 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -78,6 +78,7 @@ initialize_context(struct gl_context *ctx, gl_api api) ctx->API = api; 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; -- cgit v1.2.3 From 0035d1d902f34a88ec745925284fe3b768fac261 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 12 Jan 2011 16:31:07 +0000 Subject: glsl: Make builtin_compiler portable for non-unices. --- src/glsl/main.cpp | 59 ++++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 31 deletions(-) (limited to 'src/glsl/main.cpp') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index c8fc2676253..847540ddd9f 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -24,11 +24,6 @@ #include #include -#include -#include -#include -#include - #include "ast.h" #include "glsl_parser_extras.h" #include "glsl_parser.h" @@ -110,38 +105,40 @@ static char * load_text_file(void *ctx, const char *file_name) { char *text = NULL; - struct stat st; - ssize_t total_read = 0; - int fd = open(file_name, O_RDONLY); + size_t size; + size_t total_read = 0; + FILE *fp = fopen(file_name, "rb"); - if (fd < 0) { + if (!fp) { return NULL; } - if (fstat(fd, & st) == 0) { - text = (char *) talloc_size(ctx, st.st_size + 1); - if (text != NULL) { - do { - ssize_t bytes = read(fd, text + total_read, - st.st_size - total_read); - if (bytes < 0) { - free(text); - text = NULL; - break; - } - - if (bytes == 0) { - break; - } - - total_read += bytes; - } while (total_read < st.st_size); - - text[total_read] = '\0'; - } + fseek(fp, 0L, SEEK_END); + size = ftell(fp); + fseek(fp, 0L, SEEK_SET); + + text = (char *) talloc_size(ctx, size + 1); + if (text != NULL) { + do { + size_t bytes = fread(text + total_read, + 1, size - total_read, fp); + if (bytes < size - total_read) { + free(text); + text = NULL; + break; + } + + if (bytes == 0) { + break; + } + + total_read += bytes; + } while (total_read < size); + + text[total_read] = '\0'; } - close(fd); + fclose(fp); return text; } -- cgit v1.2.3 From d42acef139740a54fe571f99b62cba7720734d8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Jan 2011 17:45:23 -0700 Subject: glsl: fix implicit int to bool warning Maybe preprocess() should return a bool. --- src/glsl/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/glsl/main.cpp') diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index 847540ddd9f..2d146caca5b 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -185,7 +185,7 @@ compile_shader(struct gl_context *ctx, struct gl_shader *shader) const char *source = shader->Source; state->error = preprocess(state, &source, &state->info_log, - state->extensions, ctx->API); + state->extensions, ctx->API) != 0; if (!state->error) { _mesa_glsl_lexer_ctor(state, source); -- cgit v1.2.3