gallium: don't use arrays for texture width,height,depth
This commit is contained in:
@@ -398,9 +398,9 @@ aaline_create_texture(struct aaline_stage *aaline)
|
|||||||
texTemp.target = PIPE_TEXTURE_2D;
|
texTemp.target = PIPE_TEXTURE_2D;
|
||||||
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
|
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
|
||||||
texTemp.last_level = MAX_TEXTURE_LEVEL;
|
texTemp.last_level = MAX_TEXTURE_LEVEL;
|
||||||
texTemp.width[0] = 1 << MAX_TEXTURE_LEVEL;
|
texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
|
||||||
texTemp.height[0] = 1 << MAX_TEXTURE_LEVEL;
|
texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
|
||||||
texTemp.depth[0] = 1;
|
texTemp.depth0 = 1;
|
||||||
pf_get_block(texTemp.format, &texTemp.block);
|
pf_get_block(texTemp.format, &texTemp.block);
|
||||||
|
|
||||||
aaline->texture = screen->texture_create(screen, &texTemp);
|
aaline->texture = screen->texture_create(screen, &texTemp);
|
||||||
@@ -413,11 +413,11 @@ aaline_create_texture(struct aaline_stage *aaline)
|
|||||||
*/
|
*/
|
||||||
for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
|
for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) {
|
||||||
struct pipe_transfer *transfer;
|
struct pipe_transfer *transfer;
|
||||||
const uint size = aaline->texture->width[level];
|
const uint size = u_minify(aaline->texture->width0, level);
|
||||||
ubyte *data;
|
ubyte *data;
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
assert(aaline->texture->width[level] == aaline->texture->height[level]);
|
assert(aaline->texture->width0 == aaline->texture->height0);
|
||||||
|
|
||||||
/* This texture is new, no need to flush.
|
/* This texture is new, no need to flush.
|
||||||
*/
|
*/
|
||||||
|
@@ -427,9 +427,9 @@ pstip_create_texture(struct pstip_stage *pstip)
|
|||||||
texTemp.target = PIPE_TEXTURE_2D;
|
texTemp.target = PIPE_TEXTURE_2D;
|
||||||
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
|
texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */
|
||||||
texTemp.last_level = 0;
|
texTemp.last_level = 0;
|
||||||
texTemp.width[0] = 32;
|
texTemp.width0 = 32;
|
||||||
texTemp.height[0] = 32;
|
texTemp.height0 = 32;
|
||||||
texTemp.depth[0] = 1;
|
texTemp.depth0 = 1;
|
||||||
pf_get_block(texTemp.format, &texTemp.block);
|
pf_get_block(texTemp.format, &texTemp.block);
|
||||||
|
|
||||||
pstip->texture = screen->texture_create(screen, &texTemp);
|
pstip->texture = screen->texture_create(screen, &texTemp);
|
||||||
|
@@ -354,9 +354,9 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
|||||||
texTemp.target = PIPE_TEXTURE_2D;
|
texTemp.target = PIPE_TEXTURE_2D;
|
||||||
texTemp.format = src->format;
|
texTemp.format = src->format;
|
||||||
texTemp.last_level = 0;
|
texTemp.last_level = 0;
|
||||||
texTemp.width[0] = srcW;
|
texTemp.width0 = srcW;
|
||||||
texTemp.height[0] = srcH;
|
texTemp.height0 = srcH;
|
||||||
texTemp.depth[0] = 1;
|
texTemp.depth0 = 1;
|
||||||
pf_get_block(src->format, &texTemp.block);
|
pf_get_block(src->format, &texTemp.block);
|
||||||
|
|
||||||
tex = screen->texture_create(screen, &texTemp);
|
tex = screen->texture_create(screen, &texTemp);
|
||||||
@@ -389,10 +389,10 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pipe_texture_reference(&tex, src->texture);
|
pipe_texture_reference(&tex, src->texture);
|
||||||
s0 = srcX0 / (float)tex->width[0];
|
s0 = srcX0 / (float)tex->width0;
|
||||||
s1 = srcX1 / (float)tex->width[0];
|
s1 = srcX1 / (float)tex->width0;
|
||||||
t0 = srcY0 / (float)tex->height[0];
|
t0 = srcY0 / (float)tex->height0;
|
||||||
t1 = srcY1 / (float)tex->height[0];
|
t1 = srcY1 / (float)tex->height0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -518,13 +518,13 @@ util_blit_pixels_tex(struct blit_state *ctx,
|
|||||||
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
|
assert(filter == PIPE_TEX_MIPFILTER_NEAREST ||
|
||||||
filter == PIPE_TEX_MIPFILTER_LINEAR);
|
filter == PIPE_TEX_MIPFILTER_LINEAR);
|
||||||
|
|
||||||
assert(tex->width[0] != 0);
|
assert(tex->width0 != 0);
|
||||||
assert(tex->height[0] != 0);
|
assert(tex->height0 != 0);
|
||||||
|
|
||||||
s0 = srcX0 / (float)tex->width[0];
|
s0 = srcX0 / (float)tex->width0;
|
||||||
s1 = srcX1 / (float)tex->width[0];
|
s1 = srcX1 / (float)tex->width0;
|
||||||
t0 = srcY0 / (float)tex->height[0];
|
t0 = srcY0 / (float)tex->height0;
|
||||||
t1 = srcY1 / (float)tex->height[0];
|
t1 = srcY1 / (float)tex->height0;
|
||||||
|
|
||||||
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
|
assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format,
|
||||||
PIPE_TEXTURE_2D,
|
PIPE_TEXTURE_2D,
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include "util/u_draw_quad.h"
|
#include "util/u_draw_quad.h"
|
||||||
#include "util/u_gen_mipmap.h"
|
#include "util/u_gen_mipmap.h"
|
||||||
#include "util/u_simple_shaders.h"
|
#include "util/u_simple_shaders.h"
|
||||||
|
#include "util/u_math.h"
|
||||||
|
|
||||||
#include "cso_cache/cso_context.h"
|
#include "cso_cache/cso_context.h"
|
||||||
|
|
||||||
@@ -1125,12 +1126,12 @@ make_1d_mipmap(struct gen_mipmap_state *ctx,
|
|||||||
|
|
||||||
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
|
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
|
||||||
PIPE_TRANSFER_READ, 0, 0,
|
PIPE_TRANSFER_READ, 0, 0,
|
||||||
pt->width[srcLevel],
|
u_minify(pt->width0, srcLevel),
|
||||||
pt->height[srcLevel]);
|
u_minify(pt->height0, srcLevel));
|
||||||
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
|
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
|
||||||
PIPE_TRANSFER_WRITE, 0, 0,
|
PIPE_TRANSFER_WRITE, 0, 0,
|
||||||
pt->width[dstLevel],
|
u_minify(pt->width0, dstLevel),
|
||||||
pt->height[dstLevel]);
|
u_minify(pt->height0, dstLevel));
|
||||||
|
|
||||||
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
|
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
|
||||||
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
|
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
|
||||||
@@ -1168,12 +1169,12 @@ make_2d_mipmap(struct gen_mipmap_state *ctx,
|
|||||||
|
|
||||||
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
|
srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice,
|
||||||
PIPE_TRANSFER_READ, 0, 0,
|
PIPE_TRANSFER_READ, 0, 0,
|
||||||
pt->width[srcLevel],
|
u_minify(pt->width0, srcLevel),
|
||||||
pt->height[srcLevel]);
|
u_minify(pt->height0, srcLevel));
|
||||||
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
|
dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice,
|
||||||
PIPE_TRANSFER_WRITE, 0, 0,
|
PIPE_TRANSFER_WRITE, 0, 0,
|
||||||
pt->width[dstLevel],
|
u_minify(pt->width0, dstLevel),
|
||||||
pt->height[dstLevel]);
|
u_minify(pt->height0, dstLevel));
|
||||||
|
|
||||||
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
|
srcMap = (ubyte *) screen->transfer_map(screen, srcTrans);
|
||||||
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
|
dstMap = (ubyte *) screen->transfer_map(screen, dstTrans);
|
||||||
@@ -1575,8 +1576,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
|||||||
* Setup framebuffer / dest surface
|
* Setup framebuffer / dest surface
|
||||||
*/
|
*/
|
||||||
fb.cbufs[0] = surf;
|
fb.cbufs[0] = surf;
|
||||||
fb.width = pt->width[dstLevel];
|
fb.width = u_minify(pt->width0, dstLevel);
|
||||||
fb.height = pt->height[dstLevel];
|
fb.height = u_minify(pt->height0, dstLevel);
|
||||||
cso_set_framebuffer(ctx->cso, &fb);
|
cso_set_framebuffer(ctx->cso, &fb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1597,8 +1598,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
|||||||
offset = set_vertex_data(ctx,
|
offset = set_vertex_data(ctx,
|
||||||
pt->target,
|
pt->target,
|
||||||
face,
|
face,
|
||||||
(float) pt->width[dstLevel],
|
(float) u_minify(pt->width0, dstLevel),
|
||||||
(float) pt->height[dstLevel]);
|
(float) u_minify(pt->height0, dstLevel));
|
||||||
|
|
||||||
util_draw_vertex_buffer(ctx->pipe,
|
util_draw_vertex_buffer(ctx->pipe,
|
||||||
ctx->vbuf,
|
ctx->vbuf,
|
||||||
|
@@ -507,9 +507,9 @@ align(int value, int alignment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static INLINE unsigned
|
static INLINE unsigned
|
||||||
minify(unsigned value)
|
u_minify(unsigned value, unsigned levels)
|
||||||
{
|
{
|
||||||
return MAX2(1, value >> 1);
|
return MAX2(1, value >> levels);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef COPY_4V
|
#ifndef COPY_4V
|
||||||
|
@@ -79,9 +79,9 @@ util_create_rgba_surface(struct pipe_screen *screen,
|
|||||||
templ.target = target;
|
templ.target = target;
|
||||||
templ.format = format;
|
templ.format = format;
|
||||||
templ.last_level = 0;
|
templ.last_level = 0;
|
||||||
templ.width[0] = width;
|
templ.width0 = width;
|
||||||
templ.height[0] = height;
|
templ.height0 = height;
|
||||||
templ.depth[0] = 1;
|
templ.depth0 = 1;
|
||||||
pf_get_block(format, &templ.block);
|
pf_get_block(format, &templ.block);
|
||||||
templ.tex_usage = usage;
|
templ.tex_usage = usage;
|
||||||
|
|
||||||
|
@@ -455,8 +455,8 @@ void vl_compositor_render(struct vl_compositor *compositor,
|
|||||||
assert(dst_area);
|
assert(dst_area);
|
||||||
assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME);
|
assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME);
|
||||||
|
|
||||||
compositor->fb_state.width = dst_surface->width[0];
|
compositor->fb_state.width = dst_surface->width0;
|
||||||
compositor->fb_state.height = dst_surface->height[0];
|
compositor->fb_state.height = dst_surface->height0;
|
||||||
compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface
|
compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface
|
||||||
(
|
(
|
||||||
compositor->pipe->screen,
|
compositor->pipe->screen,
|
||||||
@@ -504,12 +504,12 @@ void vl_compositor_render(struct vl_compositor *compositor,
|
|||||||
vs_consts->dst_trans.z = 0;
|
vs_consts->dst_trans.z = 0;
|
||||||
vs_consts->dst_trans.w = 0;
|
vs_consts->dst_trans.w = 0;
|
||||||
|
|
||||||
vs_consts->src_scale.x = src_area->w / (float)src_surface->width[0];
|
vs_consts->src_scale.x = src_area->w / (float)src_surface->width0;
|
||||||
vs_consts->src_scale.y = src_area->h / (float)src_surface->height[0];
|
vs_consts->src_scale.y = src_area->h / (float)src_surface->height0;
|
||||||
vs_consts->src_scale.z = 1;
|
vs_consts->src_scale.z = 1;
|
||||||
vs_consts->src_scale.w = 1;
|
vs_consts->src_scale.w = 1;
|
||||||
vs_consts->src_trans.x = src_area->x / (float)src_surface->width[0];
|
vs_consts->src_trans.x = src_area->x / (float)src_surface->width0;
|
||||||
vs_consts->src_trans.y = src_area->y / (float)src_surface->height[0];
|
vs_consts->src_trans.y = src_area->y / (float)src_surface->height0;
|
||||||
vs_consts->src_trans.z = 0;
|
vs_consts->src_trans.z = 0;
|
||||||
vs_consts->src_trans.w = 0;
|
vs_consts->src_trans.w = 0;
|
||||||
|
|
||||||
|
@@ -681,7 +681,7 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r)
|
|||||||
(
|
(
|
||||||
r->pipe->screen, r->textures.all[i],
|
r->pipe->screen, r->textures.all[i],
|
||||||
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
|
0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0,
|
||||||
r->textures.all[i]->width[0], r->textures.all[i]->height[0]
|
r->textures.all[i]->width0, r->textures.all[i]->height0
|
||||||
);
|
);
|
||||||
|
|
||||||
r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]);
|
r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]);
|
||||||
@@ -835,26 +835,26 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
|
|||||||
/* TODO: Accomodate HW that can't do this and also for cases when this isn't precise enough */
|
/* TODO: Accomodate HW that can't do this and also for cases when this isn't precise enough */
|
||||||
template.format = PIPE_FORMAT_R16_SNORM;
|
template.format = PIPE_FORMAT_R16_SNORM;
|
||||||
template.last_level = 0;
|
template.last_level = 0;
|
||||||
template.width[0] = r->pot_buffers ?
|
template.width0 = r->pot_buffers ?
|
||||||
util_next_power_of_two(r->picture_width) : r->picture_width;
|
util_next_power_of_two(r->picture_width) : r->picture_width;
|
||||||
template.height[0] = r->pot_buffers ?
|
template.height0 = r->pot_buffers ?
|
||||||
util_next_power_of_two(r->picture_height) : r->picture_height;
|
util_next_power_of_two(r->picture_height) : r->picture_height;
|
||||||
template.depth[0] = 1;
|
template.depth0 = 1;
|
||||||
pf_get_block(template.format, &template.block);
|
pf_get_block(template.format, &template.block);
|
||||||
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
|
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC;
|
||||||
|
|
||||||
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
|
r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template);
|
||||||
|
|
||||||
if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
|
if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) {
|
||||||
template.width[0] = r->pot_buffers ?
|
template.width0 = r->pot_buffers ?
|
||||||
util_next_power_of_two(r->picture_width / 2) :
|
util_next_power_of_two(r->picture_width / 2) :
|
||||||
r->picture_width / 2;
|
r->picture_width / 2;
|
||||||
template.height[0] = r->pot_buffers ?
|
template.height0 = r->pot_buffers ?
|
||||||
util_next_power_of_two(r->picture_height / 2) :
|
util_next_power_of_two(r->picture_height / 2) :
|
||||||
r->picture_height / 2;
|
r->picture_height / 2;
|
||||||
}
|
}
|
||||||
else if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422)
|
else if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422)
|
||||||
template.height[0] = r->pot_buffers ?
|
template.height0 = r->pot_buffers ?
|
||||||
util_next_power_of_two(r->picture_height / 2) :
|
util_next_power_of_two(r->picture_height / 2) :
|
||||||
r->picture_height / 2;
|
r->picture_height / 2;
|
||||||
|
|
||||||
@@ -1283,8 +1283,8 @@ flush(struct vl_mpeg12_mc_renderer *r)
|
|||||||
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
|
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
|
||||||
);
|
);
|
||||||
|
|
||||||
vs_consts->denorm.x = r->surface->width[0];
|
vs_consts->denorm.x = r->surface->width0;
|
||||||
vs_consts->denorm.y = r->surface->height[0];
|
vs_consts->denorm.y = r->surface->height0;
|
||||||
|
|
||||||
pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf.buffer);
|
pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf.buffer);
|
||||||
|
|
||||||
@@ -1633,8 +1633,8 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer
|
|||||||
renderer->past = past;
|
renderer->past = past;
|
||||||
renderer->future = future;
|
renderer->future = future;
|
||||||
renderer->fence = fence;
|
renderer->fence = fence;
|
||||||
renderer->surface_tex_inv_size.x = 1.0f / surface->width[0];
|
renderer->surface_tex_inv_size.x = 1.0f / surface->width0;
|
||||||
renderer->surface_tex_inv_size.y = 1.0f / surface->height[0];
|
renderer->surface_tex_inv_size.y = 1.0f / surface->height0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (num_macroblocks) {
|
while (num_macroblocks) {
|
||||||
|
@@ -231,7 +231,7 @@ i915_update_texture(struct i915_context *i915,
|
|||||||
{
|
{
|
||||||
const struct pipe_texture *pt = &tex->base;
|
const struct pipe_texture *pt = &tex->base;
|
||||||
uint format, pitch;
|
uint format, pitch;
|
||||||
const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0];
|
const uint width = pt->width0, height = pt->height0, depth = pt->depth0;
|
||||||
const uint num_levels = pt->last_level;
|
const uint num_levels = pt->last_level;
|
||||||
unsigned max_lod = num_levels * 4;
|
unsigned max_lod = num_levels * 4;
|
||||||
unsigned tiled = MS3_USE_FENCE_REGS;
|
unsigned tiled = MS3_USE_FENCE_REGS;
|
||||||
|
@@ -105,10 +105,6 @@ i915_miptree_set_level_info(struct i915_texture *tex,
|
|||||||
|
|
||||||
assert(level < PIPE_MAX_TEXTURE_LEVELS);
|
assert(level < PIPE_MAX_TEXTURE_LEVELS);
|
||||||
|
|
||||||
pt->width[level] = w;
|
|
||||||
pt->height[level] = h;
|
|
||||||
pt->depth[level] = d;
|
|
||||||
|
|
||||||
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w);
|
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w);
|
||||||
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h);
|
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h);
|
||||||
|
|
||||||
@@ -168,16 +164,16 @@ i915_scanout_layout(struct i915_texture *tex)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
i915_miptree_set_level_info(tex, 0, 1,
|
i915_miptree_set_level_info(tex, 0, 1,
|
||||||
tex->base.width[0],
|
tex->base.width0,
|
||||||
tex->base.height[0],
|
tex->base.height0,
|
||||||
1);
|
1);
|
||||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||||
|
|
||||||
if (tex->base.width[0] >= 240) {
|
if (tex->base.width0 >= 240) {
|
||||||
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
|
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
|
||||||
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
|
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
|
||||||
tex->hw_tiled = INTEL_TILE_X;
|
tex->hw_tiled = INTEL_TILE_X;
|
||||||
} else if (tex->base.width[0] == 64 && tex->base.height[0] == 64) {
|
} else if (tex->base.width0 == 64 && tex->base.height0 == 64) {
|
||||||
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
|
tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size);
|
||||||
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
|
tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8);
|
||||||
} else {
|
} else {
|
||||||
@@ -185,7 +181,7 @@ i915_scanout_layout(struct i915_texture *tex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
||||||
tex->base.width[0], tex->base.height[0], pt->block.size,
|
tex->base.width0, tex->base.height0, pt->block.size,
|
||||||
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -203,12 +199,12 @@ i915_display_target_layout(struct i915_texture *tex)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* fallback to normal textures for small textures */
|
/* fallback to normal textures for small textures */
|
||||||
if (tex->base.width[0] < 240)
|
if (tex->base.width0 < 240)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
i915_miptree_set_level_info(tex, 0, 1,
|
i915_miptree_set_level_info(tex, 0, 1,
|
||||||
tex->base.width[0],
|
tex->base.width0,
|
||||||
tex->base.height[0],
|
tex->base.height0,
|
||||||
1);
|
1);
|
||||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||||
|
|
||||||
@@ -217,7 +213,7 @@ i915_display_target_layout(struct i915_texture *tex)
|
|||||||
tex->hw_tiled = INTEL_TILE_X;
|
tex->hw_tiled = INTEL_TILE_X;
|
||||||
|
|
||||||
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__,
|
||||||
tex->base.width[0], tex->base.height[0], pt->block.size,
|
tex->base.width0, tex->base.height0, pt->block.size,
|
||||||
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -228,8 +224,8 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
|||||||
{
|
{
|
||||||
struct pipe_texture *pt = &tex->base;
|
struct pipe_texture *pt = &tex->base;
|
||||||
unsigned level;
|
unsigned level;
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
unsigned nblocksx = pt->nblocksx[0];
|
unsigned nblocksx = pt->nblocksx[0];
|
||||||
unsigned nblocksy = pt->nblocksy[0];
|
unsigned nblocksy = pt->nblocksy[0];
|
||||||
|
|
||||||
@@ -254,8 +250,8 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
|||||||
|
|
||||||
tex->total_nblocksy += nblocksy;
|
tex->total_nblocksy += nblocksy;
|
||||||
|
|
||||||
width = minify(width);
|
width = u_minify(width, 1);
|
||||||
height = minify(height);
|
height = u_minify(height, 1);
|
||||||
nblocksx = pf_get_nblocksx(&pt->block, width);
|
nblocksx = pf_get_nblocksx(&pt->block, width);
|
||||||
nblocksy = pf_get_nblocksy(&pt->block, height);
|
nblocksy = pf_get_nblocksy(&pt->block, height);
|
||||||
}
|
}
|
||||||
@@ -267,9 +263,9 @@ i915_miptree_layout_3d(struct i915_texture *tex)
|
|||||||
struct pipe_texture *pt = &tex->base;
|
struct pipe_texture *pt = &tex->base;
|
||||||
unsigned level;
|
unsigned level;
|
||||||
|
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
unsigned depth = pt->depth[0];
|
unsigned depth = pt->depth0;
|
||||||
unsigned nblocksx = pt->nblocksx[0];
|
unsigned nblocksx = pt->nblocksx[0];
|
||||||
unsigned nblocksy = pt->nblocksy[0];
|
unsigned nblocksy = pt->nblocksy[0];
|
||||||
unsigned stack_nblocksy = 0;
|
unsigned stack_nblocksy = 0;
|
||||||
@@ -285,36 +281,34 @@ i915_miptree_layout_3d(struct i915_texture *tex)
|
|||||||
|
|
||||||
stack_nblocksy += MAX2(2, nblocksy);
|
stack_nblocksy += MAX2(2, nblocksy);
|
||||||
|
|
||||||
width = minify(width);
|
width = u_minify(width, 1);
|
||||||
height = minify(height);
|
height = u_minify(height, 1);
|
||||||
depth = minify(depth);
|
|
||||||
nblocksx = pf_get_nblocksx(&pt->block, width);
|
nblocksx = pf_get_nblocksx(&pt->block, width);
|
||||||
nblocksy = pf_get_nblocksy(&pt->block, height);
|
nblocksy = pf_get_nblocksy(&pt->block, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fixup depth image_offsets:
|
/* Fixup depth image_offsets:
|
||||||
*/
|
*/
|
||||||
depth = pt->depth[0];
|
|
||||||
for (level = 0; level <= pt->last_level; level++) {
|
for (level = 0; level <= pt->last_level; level++) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < depth; i++)
|
for (i = 0; i < depth; i++)
|
||||||
i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy);
|
i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy);
|
||||||
|
|
||||||
depth = minify(depth);
|
depth = u_minify(depth, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Multiply slice size by texture depth for total size. It's
|
/* Multiply slice size by texture depth for total size. It's
|
||||||
* remarkable how wasteful of memory the i915 texture layouts
|
* remarkable how wasteful of memory the i915 texture layouts
|
||||||
* are. They are largely fixed in the i945.
|
* are. They are largely fixed in the i945.
|
||||||
*/
|
*/
|
||||||
tex->total_nblocksy = stack_nblocksy * pt->depth[0];
|
tex->total_nblocksy = stack_nblocksy * pt->depth0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
i915_miptree_layout_cube(struct i915_texture *tex)
|
i915_miptree_layout_cube(struct i915_texture *tex)
|
||||||
{
|
{
|
||||||
struct pipe_texture *pt = &tex->base;
|
struct pipe_texture *pt = &tex->base;
|
||||||
unsigned width = pt->width[0], height = pt->height[0];
|
unsigned width = pt->width0, height = pt->height0;
|
||||||
const unsigned nblocks = pt->nblocksx[0];
|
const unsigned nblocks = pt->nblocksx[0];
|
||||||
unsigned level;
|
unsigned level;
|
||||||
unsigned face;
|
unsigned face;
|
||||||
@@ -383,8 +377,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
|||||||
unsigned level;
|
unsigned level;
|
||||||
unsigned x = 0;
|
unsigned x = 0;
|
||||||
unsigned y = 0;
|
unsigned y = 0;
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
unsigned nblocksx = pt->nblocksx[0];
|
unsigned nblocksx = pt->nblocksx[0];
|
||||||
unsigned nblocksy = pt->nblocksy[0];
|
unsigned nblocksy = pt->nblocksy[0];
|
||||||
|
|
||||||
@@ -407,8 +401,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
|||||||
*/
|
*/
|
||||||
if (pt->last_level > 0) {
|
if (pt->last_level > 0) {
|
||||||
unsigned mip1_nblocksx
|
unsigned mip1_nblocksx
|
||||||
= align(pf_get_nblocksx(&pt->block, minify(width)), align_x)
|
= align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x)
|
||||||
+ pf_get_nblocksx(&pt->block, minify(minify(width)));
|
+ pf_get_nblocksx(&pt->block, u_minify(width, 2));
|
||||||
|
|
||||||
if (mip1_nblocksx > nblocksx)
|
if (mip1_nblocksx > nblocksx)
|
||||||
tex->stride = mip1_nblocksx * pt->block.size;
|
tex->stride = mip1_nblocksx * pt->block.size;
|
||||||
@@ -439,8 +433,8 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
|||||||
y += nblocksy;
|
y += nblocksy;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = minify(width);
|
width = u_minify(width, 1);
|
||||||
height = minify(height);
|
height = u_minify(height, 1);
|
||||||
nblocksx = pf_get_nblocksx(&pt->block, width);
|
nblocksx = pf_get_nblocksx(&pt->block, width);
|
||||||
nblocksy = pf_get_nblocksy(&pt->block, height);
|
nblocksy = pf_get_nblocksy(&pt->block, height);
|
||||||
}
|
}
|
||||||
@@ -450,9 +444,9 @@ static void
|
|||||||
i945_miptree_layout_3d(struct i915_texture *tex)
|
i945_miptree_layout_3d(struct i915_texture *tex)
|
||||||
{
|
{
|
||||||
struct pipe_texture *pt = &tex->base;
|
struct pipe_texture *pt = &tex->base;
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
unsigned depth = pt->depth[0];
|
unsigned depth = pt->depth0;
|
||||||
unsigned nblocksx = pt->nblocksx[0];
|
unsigned nblocksx = pt->nblocksx[0];
|
||||||
unsigned nblocksy = pt->nblocksy[0];
|
unsigned nblocksy = pt->nblocksy[0];
|
||||||
unsigned pack_x_pitch, pack_x_nr;
|
unsigned pack_x_pitch, pack_x_nr;
|
||||||
@@ -495,9 +489,9 @@ i945_miptree_layout_3d(struct i915_texture *tex)
|
|||||||
pack_y_pitch >>= 1;
|
pack_y_pitch >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = minify(width);
|
width = u_minify(width, 1);
|
||||||
height = minify(height);
|
height = u_minify(height, 1);
|
||||||
depth = minify(depth);
|
depth = u_minify(depth, 1);
|
||||||
nblocksx = pf_get_nblocksx(&pt->block, width);
|
nblocksx = pf_get_nblocksx(&pt->block, width);
|
||||||
nblocksy = pf_get_nblocksy(&pt->block, height);
|
nblocksy = pf_get_nblocksy(&pt->block, height);
|
||||||
}
|
}
|
||||||
@@ -511,11 +505,11 @@ i945_miptree_layout_cube(struct i915_texture *tex)
|
|||||||
|
|
||||||
const unsigned nblocks = pt->nblocksx[0];
|
const unsigned nblocks = pt->nblocksx[0];
|
||||||
unsigned face;
|
unsigned face;
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]);
|
printf("%s %i, %i\n", __FUNCTION__, pt->width0, pt->height0);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assert(width == height); /* cubemap images are square */
|
assert(width == height); /* cubemap images are square */
|
||||||
@@ -651,8 +645,8 @@ i915_texture_create(struct pipe_screen *screen,
|
|||||||
pipe_reference_init(&tex->base.reference, 1);
|
pipe_reference_init(&tex->base.reference, 1);
|
||||||
tex->base.screen = screen;
|
tex->base.screen = screen;
|
||||||
|
|
||||||
tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]);
|
tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0);
|
||||||
tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]);
|
tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0);
|
||||||
|
|
||||||
if (is->is_i945) {
|
if (is->is_i945) {
|
||||||
if (!i945_miptree_layout(tex))
|
if (!i945_miptree_layout(tex))
|
||||||
@@ -667,7 +661,7 @@ i915_texture_create(struct pipe_screen *screen,
|
|||||||
|
|
||||||
|
|
||||||
/* for scanouts and cursors, cursors arn't scanouts */
|
/* for scanouts and cursors, cursors arn't scanouts */
|
||||||
if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width[0] != 64)
|
if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
|
||||||
buf_usage = INTEL_NEW_SCANOUT;
|
buf_usage = INTEL_NEW_SCANOUT;
|
||||||
else
|
else
|
||||||
buf_usage = INTEL_NEW_TEXTURE;
|
buf_usage = INTEL_NEW_TEXTURE;
|
||||||
@@ -710,7 +704,7 @@ i915_texture_blanket(struct pipe_screen * screen,
|
|||||||
/* Only supports one type */
|
/* Only supports one type */
|
||||||
if (base->target != PIPE_TEXTURE_2D ||
|
if (base->target != PIPE_TEXTURE_2D ||
|
||||||
base->last_level != 0 ||
|
base->last_level != 0 ||
|
||||||
base->depth[0] != 1) {
|
base->depth0 != 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -724,7 +718,7 @@ i915_texture_blanket(struct pipe_screen * screen,
|
|||||||
|
|
||||||
tex->stride = stride[0];
|
tex->stride = stride[0];
|
||||||
|
|
||||||
i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
|
i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
|
||||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||||
|
|
||||||
pipe_buffer_reference(&tex->buffer, buffer);
|
pipe_buffer_reference(&tex->buffer, buffer);
|
||||||
@@ -788,8 +782,8 @@ i915_get_tex_surface(struct pipe_screen *screen,
|
|||||||
pipe_reference_init(&ps->reference, 1);
|
pipe_reference_init(&ps->reference, 1);
|
||||||
pipe_texture_reference(&ps->texture, pt);
|
pipe_texture_reference(&ps->texture, pt);
|
||||||
ps->format = pt->format;
|
ps->format = pt->format;
|
||||||
ps->width = pt->width[level];
|
ps->width = u_minify(pt->width0, level);
|
||||||
ps->height = pt->height[level];
|
ps->height = u_minify(pt->height0, level);
|
||||||
ps->offset = offset;
|
ps->offset = offset;
|
||||||
ps->usage = flags;
|
ps->usage = flags;
|
||||||
}
|
}
|
||||||
@@ -919,7 +913,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen,
|
|||||||
/* Only supports one type */
|
/* Only supports one type */
|
||||||
if (base->target != PIPE_TEXTURE_2D ||
|
if (base->target != PIPE_TEXTURE_2D ||
|
||||||
base->last_level != 0 ||
|
base->last_level != 0 ||
|
||||||
base->depth[0] != 1) {
|
base->depth0 != 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +927,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen,
|
|||||||
|
|
||||||
tex->stride = stride;
|
tex->stride = stride;
|
||||||
|
|
||||||
i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1);
|
i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1);
|
||||||
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
i915_miptree_set_image_offset(tex, 0, 0, 0, 0);
|
||||||
|
|
||||||
tex->buffer = buffer;
|
tex->buffer = buffer;
|
||||||
|
@@ -521,7 +521,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp,
|
|||||||
const struct pipe_sampler_state *sampler = samp->sampler;
|
const struct pipe_sampler_state *sampler = samp->sampler;
|
||||||
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
|
float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]);
|
||||||
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
|
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
|
||||||
float rho = MAX2(dsdx, dsdy) * texture->width[0];
|
float rho = MAX2(dsdx, dsdy) * texture->width0;
|
||||||
float lambda;
|
float lambda;
|
||||||
|
|
||||||
lambda = util_fast_log2(rho);
|
lambda = util_fast_log2(rho);
|
||||||
@@ -545,8 +545,8 @@ compute_lambda_2d(const struct sp_sampler_varient *samp,
|
|||||||
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
|
float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]);
|
||||||
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
|
float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]);
|
||||||
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
|
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
|
||||||
float maxx = MAX2(dsdx, dsdy) * texture->width[0];
|
float maxx = MAX2(dsdx, dsdy) * texture->width0;
|
||||||
float maxy = MAX2(dtdx, dtdy) * texture->height[0];
|
float maxy = MAX2(dtdx, dtdy) * texture->height0;
|
||||||
float rho = MAX2(maxx, maxy);
|
float rho = MAX2(maxx, maxy);
|
||||||
float lambda;
|
float lambda;
|
||||||
|
|
||||||
@@ -573,9 +573,9 @@ compute_lambda_3d(const struct sp_sampler_varient *samp,
|
|||||||
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
|
float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]);
|
||||||
float dpdx = fabsf(p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]);
|
float dpdx = fabsf(p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]);
|
||||||
float dpdy = fabsf(p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]);
|
float dpdy = fabsf(p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]);
|
||||||
float maxx = MAX2(dsdx, dsdy) * texture->width[0];
|
float maxx = MAX2(dsdx, dsdy) * texture->width0;
|
||||||
float maxy = MAX2(dtdx, dtdy) * texture->height[0];
|
float maxy = MAX2(dtdx, dtdy) * texture->height0;
|
||||||
float maxz = MAX2(dpdx, dpdy) * texture->depth[0];
|
float maxz = MAX2(dpdx, dpdy) * texture->depth0;
|
||||||
float rho, lambda;
|
float rho, lambda;
|
||||||
|
|
||||||
rho = MAX2(maxx, maxy);
|
rho = MAX2(maxx, maxy);
|
||||||
@@ -644,8 +644,8 @@ get_texel_2d(const struct sp_sampler_varient *samp,
|
|||||||
const struct pipe_texture *texture = samp->texture;
|
const struct pipe_texture *texture = samp->texture;
|
||||||
unsigned level = addr.bits.level;
|
unsigned level = addr.bits.level;
|
||||||
|
|
||||||
if (x < 0 || x >= (int) texture->width[level] ||
|
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
|
||||||
y < 0 || y >= (int) texture->height[level]) {
|
y < 0 || y >= (int) u_minify(texture->height0, level)) {
|
||||||
return samp->sampler->border_color;
|
return samp->sampler->border_color;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -737,9 +737,9 @@ get_texel_3d(const struct sp_sampler_varient *samp,
|
|||||||
const struct pipe_texture *texture = samp->texture;
|
const struct pipe_texture *texture = samp->texture;
|
||||||
unsigned level = addr.bits.level;
|
unsigned level = addr.bits.level;
|
||||||
|
|
||||||
if (x < 0 || x >= (int) texture->width[level] ||
|
if (x < 0 || x >= (int) u_minify(texture->width0, level) ||
|
||||||
y < 0 || y >= (int) texture->height[level] ||
|
y < 0 || y >= (int) u_minify(texture->height0, level) ||
|
||||||
z < 0 || z >= (int) texture->depth[level]) {
|
z < 0 || z >= (int) u_minify(texture->depth0, level)) {
|
||||||
return samp->sampler->border_color;
|
return samp->sampler->border_color;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -925,7 +925,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
|
|
||||||
@@ -961,8 +961,8 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler,
|
|||||||
|
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
@@ -1008,8 +1008,8 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
@@ -1046,9 +1046,9 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
depth = texture->depth[level0];
|
depth = u_minify(texture->depth0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
@@ -1088,7 +1088,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
|
|
||||||
@@ -1127,8 +1127,8 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
@@ -1174,8 +1174,8 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
@@ -1221,9 +1221,9 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler,
|
|||||||
union tex_tile_address addr;
|
union tex_tile_address addr;
|
||||||
|
|
||||||
level0 = samp->level;
|
level0 = samp->level;
|
||||||
width = texture->width[level0];
|
width = u_minify(texture->width0, level0);
|
||||||
height = texture->height[level0];
|
height = u_minify(texture->height0, level0);
|
||||||
depth = texture->depth[level0];
|
depth = u_minify(texture->depth0, level0);
|
||||||
|
|
||||||
addr.value = 0;
|
addr.value = 0;
|
||||||
addr.bits.level = level0;
|
addr.bits.level = level0;
|
||||||
@@ -1778,8 +1778,8 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp,
|
|||||||
|
|
||||||
samp->texture = texture;
|
samp->texture = texture;
|
||||||
samp->cache = tex_cache;
|
samp->cache = tex_cache;
|
||||||
samp->xpot = util_unsigned_logbase2( texture->width[0] );
|
samp->xpot = util_unsigned_logbase2( texture->width0 );
|
||||||
samp->ypot = util_unsigned_logbase2( texture->height[0] );
|
samp->ypot = util_unsigned_logbase2( texture->height0 );
|
||||||
samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level);
|
samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "util/u_memory.h"
|
#include "util/u_memory.h"
|
||||||
#include "util/u_tile.h"
|
#include "util/u_tile.h"
|
||||||
|
#include "util/u_math.h"
|
||||||
#include "sp_context.h"
|
#include "sp_context.h"
|
||||||
#include "sp_surface.h"
|
#include "sp_surface.h"
|
||||||
#include "sp_texture.h"
|
#include "sp_texture.h"
|
||||||
@@ -246,9 +247,9 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc,
|
|||||||
addr.bits.level,
|
addr.bits.level,
|
||||||
addr.bits.z,
|
addr.bits.z,
|
||||||
PIPE_TRANSFER_READ, 0, 0,
|
PIPE_TRANSFER_READ, 0, 0,
|
||||||
tc->texture->width[addr.bits.level],
|
u_minify(tc->texture->width0, addr.bits.level),
|
||||||
tc->texture->height[addr.bits.level]);
|
u_minify(tc->texture->height0, addr.bits.level));
|
||||||
|
|
||||||
tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
|
tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans);
|
||||||
|
|
||||||
tc->tex_face = addr.bits.face;
|
tc->tex_face = addr.bits.face;
|
||||||
|
@@ -52,16 +52,17 @@ softpipe_texture_layout(struct pipe_screen *screen,
|
|||||||
{
|
{
|
||||||
struct pipe_texture *pt = &spt->base;
|
struct pipe_texture *pt = &spt->base;
|
||||||
unsigned level;
|
unsigned level;
|
||||||
unsigned width = pt->width[0];
|
unsigned width = pt->width0;
|
||||||
unsigned height = pt->height[0];
|
unsigned height = pt->height0;
|
||||||
unsigned depth = pt->depth[0];
|
unsigned depth = pt->depth0;
|
||||||
|
|
||||||
unsigned buffer_size = 0;
|
unsigned buffer_size = 0;
|
||||||
|
|
||||||
|
pt->width0 = width;
|
||||||
|
pt->height0 = height;
|
||||||
|
pt->depth0 = depth;
|
||||||
|
|
||||||
for (level = 0; level <= pt->last_level; level++) {
|
for (level = 0; level <= pt->last_level; level++) {
|
||||||
pt->width[level] = width;
|
|
||||||
pt->height[level] = height;
|
|
||||||
pt->depth[level] = depth;
|
|
||||||
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
|
pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width);
|
||||||
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
|
pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height);
|
||||||
spt->stride[level] = pt->nblocksx[level]*pt->block.size;
|
spt->stride[level] = pt->nblocksx[level]*pt->block.size;
|
||||||
@@ -72,9 +73,9 @@ softpipe_texture_layout(struct pipe_screen *screen,
|
|||||||
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
|
((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) *
|
||||||
spt->stride[level]);
|
spt->stride[level]);
|
||||||
|
|
||||||
width = minify(width);
|
width = u_minify(width, 1);
|
||||||
height = minify(height);
|
height = u_minify(height, 1);
|
||||||
depth = minify(depth);
|
depth = u_minify(depth, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
spt->buffer = screen->buffer_create(screen, 32,
|
spt->buffer = screen->buffer_create(screen, 32,
|
||||||
@@ -96,12 +97,12 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
|
|||||||
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
|
PIPE_BUFFER_USAGE_GPU_READ_WRITE);
|
||||||
unsigned tex_usage = spt->base.tex_usage;
|
unsigned tex_usage = spt->base.tex_usage;
|
||||||
|
|
||||||
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
|
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
|
||||||
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
|
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
|
||||||
|
|
||||||
spt->buffer = screen->surface_buffer_create( screen,
|
spt->buffer = screen->surface_buffer_create( screen,
|
||||||
spt->base.width[0],
|
spt->base.width0,
|
||||||
spt->base.height[0],
|
spt->base.height0,
|
||||||
spt->base.format,
|
spt->base.format,
|
||||||
usage,
|
usage,
|
||||||
tex_usage,
|
tex_usage,
|
||||||
@@ -126,9 +127,9 @@ softpipe_texture_create(struct pipe_screen *screen,
|
|||||||
pipe_reference_init(&spt->base.reference, 1);
|
pipe_reference_init(&spt->base.reference, 1);
|
||||||
spt->base.screen = screen;
|
spt->base.screen = screen;
|
||||||
|
|
||||||
spt->pot = (util_is_power_of_two(template->width[0]) &&
|
spt->pot = (util_is_power_of_two(template->width0) &&
|
||||||
util_is_power_of_two(template->height[0]) &&
|
util_is_power_of_two(template->height0) &&
|
||||||
util_is_power_of_two(template->depth[0]));
|
util_is_power_of_two(template->depth0));
|
||||||
|
|
||||||
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||||
PIPE_TEXTURE_USAGE_PRIMARY)) {
|
PIPE_TEXTURE_USAGE_PRIMARY)) {
|
||||||
@@ -163,7 +164,7 @@ softpipe_texture_blanket(struct pipe_screen * screen,
|
|||||||
/* Only supports one type */
|
/* Only supports one type */
|
||||||
if (base->target != PIPE_TEXTURE_2D ||
|
if (base->target != PIPE_TEXTURE_2D ||
|
||||||
base->last_level != 0 ||
|
base->last_level != 0 ||
|
||||||
base->depth[0] != 1) {
|
base->depth0 != 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,8 +175,8 @@ softpipe_texture_blanket(struct pipe_screen * screen,
|
|||||||
spt->base = *base;
|
spt->base = *base;
|
||||||
pipe_reference_init(&spt->base.reference, 1);
|
pipe_reference_init(&spt->base.reference, 1);
|
||||||
spt->base.screen = screen;
|
spt->base.screen = screen;
|
||||||
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]);
|
spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0);
|
||||||
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
|
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0);
|
||||||
spt->stride[0] = stride[0];
|
spt->stride[0] = stride[0];
|
||||||
|
|
||||||
pipe_buffer_reference(&spt->buffer, buffer);
|
pipe_buffer_reference(&spt->buffer, buffer);
|
||||||
@@ -213,8 +214,8 @@ softpipe_get_tex_surface(struct pipe_screen *screen,
|
|||||||
pipe_reference_init(&ps->reference, 1);
|
pipe_reference_init(&ps->reference, 1);
|
||||||
pipe_texture_reference(&ps->texture, pt);
|
pipe_texture_reference(&ps->texture, pt);
|
||||||
ps->format = pt->format;
|
ps->format = pt->format;
|
||||||
ps->width = pt->width[level];
|
ps->width = u_minify(pt->width0, level);
|
||||||
ps->height = pt->height[level];
|
ps->height = u_minify(pt->height0, level);
|
||||||
ps->offset = spt->level_offset[level];
|
ps->offset = spt->level_offset[level];
|
||||||
ps->usage = usage;
|
ps->usage = usage;
|
||||||
|
|
||||||
@@ -434,9 +435,9 @@ softpipe_video_surface_create(struct pipe_screen *screen,
|
|||||||
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
|
template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
|
||||||
template.last_level = 0;
|
template.last_level = 0;
|
||||||
/* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */
|
/* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */
|
||||||
template.width[0] = util_next_power_of_two(width);
|
template.width0 = util_next_power_of_two(width);
|
||||||
template.height[0] = util_next_power_of_two(height);
|
template.height0 = util_next_power_of_two(height);
|
||||||
template.depth[0] = 1;
|
template.depth0 = 1;
|
||||||
pf_get_block(template.format, &template.block);
|
pf_get_block(template.format, &template.block);
|
||||||
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
||||||
|
|
||||||
|
@@ -83,15 +83,15 @@ void trace_dump_template(const struct pipe_texture *templat)
|
|||||||
trace_dump_member(format, templat, format);
|
trace_dump_member(format, templat, format);
|
||||||
|
|
||||||
trace_dump_member_begin("width");
|
trace_dump_member_begin("width");
|
||||||
trace_dump_array(uint, templat->width, 1);
|
trace_dump_uint(templat->width0);
|
||||||
trace_dump_member_end();
|
trace_dump_member_end();
|
||||||
|
|
||||||
trace_dump_member_begin("height");
|
trace_dump_member_begin("height");
|
||||||
trace_dump_array(uint, templat->height, 1);
|
trace_dump_uint(templat->height0);
|
||||||
trace_dump_member_end();
|
trace_dump_member_end();
|
||||||
|
|
||||||
trace_dump_member_begin("depth");
|
trace_dump_member_begin("depth");
|
||||||
trace_dump_array(uint, templat->depth, 1);
|
trace_dump_uint(templat->depth0);
|
||||||
trace_dump_member_end();
|
trace_dump_member_end();
|
||||||
|
|
||||||
trace_dump_member_begin("block");
|
trace_dump_member_begin("block");
|
||||||
|
@@ -200,9 +200,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header,
|
|||||||
t = tr_tex->texture;
|
t = tr_tex->texture;
|
||||||
rbug_send_texture_info_reply(tr_rbug->con, serial,
|
rbug_send_texture_info_reply(tr_rbug->con, serial,
|
||||||
t->target, t->format,
|
t->target, t->format,
|
||||||
t->width, t->last_level + 1,
|
&t->width0, 1,
|
||||||
t->height, t->last_level + 1,
|
&t->height0, 1,
|
||||||
t->depth, t->last_level + 1,
|
&t->depth0, 1,
|
||||||
t->block.width, t->block.height, t->block.size,
|
t->block.width, t->block.height, t->block.size,
|
||||||
t->last_level,
|
t->last_level,
|
||||||
t->nr_samples,
|
t->nr_samples,
|
||||||
|
@@ -343,9 +343,9 @@ struct pipe_texture
|
|||||||
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
|
enum pipe_texture_target target; /**< PIPE_TEXTURE_x */
|
||||||
enum pipe_format format; /**< PIPE_FORMAT_x */
|
enum pipe_format format; /**< PIPE_FORMAT_x */
|
||||||
|
|
||||||
unsigned width[PIPE_MAX_TEXTURE_LEVELS];
|
unsigned width0;
|
||||||
unsigned height[PIPE_MAX_TEXTURE_LEVELS];
|
unsigned height0;
|
||||||
unsigned depth[PIPE_MAX_TEXTURE_LEVELS];
|
unsigned depth0;
|
||||||
|
|
||||||
struct pipe_format_block block;
|
struct pipe_format_block block;
|
||||||
unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
|
unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "cso_cache/cso_context.h"
|
#include "cso_cache/cso_context.h"
|
||||||
#include "util/u_rect.h"
|
#include "util/u_rect.h"
|
||||||
|
#include "util/u_math.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -64,8 +65,8 @@ update_renderbuffer_surface(struct st_context *st,
|
|||||||
GLuint level;
|
GLuint level;
|
||||||
/* find matching mipmap level size */
|
/* find matching mipmap level size */
|
||||||
for (level = 0; level <= texture->last_level; level++) {
|
for (level = 0; level <= texture->last_level; level++) {
|
||||||
if (texture->width[level] == rtt_width &&
|
if (u_minify(texture->width0, level) == rtt_width &&
|
||||||
texture->height[level] == rtt_height) {
|
u_minify(texture->height0, level) == rtt_height) {
|
||||||
|
|
||||||
pipe_surface_reference(&strb->surface, NULL);
|
pipe_surface_reference(&strb->surface, NULL);
|
||||||
|
|
||||||
|
@@ -145,7 +145,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt)
|
|||||||
const GLuint gSize = ctx->PixelMaps.GtoG.Size;
|
const GLuint gSize = ctx->PixelMaps.GtoG.Size;
|
||||||
const GLuint bSize = ctx->PixelMaps.BtoB.Size;
|
const GLuint bSize = ctx->PixelMaps.BtoB.Size;
|
||||||
const GLuint aSize = ctx->PixelMaps.AtoA.Size;
|
const GLuint aSize = ctx->PixelMaps.AtoA.Size;
|
||||||
const uint texSize = pt->width[0];
|
const uint texSize = pt->width0;
|
||||||
uint *dest;
|
uint *dest;
|
||||||
uint i, j;
|
uint i, j;
|
||||||
|
|
||||||
|
@@ -637,8 +637,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
|
|||||||
y1 = y + height * ctx->Pixel.ZoomY;
|
y1 = y + height * ctx->Pixel.ZoomY;
|
||||||
|
|
||||||
draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex,
|
draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex,
|
||||||
(GLfloat) width / pt->width[0],
|
(GLfloat) width / pt->width0,
|
||||||
(GLfloat) height / pt->height[0]);
|
(GLfloat) height / pt->height0);
|
||||||
|
|
||||||
/* restore state */
|
/* restore state */
|
||||||
cso_restore_rasterizer(cso);
|
cso_restore_rasterizer(cso);
|
||||||
|
@@ -128,9 +128,9 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||||||
template.target = PIPE_TEXTURE_2D;
|
template.target = PIPE_TEXTURE_2D;
|
||||||
template.format = format;
|
template.format = format;
|
||||||
pf_get_block(format, &template.block);
|
pf_get_block(format, &template.block);
|
||||||
template.width[0] = width;
|
template.width0 = width;
|
||||||
template.height[0] = height;
|
template.height0 = height;
|
||||||
template.depth[0] = 1;
|
template.depth0 = 1;
|
||||||
template.last_level = 0;
|
template.last_level = 0;
|
||||||
template.nr_samples = rb->NumSamples;
|
template.nr_samples = rb->NumSamples;
|
||||||
if (pf_is_depth_stencil(format)) {
|
if (pf_is_depth_stencil(format)) {
|
||||||
|
@@ -243,7 +243,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb,
|
|||||||
GLint row, col, dy, dstStride;
|
GLint row, col, dy, dstStride;
|
||||||
|
|
||||||
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) {
|
||||||
y = strb->texture->height[0] - y - height;
|
y = strb->texture->height0 - y - height;
|
||||||
}
|
}
|
||||||
|
|
||||||
trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
|
trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture,
|
||||||
|
@@ -451,9 +451,9 @@ compress_with_blit(GLcontext * ctx,
|
|||||||
templ.target = PIPE_TEXTURE_2D;
|
templ.target = PIPE_TEXTURE_2D;
|
||||||
templ.format = st_mesa_format_to_pipe_format(mesa_format);
|
templ.format = st_mesa_format_to_pipe_format(mesa_format);
|
||||||
pf_get_block(templ.format, &templ.block);
|
pf_get_block(templ.format, &templ.block);
|
||||||
templ.width[0] = width;
|
templ.width0 = width;
|
||||||
templ.height[0] = height;
|
templ.height0 = height;
|
||||||
templ.depth[0] = 1;
|
templ.depth0 = 1;
|
||||||
templ.last_level = 0;
|
templ.last_level = 0;
|
||||||
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
|
||||||
src_tex = screen->texture_create(screen, &templ);
|
src_tex = screen->texture_create(screen, &templ);
|
||||||
@@ -1813,9 +1813,9 @@ st_finalize_texture(GLcontext *ctx,
|
|||||||
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
|
if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) ||
|
||||||
stObj->pt->format != fmt ||
|
stObj->pt->format != fmt ||
|
||||||
stObj->pt->last_level < stObj->lastLevel ||
|
stObj->pt->last_level < stObj->lastLevel ||
|
||||||
stObj->pt->width[0] != firstImage->base.Width2 ||
|
stObj->pt->width0 != firstImage->base.Width2 ||
|
||||||
stObj->pt->height[0] != firstImage->base.Height2 ||
|
stObj->pt->height0 != firstImage->base.Height2 ||
|
||||||
stObj->pt->depth[0] != firstImage->base.Depth2 ||
|
stObj->pt->depth0 != firstImage->base.Depth2 ||
|
||||||
/* Nominal bytes per pixel: */
|
/* Nominal bytes per pixel: */
|
||||||
stObj->pt->block.size / stObj->pt->block.width != cpp)
|
stObj->pt->block.size / stObj->pt->block.width != cpp)
|
||||||
{
|
{
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "util/u_gen_mipmap.h"
|
#include "util/u_gen_mipmap.h"
|
||||||
|
#include "util/u_math.h"
|
||||||
|
|
||||||
#include "cso_cache/cso_cache.h"
|
#include "cso_cache/cso_cache.h"
|
||||||
#include "cso_cache/cso_context.h"
|
#include "cso_cache/cso_context.h"
|
||||||
@@ -133,14 +134,14 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
|
srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
|
||||||
srcLevel, zslice,
|
srcLevel, zslice,
|
||||||
PIPE_TRANSFER_READ, 0, 0,
|
PIPE_TRANSFER_READ, 0, 0,
|
||||||
pt->width[srcLevel],
|
u_minify(pt->width0, srcLevel),
|
||||||
pt->height[srcLevel]);
|
u_minify(pt->height0, srcLevel));
|
||||||
|
|
||||||
dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
|
dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face,
|
||||||
dstLevel, zslice,
|
dstLevel, zslice,
|
||||||
PIPE_TRANSFER_WRITE, 0, 0,
|
PIPE_TRANSFER_WRITE, 0, 0,
|
||||||
pt->width[dstLevel],
|
u_minify(pt->width0, dstLevel),
|
||||||
pt->height[dstLevel]);
|
u_minify(pt->height0, dstLevel));
|
||||||
|
|
||||||
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
|
srcData = (ubyte *) screen->transfer_map(screen, srcTrans);
|
||||||
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
|
dstData = (ubyte *) screen->transfer_map(screen, dstTrans);
|
||||||
@@ -149,13 +150,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
dstStride = dstTrans->stride / dstTrans->block.size;
|
dstStride = dstTrans->stride / dstTrans->block.size;
|
||||||
|
|
||||||
_mesa_generate_mipmap_level(target, datatype, comps,
|
_mesa_generate_mipmap_level(target, datatype, comps,
|
||||||
0 /*border*/,
|
0 /*border*/,
|
||||||
pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel],
|
u_minify(pt->width0, srcLevel),
|
||||||
srcData,
|
u_minify(pt->height0, srcLevel),
|
||||||
srcStride, /* stride in texels */
|
u_minify(pt->depth0, srcLevel),
|
||||||
pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel],
|
srcData,
|
||||||
dstData,
|
srcStride, /* stride in texels */
|
||||||
dstStride); /* stride in texels */
|
u_minify(pt->width0, dstLevel),
|
||||||
|
u_minify(pt->height0, dstLevel),
|
||||||
|
u_minify(pt->depth0, dstLevel),
|
||||||
|
dstData,
|
||||||
|
dstStride); /* stride in texels */
|
||||||
|
|
||||||
screen->transfer_unmap(screen, srcTrans);
|
screen->transfer_unmap(screen, srcTrans);
|
||||||
screen->transfer_unmap(screen, dstTrans);
|
screen->transfer_unmap(screen, dstTrans);
|
||||||
@@ -232,9 +237,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
oldTex->target,
|
oldTex->target,
|
||||||
oldTex->format,
|
oldTex->format,
|
||||||
lastLevel,
|
lastLevel,
|
||||||
oldTex->width[0],
|
oldTex->width0,
|
||||||
oldTex->height[0],
|
oldTex->height0,
|
||||||
oldTex->depth[0],
|
oldTex->depth0,
|
||||||
oldTex->tex_usage);
|
oldTex->tex_usage);
|
||||||
|
|
||||||
/* The texture isn't in a "complete" state yet so set the expected
|
/* The texture isn't in a "complete" state yet so set the expected
|
||||||
@@ -269,9 +274,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target,
|
|||||||
= _mesa_get_tex_image(ctx, texObj, target, srcLevel);
|
= _mesa_get_tex_image(ctx, texObj, target, srcLevel);
|
||||||
struct gl_texture_image *dstImage;
|
struct gl_texture_image *dstImage;
|
||||||
struct st_texture_image *stImage;
|
struct st_texture_image *stImage;
|
||||||
uint dstWidth = pt->width[dstLevel];
|
uint dstWidth = u_minify(pt->width0, dstLevel);
|
||||||
uint dstHeight = pt->height[dstLevel];
|
uint dstHeight = u_minify(pt->height0, dstLevel);
|
||||||
uint dstDepth = pt->depth[dstLevel];
|
uint dstDepth = u_minify(pt->depth0, dstLevel);
|
||||||
uint border = srcImage->Border;
|
uint border = srcImage->Border;
|
||||||
|
|
||||||
dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
|
dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "pipe/p_inlines.h"
|
#include "pipe/p_inlines.h"
|
||||||
#include "util/u_rect.h"
|
#include "util/u_rect.h"
|
||||||
|
#include "util/u_math.h"
|
||||||
|
|
||||||
|
|
||||||
#define DBG if(0) printf
|
#define DBG if(0) printf
|
||||||
@@ -100,9 +101,9 @@ st_texture_create(struct st_context *st,
|
|||||||
pt.target = target;
|
pt.target = target;
|
||||||
pt.format = format;
|
pt.format = format;
|
||||||
pt.last_level = last_level;
|
pt.last_level = last_level;
|
||||||
pt.width[0] = width0;
|
pt.width0 = width0;
|
||||||
pt.height[0] = height0;
|
pt.height0 = height0;
|
||||||
pt.depth[0] = depth0;
|
pt.depth0 = depth0;
|
||||||
pf_get_block(format, &pt.block);
|
pf_get_block(format, &pt.block);
|
||||||
pt.tex_usage = usage;
|
pt.tex_usage = usage;
|
||||||
|
|
||||||
@@ -135,9 +136,9 @@ st_texture_match_image(const struct pipe_texture *pt,
|
|||||||
/* Test if this image's size matches what's expected in the
|
/* Test if this image's size matches what's expected in the
|
||||||
* established texture.
|
* established texture.
|
||||||
*/
|
*/
|
||||||
if (image->Width != pt->width[level] ||
|
if (image->Width != u_minify(pt->width0, level) ||
|
||||||
image->Height != pt->height[level] ||
|
image->Height != u_minify(pt->height0, level) ||
|
||||||
image->Depth != pt->depth[level])
|
image->Depth != u_minify(pt->depth0, level))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
@@ -265,7 +266,7 @@ st_texture_image_data(struct st_context *st,
|
|||||||
{
|
{
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
GLuint depth = dst->depth[level];
|
GLuint depth = u_minify(dst->depth0, level);
|
||||||
GLuint i;
|
GLuint i;
|
||||||
const GLubyte *srcUB = src;
|
const GLubyte *srcUB = src;
|
||||||
struct pipe_transfer *dst_transfer;
|
struct pipe_transfer *dst_transfer;
|
||||||
@@ -275,15 +276,16 @@ st_texture_image_data(struct st_context *st,
|
|||||||
for (i = 0; i < depth; i++) {
|
for (i = 0; i < depth; i++) {
|
||||||
dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
|
dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i,
|
||||||
PIPE_TRANSFER_WRITE, 0, 0,
|
PIPE_TRANSFER_WRITE, 0, 0,
|
||||||
dst->width[level],
|
u_minify(dst->width0, level),
|
||||||
dst->height[level]);
|
u_minify(dst->height0, level));
|
||||||
|
|
||||||
st_surface_data(pipe, dst_transfer,
|
st_surface_data(pipe, dst_transfer,
|
||||||
0, 0, /* dstx, dsty */
|
0, 0, /* dstx, dsty */
|
||||||
srcUB,
|
srcUB,
|
||||||
src_row_stride,
|
src_row_stride,
|
||||||
0, 0, /* source x, y */
|
0, 0, /* source x, y */
|
||||||
dst->width[level], dst->height[level]); /* width, height */
|
u_minify(dst->width0, level),
|
||||||
|
u_minify(dst->height0, level)); /* width, height */
|
||||||
|
|
||||||
screen->tex_transfer_destroy(dst_transfer);
|
screen->tex_transfer_destroy(dst_transfer);
|
||||||
|
|
||||||
@@ -301,9 +303,9 @@ st_texture_image_copy(struct pipe_context *pipe,
|
|||||||
GLuint face)
|
GLuint face)
|
||||||
{
|
{
|
||||||
struct pipe_screen *screen = pipe->screen;
|
struct pipe_screen *screen = pipe->screen;
|
||||||
GLuint width = dst->width[dstLevel];
|
GLuint width = u_minify(dst->width0, dstLevel);
|
||||||
GLuint height = dst->height[dstLevel];
|
GLuint height = u_minify(dst->height0, dstLevel);
|
||||||
GLuint depth = dst->depth[dstLevel];
|
GLuint depth = u_minify(dst->depth0, dstLevel);
|
||||||
struct pipe_surface *src_surface;
|
struct pipe_surface *src_surface;
|
||||||
struct pipe_surface *dst_surface;
|
struct pipe_surface *dst_surface;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
@@ -313,13 +315,13 @@ st_texture_image_copy(struct pipe_context *pipe,
|
|||||||
|
|
||||||
/* find src texture level of needed size */
|
/* find src texture level of needed size */
|
||||||
for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) {
|
for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) {
|
||||||
if (src->width[srcLevel] == width &&
|
if (u_minify(src->width0, srcLevel) == width &&
|
||||||
src->height[srcLevel] == height) {
|
u_minify(src->height0, srcLevel) == height) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(src->width[srcLevel] == width);
|
assert(u_minify(src->width0, srcLevel) == width);
|
||||||
assert(src->height[srcLevel] == height);
|
assert(u_minify(src->height0, srcLevel) == height);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user