Commit cf6bef0a authored by Keith Whitwell's avatar Keith Whitwell

Merge commit 'origin/master' into gallium-resources

parents 19972319 6de8e563
......@@ -243,7 +243,6 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/shader/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
......@@ -379,15 +378,6 @@ SGI_GLU_FILES = \
$(DIRECTORY)/src/glu/sgi/libtess/*.[ch] \
$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]
MESA_GLU_FILES = \
$(DIRECTORY)/src/glu/mesa/README[12] \
$(DIRECTORY)/src/glu/mesa/Makefile* \
$(DIRECTORY)/src/glu/mesa/descrip.mms \
$(DIRECTORY)/src/glu/mesa/mms_depend \
$(DIRECTORY)/src/glu/mesa/*.def \
$(DIRECTORY)/src/glu/mesa/depend \
$(DIRECTORY)/src/glu/mesa/*.[ch]
GLW_FILES = \
$(DIRECTORY)/src/glw/*.[ch] \
$(DIRECTORY)/src/glw/Makefile* \
......@@ -450,11 +440,7 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/glx/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.cpp \
$(DIRECTORY)/src/glut/beos/Makefile \
$(DIRECTORY)/src/glut/fbdev/Makefile \
$(DIRECTORY)/src/glut/fbdev/*[ch] \
$(DIRECTORY)/src/glut/mini/*[ch] \
$(DIRECTORY)/src/glut/mini/glut.pc.in \
$(DIRECTORY)/src/glut/beos/Makefile
DEPEND_FILES = \
$(TOP)/src/mesa/depend \
......
......@@ -10,7 +10,7 @@ CONFIG_NAME = linux-llvm
GALLIUM_DRIVERS_DIRS += llvmpipe
OPT_FLAGS = -O3 -ansi -pedantic
ARCH_FLAGS = -m32 -mmmx -msse -msse2 -mstackrealign
ARCH_FLAGS = -mmmx -msse -msse2 -mstackrealign
DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DDRAW_LLVM -DHAVE_UDIS86
......
......@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glut.h>
......@@ -35,7 +36,6 @@ GLint windW, windH;
char *fileName = 0;
PPMImage *image;
float point[3];
float zoom;
GLint x, y;
......@@ -97,27 +97,27 @@ static void Mouse(int button, int state, int mouseX, int mouseY)
static void Draw(void)
{
GLint src[3], dst[3];
glClear(GL_COLOR_BUFFER_BIT);
point[0] = (windW / 2) - (image->sizeX / 2);
point[1] = (windH / 2) - (image->sizeY / 2);
point[2] = 0;
glRasterPos3fv(point);
src[0] = (int) ((windW / 2.0) - (image->sizeX / 2.0));
src[1] = (int) ((windH / 2.0) - (image->sizeY / 2.0));
src[2] = 0;
glWindowPos3ivARB(src);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelZoom(1.0, 1.0);
glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
image->data);
point[0] = (float)x;
point[1] = windH - (float)y;
point[2] = 0.0;
glRasterPos3fv(point);
dst[0] = x;
dst[1] = windH - y;
dst[2] = 0;
glWindowPos3ivARB(dst);
glPixelZoom(zoom, zoom);
glCopyPixels((windW/2)-(image->sizeX/2),
(windH/2)-(image->sizeY/2),
glCopyPixels(src[0], src[1],
image->sizeX, image->sizeY, GL_COLOR);
glFlush();
......@@ -170,8 +170,8 @@ int main(int argc, char **argv)
image = LoadPPM(fileName);
windW = 300;
windH = 300;
windW = 2*300;
windH = 2*300;
glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
type = GLUT_RGB;
......@@ -182,6 +182,7 @@ int main(int argc, char **argv)
exit(1);
}
glewInit();
Init();
glutReshapeFunc(Reshape);
......
......@@ -9,7 +9,7 @@ static PPMImage *LoadPPM(const char *filename)
char buff[16];
PPMImage *result;
FILE *fp;
int maxval;
int maxval, w, h;
fp = fopen(filename, "rb");
if (!fp)
......@@ -37,11 +37,13 @@ static PPMImage *LoadPPM(const char *filename)
exit(1);
}
if (fscanf(fp, "%lu %lu", &result->sizeX, &result->sizeY) != 2)
if (fscanf(fp, "%d %d", &w, &h) != 2)
{
fprintf(stderr, "Error loading image `%s'\n", filename);
exit(1);
}
result->sizeX = w;
result->sizeY = h;
if (fscanf(fp, "%d", &maxval) != 1)
{
......
......@@ -77,6 +77,7 @@ static void Draw(void)
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
/* red triangle (setting stencil to 1) */
glColor3ub(200, 0, 0);
glBegin(GL_POLYGON);
glVertex3i(-4, -4, 0);
......@@ -88,6 +89,7 @@ static void Draw(void)
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_INCR, GL_KEEP, GL_DECR);
/* green quad (if over red, decr stencil to 0, else incr to 1) */
glColor3ub(0, 200, 0);
glBegin(GL_POLYGON);
glVertex3i(3, 3, 0);
......@@ -101,6 +103,7 @@ static void Draw(void)
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
/* blue quad (where stencil == 1) */
glColor3ub(0, 0, 200);
glBegin(GL_POLYGON);
glVertex3f(2.5, 2.5, 0);
......
......@@ -51,13 +51,15 @@ lp_depth_type(const struct util_format_description *format_desc,
void
lp_build_depth_test(LLVMBuilderRef builder,
const struct pipe_depth_state *state,
struct lp_type type,
const struct util_format_description *format_desc,
struct lp_build_mask_context *mask,
LLVMValueRef src,
LLVMValueRef dst_ptr);
lp_build_depth_stencil_test(LLVMBuilderRef builder,
const struct pipe_depth_state *depth,
const struct pipe_stencil_state stencil[2],
struct lp_type type,
const struct util_format_description *format_desc,
struct lp_build_mask_context *mask,
LLVMValueRef stencil_refs,
LLVMValueRef zs_src,
LLVMValueRef zs_dst_ptr);
#endif /* !LP_BLD_DEPTH_H */
......@@ -483,3 +483,13 @@ lp_build_alloca(struct lp_build_context *bld)
return LLVMBuildAlloca(bld->builder, lp_build_elem_type(type), "");
}
}
/** Return (a & ~b) */
LLVMValueRef
lp_build_andc(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b)
{
b = LLVMBuildNot(bld->builder, b, "");
b = LLVMBuildAnd(bld->builder, a, b, "");
return b;
}
......@@ -79,4 +79,9 @@ lp_build_select_aos(struct lp_build_context *bld,
LLVMValueRef
lp_build_alloca(struct lp_build_context *bld);
LLVMValueRef
lp_build_andc(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b);
#endif /* !LP_BLD_LOGIC_H */
......@@ -91,36 +91,49 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
/* struct lp_jit_context */
{
LLVMTypeRef elem_types[8];
LLVMTypeRef elem_types[LP_JIT_CTX_COUNT];
LLVMTypeRef context_type;
elem_types[0] = LLVMPointerType(LLVMFloatType(), 0); /* constants */
elem_types[1] = LLVMFloatType(); /* alpha_ref_value */ elem_types[2] = LLVMFloatType(); /* scissor_xmin */
elem_types[3] = LLVMFloatType(); /* scissor_ymin */
elem_types[4] = LLVMFloatType(); /* scissor_xmax */
elem_types[5] = LLVMFloatType(); /* scissor_ymax */
elem_types[6] = LLVMPointerType(LLVMInt8Type(), 0); /* blend_color */
elem_types[7] = LLVMArrayType(texture_type, PIPE_MAX_SAMPLERS); /* textures */
elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatType(), 0);
elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType();
elem_types[LP_JIT_CTX_STENCIL_REF] = LLVMArrayType(LLVMInt8Type(), 2);
elem_types[LP_JIT_CTX_SCISSOR_XMIN] = LLVMFloatType();
elem_types[LP_JIT_CTX_SCISSOR_YMIN] = LLVMFloatType();
elem_types[LP_JIT_CTX_SCISSOR_XMAX] = LLVMFloatType();
elem_types[LP_JIT_CTX_SCISSOR_YMAX] = LLVMFloatType();
elem_types[LP_JIT_CTX_BLEND_COLOR] = LLVMPointerType(LLVMInt8Type(), 0);
elem_types[LP_JIT_CTX_TEXTURES] = LLVMArrayType(texture_type,
PIPE_MAX_SAMPLERS);
context_type = LLVMStructType(elem_types, Elements(elem_types), 0);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, constants,
screen->target, context_type, 0);
screen->target, context_type,
LP_JIT_CTX_CONSTANTS);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
screen->target, context_type, 1);
screen->target, context_type,
LP_JIT_CTX_ALPHA_REF);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref,
screen->target, context_type,
LP_JIT_CTX_STENCIL_REF);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin,
screen->target, context_type, 2);
screen->target, context_type,
LP_JIT_CTX_SCISSOR_XMIN);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymin,
screen->target, context_type, 3);
screen->target, context_type,
LP_JIT_CTX_SCISSOR_YMIN);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmax,
screen->target, context_type, 4);
screen->target, context_type,
LP_JIT_CTX_SCISSOR_XMAX);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymax,
screen->target, context_type, 5);
screen->target, context_type,
LP_JIT_CTX_SCISSOR_YMAX);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
screen->target, context_type, 6);
screen->target, context_type,
LP_JIT_CTX_BLEND_COLOR);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, textures,
screen->target, context_type,
LP_JIT_CONTEXT_TEXTURES_INDEX);
LP_JIT_CTX_TEXTURES);
LP_CHECK_STRUCT_SIZE(struct lp_jit_context,
screen->target, context_type);
......
......@@ -84,6 +84,8 @@ struct lp_jit_context
float alpha_ref_value;
uint8_t stencil_ref[2];
/** floats, not ints */
float scissor_xmin, scissor_ymin, scissor_xmax, scissor_ymax;
......@@ -94,31 +96,50 @@ struct lp_jit_context
};
/**
* These enum values must match the position of the fields in the
* lp_jit_context struct above.
*/
enum {
LP_JIT_CTX_CONSTANTS = 0,
LP_JIT_CTX_ALPHA_REF,
LP_JIT_CTX_STENCIL_REF,
LP_JIT_CTX_SCISSOR_XMIN,
LP_JIT_CTX_SCISSOR_YMIN,
LP_JIT_CTX_SCISSOR_XMAX,
LP_JIT_CTX_SCISSOR_YMAX,
LP_JIT_CTX_BLEND_COLOR,
LP_JIT_CTX_TEXTURES,
LP_JIT_CTX_COUNT
};
#define lp_jit_context_constants(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 0, "constants")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
#define lp_jit_context_alpha_ref_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 1, "alpha_ref_value")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
#define lp_jit_context_stencil_ref_values(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CTX_STENCIL_REF, "stencil_ref")
#define lp_jit_context_scissor_xmin_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 2, "scissor_xmin")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMIN, "scissor_xmin")
#define lp_jit_context_scissor_ymin_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 3, "scissor_ymin")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMIN, "scissor_ymin")
#define lp_jit_context_scissor_xmax_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 4, "scissor_xmax")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMAX, "scissor_xmax")
#define lp_jit_context_scissor_ymax_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 5, "scissor_ymax")
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_YMAX, "scissor_ymax")
#define lp_jit_context_blend_color(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 6, "blend_color")
#define LP_JIT_CONTEXT_TEXTURES_INDEX 7
lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
#define lp_jit_context_textures(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES_INDEX, "textures")
lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES, "textures")
typedef void
......
......@@ -400,6 +400,20 @@ lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
}
}
void
lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
const ubyte refs[2] )
{
LP_DBG(DEBUG_SETUP, "%s %d %d\n", __FUNCTION__, refs[0], refs[1]);
if (setup->fs.current.jit_context.stencil_ref[0] != refs[0] ||
setup->fs.current.jit_context.stencil_ref[1] != refs[1]) {
setup->fs.current.jit_context.stencil_ref[0] = refs[0];
setup->fs.current.jit_context.stencil_ref[1] = refs[1];
setup->dirty |= LP_SETUP_NEW_FS;
}
}
void
lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color )
......
......@@ -112,6 +112,10 @@ void
lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
float alpha_ref_value );
void
lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
const ubyte refs[2] );
void
lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color );
......
......@@ -67,6 +67,7 @@ struct lp_fragment_shader;
struct lp_fragment_shader_variant_key
{
struct pipe_depth_state depth;
struct pipe_stencil_state stencil[2];
struct pipe_alpha_state alpha;
struct pipe_blend_state blend;
enum pipe_format zsbuf_format;
......
......@@ -174,9 +174,12 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
if (llvmpipe->dirty & LP_NEW_SCISSOR)
lp_setup_set_scissor(llvmpipe->setup, &llvmpipe->scissor);
if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA)
if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA) {
lp_setup_set_alpha_ref_value(llvmpipe->setup,
llvmpipe->depth_stencil->alpha.ref_value);
lp_setup_set_stencil_ref_values(llvmpipe->setup,
llvmpipe->stencil_ref.ref_value);
}
if (llvmpipe->dirty & LP_NEW_CONSTANTS)
lp_setup_set_fs_constants(llvmpipe->setup,
......
......@@ -137,22 +137,20 @@ generate_pos0(LLVMBuilderRef builder,
/**
* Generate the depth test.
* Generate the depth /stencil test code.
*/
static void
generate_depth(LLVMBuilderRef builder,
const struct lp_fragment_shader_variant_key *key,
struct lp_type src_type,
struct lp_build_mask_context *mask,
LLVMValueRef src,
LLVMValueRef dst_ptr)
generate_depth_stencil(LLVMBuilderRef builder,
const struct lp_fragment_shader_variant_key *key,
struct lp_type src_type,
struct lp_build_mask_context *mask,
LLVMValueRef stencil_refs,
LLVMValueRef src,
LLVMValueRef dst_ptr)
{
const struct util_format_description *format_desc;
struct lp_type dst_type;
if(!key->depth.enabled)
return;
format_desc = util_format_description(key->zsbuf_format);
assert(format_desc);
......@@ -177,19 +175,21 @@ generate_depth(LLVMBuilderRef builder,
assert(dst_type.width == src_type.width);
assert(dst_type.length == src_type.length);
/* Convert fragment Z from float to integer */
lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1);
dst_ptr = LLVMBuildBitCast(builder,
dst_ptr,
LLVMPointerType(lp_build_vec_type(dst_type), 0), "");
lp_build_depth_test(builder,
&key->depth,
dst_type,
format_desc,
mask,
src,
dst_ptr);
lp_build_depth_stencil_test(builder,
&key->depth,
key->stencil,
dst_type,
format_desc,
mask,
stencil_refs,
src,
dst_ptr);
}
......@@ -404,15 +404,18 @@ generate_fs(struct llvmpipe_context *lp,
LLVMValueRef consts_ptr;
LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS];
LLVMValueRef z = interp->pos[2];
LLVMValueRef stencil_refs;
struct lp_build_flow_context *flow;
struct lp_build_mask_context mask;
boolean early_depth_test;
boolean early_depth_stencil_test;
unsigned attrib;
unsigned chan;
unsigned cbuf;
assert(i < 4);
stencil_refs = lp_jit_context_stencil_ref_values(builder, context_ptr);
elem_type = lp_build_elem_type(type);
vec_type = lp_build_vec_type(type);
int_vec_type = lp_build_int_vec_type(type);
......@@ -452,16 +455,16 @@ generate_fs(struct llvmpipe_context *lp,
lp_build_mask_update(&mask, smask);
}
early_depth_test =
key->depth.enabled &&
early_depth_stencil_test =
(key->depth.enabled || key->stencil[0].enabled) &&
!key->alpha.enabled &&
!shader->info.uses_kill &&
!shader->info.writes_z;
if(early_depth_test)
generate_depth(builder, key,
type, &mask,
z, depth_ptr);
if (early_depth_stencil_test)
generate_depth_stencil(builder, key,
type, &mask,
stencil_refs, z, depth_ptr);
lp_build_tgsi_soa(builder, tokens, type, &mask,
consts_ptr, interp->pos, interp->inputs,
......@@ -505,10 +508,10 @@ generate_fs(struct llvmpipe_context *lp,
}
}
if(!early_depth_test)
generate_depth(builder, key,
type, &mask,
z, depth_ptr);
if (!early_depth_stencil_test)
generate_depth_stencil(builder, key,
type, &mask,
stencil_refs, z, depth_ptr);
lp_build_mask_end(&mask);
......@@ -584,6 +587,20 @@ generate_blend(const struct pipe_blend_state *blend,
}
/** casting function to avoid compiler warnings */
static lp_jit_frag_func
cast_voidptr_to_lp_jit_frag_func(void *p)
{
union {
void *v;
lp_jit_frag_func f;
} tmp;
assert(sizeof(tmp.v) == sizeof(tmp.f));
tmp.v = p;
return tmp.f;
}
/**
* Generate the runtime callable function for the whole fragment pipeline.
* Note that the function which we generate operates on a block of 16
......@@ -844,10 +861,14 @@ generate_fragment(struct llvmpipe_context *lp,
/*
* Translate the LLVM IR into machine code.
*/
variant->jit_function[do_tri_test] = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, function);
{
void *f = LLVMGetPointerToGlobal(screen->engine, function);
variant->jit_function[do_tri_test] = cast_voidptr_to_lp_jit_frag_func(f);
if (LP_DEBUG & DEBUG_ASM)
lp_disassemble(variant->jit_function[do_tri_test]);
if (LP_DEBUG & DEBUG_ASM)
lp_disassemble(f);
}
}
......@@ -1053,10 +1074,15 @@ make_variant_key(struct llvmpipe_context *lp,
memset(key, 0, sizeof *key);
if(lp->framebuffer.zsbuf &&
lp->depth_stencil->depth.enabled) {
key->zsbuf_format = lp->framebuffer.zsbuf->format;
memcpy(&key->depth, &lp->depth_stencil->depth, sizeof key->depth);
if (lp->framebuffer.zsbuf) {
if (lp->depth_stencil->depth.enabled) {
key->zsbuf_format = lp->framebuffer.zsbuf->format;
memcpy(&key->depth, &lp->depth_stencil->depth, sizeof key->depth);
}
if (lp->depth_stencil->stencil[0].enabled) {
key->zsbuf_format = lp->framebuffer.zsbuf->format;
memcpy(&key->stencil, &lp->depth_stencil->stencil, sizeof key->stencil);
}
}
key->alpha.enabled = lp->depth_stencil->alpha.enabled;
......
......@@ -105,7 +105,7 @@ lp_llvm_texture_member(struct lp_sampler_dynamic_state *base,
/* context[0] */
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
/* context[0].textures */
indices[1] = LLVMConstInt(LLVMInt32Type(), LP_JIT_CONTEXT_TEXTURES_INDEX, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), LP_JIT_CTX_TEXTURES, 0);
/* context[0].textures[unit] */
indices[2] = LLVMConstInt(LLVMInt32Type(), unit, 0);
/* context[0].textures[unit].member */
......
......@@ -146,15 +146,15 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
dri_bo_reference(intelObj->mt->region->buffer);
i830->state.tex_buffer[unit] = intelObj->mt->region->buffer;
pitch = intelObj->mt->region->pitch * intelObj->mt->cpp;
/* XXX: This calculation is probably broken for tiled images with
* a non-page-aligned offset.
*/
i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) *
intelObj->mt->cpp;
i830->state.tex_offset[unit] = dst_x * intelObj->mt->cpp + dst_y * pitch;
format = translate_texture_format(firstImage->TexFormat,
firstImage->InternalFormat);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0 << unit) | 4);
......
......@@ -123,13 +123,12 @@ i915_miptree_layout_cube(struct intel_context *intel,
assert(lvlWidth == lvlHeight); /* cubemap images are square */
/* double pitch for cube layouts */
mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, dim * 2);
mt->total_width = dim * 2;
mt->total_height = dim * 4;
for (level = mt->first_level; level <= mt->last_level; level++) {
intel_miptree_set_level_info(mt, level, 6,
0, 0,
/*OLD: mt->pitch, mt->total_height,*/
lvlWidth, lvlHeight,
1);
lvlWidth /= 2;
......@@ -167,7 +166,7 @@ i915_miptree_layout_3d(struct intel_context *intel,
GLint level;
/* Calculate the size of a single slice. */
mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
mt->total_width = mt->width0;
/* XXX: hardware expects/requires 9 levels at minimum. */
for (level = mt->first_level; level <= MAX2(8, mt->last_level); level++) {
......@@ -210,7 +209,7 @@ i915_miptree_layout_2d(struct intel_context *intel,
GLuint img_height;
GLint level;
mt->pitch = intel_miptree_pitch_align (intel, mt, tiling, mt->width0);
mt->total_width = mt->width0;
mt->total_height = 0;
for (level = mt->first_level; level <= mt->last_level; level++) {
......@@ -251,9 +250,8 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
break;
}
DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
mt->pitch,
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
DBG("%s: %dx%dx%d\n", __FUNCTION__,