updated mesa to 7.4.4

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31289 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2009-06-28 13:40:23 +00:00
parent 2688837424
commit 590a78c63a
15 changed files with 186 additions and 46 deletions
+29 -12
View File
@@ -1549,6 +1549,24 @@ initialize_framebuffer_size(GLcontext *ctx, GLframebuffer *fb)
} }
/**
* Check if the viewport/scissor size has not yet been initialized.
* Initialize the size if the given width and height are non-zero.
*/
void
_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height)
{
if (!ctx->ViewportInitialized && width > 0 && height > 0) {
/* Note: set flag here, before calling _mesa_set_viewport(), to prevent
* potential infinite recursion.
*/
ctx->ViewportInitialized = GL_TRUE;
_mesa_set_viewport(ctx, 0, 0, width, height);
_mesa_set_scissor(ctx, 0, 0, width, height);
}
}
/** /**
* Bind the given context to the given drawBuffer and readBuffer and * Bind the given context to the given drawBuffer and readBuffer and
* make it the current context for the calling thread. * make it the current context for the calling thread.
@@ -1651,25 +1669,24 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
ASSERT(drawBuffer->Height > 0); ASSERT(drawBuffer->Height > 0);
#endif #endif
if (newCtx->FirstTimeCurrent) { if (drawBuffer) {
/* set initial viewport and scissor size now */ _mesa_check_init_viewport(newCtx,
_mesa_set_viewport(newCtx, 0, 0, drawBuffer->Width, drawBuffer->Height);
drawBuffer->Width, drawBuffer->Height);
_mesa_set_scissor(newCtx, 0, 0,
drawBuffer->Width, drawBuffer->Height );
check_context_limits(newCtx);
} }
} }
/* We can use this to help debug user's problems. Tell them to set
* the MESA_INFO env variable before running their app. Then the
* first time each context is made current we'll print some useful
* information.
*/
if (newCtx->FirstTimeCurrent) { if (newCtx->FirstTimeCurrent) {
check_context_limits(newCtx);
/* We can use this to help debug user's problems. Tell them to set
* the MESA_INFO env variable before running their app. Then the
* first time each context is made current we'll print some useful
* information.
*/
if (_mesa_getenv("MESA_INFO")) { if (_mesa_getenv("MESA_INFO")) {
_mesa_print_info(); _mesa_print_info();
} }
newCtx->FirstTimeCurrent = GL_FALSE; newCtx->FirstTimeCurrent = GL_FALSE;
} }
} }
+3
View File
@@ -132,6 +132,9 @@ extern void
_mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer, _mesa_make_current( GLcontext *ctx, GLframebuffer *drawBuffer,
GLframebuffer *readBuffer ); GLframebuffer *readBuffer );
extern void
_mesa_check_init_viewport(GLcontext *ctx, GLuint width, GLuint height);
extern GLboolean extern GLboolean
_mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare); _mesa_share_state(GLcontext *ctx, GLcontext *ctxToShare);
+13 -3
View File
@@ -323,6 +323,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
/* OK */ /* OK */
} }
else if (ctx->Extensions.EXT_packed_depth_stencil && else if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */ /* OK */
} }
@@ -332,9 +333,18 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
} }
} }
else { else {
/* no such thing as stencil textures */ ASSERT(format == GL_STENCIL);
att->Complete = GL_FALSE; ASSERT(att->Renderbuffer->StencilBits);
return; if (ctx->Extensions.EXT_packed_depth_stencil &&
ctx->Extensions.ARB_depth_texture &&
att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) {
/* OK */
}
else {
/* no such thing as stencil-only textures */
att->Complete = GL_FALSE;
return;
}
} }
} }
else if (att->Type == GL_RENDERBUFFER_EXT) { else if (att->Type == GL_RENDERBUFFER_EXT) {
+12
View File
@@ -1905,6 +1905,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
CHECK_EXT1(ARB_shader_objects, "GetBooleanv"); CHECK_EXT1(ARB_shader_objects, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); params[0] = INT_TO_BOOLEAN(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
break; break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetBooleanv");
params[0] = INT_TO_BOOLEAN(ctx->Array.ArrayObj->Name);
break;
default: default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
} }
@@ -3753,6 +3757,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
CHECK_EXT1(ARB_shader_objects, "GetFloatv"); CHECK_EXT1(ARB_shader_objects, "GetFloatv");
params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); params[0] = (GLfloat)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0);
break; break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetFloatv");
params[0] = (GLfloat)(ctx->Array.ArrayObj->Name);
break;
default: default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname);
} }
@@ -5601,6 +5609,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
CHECK_EXT1(ARB_shader_objects, "GetIntegerv"); CHECK_EXT1(ARB_shader_objects, "GetIntegerv");
params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0;
break; break;
case GL_VERTEX_ARRAY_BINDING_APPLE:
CHECK_EXT1(APPLE_vertex_array_object, "GetIntegerv");
params[0] = ctx->Array.ArrayObj->Name;
break;
default: default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
} }
+25 -15
View File
@@ -1,8 +1,9 @@
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 7.1 * Version: 7.5
* *
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -738,12 +739,20 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
GLint width, GLint height, GLint width, GLint height,
GLenum format, GLenum type ) GLenum format, GLenum type )
{ {
ASSERT(packing); GLint bytesPerRow, bytesPerImage, remainder;
ASSERT(type != GL_BITMAP);
{ ASSERT(packing);
if (type == GL_BITMAP) {
if (packing->RowLength == 0) {
bytesPerRow = (width + 7) / 8;
}
else {
bytesPerRow = (packing->RowLength + 7) / 8;
}
}
else {
const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type);
GLint bytesPerRow, bytesPerImage, remainder;
if (bytesPerPixel <= 0) if (bytesPerPixel <= 0)
return -1; /* error */ return -1; /* error */
@@ -753,17 +762,18 @@ _mesa_image_image_stride( const struct gl_pixelstore_attrib *packing,
else { else {
bytesPerRow = bytesPerPixel * packing->RowLength; bytesPerRow = bytesPerPixel * packing->RowLength;
} }
remainder = bytesPerRow % packing->Alignment;
if (remainder > 0)
bytesPerRow += (packing->Alignment - remainder);
if (packing->ImageHeight == 0)
bytesPerImage = bytesPerRow * height;
else
bytesPerImage = bytesPerRow * packing->ImageHeight;
return bytesPerImage;
} }
remainder = bytesPerRow % packing->Alignment;
if (remainder > 0)
bytesPerRow += (packing->Alignment - remainder);
if (packing->ImageHeight == 0)
bytesPerImage = bytesPerRow * height;
else
bytesPerImage = bytesPerRow * packing->ImageHeight;
return bytesPerImage;
} }
+2 -2
View File
@@ -580,8 +580,8 @@ _mesa_set_viewport( GLcontext *ctx, GLint x, GLint y,
} }
/* clamp width and height to the implementation dependent range */ /* clamp width and height to the implementation dependent range */
width = CLAMP(width, 1, (GLsizei) ctx->Const.MaxViewportWidth); width = MIN2(width, (GLsizei) ctx->Const.MaxViewportWidth);
height = CLAMP(height, 1, (GLsizei) ctx->Const.MaxViewportHeight); height = MIN2(height, (GLsizei) ctx->Const.MaxViewportHeight);
ctx->Viewport.X = x; ctx->Viewport.X = x;
ctx->Viewport.Width = width; ctx->Viewport.Width = width;
+2
View File
@@ -3063,6 +3063,8 @@ struct __GLcontextRec
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */ GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
GLboolean ViewportInitialized; /**< has viewport size been initialized? */
/** \name Derived state */ /** \name Derived state */
/*@{*/ /*@{*/
/** Bitwise-or of DD_* flags. Note that this bitfield may be used before /** Bitwise-or of DD_* flags. Note that this bitfield may be used before
+1 -1
View File
@@ -157,7 +157,7 @@ update_arrays( GLcontext *ctx )
/* 16..31 */ /* 16..31 */
if (ctx->VertexProgram._Current) { if (ctx->VertexProgram._Current) {
for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) { for (i = 0; i < Elements(ctx->Array.ArrayObj->VertexAttrib); i++) {
if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) { if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {
min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement); min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);
} }
+1
View File
@@ -507,6 +507,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att)
trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits; trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits;
trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits; trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits;
trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits; trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits;
trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits;
} }
+1 -2
View File
@@ -429,7 +429,7 @@ texture_override(GLcontext *ctx,
} }
if (texObj->_Complete) { if (texObj->_Complete) {
texUnit->_ReallyEnabled = textureBit; texUnit->_ReallyEnabled = textureBit;
texUnit->_Current = texObj; _mesa_reference_texobj(&texUnit->_Current, texObj);
update_texture_compare_function(ctx, texObj); update_texture_compare_function(ctx, texObj);
} }
} }
@@ -485,7 +485,6 @@ update_texture_state( GLcontext *ctx )
GLbitfield enableBits; GLbitfield enableBits;
GLuint tex; GLuint tex;
texUnit->_Current = NULL;
texUnit->_ReallyEnabled = 0; texUnit->_ReallyEnabled = 0;
texUnit->_GenFlags = 0; texUnit->_GenFlags = 0;
+3 -3
View File
@@ -1,6 +1,6 @@
/* /*
* Mesa 3-D graphics library * Mesa 3-D graphics library
* Version: 7.4.2 * Version: 7.4.4
* *
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
* Copyright (C) 2009 VMware, Inc. All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
@@ -31,8 +31,8 @@
/* Mesa version */ /* Mesa version */
#define MESA_MAJOR 7 #define MESA_MAJOR 7
#define MESA_MINOR 4 #define MESA_MINOR 4
#define MESA_PATCH 2 #define MESA_PATCH 4
#define MESA_VERSION_STRING "7.4.2" #define MESA_VERSION_STRING "7.4.4"
/* To make version comparison easy */ /* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
@@ -1041,11 +1041,11 @@ preprocess_source (slang_string *output, const char *source,
/* Parse optional macro parameters. */ /* Parse optional macro parameters. */
while (prod[i++] != PARAM_END) { while (prod[i++] != PARAM_END) {
if (state.cond.top->effective) { pp_symbol *param;
pp_symbol *param;
id = (const char *) (&prod[i]); id = (const char *) (&prod[i]);
idlen = _mesa_strlen (id); idlen = _mesa_strlen (id);
if (state.cond.top->effective) {
pp_annotate (output, "%s, ", id); pp_annotate (output, "%s, ", id);
param = pp_symbols_push (&symbol->parameters); param = pp_symbols_push (&symbol->parameters);
if (param == NULL) if (param == NULL)
@@ -1059,8 +1059,23 @@ preprocess_source (slang_string *output, const char *source,
id = (const char *) (&prod[i]); id = (const char *) (&prod[i]);
idlen = _mesa_strlen (id); idlen = _mesa_strlen (id);
if (state.cond.top->effective) { if (state.cond.top->effective) {
slang_string replacement;
expand_state es;
pp_annotate (output, ") %s", id); pp_annotate (output, ") %s", id);
slang_string_pushs (&symbol->replacement, id, idlen);
slang_string_init(&replacement);
slang_string_pushs(&replacement, id, idlen);
/* Expand macro replacement. */
es.output = &symbol->replacement;
es.input = slang_string_cstr(&replacement);
es.state = &state;
if (!expand(&es, &state.symbols)) {
slang_string_free(&replacement);
goto error;
}
slang_string_free(&replacement);
} }
i += idlen + 1; i += idlen + 1;
} }
@@ -1291,6 +1306,45 @@ error:
} }
/**
* Remove the continuation characters from the input string.
* This is the very first step in preprocessing and is effective
* even inside comment blocks.
* If there is a whitespace between a backslash and a newline,
* this is not considered as a line continuation.
* \return GL_TRUE for success, GL_FALSE otherwise.
*/
static GLboolean
_slang_preprocess_backslashes(slang_string *output,
const char *input)
{
while (*input) {
if (input[0] == '\\') {
/* If a newline follows, eat the backslash and the newline. */
if (input[1] == '\r') {
if (input[2] == '\n') {
input += 3;
} else {
input += 2;
}
} else if (input[1] == '\n') {
if (input[2] == '\r') {
input += 3;
} else {
input += 2;
}
} else {
/* Leave the backslash alone. */
slang_string_pushc(output, *input++);
}
} else {
slang_string_pushc(output, *input++);
}
}
return GL_TRUE;
}
/** /**
* Run preprocessor on source code. * Run preprocessor on source code.
* \param extensions indicates which GL extensions are enabled * \param extensions indicates which GL extensions are enabled
@@ -1308,6 +1362,7 @@ _slang_preprocess_directives(slang_string *output,
{ {
grammar pid, eid; grammar pid, eid;
GLboolean success; GLboolean success;
slang_string without_backslashes;
pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn)); pid = grammar_load_from_text ((const byte *) (slang_pp_directives_syn));
if (pid == 0) { if (pid == 0) {
@@ -1320,9 +1375,36 @@ _slang_preprocess_directives(slang_string *output,
grammar_destroy (pid); grammar_destroy (pid);
return GL_FALSE; return GL_FALSE;
} }
success = preprocess_source (output, input, pid, eid, elog, extensions, pragmas);
slang_string_init(&without_backslashes);
success = _slang_preprocess_backslashes(&without_backslashes, input);
if (0) {
_mesa_printf("Pre-processed shader:\n");
_mesa_printf("%s", slang_string_cstr(&without_backslashes));
_mesa_printf("----------------------\n");
}
if (success) {
success = preprocess_source(output,
slang_string_cstr(&without_backslashes),
pid,
eid,
elog,
extensions,
pragmas);
}
slang_string_free(&without_backslashes);
grammar_destroy (eid); grammar_destroy (eid);
grammar_destroy (pid); grammar_destroy (pid);
if (0) {
_mesa_printf("Post-processed shader:\n");
_mesa_printf("%s", slang_string_cstr(output));
_mesa_printf("----------------------\n");
}
return success; return success;
} }
+1 -1
View File
@@ -226,7 +226,7 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
* If A is a signed integer, A % B doesn't give the right value for A < 0 * If A is a signed integer, A % B doesn't give the right value for A < 0
* (in terms of texture repeat). Just casting to unsigned fixes that. * (in terms of texture repeat). Just casting to unsigned fixes that.
*/ */
#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B)) #define REMAINDER(A, B) (((A) + (B) * 1024) % (B))
/** /**
+4 -1
View File
@@ -114,8 +114,11 @@ static void bind_array_obj( GLcontext *ctx )
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i]; exec->array.legacy_array[VERT_ATTRIB_TEX0 + i] = &ctx->Array.ArrayObj->TexCoord[i];
for (i = 0; i < VERT_ATTRIB_MAX; i++) for (i = 0; i < MAX_VERTEX_ATTRIBS; i++) {
assert(i < Elements(ctx->Array.ArrayObj->VertexAttrib));
assert(i < Elements(exec->array.generic_array));
exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i]; exec->array.generic_array[i] = &ctx->Array.ArrayObj->VertexAttrib[i];
}
exec->array.array_obj = ctx->Array.ArrayObj->Name; exec->array.array_obj = ctx->Array.ArrayObj->Name;
} }
+1
View File
@@ -184,6 +184,7 @@ static void vbo_exec_bind_arrays( GLcontext *ctx )
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) { (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
exec->vtx.inputs[16] = exec->vtx.inputs[0]; exec->vtx.inputs[16] = exec->vtx.inputs[0];
exec->vtx.attrsz[16] = exec->vtx.attrsz[0]; exec->vtx.attrsz[16] = exec->vtx.attrsz[0];
exec->vtx.attrptr[16] = exec->vtx.attrptr[0];
exec->vtx.attrsz[0] = 0; exec->vtx.attrsz[0] = 0;
} }
break; break;