mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-14 14:28:08 +02:00
r300g: Properly take the sampler view's first_level into account when sampling.
Signed-off-by: Brian Paul <brianp@vmware.com> Signed-off-by: Marek Olšák <maraeo@gmail.com>
This commit is contained in:
parent
08070cead0
commit
1bcdc1e319
1 changed files with 20 additions and 14 deletions
|
|
@ -768,7 +768,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
||||||
struct r300_sampler_state *sampler;
|
struct r300_sampler_state *sampler;
|
||||||
struct r300_sampler_view *view;
|
struct r300_sampler_view *view;
|
||||||
struct r300_resource *tex;
|
struct r300_resource *tex;
|
||||||
unsigned min_level, max_level, i, j, size;
|
unsigned base_level, min_level, level_count, i, j, size;
|
||||||
unsigned count = MIN2(state->sampler_view_count,
|
unsigned count = MIN2(state->sampler_view_count,
|
||||||
state->sampler_state_count);
|
state->sampler_state_count);
|
||||||
boolean has_us_format = r300->screen->caps.has_us_format;
|
boolean has_us_format = r300->screen->caps.has_us_format;
|
||||||
|
|
@ -801,21 +801,27 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
||||||
r300->screen->caps.is_r500);
|
r300->screen->caps.is_r500);
|
||||||
|
|
||||||
/* determine min/max levels */
|
/* determine min/max levels */
|
||||||
max_level = MIN3(sampler->max_lod + view->base.u.tex.first_level,
|
base_level = view->base.u.tex.first_level;
|
||||||
tex->b.b.b.last_level, view->base.u.tex.last_level);
|
min_level = sampler->min_lod;
|
||||||
min_level = MIN2(sampler->min_lod + view->base.u.tex.first_level,
|
level_count = MIN3(sampler->max_lod,
|
||||||
max_level);
|
tex->b.b.b.last_level - base_level,
|
||||||
|
view->base.u.tex.last_level - base_level);
|
||||||
|
|
||||||
if (tex->tex.is_npot && min_level > 0) {
|
if (base_level + min_level) {
|
||||||
/* Even though we do not implement mipmapping for NPOT
|
unsigned offset;
|
||||||
* textures, we should at least honor the minimum level
|
|
||||||
* which is allowed to be displayed. We do this by setting up
|
if (tex->tex.is_npot) {
|
||||||
* the i-th mipmap level as the zero level. */
|
/* Even though we do not implement mipmapping for NPOT
|
||||||
unsigned offset = tex->tex_offset +
|
* textures, we should at least honor the minimum level
|
||||||
tex->tex.offset_in_bytes[min_level];
|
* which is allowed to be displayed. We do this by setting up
|
||||||
|
* an i-th mipmap level as the zero level. */
|
||||||
|
base_level += min_level;
|
||||||
|
}
|
||||||
|
offset = tex->tex_offset +
|
||||||
|
tex->tex.offset_in_bytes[base_level];
|
||||||
|
|
||||||
r300_texture_setup_format_state(r300->screen, tex,
|
r300_texture_setup_format_state(r300->screen, tex,
|
||||||
min_level,
|
base_level,
|
||||||
&texstate->format);
|
&texstate->format);
|
||||||
texstate->format.tile_config |= offset & 0xffffffe0;
|
texstate->format.tile_config |= offset & 0xffffffe0;
|
||||||
assert((offset & 0x1f) == 0);
|
assert((offset & 0x1f) == 0);
|
||||||
|
|
@ -892,7 +898,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* the MAX_MIP level is the largest (finest) one */
|
/* the MAX_MIP level is the largest (finest) one */
|
||||||
texstate->format.format0 |= R300_TX_NUM_LEVELS(max_level);
|
texstate->format.format0 |= R300_TX_NUM_LEVELS(level_count);
|
||||||
texstate->filter0 |= R300_TX_MAX_MIP_LEVEL(min_level);
|
texstate->filter0 |= R300_TX_MAX_MIP_LEVEL(min_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue