diff options
author | marha <marha@users.sourceforge.net> | 2013-10-02 11:13:08 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-10-02 11:13:08 +0200 |
commit | c3594c6c050a987fb891a1c7cf0c83102fbbec46 (patch) | |
tree | 33b215c07359fff941f32fc89a8cf3e968d334a9 /mesalib/src | |
parent | 1881d1a5c46cc9efb394f84b69f58c000ee1118b (diff) | |
parent | 8092f320c341a6b3a1b428fdd4473859d5db8b79 (diff) | |
download | vcxsrv-c3594c6c050a987fb891a1c7cf0c83102fbbec46.tar.gz vcxsrv-c3594c6c050a987fb891a1c7cf0c83102fbbec46.tar.bz2 vcxsrv-c3594c6c050a987fb891a1c7cf0c83102fbbec46.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig mesa pixman xkeyboard-config git update 2 Okt 2013
Conflicts:
mesalib/src/glsl/ast.h
mesalib/src/glsl/glsl_parser_extras.h
Diffstat (limited to 'mesalib/src')
-rwxr-xr-x | mesalib/src/glsl/ast.h | 12 | ||||
-rw-r--r-- | mesalib/src/glsl/glsl_parser_extras.cpp | 19 | ||||
-rwxr-xr-x | mesalib/src/glsl/glsl_parser_extras.h | 2 | ||||
-rw-r--r-- | mesalib/src/glsl/ralloc.h | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/swrast/Makefile.am | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/main/ff_fragment_shader.cpp | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/main/objectlabel.c | 51 | ||||
-rw-r--r-- | mesalib/src/mesa/main/syncobj.c | 14 | ||||
-rw-r--r-- | mesalib/src/mesa/main/syncobj.h | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 |
11 files changed, 97 insertions, 44 deletions
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h index 242ee4883..2307a7878 100755 --- a/mesalib/src/glsl/ast.h +++ b/mesalib/src/glsl/ast.h @@ -49,7 +49,7 @@ struct YYLTYPE; */ class ast_node { public: - DECLARE_RZALLOC_CXX_OPERATORS(ast_node); + DECLARE_RALLOC_CXX_OPERATORS(ast_node); static void operator delete(void *table, void *ctx) { ralloc_free(table); @@ -350,7 +350,7 @@ enum { }; struct ast_type_qualifier { - DECLARE_RZALLOC_CXX_OPERATORS(ast_type_qualifier); + DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier); union { struct { @@ -580,6 +580,10 @@ public: virtual void print(void) const; bool has_qualifiers() const; + ast_fully_specified_type() : qualifier(), specifier(NULL) + { + } + const struct glsl_type *glsl_type(const char **name, struct _mesa_glsl_parse_state *state) const; @@ -863,6 +867,10 @@ public: class ast_function_definition : public ast_node { public: + ast_function_definition() : prototype(NULL), body(NULL) + { + } + virtual void print(void) const; virtual ir_rvalue *hir(exec_list *instructions, diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index e9922fc14..4f2f2893a 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -55,7 +55,7 @@ static unsigned known_desktop_glsl_versions[] = _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target, void *mem_ctx) - : ctx(_ctx) + : ctx(_ctx), switch_state() { switch (target) { case GL_VERTEX_SHADER: this->target = vertex_shader; break; @@ -66,10 +66,14 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->scanner = NULL; this->translation_unit.make_empty(); this->symbols = new(mem_ctx) glsl_symbol_table; + + this->num_uniform_blocks = 0; + this->uniform_block_array_size = 0; + this->uniform_blocks = NULL; + this->info_log = ralloc_strdup(mem_ctx, ""); this->error = false; this->loop_nesting_ast = NULL; - this->switch_state.switch_nesting_ast = NULL; this->struct_specifier_depth = 0; this->num_builtins_to_link = 0; @@ -105,6 +109,13 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers; + this->current_function = NULL; + this->toplevel_ir = NULL; + this->found_return = false; + this->all_invariant = false; + this->user_structures = NULL; + this->num_user_structures = 0; + /* Populate the list of supported GLSL versions */ /* FINISHME: Once the OpenGL 3.0 'forward compatible' context or * the OpenGL 3.2 Core context is supported, this logic will need @@ -163,6 +174,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->gs_input_prim_type_specified = false; this->gs_input_prim_type = GL_POINTS; + this->gs_input_size = 0; this->out_qualifier = new(this) ast_type_qualifier(); } @@ -1038,7 +1050,8 @@ ast_expression::print(void) const ast_expression::ast_expression(int oper, ast_expression *ex0, ast_expression *ex1, - ast_expression *ex2) + ast_expression *ex2) : + primary_expression() { this->oper = ast_operators(oper); this->subexpressions[0] = ex0; diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index 3a228fde7..4833436a3 100755 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -73,7 +73,7 @@ struct _mesa_glsl_parse_state { _mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target, void *mem_ctx); - DECLARE_RZALLOC_CXX_OPERATORS(_mesa_glsl_parse_state); + DECLARE_RALLOC_CXX_OPERATORS(_mesa_glsl_parse_state); static void operator delete(void *mem, void *ctx) { ralloc_free(mem); diff --git a/mesalib/src/glsl/ralloc.h b/mesalib/src/glsl/ralloc.h index 799d3a9b8..31682d515 100644 --- a/mesalib/src/glsl/ralloc.h +++ b/mesalib/src/glsl/ralloc.h @@ -404,10 +404,20 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); } /* end of extern "C" */ #endif -#define _RALLOC_OPS(ALLOC, TYPE) \ +/** + * Declare C++ new and delete operators which use ralloc. + * + * Placing this macro in the body of a class makes it possible to do: + * + * TYPE *var = new(mem_ctx) TYPE(...); + * delete var; + * + * which is more idiomatic in C++ than calling ralloc. + */ +#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) \ static void* operator new(size_t size, void *mem_ctx) \ { \ - void *p = ALLOC(mem_ctx, size); \ + void *p = ralloc_size(mem_ctx, size); \ assert(p != NULL); \ return p; \ } \ @@ -417,17 +427,5 @@ bool ralloc_vasprintf_append(char **str, const char *fmt, va_list args); ralloc_free(p); \ } -/** - * Declare C++ new and delete operators which use ralloc. - * - * Placing one of these macros in the body of a class makes it possible to do: - * - * TYPE *var = new(mem_ctx) TYPE(...); - * delete var; - * - * which is more idiomatic in C++ than calling ralloc or rzalloc. - */ -#define DECLARE_RALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(ralloc_size, TYPE) -#define DECLARE_RZALLOC_CXX_OPERATORS(TYPE) _RALLOC_OPS(rzalloc_size, TYPE) #endif diff --git a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am index fb9b8a050..9652583f2 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/swrast/Makefile.am @@ -34,10 +34,7 @@ AM_CFLAGS = \ $(VISIBILITY_CFLAGS) dridir = $(DRI_DRIVER_INSTALL_DIR) - -if HAVE_SWRAST_DRI dri_LTLIBRARIES = swrast_dri.la -endif swrast_dri_la_SOURCES = \ $(SWRAST_C_FILES) diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp index 86317efcd..01edd3ff8 100644 --- a/mesalib/src/mesa/main/ff_fragment_shader.cpp +++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp @@ -32,7 +32,6 @@ extern "C" { #include "imports.h" #include "mtypes.h" #include "main/context.h" -#include "main/uniforms.h" #include "main/macros.h" #include "main/samplerobj.h" #include "program/program.h" diff --git a/mesalib/src/mesa/main/objectlabel.c b/mesalib/src/mesa/main/objectlabel.c index 90d9e09f5..e75fe3be2 100644 --- a/mesalib/src/mesa/main/objectlabel.c +++ b/mesalib/src/mesa/main/objectlabel.c @@ -86,21 +86,38 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, /** * Helper for _mesa_GetObjectLabel() and _mesa_GetObjectPtrLabel(). + * \param src the src label (may be null) + * \param dst pointer to dest buffer (may be null) + * \param length returns length of label (may be null) + * \param bufsize size of dst buffer */ static void -copy_label(char **labelPtr, char *label, int *length, int bufSize) +copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize) { int labelLen = 0; - if (*labelPtr) - labelLen = strlen(*labelPtr); + /* From http://www.opengl.org/registry/specs/KHR/debug.txt: + * "If <length> is NULL, no length is returned. The maximum number of + * characters that may be written into <label>, including the null + * terminator, is specified by <bufSize>. If no debug label was specified + * for the object then <label> will contain a null-terminated empty string, + * and zero will be returned in <length>. If <label> is NULL and <length> + * is non-NULL then no string will be returned and the length of the label + * will be returned in <length>." + */ - if (label) { - if (bufSize <= labelLen) - labelLen = bufSize-1; + if (src) + labelLen = strlen(src); + + if (dst) { + if (src) { + if (bufSize <= labelLen) + labelLen = bufSize - 1; - memcpy(label, *labelPtr, labelLen); - label[labelLen] = '\0'; + memcpy(dst, src, labelLen); + } + + dst[labelLen] = '\0'; } if (length) @@ -207,7 +224,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name, } if (NULL == labelPtr) { - _mesa_error(ctx, GL_INVALID_VALUE, "glObjectLabel(name = %u)", name); + _mesa_error(ctx, GL_INVALID_VALUE, "%s(name = %u)", caller, name); } return labelPtr; @@ -239,11 +256,17 @@ _mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GET_CURRENT_CONTEXT(ctx); char **labelPtr; + if (bufSize < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectLabel(bufSize = %d)", + bufSize); + return; + } + labelPtr = get_label_pointer(ctx, identifier, name, "glGetObjectLabel"); if (!labelPtr) return; - copy_label(labelPtr, label, length, bufSize); + copy_label(*labelPtr, label, length, bufSize); } void GLAPIENTRY @@ -271,6 +294,12 @@ _mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, char **labelPtr; struct gl_sync_object *const syncObj = (struct gl_sync_object *) ptr; + if (bufSize < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectPtrLabel(bufSize = %d)", + bufSize); + return; + } + if (!_mesa_validate_sync(ctx, syncObj)) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectPtrLabel (not a valid sync object)"); return; @@ -278,5 +307,5 @@ _mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, labelPtr = &syncObj->Label; - copy_label(labelPtr, label, length, bufSize); + copy_label(*labelPtr, label, length, bufSize); } diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index 3157491bf..ae49db2e4 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -161,8 +161,16 @@ _mesa_free_sync_data(struct gl_context *ctx) } -int -_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) +/** + * Check if the given sync object is: + * - non-null + * - not in sync objects hash table + * - type is GL_SYNC_FENCE + * - not marked as deleted + */ +bool +_mesa_validate_sync(struct gl_context *ctx, + const struct gl_sync_object *syncObj) { return (syncObj != NULL) && _mesa_set_search(ctx->Shared->SyncObjects, @@ -410,7 +418,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, return; } - if (size > 0) { + if (size > 0 && bufSize > 0) { const GLsizei copy_count = MIN2(size, bufSize); memcpy(values, v, sizeof(GLint) * copy_count); diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index a6563b09d..1dbb7b14a 100644 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -53,8 +53,9 @@ _mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); extern void GLAPIENTRY _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); -extern int -_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj); +extern bool +_mesa_validate_sync(struct gl_context *ctx, + const struct gl_sync_object *syncObj); extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 8cd42dfd2..b08107b1c 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -44,11 +44,11 @@ #include "main/mtypes.h" #include "main/shaderobj.h" +#include "main/uniforms.h" #include "program/hash_table.h" extern "C" { #include "main/shaderapi.h" -#include "main/uniforms.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -155,7 +155,7 @@ namespace { class ir_to_mesa_instruction : public exec_node { public: - DECLARE_RZALLOC_CXX_OPERATORS(ir_to_mesa_instruction) + DECLARE_RALLOC_CXX_OPERATORS(ir_to_mesa_instruction) enum prog_opcode op; dst_reg dst; diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 53838b391..a5d0b84e3 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -43,11 +43,11 @@ #include "main/mtypes.h" #include "main/shaderobj.h" +#include "main/uniforms.h" #include "program/hash_table.h" extern "C" { #include "main/shaderapi.h" -#include "main/uniforms.h" #include "program/prog_instruction.h" #include "program/prog_optimize.h" #include "program/prog_print.h" @@ -217,7 +217,7 @@ st_dst_reg::st_dst_reg(st_src_reg reg) class glsl_to_tgsi_instruction : public exec_node { public: - DECLARE_RZALLOC_CXX_OPERATORS(glsl_to_tgsi_instruction) + DECLARE_RALLOC_CXX_OPERATORS(glsl_to_tgsi_instruction) unsigned op; st_dst_reg dst; |