aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-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
7 files changed, 58 insertions, 24 deletions
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;