uint32_t filter = 0;
ps = malloc(sizeof(struct nv40_sampler_state));
-
+
+ ps->fmt = 0;
+ if (!cso->normalized_coords)
+ ps->fmt |= NV40TCL_TEX_FORMAT_RECT;
+
+ ps->wrap = ((wrap_mode(cso->wrap_s) << NV40TCL_TEX_WRAP_S_SHIFT) |
+ (wrap_mode(cso->wrap_t) << NV40TCL_TEX_WRAP_T_SHIFT) |
+ (wrap_mode(cso->wrap_r) << NV40TCL_TEX_WRAP_R_SHIFT));
+
+ ps->en = 0;
+ if (cso->max_anisotropy >= 2.0) {
+ /* no idea, binary driver sets it, works without it.. meh.. */
+ ps->wrap |= (1 << 5);
+
+ if (cso->max_anisotropy >= 16.0) {
+ ps->en |= (7 << 4);
+ } else
+ if (cso->max_anisotropy >= 12.0) {
+ ps->en |= (6 << 4);
+ } else
+ if (cso->max_anisotropy >= 10.0) {
+ ps->en |= (5 << 4);
+ } else
+ if (cso->max_anisotropy >= 8.0) {
+ ps->en |= (4 << 4);
+ } else
+ if (cso->max_anisotropy >= 6.0) {
+ ps->en |= (3 << 4);
+ } else
+ if (cso->max_anisotropy >= 4.0) {
+ ps->en |= (2 << 4);
+ } else {
+ ps->en |= (1 << 4); /* 2.0 */
+ }
+ }
+
switch (cso->mag_img_filter) {
case PIPE_TEX_FILTER_LINEAR:
filter |= NV40TCL_TEX_FILTER_MAG_LINEAR;
break;
}
-
- ps->wrap = ((wrap_mode(cso->wrap_s) << NV40TCL_TEX_WRAP_S_SHIFT) |
- (wrap_mode(cso->wrap_t) << NV40TCL_TEX_WRAP_T_SHIFT) |
- (wrap_mode(cso->wrap_r) << NV40TCL_TEX_WRAP_R_SHIFT));
ps->filt = filter;
+
ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) |
(float_to_ubyte(cso->border_color[0]) << 16) |
(float_to_ubyte(cso->border_color[1]) << 8) |
return;
}
- txf = tf->format | 0x8000;
+ txf = ps->fmt;
+ txf |= tf->format | 0x8000;
txf |= ((mt->last_level - mt->first_level + 1) <<
NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT);
NOUVEAU_BO_OR | NOUVEAU_BO_RD, NV40TCL_TEX_FORMAT_DMA0,
NV40TCL_TEX_FORMAT_DMA1);
OUT_RING (ps->wrap);
- OUT_RING (NV40TCL_TEX_ENABLE_ENABLE |
+ OUT_RING (NV40TCL_TEX_ENABLE_ENABLE | ps->en |
(0x00078000) /* mipmap related? */);
OUT_RING (txs);
OUT_RING (ps->filt | 0x3fd6 /*voodoo*/);