X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fnouveau%2Fnv04_context.c;h=3140af56fdd9889212023568afbef34fdbf5b0c0;hb=b2ddb93ff3b8c88682634ccdef247967e31fab84;hp=6834f7cd3dc60fb2e868651c7dab809990c37305;hpb=02224ec4e0de8072c9d730821f88e0a00212ff50;p=mesa.git diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index 6834f7cd3dc..3140af56fdd 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -28,21 +28,38 @@ #include "nouveau_context.h" #include "nouveau_fbo.h" #include "nouveau_util.h" -#include "nouveau_class.h" +#include "nv04_3d.xml.h" #include "nv04_driver.h" +static GLboolean +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 || + u->EnvMode == GL_COMBINE || + u->EnvMode == GL_COMBINE4_NV || + u->EnvMode == GL_BLEND || + u->EnvMode == GL_ADD; +} + struct nouveau_grobj * -nv04_context_engine(GLcontext *ctx) +nv04_context_engine(struct gl_context *ctx) { struct nv04_context *nctx = to_nv04_context(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; struct nouveau_grobj *fahrenheit; - if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE || - ctx->Texture.Unit[0].EnvMode == GL_BLEND || - ctx->Texture.Unit[0].EnvMode == GL_ADD || + if ((ctx->Texture.Unit[0]._ReallyEnabled && + texunit_needs_combiners(&ctx->Texture.Unit[0])) || ctx->Texture.Unit[1]._ReallyEnabled || - ctx->Stencil.Enabled) + ctx->Stencil.Enabled || + !(ctx->Color.ColorMask[0][RCOMP] && + ctx->Color.ColorMask[0][GCOMP] && + ctx->Color.ColorMask[0][BCOMP] && + ctx->Color.ColorMask[0][ACOMP])) fahrenheit = hw->eng3dm; else fahrenheit = hw->eng3d; @@ -73,23 +90,23 @@ static void nv04_channel_flush_notify(struct nouveau_channel *chan) { struct nouveau_context *nctx = chan->user_private; - GLcontext *ctx = &nctx->base; + struct gl_context *ctx = &nctx->base; if (nctx->fallback < SWRAST) { - /* Flushing seems to clobber the engine context. */ + nouveau_bo_state_emit(ctx); + + /* Reemit the engine state. */ context_emit(ctx, TEX_OBJ0); context_emit(ctx, TEX_OBJ1); context_emit(ctx, TEX_ENV0); context_emit(ctx, TEX_ENV1); context_emit(ctx, CONTROL); context_emit(ctx, BLEND); - - nouveau_bo_state_emit(ctx); } } static void -nv04_hwctx_init(GLcontext *ctx) +nv04_hwctx_init(struct gl_context *ctx) { struct nouveau_channel *chan = context_chan(ctx); struct nouveau_hw_state *hw = &to_nouveau_context(ctx)->hw; @@ -119,7 +136,7 @@ nv04_hwctx_init(GLcontext *ctx) } static void -init_dummy_texture(GLcontext *ctx) +init_dummy_texture(struct gl_context *ctx) { struct nouveau_surface *s = &to_nv04_context(ctx)->dummy_texture; @@ -133,7 +150,7 @@ init_dummy_texture(GLcontext *ctx) } static void -nv04_context_destroy(GLcontext *ctx) +nv04_context_destroy(struct gl_context *ctx) { struct nouveau_context *nctx = to_nouveau_context(ctx); @@ -149,13 +166,13 @@ nv04_context_destroy(GLcontext *ctx) FREE(ctx); } -static GLcontext * -nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual, - GLcontext *share_ctx) +static struct gl_context * +nv04_context_create(struct nouveau_screen *screen, const struct gl_config *visual, + struct gl_context *share_ctx) { struct nv04_context *nctx; struct nouveau_hw_state *hw; - GLcontext *ctx; + struct gl_context *ctx; int ret; nctx = CALLOC_STRUCT(nv04_context); @@ -171,6 +188,7 @@ nv04_context_create(struct nouveau_screen *screen, const GLvisual *visual, hw->chan->flush_notify = nv04_channel_flush_notify; /* GL constants. */ + ctx->Const.MaxTextureLevels = 11; ctx->Const.MaxTextureCoordUnits = NV04_TEXTURE_UNITS; ctx->Const.MaxTextureImageUnits = NV04_TEXTURE_UNITS; ctx->Const.MaxTextureUnits = NV04_TEXTURE_UNITS;