ST_NEW_SAMPLE_STATE | \
ST_NEW_SAMPLE_SHADING)
-#define ST_NEW_VERTEX_PROGRAM(st, p) (p->affected_states | \
+#define ST_NEW_VERTEX_PROGRAM(st, p) ((p)->affected_states | \
(st_user_clip_planes_enabled(st->ctx) ? \
ST_NEW_CLIP_STATE : 0))
if (!stfp->shader_program && /* not GLSL->NIR */
!st_translate_fragment_program(st, stfp))
return false;
-
- if (st->fp == stfp)
- st->dirty |= stfp->affected_states;
} else if (target == GL_VERTEX_PROGRAM_ARB) {
struct st_vertex_program *stvp = (struct st_vertex_program *) prog;
if (!stvp->shader_program && /* not GLSL->NIR */
!st_translate_vertex_program(st, stvp))
return false;
-
- if (st->vp == stvp)
- st->dirty |= ST_NEW_VERTEX_PROGRAM(st, stvp);
} else {
struct st_common_program *stcp = st_common_program(prog);
if (!stcp->shader_program && /* not GLSL->NIR */
!st_translate_common_program(st, stcp))
return false;
-
- if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
- (prog->info.stage == MESA_SHADER_TESS_EVAL && st->tep == stcp) ||
- (prog->info.stage == MESA_SHADER_GEOMETRY && st->gp == stcp) ||
- (prog->info.stage == MESA_SHADER_COMPUTE && st->cp == stcp))
- st->dirty |= stcp->affected_states;
}
st_finalize_program(st, prog);
*/
unsigned active_queries;
- struct st_vertex_program *vp; /**< Currently bound vertex program */
- struct st_common_program *fp; /**< Currently bound fragment program */
- struct st_common_program *gp; /**< Currently bound geometry program */
- struct st_common_program *tcp; /**< Currently bound tess control program */
- struct st_common_program *tep; /**< Currently bound tess eval program */
- struct st_common_program *cp; /**< Currently bound compute program */
+ union {
+ struct {
+ struct st_vertex_program *vp; /**< Currently bound vertex program */
+ struct st_common_program *tcp; /**< Currently bound tess control program */
+ struct st_common_program *tep; /**< Currently bound tess eval program */
+ struct st_common_program *gp; /**< Currently bound geometry program */
+ struct st_common_program *fp; /**< Currently bound fragment program */
+ struct st_common_program *cp; /**< Currently bound compute program */
+ };
+ struct gl_program *current_program[MESA_SHADER_STAGES];
+ };
struct st_vp_variant *vp_variant;
#include "st_atifs_to_tgsi.h"
#include "st_nir.h"
#include "st_shader_cache.h"
+#include "st_util.h"
#include "cso_cache/cso_context.h"
void
st_finalize_program(struct st_context *st, struct gl_program *prog)
{
+ if (st->current_program[prog->info.stage] == prog) {
+ if (prog->info.stage == MESA_SHADER_VERTEX)
+ st->dirty |= ST_NEW_VERTEX_PROGRAM(st, (struct st_vertex_program *)prog);
+ else
+ st->dirty |= ((struct st_common_program *)prog)->affected_states;
+ }
+
/* Create Gallium shaders now instead of on demand. */
if (ST_DEBUG & DEBUG_PRECOMPILE ||
st->shader_has_one_variant[prog->info.stage])
} else {
read_tgsi_from_cache(&blob_reader, &stvp->state.tokens);
}
-
- if (st->vp == stvp)
- st->dirty |= ST_NEW_VERTEX_PROGRAM(st, stvp);
-
break;
}
case MESA_SHADER_TESS_CTRL:
} else {
read_tgsi_from_cache(&blob_reader, &stcp->state.tokens);
}
-
- if ((prog->info.stage == MESA_SHADER_TESS_CTRL && st->tcp == stcp) ||
- (prog->info.stage == MESA_SHADER_TESS_EVAL && st->tep == stcp) ||
- (prog->info.stage == MESA_SHADER_GEOMETRY && st->gp == stcp) ||
- (prog->info.stage == MESA_SHADER_FRAGMENT && st->fp == stcp) ||
- (prog->info.stage == MESA_SHADER_COMPUTE && st->cp == stcp))
- st->dirty |= stcp->affected_states;
break;
}
default: