コード例 #1
0
ファイル: cogl-shader.c プロジェクト: collinss/muffin
static void
delete_shader (CoglShader *shader)
{
  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

#ifdef HAVE_COGL_GL
  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
    {
      if (shader->gl_handle)
        GE (ctx, glDeletePrograms (1, &shader->gl_handle));
    }
  else
#endif
    {
      if (shader->gl_handle)
        GE (ctx, glDeleteShader (shader->gl_handle));
    }

  shader->gl_handle = 0;

  if (shader->compilation_pipeline)
    {
      cogl_object_unref (shader->compilation_pipeline);
      shader->compilation_pipeline = NULL;
    }
}
コード例 #2
0
static void
destroy_shader_state (void *user_data,
                      void *instance)
{
  CoglPipelineShaderState *shader_state = user_data;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  /* If the shader state was last used for this pipeline then clear it
     so that if same address gets used again for a new pipeline then
     we won't think it's the same pipeline and avoid updating the
     constants */
  if (shader_state->last_used_for_pipeline == instance)
    shader_state->last_used_for_pipeline = NULL;

  if (--shader_state->ref_count == 0)
    {
      if (shader_state->gl_program)
        {
          GE (ctx, glDeletePrograms (1, &shader_state->gl_program));
          shader_state->gl_program = 0;
        }

      g_free (shader_state->unit_state);

      g_slice_free (CoglPipelineShaderState, shader_state);
    }
}
コード例 #3
0
ファイル: cogl-shader.c プロジェクト: collinss/muffin
static void
_cogl_shader_free (CoglShader *shader)
{
  /* Frees shader resources but its handle is not
     released! Do that separately before this! */
  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

#ifdef HAVE_COGL_GL
  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
    {
      if (shader->gl_handle)
        GE (ctx, glDeletePrograms (1, &shader->gl_handle));
    }
  else
#endif
    if (shader->gl_handle)
      GE (ctx, glDeleteShader (shader->gl_handle));

  g_slice_free (CoglShader, shader);
}