void vrend_inject_tcs(struct vrend_sub_context *sub_ctx, int vertices_per_patch)
{
   struct pipe_stream_output_info so_info;

   memset(&so_info, 0, sizeof(so_info));
   struct vrend_shader_selector *sel = vrend_create_shader_state(&so_info,
                                                                 false, PIPE_SHADER_TESS_CTRL);
   struct vrend_shader *shader;
   shader = CALLOC_STRUCT(vrend_shader);
   vrend_fill_shader_key(sub_ctx, sel, &shader->key);

   shader->sel = sel;
   list_inithead(&shader->programs);
   strarray_alloc(&shader->glsl_strings, SHADER_MAX_STRINGS);

   vrend_shader_create_passthrough_tcs(sub_ctx->parent, &sub_ctx->parent->shader_cfg,
                                       sub_ctx->shaders[PIPE_SHADER_VERTEX]->tokens,
                                       &shader->key, vrend_state.tess_factors, &sel->sinfo,
                                       &shader->glsl_strings, vertices_per_patch);
   // Need to add inject the selected shader to the shader selector and then the code below
   // can continue
   sel->tokens = NULL;
   sel->current = shader;
   sub_ctx->shaders[PIPE_SHADER_TESS_CTRL] = sel;
   sub_ctx->shaders[PIPE_SHADER_TESS_CTRL]->num_shaders = 1;

   vrend_compile_shader(sub_ctx, shader);
}
void vrend_inject_tcs(struct vrend_sub_context *sub_ctx, int vertices_per_patch)
{
   struct pipe_stream_output_info so_info;

   memset(&so_info, 0, sizeof(so_info));
   struct vrend_shader_selector *sel = vrend_create_shader_state(&so_info,
                                                                 false, PIPE_SHADER_TESS_CTRL);
   struct vrend_shader *shader;
   shader = CALLOC_STRUCT(vrend_shader);
   vrend_fill_shader_key(sub_ctx, sel, &shader->key);

   shader->sel = sel;
   list_inithead(&shader->programs);
   strarray_alloc(&shader->glsl_strings, SHADER_MAX_STRINGS);

   vrend_shader_create_passthrough_tcs(sub_ctx->parent, &sub_ctx->parent->shader_cfg,
                                       sub_ctx->shaders[PIPE_SHADER_VERTEX]->tokens,
                                       &shader->key, vrend_state.tess_factors, &sel->sinfo,
                                       &shader->glsl_strings, vertices_per_patch);
    
    
   sel->tokens = NULL;
   sel->current = shader;
   sub_ctx->shaders[PIPE_SHADER_TESS_CTRL] = sel;
   sub_ctx->shaders[PIPE_SHADER_TESS_CTRL]->num_shaders = 1;

   vrend_compile_shader(sub_ctx, shader);
}