Merge branch 'master' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa

This commit is contained in:
Brian
2006-12-14 15:20:15 -07:00
16 changed files with 202 additions and 124 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ static void display(void)
GLfloat tcm = 4.0;
printf("BASE_LEVEL = %d MAX_LEVEL = %d MIN_LOD = %f MAX_LOD = %f Bias = %.2g filter = %s\n",
BaseLevel, MaxLevel, MinLod, MaxLod, LodBias,
NearestFilter ? "LINEAR" : "NEAREST");
NearestFilter ? "NEAREST" : "LINEAR");
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, BaseLevel);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, MaxLevel);
+4 -1
View File
@@ -20,6 +20,7 @@ DRIVER_SOURCES = \
intel_batchbuffer.c \
intel_mipmap_tree.c \
i915_tex_layout.c \
intel_tex_layout.c \
intel_tex_image.c \
intel_tex_subimage.c \
intel_tex_copy.c \
@@ -59,8 +60,10 @@ C_SOURCES = \
ASM_SOURCES =
DRIVER_DEFINES = -I../intel
include ../Makefile.template
intel_tex_layout.o: ../intel/intel_tex_layout.c
symlinks:
+4 -52
View File
@@ -30,6 +30,7 @@
*/
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
#include "macros.h"
#include "intel_context.h"
@@ -52,12 +53,6 @@ static GLint step_offsets[6][2] = { {0, 2},
{-1, 1}
};
static GLuint
minify(GLuint d)
{
return MAX2(1, d >> 1);
}
GLboolean
i915_miptree_layout(struct intel_mipmap_tree * mt)
{
@@ -217,7 +212,7 @@ i945_miptree_layout(struct intel_mipmap_tree * mt)
y = mt->total_height - 4;
x = (face - 4) * 8;
}
else if (dim < 4) {
else if (dim < 4 && (face > 0 || mt->first_level > 0)) {
y = mt->total_height - 4;
x = face * 8;
}
@@ -322,52 +317,9 @@ i945_miptree_layout(struct intel_mipmap_tree * mt)
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_RECTANGLE_ARB:{
GLuint x = 0;
GLuint y = 0;
GLuint width = mt->width0;
GLuint height = mt->height0;
GLint align_h = 2;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
for (level = mt->first_level; level <= mt->last_level; level++) {
GLuint img_height;
intel_miptree_set_level_info(mt, level, 1,
x, y,
width,
mt->compressed ? height/4 : height, 1);
if (mt->compressed)
img_height = MAX2(1, height / 4);
else
img_height = MAX2(align_h, height);
/* LPT change: step right after second mipmap.
*/
if (level == mt->first_level + 1) {
x += mt->pitch / 2;
x = (x + 3) & ~3;
}
else {
y += img_height;
y += align_h - 1;
y &= ~(align_h - 1);
}
/* Because the images are packed better, the final offset
* might not be the maximal one:
*/
mt->total_height = MAX2(mt->total_height, y);
width = minify(width);
height = minify(height);
}
case GL_TEXTURE_RECTANGLE_ARB:
i945_miptree_layout_2d(mt);
break;
}
default:
_mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
}
@@ -252,6 +252,7 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
{
struct intel_context *intel = batch->intel;
GLuint used = batch->ptr - batch->map;
GLboolean was_locked = intel->locked;
if (used == 0)
return batch->last_fence;
@@ -278,17 +279,14 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch)
/* TODO: Just pass the relocation list and dma buffer up to the
* kernel.
*/
if (!intel->locked) {
assert(!(batch->flags & INTEL_BATCH_NO_CLIPRECTS));
if (!was_locked)
LOCK_HARDWARE(intel);
do_flush_locked(batch, used, GL_FALSE, GL_TRUE);
do_flush_locked(batch, used, !(batch->flags & INTEL_BATCH_CLIPRECTS),
GL_FALSE);
if (!was_locked)
UNLOCK_HARDWARE(intel);
}
else {
GLboolean ignore_cliprects = !(batch->flags & INTEL_BATCH_CLIPRECTS);
do_flush_locked(batch, used, ignore_cliprects, GL_FALSE);
}
/* Reset the buffer:
*/
+1
View File
@@ -0,0 +1 @@
../intel/intel_tex_layout.c
@@ -50,7 +50,6 @@ intelTexSubimage(GLcontext * ctx,
{
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intelImage = intel_texture_image(texImage);
GLuint dstImageStride;
GLuint dstRowStride;
DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__,
@@ -79,7 +78,7 @@ intelTexSubimage(GLcontext * ctx,
intelImage->face,
intelImage->level,
&dstRowStride,
&dstImageStride);
texImage->ImageOffsets);
assert(dstRowStride);
@@ -2,6 +2,7 @@
#include "macros.h"
#include "intel_context.h"
#include "intel_batchbuffer.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
@@ -155,9 +156,15 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
* leaving the tree alone.
*/
if (intelObj->mt &&
((intelObj->mt->first_level > intelObj->firstLevel) ||
(intelObj->mt->last_level < intelObj->lastLevel) ||
(intelObj->mt->internal_format != firstImage->base.InternalFormat))) {
(intelObj->mt->target != intelObj->base.Target ||
intelObj->mt->internal_format != firstImage->base.InternalFormat ||
intelObj->mt->first_level != intelObj->firstLevel ||
intelObj->mt->last_level != intelObj->lastLevel ||
intelObj->mt->width0 != firstImage->base.Width ||
intelObj->mt->height0 != firstImage->base.Height ||
intelObj->mt->depth0 != firstImage->base.Depth ||
intelObj->mt->cpp != firstImage->base.TexFormat->TexelBytes ||
intelObj->mt->compressed != firstImage->base.IsCompressed)) {
intel_miptree_release(intel, &intelObj->mt);
}
@@ -198,6 +205,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
}
}
intel_batchbuffer_flush(intel->batch);
return GL_TRUE;
}
+4 -1
View File
@@ -20,6 +20,7 @@ DRIVER_SOURCES = \
intel_pixel_bitmap.c \
intel_state.c \
intel_tex.c \
intel_tex_layout.c \
intel_tex_validate.c \
brw_aub.c \
brw_aub_playback.c \
@@ -92,8 +93,10 @@ C_SOURCES = \
ASM_SOURCES =
DRIVER_DEFINES = -I../intel
include ../Makefile.template
intel_tex_layout.o: ../intel/intel_tex_layout.c
symlinks:
+3 -52
View File
@@ -34,21 +34,15 @@
*/
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
#include "macros.h"
static GLuint minify( GLuint d )
{
return MAX2(1, d>>1);
}
GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt )
{
/* XXX: these vary depending on image format:
*/
/* GLint align_w = 4; */
GLint align_h = 2;
switch (mt->target) {
case GL_TEXTURE_CUBE_MAP:
@@ -107,53 +101,10 @@ GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt )
break;
}
default: {
GLuint level;
GLuint x = 0;
GLuint y = 0;
GLuint width = mt->width0;
GLuint height = mt->height0;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
GLuint img_height;
intel_miptree_set_level_info(mt, level, 1,
x, y,
width,
mt->compressed ? height/4 : height, 1);
if (mt->compressed)
img_height = MAX2(1, height/4);
else
img_height = MAX2(align_h, height);
/* Because the images are packed better, the final offset
* might not be the maximal one:
*/
mt->total_height = MAX2(mt->total_height, y + img_height);
/* Layout_below: step right after second mipmap.
*/
if (level == mt->first_level + 1) {
x += mt->pitch / 2;
x = (x + 3) & ~ 3;
}
else {
y += img_height;
y += align_h - 1;
y &= ~(align_h - 1);
}
width = minify(width);
height = minify(height);
}
default:
i945_miptree_layout_2d(mt);
break;
}
}
DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
mt->pitch,
mt->total_height,
+1
View File
@@ -0,0 +1 @@
../intel/intel_tex_layout.c
@@ -0,0 +1,102 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Michel Dänzer <michel@tungstengraphics.com>
*/
#include "intel_mipmap_tree.h"
#include "intel_tex_layout.h"
#include "macros.h"
static int align(int value, int alignment)
{
return (value + alignment - 1) & ~(alignment - 1);
}
void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
{
GLint align_h = 2, align_w = 4;
GLuint level;
GLuint x = 0;
GLuint y = 0;
GLuint width = mt->width0;
GLuint height = mt->height0;
mt->pitch = mt->width0;
/* May need to adjust pitch to accomodate the placement of
* the 2nd mipmap. This occurs when the alignment
* constraints of mipmap placement push the right edge of the
* 2nd mipmap out past the width of its parent.
*/
if (mt->first_level != mt->last_level) {
GLuint mip1_width = align(minify(mt->width0), align_w)
+ minify(minify(mt->width0));
if (mip1_width > mt->width0)
mt->pitch = mip1_width;
}
/* Pitch must be a whole number of dwords, even though we
* express it in texels.
*/
mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp;
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
GLuint img_height;
intel_miptree_set_level_info(mt, level, 1, x, y, width,
mt->compressed ? height/4 : height, 1);
if (mt->compressed)
img_height = MAX2(1, height/4);
else
img_height = align(height, align_h);
/* Because the images are packed better, the final offset
* might not be the maximal one:
*/
mt->total_height = MAX2(mt->total_height, y + img_height);
/* Layout_below: step right after second mipmap.
*/
if (level == mt->first_level + 1) {
x += align(width, align_w);
}
else {
y += img_height;
}
width = minify(width);
height = minify(height);
}
}
@@ -0,0 +1,41 @@
/**************************************************************************
*
* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Michel Dänzer <michel@tungstengraphics.com>
*/
#include "macros.h"
static GLuint minify( GLuint d )
{
return MAX2(1, d>>1);
}
extern void i945_miptree_layout_2d( struct intel_mipmap_tree *mt );
+1
View File
@@ -735,6 +735,7 @@ struct r200_tcl_info {
GLuint *Elts;
struct r200_dma_region indexed_verts;
struct r200_dma_region weight;
struct r200_dma_region obj;
struct r200_dma_region rgba;
struct r200_dma_region spec;
+18 -1
View File
@@ -423,7 +423,21 @@ void r200EmitArrays( GLcontext *ctx, GLuint inputs )
count );
}
component[nr++] = &rmesa->tcl.generic[geninput];
vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
vfmt0 |= R200_VTX_W0 | R200_VTX_Z0;
}
if (inputs & VERT_BIT_WEIGHT) {
if (!rmesa->tcl.weight.buf)
emit_vector( ctx,
&rmesa->tcl.weight,
(char *)VB->AttribPtr[VERT_ATTRIB_WEIGHT]->data,
VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size,
VB->AttribPtr[VERT_ATTRIB_WEIGHT]->stride,
count);
assert(VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size <= 4);
vfmt0 |= VB->AttribPtr[VERT_ATTRIB_WEIGHT]->size << R200_VTX_WEIGHT_COUNT_SHIFT;
component[nr++] = &rmesa->tcl.weight;
}
if (inputs & VERT_BIT_NORMAL) {
@@ -672,6 +686,9 @@ void r200ReleaseArrays( GLcontext *ctx, GLuint newinputs )
if (newinputs & VERT_BIT_POS)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.obj, __FUNCTION__ );
if (newinputs & VERT_BIT_WEIGHT)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.weight, __FUNCTION__ );
if (newinputs & VERT_BIT_NORMAL)
r200ReleaseDmaRegion( rmesa, &rmesa->tcl.norm, __FUNCTION__ );
@@ -503,7 +503,6 @@ static GLboolean r200_translate_vertex_program(GLcontext *ctx, struct r200_verte
array_count++;
}
if (mesa_vp->Base.InputsRead & VERT_BIT_WEIGHT) {
/* we don't actually handle that later. Then again, we don't have to... */
vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
array_count++;
}
+2 -1
View File
@@ -808,7 +808,8 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx,
/* _mesa_printf("map %d %d %d %d\n", map[0], map[1], map[2], map[3]); */
if (srcRowStride == srcWidth * srcComponents &&
if (srcRowStride == dstRowStride &&
srcRowStride == srcWidth * srcComponents &&
dimensions < 3) {
/* 1 and 2D images only */
GLubyte *dstImage = (GLubyte *) dstAddr