aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-15 22:49:12 +0000
committermarha <marha@users.sourceforge.net>2011-03-15 22:49:12 +0000
commit8285341e69cd721c6871b553e45437c767200545 (patch)
tree551508bddc84d1c16c15d961878cd2d2f6edb365 /mesalib/src/mesa/state_tracker
parent52b8618bfdaa4725fc403f50fe682d02e7f16435 (diff)
parent5e633abcca598289d0423d89bb400b41e6417259 (diff)
downloadvcxsrv-8285341e69cd721c6871b553e45437c767200545.tar.gz
vcxsrv-8285341e69cd721c6871b553e45437c767200545.tar.bz2
vcxsrv-8285341e69cd721c6871b553e45437c767200545.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c60
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h37
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c4
5 files changed, 112 insertions, 5 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 9dd1f8a3e..953cb446e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -301,11 +301,15 @@ st_bufferobj_map_range(struct gl_context *ctx, GLenum target,
if (access & GL_MAP_FLUSH_EXPLICIT_BIT)
flags |= PIPE_TRANSFER_FLUSH_EXPLICIT;
- if (access & GL_MAP_INVALIDATE_RANGE_BIT)
- flags |= PIPE_TRANSFER_DISCARD;
-
- if (access & GL_MAP_INVALIDATE_BUFFER_BIT)
- flags |= PIPE_TRANSFER_DISCARD;
+ if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
+ flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ }
+ else if (access & GL_MAP_INVALIDATE_RANGE_BIT) {
+ if (offset == 0 && length == obj->Size)
+ flags |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ else
+ flags |= PIPE_TRANSFER_DISCARD_RANGE;
+ }
if (access & GL_MAP_UNSYNCHRONIZED_BIT)
flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c
new file mode 100644
index 000000000..36668d343
--- /dev/null
+++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.c
@@ -0,0 +1,60 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Marek Olšák <maraeo@gmail.com>
+ * 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 THE AUTHORS 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.
+ *
+ **************************************************************************/
+
+
+/**
+ * glTextureBarrierNV function
+ *
+ * \author Marek Olšák
+ */
+
+
+#include "main/imports.h"
+#include "main/context.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "st_context.h"
+#include "st_cb_texturebarrier.h"
+
+
+/**
+ * Called via ctx->Driver.TextureBarrier()
+ */
+static void
+st_TextureBarrier(struct gl_context *ctx)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+
+ pipe->texture_barrier(pipe);
+}
+
+
+void st_init_texture_barrier_functions(struct dd_function_table *functions)
+{
+ functions->TextureBarrier = st_TextureBarrier;
+}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h
new file mode 100644
index 000000000..dc94cc443
--- /dev/null
+++ b/mesalib/src/mesa/state_tracker/st_cb_texturebarrier.h
@@ -0,0 +1,37 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Marek Olšák <maraeo@gmail.com>
+ * 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 THE AUTHORS 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.
+ *
+ **************************************************************************/
+
+#ifndef ST_CB_TEXTUREBARRIER_H
+#define ST_CB_TEXTUREBARRIER_H
+
+
+struct dd_function_table;
+
+extern void st_init_texture_barrier_functions(struct dd_function_table *functions);
+
+
+#endif
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index c1b4cde77..afd85f0de 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -53,6 +53,7 @@
#include "st_cb_flush.h"
#include "st_cb_syncobj.h"
#include "st_cb_strings.h"
+#include "st_cb_texturebarrier.h"
#include "st_cb_viewport.h"
#include "st_atom.h"
#include "st_draw.h"
@@ -288,6 +289,7 @@ void st_init_driver_functions(struct dd_function_table *functions)
st_init_cond_render_functions(functions);
st_init_readpixels_functions(functions);
st_init_texture_functions(functions);
+ st_init_texture_barrier_functions(functions);
st_init_flush_functions(functions);
st_init_string_functions(functions);
st_init_viewport_functions(functions);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 5fe516c19..2153865cf 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -522,4 +522,8 @@ void st_init_extensions(struct st_context *st)
if (screen->fence_finish) {
ctx->Extensions.ARB_sync = GL_TRUE;
}
+
+ if (st->pipe->texture_barrier) {
+ ctx->Extensions.NV_texture_barrier = GL_TRUE;
+ }
}