aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-24 08:16:00 +0100
committermarha <marha@users.sourceforge.net>2012-02-24 08:16:00 +0100
commit5fb4fb602bde5140dcea45464e3b70a49078ad2e (patch)
tree24db226b5f69e9a8c9c3aea11e7a27a82620fa2c /mesalib
parent6baac61e6ca9cd314e689dfe7f84771aad08c66e (diff)
downloadvcxsrv-5fb4fb602bde5140dcea45464e3b70a49078ad2e.tar.gz
vcxsrv-5fb4fb602bde5140dcea45464e3b70a49078ad2e.tar.bz2
vcxsrv-5fb4fb602bde5140dcea45464e3b70a49078ad2e.zip
fontconfig libX11 pixman xserver git update 24 Feb 2012
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/include/GL/internal/dri_interface.h3
-rw-r--r--mesalib/scons/llvm.py14
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c21
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_debug_memory.c623
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_inlines.h22
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_slab.c340
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml2
-rw-r--r--mesalib/src/mesa/main/enums.c7
-rw-r--r--mesalib/src/mesa/main/texstore.c26
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c18
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c21
-rw-r--r--mesalib/src/mesa/swrast/swrast.h4
13 files changed, 607 insertions, 503 deletions
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index 701e83e78..da8366652 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -894,7 +894,7 @@ struct __DRIdri2ExtensionRec {
* extensions.
*/
#define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 2
+#define __DRI_IMAGE_VERSION 3
/**
* These formats correspond to the similarly named MESA_FORMAT_*
@@ -918,6 +918,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
#define __DRI_IMAGE_ATTRIB_NAME 0x2002
+#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
diff --git a/mesalib/scons/llvm.py b/mesalib/scons/llvm.py
index 916b040b0..8222c5b45 100644
--- a/mesalib/scons/llvm.py
+++ b/mesalib/scons/llvm.py
@@ -92,7 +92,19 @@ def generate(env):
'HAVE_STDINT_H',
])
env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')])
- if llvm_version >= distutils.version.LooseVersion('2.9'):
+ if llvm_version >= distutils.version.LooseVersion('3.0'):
+ # 3.0
+ env.Prepend(LIBS = [
+ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
+ 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG',
+ 'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter',
+ 'LLVMX86Utils', 'LLVMX86Info', 'LLVMJIT',
+ 'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts',
+ 'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa',
+ 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore',
+ 'LLVMSupport'
+ ])
+ elif llvm_version >= distutils.version.LooseVersion('2.9'):
# 2.9
env.Prepend(LIBS = [
'LLVMObject', 'LLVMMCJIT', 'LLVMMCDisassembler',
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 6a32de619..48808ae08 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -241,7 +241,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
}
if (ctx->has_stream_out) {
- velem[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ velem[0].src_format = PIPE_FORMAT_R32_UINT;
ctx->velem_state_readbuf = pipe->create_vertex_elements_state(pipe, 1, &velem[0]);
}
@@ -263,8 +263,8 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
memset(&so, 0, sizeof(so));
so.num_outputs = 1;
- so.output[0].num_components = 4;
- so.stride[0] = 4;
+ so.output[0].num_components = 1;
+ so.stride[0] = 1;
ctx->vs_pos_only =
util_make_vertex_passthrough_shader_with_so(pipe, 1, semantic_names,
@@ -1247,12 +1247,23 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
struct pipe_vertex_buffer vb;
struct pipe_stream_output_target *so_target;
+ if (srcx >= src->width0 ||
+ dstx >= dst->width0) {
+ return;
+ }
+ if (srcx + size > src->width0) {
+ size = src->width0 - srcx;
+ }
+ if (dstx + size > dst->width0) {
+ size = dst->width0 - dstx;
+ }
+
/* Drivers not capable of Stream Out should not call this function
* in the first place. */
assert(ctx->has_stream_out);
/* Some alignment is required. */
- if (srcx % 4 != 0 || dstx % 4 != 0 || size % 16 != 0 ||
+ if (srcx % 4 != 0 || dstx % 4 != 0 || size % 4 != 0 ||
!ctx->has_stream_out) {
struct pipe_box box;
u_box_1d(srcx, size, &box);
@@ -1277,7 +1288,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
so_target = pipe->create_stream_output_target(pipe, dst, dstx, size);
pipe->set_stream_output_targets(pipe, 1, &so_target, 0);
- util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 16);
+ util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4);
blitter_restore_vertex_states(ctx);
blitter_unset_running_flag(ctx);
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_memory.c b/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
index 36497921e..e24a8bc0b 100644
--- a/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
+++ b/mesalib/src/gallium/auxiliary/util/u_debug_memory.c
@@ -1,307 +1,316 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-/**
- * @file
- * Memory debugging.
- *
- * @author José Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-#include "pipe/p_config.h"
-
-#define DEBUG_MEMORY_IMPLEMENTATION
-
-#include "os/os_memory.h"
-#include "os/os_memory_debug.h"
-
-#include "util/u_debug.h"
-#include "util/u_debug_stack.h"
-#include "util/u_double_list.h"
-
-
-#define DEBUG_MEMORY_MAGIC 0x6e34090aU
-#define DEBUG_MEMORY_STACK 0 /* XXX: disabled until we have symbol lookup */
-
-
-struct debug_memory_header
-{
- struct list_head head;
-
- unsigned long no;
- const char *file;
- unsigned line;
- const char *function;
-#if DEBUG_MEMORY_STACK
- struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK];
-#endif
- size_t size;
-
- unsigned magic;
-};
-
-struct debug_memory_footer
-{
- unsigned magic;
-};
-
-
-static struct list_head list = { &list, &list };
-
-static unsigned long last_no = 0;
-
-
-static INLINE struct debug_memory_header *
-header_from_data(void *data)
-{
- if(data)
- return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
- else
- return NULL;
-}
-
-static INLINE void *
-data_from_header(struct debug_memory_header *hdr)
-{
- if(hdr)
- return (void *)((char *)hdr + sizeof(struct debug_memory_header));
- else
- return NULL;
-}
-
-static INLINE struct debug_memory_footer *
-footer_from_header(struct debug_memory_header *hdr)
-{
- if(hdr)
- return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
- else
- return NULL;
-}
-
-
-void *
-debug_malloc(const char *file, unsigned line, const char *function,
- size_t size)
-{
- struct debug_memory_header *hdr;
- struct debug_memory_footer *ftr;
-
- hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
- if(!hdr) {
- debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
- file, line, function,
- (long unsigned)size);
- return NULL;
- }
-
- hdr->no = last_no++;
- hdr->file = file;
- hdr->line = line;
- hdr->function = function;
- hdr->size = size;
- hdr->magic = DEBUG_MEMORY_MAGIC;
-
-#if DEBUG_MEMORY_STACK
- debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
-#endif
-
- ftr = footer_from_header(hdr);
- ftr->magic = DEBUG_MEMORY_MAGIC;
-
- LIST_ADDTAIL(&hdr->head, &list);
-
- return data_from_header(hdr);
-}
-
-void
-debug_free(const char *file, unsigned line, const char *function,
- void *ptr)
-{
- struct debug_memory_header *hdr;
- struct debug_memory_footer *ftr;
-
- if(!ptr)
- return;
-
- hdr = header_from_data(ptr);
- if(hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
- file, line, function,
- ptr);
- debug_assert(0);
- return;
- }
-
- ftr = footer_from_header(hdr);
- if(ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
-
- LIST_DEL(&hdr->head);
- hdr->magic = 0;
- ftr->magic = 0;
-
- os_free(hdr);
-}
-
-void *
-debug_calloc(const char *file, unsigned line, const char *function,
- size_t count, size_t size )
-{
- void *ptr = debug_malloc( file, line, function, count * size );
- if( ptr )
- memset( ptr, 0, count * size );
- return ptr;
-}
-
-void *
-debug_realloc(const char *file, unsigned line, const char *function,
- void *old_ptr, size_t old_size, size_t new_size )
-{
- struct debug_memory_header *old_hdr, *new_hdr;
- struct debug_memory_footer *old_ftr, *new_ftr;
- void *new_ptr;
-
- if(!old_ptr)
- return debug_malloc( file, line, function, new_size );
-
- if(!new_size) {
- debug_free( file, line, function, old_ptr );
- return NULL;
- }
-
- old_hdr = header_from_data(old_ptr);
- if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
- file, line, function,
- old_ptr);
- debug_assert(0);
- return NULL;
- }
-
- old_ftr = footer_from_header(old_hdr);
- if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- old_hdr->file, old_hdr->line, old_hdr->function,
- old_ptr);
- debug_assert(0);
- }
-
- /* alloc new */
- new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
- if(!new_hdr) {
- debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
- file, line, function,
- (long unsigned)new_size);
- return NULL;
- }
- new_hdr->no = old_hdr->no;
- new_hdr->file = old_hdr->file;
- new_hdr->line = old_hdr->line;
- new_hdr->function = old_hdr->function;
- new_hdr->size = new_size;
- new_hdr->magic = DEBUG_MEMORY_MAGIC;
-
- new_ftr = footer_from_header(new_hdr);
- new_ftr->magic = DEBUG_MEMORY_MAGIC;
-
- LIST_REPLACE(&old_hdr->head, &new_hdr->head);
-
- /* copy data */
- new_ptr = data_from_header(new_hdr);
- memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
-
- /* free old */
- old_hdr->magic = 0;
- old_ftr->magic = 0;
- os_free(old_hdr);
-
- return new_ptr;
-}
-
-unsigned long
-debug_memory_begin(void)
-{
- return last_no;
-}
-
-void
-debug_memory_end(unsigned long start_no)
-{
- size_t total_size = 0;
- struct list_head *entry;
-
- if(start_no == last_no)
- return;
-
- entry = list.prev;
- for (; entry != &list; entry = entry->prev) {
- struct debug_memory_header *hdr;
- void *ptr;
- struct debug_memory_footer *ftr;
-
- hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
- ptr = data_from_header(hdr);
- ftr = footer_from_header(hdr);
-
- if(hdr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
-
- if((start_no <= hdr->no && hdr->no < last_no) ||
- (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
- debug_printf("%s:%u:%s: %lu bytes at %p not freed\n",
- hdr->file, hdr->line, hdr->function,
- (unsigned long) hdr->size, ptr);
-#if DEBUG_MEMORY_STACK
- debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
-#endif
- total_size += hdr->size;
- }
-
- if(ftr->magic != DEBUG_MEMORY_MAGIC) {
- debug_printf("%s:%u:%s: buffer overflow %p\n",
- hdr->file, hdr->line, hdr->function,
- ptr);
- debug_assert(0);
- }
- }
-
- if(total_size) {
- debug_printf("Total of %lu KB of system memory apparently leaked\n",
- (unsigned long) (total_size + 1023)/1024);
- }
- else {
- debug_printf("No memory leaks detected.\n");
- }
-}
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * Memory debugging.
+ *
+ * @author José Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+#include "pipe/p_config.h"
+
+#define DEBUG_MEMORY_IMPLEMENTATION
+
+#include "os/os_memory.h"
+#include "os/os_memory_debug.h"
+#include "os/os_thread.h"
+
+#include "util/u_debug.h"
+#include "util/u_debug_stack.h"
+#include "util/u_double_list.h"
+
+
+#define DEBUG_MEMORY_MAGIC 0x6e34090aU
+#define DEBUG_MEMORY_STACK 0 /* XXX: disabled until we have symbol lookup */
+
+
+struct debug_memory_header
+{
+ struct list_head head;
+
+ unsigned long no;
+ const char *file;
+ unsigned line;
+ const char *function;
+#if DEBUG_MEMORY_STACK
+ struct debug_stack_frame backtrace[DEBUG_MEMORY_STACK];
+#endif
+ size_t size;
+
+ unsigned magic;
+};
+
+struct debug_memory_footer
+{
+ unsigned magic;
+};
+
+
+static struct list_head list = { &list, &list };
+
+pipe_static_mutex(list_mutex);
+
+static unsigned long last_no = 0;
+
+
+static INLINE struct debug_memory_header *
+header_from_data(void *data)
+{
+ if(data)
+ return (struct debug_memory_header *)((char *)data - sizeof(struct debug_memory_header));
+ else
+ return NULL;
+}
+
+static INLINE void *
+data_from_header(struct debug_memory_header *hdr)
+{
+ if(hdr)
+ return (void *)((char *)hdr + sizeof(struct debug_memory_header));
+ else
+ return NULL;
+}
+
+static INLINE struct debug_memory_footer *
+footer_from_header(struct debug_memory_header *hdr)
+{
+ if(hdr)
+ return (struct debug_memory_footer *)((char *)hdr + sizeof(struct debug_memory_header) + hdr->size);
+ else
+ return NULL;
+}
+
+
+void *
+debug_malloc(const char *file, unsigned line, const char *function,
+ size_t size)
+{
+ struct debug_memory_header *hdr;
+ struct debug_memory_footer *ftr;
+
+ hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
+ if(!hdr) {
+ debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+ file, line, function,
+ (long unsigned)size);
+ return NULL;
+ }
+
+ hdr->no = last_no++;
+ hdr->file = file;
+ hdr->line = line;
+ hdr->function = function;
+ hdr->size = size;
+ hdr->magic = DEBUG_MEMORY_MAGIC;
+
+#if DEBUG_MEMORY_STACK
+ debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
+#endif
+
+ ftr = footer_from_header(hdr);
+ ftr->magic = DEBUG_MEMORY_MAGIC;
+
+ pipe_mutex_lock(list_mutex);
+ LIST_ADDTAIL(&hdr->head, &list);
+ pipe_mutex_unlock(list_mutex);
+
+ return data_from_header(hdr);
+}
+
+void
+debug_free(const char *file, unsigned line, const char *function,
+ void *ptr)
+{
+ struct debug_memory_header *hdr;
+ struct debug_memory_footer *ftr;
+
+ if(!ptr)
+ return;
+
+ hdr = header_from_data(ptr);
+ if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: freeing bad or corrupted memory %p\n",
+ file, line, function,
+ ptr);
+ debug_assert(0);
+ return;
+ }
+
+ ftr = footer_from_header(hdr);
+ if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+
+ pipe_mutex_lock(list_mutex);
+ LIST_DEL(&hdr->head);
+ pipe_mutex_unlock(list_mutex);
+ hdr->magic = 0;
+ ftr->magic = 0;
+
+ os_free(hdr);
+}
+
+void *
+debug_calloc(const char *file, unsigned line, const char *function,
+ size_t count, size_t size )
+{
+ void *ptr = debug_malloc( file, line, function, count * size );
+ if( ptr )
+ memset( ptr, 0, count * size );
+ return ptr;
+}
+
+void *
+debug_realloc(const char *file, unsigned line, const char *function,
+ void *old_ptr, size_t old_size, size_t new_size )
+{
+ struct debug_memory_header *old_hdr, *new_hdr;
+ struct debug_memory_footer *old_ftr, *new_ftr;
+ void *new_ptr;
+
+ if(!old_ptr)
+ return debug_malloc( file, line, function, new_size );
+
+ if(!new_size) {
+ debug_free( file, line, function, old_ptr );
+ return NULL;
+ }
+
+ old_hdr = header_from_data(old_ptr);
+ if(old_hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: reallocating bad or corrupted memory %p\n",
+ file, line, function,
+ old_ptr);
+ debug_assert(0);
+ return NULL;
+ }
+
+ old_ftr = footer_from_header(old_hdr);
+ if(old_ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ old_hdr->file, old_hdr->line, old_hdr->function,
+ old_ptr);
+ debug_assert(0);
+ }
+
+ /* alloc new */
+ new_hdr = os_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
+ if(!new_hdr) {
+ debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
+ file, line, function,
+ (long unsigned)new_size);
+ return NULL;
+ }
+ new_hdr->no = old_hdr->no;
+ new_hdr->file = old_hdr->file;
+ new_hdr->line = old_hdr->line;
+ new_hdr->function = old_hdr->function;
+ new_hdr->size = new_size;
+ new_hdr->magic = DEBUG_MEMORY_MAGIC;
+
+ new_ftr = footer_from_header(new_hdr);
+ new_ftr->magic = DEBUG_MEMORY_MAGIC;
+
+ pipe_mutex_lock(list_mutex);
+ LIST_REPLACE(&old_hdr->head, &new_hdr->head);
+ pipe_mutex_unlock(list_mutex);
+
+ /* copy data */
+ new_ptr = data_from_header(new_hdr);
+ memcpy( new_ptr, old_ptr, old_size < new_size ? old_size : new_size );
+
+ /* free old */
+ old_hdr->magic = 0;
+ old_ftr->magic = 0;
+ os_free(old_hdr);
+
+ return new_ptr;
+}
+
+unsigned long
+debug_memory_begin(void)
+{
+ return last_no;
+}
+
+void
+debug_memory_end(unsigned long start_no)
+{
+ size_t total_size = 0;
+ struct list_head *entry;
+
+ if(start_no == last_no)
+ return;
+
+ entry = list.prev;
+ for (; entry != &list; entry = entry->prev) {
+ struct debug_memory_header *hdr;
+ void *ptr;
+ struct debug_memory_footer *ftr;
+
+ hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
+ ptr = data_from_header(hdr);
+ ftr = footer_from_header(hdr);
+
+ if(hdr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+
+ if((start_no <= hdr->no && hdr->no < last_no) ||
+ (last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
+ debug_printf("%s:%u:%s: %lu bytes at %p not freed\n",
+ hdr->file, hdr->line, hdr->function,
+ (unsigned long) hdr->size, ptr);
+#if DEBUG_MEMORY_STACK
+ debug_backtrace_dump(hdr->backtrace, DEBUG_MEMORY_STACK);
+#endif
+ total_size += hdr->size;
+ }
+
+ if(ftr->magic != DEBUG_MEMORY_MAGIC) {
+ debug_printf("%s:%u:%s: buffer overflow %p\n",
+ hdr->file, hdr->line, hdr->function,
+ ptr);
+ debug_assert(0);
+ }
+ }
+
+ if(total_size) {
+ debug_printf("Total of %lu KB of system memory apparently leaked\n",
+ (unsigned long) (total_size + 1023)/1024);
+ }
+ else {
+ debug_printf("No memory leaks detected.\n");
+ }
+}
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h
index c90dc5707..2fe680ff4 100644
--- a/mesalib/src/gallium/auxiliary/util/u_inlines.h
+++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h
@@ -135,6 +135,28 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
*ptr = view;
}
+/**
+ * Similar to pipe_sampler_view_reference() but always set the pointer to
+ * NULL and pass in an explicit context. Passing an explicit context is a
+ * work-around for fixing a dangling context pointer problem when textures
+ * are shared by multiple contexts. XXX fix this someday.
+ */
+static INLINE void
+pipe_sampler_view_release(struct pipe_context *ctx,
+ struct pipe_sampler_view **ptr)
+{
+ struct pipe_sampler_view *old_view = *ptr;
+ if (*ptr && (*ptr)->context != ctx) {
+ debug_printf_once(("context mis-match in pipe_sampler_view_release()\n"));
+ }
+ if (pipe_reference_described(&(*ptr)->reference, NULL,
+ (debug_reference_descriptor)debug_describe_sampler_view)) {
+ ctx->sampler_view_destroy(ctx, old_view);
+ }
+ *ptr = NULL;
+}
+
+
static INLINE void
pipe_so_target_reference(struct pipe_stream_output_target **ptr,
struct pipe_stream_output_target *target)
diff --git a/mesalib/src/gallium/auxiliary/util/u_slab.c b/mesalib/src/gallium/auxiliary/util/u_slab.c
index 2c2175fea..f9f5ef68f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_slab.c
+++ b/mesalib/src/gallium/auxiliary/util/u_slab.c
@@ -1,169 +1,171 @@
-/*
- * Copyright 2010 Marek Olšák <maraeo@gmail.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- * USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-#include "util/u_slab.h"
-
-#include "util/u_math.h"
-#include "util/u_memory.h"
-#include "util/u_simple_list.h"
-
-#include <stdio.h>
-
-#define UTIL_SLAB_MAGIC 0xcafe4321
-
-/* The block is either allocated memory or free space. */
-struct util_slab_block {
- /* The header. */
- /* The first next free block. */
- struct util_slab_block *next_free;
-
- intptr_t magic;
-
- /* Memory after the last member is dedicated to the block itself.
- * The allocated size is always larger than this structure. */
-};
-
-static struct util_slab_block *
-util_slab_get_block(struct util_slab_mempool *pool,
- struct util_slab_page *page, unsigned index)
-{
- return (struct util_slab_block*)
- ((uint8_t*)page + sizeof(struct util_slab_page) +
- (pool->block_size * index));
-}
-
-static void util_slab_add_new_page(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page;
- struct util_slab_block *block;
- int i;
-
- page = MALLOC(pool->page_size);
- insert_at_tail(&pool->list, page);
-
- /* Mark all blocks as free. */
- for (i = 0; i < pool->num_blocks-1; i++) {
- block = util_slab_get_block(pool, page, i);
- block->next_free = util_slab_get_block(pool, page, i+1);
- block->magic = UTIL_SLAB_MAGIC;
- }
-
- block = util_slab_get_block(pool, page, pool->num_blocks-1);
- block->next_free = pool->first_free;
- block->magic = UTIL_SLAB_MAGIC;
- pool->first_free = util_slab_get_block(pool, page, 0);
- pool->num_pages++;
-
-#if 0
- fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
-#endif
-}
-
-static void *util_slab_alloc_st(struct util_slab_mempool *pool)
-{
- struct util_slab_block *block;
-
- if (!pool->first_free)
- util_slab_add_new_page(pool);
-
- block = pool->first_free;
- assert(block->magic == UTIL_SLAB_MAGIC);
- pool->first_free = block->next_free;
-
- return (uint8_t*)block + sizeof(struct util_slab_block);
-}
-
-static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
-{
- struct util_slab_block *block =
- (struct util_slab_block*)
- ((uint8_t*)ptr - sizeof(struct util_slab_block));
-
- assert(block->magic == UTIL_SLAB_MAGIC);
- block->next_free = pool->first_free;
- pool->first_free = block;
-}
-
-static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
-{
- void *mem;
-
- pipe_mutex_lock(pool->mutex);
- mem = util_slab_alloc_st(pool);
- pipe_mutex_unlock(pool->mutex);
- return mem;
-}
-
-static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
-{
- pipe_mutex_lock(pool->mutex);
- util_slab_free_st(pool, ptr);
- pipe_mutex_unlock(pool->mutex);
-}
-
-void util_slab_set_thread_safety(struct util_slab_mempool *pool,
- enum util_slab_threading threading)
-{
- pool->threading = threading;
-
- if (threading) {
- pool->alloc = util_slab_alloc_mt;
- pool->free = util_slab_free_mt;
- } else {
- pool->alloc = util_slab_alloc_st;
- pool->free = util_slab_free_st;
- }
-}
-
-void util_slab_create(struct util_slab_mempool *pool,
- unsigned item_size,
- unsigned num_blocks,
- enum util_slab_threading threading)
-{
- item_size = align(item_size, sizeof(intptr_t));
-
- pool->num_pages = 0;
- pool->num_blocks = num_blocks;
- pool->block_size = sizeof(struct util_slab_block) + item_size;
- pool->block_size = align(pool->block_size, sizeof(intptr_t));
- pool->page_size = sizeof(struct util_slab_page) +
- num_blocks * pool->block_size;
- pool->first_free = NULL;
-
- make_empty_list(&pool->list);
-
- pipe_mutex_init(pool->mutex);
-
- util_slab_set_thread_safety(pool, threading);
-}
-
-void util_slab_destroy(struct util_slab_mempool *pool)
-{
- struct util_slab_page *page, *temp;
-
- foreach_s(page, temp, &pool->list) {
- remove_from_list(page);
- FREE(page);
- }
-
- pipe_mutex_destroy(pool->mutex);
-}
+/*
+ * Copyright 2010 Marek Olšák <maraeo@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "util/u_slab.h"
+
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "util/u_simple_list.h"
+
+#include <stdio.h>
+
+#define UTIL_SLAB_MAGIC 0xcafe4321
+
+/* The block is either allocated memory or free space. */
+struct util_slab_block {
+ /* The header. */
+ /* The first next free block. */
+ struct util_slab_block *next_free;
+
+ intptr_t magic;
+
+ /* Memory after the last member is dedicated to the block itself.
+ * The allocated size is always larger than this structure. */
+};
+
+static struct util_slab_block *
+util_slab_get_block(struct util_slab_mempool *pool,
+ struct util_slab_page *page, unsigned index)
+{
+ return (struct util_slab_block*)
+ ((uint8_t*)page + sizeof(struct util_slab_page) +
+ (pool->block_size * index));
+}
+
+static void util_slab_add_new_page(struct util_slab_mempool *pool)
+{
+ struct util_slab_page *page;
+ struct util_slab_block *block;
+ int i;
+
+ page = MALLOC(pool->page_size);
+ insert_at_tail(&pool->list, page);
+
+ /* Mark all blocks as free. */
+ for (i = 0; i < pool->num_blocks-1; i++) {
+ block = util_slab_get_block(pool, page, i);
+ block->next_free = util_slab_get_block(pool, page, i+1);
+ block->magic = UTIL_SLAB_MAGIC;
+ }
+
+ block = util_slab_get_block(pool, page, pool->num_blocks-1);
+ block->next_free = pool->first_free;
+ block->magic = UTIL_SLAB_MAGIC;
+ pool->first_free = util_slab_get_block(pool, page, 0);
+ pool->num_pages++;
+
+#if 0
+ fprintf(stderr, "New page! Num of pages: %i\n", pool->num_pages);
+#endif
+}
+
+static void *util_slab_alloc_st(struct util_slab_mempool *pool)
+{
+ struct util_slab_block *block;
+
+ if (!pool->first_free)
+ util_slab_add_new_page(pool);
+
+ block = pool->first_free;
+ assert(block->magic == UTIL_SLAB_MAGIC);
+ pool->first_free = block->next_free;
+
+ return (uint8_t*)block + sizeof(struct util_slab_block);
+}
+
+static void util_slab_free_st(struct util_slab_mempool *pool, void *ptr)
+{
+ struct util_slab_block *block =
+ (struct util_slab_block*)
+ ((uint8_t*)ptr - sizeof(struct util_slab_block));
+
+ assert(block->magic == UTIL_SLAB_MAGIC);
+ block->next_free = pool->first_free;
+ pool->first_free = block;
+}
+
+static void *util_slab_alloc_mt(struct util_slab_mempool *pool)
+{
+ void *mem;
+
+ pipe_mutex_lock(pool->mutex);
+ mem = util_slab_alloc_st(pool);
+ pipe_mutex_unlock(pool->mutex);
+ return mem;
+}
+
+static void util_slab_free_mt(struct util_slab_mempool *pool, void *ptr)
+{
+ pipe_mutex_lock(pool->mutex);
+ util_slab_free_st(pool, ptr);
+ pipe_mutex_unlock(pool->mutex);
+}
+
+void util_slab_set_thread_safety(struct util_slab_mempool *pool,
+ enum util_slab_threading threading)
+{
+ pool->threading = threading;
+
+ if (threading) {
+ pool->alloc = util_slab_alloc_mt;
+ pool->free = util_slab_free_mt;
+ } else {
+ pool->alloc = util_slab_alloc_st;
+ pool->free = util_slab_free_st;
+ }
+}
+
+void util_slab_create(struct util_slab_mempool *pool,
+ unsigned item_size,
+ unsigned num_blocks,
+ enum util_slab_threading threading)
+{
+ item_size = align(item_size, sizeof(intptr_t));
+
+ pool->num_pages = 0;
+ pool->num_blocks = num_blocks;
+ pool->block_size = sizeof(struct util_slab_block) + item_size;
+ pool->block_size = align(pool->block_size, sizeof(intptr_t));
+ pool->page_size = sizeof(struct util_slab_page) +
+ num_blocks * pool->block_size;
+ pool->first_free = NULL;
+
+ make_empty_list(&pool->list);
+
+ pipe_mutex_init(pool->mutex);
+
+ util_slab_set_thread_safety(pool, threading);
+}
+
+void util_slab_destroy(struct util_slab_mempool *pool)
+{
+ struct util_slab_page *page, *temp;
+
+ if (pool->list.next) {
+ foreach_s(page, temp, &pool->list) {
+ remove_from_list(page);
+ FREE(page);
+ }
+ }
+
+ pipe_mutex_destroy(pool->mutex);
+}
diff --git a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
index 8dc827c5a..84e8aa8ae 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_seamless_cube_map.xml
@@ -4,7 +4,7 @@
<OpenGLAPI>
<category name="GL_ARB_seamless_cube_map" number="65">
- <enum name="TEXTURE_CUBE_MAP_SEAMLESS" count="1" value="0x88F4">
+ <enum name="TEXTURE_CUBE_MAP_SEAMLESS" count="1" value="0x884F">
<size name="Get" mode="get"/>
</enum>
</category>
diff --git a/mesalib/src/mesa/main/enums.c b/mesalib/src/mesa/main/enums.c
index b00a738bc..c92a9a166 100644
--- a/mesalib/src/mesa/main/enums.c
+++ b/mesalib/src/mesa/main/enums.c
@@ -4460,7 +4460,7 @@ static const enum_elt all_enums[2340] =
{ 45645, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
{ 45676, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
{ 45711, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES */
- { 45746, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ { 45746, 0x0000884F }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
{ 45775, 0x00008071 }, /* GL_TEXTURE_DEPTH */
{ 45792, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
{ 45814, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
@@ -4723,7 +4723,7 @@ static const enum_elt all_enums[2340] =
{ 52477, 0x00000D17 }, /* GL_ZOOM_Y */
};
-static const unsigned reduced_enums[1571] =
+static const unsigned reduced_enums[1572] =
{
556, /* GL_FALSE */
853, /* GL_LINES */
@@ -5806,6 +5806,7 @@ static const unsigned reduced_enums[1571] =
2038, /* GL_TEXTURE_COMPARE_MODE */
2036, /* GL_TEXTURE_COMPARE_FUNC */
284, /* GL_COMPARE_REF_TO_TEXTURE */
+ 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
1400, /* GL_POINT_SPRITE */
347, /* GL_COORD_REPLACE */
1405, /* GL_POINT_SPRITE_R_MODE_NV */
@@ -5917,7 +5918,7 @@ static const unsigned reduced_enums[1571] =
1368, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
400, /* GL_DEPTH24_STENCIL8 */
2134, /* GL_TEXTURE_STENCIL_SIZE */
- 2079, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */
+ 1096, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
1094, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
1097, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
1101, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index 8c51a948e..e8190c392 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -1350,6 +1350,32 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
}
else if (!ctx->_ImageTransferState &&
!srcPacking->SwapBytes &&
+ dstFormat == MESA_FORMAT_ARGB8888 &&
+ srcFormat == GL_LUMINANCE_ALPHA &&
+ baseInternalFormat == GL_RGBA &&
+ srcType == GL_UNSIGNED_BYTE) {
+ /* special case of storing LA -> ARGB8888 */
+ int img, row, col;
+ const GLint srcRowStride =
+ _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType);
+ for (img = 0; img < srcDepth; img++) {
+ const GLubyte *srcRow = (const GLubyte *)
+ _mesa_image_address(dims, srcPacking, srcAddr, srcWidth,
+ srcHeight, srcFormat, srcType, img, 0, 0);
+ GLubyte *dstRow = dstSlices[img];
+ for (row = 0; row < srcHeight; row++) {
+ GLuint *d4 = (GLuint *) dstRow;
+ for (col = 0; col < srcWidth; col++) {
+ GLubyte l = srcRow[col * 2 + 0], a = srcRow[col * 2 + 1];
+ d4[col] = PACK_COLOR_8888(a, l, l, l);
+ }
+ dstRow += dstRowStride;
+ srcRow += srcRowStride;
+ }
+ }
+ }
+ else if (!ctx->_ImageTransferState &&
+ !srcPacking->SwapBytes &&
dstFormat == MESA_FORMAT_ARGB8888 &&
srcFormat == GL_RGBA &&
baseInternalFormat == GL_RGBA &&
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 300c3f0eb..953295c0e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -278,9 +278,16 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
case PIPE_FORMAT_R16G16_UNORM:
strb->Base.InternalFormat = GL_RG16;
break;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ strb->Base.InternalFormat = GL_RGBA32F;
+ break;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ strb->Base.InternalFormat = GL_RGBA16F;
+ break;
default:
_mesa_problem(NULL,
- "Unexpected format in st_new_renderbuffer_fb");
+ "Unexpected format %s in st_new_renderbuffer_fb",
+ util_format_name(format));
free(strb);
return NULL;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 74ae2d11d..d887455e6 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -137,15 +137,7 @@ st_DeleteTextureObject(struct gl_context *ctx,
if (stObj->pt)
pipe_resource_reference(&stObj->pt, NULL);
if (stObj->sampler_view) {
- if (stObj->sampler_view->context != st->pipe) {
- /* Take "ownership" of this texture sampler view by setting
- * its context pointer to this context. This avoids potential
- * crashes when the texture object is shared among contexts
- * and the original/owner context has already been destroyed.
- */
- stObj->sampler_view->context = st->pipe;
- }
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
}
_mesa_delete_texture_object(ctx, texObj);
}
@@ -450,7 +442,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
/* The parent texture object does not have space for this image */
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
@@ -717,7 +709,7 @@ decompress_with_blit(struct gl_context * ctx,
/* destroy the temp / dest surface */
util_destroy_rgba_surface(dst_texture, dst_surface);
- pipe_sampler_view_reference(&src_view, NULL);
+ pipe_sampler_view_release(pipe, &src_view);
}
@@ -1260,7 +1252,7 @@ st_finalize_texture(struct gl_context *ctx,
firstImage->pt != stObj->pt &&
(!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
}
/* Find gallium format for the Mesa texture */
@@ -1300,7 +1292,7 @@ st_finalize_texture(struct gl_context *ctx,
* gallium texture now. We'll make a new one below.
*/
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 72d309300..9718367a8 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -96,6 +96,25 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->ImageOffsets[i] = i * width * height;
}
+ _swrast_init_texture_image(texImage, width, height, depth);
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Code that overrides ctx->Driver.AllocTextureImageBuffer may use this to
+ * initialize the fields of swrast_texture_image without allocating the image
+ * buffer or initializing ImageOffsets or RowStride.
+ *
+ * Returns GL_TRUE on success, GL_FALSE on memory allocation failure.
+ */
+void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ struct swrast_texture_image *swImg = swrast_texture_image(texImage);
+
if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) &&
(height == 1 || _mesa_is_pow_two(texImage->Height2)) &&
(depth == 1 || _mesa_is_pow_two(texImage->Depth2)))
@@ -115,8 +134,6 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->HeightScale = (GLfloat) texImage->Height;
swImg->DepthScale = (GLfloat) texImage->Depth;
}
-
- return GL_TRUE;
}
diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h
index 468d22f0b..ad19eeecc 100644
--- a/mesalib/src/mesa/swrast/swrast.h
+++ b/mesalib/src/mesa/swrast/swrast.h
@@ -192,6 +192,10 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
GLsizei height, GLsizei depth);
extern void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth);
+
+extern void
_swrast_free_texture_image_buffer(struct gl_context *ctx,
struct gl_texture_image *texImage);