Merge branch 'mesa_7_5_branch'

This commit is contained in:
Brian Paul
2009-08-14 11:27:51 -06:00
7 changed files with 198 additions and 150 deletions

View File

@@ -37,6 +37,8 @@ tbd
<h2>New features</h2> <h2>New features</h2>
<ul> <ul>
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
max framebuffer, viewport size.
</ul> </ul>

View File

@@ -258,8 +258,26 @@ static void Init( void )
} }
glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE); glBindTexture(GL_TEXTURE_2D, BORDER_TEXTURE);
#ifdef TEST_PBO_DLIST
/* test fetching teximage from PBO in display list */
{
GLuint b = 42, l = 10;
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, b);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER, sizeof(BorderImage),
BorderImage, GL_STREAM_DRAW);
glNewList(l, GL_COMPILE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) 0/* BorderImage*/);
glEndList();
glCallList(l);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
}
#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE+2, SIZE+2, 1,
GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage); GL_RGBA, GL_UNSIGNED_BYTE, (void *) BorderImage);
#endif
for (i = 0; i < SIZE; i++) { for (i = 0; i < SIZE; i++) {
for (j = 0; j < SIZE; j++) { for (j = 0; j < SIZE; j++) {

View File

@@ -683,24 +683,48 @@ translate_id(GLsizei n, GLenum type, const GLvoid * list)
/** /**
* Wrapper for _mesa_unpack_image() that handles pixel buffer objects. * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
* \todo This won't suffice when the PBO is really in VRAM/GPU memory. * If we run out of memory, GL_OUT_OF_MEMORY will be recorded.
*/ */
static GLvoid * static GLvoid *
unpack_image(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, unpack_image(GLcontext *ctx, GLuint dimensions,
GLsizei width, GLsizei height, GLsizei depth,
GLenum format, GLenum type, const GLvoid * pixels, GLenum format, GLenum type, const GLvoid * pixels,
const struct gl_pixelstore_attrib *unpack) const struct gl_pixelstore_attrib *unpack)
{ {
if (!_mesa_is_bufferobj(unpack->BufferObj)) { if (!_mesa_is_bufferobj(unpack->BufferObj)) {
/* no PBO */ /* no PBO */
return _mesa_unpack_image(dimensions, width, height, depth, format, GLvoid *image = _mesa_unpack_image(dimensions, width, height, depth,
type, pixels, unpack); format, type, pixels, unpack);
if (pixels && !image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
} }
else return image;
if (_mesa_validate_pbo_access }
(dimensions, unpack, width, height, depth, format, type, pixels)) { else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels); format, type, pixels)) {
return _mesa_unpack_image(dimensions, width, height, depth, format, const GLubyte *map, *src;
type, src, unpack); GLvoid *image;
map = (GLubyte *)
ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
GL_READ_ONLY_ARB, unpack->BufferObj);
if (!map) {
/* unable to map src buffer! */
_mesa_error(ctx, GL_INVALID_OPERATION, "unable to map PBO");
return NULL;
}
src = ADD_POINTERS(map, pixels);
image = _mesa_unpack_image(dimensions, width, height, depth,
format, type, src, unpack);
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
unpack->BufferObj);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "display list construction");
}
return image;
} }
/* bad access! */ /* bad access! */
return NULL; return NULL;
@@ -858,7 +882,6 @@ save_Bitmap(GLsizei width, GLsizei height,
GLfloat xmove, GLfloat ymove, const GLubyte * pixels) GLfloat xmove, GLfloat ymove, const GLubyte * pixels)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7); n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7);
@@ -869,10 +892,7 @@ save_Bitmap(GLsizei width, GLsizei height,
n[4].f = yorig; n[4].f = yorig;
n[5].f = xmove; n[5].f = xmove;
n[6].f = ymove; n[6].f = ymove;
n[7].data = image; n[7].data = _mesa_unpack_bitmap(width, height, pixels, &ctx->Unpack);
}
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_Bitmap(ctx->Exec, (width, height, CALL_Bitmap(ctx->Exec, (width, height,
@@ -999,7 +1019,7 @@ _mesa_save_CallList(GLuint list)
void GLAPIENTRY void GLAPIENTRY
_mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists) _mesa_save_CallLists(GLsizei num, GLenum type, const GLvoid * lists)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLint i; GLint i;
@@ -1024,7 +1044,7 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
typeErrorFlag = GL_TRUE; typeErrorFlag = GL_TRUE;
} }
for (i = 0; i < n; i++) { for (i = 0; i < num; i++) {
GLint list = translate_id(i, type, lists); GLint list = translate_id(i, type, lists);
Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2); Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2);
if (n) { if (n) {
@@ -1039,7 +1059,7 @@ _mesa_save_CallLists(GLsizei n, GLenum type, const GLvoid * lists)
invalidate_saved_current_state( ctx ); invalidate_saved_current_state( ctx );
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_CallLists(ctx->Exec, (n, type, lists)); CALL_CallLists(ctx->Exec, (num, type, lists));
} }
} }
@@ -1217,8 +1237,6 @@ save_ColorTable(GLenum target, GLenum internalFormat,
format, type, table)); format, type, table));
} }
else { else {
GLvoid *image = unpack_image(1, width, 1, 1, format, type, table,
&ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6); n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6);
@@ -1228,10 +1246,8 @@ save_ColorTable(GLenum target, GLenum internalFormat,
n[3].i = width; n[3].i = width;
n[4].e = format; n[4].e = format;
n[5].e = type; n[5].e = type;
n[6].data = image; n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, table,
} &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_ColorTable(ctx->Exec, (target, internalFormat, width, CALL_ColorTable(ctx->Exec, (target, internalFormat, width,
@@ -1307,8 +1323,6 @@ save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
GLenum format, GLenum type, const GLvoid * table) GLenum format, GLenum type, const GLvoid * table)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(1, count, 1, 1, format, type, table,
&ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6); n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6);
@@ -1318,10 +1332,8 @@ save_ColorSubTable(GLenum target, GLsizei start, GLsizei count,
n[3].i = count; n[3].i = count;
n[4].e = format; n[4].e = format;
n[5].e = type; n[5].e = type;
n[6].data = image; n[6].data = unpack_image(ctx, 1, count, 1, 1, format, type, table,
} &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_ColorSubTable(ctx->Exec, CALL_ColorSubTable(ctx->Exec,
@@ -1379,10 +1391,10 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
GLenum format, GLenum type, const GLvoid * filter) GLenum format, GLenum type, const GLvoid * filter)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter,
&ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6); n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6);
if (n) { if (n) {
n[1].e = target; n[1].e = target;
@@ -1390,10 +1402,8 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
n[3].i = width; n[3].i = width;
n[4].e = format; n[4].e = format;
n[5].e = type; n[5].e = type;
n[6].data = image; n[6].data = unpack_image(ctx, 1, width, 1, 1, format, type, filter,
} &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width, CALL_ConvolutionFilter1D(ctx->Exec, (target, internalFormat, width,
@@ -1408,10 +1418,10 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
GLenum type, const GLvoid * filter) GLenum type, const GLvoid * filter)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(2, width, height, 1, format, type, filter,
&ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7); n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7);
if (n) { if (n) {
n[1].e = target; n[1].e = target;
@@ -1420,10 +1430,8 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
n[4].i = height; n[4].i = height;
n[5].e = format; n[5].e = format;
n[6].e = type; n[6].e = type;
n[7].data = image; n[7].data = unpack_image(ctx, 2, width, height, 1, format, type, filter,
} &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_ConvolutionFilter2D(ctx->Exec, CALL_ConvolutionFilter2D(ctx->Exec,
@@ -1778,20 +1786,18 @@ save_DrawPixels(GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid * pixels) GLenum format, GLenum type, const GLvoid * pixels)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(2, width, height, 1, format, type,
pixels, &ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5); n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5);
if (n) { if (n) {
n[1].i = width; n[1].i = width;
n[2].i = height; n[2].i = height;
n[3].e = format; n[3].e = format;
n[4].e = type; n[4].e = type;
n[5].data = image; n[5].data = unpack_image(ctx, 2, width, height, 1, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels)); CALL_DrawPixels(ctx->Exec, (width, height, format, type, pixels));
@@ -1880,7 +1886,10 @@ save_Fogfv(GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_Fogf(GLenum pname, GLfloat param) save_Fogf(GLenum pname, GLfloat param)
{ {
save_Fogfv(pname, &param); GLfloat parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_Fogfv(pname, parray);
} }
@@ -1904,7 +1913,7 @@ save_Fogiv(GLenum pname, const GLint *params)
break; break;
default: default:
/* Error will be caught later in gl_Fogfv */ /* Error will be caught later in gl_Fogfv */
; ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
} }
save_Fogfv(pname, p); save_Fogfv(pname, p);
} }
@@ -1913,7 +1922,10 @@ save_Fogiv(GLenum pname, const GLint *params)
static void GLAPIENTRY static void GLAPIENTRY
save_Fogi(GLenum pname, GLint param) save_Fogi(GLenum pname, GLint param)
{ {
save_Fogiv(pname, &param); GLint parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0;
save_Fogiv(pname, parray);
} }
@@ -2077,9 +2089,12 @@ save_Lightfv(GLenum light, GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_Lightf(GLenum light, GLenum pname, GLfloat params) save_Lightf(GLenum light, GLenum pname, GLfloat param)
{ {
save_Lightfv(light, pname, &params); GLfloat parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_Lightfv(light, pname, parray);
} }
@@ -2125,7 +2140,10 @@ save_Lightiv(GLenum light, GLenum pname, const GLint *params)
static void GLAPIENTRY static void GLAPIENTRY
save_Lighti(GLenum light, GLenum pname, GLint param) save_Lighti(GLenum light, GLenum pname, GLint param)
{ {
save_Lightiv(light, pname, &param); GLint parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0;
save_Lightiv(light, pname, parray);
} }
@@ -2152,7 +2170,10 @@ save_LightModelfv(GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_LightModelf(GLenum pname, GLfloat param) save_LightModelf(GLenum pname, GLfloat param)
{ {
save_LightModelfv(pname, &param); GLfloat parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_LightModelfv(pname, parray);
} }
@@ -2174,7 +2195,7 @@ save_LightModeliv(GLenum pname, const GLint *params)
break; break;
default: default:
/* Error will be caught later in gl_LightModelfv */ /* Error will be caught later in gl_LightModelfv */
; ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
} }
save_LightModelfv(pname, fparam); save_LightModelfv(pname, fparam);
} }
@@ -2183,7 +2204,10 @@ save_LightModeliv(GLenum pname, const GLint *params)
static void GLAPIENTRY static void GLAPIENTRY
save_LightModeli(GLenum pname, GLint param) save_LightModeli(GLenum pname, GLint param)
{ {
save_LightModeliv(pname, &param); GLint parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0;
save_LightModeliv(pname, parray);
} }
@@ -2698,21 +2722,28 @@ save_PointParameterfvEXT(GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_PointParameterfEXT(GLenum pname, GLfloat param) save_PointParameterfEXT(GLenum pname, GLfloat param)
{ {
save_PointParameterfvEXT(pname, &param); GLfloat parray[3];
parray[0] = param;
parray[1] = parray[2] = 0.0F;
save_PointParameterfvEXT(pname, parray);
} }
static void GLAPIENTRY static void GLAPIENTRY
save_PointParameteriNV(GLenum pname, GLint param) save_PointParameteriNV(GLenum pname, GLint param)
{ {
GLfloat p = (GLfloat) param; GLfloat parray[3];
save_PointParameterfvEXT(pname, &p); parray[0] = (GLfloat) param;
parray[1] = parray[2] = 0.0F;
save_PointParameterfvEXT(pname, parray);
} }
static void GLAPIENTRY static void GLAPIENTRY
save_PointParameterivNV(GLenum pname, const GLint * param) save_PointParameterivNV(GLenum pname, const GLint * param)
{ {
GLfloat p = (GLfloat) param[0]; GLfloat parray[3];
save_PointParameterfvEXT(pname, &p); parray[0] = (GLfloat) param[0];
parray[1] = parray[2] = 0.0F;
save_PointParameterfvEXT(pname, parray);
} }
@@ -2753,16 +2784,14 @@ static void GLAPIENTRY
save_PolygonStipple(const GLubyte * pattern) save_PolygonStipple(const GLubyte * pattern)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
pattern, &ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1);
if (n) { if (n) {
n[1].data = image; n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
} pattern, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern)); CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
@@ -3386,7 +3415,10 @@ save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_TexEnvf(GLenum target, GLenum pname, GLfloat param) save_TexEnvf(GLenum target, GLenum pname, GLfloat param)
{ {
save_TexEnvfv(target, pname, &param); GLfloat parray[4];
parray[0] = (GLfloat) param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_TexEnvfv(target, pname, parray);
} }
@@ -3454,8 +3486,10 @@ save_TexGeniv(GLenum coord, GLenum pname, const GLint *params)
static void GLAPIENTRY static void GLAPIENTRY
save_TexGend(GLenum coord, GLenum pname, GLdouble param) save_TexGend(GLenum coord, GLenum pname, GLdouble param)
{ {
GLfloat p = (GLfloat) param; GLfloat parray[4];
save_TexGenfv(coord, pname, &p); parray[0] = (GLfloat) param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_TexGenfv(coord, pname, parray);
} }
@@ -3474,14 +3508,20 @@ save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params)
static void GLAPIENTRY static void GLAPIENTRY
save_TexGenf(GLenum coord, GLenum pname, GLfloat param) save_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{ {
save_TexGenfv(coord, pname, &param); GLfloat parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_TexGenfv(coord, pname, parray);
} }
static void GLAPIENTRY static void GLAPIENTRY
save_TexGeni(GLenum coord, GLenum pname, GLint param) save_TexGeni(GLenum coord, GLenum pname, GLint param)
{ {
save_TexGeniv(coord, pname, &param); GLint parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0;
save_TexGeniv(coord, pname, parray);
} }
@@ -3509,7 +3549,10 @@ save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
static void GLAPIENTRY static void GLAPIENTRY
save_TexParameterf(GLenum target, GLenum pname, GLfloat param) save_TexParameterf(GLenum target, GLenum pname, GLfloat param)
{ {
save_TexParameterfv(target, pname, &param); GLfloat parray[4];
parray[0] = param;
parray[1] = parray[2] = parray[3] = 0.0F;
save_TexParameterfv(target, pname, parray);
} }
@@ -3546,8 +3589,6 @@ save_TexImage1D(GLenum target,
border, format, type, pixels)); border, format, type, pixels));
} }
else { else {
GLvoid *image = unpack_image(1, width, 1, 1, format, type,
pixels, &ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8);
@@ -3559,10 +3600,8 @@ save_TexImage1D(GLenum target,
n[5].i = border; n[5].i = border;
n[6].e = format; n[6].e = format;
n[7].e = type; n[7].e = type;
n[8].data = image; n[8].data = unpack_image(ctx, 1, width, 1, 1, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexImage1D(ctx->Exec, (target, level, components, width, CALL_TexImage1D(ctx->Exec, (target, level, components, width,
@@ -3585,8 +3624,6 @@ save_TexImage2D(GLenum target,
height, border, format, type, pixels)); height, border, format, type, pixels));
} }
else { else {
GLvoid *image = unpack_image(2, width, height, 1, format, type,
pixels, &ctx->Unpack);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9);
@@ -3599,10 +3636,8 @@ save_TexImage2D(GLenum target,
n[6].i = border; n[6].i = border;
n[7].e = format; n[7].e = format;
n[8].e = type; n[8].e = type;
n[9].data = image; n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexImage2D(ctx->Exec, (target, level, components, width, CALL_TexImage2D(ctx->Exec, (target, level, components, width,
@@ -3628,8 +3663,6 @@ save_TexImage3D(GLenum target,
} }
else { else {
Node *n; Node *n;
GLvoid *image = unpack_image(3, width, height, depth, format, type,
pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10);
if (n) { if (n) {
@@ -3642,10 +3675,8 @@ save_TexImage3D(GLenum target,
n[7].i = border; n[7].i = border;
n[8].e = format; n[8].e = format;
n[9].e = type; n[9].e = type;
n[10].data = image; n[10].data = unpack_image(ctx, 3, width, height, depth, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width, CALL_TexImage3D(ctx->Exec, (target, level, internalFormat, width,
@@ -3663,9 +3694,9 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
GLvoid *image = unpack_image(1, width, 1, 1, format, type,
pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7);
if (n) { if (n) {
n[1].e = target; n[1].e = target;
@@ -3674,10 +3705,8 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset,
n[4].i = (GLint) width; n[4].i = (GLint) width;
n[5].e = format; n[5].e = format;
n[6].e = type; n[6].e = type;
n[7].data = image; n[7].data = unpack_image(ctx, 1, width, 1, 1, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width, CALL_TexSubImage1D(ctx->Exec, (target, level, xoffset, width,
@@ -3694,9 +3723,9 @@ save_TexSubImage2D(GLenum target, GLint level,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
GLvoid *image = unpack_image(2, width, height, 1, format, type,
pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9);
if (n) { if (n) {
n[1].e = target; n[1].e = target;
@@ -3707,10 +3736,8 @@ save_TexSubImage2D(GLenum target, GLint level,
n[6].i = (GLint) height; n[6].i = (GLint) height;
n[7].e = format; n[7].e = format;
n[8].e = type; n[8].e = type;
n[9].data = image; n[9].data = unpack_image(ctx, 2, width, height, 1, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset, CALL_TexSubImage2D(ctx->Exec, (target, level, xoffset, yoffset,
@@ -3727,9 +3754,9 @@ save_TexSubImage3D(GLenum target, GLint level,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
GLvoid *image = unpack_image(3, width, height, depth, format, type,
pixels, &ctx->Unpack);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11); n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11);
if (n) { if (n) {
n[1].e = target; n[1].e = target;
@@ -3742,10 +3769,8 @@ save_TexSubImage3D(GLenum target, GLint level,
n[8].i = (GLint) depth; n[8].i = (GLint) depth;
n[9].e = format; n[9].e = format;
n[10].e = type; n[10].e = type;
n[11].data = image; n[11].data = unpack_image(ctx, 3, width, height, depth, format, type,
} pixels, &ctx->Unpack);
else if (image) {
_mesa_free(image);
} }
if (ctx->ExecuteFlag) { if (ctx->ExecuteFlag) {
CALL_TexSubImage3D(ctx->Exec, (target, level, CALL_TexSubImage3D(ctx->Exec, (target, level,
@@ -4458,18 +4483,17 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
GLubyte *programCopy;
programCopy = (GLubyte *) _mesa_malloc(len); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
if (n) {
GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
if (!programCopy) { if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return; return;
} }
_mesa_memcpy(programCopy, program, len); _mesa_memcpy(programCopy, program, len);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
if (n) {
n[1].e = target; n[1].e = target;
n[2].ui = id; n[2].ui = id;
n[3].i = len; n[3].i = len;
@@ -4486,15 +4510,17 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2);
if (n) {
GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
if (!idCopy) { if (!idCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
return; return;
} }
_mesa_memcpy(idCopy, ids, num * sizeof(GLuint)); _mesa_memcpy(idCopy, ids, num * sizeof(GLuint));
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2);
if (n) {
n[1].i = num; n[1].i = num;
n[2].data = idCopy; n[2].data = idCopy;
} }
@@ -4655,16 +4681,17 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
if (n) {
GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
if (!nameCopy) { if (!nameCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
return; return;
} }
_mesa_memcpy(nameCopy, name, len); _mesa_memcpy(nameCopy, name, len);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
if (n) {
n[1].ui = id; n[1].ui = id;
n[2].i = len; n[2].i = len;
n[3].data = nameCopy; n[3].data = nameCopy;
@@ -4753,18 +4780,17 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
{ {
GET_CURRENT_CONTEXT(ctx); GET_CURRENT_CONTEXT(ctx);
Node *n; Node *n;
GLubyte *programCopy;
programCopy = (GLubyte *) _mesa_malloc(len); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
if (n) {
GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
if (!programCopy) { if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return; return;
} }
_mesa_memcpy(programCopy, string, len); _mesa_memcpy(programCopy, string, len);
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
if (n) {
n[1].e = target; n[1].e = target;
n[2].e = format; n[2].e = format;
n[3].i = len; n[3].i = len;

View File

@@ -417,21 +417,22 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
if (format == GL_COLOR) { if (format == GL_COLOR) {
if (att->Renderbuffer->_BaseFormat != GL_RGB && if (att->Renderbuffer->_BaseFormat != GL_RGB &&
att->Renderbuffer->_BaseFormat != GL_RGBA) { att->Renderbuffer->_BaseFormat != GL_RGBA) {
ASSERT(att->Renderbuffer->RedBits);
ASSERT(att->Renderbuffer->GreenBits);
ASSERT(att->Renderbuffer->BlueBits);
att_incomplete("bad renderbuffer color format"); att_incomplete("bad renderbuffer color format");
att->Complete = GL_FALSE; att->Complete = GL_FALSE;
return; return;
} }
ASSERT(att->Renderbuffer->RedBits);
ASSERT(att->Renderbuffer->GreenBits);
ASSERT(att->Renderbuffer->BlueBits);
} }
else if (format == GL_DEPTH) { else if (format == GL_DEPTH) {
ASSERT(att->Renderbuffer->DepthBits);
if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) { if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) {
ASSERT(att->Renderbuffer->DepthBits);
/* OK */ /* OK */
} }
else if (ctx->Extensions.EXT_packed_depth_stencil && else if (ctx->Extensions.EXT_packed_depth_stencil &&
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
ASSERT(att->Renderbuffer->DepthBits);
/* OK */ /* OK */
} }
else { else {
@@ -442,12 +443,13 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
} }
else { else {
assert(format == GL_STENCIL); assert(format == GL_STENCIL);
ASSERT(att->Renderbuffer->StencilBits);
if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) { if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) {
ASSERT(att->Renderbuffer->StencilBits);
/* OK */ /* OK */
} }
else if (ctx->Extensions.EXT_packed_depth_stencil && else if (ctx->Extensions.EXT_packed_depth_stencil &&
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
ASSERT(att->Renderbuffer->StencilBits);
/* OK */ /* OK */
} }
else { else {

View File

@@ -67,7 +67,7 @@ _mesa_Fogiv(GLenum pname, const GLint *params )
break; break;
default: default:
/* Error will be caught later in _mesa_Fogfv */ /* Error will be caught later in _mesa_Fogfv */
; ASSIGN_4V(p, 0.0F, 0.0F, 0.0F, 0.0F);
} }
_mesa_Fogfv(pname, p); _mesa_Fogfv(pname, p);
} }

View File

@@ -528,7 +528,7 @@ _mesa_LightModeliv( GLenum pname, const GLint *params )
break; break;
default: default:
/* Error will be caught later in gl_LightModelfv */ /* Error will be caught later in gl_LightModelfv */
; ASSIGN_4V(fparam, 0.0F, 0.0F, 0.0F, 0.0F);
} }
_mesa_LightModelfv( pname, fparam ); _mesa_LightModelfv( pname, fparam );
} }
@@ -1256,15 +1256,15 @@ _mesa_update_tnl_spaces( GLcontext *ctx, GLuint new_state )
ctx->Driver.LightingSpaceChange( ctx ); ctx->Driver.LightingSpaceChange( ctx );
} }
else { else {
GLuint new_state = ctx->NewState; GLuint new_state2 = ctx->NewState;
/* Recalculate that same state only if it has been invalidated /* Recalculate that same state only if it has been invalidated
* by other statechanges. * by other statechanges.
*/ */
if (new_state & _NEW_MODELVIEW) if (new_state2 & _NEW_MODELVIEW)
update_modelview_scale(ctx); update_modelview_scale(ctx);
if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW)) if (new_state2 & (_NEW_LIGHT|_NEW_MODELVIEW))
compute_light_positions( ctx ); compute_light_positions( ctx );
} }
} }

View File

@@ -885,7 +885,7 @@ _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
static struct gl_program_parameter * static struct gl_program_parameter *
get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index) get_uniform_parameter(const struct gl_shader_program *shProg, GLuint index)
{ {
const struct gl_program *prog; const struct gl_program *prog = NULL;
GLint progPos; GLint progPos;
progPos = shProg->Uniforms->Uniforms[index].VertPos; progPos = shProg->Uniforms->Uniforms[index].VertPos;
@@ -915,7 +915,7 @@ _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
GLenum *type, GLchar *nameOut) GLenum *type, GLchar *nameOut)
{ {
const struct gl_shader_program *shProg; const struct gl_shader_program *shProg;
const struct gl_program *prog; const struct gl_program *prog = NULL;
const struct gl_program_parameter *param; const struct gl_program_parameter *param;
GLint progPos; GLint progPos;