Merge branch 'master' into gallium-0.2

Conflicts:

	src/mesa/glapi/glapi.h
	src/mesa/main/api_exec.c
	src/mesa/main/attrib.c
	src/mesa/main/clear.c
	src/mesa/main/context.c
	src/mesa/main/mfeatures.h
	src/mesa/main/mipmap.c
	src/mesa/main/mipmap.h
	src/mesa/main/readpix.c
	src/mesa/main/sources
	src/mesa/main/state.c
	src/mesa/main/texformat.c
	src/mesa/main/texparam.c
	src/mesa/main/texstate.c
	src/mesa/vbo/vbo_context.c
	src/mesa/x86/common_x86_asm.S
This commit is contained in:
Keith Whitwell
2008-09-21 22:30:55 -07:00
16 changed files with 101 additions and 89 deletions

View File

@@ -35,6 +35,7 @@
#include "main/enums.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "shader/prog_statevars.h"
#include "brw_vs.h"
#include "brw_state.h"
@@ -853,7 +854,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
*/
if (!p->state->unit[i].light_spotcutoff_is_180) {
struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
STATE_SPOT_DIR_NORMALIZED, i);
STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
struct ureg spot = get_temp(p);
struct ureg slt = get_temp(p);
@@ -988,7 +989,7 @@ static void build_lighting( struct tnl_program *p )
* Attenuation never applies to infinite lights.
*/
VPpli = register_param3(p, STATE_LIGHT, i,
STATE_POSITION_NORMALIZED);
STATE_LIGHT_POSITION_NORMALIZED);
if (p->state->light_local_viewer) {
struct ureg eye_hat = get_eye_position_normalized(p);
half = get_temp(p);

View File

@@ -74,7 +74,7 @@
#include "eval.h"
#endif
#include "get.h"
#if FEATURE_feedback
#if FEATURE_feadback
#include "feedback.h"
#endif
#include "fog.h"
@@ -222,7 +222,7 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_CopyPixels(exec, _mesa_CopyPixels);
SET_DrawPixels(exec, _mesa_DrawPixels);
#endif
#if FEATURE_feedback
#if FEATURE_feadback
SET_InitNames(exec, _mesa_InitNames);
SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
SET_LoadName(exec, _mesa_LoadName);

View File

@@ -1110,9 +1110,9 @@ _mesa_PopAttrib(void)
_mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite);
if (ctx->Extensions.NV_point_sprite)
_mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV,
ctx->Point.SpriteRMode);
ctx->Point.SpriteRMode);
_mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN,
(GLfloat)ctx->Point.SpriteOrigin);
(GLfloat)ctx->Point.SpriteOrigin);
}
}
break;

View File

@@ -114,6 +114,8 @@ _mesa_Clear( GLbitfield mask )
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
FLUSH_CURRENT(ctx, 0);
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glClear 0x%x\n", mask);

View File

@@ -44,7 +44,6 @@
#define FEATURE_dlist _HAVE_FULL_GL
#define FEATURE_draw_read_buffer _HAVE_FULL_GL
#define FEATURE_drawpix _HAVE_FULL_GL
#define FEATURE_es2_glsl 0
#define FEATURE_evaluators _HAVE_FULL_GL
#define FEATURE_feedback _HAVE_FULL_GL
#define FEATURE_fixedpt 0
@@ -56,6 +55,8 @@
#define FEATURE_texture_s3tc _HAVE_FULL_GL
#define FEATURE_userclip _HAVE_FULL_GL
#define FEATURE_vertex_array_byte 0
#define FEATURE_windowpos _HAVE_FULL_GL
#define FEATURE_es2_glsl 0
#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL
#define FEATURE_ARB_fragment_program _HAVE_FULL_GL

View File

@@ -446,30 +446,23 @@ make_1d_mipmap(GLenum datatype, GLuint comps, GLint border,
}
/**
* Strides are in bytes. If zero, it'll be computed as width * bpp.
*/
static void
make_2d_mipmap(GLenum datatype, GLuint comps, GLint border,
GLint srcWidth, GLint srcHeight,
GLint srcRowBytes, const GLubyte *srcPtr,
const GLubyte *srcPtr, GLint srcRowStride,
GLint dstWidth, GLint dstHeight,
GLint dstRowBytes, GLubyte *dstPtr)
GLubyte *dstPtr, GLint dstRowStride)
{
const GLint bpt = bytes_per_pixel(datatype, comps);
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
const GLint dstWidthNB = dstWidth - 2 * border;
const GLint dstHeightNB = dstHeight - 2 * border;
const GLint srcRowBytes = bpt * srcRowStride;
const GLint dstRowBytes = bpt * dstRowStride;
const GLubyte *srcA, *srcB;
GLubyte *dst;
GLint row;
if (!srcRowBytes)
srcRowBytes = bpt * srcWidth;
if (!dstRowBytes)
dstRowBytes = bpt * dstWidth;
/* Compute src and dst pointers, skipping any border */
srcA = srcPtr + border * ((srcWidth + 1) * bpt);
if (srcHeight > 1)
@@ -541,11 +534,9 @@ make_2d_mipmap(GLenum datatype, GLuint comps, GLint border,
static void
make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint srcRowBytes,
const GLubyte *srcPtr,
const GLubyte *srcPtr, GLint srcRowStride,
GLint dstWidth, GLint dstHeight, GLint dstDepth,
GLint dstRowBytes,
GLubyte *dstPtr)
GLubyte *dstPtr, GLint dstRowStride)
{
const GLint bpt = bytes_per_pixel(datatype, comps);
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
@@ -556,6 +547,7 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
GLvoid *tmpRowA, *tmpRowB;
GLint img, row;
GLint bytesPerSrcImage, bytesPerDstImage;
GLint bytesPerSrcRow, bytesPerDstRow;
GLint srcImageOffset, srcRowOffset;
(void) srcDepthNB; /* silence warnings */
@@ -573,10 +565,8 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
bytesPerSrcImage = srcWidth * srcHeight * bpt;
bytesPerDstImage = dstWidth * dstHeight * bpt;
if (!srcRowBytes)
srcRowBytes = srcWidth * bpt;
if (!dstRowBytes)
dstRowBytes = dstWidth * bpt;
bytesPerSrcRow = srcWidth * bpt;
bytesPerDstRow = dstWidth * bpt;
/* Offset between adjacent src images to be averaged together */
srcImageOffset = (srcDepth == dstDepth) ? 0 : bytesPerSrcImage;
@@ -600,13 +590,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
for (img = 0; img < dstDepthNB; img++) {
/* first source image pointer, skipping border */
const GLubyte *imgSrcA = srcPtr
+ (bytesPerSrcImage + srcRowBytes + border) * bpt * border
+ (bytesPerSrcImage + bytesPerSrcRow + border) * bpt * border
+ img * (bytesPerSrcImage + srcImageOffset);
/* second source image pointer, skipping border */
const GLubyte *imgSrcB = imgSrcA + srcImageOffset;
/* address of the dest image, skipping border */
GLubyte *imgDst = dstPtr
+ (bytesPerDstImage + dstRowBytes + border) * bpt * border
+ (bytesPerDstImage + bytesPerDstRow + border) * bpt * border
+ img * bytesPerDstImage;
/* setup the four source row pointers and the dest row pointer */
@@ -627,11 +617,11 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
do_row(datatype, comps, srcWidthNB, tmpRowA, tmpRowB,
dstWidthNB, dstImgRow);
/* advance to next rows */
srcImgARowA += srcRowBytes + srcRowOffset;
srcImgARowB += srcRowBytes + srcRowOffset;
srcImgBRowA += srcRowBytes + srcRowOffset;
srcImgBRowB += srcRowBytes + srcRowOffset;
dstImgRow += dstRowBytes;
srcImgARowA += bytesPerSrcRow + srcRowOffset;
srcImgARowB += bytesPerSrcRow + srcRowOffset;
srcImgBRowA += bytesPerSrcRow + srcRowOffset;
srcImgBRowB += bytesPerSrcRow + srcRowOffset;
dstImgRow += bytesPerDstRow;
}
}
@@ -641,15 +631,13 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
/* Luckily we can leverage the make_2d_mipmap() function here! */
if (border > 0) {
/* do front border image */
make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, 0, srcPtr,
dstWidth, dstHeight, 0, dstPtr);
make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight, srcPtr, srcRowStride,
dstWidth, dstHeight, dstPtr, dstRowStride);
/* do back border image */
make_2d_mipmap(datatype, comps, 1, srcWidth, srcHeight,
0,
srcPtr + bytesPerSrcImage * (srcDepth - 1),
srcPtr + bytesPerSrcImage * (srcDepth - 1), srcRowStride,
dstWidth, dstHeight,
0,
dstPtr + bytesPerDstImage * (dstDepth - 1));
dstPtr + bytesPerDstImage * (dstDepth - 1), dstRowStride);
/* do four remaining border edges that span the image slices */
if (srcDepth == dstDepth) {
/* just copy border pixels from src to dst */
@@ -664,9 +652,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
/* do border along [img][row=dstHeight-1][col=0] */
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ (srcHeight - 1) * srcRowBytes;
+ (srcHeight - 1) * bytesPerSrcRow;
dst = dstPtr + (img + 1) * bytesPerDstImage
+ (dstHeight - 1) * dstRowBytes;
+ (dstHeight - 1) * bytesPerDstRow;
MEMCPY(dst, src, bpt);
/* do border along [img][row=0][col=dstWidth-1] */
@@ -698,9 +686,9 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
/* do border along [img][row=dstHeight-1][col=0] */
src = srcPtr + (img * 2 + 1) * bytesPerSrcImage
+ (srcHeight - 1) * srcRowBytes;
+ (srcHeight - 1) * bytesPerSrcRow;
dst = dstPtr + (img + 1) * bytesPerDstImage
+ (dstHeight - 1) * dstRowBytes;
+ (dstHeight - 1) * bytesPerDstRow;
do_row(datatype, comps, 1, src, src + srcImageOffset, 1, dst);
/* do border along [img][row=0][col=dstWidth-1] */
@@ -724,15 +712,16 @@ make_3d_mipmap(GLenum datatype, GLuint comps, GLint border,
static void
make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
GLint srcWidth, const GLubyte *srcPtr,
GLint dstWidth, GLint dstHeight, GLubyte *dstPtr)
GLint srcWidth, const GLubyte *srcPtr, GLuint srcRowStride,
GLint dstWidth, GLint dstHeight,
GLubyte *dstPtr, GLuint dstRowStride )
{
const GLint bpt = bytes_per_pixel(datatype, comps);
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
const GLint dstWidthNB = dstWidth - 2 * border;
const GLint dstHeightNB = dstHeight - 2 * border;
const GLint srcRowBytes = bpt * srcRowBytes;
const GLint dstRowBytes = bpt * dstRowBytes;
const GLint srcRowBytes = bpt * srcRowStride;
const GLint dstRowBytes = bpt * dstRowStride;
const GLubyte *src;
GLubyte *dst;
GLint row;
@@ -767,28 +756,22 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
static void
make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border,
GLint srcWidth, GLint srcHeight,
GLint srcRowBytes,
const GLubyte *srcPtr,
const GLubyte *srcPtr, GLint srcRowStride,
GLint dstWidth, GLint dstHeight, GLint dstDepth,
GLint dstRowBytes,
GLubyte *dstPtr)
GLubyte *dstPtr, GLint dstRowStride)
{
const GLint bpt = bytes_per_pixel(datatype, comps);
const GLint srcWidthNB = srcWidth - 2 * border; /* sizes w/out border */
const GLint dstWidthNB = dstWidth - 2 * border;
const GLint dstHeightNB = dstHeight - 2 * border;
const GLint dstDepthNB = dstDepth - 2 * border;
const GLint srcRowBytes = bpt * srcRowStride;
const GLint dstRowBytes = bpt * dstRowStride;
const GLubyte *srcA, *srcB;
GLubyte *dst;
GLint layer;
GLint row;
if (!srcRowBytes)
srcRowBytes = bpt * srcWidth;
if (!dstRowBytes)
dstRowBytes = bpt * dstWidth;
/* Compute src and dst pointers, skipping any border */
srcA = srcPtr + border * ((srcWidth + 1) * bpt);
if (srcHeight > 1)
@@ -867,12 +850,15 @@ _mesa_generate_mipmap_level(GLenum target,
GLenum datatype, GLuint comps,
GLint border,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint srcRowBytes,
const GLubyte *srcData,
GLint srcRowStride,
GLint dstWidth, GLint dstHeight, GLint dstDepth,
GLint dstRowBytes,
GLubyte *dstData)
GLubyte *dstData,
GLint dstRowStride)
{
/*
* We use simple 2x2 averaging to compute the next mipmap level.
*/
switch (target) {
case GL_TEXTURE_1D:
make_1d_mipmap(datatype, comps, border,
@@ -887,29 +873,35 @@ _mesa_generate_mipmap_level(GLenum target,
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
make_2d_mipmap(datatype, comps, border,
srcWidth, srcHeight, srcRowBytes, srcData,
dstWidth, dstHeight, dstRowBytes, dstData);
srcWidth, srcHeight, srcData, srcRowStride,
dstWidth, dstHeight, dstData, dstRowStride);
break;
case GL_TEXTURE_3D:
make_3d_mipmap(datatype, comps, border,
srcWidth, srcHeight, srcDepth, srcRowBytes, srcData,
dstWidth, dstHeight, dstDepth, dstRowBytes, dstData);
srcWidth, srcHeight, srcDepth,
srcData, srcRowStride,
dstWidth, dstHeight, dstDepth,
dstData, dstRowStride);
break;
case GL_TEXTURE_1D_ARRAY_EXT:
make_1d_stack_mipmap(datatype, comps, border,
srcWidth, srcData,
dstWidth, dstHeight, dstData);
srcWidth, srcData, srcRowStride,
dstWidth, dstHeight,
dstData, dstRowStride);
break;
case GL_TEXTURE_2D_ARRAY_EXT:
make_2d_stack_mipmap(datatype, comps, border,
srcWidth, srcHeight, srcRowBytes, srcData,
dstWidth, dstHeight, dstDepth, dstRowBytes, dstData);
srcWidth, srcHeight,
srcData, srcRowStride,
dstWidth, dstHeight,
dstDepth, dstData, dstRowStride);
break;
case GL_TEXTURE_RECTANGLE_NV:
/* no mipmaps, do nothing */
break;
default:
_mesa_problem(NULL, "bad target in _mesa_generate_mipmap_level");
_mesa_problem(NULL, "bad dimensions in _mesa_generate_mipmaps");
return;
}
}
@@ -1131,23 +1123,25 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
dstData = (GLubyte *) dstImage->Data;
}
/* Note, 0 indicates default row strides */
_mesa_generate_mipmap_level(target, datatype, comps, border,
srcWidth, srcHeight, srcDepth, 0, srcData,
dstWidth, dstHeight, dstDepth, 0, dstData);
srcWidth, srcHeight, srcDepth,
srcData, srcImage->RowStride,
dstWidth, dstHeight, dstDepth,
dstData, dstImage->RowStride);
if (dstImage->IsCompressed) {
GLubyte *temp;
/* compress image from dstData into dstImage->Data */
const GLenum srcFormat = convertFormat->BaseFormat;
GLint dstRowBytes
GLint dstRowStride
= _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth);
ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA);
dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat,
dstImage->TexFormat,
dstImage->Data,
0, 0, 0, /* dstX/Y/Zoffset */
dstRowBytes, 0, /* strides */
dstRowStride, 0, /* strides */
dstWidth, dstHeight, 1, /* size */
srcFormat, CHAN_TYPE,
dstData, /* src data, actually */
@@ -1172,7 +1166,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
void
_mesa_rescale_teximage2d(GLuint bytesPerPixel,
GLuint srcStrideInPixels,
GLuint dstRowBytes,
GLuint dstRowStride,
GLint srcWidth, GLint srcHeight,
GLint dstWidth, GLint dstHeight,
const GLvoid *srcImage, GLvoid *dstImage)
@@ -1186,7 +1180,7 @@ _mesa_rescale_teximage2d(GLuint bytesPerPixel,
GLint srcCol = col WOP wScale; \
dst[col] = src[srcRow * srcStrideInPixels + srcCol]; \
} \
dst = (TYPE *) ((GLubyte *) dst + dstRowBytes); \
dst = (TYPE *) ((GLubyte *) dst + dstRowStride); \
} \
#define RESCALE_IMAGE( TYPE ) \
@@ -1244,7 +1238,7 @@ do { \
void
_mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
GLsizei outWidth, GLsizei outHeight,
GLint comps, const GLchan *src, GLint srcRowBytes,
GLint comps, const GLchan *src, GLint srcRowStride,
GLchan *dest )
{
GLint i, j, k;
@@ -1263,7 +1257,7 @@ _mesa_upscale_teximage2d(GLsizei inWidth, GLsizei inHeight,
const GLint jj = j % inWidth;
for (k = 0; k < comps; k++) {
dest[(i * outWidth + j) * comps + k]
= src[ii * srcRowBytes + jj * comps + k];
= src[ii * srcRowStride + jj * comps + k];
}
}
}

View File

@@ -34,11 +34,11 @@ _mesa_generate_mipmap_level(GLenum target,
GLenum datatype, GLuint comps,
GLint border,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint srcRowStride,
const GLubyte *srcData,
GLint srcRowStride,
GLint dstWidth, GLint dstHeight, GLint dstDepth,
GLint dstRowStride,
GLubyte *dstData);
GLubyte *dstData,
GLint dstRowStride);
extern void

View File

@@ -105,8 +105,7 @@ _mesa_error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
}
break;
case GL_DEPTH_COMPONENT:
if ((drawing && !_mesa_dest_buffer_exists(ctx, format)) ||
(!drawing && !_mesa_source_buffer_exists(ctx, format))) {
if ((drawing && !_mesa_dest_buffer_exists(ctx, format))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"gl%sPixels(no depth buffer)", readDraw);
return GL_TRUE;

View File

@@ -78,6 +78,10 @@ vsnprintf.c
MESA_MAIN_HEADERS = \
accum.h \
api_arrayelt.h \
<<<<<<< HEAD:src/mesa/main/sources
=======
api_eval.h \
>>>>>>> master:src/mesa/main/sources
api_exec.h \
api_loopback.h \
api_noop.h \

View File

@@ -51,8 +51,6 @@
#include "texstate.h"
static void
update_separate_specular(GLcontext *ctx)
{

View File

@@ -324,6 +324,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
break;
case GL_GENERATE_MIPMAP_SGIS:
if (ctx->Extensions.SGIS_generate_mipmap) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
}
else {

View File

@@ -819,7 +819,6 @@ _mesa_free_texture_data(GLcontext *ctx)
for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
#if FEATURE_colortable
{
GLuint i;

View File

@@ -2507,7 +2507,8 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS)
dstRow += dstRowStride / sizeof(GLuint);
}
}
} else {
}
else {
for (img = 0; img < srcDepth; img++) {
GLuint *dstRow = (GLuint *) dstAddr
+ dstImageOffsets[dstZoffset + img]

View File

@@ -517,7 +517,7 @@ _mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count)
for (i = 0; i < prog->NumInstructions; i++) {
struct prog_instruction *inst = prog->Instructions + i;
if (inst->BranchTarget > 0) {
if (inst->BranchTarget >= start) {
if ((GLuint)inst->BranchTarget >= start) {
inst->BranchTarget += count;
}
}

View File

@@ -517,7 +517,7 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
{
struct gl_shader_program *shProg;
const GLint size = -1; /* unknown size */
GLint i;
GLint i, oldIndex;
GLenum datatype = GL_FLOAT_VEC4;
shProg = _mesa_lookup_shader_program_err(ctx, program,
@@ -540,6 +540,14 @@ _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
return;
}
if (shProg->LinkStatus) {
/* get current index/location for the attribute */
oldIndex = _mesa_get_attrib_location(ctx, program, name);
}
else {
oldIndex = -1;
}
/* this will replace the current value if it's already in the list */
i = _mesa_add_attribute(shProg->Attributes, name, size, datatype, index);
if (i < 0) {

View File

@@ -39,6 +39,10 @@
* in there will break the build on some platforms.
*/
<<<<<<< HEAD:src/mesa/x86/common_x86_asm.S
=======
#include "matypes.h"
>>>>>>> master:src/mesa/x86/common_x86_asm.S
#include "assyntax.h"
#include "common_x86_features.h"