浏览代码

texenv: Calculate whether we need to do secondary color on our own.

The _TriangleCaps bit is deprecated, not updated when we require, and
is set based on state that hasn't been updated at that point in
_mesa_update_state_locked().

Fixes incorrect clear color in glsl/twoside.c with meta_clear_tris.
tags/mesa_7_6_rc1
Eric Anholt 16 年前
父节点
当前提交
9cea84b6b5
共有 2 个文件被更改,包括 16 次插入4 次删除
  1. 1
    1
      src/mesa/main/state.c
  2. 15
    3
      src/mesa/main/texenvprogram.c

+ 1
- 1
src/mesa/main/state.c 查看文件

@@ -546,7 +546,7 @@ _mesa_update_state_locked( GLcontext *ctx )

/* Determine which state flags effect vertex/fragment program state */
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
prog_flags |= (_NEW_TEXTURE | _NEW_FOG | _DD_NEW_SEPARATE_SPECULAR |
prog_flags |= (_NEW_TEXTURE | _NEW_FOG |
_NEW_ARRAY | _NEW_LIGHT | _NEW_POINT | _NEW_RENDERMODE);
}
if (ctx->VertexProgram._MaintainTnlProgram) {

+ 15
- 3
src/mesa/main/texenvprogram.c 查看文件

@@ -62,6 +62,18 @@ struct texenvprog_cache_item
struct texenvprog_cache_item *next;
};

static GLboolean
texenv_doing_secondary_color(GLcontext *ctx)
{
if (ctx->Light.Enabled &&
(ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR))
return GL_TRUE;

if (ctx->Fog.ColorSumEnabled)
return GL_TRUE;

return GL_FALSE;
}

/**
* Up to nine instructions per tex unit, plus fog, specular color.
@@ -298,7 +310,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx )
if (ctx->Light.Enabled) {
fp_inputs |= FRAG_BIT_COL0;

if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
if (texenv_doing_secondary_color(ctx))
fp_inputs |= FRAG_BIT_COL1;
}

@@ -416,8 +428,8 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
}
}

/* _DD_NEW_SEPARATE_SPECULAR */
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
/* _NEW_LIGHT | _NEW_FOG */
if (texenv_doing_secondary_color(ctx)) {
key->separate_specular = 1;
inputs_referenced |= FRAG_BIT_COL1;
}

正在加载...
取消
保存