const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
- struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *unit =
+ &ctx->Texture.FixedFuncUnit[i];
int j;
for (j = 0; j < 4; j++) {
struct nouveau_surface *s;
struct gl_texture_image *ti;
const struct gl_sampler_object *sa;
- uint32_t tx_format, tx_filter, tx_wrap, tx_enable;
+ uint8_t r, g, b, a;
+ uint32_t tx_format, tx_filter, tx_wrap, tx_bcolor, tx_enable;
PUSH_RESET(push, BUFCTX_TEX(i));
| NV20_3D_TEX_FORMAT_NO_BORDER
| 1 << 16;
- tx_wrap = nvgl_wrap_mode(sa->WrapR) << 16
- | nvgl_wrap_mode(sa->WrapT) << 8
- | nvgl_wrap_mode(sa->WrapS) << 0;
+ switch (t->Target) {
+ case GL_TEXTURE_1D:
+ tx_wrap = NV20_3D_TEX_WRAP_R_CLAMP_TO_EDGE
+ | NV20_3D_TEX_WRAP_T_CLAMP_TO_EDGE
+ | nvgl_wrap_mode_nv20(sa->WrapS) << 0;
+ break;
+
+ default:
+ tx_wrap = nvgl_wrap_mode_nv20(sa->WrapR) << 16
+ | nvgl_wrap_mode_nv20(sa->WrapT) << 8
+ | nvgl_wrap_mode_nv20(sa->WrapS) << 0;
+ break;
+ }
tx_filter = nvgl_filter_mode(sa->MagFilter) << 24
| nvgl_filter_mode(sa->MinFilter) << 16
| 2 << 12;
+ r = FLOAT_TO_UBYTE(sa->BorderColor.f[0]);
+ g = FLOAT_TO_UBYTE(sa->BorderColor.f[1]);
+ b = FLOAT_TO_UBYTE(sa->BorderColor.f[2]);
+ a = FLOAT_TO_UBYTE(sa->BorderColor.f[3]);
+ switch (ti->_BaseFormat) {
+ case GL_LUMINANCE:
+ a = 0xff;
+ /* fallthrough */
+ case GL_LUMINANCE_ALPHA:
+ g = b = r;
+ break;
+ case GL_RGB:
+ a = 0xff;
+ break;
+ case GL_INTENSITY:
+ g = b = a = r;
+ break;
+ case GL_ALPHA:
+ r = g = b = 0;
+ break;
+ }
+ tx_bcolor = b << 0 | g << 8 | r << 16 | a << 24;
+
tx_enable = NV20_3D_TEX_ENABLE_ENABLE
| log2i(sa->MaxAnisotropy) << 4;
BEGIN_NV04(push, NV20_3D(TEX_FILTER(i)), 1);
PUSH_DATA (push, tx_filter);
+ BEGIN_NV04(push, NV20_3D(TEX_BORDER_COLOR(i)), 1);
+ PUSH_DATA (push, tx_bcolor);
+
BEGIN_NV04(push, NV20_3D(TEX_ENABLE(i)), 1);
PUSH_DATA (push, tx_enable);