summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-03-09 11:57:16 -0600
committerBrian Paul <brianp@vmware.com>2009-03-09 11:57:16 -0600
commit549586c3197ba5f0aee90d09cdfb6a3f403277f7 (patch)
treee3907140b0052d91b5ddab8a8d55546f1813390d
parent463ac421a53c769922f174b3a07f7014f64b3234 (diff)
i965: fix cube map lock-up / corruption
If we're using anything but GL_NEAREST sampling of a cube map, we need to use the BRW_TEXCOORDMODE_CUBE texcoord wrap mode. Before this, the GPU would either lock up or subsequent texture filtering would be corrupted. (cherry picked from master, commit 6f915b10d5963466567ea5445631192fd9c4e802)
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 8c9cb789453..318b1453c4b 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -95,6 +95,7 @@ struct wm_sampler_key {
int sampler_count;
struct wm_sampler_entry {
+ GLenum tex_target;
GLenum wrap_r, wrap_s, wrap_t;
float maxlod, minlod;
float lod_bias;
@@ -168,19 +169,20 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
}
}
- sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
- sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);
- sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t);
-
- /* Fulsim complains if I don't do this. Hardware doesn't mind:
- */
-#if 0
- if (texObj->Target == GL_TEXTURE_CUBE_MAP_ARB) {
+ if (key->tex_target == GL_TEXTURE_CUBE_MAP &&
+ (key->minfilter != GL_NEAREST || key->magfilter != GL_NEAREST)) {
+ /* If we're using anything but nearest sampling for a cube map, we
+ * need to set this wrap mode to avoid GPU lock-ups.
+ */
sampler->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CUBE;
sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CUBE;
sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CUBE;
}
-#endif
+ else {
+ sampler->ss1.r_wrap_mode = translate_wrap_mode(key->wrap_r);
+ sampler->ss1.s_wrap_mode = translate_wrap_mode(key->wrap_s);
+ sampler->ss1.t_wrap_mode = translate_wrap_mode(key->wrap_t);
+ }
/* Set shadow function:
*/
@@ -233,6 +235,8 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
struct gl_texture_image *firstImage =
texObj->Image[0][intelObj->firstLevel];
+ entry->tex_target = texObj->Target;
+
entry->wrap_r = texObj->WrapR;
entry->wrap_s = texObj->WrapS;
entry->wrap_t = texObj->WrapT;