summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-12-18 10:17:52 +0100
committerMarek Olšák <maraeo@gmail.com>2010-12-18 10:17:52 +0100
commitbe1f4cfd96b20a7d5bcc845f1b40b38ffaefe4a9 (patch)
tree805f029a9444b085a1355f4702666bfffba2511c
parent7b6b66d617b1f14f79fb7af2dad268a68e35b9e3 (diff)
downloadmesa-be1f4cfd96b20a7d5bcc845f1b40b38ffaefe4a9.tar.gz
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. (cherry picked from commit daffaca53e47faeaaefb98ca46fe4870133d9f02) Conflicts: src/gallium/drivers/r300/r300_state.c
-rw-r--r--src/gallium/drivers/r300/r300_state.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index b114892ab75..08e914a1860 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1313,29 +1313,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.
- * Needed for RECT and NPOT fallback. */
- texture = r300_texture(views[i]->texture);
- if (texture->desc.is_npot) {
- r300->fs_rc_constant_state.dirty = TRUE;
- }
+ /* 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->fs_rc_constant_state.dirty = TRUE;
+ }
- 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++) {