summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorNian Wu <[email protected]>2007-03-19 17:00:19 +0800
committerNian Wu <[email protected]>2007-03-19 17:00:19 +0800
commite01ee3da577f177e77153f3a33d39e13f5e3f9cb (patch)
tree14bcfd5a30a5b24b22a9b773b4ba6211e50e8958 /src/mesa/drivers/dri
parentfd1b1fce3faaf40af201a5b06a84df62c855fb12 (diff)
parent77544d7b7d7c6fd03c0df81dca07f1bb3a67c119 (diff)
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/i915_reg.h2
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/i915_reg.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex.c15
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader_0.c23
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_maos.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_maos.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_texmem.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c1
-rw-r--r--src/mesa/drivers/dri/r300/radeon_span.c1
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c31
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h5
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c24
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c18
19 files changed, 74 insertions, 63 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h
index 3ba792a2342..694cd4c8c3c 100644
--- a/src/mesa/drivers/dri/i915/i915_reg.h
+++ b/src/mesa/drivers/dri/i915/i915_reg.h
@@ -138,7 +138,7 @@
/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
-#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<19) | 0x2)
+#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2)
/* p161 */
#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index fd11e10652e..5e00e6597b0 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -813,7 +813,7 @@ static void i915_init_packets( i915ContextPtr i915 )
I1_LOAD_S(4) |
I1_LOAD_S(5) |
I1_LOAD_S(6) |
- (4));
+ (3));
i915->state.Ctx[I915_CTXREG_LIS2] = 0;
i915->state.Ctx[I915_CTXREG_LIS4] = 0;
i915->state.Ctx[I915_CTXREG_LIS5] = 0;
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 2936a0fb721..b533e153beb 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -180,7 +180,7 @@ static void i915_emit_invarient_state( intelContextPtr intel )
*/
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(3) |
- (1));
+ (0));
OUT_BATCH(0);
/* XXX: Use this */
diff --git a/src/mesa/drivers/dri/i915tex/i915_reg.h b/src/mesa/drivers/dri/i915tex/i915_reg.h
index 04b199905c1..34c68214056 100644
--- a/src/mesa/drivers/dri/i915tex/i915_reg.h
+++ b/src/mesa/drivers/dri/i915tex/i915_reg.h
@@ -138,7 +138,7 @@
/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */
-#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<19) | 0x2)
+#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2)
/* p161 */
#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16))
diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c
index c3ffa9e6577..467aec64a01 100644
--- a/src/mesa/drivers/dri/i965/brw_tex.c
+++ b/src/mesa/drivers/dri/i965/brw_tex.c
@@ -148,18 +148,25 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
return &_mesa_texformat_ycbcr_rev;
case GL_COMPRESSED_RGB_FXT1_3DFX:
+ return &_mesa_texformat_rgb_fxt1;
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return &_mesa_texformat_rgb_fxt1;
+ return &_mesa_texformat_rgba_fxt1;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1; /* there is no rgba support? */
+ return &_mesa_texformat_rgba_dxt5;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
index 73c1f7c2a53..211483dc027 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_0.c
@@ -263,6 +263,23 @@ pass0_make_mask(GLuint mesa_mask)
return mask;
}
+static GLboolean
+pass0_opcode_is_tex(enum prog_opcode op)
+{
+ switch (op) {
+ case OPCODE_TEX:
+ case OPCODE_TXB:
+ case OPCODE_TXD:
+ case OPCODE_TXL:
+ case OPCODE_TXP:
+ return GL_TRUE;
+ default:
+ break;
+ }
+
+ return GL_FALSE;
+}
+
static nvsTexTarget
pass0_make_tex_target(GLuint mesa)
{
@@ -721,7 +738,11 @@ pass0_translate_arith(nouveauShader *nvs, struct gl_program *prog,
(inst->SaturateMode != SATURATE_OFF),
src[0], src[1], src[2]);
nvsinst->tex_unit = inst->TexSrcUnit;
- nvsinst->tex_target = pass0_make_tex_target(inst->TexSrcTarget);
+ if (pass0_opcode_is_tex(inst->Opcode))
+ nvsinst->tex_target =
+ pass0_make_tex_target(inst->TexSrcTarget);
+ else
+ nvsinst->tex_target = NVS_TEX_TARGET_UNKNOWN;
ret = GL_TRUE;
} else
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index a106bbc6abf..0fb2e5a2e0f 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -338,7 +338,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
r300->hw.unk4260.cmd[0] = cmdpacket0(0x4260, 3);
ALLOC_STATE( shade, always, 5, "shade", 0 );
r300->hw.shade.cmd[0] = cmdpacket0(R300_RE_SHADE, 4);
- ALLOC_STATE( polygon_mode, always, 4, "unk4288", 0 );
+ ALLOC_STATE( polygon_mode, always, 4, "polygon_mode", 0 );
r300->hw.polygon_mode.cmd[0] = cmdpacket0(R300_RE_POLYGON_MODE, 3);
ALLOC_STATE( fogp, always, 3, "fogp", 0 );
r300->hw.fogp.cmd[0] = cmdpacket0(R300_RE_FOG_SCALE, 2);
diff --git a/src/mesa/drivers/dri/r300/r300_maos.c b/src/mesa/drivers/dri/r300/r300_maos.c
index fcb87cbbb59..b0d96f7601a 100644
--- a/src/mesa/drivers/dri/r300/r300_maos.c
+++ b/src/mesa/drivers/dri/r300/r300_maos.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_maos_arrays.c,v 1.3 2003/02/23 23:59:01 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/r300_maos.h b/src/mesa/drivers/dri/r300/r300_maos.h
index 679f1c25588..ab283178944 100644
--- a/src/mesa/drivers/dri/r300/r300_maos.h
+++ b/src/mesa/drivers/dri/r300/r300_maos.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_maos.h,v 1.1 2002/10/30 12:51:52 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 6348ba1982a..eb72802f8b4 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_tex.c,v 1.2 2002/11/05 17:46:08 tsi Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h
index a18ff0e2ce7..10aabc8b4b7 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.h
+++ b/src/mesa/drivers/dri/r300/r300_tex.h
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_tex.h,v 1.1 2002/10/30 12:51:53 alanh Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c
index 96973c00987..f531b54d115 100644
--- a/src/mesa/drivers/dri/r300/r300_texmem.c
+++ b/src/mesa/drivers/dri/r300/r300_texmem.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_texmem.c,v 1.5 2002/12/17 00:32:56 dawes Exp $ */
/**************************************************************************
Copyright (C) Tungsten Graphics 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index cc356afb230..4bc0ea14f81 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/r300/r300_texstate.c,v 1.3 2003/02/15 22:18:47 dawes Exp $ */
/*
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/r300/radeon_span.c b/src/mesa/drivers/dri/r300/radeon_span.c
index 1b74f6779b4..cc779d684fb 100644
--- a/src/mesa/drivers/dri/r300/radeon_span.c
+++ b/src/mesa/drivers/dri/r300/radeon_span.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_span.c,v 1.6 2002/10/30 12:51:56 alanh Exp $ */
/**************************************************************************
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 89533421b46..4d25d328e33 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -768,9 +768,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
drawable);
}
- draw_buffer->drawXoff = (GLuint)(((drawable->x * bytePerPixel) & 0x1f) /
- bytePerPixel);
- draw_buffer->drawX = drawable->x - draw_buffer->drawXoff;
+ draw_buffer->drawX = drawable->x;
draw_buffer->drawY = drawable->y;
draw_buffer->drawW = drawable->w;
draw_buffer->drawH = drawable->h;
@@ -782,9 +780,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
readable);
}
- read_buffer->drawXoff = (GLuint)(((readable->x * bytePerPixel) & 0x1f) /
- bytePerPixel);
- read_buffer->drawX = readable->x - read_buffer->drawXoff;
+ read_buffer->drawX = readable->x;
read_buffer->drawY = readable->y;
read_buffer->drawW = readable->w;
read_buffer->drawH = readable->h;
@@ -795,13 +791,24 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
draw_buffer->drawX * bytePerPixel);
vmesa->front.origMap = (vmesa->front.map +
- draw_buffer->drawY * vmesa->front.pitch +
- draw_buffer->drawX * bytePerPixel);
+ draw_buffer->drawY * vmesa->front.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->back.orig = (vmesa->back.offset +
+ draw_buffer->drawY * vmesa->back.pitch +
+ draw_buffer->drawX * bytePerPixel);
- vmesa->back.orig = vmesa->back.offset;
- vmesa->depth.orig = vmesa->depth.offset;
- vmesa->back.origMap = vmesa->back.map;
- vmesa->depth.origMap = vmesa->depth.map;
+ vmesa->back.origMap = (vmesa->back.map +
+ draw_buffer->drawY * vmesa->back.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->depth.orig = (vmesa->depth.offset +
+ draw_buffer->drawY * vmesa->depth.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->depth.origMap = (vmesa->depth.map +
+ draw_buffer->drawY * vmesa->depth.pitch +
+ draw_buffer->drawX * bytePerPixel);
viaCalcViewport(vmesa->glCtx);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 77161a8d5df..fecd2782fba 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -104,11 +104,6 @@ struct via_renderbuffer {
int drawW;
int drawH;
- int drawXoff; /* drawX is 32byte aligned - this is
- * the delta to the real origin, in
- * pixel units.
- */
-
__DRIdrawablePrivate *dPriv;
};
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 5d102de93ed..4a733fb00c2 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -187,7 +187,7 @@ static void viaFillBuffer(struct via_context *vmesa,
int w = pbox[i].x2 - pbox[i].x1;
int h = pbox[i].y2 - pbox[i].y1;
- int offset = (buffer->orig +
+ int offset = (buffer->offset +
y * buffer->pitch +
x * bytePerPixel);
@@ -276,7 +276,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask)
/* flip top to bottom */
cy = dPriv->h - cy - ch;
- cx += vrb->drawX + vrb->drawXoff;
+ cx += vrb->drawX;
cy += vrb->drawY;
if (!all) {
@@ -359,8 +359,8 @@ static void viaDoSwapBuffers(struct via_context *vmesa,
GLint w = b->x2 - b->x1;
GLint h = b->y2 - b->y1;
- GLuint src = back->orig + y * back->pitch + x * bytePerPixel;
- GLuint dest = front->orig + y * front->pitch + x * bytePerPixel;
+ GLuint src = back->offset + y * back->pitch + x * bytePerPixel;
+ GLuint dest = front->offset + y * front->pitch + x * bytePerPixel;
viaBlit(vmesa,
bytePerPixel << 3,
@@ -747,7 +747,7 @@ static void via_emit_cliprect(struct via_context *vmesa,
: HC_HDBFM_RGB565);
GLuint pitch = buffer->pitch;
- GLuint offset = buffer->orig;
+ GLuint offset = buffer->offset;
if (0)
fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n",
@@ -768,7 +768,7 @@ static void via_emit_cliprect(struct via_context *vmesa,
vb[4] = (HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF);
vb[5] = (HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000) >> 24);
- vb[6] = (HC_SubA_HSPXYOS << 24) | ((31 - buffer->drawXoff) << HC_HSPXOS_SHIFT);
+ vb[6] = (HC_SubA_HSPXYOS << 24);
vb[7] = (HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch;
}
@@ -887,22 +887,18 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
struct via_renderbuffer *const vrb =
(struct via_renderbuffer *) dPriv->driverPrivate;
-
for (i = 0; i < vmesa->numClipRects; i++) {
drm_clip_rect_t b;
- b.x1 = pbox[i].x1 - (vrb->drawX + vrb->drawXoff);
- b.x2 = pbox[i].x2 - (vrb->drawX + vrb->drawXoff);
- b.y1 = pbox[i].y1 - vrb->drawY;
- b.y2 = pbox[i].y2 - vrb->drawY;
+ b.x1 = pbox[i].x1;
+ b.x2 = pbox[i].x2;
+ b.y1 = pbox[i].y1;
+ b.y2 = pbox[i].y2;
if (vmesa->scissor &&
!intersect_rect(&b, &b, &vmesa->scissorRect))
continue;
- b.x1 += vrb->drawXoff;
- b.x2 += vrb->drawXoff;
-
via_emit_cliprect(vmesa, &b);
if (fire_buffer(vmesa) != 0) {
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index f1ed98036bf..3a16dadd238 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -46,7 +46,7 @@
GLuint pitch = vrb->pitch; \
GLuint height = dPriv->h; \
GLint p = 0; \
- char *buf = (char *)(vrb->origMap + vrb->drawXoff * vrb->bpp); \
+ char *buf = (char *)(vrb->origMap); \
(void) p;
/* ================================================================
@@ -82,7 +82,7 @@
__DRIdrawablePrivate *dPriv = vrb->dPriv; \
GLuint depth_pitch = vrb->pitch; \
GLuint height = dPriv->h; \
- char *buf = (char *)(vrb->map + (vrb->drawXoff * vrb->bpp/8))
+ char *buf = (char *)(vrb->map)
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 30b9dc289a7..bccdbe93264 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -500,10 +500,8 @@ void viaEmitState(struct via_context *vmesa)
OUT_RING( HC_HEADER2 );
OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32- vrb->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32 - vrb->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
+ OUT_RING( (HC_SubA_HSPXYOS << 24) );
+ OUT_RING( (HC_SubA_HSPXYOS << 24) );
ADVANCE_RING();
}
@@ -712,12 +710,8 @@ static void viaColorMask(GLcontext *ctx,
}
-/* =============================================================
- */
-
-/* Using drawXoff like this is incorrect outside of locked regions.
- * This hardware just isn't capable of private back buffers without
+/* This hardware just isn't capable of private back buffers without
* glitches and/or a hefty locking scheme.
*/
void viaCalcViewport(GLcontext *ctx)
@@ -729,12 +723,10 @@ void viaCalcViewport(GLcontext *ctx)
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat *m = vmesa->ViewportMatrix.m;
- /* See also via_translate_vertex.
- */
m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X + vrb->drawXoff;
+ m[MAT_TX] = v[MAT_TX] + vrb->drawX + SUBPIXEL_X;
m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + dPriv->h + SUBPIXEL_Y;
+ m[MAT_TY] = - v[MAT_TY] + vrb->drawY + SUBPIXEL_Y + vrb->drawH;
m[MAT_SZ] = v[MAT_SZ] * (1.0 / vmesa->depth_max);
m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max);
}