aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/configure.ac8
-rw-r--r--mesalib/src/glsl/ast.h12
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp19
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h2
-rw-r--r--mesalib/src/glsl/ralloc.h26
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/Makefile.am3
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp1
-rw-r--r--mesalib/src/mesa/main/objectlabel.c51
-rw-r--r--mesalib/src/mesa/main/syncobj.c14
-rw-r--r--mesalib/src/mesa/main/syncobj.h5
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp4
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp4
12 files changed, 101 insertions, 48 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 1f0a646a6..e7c822338 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1781,7 +1781,6 @@ if test "x$with_gallium_drivers" != x; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r600"
if test "x$enable_r600_llvm" = xyes -o "x$enable_opencl" = xyes; then
radeon_llvm_check
- R600_NEED_RADEON_GALLIUM=yes;
LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
fi
if test "x$enable_r600_llvm" = xyes; then
@@ -1824,7 +1823,6 @@ if test "x$with_gallium_drivers" != x; then
if test "x$enable_dri" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
- HAVE_COMMON_DRI=yes
fi
if test "x$enable_vdpau" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS vdpau-softpipe"
@@ -1938,7 +1936,6 @@ AM_CONDITIONAL(NEED_WINSYS_WRAPPER, test "x$HAVE_GALLIUM_I915" = xyes -o \
"x$HAVE_GALLIUM_SVGA" = xyes)
AM_CONDITIONAL(NEED_WINSYS_XLIB, test "x$NEED_WINSYS_XLIB" = xyes)
AM_CONDITIONAL(NEED_RADEON_LLVM, test x$NEED_RADEON_LLVM = xyes)
-AM_CONDITIONAL(R600_NEED_RADEON_GALLIUM, test x$R600_NEED_RADEON_GALLIUM = xyes)
AM_CONDITIONAL(USE_R600_LLVM_COMPILER, test x$USE_R600_LLVM_COMPILER = xyes)
AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
@@ -2006,9 +2003,12 @@ AC_CONFIG_FILES([Makefile
src/gallium/drivers/freedreno/Makefile
src/gallium/drivers/freedreno/a2xx/Makefile
src/gallium/drivers/freedreno/a3xx/Makefile
+ src/gallium/drivers/galahad/Makefile
src/gallium/drivers/i915/Makefile
+ src/gallium/drivers/identity/Makefile
src/gallium/drivers/ilo/Makefile
src/gallium/drivers/llvmpipe/Makefile
+ src/gallium/drivers/noop/Makefile
src/gallium/drivers/nouveau/Makefile
src/gallium/drivers/r300/Makefile
src/gallium/drivers/r600/Makefile
@@ -2025,7 +2025,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/state_trackers/dri/sw/Makefile
src/gallium/state_trackers/egl/Makefile
src/gallium/state_trackers/gbm/Makefile
- src/gallium/state_trackers/glx/Makefile
+ src/gallium/state_trackers/glx/xlib/Makefile
src/gallium/state_trackers/osmesa/Makefile
src/gallium/state_trackers/vdpau/Makefile
src/gallium/state_trackers/vega/Makefile
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index c3361a106..97905c6a6 100644
--- 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);
/**
* Print an AST node in something approximating the original GLSL code
@@ -346,7 +346,7 @@ enum {
};
struct ast_type_qualifier {
- DECLARE_RZALLOC_CXX_OPERATORS(ast_type_qualifier);
+ DECLARE_RALLOC_CXX_OPERATORS(ast_type_qualifier);
union {
struct {
@@ -576,6 +576,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;
@@ -859,6 +863,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 cef4436f6..d557f8ba6 100644
--- 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);
/**
* Generate a string representing the GLSL version currently being compiled
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 987d4f57c..ad21f3b67 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 025a9b132..5d510e873 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
_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;