summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-12-07 11:54:27 -0800
committerEric Anholt <eric@anholt.net>2007-12-07 11:58:38 -0800
commit4d041ab34bf57f39874436f0f4b866aac7111a97 (patch)
treea43f3d5bdbd156b11ec9b9f5bbb73907cb361eee /src
parent230dec40b9fb79c4b6d41d1941eeebf7120d120b (diff)
parente2ca788ae700aae75bf8d024c1374c38cc5574f9 (diff)
Merge remote branch 'origin/master' into 965-ttm
Conflicts: src/mesa/drivers/dri/common/dri_bufmgr.h
Diffstat (limited to 'src')
-rw-r--r--src/glw/glw.pc.in2
-rw-r--r--src/glx/x11/dri_glx.c11
-rw-r--r--src/glx/x11/glxclient.h1
-rw-r--r--src/glx/x11/glxcmds.c1
-rw-r--r--src/mesa/Makefile2
-rw-r--r--src/mesa/descrip.mms5
-rw-r--r--src/mesa/drivers/common/descrip.mms5
-rw-r--r--src/mesa/drivers/common/driverfuncs.c2
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr.c9
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr.h14
-rw-r--r--src/mesa/drivers/dri/common/dri_bufmgr_fake.c40
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c3
-rw-r--r--src/mesa/drivers/dri/i915/i830_vtbl.c62
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c14
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_curbe.c62
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_emit.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_batchbuffer.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c726
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c9
-rw-r--r--src/mesa/drivers/osmesa/descrip.mms10
-rw-r--r--src/mesa/drivers/windows/gdi/wgl.c20
-rw-r--r--src/mesa/drivers/x11/descrip.mms10
-rw-r--r--src/mesa/main/config.h2
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/dd.h5
-rw-r--r--src/mesa/main/descrip.mms25
-rw-r--r--src/mesa/main/enable.c8
-rw-r--r--src/mesa/main/mtypes.h6
-rw-r--r--src/mesa/main/texstore.c24
-rw-r--r--src/mesa/math/descrip.mms6
-rw-r--r--src/mesa/shader/descrip.mms40
-rw-r--r--src/mesa/shader/prog_statevars.c93
-rw-r--r--src/mesa/shader/prog_statevars.h8
-rw-r--r--src/mesa/shader/slang/descrip.mms49
-rw-r--r--src/mesa/shader/slang/slang_codegen.c3
-rw-r--r--src/mesa/swrast/descrip.mms18
-rw-r--r--src/mesa/swrast/s_aalinetemp.h1
-rw-r--r--src/mesa/swrast/s_aatritemp.h5
-rw-r--r--src/mesa/swrast/s_context.c17
-rw-r--r--src/mesa/swrast/s_context.h4
-rw-r--r--src/mesa/swrast/s_fragprog.c2
-rw-r--r--src/mesa/swrast/s_linetemp.h3
-rw-r--r--src/mesa/swrast/s_points.c10
-rw-r--r--src/mesa/swrast/s_triangle.c2
-rw-r--r--src/mesa/swrast/s_tritemp.h12
-rw-r--r--src/mesa/swrast/swrast.h7
-rw-r--r--src/mesa/swrast_setup/descrip.mms7
-rw-r--r--src/mesa/swrast_setup/ss_context.c3
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c10
-rw-r--r--src/mesa/swrast_setup/ss_tritmp.h2
-rw-r--r--src/mesa/tnl/descrip.mms38
-rw-r--r--src/mesa/tnl/t_vb_program.c159
-rw-r--r--src/mesa/tnl/tnl.h8
-rw-r--r--src/mesa/tnl_dd/t_dd_tritmp.h8
-rw-r--r--src/mesa/vbo/descrip.mms4
58 files changed, 945 insertions, 673 deletions
diff --git a/src/glw/glw.pc.in b/src/glw/glw.pc.in
index 951e2dc2af..9c2682fbf3 100644
--- a/src/glw/glw.pc.in
+++ b/src/glw/glw.pc.in
@@ -7,5 +7,5 @@ Name: glw
Description: Mesa OpenGL widget library
Requires: gl
Version: @VERSION@
-Libs: -L${libdir} -lGLU
+Libs: -L${libdir} -lGLw
Cflags: -I${includedir}
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c
index c02f105611..dab454e8e3 100644
--- a/src/glx/x11/dri_glx.c
+++ b/src/glx/x11/dri_glx.c
@@ -194,7 +194,8 @@ static __DRIdriver *OpenDriver(const char *driverName)
/* First, search Drivers list to see if we've already opened this driver */
for (driver = Drivers; driver; driver = driver->next) {
if (strcmp(driver->name, driverName) == 0) {
- /* found it */
+ /* found it, increment library refcount & return */
+ dlopen(driver->libpath, RTLD_NOW | RTLD_GLOBAL);
return driver;
}
}
@@ -238,7 +239,12 @@ static __DRIdriver *OpenDriver(const char *driverName)
break; /* out of memory! */
/* init the struct */
driver->name = __glXstrdup(driverName);
- if (!driver->name) {
+ driver->libpath = __glXstrdup(realDriverName);
+ if (!driver->name || !driver->libpath) {
+ if (driver->name)
+ Xfree(driver->name);
+ if (driver->libpath)
+ Xfree(driver->libpath);
Xfree(driver);
driver = NULL;
break; /* out of memory! */
@@ -401,6 +407,7 @@ static void driDestroyDisplay(Display *dpy, void *private)
Drivers = driver->next;
Xfree(driver->name);
+ Xfree(driver->libpath);
Xfree(driver);
break;
}
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h
index 05354073c4..7054f3cc31 100644
--- a/src/glx/x11/glxclient.h
+++ b/src/glx/x11/glxclient.h
@@ -117,6 +117,7 @@ struct __DRIdisplayRec {
*/
struct __DRIdriverRec {
const char *name;
+ const char *libpath;
void *handle;
PFNCREATENEWSCREENFUNC createNewScreenFunc;
struct __DRIdriverRec *next;
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index 2d217517af..7ff2bf700c 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -101,6 +101,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, __GLXscreenConfigs *sc)
longer exists in the Xserver */
(*pdraw->driDrawable.destroyDrawable)(&pdraw->driDrawable);
XF86DRIDestroyDrawable(dpy, sc->scr, draw);
+ __glxHashDelete(sc->drawHash, draw);
Xfree(pdraw);
}
} while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1);
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 77bb7be480..2c6d65d8a1 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -65,7 +65,7 @@ linux-solo: depend subdirs libmesa.a
# Stand-alone Mesa libGL, no built-in drivers (DirectFB)
libgl-core: $(CORE_OBJECTS)
- @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS) \
+ @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
-install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(CORE_OBJECTS) \
$(GL_LIB_DEPS)
diff --git a/src/mesa/descrip.mms b/src/mesa/descrip.mms
index a12e3fc1b7..dbfa336a91 100644
--- a/src/mesa/descrip.mms
+++ b/src/mesa/descrip.mms
@@ -1,5 +1,6 @@
# Makefile for Mesa for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Date last revision : 7 March 2007
all :
set default [.main]
@@ -22,5 +23,5 @@ all :
$(MMS)$(MMSQUALIFIERS)
set default [-.swrast_setup]
$(MMS)$(MMSQUALIFIERS)
- set default [-.array_cache]
+ set default [-.vbo]
$(MMS)$(MMSQUALIFIERS)
diff --git a/src/mesa/drivers/common/descrip.mms b/src/mesa/drivers/common/descrip.mms
index 3cb856d12c..99a2ae6c37 100644
--- a/src/mesa/drivers/common/descrip.mms
+++ b/src/mesa/drivers/common/descrip.mms
@@ -1,12 +1,15 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 2 November 2005
+# Last revision : 3 October 2007
.first
define gl [----.include.gl]
define math [--.math]
define tnl [--.tnl]
define swrast [--.swrast]
+ define glapi [--.glapi]
+ define shader [--.shader]
+ define main [--.main]
.include [----]mms-config.
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 1e7c279875..03fbab69e3 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -112,6 +112,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->DeleteTexture = _mesa_delete_texture_object;
driver->NewTextureImage = _mesa_new_texture_image;
driver->FreeTexImageData = _mesa_free_texture_image_data;
+ driver->MapTexture = NULL;
+ driver->UnmapTexture = NULL;
driver->TextureMemCpy = _mesa_memcpy;
driver->IsTextureResident = NULL;
driver->PrioritizeTexture = NULL;
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c
index 72a4a17150..757a237494 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr.c
+++ b/src/mesa/drivers/dri/common/dri_bufmgr.c
@@ -35,7 +35,7 @@
dri_bo *
dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
- unsigned int alignment, unsigned int location_mask)
+ unsigned int alignment, uint64_t location_mask)
{
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 |
@@ -48,7 +48,7 @@ dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
dri_bo *
dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name, unsigned long offset,
unsigned long size, void *virtual,
- unsigned int location_mask)
+ uint64_t location_mask)
{
assert((location_mask & ~(DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_VRAM | DRM_BO_FLAG_MEM_PRIV0 |
@@ -139,9 +139,10 @@ dri_bufmgr_destroy(dri_bufmgr *bufmgr)
}
-void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee)
+void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
+ GLuint offset, dri_bo *target_buf)
{
- batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee);
+ reloc_buf->bufmgr->emit_reloc(reloc_buf, flags, delta, offset, target_buf);
}
void *dri_process_relocs(dri_bo *batch_buf, GLuint *count)
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h
index 1290fa956b..d263ad279b 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr.h
+++ b/src/mesa/drivers/dri/common/dri_bufmgr.h
@@ -84,7 +84,7 @@ struct _dri_bufmgr {
*/
dri_bo *(*bo_alloc)(dri_bufmgr *bufmgr_ctx, const char *name,
unsigned long size, unsigned int alignment,
- unsigned int location_mask);
+ uint64_t location_mask);
/**
* Allocates a buffer object for a static allocation.
@@ -94,7 +94,7 @@ struct _dri_bufmgr {
*/
dri_bo *(*bo_alloc_static)(dri_bufmgr *bufmgr_ctx, const char *name,
unsigned long offset, unsigned long size,
- void *virtual, unsigned int location_mask);
+ void *virtual, uint64_t location_mask);
/** Takes a reference on a buffer object */
void (*bo_reference)(dri_bo *bo);
@@ -153,7 +153,7 @@ struct _dri_bufmgr {
* \param target Buffer whose offset should be written into the relocation
* entry.
*/
- void (*emit_reloc)(dri_bo *reloc_buf, GLuint flags, GLuint delta,
+ void (*emit_reloc)(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
GLuint offset, dri_bo *target);
/**
@@ -175,10 +175,10 @@ struct _dri_bufmgr {
};
dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size,
- unsigned int alignment, unsigned int location_mask);
+ unsigned int alignment, uint64_t location_mask);
dri_bo *dri_bo_alloc_static(dri_bufmgr *bufmgr, const char *name,
unsigned long offset, unsigned long size,
- void *virtual, unsigned int location_mask);
+ void *virtual, uint64_t location_mask);
void dri_bo_reference(dri_bo *bo);
void dri_bo_unreference(dri_bo *bo);
int dri_bo_map(dri_bo *buf, GLboolean write_enable);
@@ -202,6 +202,7 @@ dri_bufmgr *dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
int (*fence_wait)(void *private,
unsigned int cookie),
void *driver_priv);
+void dri_bufmgr_fake_set_debug(dri_bufmgr *bufmgr, GLboolean enable_debug);
void dri_bo_fake_disable_backing_store(dri_bo *bo,
void (*invalidate_cb)(dri_bo *bo,
void *ptr),
@@ -210,7 +211,8 @@ void dri_bufmgr_destroy(dri_bufmgr *bufmgr);
dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
unsigned int handle);
-void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee);
+void dri_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
+ GLuint offset, dri_bo *target_buf);
void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count);
void dri_post_process_relocs(dri_bo *batch_buf);
void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence);
diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
index 9081f23e4a..4c5e0cac26 100644
--- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
+++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c
@@ -41,11 +41,10 @@
#include "mm.h"
#include "imports.h"
-#if 0
-#define DBG(...) _mesa_printf(__VA_ARGS__)
-#else
-#define DBG(...)
-#endif
+#define DBG(...) do { \
+ if (bufmgr_fake->debug) \
+ _mesa_printf(__VA_ARGS__); \
+} while (0)
/* Internal flags:
*/
@@ -67,7 +66,7 @@ struct fake_buffer_reloc
dri_bo *target_buf;
GLuint offset;
GLuint delta;
- GLuint validate_flags;
+ uint64_t validate_flags;
GLboolean relocated;
};
@@ -129,6 +128,7 @@ typedef struct _bufmgr_fake {
/** Driver-supplied argument to driver callbacks */
void *driver_priv;
+ GLboolean debug;
/** fake relocation list */
struct fake_buffer_reloc reloc[MAX_RELOCS];
@@ -161,7 +161,7 @@ typedef struct _dri_bo_fake {
* DRM_BO_NO_BACKING_STORE and BM_NO_FENCE_SUBDATA, which are the first two
* driver private flags.
*/
- unsigned int flags;
+ uint64_t flags;
unsigned int alignment;
GLboolean is_static, validated;
unsigned int map_count;
@@ -329,6 +329,7 @@ free_backing_store(dri_bo *bo)
static void
set_dirty(dri_bo *bo)
{
+ dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
if (bo_fake->flags & BM_NO_BACKING_STORE && bo_fake->invalidate_cb != NULL)
@@ -575,7 +576,7 @@ dri_bufmgr_fake_contended_lock_take(dri_bufmgr *bufmgr)
static dri_bo *
dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment,
- unsigned int location_mask)
+ uint64_t location_mask)
{
dri_bufmgr_fake *bufmgr_fake;
dri_bo_fake *bo_fake;
@@ -613,7 +614,7 @@ dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name,
static dri_bo *
dri_fake_bo_alloc_static(dri_bufmgr *bufmgr, const char *name,
unsigned long offset, unsigned long size,
- void *virtual, unsigned int location_mask)
+ void *virtual, uint64_t location_mask)
{
dri_bufmgr_fake *bufmgr_fake;
dri_bo_fake *bo_fake;
@@ -790,6 +791,7 @@ dri_fake_bo_unmap(dri_bo *bo)
return 0;
_glthread_LOCK_MUTEX(bufmgr_fake->mutex);
+ assert(bo_fake->map_count != 0);
if (--bo_fake->map_count != 0) {
_glthread_UNLOCK_MUTEX(bufmgr_fake->mutex);
return 0;
@@ -806,7 +808,7 @@ dri_fake_bo_unmap(dri_bo *bo)
}
static int
-dri_fake_bo_validate(dri_bo *bo, unsigned int flags)
+dri_fake_bo_validate(dri_bo *bo, uint64_t flags)
{
dri_bufmgr_fake *bufmgr_fake;
dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
@@ -814,13 +816,19 @@ dri_fake_bo_validate(dri_bo *bo, unsigned int flags)
/* XXX: Sanity-check whether we've already validated this one under
* different flags. See drmAddValidateItem().
*/
+ bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
DBG("drm_bo_validate: (buf %d: %s, %d kb)\n", bo_fake->id, bo_fake->name,
bo_fake->bo.size / 1024);
- bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
_glthread_LOCK_MUTEX(bufmgr_fake->mutex);
{
+ /* Sanity check: Buffers should be unmapped before being validated.
+ * This is not so much of a problem for bufmgr_fake, but TTM refuses,
+ * and the problem is harder to debug there.
+ */
+ assert(bo_fake->map_count == 0);
+
if (bo_fake->is_static) {
/* Add it to the needs-fence list */
bufmgr_fake->need_fence = 1;
@@ -950,7 +958,7 @@ dri_fake_destroy(dri_bufmgr *bufmgr)
}
static void
-dri_fake_emit_reloc(dri_bo *reloc_buf, GLuint flags, GLuint delta,
+dri_fake_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
GLuint offset, dri_bo *target_buf)
{
dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)reloc_buf->bufmgr;
@@ -1133,6 +1141,14 @@ dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
bufmgr_fake->nr_relocs = 0;
}
+void
+dri_bufmgr_fake_set_debug(dri_bufmgr *bufmgr, GLboolean enable_debug)
+{
+ dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
+
+ bufmgr_fake->debug = enable_debug;
+}
+
dri_bufmgr *
dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual,
unsigned long size,
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 2e2e64c4d1..2b378a531e 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -336,6 +336,9 @@ static void driSwapBuffers(__DRIdrawable *drawable)
__DRIdrawablePrivate *dPriv = drawable->private;
drm_clip_rect_t rect;
+ if (!dPriv->numClipRects)
+ return;
+
dPriv->swapBuffers(dPriv);
/* Check that we actually have the new damage report method */
diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
index eecff2729f..c23c02c060 100644
--- a/src/mesa/drivers/dri/i915/i830_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
@@ -383,9 +383,15 @@ do { \
} while (0)
static GLuint
+get_dirty(struct i830_hw_state *state)
+{
+ return state->active & ~state->emitted;
+}
+
+static GLuint
get_state_size(struct i830_hw_state *state)
{
- GLuint dirty = state->active & ~state->emitted;
+ GLuint dirty = get_dirty(state);
GLuint sz = 0;
GLuint i;
@@ -416,7 +422,7 @@ get_state_size(struct i830_hw_state *state)
/* Push the state into the sarea and/or texture memory.
*/
static void
-i830_emit_state(struct intel_context *intel)
+i830_do_emit_state(struct intel_context *intel)
{
struct i830_context *i830 = i830_context(&intel->ctx);
struct i830_hw_state *state = i830->current;
@@ -433,10 +439,32 @@ i830_emit_state(struct intel_context *intel)
*/
intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0);
+ /* Workaround. There are cases I haven't been able to track down
+ * where we aren't emitting a full state at the start of a new
+ * batchbuffer. This code spots that we are on a new batchbuffer
+ * and forces a full state emit no matter what.
+ *
+ * In the normal case state->emitted is already zero, this code is
+ * another set of checks to make sure it really is.
+ */
+ if (intel->batch->id != intel->last_state_batch_id ||
+ intel->batch->map == intel->batch->ptr)
+ {
+ state->emitted = 0;
+ intel_batchbuffer_require_space(intel->batch, get_state_size(state), 0);
+ }
+
/* Do this here as we may have flushed the batchbuffer above,
* causing more state to be dirty!
*/
- dirty = state->active & ~state->emitted;
+ dirty = get_dirty(state);
+ state->emitted |= dirty;
+ assert(get_dirty(state) == 0);
+
+ if (intel->batch->id != intel->last_state_batch_id) {
+ assert(dirty & I830_UPLOAD_CTX);
+ intel->last_state_batch_id = intel->batch->id;
+ }
if (dirty & I830_UPLOAD_INVARIENT) {
DBG("I830_UPLOAD_INVARIENT:\n");
@@ -515,7 +543,30 @@ i830_emit_state(struct intel_context *intel)
}
}
- state->emitted |= dirty;
+ intel->batch->dirty_state &= ~dirty;
+ assert(get_dirty(state) == 0);
+}
+
+static void
+i830_emit_state(struct intel_context *intel)
+{
+ struct i830_context *i830 = i830_context(&intel->ctx);
+
+ i830_do_emit_state( intel );
+
+ /* Second chance - catch batchbuffer wrap in the middle of state
+ * emit. This shouldn't happen but it has been observed in
+ * testing.
+ */
+ if (get_dirty( i830->current )) {
+ /* Force a full re-emit if this happens.
+ */
+ i830->current->emitted = 0;
+ i830_do_emit_state( intel );
+ }
+
+ assert(get_dirty(i830->current) == 0);
+ assert((intel->batch->dirty_state & (1<<1)) == 0);
}
static void
@@ -652,8 +703,7 @@ i830_assert_not_dirty( struct intel_context *intel )
{
struct i830_context *i830 = i830_context(&intel->ctx);
struct i830_hw_state *state = i830->current;
- GLuint dirty = state->active & ~state->emitted;
- assert(!dirty);
+ assert(!get_dirty(state));
}
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 5decffa116..58f681f74b 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -442,14 +442,16 @@ i915_do_emit_state(struct intel_context *intel)
}
if (dirty & I915_UPLOAD_PROGRAM) {
- if (INTEL_DEBUG & DEBUG_STATE)
- fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
+ if (state->ProgramSize) {
+ if (INTEL_DEBUG & DEBUG_STATE)
+ fprintf(stderr, "I915_UPLOAD_PROGRAM:\n");
- assert((state->Program[0] & 0x1ff) + 2 == state->ProgramSize);
+ assert((state->Program[0] & 0x1ff) + 2 == state->ProgramSize);
- emit(intel, state->Program, state->ProgramSize * sizeof(GLuint));
- if (INTEL_DEBUG & DEBUG_STATE)
- i915_disassemble_program(state->Program, state->ProgramSize);
+ emit(intel, state->Program, state->ProgramSize * sizeof(GLuint));
+ if (INTEL_DEBUG & DEBUG_STATE)
+ i915_disassemble_program(state->Program, state->ProgramSize);
+ }
}
intel->batch->dirty_state &= ~dirty;
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index a26a424f86..326be9c76f 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -460,6 +460,8 @@ intelInitContext(struct intel_context *intel,
#if DO_DEBUG
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+ if (!intel->intelScreen->ttm && (INTEL_DEBUG & DEBUG_BUFMGR))
+ dri_bufmgr_fake_set_debug(intel->intelScreen->bufmgr, GL_TRUE);
#endif
if (getenv("INTEL_NO_RAST")) {
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index bdfdfd1704..4654ab1ddf 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -70,12 +70,14 @@ static void brwUseProgram(GLcontext *ctx, GLuint program)
if (sh_prog) {
if (sh_prog->VertexProgram) {
brw->attribs.VertexProgram->Current = sh_prog->VertexProgram;
+ sh_prog->VertexProgram->Base.RefCount++;
ctx->VertexProgram.Enabled = GL_TRUE;
}else
ctx->VertexProgram.Enabled = GL_FALSE;
if (sh_prog->FragmentProgram) {
brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram;
+ sh_prog->FragmentProgram->Base.RefCount++;
ctx->FragmentProgram.Enabled = GL_TRUE;
} else
ctx->FragmentProgram.Enabled = GL_FALSE;
diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c
index 43e66ff3fd..4007dbf9e9 100644
--- a/src/mesa/drivers/dri/i965/brw_curbe.c
+++ b/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -184,6 +184,7 @@ static GLfloat fixed_plane[6][4] = {
*/
static void upload_constant_buffer(struct brw_context *brw)
{
+ struct intel_context *intel = &brw->intel;
GLcontext *ctx = &brw->intel.ctx;
struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
struct brw_fragment_program *fp = (struct brw_fragment_program *)brw->fragment_program;
@@ -201,13 +202,10 @@ static void upload_constant_buffer(struct brw_context *brw)
brw->curbe.tracked_state.dirty.mesa |= fp->param_state;
if (sz == 0) {
- struct brw_constant_buffer cb;
- cb.header.opcode = CMD_CONST_BUFFER;
- cb.header.length = sizeof(cb)/4 - 2;
- cb.header.valid = 0;
- cb.bits0.buffer_length = 0;
- cb.bits0.buffer_address = 0;
- BRW_BATCH_STRUCT(brw, &cb);
+ BEGIN_BATCH(2, INTEL_BATCH_NO_CLIPRECTS);
+ OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2));
+ OUT_BATCH(0);
+ ADVANCE_BATCH();
if (brw->curbe.last_buf) {
free(brw->curbe.last_buf);
@@ -317,39 +315,23 @@ static void upload_constant_buffer(struct brw_context *brw)
dri_bo_subdata(pool->buffer, brw->curbe.gs_offset, bufsz, buf);
}
- /* TODO: only emit the constant_buffer packet when necessary, ie:
- - contents have changed
- - offset has changed
- - hw requirements due to other packets emitted.
- */
- {
- struct brw_constant_buffer cb;
-
- memset(&cb, 0, sizeof(cb));
-
- cb.header.opcode = CMD_CONST_BUFFER;
- cb.header.length = sizeof(cb)/4 - 2;
- cb.header.valid = 1;
- cb.bits0.buffer_length = sz - 1;
- cb.bits0.buffer_address = brw->curbe.gs_offset >> 6;
-
- /* Because this provokes an action (ie copy the constants into the
- * URB), it shouldn't be shortcircuited if identical to the
- * previous time - because eg. the urb destination may have
- * changed, or the urb contents different to last time.
- *
- * Note that the data referred to is actually copied internally,
- * not just used in place according to passed pointer.
- *
- * It appears that the CS unit takes care of using each available
- * URB entry (Const URB Entry == CURBE) in turn, and issuing
- * flushes as necessary when doublebuffering of CURBEs isn't
- * possible.
- */
-/* intel_batchbuffer_align(brw->intel.batch, 64, sizeof(cb)); */
- BRW_BATCH_STRUCT(brw, &cb);
-/* intel_batchbuffer_align(brw->intel.batch, 64, 0); */
- }
+ /* Because this provokes an action (ie copy the constants into the
+ * URB), it shouldn't be shortcircuited if identical to the
+ * previous time - because eg. the urb destination may have
+ * changed, or the urb contents different to last time.
+ *
+ * Note that the data referred to is actually copied internally,
+ * not just used in place according to passed pointer.
+ *
+ * It appears that the CS unit takes care of using each available
+ * URB entry (Const URB Entry == CURBE) in turn, and issuing
+ * flushes as necessary when doublebuffering of CURBEs isn't
+ * possible.
+ */
+ BEGIN_BATCH(2, INTEL_BATCH_NO_CLIPRECTS);
+ OUT_BATCH((CMD_CONST_BUFFER << 16) | (1 << 8) | (2 - 2));
+ OUT_BATCH(brw->curbe.gs_offset | (sz - 1));
+ ADVANCE_BATCH();
}
/* This tracked state is unique in that the state it monitors varies
diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c
index 1f7158f7a7..6bafa44b82 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -810,6 +810,7 @@ static void emit_kil( struct brw_wm_compile *c,
brw_push_insn_state(p);
brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0[i], brw_imm_f(0));
brw_set_predicate_control_flag_value(p, 0xff);
+ brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_AND(p, r0uw, brw_flag_reg(), r0uw);
brw_pop_insn_state(p);
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index 4b273fefe9..e738086fef 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -324,6 +324,20 @@ static void emit_fb_write(struct brw_wm_compile *c,
nr += 8;
brw_pop_insn_state(p);
}
+
+ if (c->key.source_depth_to_render_target)
+ {
+ if (c->key.computes_depth) {
+ src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1);
+ brw_MOV(p, brw_message_reg(nr), src0);
+ } else {
+ src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+ brw_MOV(p, brw_message_reg(nr), src0);
+ }
+
+ nr += 2;
+ }
+
fire_fb_write(c, 0, nr);
}
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 7d26bd0a16..21db0e7dcd 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -131,6 +131,7 @@ do_flush_locked(struct intel_batchbuffer *batch,
void *start;
GLuint count;
+ dri_bo_unmap(batch->buf);
start = dri_process_relocs(batch->buf, &count);
batch->map = NULL;
diff --git a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
index 32d9886091..3e0d818a0c 100644
--- a/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
+++ b/src/mesa/drivers/dri/intel/intel_bufmgr_ttm.c
@@ -1,10 +1,10 @@
/**************************************************************************
- *
+ *
* Copyright © 2007 Red Hat Inc.
* Copyright © 2007 Intel Corporation
* Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA
* 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
@@ -12,20 +12,20 @@
* 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 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 COPYRIGHT HOLDERS, 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
+ * 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.
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
- *
+ *
+ *
**************************************************************************/
/*
* Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
@@ -52,11 +52,11 @@
struct intel_reloc_info
{
- GLuint type;
- GLuint reloc;
- GLuint delta; /* not needed? */
- GLuint index;
- drm_handle_t handle;
+ GLuint type;
+ GLuint reloc;
+ GLuint delta;
+ GLuint index;
+ drm_handle_t handle;
};
struct intel_bo_node
@@ -64,8 +64,8 @@ struct intel_bo_node
drmMMListHead head;
drmBO *buf;
struct drm_i915_op_arg bo_arg;
- unsigned long arg0;
- unsigned long arg1;
+ uint64_t flags;
+ uint64_t mask;
void (*destroy)(void *);
void *priv;
};
@@ -92,39 +92,40 @@ struct intel_bo_list {
};
typedef struct _dri_bufmgr_ttm {
- dri_bufmgr bufmgr;
+ dri_bufmgr bufmgr;
- int fd;
- _glthread_Mutex mutex;
- unsigned int fence_type;
- unsigned int fence_type_flush;
+ int fd;
+ _glthread_Mutex mutex;
+ unsigned int fence_type;
+ unsigned int fence_type_flush;
- uint32_t max_relocs;
- /** ttm relocation list */
- struct intel_bo_list list;
- struct intel_bo_list reloc_list;
+ uint32_t max_relocs;
+ /** ttm relocation list */
+ struct intel_bo_list list;
+ struct intel_bo_list reloc_list;
} dri_bufmgr_ttm;
typedef struct _dri_bo_ttm {
- dri_bo bo;
+ dri_bo bo;
- int refcount; /* Protected by bufmgr->mutex */
- drmBO drm_bo;
- const char *name;
+ int refcount; /* Protected by bufmgr->mutex */
+ drmBO drm_bo;
+ const char *name;
} dri_bo_ttm;
typedef struct _dri_fence_ttm
{
- dri_fence fence;
+ dri_fence fence;
- int refcount; /* Protected by bufmgr->mutex */
- const char *name;
- drmFence drm_fence;
+ int refcount; /* Protected by bufmgr->mutex */
+ const char *name;
+ drmFence drm_fence;
} dri_fence_ttm;
-static void intel_bo_free_list(struct intel_bo_list *list)
+static void
+intel_bo_free_list(struct intel_bo_list *list)
{
struct intel_bo_node *node;
drmMMListHead *l;
@@ -139,12 +140,15 @@ static void intel_bo_free_list(struct intel_bo_list *list)
}
}
-static void generic_destroy(void *nodep)
+static void
+generic_destroy(void *nodep)
{
free(nodep);
}
-static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destroy)(void *))
+static int
+intel_create_bo_list(int numTarget, struct intel_bo_list *list,
+ void (*destroy)(void *))
{
DRMINITLISTHEAD(&list->list);
list->numCurrent = 0;
@@ -157,8 +161,10 @@ static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void
static struct drm_i915_op_arg *
-intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_list *reloc_list, GLuint *count_p)
+intel_setup_validate_list(dri_bufmgr_ttm *bufmgr_ttm, GLuint *count_p)
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_node *node;
struct intel_bo_reloc_node *rl_node;
drmMMListHead *l, *rl;
@@ -185,13 +191,15 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li
prevNext = &arg->next;
req->bo_req.handle = node->buf->handle;
req->op = drm_bo_validate;
- req->bo_req.flags = node->arg0;
+ req->bo_req.flags = node->flags;
req->bo_req.hint = 0;
- req->bo_req.mask = node->arg1;
+ req->bo_req.mask = node->mask;
req->bo_req.fence_class = 0; /* Backwards compat. */
arg->reloc_handle = 0;
- for (rl = reloc_list->list.next; rl != &reloc_list->list; rl = rl->next) {
+ for (rl = reloc_list->list.next; rl != &reloc_list->list;
+ rl = rl->next)
+ {
rl_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head);
if (rl_node->handle == node->buf->handle) {
@@ -208,13 +216,15 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li
return first;
}
-static void intel_free_validate_list(int fd, struct intel_bo_list *list)
+static void
+intel_free_validate_list(dri_bufmgr_ttm *bufmgr_ttm)
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
struct intel_bo_node *node;
drmMMListHead *l;
for (l = list->list.next; l != &list->list; l = l->next) {
- node = DRMLISTENTRY(struct intel_bo_node, l, head);
+ node = DRMLISTENTRY(struct intel_bo_node, l, head);
if (node->destroy)
(*node->destroy)(node->priv);
@@ -222,30 +232,45 @@ static void intel_free_validate_list(int fd, struct intel_bo_list *list)
}
}
-static void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list)
+static void
+intel_free_reloc_list(dri_bufmgr_ttm *bufmgr_ttm)
{
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_reloc_node *reloc_node;
drmMMListHead *rl, *tmp;
- for (rl = reloc_list->list.next, tmp = rl->next; rl != &reloc_list->list; rl = tmp, tmp = rl->next) {
+ for (rl = reloc_list->list.next, tmp = rl->next; rl != &reloc_list->list;
+ rl = tmp, tmp = rl->next)
+ {
reloc_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head);
DRMLISTDEL(rl);
if (reloc_node->nr_reloc_types > 1) {
-
/* TODO */
}
- drmBOUnmap(fd, &reloc_node->type_list.buf);
- drmBOUnreference(fd, &reloc_node->type_list.buf);
+ drmBOUnmap(bufmgr_ttm->fd, &reloc_node->type_list.buf);
+ drmBOUnreference(bufmgr_ttm->fd, &reloc_node->type_list.buf);
free(reloc_node);
}
}
-static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned flags,
- unsigned mask, int *itemLoc, void (*destroy_cb)(void *))
+/**
+ * Adds the given buffer to the list of buffers to be validated (moved into the
+ * appropriate memory type) with the next batch submission.
+ *
+ * If a buffer is validated multiple times in a batch submission, it ends up
+ * with the intersection of the memory type flags and the union of the
+ * remaining flags.
+ */
+static int
+intel_add_validate_buffer(dri_bufmgr_ttm *bufmgr_ttm,
+ dri_bo *buf,
+ uint64_t flags, uint64_t mask,
+ int *itemLoc, void (*destroy_cb)(void *))
{
+ struct intel_bo_list *list = &bufmgr_ttm->list;
struct intel_bo_node *node, *cur;
drmMMListHead *l;
int count = 0;
@@ -253,6 +278,7 @@ static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, un
drmBO *buf_bo = &((dri_bo_ttm *)buf)->drm_bo;
cur = NULL;
+ /* Find the buffer in the validation list if it's already there. */
for (l = list->list.next; l != &list->list; l = l->next) {
node = DRMLISTENTRY(struct intel_bo_node, l, head);
if (node->buf->handle == buf_bo->handle) {
@@ -261,7 +287,7 @@ static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, un
}
count++;
}
-
+
if (!cur) {
cur = drmMalloc(sizeof(*cur));
if (!cur) {
@@ -269,55 +295,81 @@ static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, un
}
cur->buf = buf_bo;
cur->priv = buf;
- cur->arg0 = flags;
- cur->arg1 = mask;
+ cur->flags = flags;
+ cur->mask = mask;
cur->destroy = destroy_cb;
ret = 1;
DRMLISTADDTAIL(&cur->head, &list->list);
-
} else {
- unsigned memMask = (cur->arg1 | mask) & DRM_BO_MASK_MEM;
- unsigned memFlags = cur->arg0 & flags & memMask;
-
+ uint64_t memMask = (cur->mask | mask) & DRM_BO_MASK_MEM;
+ uint64_t memFlags = cur->flags & flags & memMask;
+
if (!memFlags) {
+ fprintf(stderr,
+ "%s: No shared memory types between "
+ "0x%16llx and 0x%16llx\n",
+ __FUNCTION__, cur->flags, flags);
return -EINVAL;
}
- if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) {
+ if (mask & cur->mask & ~DRM_BO_MASK_MEM & (cur->flags ^ flags)) {
+ fprintf(stderr,
+ "%s: Incompatible flags between 0x%16llx and 0x%16llx "
+ "(0x%16llx, 0x%16llx masks)\n",
+ __FUNCTION__, cur->flags, flags, cur->mask, mask);
return -EINVAL;
}
- cur->arg1 |= mask;
- cur->arg0 = memFlags | ((cur->arg0 | flags) &
- cur->arg1 & ~DRM_BO_MASK_MEM);
+ cur->mask |= mask;
+ cur->flags = memFlags | ((cur->flags | flags) &
+ cur->mask & ~DRM_BO_MASK_MEM);
}
*itemLoc = count;
return ret;
}
-#define RELOC_BUF_SIZE(x) ((I915_RELOC_HEADER + x * I915_RELOC0_STRIDE) * sizeof(uint32_t))
+#define RELOC_BUF_SIZE(x) ((I915_RELOC_HEADER + x * I915_RELOC0_STRIDE) * \
+ sizeof(uint32_t))
-static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type, int max_relocs)
+static int
+intel_create_new_reloc_type_list(dri_bufmgr_ttm *bufmgr_ttm,
+ struct intel_bo_reloc_list *cur_type)
{
int ret;
-
+
/* should allocate a drmBO here */
- ret = drmBOCreate(fd, RELOC_BUF_SIZE(max_relocs), 0,
+ ret = drmBOCreate(bufmgr_ttm->fd, RELOC_BUF_SIZE(bufmgr_ttm->max_relocs), 0,
NULL,
- DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | DRM_BO_FLAG_CACHED,
+ DRM_BO_FLAG_MEM_LOCAL |
+ DRM_BO_FLAG_READ |
+ DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_MAPPABLE |
+ DRM_BO_FLAG_CACHED,
0, &cur_type->buf);
- if (ret)
+ if (ret) {
+ fprintf(stderr, "Failed to create relocation BO: %s\n",
+ strerror(-ret));
return ret;
-
- ret = drmBOMap(fd, &cur_type->buf, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, (void **)&cur_type->relocs);
- if (ret)
+ }
+
+ ret = drmBOMap(bufmgr_ttm->fd, &cur_type->buf,
+ DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE,
+ 0, (void **)&cur_type->relocs);
+ if (ret) {
+ fprintf(stderr, "Failed to map relocation BO: %s\n", strerror(-ret));
return ret;
+ }
return 0;
}
-
-static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info, uint32_t max_relocs)
+/**
+ * Adds the relocation @reloc_info to the relocation list.
+ */
+static int
+intel_add_validate_reloc(dri_bufmgr_ttm *bufmgr_ttm,
+ struct intel_reloc_info *reloc_info)
{
+ struct intel_bo_list *reloc_list = &bufmgr_ttm->reloc_list;
struct intel_bo_reloc_node *rl_node, *cur;
drmMMListHead *rl, *l;
int ret = 0;
@@ -346,7 +398,7 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st
cur_type = &cur->type_list;
DRMINITLISTHEAD(&cur->type_list.head);
- ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs);
+ ret = intel_create_new_reloc_type_list(bufmgr_ttm, cur_type);
if (ret) {
return -1;
}
@@ -361,22 +413,24 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st
cur_type = &cur->type_list;
found = 1;
} else {
- for (l = cur->type_list.head.next; l != &cur->type_list.head; l = l->next) {
+ for (l = cur->type_list.head.next; l != &cur->type_list.head;
+ l = l->next)
+ {
cur_type = DRMLISTENTRY(struct intel_bo_reloc_list, l, head);
if (((cur_type->relocs[0] >> 16) & 0xffff) == reloc_info->type)
found = 1;
break;
}
}
-
+
/* didn't find the relocation type */
if (!found) {
cur_type = malloc(sizeof(*cur_type));
if (!cur_type) {
return -ENOMEM;
}
-
- ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs);
+
+ ret = intel_create_new_reloc_type_list(bufmgr_ttm, cur_type);
DRMLISTADDTAIL(&cur_type->head, &cur->type_list.head);
cur_type->relocs[0] = (reloc_info->type << 16);
@@ -390,11 +444,14 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st
num_relocs = (reloc_start[0] & 0xffff);
- reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER] = reloc_info->reloc;
- reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER+1] = reloc_info->delta;
- reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER+2] = reloc_info->index;
+ reloc_start[num_relocs * I915_RELOC0_STRIDE + I915_RELOC_HEADER] =
+ reloc_info->reloc;
+ reloc_start[num_relocs * I915_RELOC0_STRIDE + I915_RELOC_HEADER + 1] =
+ reloc_info->delta;
+ reloc_start[num_relocs * I915_RELOC0_STRIDE + I915_RELOC_HEADER + 2] =
+ reloc_info->index;
reloc_start[0]++;
- if (((reloc_start[0] & 0xffff)) > (max_relocs)) {
+ if (((reloc_start[0] & 0xffff)) > (bufmgr_ttm->max_relocs)) {
return -ENOMEM;
}
return 0;
@@ -405,64 +462,64 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st
int
driFenceSignaled(DriFenceObject * fence, unsigned type)
{
- int signaled;
- int ret;
+ int signaled;
+ int ret;
- if (fence == NULL)
- return GL_TRUE;
+ if (fence == NULL)
+ return GL_TRUE;
- _glthread_LOCK_MUTEX(fence->mutex);
- ret = drmFenceSignaled(bufmgr_ttm->fd, &fence->fence, type, &signaled);
- _glthread_UNLOCK_MUTEX(fence->mutex);
- BM_CKFATAL(ret);
- return signaled;
+ _glthread_LOCK_MUTEX(fence->mutex);
+ ret = drmFenceSignaled(bufmgr_ttm->fd, &fence->fence, type, &signaled);
+ _glthread_UNLOCK_MUTEX(fence->mutex);
+ BM_CKFATAL(ret);
+ return signaled;
}
#endif
static dri_bo *
dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
unsigned long size, unsigned int alignment,
- unsigned int location_mask)
-{
- dri_bufmgr_ttm *ttm_bufmgr;
- dri_bo_ttm *ttm_buf;
- unsigned int pageSize = getpagesize();
- int ret;
- unsigned int flags, hint;
-
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
-
- ttm_buf = malloc(sizeof(*ttm_buf));
- if (!ttm_buf)
- return NULL;
-
- /* The mask argument doesn't do anything for us that we want other than
- * determine which pool (TTM or local) the buffer is allocated into, so just
- * pass all of the allocation class flags.
- */
- flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE |
- DRM_BO_FLAG_EXE;
- /* No hints we want to use. */
- hint = 0;
-
- ret = drmBOCreate(ttm_bufmgr->fd, size, alignment / pageSize,
- NULL, flags, hint, &ttm_buf->drm_bo);
- if (ret != 0) {
- free(ttm_buf);
- return NULL;
- }
- ttm_buf->bo.size = ttm_buf->drm_bo.size;
- ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
- ttm_buf->bo.virtual = NULL;
- ttm_buf->bo.bufmgr = bufmgr;
- ttm_buf->name = name;
- ttm_buf->refcount = 1;
+ uint64_t location_mask)
+{
+ dri_bufmgr_ttm *ttm_bufmgr;
+ dri_bo_ttm *ttm_buf;
+ unsigned int pageSize = getpagesize();
+ int ret;
+ unsigned int flags, hint;
+
+ ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+
+ ttm_buf = malloc(sizeof(*ttm_buf));
+ if (!ttm_buf)
+ return NULL;
+
+ /* The mask argument doesn't do anything for us that we want other than
+ * determine which pool (TTM or local) the buffer is allocated into, so
+ * just pass all of the allocation class flags.
+ */
+ flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE |
+ DRM_BO_FLAG_EXE;
+ /* No hints we want to use. */
+ hint = 0;
+
+ ret = drmBOCreate(ttm_bufmgr->fd, size, alignment / pageSize,
+ NULL, flags, hint, &ttm_buf->drm_bo);
+ if (ret != 0) {
+ free(ttm_buf);
+ return NULL;
+ }
+ ttm_buf->bo.size = ttm_buf->drm_bo.size;
+ ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
+ ttm_buf->bo.virtual = NULL;
+ ttm_buf->bo.bufmgr = bufmgr;
+ ttm_buf->name = name;
+ ttm_buf->refcount = 1;
#if BUFMGR_DEBUG
- fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
+ fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
#endif
- return &ttm_buf->bo;
+ return &ttm_buf->bo;
}
/* Our TTM backend doesn't allow creation of static buffers, as that requires
@@ -472,12 +529,13 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name,
static dri_bo *
dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name,
unsigned long offset, unsigned long size, void *virtual,
- unsigned int location_mask)
+ uint64_t location_mask)
{
- return NULL;
+ return NULL;
}
-/** Returns a dri_bo wrapping the given buffer object handle.
+/**
+ * Returns a dri_bo wrapping the given buffer object handle.
*
* This can be used when one application needs to pass a buffer object
* to another.
@@ -486,121 +544,122 @@ dri_bo *
intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name,
unsigned int handle)
{
- dri_bufmgr_ttm *ttm_bufmgr;
- dri_bo_ttm *ttm_buf;
- int ret;
+ dri_bufmgr_ttm *ttm_bufmgr;
+ dri_bo_ttm *ttm_buf;
+ int ret;
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+ ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
- ttm_buf = malloc(sizeof(*ttm_buf));
- if (!ttm_buf)
- return NULL;
+ ttm_buf = malloc(sizeof(*ttm_buf));
+ if (!ttm_buf)
+ return NULL;
- ret = drmBOReference(ttm_bufmgr->fd, handle, &ttm_buf->drm_bo);
- if (ret != 0) {
- free(ttm_buf);
- return NULL;
- }
- ttm_buf->bo.size = ttm_buf->drm_bo.size;
- ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
- ttm_buf->bo.virtual = NULL;
- ttm_buf->bo.bufmgr = bufmgr;
- ttm_buf->name = name;
- ttm_buf->refcount = 1;
+ ret = drmBOReference(ttm_bufmgr->fd, handle, &ttm_buf->drm_bo);
+ if (ret != 0) {
+ free(ttm_buf);
+ return NULL;
+ }
+ ttm_buf->bo.size = ttm_buf->drm_bo.size;
+ ttm_buf->bo.offset = ttm_buf->drm_bo.offset;
+ ttm_buf->bo.virtual = NULL;
+ ttm_buf->bo.bufmgr = bufmgr;
+ ttm_buf->name = name;
+ ttm_buf->refcount = 1;
#if BUFMGR_DEBUG
- fprintf(stderr, "bo_create_from_handle: %p %08x (%s)\n", &ttm_buf->bo, handle,
- ttm_buf->name);
+ fprintf(stderr, "bo_create_from_handle: %p %08x (%s)\n",
+ &ttm_buf->bo, handle, ttm_buf->name);
#endif
- return &ttm_buf->bo;
+ return &ttm_buf->bo;
}
static void
dri_ttm_bo_reference(dri_bo *buf)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
- _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
- ttm_buf->refcount++;
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
+ ttm_buf->refcount++;
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
}
static void
dri_ttm_bo_unreference(dri_bo *buf)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
- if (!buf)
- return;
+ if (!buf)
+ return;
- _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
- if (--ttm_buf->refcount == 0) {
- int ret;
+ _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
+ if (--ttm_buf->refcount == 0) {
+ int ret;
- ret = drmBOUnreference(bufmgr_ttm->fd, &ttm_buf->drm_bo);
- if (ret != 0) {
- fprintf(stderr, "drmBOUnreference failed (%s): %s\n", ttm_buf->name,
- strerror(-ret));
- }
+ ret = drmBOUnreference(bufmgr_ttm->fd, &ttm_buf->drm_bo);
+ if (ret != 0) {
+ fprintf(stderr, "drmBOUnreference failed (%s): %s\n",
+ ttm_buf->name, strerror(-ret));
+ }
#if BUFMGR_DEBUG
- fprintf(stderr, "bo_unreference final: %p (%s)\n",
- &ttm_buf->bo, ttm_buf->name);
+ fprintf(stderr, "bo_unreference final: %p (%s)\n",
+ &ttm_buf->bo, ttm_buf->name);
#endif
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
- free(buf);
- return;
- }
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ free(buf);
+ return;
+ }
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
}
static int
dri_ttm_bo_map(dri_bo *buf, GLboolean write_enable)
{
- dri_bufmgr_ttm *bufmgr_ttm;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
- unsigned int flags;
+ dri_bufmgr_ttm *bufmgr_ttm;
+ dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ unsigned int flags;
- bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
- flags = DRM_BO_FLAG_READ;
- if (write_enable)
- flags |= DRM_BO_FLAG_WRITE;
+ flags = DRM_BO_FLAG_READ;
+ if (write_enable)
+ flags |= DRM_BO_FLAG_WRITE;
- assert(buf->virtual == NULL);
+ assert(buf->virtual == NULL);
#if BUFMGR_DEBUG
- fprintf(stderr, "bo_map: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
+ fprintf(stderr, "bo_map: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
#endif
- return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual);
+ return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual);
}
static int
dri_ttm_bo_unmap(dri_bo *buf)
{
- dri_bufmgr_ttm *bufmgr_ttm;
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
+ dri_bufmgr_ttm *bufmgr_ttm;
+ dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf;
- if (buf == NULL)
- return 0;
+ if (buf == NULL)
+ return 0;
- bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
+ bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr;
- assert(buf->virtual != NULL);
+ assert(buf->virtual != NULL);
- buf->virtual = NULL;
+ buf->virtual = NULL;
#if BUFMGR_DEBUG
- fprintf(stderr, "bo_unmap: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
+ fprintf(stderr, "bo_unmap: %p (%s)\n", &ttm_buf->bo, ttm_buf->name);
#endif
- return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo);
+ return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo);
}
-/* Returns a dri_bo wrapping the given buffer object handle.
+/**
+ * Returns a dri_bo wrapping the given buffer object handle.
*
* This can be used when one application needs to pass a buffer object
* to another.
@@ -609,183 +668,185 @@ dri_fence *
intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name,
drm_fence_arg_t *arg)
{
- dri_bufmgr_ttm *ttm_bufmgr;
- dri_fence_ttm *ttm_fence;
+ dri_bufmgr_ttm *ttm_bufmgr;
+ dri_fence_ttm *ttm_fence;
- ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
+ ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr;
- ttm_fence = malloc(sizeof(*ttm_fence));
- if (!ttm_fence)
- return NULL;
+ ttm_fence = malloc(sizeof(*ttm_fence));
+ if (!ttm_fence)
+ return NULL;
- ttm_fence->drm_fence.handle = arg->handle;
- ttm_fence->drm_fence.fence_class = arg->fence_class;
- ttm_fence->drm_fence.type = arg->type;
- ttm_fence->drm_fence.flags = arg->flags;
- ttm_fence->drm_fence.signaled = 0;
- ttm_fence->drm_fence.sequence = arg->sequence;
+ ttm_fence->drm_fence.handle = arg->handle;
+ ttm_fence->drm_fence.fence_class = arg->fence_class;
+ ttm_fence->drm_fence.type = arg->type;
+ ttm_fence->drm_fence.flags = arg->flags;
+ ttm_fence->drm_fence.signaled = 0;
+ ttm_fence->drm_fence.sequence = arg->sequence;
- ttm_fence->fence.bufmgr = bufmgr;
- ttm_fence->name = name;
- ttm_fence->refcount = 1;
+ ttm_fence->fence.bufmgr = bufmgr;
+ ttm_fence->name = name;
+ ttm_fence->refcount = 1;
#if BUFMGR_DEBUG
- fprintf(stderr, "fence_create_from_handle: %p (%s)\n", &ttm_fence->fence,
- ttm_fence->name);
+ fprintf(stderr, "fence_create_from_handle: %p (%s)\n", &ttm_fence->fence,
+ ttm_fence->name);
#endif
- return &ttm_fence->fence;
+ return &ttm_fence->fence;
}
static void
dri_ttm_fence_reference(dri_fence *fence)
{
- dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
+ dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
- _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
- ++fence_ttm->refcount;
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
+ ++fence_ttm->refcount;
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
#if BUFMGR_DEBUG
- fprintf(stderr, "fence_reference: %p (%s)\n", &fence_ttm->fence,
- fence_ttm->name);
+ fprintf(stderr, "fence_reference: %p (%s)\n", &fence_ttm->fence,
+ fence_ttm->name);
#endif
}
static void
dri_ttm_fence_unreference(dri_fence *fence)
{
- dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
+ dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
- if (!fence)
- return;
+ if (!fence)
+ return;
#if BUFMGR_DEBUG
- fprintf(stderr, "fence_unreference: %p (%s)\n", &fence_ttm->fence,
- fence_ttm->name);
+ fprintf(stderr, "fence_unreference: %p (%s)\n", &fence_ttm->fence,
+ fence_ttm->name);
#endif
- _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
- if (--fence_ttm->refcount == 0) {
- int ret;
-
- ret = drmFenceUnreference(bufmgr_ttm->fd, &fence_ttm->drm_fence);
- if (ret != 0) {
- fprintf(stderr, "drmFenceUnreference failed (%s): %s\n",
- fence_ttm->name, strerror(-ret));
- }
-
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
- free(fence);
- return;
- }
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
+ if (--fence_ttm->refcount == 0) {
+ int ret;
+
+ ret = drmFenceUnreference(bufmgr_ttm->fd, &fence_ttm->drm_fence);
+ if (ret != 0) {
+ fprintf(stderr, "drmFenceUnreference failed (%s): %s\n",
+ fence_ttm->name, strerror(-ret));
+ }
+
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ free(fence);
+ return;
+ }
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
}
static void
dri_ttm_fence_wait(dri_fence *fence)
{
- dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
- int ret;
+ dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr;
+ int ret;
- _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
- ret = drmFenceWait(bufmgr_ttm->fd, 0, &fence_ttm->drm_fence, 0);
- _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
- if (ret != 0) {
- _mesa_printf("%s:%d: Error %d waiting for fence %s.\n",
- __FILE__, __LINE__, ret, fence_ttm->name);
- abort();
- }
+ _glthread_LOCK_MUTEX(bufmgr_ttm->mutex);
+ ret = drmFenceWait(bufmgr_ttm->fd, 0, &fence_ttm->drm_fence, 0);
+ _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex);
+ if (ret != 0) {
+ _mesa_printf("%s:%d: Error %d waiting for fence %s.\n",
+ __FILE__, __LINE__, ret, fence_ttm->name);
+ abort();
+ }
#if BUFMGR_DEBUG
- fprintf(stderr, "fence_wait: %p (%s)\n", &fence_ttm->fence,
- fence_ttm->name);
+ fprintf(stderr, "fence_wait: %p (%s)\n", &fence_ttm->fence,
+ fence_ttm->name);
#endif
}
static void
dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr;
- intel_bo_free_list(&bufmgr_ttm->list);
- intel_bo_free_list(&bufmgr_ttm->reloc_list);
+ intel_bo_free_list(&bufmgr_ttm->list);
+ intel_bo_free_list(&bufmgr_ttm->reloc_list);
- _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex);
- free(bufmgr);
+ _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex);
+ free(bufmgr);
}
-static void intel_dribo_destroy_callback(void *priv)
+static void
+intel_dribo_destroy_callback(void *priv)
{
- dri_bo *dribo = priv;
-
- if (dribo) {
- dri_bo_unreference(dribo);
- }
+ dri_bo *dribo = priv;
+
+ if (dribo)
+ dri_bo_unreference(dribo);
}
static void
-dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset,
- dri_bo *relocatee)
-{
- dri_bo_ttm *ttm_buf = (dri_bo_ttm *)batch_buf;
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
- int newItem;
- struct intel_reloc_info reloc;
- int mask;
- int ret;
-
- mask = DRM_BO_MASK_MEM;
- mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE);
-
- ret = intel_add_validate_buffer(&bufmgr_ttm->list, relocatee, flags, mask, &newItem, intel_dribo_destroy_callback);
- if (ret < 0)
- return;
-
- if (ret == 1) {
- dri_bo_reference(relocatee);
- }
-
- reloc.type = I915_RELOC_TYPE_0;
- reloc.reloc = offset;
- reloc.delta = delta;
- reloc.index = newItem;
- reloc.handle = ttm_buf->drm_bo.handle;
-
- intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc, bufmgr_ttm->max_relocs);
- return;
+dri_ttm_emit_reloc(dri_bo *reloc_buf, uint64_t flags, GLuint delta,
+ GLuint offset, dri_bo *target_buf)
+{
+ dri_bo_ttm *ttm_buf = (dri_bo_ttm *)reloc_buf;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)reloc_buf->bufmgr;
+ int newItem;
+ struct intel_reloc_info reloc;
+ int mask;
+ int ret;
+
+ mask = DRM_BO_MASK_MEM;
+ mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE);
+
+ ret = intel_add_validate_buffer(bufmgr_ttm, target_buf, flags, mask,
+ &newItem, intel_dribo_destroy_callback);
+ if (ret < 0)
+ return;
+
+ if (ret == 1)
+ dri_bo_reference(target_buf);
+
+ reloc.type = I915_RELOC_TYPE_0;
+ reloc.reloc = offset;
+ reloc.delta = delta;
+ reloc.index = newItem;
+ reloc.handle = ttm_buf->drm_bo.handle;
+
+ intel_add_validate_reloc(bufmgr_ttm, &reloc);
}
static void *
dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *count)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
- void *ptr;
- int itemLoc;
-
- dri_bo_unmap(batch_buf);
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
+ void *ptr;
+ int itemLoc;
- intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE,
- DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE, &itemLoc, NULL);
+ /* Add the batch buffer to the validation list. There are no relocations
+ * pointing to it.
+ */
+ intel_add_validate_buffer(bufmgr_ttm, batch_buf,
+ DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE,
+ DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE,
+ &itemLoc, NULL);
- ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list, &bufmgr_ttm->reloc_list, count);
+ ptr = intel_setup_validate_list(bufmgr_ttm, count);
- return ptr;
+ return ptr;
}
static void
dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence)
{
- dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
+ dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr;
- intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list);
- intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list);
+ intel_free_validate_list(bufmgr_ttm);
+ intel_free_reloc_list(bufmgr_ttm);
- intel_bo_free_list(&bufmgr_ttm->list);
+ intel_bo_free_list(&bufmgr_ttm->list);
}
/**
@@ -801,33 +862,34 @@ dri_bufmgr *
intel_bufmgr_ttm_init(int fd, unsigned int fence_type,
unsigned int fence_type_flush, int batch_size)
{
- dri_bufmgr_ttm *bufmgr_ttm;
-
- bufmgr_ttm = malloc(sizeof(*bufmgr_ttm));
- bufmgr_ttm->fd = fd;
- bufmgr_ttm->fence_type = fence_type;
- bufmgr_ttm->fence_type_flush = fence_type_flush;
- _glthread_INIT_MUTEX(bufmgr_ttm->mutex);
-
- /* lets go with one relocation per every four dwords - purely heuristic */
- bufmgr_ttm->max_relocs = batch_size / sizeof(uint32_t) / 4;
-
- intel_create_bo_list(10, &bufmgr_ttm->list, NULL);
- intel_create_bo_list(1, &bufmgr_ttm->reloc_list, NULL);
-
- bufmgr_ttm->bufmgr.bo_alloc = dri_ttm_alloc;
- bufmgr_ttm->bufmgr.bo_alloc_static = dri_ttm_alloc_static;
- bufmgr_ttm->bufmgr.bo_reference = dri_ttm_bo_reference;
- bufmgr_ttm->bufmgr.bo_unreference = dri_ttm_bo_unreference;
- bufmgr_ttm->bufmgr.bo_map = dri_ttm_bo_map;
- bufmgr_ttm->bufmgr.bo_unmap = dri_ttm_bo_unmap;
- bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference;
- bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference;
- bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait;
- bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy;
- bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc;
- bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc;
- bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit;
- return &bufmgr_ttm->bufmgr;
+ dri_bufmgr_ttm *bufmgr_ttm;
+
+ bufmgr_ttm = malloc(sizeof(*bufmgr_ttm));
+ bufmgr_ttm->fd = fd;
+ bufmgr_ttm->fence_type = fence_type;
+ bufmgr_ttm->fence_type_flush = fence_type_flush;
+ _glthread_INIT_MUTEX(bufmgr_ttm->mutex);
+
+ /* lets go with one relocation per every four dwords - purely heuristic */
+ bufmgr_ttm->max_relocs = batch_size / sizeof(uint32_t) / 4;
+
+ intel_create_bo_list(10, &bufmgr_ttm->list, NULL);
+ intel_create_bo_list(1, &bufmgr_ttm->reloc_list, NULL);
+
+ bufmgr_ttm->bufmgr.bo_alloc = dri_ttm_alloc;
+ bufmgr_ttm->bufmgr.bo_alloc_static = dri_ttm_alloc_static;
+ bufmgr_ttm->bufmgr.bo_reference = dri_ttm_bo_reference;
+ bufmgr_ttm->bufmgr.bo_unreference = dri_ttm_bo_unreference;
+ bufmgr_ttm->bufmgr.bo_map = dri_ttm_bo_map;
+ bufmgr_ttm->bufmgr.bo_unmap = dri_ttm_bo_unmap;
+ bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference;
+ bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference;
+ bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait;
+ bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy;
+ bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc;
+ bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc;
+ bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit;
+
+ return &bufmgr_ttm->bufmgr;
}
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index 755035b07a..94701ef1ca 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -71,7 +71,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define _INVALID(f) \
[ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 }
#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \
- && (tx_table_le[f].format != 0xffffffff) )
+ && (tx_table_be[f].format != 0xffffffff) )
struct tx_table {
GLuint format, filter;
@@ -164,12 +164,15 @@ static void r200SetTexImages( r200ContextPtr rmesa,
*/
if ( !t->image_override ) {
if ( VALID_FORMAT( baseImage->TexFormat->MesaFormat ) ) {
+ const struct tx_table *table = _mesa_little_endian() ? tx_table_le :
+ tx_table_be;
+
t->pp_txformat &= ~(R200_TXFORMAT_FORMAT_MASK |
R200_TXFORMAT_ALPHA_IN_MAP);
t->pp_txfilter &= ~R200_YUV_TO_RGB;
- t->pp_txformat |= tx_table_le[ baseImage->TexFormat->MesaFormat ].format;
- t->pp_txfilter |= tx_table_le[ baseImage->TexFormat->MesaFormat ].filter;
+ t->pp_txformat |= table[ baseImage->TexFormat->MesaFormat ].format;
+ t->pp_txfilter |= table[ baseImage->TexFormat->MesaFormat ].filter;
}
else {
_mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
diff --git a/src/mesa/drivers/osmesa/descrip.mms b/src/mesa/drivers/osmesa/descrip.mms
index 4035b24e4e..6c2f3226f6 100644
--- a/src/mesa/drivers/osmesa/descrip.mms
+++ b/src/mesa/drivers/osmesa/descrip.mms
@@ -1,15 +1,19 @@
# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 3 October 2007
.first
define gl [----.include.gl]
define math [--.math]
define tnl [--.tnl]
+ define vbo [--.vbo]
define swrast [--.swrast]
define swrast_setup [--.swrast_setup]
define array_cache [--.array_cache]
define drivers [-]
+ define glapi [--.glapi]
+ define main [--.main]
+ define shader [--.shader]
.include [----]mms-config.
@@ -17,7 +21,7 @@
VPATH = RCS
-INCDIR = [----.include],[--.main],[--.glapi]
+INCDIR = [----.include],[--.main],[--.glapi],[--.shader]
LIBDIR = [----.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
diff --git a/src/mesa/drivers/windows/gdi/wgl.c b/src/mesa/drivers/windows/gdi/wgl.c
index 17eed1dc32..f7028d01a3 100644
--- a/src/mesa/drivers/windows/gdi/wgl.c
+++ b/src/mesa/drivers/windows/gdi/wgl.c
@@ -55,7 +55,7 @@
#include <windows.h>
#endif
-
+#include "config.h"
#include "glapi.h"
#include "GL/wmesa.h" /* protos for wmesa* functions */
@@ -70,10 +70,12 @@ struct __pixelformat__
GLboolean doubleBuffered;
};
+
+
/* These are the PFD's supported by this driver. */
struct __pixelformat__ pfd[] =
{
-#if 0
+#if 0
/* Double Buffer, alpha */
{
{
@@ -87,7 +89,7 @@ struct __pixelformat__ pfd[] =
8, 16,
8, 24,
0, 0, 0, 0, 0,
- 16, 8,
+ DEFAULT_SOFTWARE_DEPTH_BITS, 8,
0, 0, 0,
0, 0, 0
},
@@ -106,13 +108,13 @@ struct __pixelformat__ pfd[] =
8, 16,
8, 24,
0, 0, 0, 0, 0,
- 16, 8,
+ DEFAULT_SOFTWARE_DEPTH_BITS, 8,
0, 0, 0,
0, 0, 0
},
GL_FALSE
},
-#endif
+#endif
/* Double Buffer, no alpha */
{
{
@@ -126,7 +128,7 @@ struct __pixelformat__ pfd[] =
8, 16,
0, 0,
0, 0, 0, 0, 0,
- 16, 8,
+ DEFAULT_SOFTWARE_DEPTH_BITS, 8,
0, 0, 0,
0, 0, 0
},
@@ -145,7 +147,7 @@ struct __pixelformat__ pfd[] =
8, 16,
0, 0,
0, 0, 0, 0, 0,
- 16, 8,
+ DEFAULT_SOFTWARE_DEPTH_BITS, 8,
0, 0, 0,
0, 0, 0
},
@@ -601,8 +603,8 @@ WINGDIAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC hdc,
WINGDIAPI BOOL GLAPIENTRY wglShareLists(HGLRC hglrc1,
HGLRC hglrc2)
{
- WMesaShareLists(hglrc1, hglrc2);
- return(TRUE);
+ WMesaShareLists(hglrc1, hglrc2);
+ return(TRUE);
}
diff --git a/src/mesa/drivers/x11/descrip.mms b/src/mesa/drivers/x11/descrip.mms
index 6c6184b2c3..648f683dfa 100644
--- a/src/mesa/drivers/x11/descrip.mms
+++ b/src/mesa/drivers/x11/descrip.mms
@@ -1,15 +1,19 @@
# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 3 October 2007
.first
define gl [----.include.gl]
define math [--.math]
define tnl [--.tnl]
+ define vbo [--.vbo]
define swrast [--.swrast]
define swrast_setup [--.swrast_setup]
define array_cache [--.array_cache]
define drivers [-]
+ define glapi [--.glapi]
+ define main [--.main]
+ define shader [--.shader]
.include [----]mms-config.
@@ -17,7 +21,7 @@
VPATH = RCS
-INCDIR = [----.include],[--.main],[--.glapi]
+INCDIR = [----.include],[--.main],[--.glapi],[--.shader]
LIBDIR = [----.lib]
CFLAGS =/include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 8eb02beb4c..ab0f035b45 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -213,7 +213,7 @@
/** For GL_ARB_vertex_shader */
/*@{*/
#define MAX_VERTEX_ATTRIBS 16
-#define MAX_VERTEX_TEXTURE_IMAGE_UNITS 0
+#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_UNITS
#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS)
/*@}*/
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 08db12b1b6..2ae0e1221d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -992,7 +992,6 @@ init_attrib_groups(GLcontext *ctx)
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
- ctx->_Facing = 0;
return GL_TRUE;
}
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index caa50dd682..77d27bb03d 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -493,6 +493,11 @@ struct dd_function_table {
*/
void (*FreeTexImageData)( GLcontext *ctx, struct gl_texture_image *tImage );
+ /** Map texture image data into user space */
+ void (*MapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+ /** Unmap texture images from user space */
+ void (*UnmapTexture)( GLcontext *ctx, struct gl_texture_object *tObj );
+
/**
* Note: no context argument. This function doesn't initially look
* like it belongs here, except that the driver is the only entity
diff --git a/src/mesa/main/descrip.mms b/src/mesa/main/descrip.mms
index d09c57b321..3ef215f47f 100644
--- a/src/mesa/main/descrip.mms
+++ b/src/mesa/main/descrip.mms
@@ -1,11 +1,13 @@
# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 10 May 2005
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 2 October 2007
.first
define gl [---.include.gl]
define math [-.math]
define shader [-.shader]
+ define glapi [-.glapi]
+ define main [-.main]
.include [---]mms-config.
@@ -58,13 +60,13 @@ SOURCES =accum.c \
matrix.c \
mipmap.c \
mm.c \
- occlude.c \
pixel.c \
points.c \
polygon.c \
rastpos.c \
rbadaptors.c \
renderbuffer.c \
+ shaders.c \
state.c \
stencil.c \
texcompress.c \
@@ -78,7 +80,9 @@ SOURCES =accum.c \
texstate.c \
texstore.c \
varray.c \
- vtxfmt.c
+ vtxfmt.c \
+ queryobj.c \
+ rbadaptors.c
OBJECTS=accum.obj,\
api_arrayelt.obj,\
@@ -121,12 +125,12 @@ lines.obj,\
matrix.obj,\
mipmap.obj,\
mm.obj,\
-occlude.obj,\
pixel.obj,\
points.obj,\
polygon.obj,\
rastpos.obj,\
renderbuffer.obj,\
+shaders.obj,\
state.obj,\
stencil.obj,\
texcompress.obj,\
@@ -140,7 +144,9 @@ texrender.obj,\
texstate.obj,\
texstore.obj,\
varray.obj,\
-vtxfmt.obj
+vtxfmt.obj,\
+queryobj.obj,\
+rbadaptors.obj
##### RULES #####
@@ -149,8 +155,7 @@ VERSION=Mesa V3.4
##### TARGETS #####
# Make the library
$(LIBDIR)$(GL_LIB) : $(OBJECTS)
- @ $(MAKELIB) $(GL_LIB) $(OBJECTS)
- @ rename $(GL_LIB)* $(LIBDIR)
+ @ $(MAKELIB) $(LIBDIR)$(GL_LIB) $(OBJECTS)
clean :
purge
@@ -197,7 +202,6 @@ lines.obj : lines.c
matrix.obj : matrix.c
mipmap.obj : mipmap.c
mm.obj : mm.c
-occlude.obj : occlude.c
pixel.obj : pixel.c
points.obj : points.c
polygon.obj : polygon.c
@@ -219,3 +223,6 @@ texstate.obj : texstate.c
texstore.obj : texstore.c
varray.obj : varray.c
vtxfmt.obj : vtxfmt.c
+shaders.obj : shaders.c
+queryobj.obj : queryobj.c
+rbadaptors.obj : rbadaptors.c
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index ba4972b167..9fe979a6b2 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.1
+ * Version: 7.0.3
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul 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"),
@@ -364,12 +364,12 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
case GL_LIGHTING:
if (ctx->Light.Enabled == state)
return;
+ FLUSH_VERTICES(ctx, _NEW_LIGHT);
+ ctx->Light.Enabled = state;
if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
else
ctx->_TriangleCaps &= ~DD_TRI_LIGHT_TWOSIDE;
- FLUSH_VERTICES(ctx, _NEW_LIGHT);
- ctx->Light.Enabled = state;
break;
case GL_LINE_SMOOTH:
if (ctx->Line.SmoothFlag == state)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1fbfeb7447..94b7094388 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3059,12 +3059,6 @@ struct __GLcontextRec
struct gl_list_extensions ListExt; /**< driver dlist extensions */
-
- GLuint _Facing; /**< This is a hack for 2-sided stencil test.
- *
- * We don't have a better way to communicate this value from
- * swrast_setup to swrast. */
-
/** \name For debugging/development only */
/*@{*/
GLboolean FirstTimeCurrent;
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 3b5151ed17..a8e639be6d 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1443,7 +1443,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
(baseInternalFormat == GL_RGBA ||
baseInternalFormat == GL_RGB) &&
srcType == GL_UNSIGNED_BYTE) {
-
int img, row, col;
for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
@@ -1455,11 +1454,12 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
+ dstYoffset * dstRowStride
+ dstXoffset * dstFormat->TexelBytes;
for (row = 0; row < srcHeight; row++) {
+ GLuint *d4 = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- dstRow[col * 4 + 0] = srcRow[col * 3 + BCOMP];
- dstRow[col * 4 + 1] = srcRow[col * 3 + GCOMP];
- dstRow[col * 4 + 2] = srcRow[col * 3 + RCOMP];
- dstRow[col * 4 + 3] = 0xff;
+ d4[col] = ((0xff << 24) |
+ (srcRow[col * 3 + RCOMP] << 16) |
+ (srcRow[col * 3 + GCOMP] << 8) |
+ (srcRow[col * 3 + BCOMP] << 0));
}
dstRow += dstRowStride;
srcRow += srcRowStride;
@@ -1471,7 +1471,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
dstFormat == &_mesa_texformat_argb8888 &&
srcFormat == GL_RGBA &&
baseInternalFormat == GL_RGBA &&
- (srcType == GL_UNSIGNED_BYTE && littleEndian)) {
+ srcType == GL_UNSIGNED_BYTE &&
+ littleEndian) {
+ /* same as above case, but src data has alpha too */
GLint img, row, col;
/* For some reason, streaming copies to write-combined regions
* are extremely sensitive to the characteristics of how the
@@ -1488,13 +1490,13 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
+ dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+ dstYoffset * dstRowStride
+ dstXoffset * dstFormat->TexelBytes;
-
for (row = 0; row < srcHeight; row++) {
+ GLuint *d4 = (GLuint *) dstRow;
for (col = 0; col < srcWidth; col++) {
- *(GLuint *)(dstRow + col * 4) = (srcRow[col * 4 + RCOMP] << 16 |
- srcRow[col * 4 + GCOMP] << 8 |
- srcRow[col * 4 + BCOMP] << 0 |
- srcRow[col * 4 + ACOMP] << 24);
+ d4[col] = ((srcRow[col * 4 + ACOMP] << 24) |
+ (srcRow[col * 4 + RCOMP] << 16) |
+ (srcRow[col * 4 + GCOMP] << 8) |
+ (srcRow[col * 4 + BCOMP] << 0));
}
dstRow += dstRowStride;
srcRow += srcRowStride;
diff --git a/src/mesa/math/descrip.mms b/src/mesa/math/descrip.mms
index a3f20c2f25..3aaa6eb8b4 100644
--- a/src/mesa/math/descrip.mms
+++ b/src/mesa/math/descrip.mms
@@ -1,10 +1,12 @@
# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 3 October 2007
.first
define gl [---.include.gl]
define math [-.math]
+ define glapi [-.glapi]
+ define main [-.main]
.include [---]mms-config.
diff --git a/src/mesa/shader/descrip.mms b/src/mesa/shader/descrip.mms
index d70cec3830..157c193c79 100644
--- a/src/mesa/shader/descrip.mms
+++ b/src/mesa/shader/descrip.mms
@@ -1,11 +1,14 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 20 November 2006
+# Last revision : 3 October 2007
.first
define gl [---.include.gl]
define math [-.math]
define swrast [-.swrast]
define array_cache [-.array_cache]
+ define glapi [-.glapi]
+ define main [-.main]
+ define shader [-.shader]
.include [---]mms-config.
@@ -23,11 +26,16 @@ SOURCES = \
arbprogram.c \
nvfragparse.c \
nvprogram.c \
- nvvertexec.c \
nvvertparse.c \
program.c \
- shaderobjects.c \
- shaderobjects_3dlabs.c
+ programopt.c \
+ prog_debug.c \
+ prog_execute.c \
+ prog_instruction.c \
+ prog_parameter.c \
+ prog_print.c \
+ prog_statevars.c \
+ shader_api.c
OBJECTS = \
atifragshader.obj,\
@@ -35,12 +43,16 @@ OBJECTS = \
arbprogram.obj,\
nvfragparse.obj,\
nvprogram.obj,\
- nvvertexec.obj,\
nvvertparse.obj,\
program.obj,\
- shaderobjects.obj,\
- shaderobjects_3dlabs.obj
-
+ programopt.obj,\
+ prog_debug.obj,\
+ prog_execute.obj,\
+ prog_instruction.obj,\
+ prog_parameter.obj,\
+ prog_print.obj,\
+ prog_statevars.obj,\
+ shader_api.obj
##### RULES #####
@@ -68,9 +80,13 @@ arbprogparse.obj : arbprogparse.c
arbprogram.obj : arbprogram.c
nvfragparse.obj : nvfragparse.c
nvprogram.obj : nvprogram.c
-nvvertexec.obj : nvvertexec.c
nvvertparse.obj : nvvertparse.c
program.obj : program.c
-shaderobjects.obj : shaderobjects.c
- cc$(CFLAGS)/nowarn shaderobjects.c
-shaderobjects_3dlabs.obj : shaderobjects_3dlabs.c
+programopt. obj : programopt.c
+prog_debug.obj : prog_debug.c
+prog_execute.obj : prog_execute.c
+prog_instruction.obj : prog_instruction.c
+prog_parameter.obj : prog_parameter.c
+prog_print.obj : prog_print.c
+prog_statevars.obj : prog_statevars.c
+shader_api.obj : shader_api.c
diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c
index 57a9d2dae9..c5dda01861 100644
--- a/src/mesa/shader/prog_statevars.c
+++ b/src/mesa/shader/prog_statevars.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.0
+ * Version: 7.1
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@@ -824,3 +824,94 @@ _mesa_load_state_parameters(GLcontext *ctx,
}
}
+
+/**
+ * Copy the 16 elements of a matrix into four consecutive program
+ * registers starting at 'pos'.
+ */
+static void
+load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
+{
+ GLuint i;
+ for (i = 0; i < 4; i++) {
+ registers[pos + i][0] = mat[0 + i];
+ registers[pos + i][1] = mat[4 + i];
+ registers[pos + i][2] = mat[8 + i];
+ registers[pos + i][3] = mat[12 + i];
+ }
+}
+
+
+/**
+ * As above, but transpose the matrix.
+ */
+static void
+load_transpose_matrix(GLfloat registers[][4], GLuint pos,
+ const GLfloat mat[16])
+{
+ MEMCPY(registers[pos], mat, 16 * sizeof(GLfloat));
+}
+
+
+/**
+ * Load current vertex program's parameter registers with tracked
+ * matrices (if NV program). This only needs to be done per
+ * glBegin/glEnd, not per-vertex.
+ */
+void
+_mesa_load_tracked_matrices(GLcontext *ctx)
+{
+ GLuint i;
+
+ for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
+ /* point 'mat' at source matrix */
+ GLmatrix *mat;
+ if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) {
+ mat = ctx->ModelviewMatrixStack.Top;
+ }
+ else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) {
+ mat = ctx->ProjectionMatrixStack.Top;
+ }
+ else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) {
+ mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top;
+ }
+ else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) {
+ mat = ctx->ColorMatrixStack.Top;
+ }
+ else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
+ /* XXX verify the combined matrix is up to date */
+ mat = &ctx->_ModelProjectMatrix;
+ }
+ else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV &&
+ ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) {
+ GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV;
+ ASSERT(n < MAX_PROGRAM_MATRICES);
+ mat = ctx->ProgramMatrixStack[n].Top;
+ }
+ else {
+ /* no matrix is tracked, but we leave the register values as-is */
+ assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE);
+ continue;
+ }
+
+ /* load the matrix values into sequential registers */
+ if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) {
+ load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
+ }
+ else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) {
+ _math_matrix_analyse(mat); /* update the inverse */
+ ASSERT(!_math_matrix_is_dirty(mat));
+ load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
+ }
+ else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) {
+ load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
+ }
+ else {
+ assert(ctx->VertexProgram.TrackMatrixTransform[i]
+ == GL_INVERSE_TRANSPOSE_NV);
+ _math_matrix_analyse(mat); /* update the inverse */
+ ASSERT(!_math_matrix_is_dirty(mat));
+ load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
+ }
+ }
+}
diff --git a/src/mesa/shader/prog_statevars.h b/src/mesa/shader/prog_statevars.h
index 3281a4a2a0..22bb8e07ad 100644
--- a/src/mesa/shader/prog_statevars.h
+++ b/src/mesa/shader/prog_statevars.h
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.2
+ * Version: 7.1
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul 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"),
@@ -126,4 +126,8 @@ extern const char *
_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
+extern void
+_mesa_load_tracked_matrices(GLcontext *ctx);
+
+
#endif /* PROG_STATEVARS_H */
diff --git a/src/mesa/shader/slang/descrip.mms b/src/mesa/shader/slang/descrip.mms
index c86763718a..6eefbcf5bd 100644
--- a/src/mesa/shader/slang/descrip.mms
+++ b/src/mesa/shader/slang/descrip.mms
@@ -1,12 +1,15 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 17 March 2006
+# Last revision : 3 October 2007
.first
define gl [----.include.gl]
define math [--.math]
define swrast [--.swrast]
define array_cache [--.array_cache]
+ define main [--.main]
+ define glapi [--.glapi]
+ define shader [--.shader]
.include [----]mms-config.
@@ -21,15 +24,13 @@ CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ie
SOURCES = \
slang_compile.c,slang_preprocess.c
-OBJECTS = \
- slang_compile.obj,slang_preprocess.obj,slang_utility.obj,\
- slang_execute.obj,slang_assemble.obj,slang_assemble_conditional.obj,\
- slang_assemble_constructor.obj,slang_assemble_typeinfo.obj,\
- slang_storage.obj,slang_assemble_assignment.obj,\
- slang_compile_function.obj,slang_compile_struct.obj,\
- slang_compile_variable.obj,slang_compile_operation.obj,\
- slang_library_noise.obj,slang_link.obj,slang_export.obj,\
- slang_analyse.obj,slang_library_texsample.obj
+OBJECTS = slang_builtin.obj,slang_codegen.obj,slang_compile.obj,\
+ slang_compile_function.obj,slang_compile_operation.obj,\
+ slang_compile_struct.obj,slang_compile_variable.obj,slang_emit.obj,\
+ slang_ir.obj,slang_label.obj,slang_library_noise.obj,slang_link.obj,\
+ slang_log.obj,slang_mem.obj,slang_preprocess.obj,slang_print.obj,\
+ slang_simplify.obj,slang_storage.obj,slang_typeinfo.obj,\
+ slang_utility.obj,slang_vartable.obj
##### RULES #####
@@ -44,22 +45,24 @@ clean :
purge
delete *.obj;*
+slang_builtin.obj : slang_builtin.c
+slang_codegen.obj : slang_codegen.c
slang_compile.obj : slang_compile.c
-slang_preprocess.obj : slang_preprocess.c
-slang_utility.obj : slang_utility.c
-slang_execute.obj : slang_execute.c
-slang_assemble.obj : slang_assemble.c
-slang_assemble_conditional.obj : slang_assemble_conditional.c
-slang_assemble_constructor.obj : slang_assemble_constructor.c
-slang_assemble_typeinfo.obj : slang_assemble_typeinfo.c
-slang_storage.obj : slang_storage.c
-slang_assemble_assignment.obj : slang_assemble_assignment.c
slang_compile_function.obj : slang_compile_function.c
+slang_compile_operation.obj : slang_compile_operation.c
slang_compile_struct.obj : slang_compile_struct.c
slang_compile_variable.obj : slang_compile_variable.c
-slang_compile_operation.obj : slang_compile_operation.c
+slang_emit.obj : slang_emit.c
+slang_ir.obj : slang_ir.c
+slang_label.obj : slang_label.c
slang_library_noise.obj : slang_library_noise.c
slang_link.obj : slang_link.c
-slang_export.obj : slang_export.c
-slang_analyse.obj : slang_analyse.c
-slang_library_texsample.obj : slang_library_texsample.c
+slang_log.obj : slang_log.c
+slang_mem.obj : slang_mem.c
+slang_preprocess.obj : slang_preprocess.c
+slang_print.obj : slang_print.c
+slang_simplify.obj : slang_simplify.c
+slang_storage.obj : slang_storage.c
+slang_typeinfo.obj : slang_typeinfo.c
+slang_utility.obj : slang_utility.c
+slang_vartable.obj : slang_vartable.c
diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c
index 5191e0c222..f6ea57b3f2 100644
--- a/src/mesa/shader/slang/slang_codegen.c
+++ b/src/mesa/shader/slang/slang_codegen.c
@@ -2352,7 +2352,8 @@ _slang_gen_field(slang_assemble_ctx * A, slang_operation *oper)
return n;
}
else if ( ti.spec.type == SLANG_SPEC_FLOAT
- || ti.spec.type == SLANG_SPEC_INT) {
+ || ti.spec.type == SLANG_SPEC_INT
+ || ti.spec.type == SLANG_SPEC_BOOL) {
const GLuint rows = 1;
slang_swizzle swz;
slang_ir_node *n;
diff --git a/src/mesa/swrast/descrip.mms b/src/mesa/swrast/descrip.mms
index 4d49673b5d..0b23deb3c2 100644
--- a/src/mesa/swrast/descrip.mms
+++ b/src/mesa/swrast/descrip.mms
@@ -1,12 +1,15 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 21 February 2006
+# Last revision : 3 October 2007
.first
define gl [---.include.gl]
define math [-.math]
define swrast [-.swrast]
define array_cache [-.array_cache]
+ define glapi [-.glapi]
+ define main [-.main]
+ define shader [-.shader]
.include [---]mms-config.
@@ -20,17 +23,17 @@ CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ie
SOURCES = s_aaline.c s_aatriangle.c s_accum.c s_alpha.c \
s_bitmap.c s_blend.c s_blit.c s_buffers.c s_context.c \
- s_copypix.c s_depth.c \
+ s_copypix.c s_depth.c s_fragprog.c \
s_drawpix.c s_feedback.c s_fog.c s_imaging.c s_lines.c s_logic.c \
- s_masking.c s_nvfragprog.c s_points.c s_readpix.c \
+ s_masking.c s_points.c s_readpix.c \
s_span.c s_stencil.c s_texstore.c s_texcombine.c s_texfilter.c \
- s_triangle.c s_zoom.c s_atifragshader.c s_arbshader.c
+ s_triangle.c s_zoom.c s_atifragshader.c
OBJECTS = s_aaline.obj,s_aatriangle.obj,s_accum.obj,s_alpha.obj,\
- s_bitmap.obj,s_blend.obj,s_blit.obj,s_arbshader.obj,\
+ s_bitmap.obj,s_blend.obj,s_blit.obj,s_fragprog.obj,\
s_buffers.obj,s_context.obj,s_atifragshader.obj,\
s_copypix.obj,s_depth.obj,s_drawpix.obj,s_feedback.obj,s_fog.obj,\
- s_imaging.obj,s_lines.obj,s_logic.obj,s_masking.obj,s_nvfragprog.obj,\
+ s_imaging.obj,s_lines.obj,s_logic.obj,s_masking.obj,\
s_points.obj,s_readpix.obj,s_span.obj,s_stencil.obj,\
s_texstore.obj,s_texcombine.obj,s_texfilter.obj,s_triangle.obj,\
s_zoom.obj
@@ -67,7 +70,6 @@ s_imaging.obj : s_imaging.c
s_lines.obj : s_lines.c
s_logic.obj : s_logic.c
s_masking.obj : s_masking.c
-s_nvfragprog.obj : s_nvfragprog.c
s_points.obj : s_points.c
s_readpix.obj : s_readpix.c
s_span.obj : s_span.c
@@ -77,4 +79,4 @@ s_texcombine.obj : s_texcombine.c
s_texfilter.obj : s_texfilter.c
s_triangle.obj : s_triangle.c
s_zoom.obj : s_zoom.c
-s_arbshader.obj : s_arbshader.c
+s_fragprog.obj : s_fragprog.c
diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h
index e7911fec3b..ca08203d83 100644
--- a/src/mesa/swrast/s_aalinetemp.h
+++ b/src/mesa/swrast/s_aalinetemp.h
@@ -141,6 +141,7 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
INIT_SPAN(line.span, GL_LINE);
line.span.arrayMask = SPAN_XY | SPAN_COVERAGE;
+ line.span.facing = swrast->PointLineFacing;
line.xAdj = line.dx / line.len * line.halfWidth;
line.yAdj = line.dy / line.len * line.halfWidth;
diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h
index 29609add17..0827b3db9e 100644
--- a/src/mesa/swrast/s_aatritemp.h
+++ b/src/mesa/swrast/s_aatritemp.h
@@ -65,7 +65,7 @@
GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4];
GLfloat wPlane[4]; /* win[3] */
#endif
- GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceSign;
+ GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign;
(void) swrast;
@@ -104,6 +104,7 @@
majDx = vMax->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0];
majDy = vMax->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1];
+ /* front/back-face determination and cullling */
{
const GLfloat botDx = vMid->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0];
const GLfloat botDy = vMid->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1];
@@ -112,6 +113,8 @@
if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area))
return;
ltor = (GLboolean) (area < 0.0F);
+
+ span.facing = area * swrast->_BackfaceSign > 0.0F;
}
/* Plane equation setup:
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c
index 3956925651..3bf9804bef 100644
--- a/src/mesa/swrast/s_context.c
+++ b/src/mesa/swrast/s_context.c
@@ -117,8 +117,8 @@ _swrast_update_rasterflags( GLcontext *ctx )
/**
- * Examine polycon culls tate to compute the _BackfaceSign field.
- * _BackfaceSign will be 0 if no culling, -1 if culling back-faces,
+ * Examine polycon culls tate to compute the _BackfaceCullSign field.
+ * _BackfaceCullSign will be 0 if no culling, -1 if culling back-faces,
* and 1 if culling front-faces. The Polygon FrontFace state also
* factors in.
*/
@@ -149,10 +149,15 @@ _swrast_update_polygon( GLcontext *ctx )
backface_sign = 0.0;
}
- SWRAST_CONTEXT(ctx)->_BackfaceSign = backface_sign;
+ SWRAST_CONTEXT(ctx)->_BackfaceCullSign = backface_sign;
+
+ /* This is for front/back-face determination, but not for culling */
+ SWRAST_CONTEXT(ctx)->_BackfaceSign
+ = (ctx->Polygon.FrontFace == GL_CW) ? -1.0 : 1.0;
}
+
/**
* Update the _PreferPixelFog field to indicate if we need to compute
* fog blend factors (from the fog coords) per-fragment.
@@ -764,6 +769,12 @@ _swrast_ResetLineStipple( GLcontext *ctx )
}
void
+_swrast_SetFacing(GLcontext *ctx, GLuint facing)
+{
+ SWRAST_CONTEXT(ctx)->PointLineFacing = facing;
+}
+
+void
_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value )
{
if (SWRAST_DEBUG) {
diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h
index daa07e1578..aebc80c208 100644
--- a/src/mesa/swrast/s_context.h
+++ b/src/mesa/swrast/s_context.h
@@ -128,7 +128,8 @@ typedef struct
* _swrast_validate_derived():
*/
GLbitfield _RasterMask;
- GLfloat _BackfaceSign;
+ GLfloat _BackfaceSign; /** +1 or -1 */
+ GLfloat _BackfaceCullSign; /** +1, 0, or -1 */
GLboolean _PreferPixelFog; /* Compute fog blend factor per fragment? */
GLboolean _AnyTextureCombine;
GLboolean _FogEnabled;
@@ -156,6 +157,7 @@ typedef struct
/* Working values:
*/
GLuint StippleCounter; /**< Line stipple counter */
+ GLuint PointLineFacing;
GLbitfield NewState;
GLuint StateChanges;
GLenum Primitive; /* current primitive being drawn (ala glBegin) */
diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c
index 4067fd6886..76c79eb0d8 100644
--- a/src/mesa/swrast/s_fragprog.c
+++ b/src/mesa/swrast/s_fragprog.c
@@ -120,7 +120,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine,
/* if running a GLSL program (not ARB_fragment_program) */
if (ctx->Shader.CurrentProgram) {
/* Store front/back facing value in register FOGC.Y */
- machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing;
+ machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = 1.0 - span->facing;
}
machine->CurElement = col;
diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h
index 1accfc67e2..1abf8d6c7f 100644
--- a/src/mesa/swrast/s_linetemp.h
+++ b/src/mesa/swrast/s_linetemp.h
@@ -308,6 +308,9 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
span.interpMask = interpFlags;
span.arrayMask = SPAN_XY;
+ span.facing = swrast->PointLineFacing;
+
+
/*
* Draw
*/
diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c
index dd664b980e..d60e175baa 100644
--- a/src/mesa/swrast/s_points.c
+++ b/src/mesa/swrast/s_points.c
@@ -106,6 +106,8 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
INIT_SPAN(span, GL_POINT);
span.interpMask = SPAN_Z | SPAN_RGBA;
+ span.facing = swrast->PointLineFacing;
+
span.red = ChanToFixed(vert->color[0]);
span.green = ChanToFixed(vert->color[1]);
span.blue = ChanToFixed(vert->color[2]);
@@ -280,6 +282,8 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
span.interpMask = SPAN_Z | SPAN_RGBA;
span.arrayMask = SPAN_COVERAGE | SPAN_MASK;
+ span.facing = swrast->PointLineFacing;
+
span.red = ChanToFixed(vert->color[0]);
span.green = ChanToFixed(vert->color[1]);
span.blue = ChanToFixed(vert->color[2]);
@@ -386,6 +390,7 @@ large_point(GLcontext *ctx, const SWvertex *vert)
/* span init */
INIT_SPAN(span, GL_POINT);
span.arrayMask = SPAN_XY;
+ span.facing = swrast->PointLineFacing;
if (ciMode) {
span.interpMask = SPAN_Z | SPAN_INDEX;
@@ -492,7 +497,8 @@ pixel_point(GLcontext *ctx, const SWvertex *vert)
/* check if we need to flush */
if (span->end >= MAX_WIDTH ||
- (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT))) {
+ (swrast->_RasterMask & (BLEND_BIT | LOGIC_OP_BIT | MASKING_BIT)) ||
+ span->facing != swrast->PointLineFacing) {
if (ciMode)
_swrast_write_index_span(ctx, span);
else
@@ -502,6 +508,8 @@ pixel_point(GLcontext *ctx, const SWvertex *vert)
count = span->end;
+ span->facing = swrast->PointLineFacing;
+
/* fragment attributes */
if (ciMode) {
span->array->index[count] = (GLuint) vert->attrib[FRAG_ATTRIB_CI][0];
diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c
index c255545217..938cdefa56 100644
--- a/src/mesa/swrast/s_triangle.c
+++ b/src/mesa/swrast/s_triangle.c
@@ -58,7 +58,7 @@ _swrast_culltriangle( GLcontext *ctx,
GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1];
GLfloat c = ex*fy-ey*fx;
- if (c * SWRAST_CONTEXT(ctx)->_BackfaceSign > 0)
+ if (c * SWRAST_CONTEXT(ctx)->_BackfaceCullSign > 0)
return 0;
return 1;
diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h
index cded4a6c1c..8e3c5b5eeb 100644
--- a/src/mesa/swrast/s_tritemp.h
+++ b/src/mesa/swrast/s_tritemp.h
@@ -234,18 +234,18 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
/* compute area, oneOverArea and perform backface culling */
{
const GLfloat area = eMaj.dx * eBot.dy - eBot.dx * eMaj.dy;
- /* Do backface culling */
- if (area * bf < 0.0)
- return;
if (IS_INF_OR_NAN(area) || area == 0.0F)
return;
- oneOverArea = 1.0F / area;
- }
+ if (area * bf * swrast->_BackfaceCullSign < 0.0)
+ return;
+ oneOverArea = 1.0F / area;
- span.facing = ctx->_Facing; /* for 2-sided stencil test */
+ /* 0 = front, 1 = back */
+ span.facing = oneOverArea * bf > 0.0F;
+ }
/* Edge setup. For a triangle strip these could be reused... */
{
diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h
index 85a27fd55b..047f7991e6 100644
--- a/src/mesa/swrast/swrast.h
+++ b/src/mesa/swrast/swrast.h
@@ -143,6 +143,13 @@ _swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value);
extern void
_swrast_ResetLineStipple( GLcontext *ctx );
+/**
+ * Indicates front/back facing for subsequent points/lines when drawing
+ * unfilled polygons. Needed for two-side stencil.
+ */
+extern void
+_swrast_SetFacing(GLcontext *ctx, GLuint facing);
+
/* These will always render the correct point/line/triangle for the
* current state.
*
diff --git a/src/mesa/swrast_setup/descrip.mms b/src/mesa/swrast_setup/descrip.mms
index e5e48afb3d..32ffd80732 100644
--- a/src/mesa/swrast_setup/descrip.mms
+++ b/src/mesa/swrast_setup/descrip.mms
@@ -1,13 +1,16 @@
# Makefile for core library for VMS
-# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
-# Last revision : 16 June 2003
+# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
+# Last revision : 3 October 2007
.first
define gl [---.include.gl]
define math [-.math]
define tnl [-.tnl]
+ define vbo [-.vbo]
define swrast [-.swrast]
define array_cache [-.array_cache]
+ define glapi [-.glapi]
+ define main [-.main]
.include [---]mms-config.
diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c
index a9c7d941e5..a4f949ddfe 100644
--- a/src/mesa/swrast_setup/ss_context.c
+++ b/src/mesa/swrast_setup/ss_context.c
@@ -201,6 +201,9 @@ _swsetup_RenderStart( GLcontext *ctx )
swsetup->NewState = 0;
+ /* This will change if drawing unfilled tris */
+ _swrast_SetFacing(ctx, 0);
+
_swrast_render_start(ctx);
/* Important */
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index b4207f2c64..4817d23932 100644
--- a/src/mesa/swrast_setup/ss_triangle.c
+++ b/src/mesa/swrast_setup/ss_triangle.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.1
+ * Version: 7.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul 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"),
@@ -68,6 +68,8 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
COPY_CHAN4(c[0], v0->color);
COPY_CHAN4(c[1], v1->color);
@@ -127,6 +129,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
return;
}
+ _swrast_SetFacing(ctx, facing);
+
if (ctx->Light.ShadeModel == GL_FLAT) {
/* save colors/indexes for v0, v1 vertices */
COPY_CHAN4(c[0], v0->color);
@@ -311,6 +315,4 @@ void _swsetup_choose_trifuncs( GLcontext *ctx )
tnl->Driver.Render.Quad = quad_tab[ind];
tnl->Driver.Render.Line = swsetup_line;
tnl->Driver.Render.Points = swsetup_points;
-
- ctx->_Facing = 0;
}
diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h
index 7d1bc23465..97d2f4a16b 100644
--- a/src/mesa/swrast_setup/ss_tritmp.h
+++ b/src/mesa/swrast_setup/ss_tritmp.h
@@ -49,7 +49,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
v[1] = &verts[e1];
v[2] = &verts[e2];
-
if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT))
{
GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0];
@@ -61,7 +60,6 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT))
{
facing = (cc < 0.0) ^ ctx->Polygon._FrontBit;
- ctx->_Facing = facing;
if (IND & SS_UNFILLED_BIT)
mode = facing ? ctx->Polygon.BackMode : ctx->Polygon.FrontMode;
diff --git a/src/mesa/tnl/descrip.mms b/src/mesa/tnl/descrip.mms
index 91e32bf978..f77f672dc8 100644
--- a/src/mesa/tnl/descrip.mms
+++ b/src/mesa/tnl/descrip.mms
@@ -1,12 +1,17 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 21 February 2006
+# Last revision : 30 November 2007
.first
define gl [---.include.gl]
define math [-.math]
+ define vbo [-.vbo]
define shader [-.shader]
+ define swrast [-.swrast]
define array_cache [-.array_cache]
+ define main [-.main]
+ define glapi [-.glapi]
+ define tnl [-.tnl]
.include [---]mms-config.
@@ -18,21 +23,19 @@ INCDIR = [---.include],[-.main],[-.glapi],[-.shader],[-.shader.slang]
LIBDIR = [---.lib]
CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)/float=ieee/ieee=denorm
-SOURCES = t_array_api.c t_array_import.c t_context.c \
- t_pipeline.c t_vb_fog.c t_save_api.c t_vtx_api.c \
+SOURCES = t_context.c t_draw.c \
+ t_pipeline.c t_vb_fog.c \
t_vb_light.c t_vb_normals.c t_vb_points.c t_vb_program.c \
t_vb_render.c t_vb_texgen.c t_vb_texmat.c t_vb_vertex.c \
- t_vtx_eval.c t_vtx_exec.c t_save_playback.c t_save_loopback.c \
- t_vertex.c t_vtx_generic.c t_vtx_x86.c t_vertex_generic.c \
- t_vb_arbprogram.c t_vp_build.c t_vb_arbshader.c
+ t_vertex.c \
+ t_vertex_generic.c t_vp_build.c
-OBJECTS = t_array_api.obj,t_array_import.obj,t_context.obj,\
+OBJECTS = t_context.obj,t_draw.obj,\
t_pipeline.obj,t_vb_fog.obj,t_vb_light.obj,t_vb_normals.obj,\
t_vb_points.obj,t_vb_program.obj,t_vb_render.obj,t_vb_texgen.obj,\
- t_vb_texmat.obj,t_vb_vertex.obj,t_save_api.obj,t_vtx_api.obj,\
- t_vtx_eval.obj,t_vtx_exec.obj,t_save_playback.obj,t_save_loopback.obj,\
- t_vertex.obj,t_vtx_generic.obj,t_vtx_x86.obj,t_vertex_generic.obj,\
- t_vb_arbprogram.obj,t_vp_build.obj,t_vb_arbshader.obj
+ t_vb_texmat.obj,t_vb_vertex.obj,\
+ t_vertex.obj,t_vertex_generic.obj,\
+ t_vp_build.obj
##### RULES #####
@@ -47,9 +50,8 @@ clean :
purge
delete *.obj;*
-t_array_api.obj : t_array_api.c
-t_array_import.obj : t_array_import.c
t_context.obj : t_context.c
+t_draw.obj : t_draw.c
t_pipeline.obj : t_pipeline.c
t_vb_fog.obj : t_vb_fog.c
t_vb_light.obj : t_vb_light.c
@@ -60,16 +62,6 @@ t_vb_render.obj : t_vb_render.c
t_vb_texgen.obj : t_vb_texgen.c
t_vb_texmat.obj : t_vb_texmat.c
t_vb_vertex.obj : t_vb_vertex.c
-t_save_api.obj : t_save_api.c
-t_vtx_api.obj : t_vtx_api.c
-t_vtx_eval.obj : t_vtx_eval.c
-t_vtx_exec.obj : t_vtx_exec.c
-t_save_playback.obj : t_save_playback.c
-t_save_loopback.obj : t_save_loopback.c
t_vertex.obj : t_vertex.c
-t_vtx_x86.obj : t_vtx_x86.c
-t_vtx_generic.obj : t_vtx_generic.c
t_vertex_generic.obj : t_vertex_generic.c
-t_vb_arbprogram.obj : t_vb_arbprogram.c
t_vp_build.obj : t_vp_build.c
-t_vb_arbshader.obj : t_vb_arbshader.c
diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c
index f15f9d8619..addaf76127 100644
--- a/src/mesa/tnl/t_vb_program.c
+++ b/src/mesa/tnl/t_vb_program.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.3
+ * Version: 7.1
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@@ -30,20 +30,20 @@
*/
-#include "glheader.h"
-#include "colormac.h"
-#include "context.h"
-#include "macros.h"
-#include "imports.h"
+#include "main/glheader.h"
+#include "main/colormac.h"
+#include "main/context.h"
+#include "main/macros.h"
+#include "main/imports.h"
#include "shader/prog_instruction.h"
#include "shader/prog_statevars.h"
#include "shader/prog_execute.h"
#include "swrast/s_context.h"
#include "swrast/s_texfilter.h"
-#include "tnl.h"
-#include "t_context.h"
-#include "t_pipeline.h"
+#include "tnl/tnl.h"
+#include "tnl/t_context.h"
+#include "tnl/t_pipeline.h"
@@ -63,18 +63,12 @@ struct vp_stage_data {
#define VP_STAGE_DATA(stage) ((struct vp_stage_data *)(stage->privatePtr))
-/**
- * XXX the texture sampling code in this module is a bit of a hack.
- * The texture sampling code is in swrast, though it doesn't have any
- * real dependencies on the rest of swrast. It should probably be
- * moved into main/ someday.
- */
-
-static void userclip( GLcontext *ctx,
- GLvector4f *clip,
- GLubyte *clipmask,
- GLubyte *clipormask,
- GLubyte *clipandmask )
+static void
+userclip( GLcontext *ctx,
+ GLvector4f *clip,
+ GLubyte *clipmask,
+ GLubyte *clipormask,
+ GLubyte *clipandmask )
{
GLuint p;
@@ -172,6 +166,12 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store)
}
+/**
+ * XXX the texture sampling code in this module is a bit of a hack.
+ * The texture sampling code is in swrast, though it doesn't have any
+ * real dependencies on the rest of swrast. It should probably be
+ * moved into main/ someday.
+ */
static void
vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
GLuint unit, GLfloat color[4])
@@ -246,92 +246,44 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine)
/**
- * Copy the 16 elements of a matrix into four consecutive program
- * registers starting at 'pos'.
+ * Map the texture images which the vertex program will access (if any).
*/
static void
-load_matrix(GLfloat registers[][4], GLuint pos, const GLfloat mat[16])
+map_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
{
- GLuint i;
- for (i = 0; i < 4; i++) {
- registers[pos + i][0] = mat[0 + i];
- registers[pos + i][1] = mat[4 + i];
- registers[pos + i][2] = mat[8 + i];
- registers[pos + i][3] = mat[12 + i];
- }
-}
+ GLuint u;
+ if (!ctx->Driver.MapTexture)
+ return;
-/**
- * As above, but transpose the matrix.
- */
-static void
-load_transpose_matrix(GLfloat registers[][4], GLuint pos,
- const GLfloat mat[16])
-{
- MEMCPY(registers[pos], mat, 16 * sizeof(GLfloat));
+ for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) {
+ if (vp->Base.TexturesUsed[u]) {
+ /* Note: _Current *should* correspond to the target indicated
+ * in TexturesUsed[u].
+ */
+ ctx->Driver.MapTexture(ctx, ctx->Texture.Unit[u]._Current);
+ }
+ }
}
/**
- * Load current vertex program's parameter registers with tracked
- * matrices (if NV program). This only needs to be done per
- * glBegin/glEnd, not per-vertex.
+ * Unmap the texture images which were used by the vertex program (if any).
*/
-void
-_mesa_load_tracked_matrices(GLcontext *ctx)
+static void
+unmap_textures(GLcontext *ctx, const struct gl_vertex_program *vp)
{
- GLuint i;
+ GLuint u;
- for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS / 4; i++) {
- /* point 'mat' at source matrix */
- GLmatrix *mat;
- if (ctx->VertexProgram.TrackMatrix[i] == GL_MODELVIEW) {
- mat = ctx->ModelviewMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_PROJECTION) {
- mat = ctx->ProjectionMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_TEXTURE) {
- mat = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] == GL_COLOR) {
- mat = ctx->ColorMatrixStack.Top;
- }
- else if (ctx->VertexProgram.TrackMatrix[i]==GL_MODELVIEW_PROJECTION_NV) {
- /* XXX verify the combined matrix is up to date */
- mat = &ctx->_ModelProjectMatrix;
- }
- else if (ctx->VertexProgram.TrackMatrix[i] >= GL_MATRIX0_NV &&
- ctx->VertexProgram.TrackMatrix[i] <= GL_MATRIX7_NV) {
- GLuint n = ctx->VertexProgram.TrackMatrix[i] - GL_MATRIX0_NV;
- ASSERT(n < MAX_PROGRAM_MATRICES);
- mat = ctx->ProgramMatrixStack[n].Top;
- }
- else {
- /* no matrix is tracked, but we leave the register values as-is */
- assert(ctx->VertexProgram.TrackMatrix[i] == GL_NONE);
- continue;
- }
+ if (!ctx->Driver.MapTexture)
+ return;
- /* load the matrix values into sequential registers */
- if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_IDENTITY_NV) {
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_INVERSE_NV) {
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
- }
- else if (ctx->VertexProgram.TrackMatrixTransform[i] == GL_TRANSPOSE_NV) {
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->m);
- }
- else {
- assert(ctx->VertexProgram.TrackMatrixTransform[i]
- == GL_INVERSE_TRANSPOSE_NV);
- _math_matrix_analyse(mat); /* update the inverse */
- ASSERT(!_math_matrix_is_dirty(mat));
- load_transpose_matrix(ctx->VertexProgram.Parameters, i*4, mat->inv);
+ for (u = 0; u < ctx->Const.MaxVertexTextureImageUnits; u++) {
+ if (vp->Base.TexturesUsed[u]) {
+ /* Note: _Current *should* correspond to the target indicated
+ * in TexturesUsed[u].
+ */
+ ctx->Driver.UnmapTexture(ctx, ctx->Texture.Unit[u]._Current);
}
}
}
@@ -362,6 +314,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
_mesa_load_state_parameters(ctx, program->Base.Parameters);
}
+ /* make list of outputs to save some time below */
numOutputs = 0;
for (i = 0; i < VERT_RESULT_MAX; i++) {
if (program->Base.OutputsWritten & (1 << i)) {
@@ -369,6 +322,8 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
}
}
+ map_textures(ctx, program);
+
for (i = 0; i < VB->Count; i++) {
GLuint attr;
@@ -420,6 +375,8 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
#endif
}
+ unmap_textures(ctx, program);
+
/* Fixup fog and point size results if needed */
if (program->IsNVProgram) {
if (ctx->Fog.Enabled &&
@@ -439,8 +396,9 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
if (program->IsPositionInvariant) {
/* We need the exact same transform as in the fixed function path here
- to guarantee invariance, depending on compiler optimization flags results
- could be different otherwise */
+ * to guarantee invariance, depending on compiler optimization flags
+ * results could be different otherwise.
+ */
VB->ClipPtr = TransformRaw( &store->results[0],
&ctx->_ModelProjectMatrix,
VB->AttribPtr[0] );
@@ -460,16 +418,15 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage )
break;
}
}
-
-
- /* Setup the VB pointers so that the next pipeline stages get
- * their data from the right place (the program output arrays).
- */
else {
+ /* Setup the VB pointers so that the next pipeline stages get
+ * their data from the right place (the program output arrays).
+ */
VB->ClipPtr = &store->results[VERT_RESULT_HPOS];
VB->ClipPtr->size = 4;
VB->ClipPtr->count = VB->Count;
}
+
VB->ColorPtr[0] = &store->results[VERT_RESULT_COL0];
VB->ColorPtr[1] = &store->results[VERT_RESULT_BFC0];
VB->SecondaryColorPtr[0] = &store->results[VERT_RESULT_COL1];
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 047b764dcb..c2b1f71caa 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -1,9 +1,8 @@
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 7.1
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul 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"),
@@ -82,7 +81,4 @@ _tnl_draw_prims( GLcontext *ctx,
GLuint min_index,
GLuint max_index);
-extern void
-_mesa_load_tracked_matrices(GLcontext *ctx);
-
#endif
diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h
index 0bf32ff344..6c2378f5e8 100644
--- a/src/mesa/tnl_dd/t_dd_tritmp.h
+++ b/src/mesa/tnl_dd/t_dd_tritmp.h
@@ -155,10 +155,6 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
@@ -421,10 +417,6 @@ static void TAG(quad)( GLcontext *ctx,
{
facing = AREA_IS_CCW( cc ) ^ ctx->Polygon._FrontBit;
- if (DO_TWOSTENCIL && ctx->Stencil.TestTwoSide) {
- ctx->_Facing = facing; /* mixed mode rendering: for 2-sided stencil test */
- }
-
if (DO_UNFILLED) {
if (facing) {
mode = ctx->Polygon.BackMode;
diff --git a/src/mesa/vbo/descrip.mms b/src/mesa/vbo/descrip.mms
index 4ab22e4005..c2a16a04f5 100644
--- a/src/mesa/vbo/descrip.mms
+++ b/src/mesa/vbo/descrip.mms
@@ -1,6 +1,6 @@
# Makefile for core library for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
-# Last revision : 7 March 2007
+# Last revision : 3 October 2007
.first
define gl [---.include.gl]
@@ -10,6 +10,8 @@
define shader [-.shader]
define swrast [-.swrast]
define swrast_setup [-.swrast_setup]
+ define main [-.main]
+ define glapi [-.glapi]
.include [---]mms-config.