summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-10-10 15:26:28 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-10-10 15:26:28 +0100
commit3a3801c1431203fc4dca24d56577995ae2e78956 (patch)
tree7ec341b78ecc62dc1a238392aff828c363148d69 /src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
parentd7f1cb5b5a134b63227d5746a2dd1f05597c5c2f (diff)
parent7216679c1998b49ff5b08e6b43f8d5779415bf54 (diff)
Merge commit 'origin/master' into gallium-0.2
Conflicts: src/mesa/glapi/descrip.mms src/mesa/shader/grammar/descrip.mms
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_sampler_state.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c23
1 files changed, 20 insertions, 3 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 e1db31ec08..f12ef47a7d 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -229,6 +229,9 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
struct wm_sampler_entry *entry = &key->sampler[unit];
struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[unit];
struct gl_texture_object *texObj = texUnit->_Current;
+ struct intel_texture_object *intelObj = intel_texture_object(texObj);
+ struct gl_texture_image *firstImage =
+ texObj->Image[0][intelObj->firstLevel];
entry->wrap_r = texObj->WrapR;
entry->wrap_s = texObj->WrapS;
@@ -244,8 +247,22 @@ brw_wm_sampler_populate_key(struct brw_context *brw,
entry->comparefunc = texObj->CompareFunc;
dri_bo_unreference(brw->wm.sdc_bo[unit]);
- brw->wm.sdc_bo[unit] = upload_default_color(brw, texObj->BorderColor);
-
+ if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
+ float bordercolor[4] = {
+ texObj->BorderColor[0],
+ texObj->BorderColor[0],
+ texObj->BorderColor[0],
+ texObj->BorderColor[0]
+ };
+ /* GL specs that border color for depth textures is taken from the
+ * R channel, while the hardware uses A. Spam R into all the
+ * channels for safety.
+ */
+ brw->wm.sdc_bo[unit] = upload_default_color(brw, bordercolor);
+ } else {
+ brw->wm.sdc_bo[unit] = upload_default_color(brw,
+ texObj->BorderColor);
+ }
key->sampler_count = unit + 1;
}
}
@@ -304,7 +321,7 @@ static void upload_wm_samplers( struct brw_context *brw )
continue;
dri_bo_emit_reloc(brw->wm.sampler_bo,
- I915_GEM_DOMAIN_INSTRUCTION, 0,
+ I915_GEM_DOMAIN_SAMPLER, 0,
0,
i * sizeof(struct brw_sampler_state) +
offsetof(struct brw_sampler_state, ss2),