aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/common/meta_blit.c3
-rw-r--r--mesalib/src/mesa/main/get.c16
-rw-r--r--mesalib/src/mesa/main/get_hash_generator.py2
-rw-r--r--mesalib/src/mesa/main/get_hash_params.py4
-rw-r--r--mesalib/src/mesa/main/hash.c10
-rw-r--r--mesalib/src/mesa/main/performance_monitor.c5
-rw-r--r--mesalib/src/mesa/program/prog_hash_table.c8
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c11
8 files changed, 46 insertions, 13 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c
index 5929619f3..f26ef93c1 100644
--- a/mesalib/src/mesa/drivers/common/meta_blit.c
+++ b/mesalib/src/mesa/drivers/common/meta_blit.c
@@ -430,6 +430,9 @@ blitframebuffer_texture(struct gl_context *ctx,
srcLevel = 0;
target = meta_temp_texture->Target;
texObj = _mesa_lookup_texture(ctx, meta_temp_texture->TexObj);
+ if (texObj == NULL) {
+ return false;
+ }
_mesa_meta_setup_copypix_texture(ctx, meta_temp_texture,
srcX0, srcY0,
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 80a5839b5..9b56edb74 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -847,6 +847,16 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_int = ctx->Array.VAO->IndexBufferObj->Name;
break;
+ /* ARB_vertex_array_bgra */
+ case GL_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+
/* ARB_copy_buffer */
case GL_COPY_READ_BUFFER:
v->value_int = ctx->CopyReadBuffer->Name;
@@ -995,7 +1005,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
/* GL_ARB_shader_atomic_counters */
case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- v->value_int = ctx->AtomicBuffer->Name;
+ if (ctx->AtomicBuffer) {
+ v->value_int = ctx->AtomicBuffer->Name;
+ } else {
+ v->value_int = 0;
+ }
break;
/* GL_ARB_draw_indirect */
case GL_DRAW_INDIRECT_BUFFER_BINDING:
diff --git a/mesalib/src/mesa/main/get_hash_generator.py b/mesalib/src/mesa/main/get_hash_generator.py
index 96bc49587..b200d1973 100644
--- a/mesalib/src/mesa/main/get_hash_generator.py
+++ b/mesalib/src/mesa/main/get_hash_generator.py
@@ -52,7 +52,7 @@ def print_header():
(prime_factor, prime_step)
def print_params(params):
- print "static struct value_desc values[] = {"
+ print "static const struct value_desc values[] = {"
for p in params:
print " { %s, %s }," % (p[0], p[1])
diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py
index d40fa0778..c7a6e02af 100644
--- a/mesalib/src/mesa/main/get_hash_params.py
+++ b/mesalib/src/mesa/main/get_hash_params.py
@@ -199,7 +199,7 @@ descriptor=[
[ "NORMAL_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_NORMAL].Type), NO_EXTRA" ],
[ "NORMAL_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_NORMAL].Stride), NO_EXTRA" ],
[ "COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR0].Enabled), NO_EXTRA" ],
- [ "COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Size), NO_EXTRA" ],
+ [ "COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
[ "COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR0].Type), NO_EXTRA" ],
[ "COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR0].Stride), NO_EXTRA" ],
[ "TEXTURE_COORD_ARRAY", "LOC_CUSTOM, TYPE_BOOLEAN, offsetof(struct gl_client_array, Enabled), NO_EXTRA" ],
@@ -552,7 +552,7 @@ descriptor=[
[ "SECONDARY_COLOR_ARRAY", "ARRAY_BOOL(VertexAttrib[VERT_ATTRIB_COLOR1].Enabled), NO_EXTRA" ],
[ "SECONDARY_COLOR_ARRAY_TYPE", "ARRAY_ENUM(VertexAttrib[VERT_ATTRIB_COLOR1].Type), NO_EXTRA" ],
[ "SECONDARY_COLOR_ARRAY_STRIDE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Stride), NO_EXTRA" ],
- [ "SECONDARY_COLOR_ARRAY_SIZE", "ARRAY_INT(VertexAttrib[VERT_ATTRIB_COLOR1].Size), NO_EXTRA" ],
+ [ "SECONDARY_COLOR_ARRAY_SIZE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
# GL_EXT_fog_coord
[ "CURRENT_FOG_COORDINATE", "CONTEXT_FLOAT(Current.Attrib[VERT_ATTRIB_FOG][0]), extra_flush_current" ],
diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c
index 23018e9da..674c29d65 100644
--- a/mesalib/src/mesa/main/hash.c
+++ b/mesalib/src/mesa/main/hash.c
@@ -115,10 +115,20 @@ _mesa_NewHashTable(void)
if (table) {
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
+ if (table->ht == NULL) {
+ free(table);
+ _mesa_error_no_memory(__func__);
+ return NULL;
+ }
+
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
mtx_init(&table->Mutex, mtx_plain);
mtx_init(&table->WalkMutex, mtx_plain);
}
+ else {
+ _mesa_error_no_memory(__func__);
+ }
+
return table;
}
diff --git a/mesalib/src/mesa/main/performance_monitor.c b/mesalib/src/mesa/main/performance_monitor.c
index 21b9423e0..9d1a6b4d8 100644
--- a/mesalib/src/mesa/main/performance_monitor.c
+++ b/mesalib/src/mesa/main/performance_monitor.c
@@ -1036,6 +1036,11 @@ _mesa_CreatePerfQueryINTEL(GLuint queryId, GLuint *queryHandle)
}
m = new_performance_monitor(ctx, first);
+ if (m == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
_mesa_HashInsert(ctx->PerfMonitor.Monitors, first, m);
*queryHandle = first;
diff --git a/mesalib/src/mesa/program/prog_hash_table.c b/mesalib/src/mesa/program/prog_hash_table.c
index f45ed46af..2445d8434 100644
--- a/mesalib/src/mesa/program/prog_hash_table.c
+++ b/mesalib/src/mesa/program/prog_hash_table.c
@@ -142,6 +142,10 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key)
struct hash_node *node;
node = calloc(1, sizeof(*node));
+ if (node == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
node->data = data;
node->key = key;
@@ -167,6 +171,10 @@ hash_table_replace(struct hash_table *ht, void *data, const void *key)
}
hn = calloc(1, sizeof(*hn));
+ if (hn == NULL) {
+ _mesa_error_no_memory(__func__);
+ return false;
+ }
hn->data = data;
hn->key = key;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 928a4ffd2..e2d26ee24 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -358,7 +358,7 @@ update_textures(struct st_context *st,
{
const GLuint old_max = *num_textures;
GLbitfield samplers_used = prog->SamplersUsed;
- GLuint unit, new_count;
+ GLuint unit;
if (samplers_used == 0x0 && old_max == 0)
return;
@@ -387,16 +387,9 @@ update_textures(struct st_context *st,
pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view);
}
- /* Ex: if old_max = 3 and *num_textures = 1, we need to pass an
- * array of views={X, NULL, NULL} to unref the old texture views
- * at positions [1] and [2].
- */
- new_count = MAX2(*num_textures, old_max);
- assert(new_count <= max_units);
-
cso_set_sampler_views(st->cso_context,
shader_stage,
- new_count,
+ *num_textures,
sampler_views);
}