Beispiel #1
0
/* Too complex to figure out, just check every time:
 */
static void check_program_state( struct st_context *st )
{
   struct gl_context *ctx = st->ctx;
   struct st_vertex_program *old_vp = st->vp;
   struct st_tessctrl_program *old_tcp = st->tcp;
   struct st_tesseval_program *old_tep = st->tep;
   struct st_geometry_program *old_gp = st->gp;
   struct st_fragment_program *old_fp = st->fp;

   struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;
   struct gl_tess_ctrl_program *new_tcp = ctx->TessCtrlProgram._Current;
   struct gl_tess_eval_program *new_tep = ctx->TessEvalProgram._Current;
   struct gl_geometry_program *new_gp = ctx->GeometryProgram._Current;
   struct gl_fragment_program *new_fp = ctx->FragmentProgram._Current;
   uint64_t dirty = 0;

   /* Flag states used by both new and old shaders to unbind shader resources
    * properly when transitioning to shaders that don't use them.
    */
   if (unlikely(new_vp != &old_vp->Base)) {
      if (old_vp)
         dirty |= old_vp->affected_states;
      if (new_vp)
         dirty |= ST_NEW_VERTEX_PROGRAM(st, st_vertex_program(new_vp));
   }

   if (unlikely(new_tcp != &old_tcp->Base)) {
      if (old_tcp)
         dirty |= old_tcp->affected_states;
      if (new_tcp)
         dirty |= st_tessctrl_program(new_tcp)->affected_states;
   }

   if (unlikely(new_tep != &old_tep->Base)) {
      if (old_tep)
         dirty |= old_tep->affected_states;
      if (new_tep)
         dirty |= st_tesseval_program(new_tep)->affected_states;
   }

   if (unlikely(new_gp != &old_gp->Base)) {
      if (old_gp)
         dirty |= old_gp->affected_states;
      if (new_gp)
         dirty |= st_geometry_program(new_gp)->affected_states;
   }

   if (unlikely(new_fp != &old_fp->Base)) {
      if (old_fp)
         dirty |= old_fp->affected_states;
      if (new_fp)
         dirty |= st_fragment_program(new_fp)->affected_states;
   }

   st->dirty |= dirty;
   st->gfx_shaders_may_be_dirty = false;
}
Beispiel #2
0
static void
update_gp( struct st_context *st )
{
   struct st_geometry_program *stgp;

   if (!st->ctx->GeometryProgram._Current) {
      cso_set_geometry_shader_handle(st->cso_context, NULL);
      st_reference_geomprog(st, &st->gp, NULL);
      return;
   }

   stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
   assert(stgp->Base.Base.Target == GL_GEOMETRY_PROGRAM_NV);

   st->gp_variant = st_get_basic_variant(st, PIPE_SHADER_GEOMETRY,
                                         &stgp->tgsi, &stgp->variants);

   st_reference_geomprog(st, &st->gp, stgp);

   cso_set_geometry_shader_handle(st->cso_context,
                                  st->gp_variant->driver_shader);
}
static void
update_gp( struct st_context *st )
{
   struct st_geometry_program *stgp;
   struct st_gp_variant_key key;

   if (!st->ctx->GeometryProgram._Current) {
      cso_set_geometry_shader_handle(st->cso_context, NULL);
      return;
   }

   stgp = st_geometry_program(st->ctx->GeometryProgram._Current);
   assert(stgp->Base.Base.Target == MESA_GEOMETRY_PROGRAM);

   memset(&key, 0, sizeof(key));
   key.st = st;

   st->gp_variant = st_get_gp_variant(st, stgp, &key);

   st_reference_geomprog(st, &st->gp, stgp);

   cso_set_geometry_shader_handle(st->cso_context,
                                  st->gp_variant->driver_shader);
}