X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fnouveau%2Fnv04_context.c;h=3cc219beab44697cabb78efee6501d0c50c62449;hb=67b53ee41837bb4438dd473f92b4906734cc4fbe;hp=921f474ce7e6d46ac9fa6538dd5f4e04fab65a07;hpb=2e47d01c9e5325906cf3bb979279599991c6328e;p=mesa.git diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 921f474ce7e..3cc219beab4 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -37,8 +37,8 @@ texunit_needs_combiners(struct gl_texture_unit *u) struct gl_texture_object *t = u->_Current; struct gl_texture_image *ti = t->Image[0][t->BaseLevel]; - return ti->TexFormat == MESA_FORMAT_A8 || - ti->TexFormat == MESA_FORMAT_L8 || + return ti->TexFormat == MESA_FORMAT_A_UNORM8 || + ti->TexFormat == MESA_FORMAT_L_UNORM8 || u->EnvMode == GL_COMBINE || u->EnvMode == GL_COMBINE4_NV || u->EnvMode == GL_BLEND || @@ -53,9 +53,9 @@ nv04_context_engine(struct gl_context *ctx) struct nouveau_pushbuf *push = context_push(ctx); struct nouveau_object *fahrenheit; - if ((ctx->Texture.Unit[0]._ReallyEnabled && + if ((ctx->Texture.Unit[0]._Current && texunit_needs_combiners(&ctx->Texture.Unit[0])) || - ctx->Texture.Unit[1]._ReallyEnabled || + ctx->Texture.Unit[1]._Current || ctx->Stencil.Enabled || !(ctx->Color.ColorMask[0][RCOMP] && ctx->Color.ColorMask[0][GCOMP] && @@ -66,26 +66,9 @@ nv04_context_engine(struct gl_context *ctx) fahrenheit = hw->eng3d; if (fahrenheit != nctx->eng3d) { - nctx->eng3d = fahrenheit; - BEGIN_NV04(push, NV01_SUBC(3D, OBJECT), 1); PUSH_DATA (push, fahrenheit->handle); - - if (nv04_mtex_engine(fahrenheit)) { - context_dirty_i(ctx, TEX_ENV, 0); - context_dirty_i(ctx, TEX_ENV, 1); - context_dirty_i(ctx, TEX_OBJ, 0); - context_dirty_i(ctx, TEX_OBJ, 1); - context_dirty(ctx, CONTROL); - context_dirty(ctx, BLEND); - } else { - nouveau_bufctx_reset(to_nouveau_context(ctx)->hw. - bufctx, BUFCTX_TEX(1)); - context_dirty_i(ctx, TEX_ENV, 0); - context_dirty_i(ctx, TEX_OBJ, 0); - context_dirty(ctx, CONTROL); - context_dirty(ctx, BLEND); - } + nctx->eng3d = fahrenheit; } return fahrenheit; @@ -131,7 +114,7 @@ init_dummy_texture(struct gl_context *ctx) nouveau_surface_alloc(ctx, s, SWIZZLED, NOUVEAU_BO_MAP | NOUVEAU_BO_VRAM, - MESA_FORMAT_ARGB8888, 1, 1); + MESA_FORMAT_B8G8R8A8_UNORM, 1, 1); nouveau_bo_map(s->bo, NOUVEAU_BO_WR, context_client(ctx)); *(uint32_t *)s->bo->map = 0xffffffff; @@ -151,11 +134,12 @@ nv04_context_destroy(struct gl_context *ctx) nouveau_object_del(&nctx->hw.surf3d); nouveau_context_deinit(ctx); - FREE(ctx); + free(ctx); } static struct gl_context * -nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual, +nv04_context_create(struct nouveau_screen *screen, gl_api api, + const struct gl_config *visual, struct gl_context *share_ctx) { struct nv04_context *nctx; @@ -170,13 +154,13 @@ nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visua ctx = &nctx->base.base; hw = &nctx->base.hw; - if (!nouveau_context_init(ctx, screen, visual, share_ctx)) + if (!nouveau_context_init(ctx, api, screen, visual, share_ctx)) goto fail; /* GL constants. */ ctx->Const.MaxTextureLevels = 11; ctx->Const.MaxTextureCoordUnits = NV04_TEXTURE_UNITS; - ctx->Const.MaxTextureImageUnits = NV04_TEXTURE_UNITS; + ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = NV04_TEXTURE_UNITS; ctx->Const.MaxTextureUnits = NV04_TEXTURE_UNITS; ctx->Const.MaxTextureMaxAnisotropy = 2; ctx->Const.MaxTextureLodBias = 15;