summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-12-17 08:59:32 +0100
committerMarek Olšák <maraeo@gmail.com>2010-12-17 13:17:52 +0100
commitdaffaca53e47faeaaefb98ca46fe4870133d9f02 (patch)
tree481f292b698e3896c44653c866725b9c1f8392e9 /src/gallium/drivers/r300/r300_state.c
parentd0f8eea9a06d8268a21ac58b134964a602f9594e (diff)
r300g: finally fix the texture corruption on r3xx-r4xx
Even though a bound texture stays bound when calling set_fragment_sampler_views, it must be assigned a new cache region depending on the occupancy of other texture units. This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=28800 Thanks to Álmos <aaalmosss@gmail.com> for finding the bug in the code. NOTE: This is a candidate for both the 7.9 and 7.10 branches.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 0ad8a1f420..f902db54cc 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1298,29 +1298,27 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
}
for (i = 0; i < count; i++) {
- if (&state->sampler_views[i]->base != views[i]) {
- pipe_sampler_view_reference(
- (struct pipe_sampler_view**)&state->sampler_views[i],
- views[i]);
+ pipe_sampler_view_reference(
+ (struct pipe_sampler_view**)&state->sampler_views[i],
+ views[i]);
- if (!views[i]) {
- continue;
- }
+ if (!views[i]) {
+ continue;
+ }
- /* A new sampler view (= texture)... */
- dirty_tex = TRUE;
+ /* A new sampler view (= texture)... */
+ dirty_tex = TRUE;
- /* Set the texrect factor in the fragment shader.
+ /* Set the texrect factor in the fragment shader.
* Needed for RECT and NPOT fallback. */
- texture = r300_texture(views[i]->texture);
- if (texture->desc.is_npot) {
- r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
- }
+ texture = r300_texture(views[i]->texture);
+ if (texture->desc.is_npot) {
+ r300_mark_atom_dirty(r300, &r300->fs_rc_constant_state);
+ }
- state->sampler_views[i]->texcache_region =
+ state->sampler_views[i]->texcache_region =
r300_assign_texture_cache_region(view_index, real_num_views);
- view_index++;
- }
+ view_index++;
}
for (i = count; i < tex_units; i++) {