Merge commit 'origin/master' into gallium-0.2

Conflicts:

	src/mesa/drivers/dri/common/dri_util.c
This commit is contained in:
Brian Paul 2009-01-06 08:15:54 -07:00
commit 374cf77b2f
14 changed files with 168 additions and 16 deletions

View file

@ -324,7 +324,7 @@ MAIN_FILES = \
DRI_FILES = \
$(DIRECTORY)/include/GL/internal/dri_interface.h \
$(DIRECTORY)/include/GL/internal/dri_sarea.h \
$(DIRECTORY)/include/GL/internal/glcore.h \
$(DIRECTORY)/include/GL/internal/sarea.h \
$(DIRECTORY)/src/glx/Makefile \
$(DIRECTORY)/src/glx/x11/Makefile \

View file

@ -57,3 +57,62 @@
gluTessVertex
gluUnProject
gluUnProject4
mgluBeginCurve
mgluBeginPolygon
mgluBeginSurface
mgluBeginTrim
mgluBuild1DMipmapLevels
mgluBuild1DMipmaps
mgluBuild2DMipmapLevels
mgluBuild2DMipmaps
mgluBuild3DMipmapLevels
mgluBuild3DMipmaps
mgluCheckExtension
mgluCylinder
mgluDeleteNurbsRenderer
mgluDeleteQuadric
mgluDeleteTess
mgluDisk
mgluEndCurve
mgluEndPolygon
mgluEndSurface
mgluEndTrim
mgluErrorString
mgluGetNurbsProperty
mgluGetString
mgluGetTessProperty
mgluLoadSamplingMatrices
mgluLookAt
mgluNewNurbsRenderer
mgluNewQuadric
mgluNewTess
mgluNextContour
mgluNurbsCallback
mgluNurbsCallbackData
mgluNurbsCallbackDataEXT
mgluNurbsCurve
mgluNurbsProperty
mgluNurbsSurface
mgluOrtho2D
mgluPartialDisk
mgluPerspective
mgluPickMatrix
mgluProject
mgluPwlCurve
mgluQuadricCallback
mgluQuadricDrawStyle
mgluQuadricNormals
mgluQuadricOrientation
mgluQuadricTexture
mgluScaleImage
mgluSphere
mgluTessBeginContour
mgluTessBeginPolygon
mgluTessCallback
mgluTessEndContour
mgluTessEndPolygon
mgluTessNormal
mgluTessProperty
mgluTessVertex
mgluUnProject
mgluUnProject4

View file

@ -314,10 +314,28 @@ static void driReportDamage(__DRIdrawable *pdp,
static void driSwapBuffers(__DRIdrawable *dPriv)
{
__DRIscreen *psp = dPriv->driScreenPriv;
drm_clip_rect_t *rects;
int i;
if (!dPriv->numClipRects)
return;
psp->DriverAPI.SwapBuffers(dPriv);
driReportDamage(dPriv, dPriv->pClipRects, dPriv->numClipRects);
rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
for (i = 0; i < dPriv->numClipRects; i++) {
rects[i].x1 = dPriv->pClipRects[i].x1 - dPriv->x;
rects[i].y1 = dPriv->pClipRects[i].y1 - dPriv->y;
rects[i].x2 = dPriv->pClipRects[i].x2 - dPriv->x;
rects[i].y2 = dPriv->pClipRects[i].y2 - dPriv->y;
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
_mesa_free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,

View file

@ -753,6 +753,7 @@ ALU2(ADD)
ALU2(MUL)
ALU1(FRC)
ALU1(RNDD)
ALU1(RNDZ)
ALU2(MAC)
ALU2(MACH)
ALU1(LZD)

View file

@ -439,6 +439,7 @@ ALU2(ADD)
ALU2(MUL)
ALU1(FRC)
ALU1(RNDD)
ALU1(RNDZ)
ALU2(MAC)
ALU2(MACH)
ALU1(LZD)

View file

@ -1133,6 +1133,10 @@ void brw_vs_emit(struct brw_vs_compile *c )
*/
emit_swz(c, dst, inst->SrcReg[0] );
break;
case OPCODE_TRUNC:
/* round toward zero */
brw_RNDZ(p, dst, args[0]);
break;
case OPCODE_XPD:
emit_xpd(p, dst, args[0], args[1]);
break;

View file

@ -267,7 +267,7 @@ static void emit_trunc( struct brw_wm_compile *c,
struct brw_reg src, dst;
dst = get_dst_reg(c, inst, i, 1) ;
src = get_src_reg(c, &inst->SrcReg[0], i, 1);
brw_RNDD(p, dst, src);
brw_RNDZ(p, dst, src);
}
}
brw_set_saturate(p, 0);

View file

@ -61,7 +61,7 @@
/**
* \return GL_TRUE if type is packed pixel type, GL_FALSE otherwise.
*/
static GLboolean
GLboolean
_mesa_type_is_packed(GLenum type)
{
switch (type) {

View file

@ -36,6 +36,9 @@ _mesa_swap2( GLushort *p, GLuint n );
extern void
_mesa_swap4( GLuint *p, GLuint n );
extern GLboolean
_mesa_type_is_packed(GLenum type);
extern GLint
_mesa_sizeof_type( GLenum type );

View file

@ -41,7 +41,11 @@ bytes_per_pixel(GLenum datatype, GLuint comps)
{
GLint b = _mesa_sizeof_packed_type(datatype);
assert(b >= 0);
return b * comps;
if (_mesa_type_is_packed(datatype))
return b;
else
return b * comps;
}

View file

@ -1685,7 +1685,7 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_ARGB1555_REV:
*datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV;
*comps = 3;
*comps = 4;
return;
case MESA_FORMAT_AL88:

View file

@ -49,6 +49,14 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i);
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
}
else if (rb->DataType == GL_UNSIGNED_INT) {
GLuint *zValues = (GLuint *) values;
/*
@ -96,6 +104,15 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
z, rgbaOut + 4 * i);
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
GLushort *zValues = (GLushort *) values;
for (i = 0; i < count; i++) {
GLfloat flt;
trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset,
z, &flt);
zValues[i] = (GLushort) (flt * 0xffff);
}
}
else if (rb->DataType == GL_UNSIGNED_INT) {
GLuint *zValues = (GLuint *) values;
for (i = 0; i < count; i++) {
@ -147,6 +164,14 @@ texture_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
const GLushort *zValues = (const GLushort *) values;
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x + i, y, z, zValues + i);
}
}
}
else if (rb->DataType == GL_UNSIGNED_INT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
@ -189,6 +214,14 @@ texture_put_mono_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
}
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
const GLushort zValue = *((const GLushort *) value);
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x + i, y, z, &zValue);
}
}
}
else if (rb->DataType == GL_UNSIGNED_INT) {
const GLuint zValue = *((const GLuint *) value);
for (i = 0; i < count; i++) {
@ -231,12 +264,19 @@ texture_put_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count,
rgba += 4;
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
const GLushort *zValues = (const GLushort *) values;
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
}
}
}
else if (rb->DataType == GL_UNSIGNED_INT) {
const GLuint *zValues = (const GLuint *) values;
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z,
zValues + i);
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, zValues + i);
}
}
}
@ -281,6 +321,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb,
}
}
}
else if (rb->DataType == GL_UNSIGNED_SHORT) {
const GLushort zValue = *((const GLushort *) value);
for (i = 0; i < count; i++) {
if (!mask || mask[i]) {
trb->Store(trb->TexImage, x[i], y[i] + trb->Yoffset, z, &zValue);
}
}
}
else if (rb->DataType == GL_UNSIGNED_INT_24_8_EXT) {
const GLuint zValue = *((const GLuint *) value);
const GLfloat flt = (GLfloat) ((zValue >> 8) * (1.0 / 0xffffff));

View file

@ -3322,6 +3322,22 @@ is_store_writable(const slang_assemble_ctx *A, const slang_ir_storage *store)
}
/**
* Walk up an IR storage path to compute the final swizzle.
* This is used when we find an expression such as "foo.xz.yx".
*/
static GLuint
root_swizzle(const slang_ir_storage *st)
{
GLuint swizzle = st->Swizzle;
while (st->Parent) {
st = st->Parent;
swizzle = _slang_swizzle_swizzle(st->Swizzle, swizzle);
}
return swizzle;
}
/**
* Generate IR tree for an assignment (=).
*/
@ -3397,9 +3413,9 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
rhs = _slang_gen_operation(A, &oper->children[1]);
if (lhs && rhs) {
/* convert lhs swizzle into writemask */
const GLuint swizzle = root_swizzle(lhs->Store);
GLuint writemask, newSwizzle;
if (!swizzle_to_writemask(A, lhs->Store->Swizzle,
&writemask, &newSwizzle)) {
if (!swizzle_to_writemask(A, swizzle, &writemask, &newSwizzle)) {
/* Non-simple writemask, need to swizzle right hand side in
* order to put components into the right place.
*/

View file

@ -310,24 +310,22 @@ storage_to_dst_reg(struct prog_dst_register *dst, const slang_ir_storage *st)
dst->WriteMask = swizzle_to_writemask(swizzle);
}
else {
GLuint writemask;
switch (size) {
case 1:
writemask = WRITEMASK_X << GET_SWZ(st->Swizzle, 0);
dst->WriteMask = WRITEMASK_X << GET_SWZ(st->Swizzle, 0);
break;
case 2:
writemask = WRITEMASK_XY;
dst->WriteMask = WRITEMASK_XY;
break;
case 3:
writemask = WRITEMASK_XYZ;
dst->WriteMask = WRITEMASK_XYZ;
break;
case 4:
writemask = WRITEMASK_XYZW;
dst->WriteMask = WRITEMASK_XYZW;
break;
default:
; /* error would have been caught above */
}
dst->WriteMask = writemask;
}
dst->RelAddr = relAddr;