{
struct gl_context *ctx = &brw->ctx;
/* _NEW_PROGRAM */
- struct gl_shader_program *prog = ctx->_Shader->_CurrentFragmentProgram;
-
- if (!prog || !prog->_LinkedShaders[MESA_SHADER_FRAGMENT])
- return;
+ struct gl_program *prog = ctx->_Shader->_CurrentFragmentProgram;
/* BRW_NEW_FS_PROG_DATA */
- brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program,
- &brw->wm.base, brw->wm.base.prog_data);
+ brw_upload_ubo_surfaces(brw, prog, &brw->wm.base, brw->wm.base.prog_data);
}
const struct brw_tracked_state brw_wm_ubo_surfaces = {
* the blend equation or "blend_support_all_equations", the error
* INVALID_OPERATION is generated [...]"
*/
- const struct gl_shader_program *sh_prog =
- ctx->_Shader->_CurrentFragmentProgram;
- const GLbitfield blend_support = !sh_prog ? 0 :
- sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->sh.fs.BlendSupport;
+ const struct gl_program *prog = ctx->_Shader->_CurrentFragmentProgram;
+ const GLbitfield blend_support = !prog ? 0 : prog->sh.fs.BlendSupport;
if ((blend_support & ctx->Color._AdvancedBlendMode) == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
_mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram[i],
NULL);
}
- _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->Shader._CurrentFragmentProgram, NULL);
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram, NULL);
/* Extended for ARB_separate_shader_objects */
/* Empty for now. */
break;
case MESA_SHADER_FRAGMENT:
- if (*target == ctx->_Shader->_CurrentFragmentProgram) {
- _mesa_reference_shader_program(ctx,
- &ctx->_Shader->_CurrentFragmentProgram,
- NULL);
+ if (*target != NULL &&
+ ((*target)->_LinkedShaders[MESA_SHADER_FRAGMENT] &&
+ (*target)->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program ==
+ ctx->_Shader->_CurrentFragmentProgram)) {
+ _mesa_reference_program(ctx,
+ &ctx->_Shader->_CurrentFragmentProgram,
+ NULL);
}
break;
}
if (fsProg && fsProg->data->LinkStatus
&& fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]) {
/* Use GLSL fragment shader */
- _mesa_reference_shader_program(ctx,
- &ctx->_Shader->_CurrentFragmentProgram,
- fsProg);
+ _mesa_reference_program(ctx, &ctx->_Shader->_CurrentFragmentProgram,
+ fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
fsProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
}
else if (ctx->FragmentProgram._Enabled) {
/* Use user-defined fragment program */
- _mesa_reference_shader_program(ctx,
- &ctx->_Shader->_CurrentFragmentProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->_Shader->_CurrentFragmentProgram,
+ NULL);
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
ctx->FragmentProgram.Current);
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
else if (ctx->ATIFragmentShader._Enabled &&
ctx->ATIFragmentShader.Current->Program) {
/* Use the enabled ATI fragment shader's associated program */
- _mesa_reference_shader_program(ctx,
- &ctx->_Shader->_CurrentFragmentProgram,
- NULL);
+ _mesa_reference_program(ctx, &ctx->_Shader->_CurrentFragmentProgram,
+ NULL);
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
ctx->ATIFragmentShader.Current->Program);
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,
/* Use fragment program generated from fixed-function state */
struct gl_shader_program *f = _mesa_get_fixed_func_fragment_program(ctx);
- _mesa_reference_shader_program(ctx,
- &ctx->_Shader->_CurrentFragmentProgram,
- f);
+ _mesa_reference_program(ctx, &ctx->_Shader->_CurrentFragmentProgram,
+ f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
_mesa_reference_program(ctx, &ctx->FragmentProgram._Current,
f->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program);
_mesa_reference_program(ctx, &ctx->FragmentProgram._TexEnvProgram,