summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorOliver McFadden <z3ro.geek@gmail.com>2007-05-09 14:23:22 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-05-09 14:23:22 +0000
commitf9828f5c4f75683934536482a7eb9b7ef2758700 (patch)
tree51f23ec9f9949594406275eced032b9c82f3efaf /src/mesa
parent7b165de5f8a4c3d99b8b9f1820e12d5899b3884f (diff)
parent62ef001de7c16aff459114c1dcc8097270689e6d (diff)
Merge branch 'master' of git://anongit.freedesktop.org/git/mesa/mesa
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i915/server/intel_dri.c27
-rw-r--r--src/mesa/drivers/dri/i915tex/server/intel_dri.c27
-rw-r--r--src/mesa/shader/shader_api.c10
3 files changed, 37 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c
index 169fdbece3..b6946b75d2 100644
--- a/src/mesa/drivers/dri/i915/server/intel_dri.c
+++ b/src/mesa/drivers/dri/i915/server/intel_dri.c
@@ -455,12 +455,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
}
unsigned long
-I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
+I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
+ I830MemRange *result, I830MemPool *pool, long size,
+ unsigned long alignment, int flags)
{
- int ret;
+ unsigned long ret;
- if (!result)
- return 0;
+ if (!result)
+ return 0;
/* Make sure these are initialised. */
result->Size = 0;
@@ -470,16 +472,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
return 0;
}
- if (pool->Free.Size < size)
- return AllocFromAGP(ctx, pI830, size, alignment, result);
- else
- {
- ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
-
- if (ret==0)
- return AllocFromAGP(ctx, pI830, size, alignment, result);
- return ret;
+ if (pool->Free.Size < size) {
+ ret = AllocFromAGP(ctx, pI830, size, alignment, result);
+ }
+ else {
+ ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
+ if (ret == 0)
+ ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
+ return ret;
}
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
diff --git a/src/mesa/drivers/dri/i915tex/server/intel_dri.c b/src/mesa/drivers/dri/i915tex/server/intel_dri.c
index 2d425d04ac..e49c4214ad 100644
--- a/src/mesa/drivers/dri/i915tex/server/intel_dri.c
+++ b/src/mesa/drivers/dri/i915tex/server/intel_dri.c
@@ -483,12 +483,14 @@ static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, l
}
unsigned long
-I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *result, I830MemPool *pool, long size, unsigned long alignment, int flags)
+I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830,
+ I830MemRange *result, I830MemPool *pool, long size,
+ unsigned long alignment, int flags)
{
- int ret;
+ unsigned long ret;
- if (!result)
- return 0;
+ if (!result)
+ return 0;
/* Make sure these are initialised. */
result->Size = 0;
@@ -498,16 +500,15 @@ I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *resul
return 0;
}
- if (pool->Free.Size < size)
- return AllocFromAGP(ctx, pI830, size, alignment, result);
- else
- {
- ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
-
- if (ret==0)
- return AllocFromAGP(ctx, pI830, size, alignment, result);
- return ret;
+ if (pool->Free.Size < size) {
+ ret = AllocFromAGP(ctx, pI830, size, alignment, result);
+ }
+ else {
+ ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags);
+ if (ret == 0)
+ ret = AllocFromAGP(ctx, pI830, size, alignment, result);
}
+ return ret;
}
static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem)
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 64f2a9fa12..3a54e68d0d 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.3
+ * Version: 7.0
*
* Copyright (C) 2004-2007 Brian Paul All Rights Reserved.
*
@@ -1072,12 +1072,20 @@ _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
* If we're setting a sampler, we must use glUniformi1()!
*/
if (shProg->Uniforms->Parameters[location].Type == PROGRAM_SAMPLER) {
+ GLint unit;
if (type != GL_INT || count != 1) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glUniform(only glUniform1i can be used "
"to set sampler uniforms)");
return;
}
+ /* check that the sampler (tex unit index) is legal */
+ unit = ((GLint *) values)[0];
+ if (unit >= ctx->Const.MaxTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glUniform1(invalid sampler/tex unit index)");
+ return;
+ }
}
if (count < 0) {