blob: b01bef436f57b34a0cd7be8ec47dcc2b1aada9d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#include <stdlib.h>
#include <assert.h>
#include <GLES2/gl2.h>
#include <src/mesa/main/mtypes.h>
void _mesa_reference_shader(const void * ctx, struct gl_shader **ptr,
struct gl_shader *sh)
{
*ptr = sh;
}
struct gl_shader * _mesa_new_shader(const void * ctx, GLuint name, GLenum type)
{
assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
struct gl_shader * shader = (struct gl_shader *)_hieralloc_zero(ctx, sizeof(struct gl_shader), "zr:gl_shader");
if (shader) {
shader->Type = type;
shader->Name = name;
shader->RefCount = 1;
}
if (!ctx)
watches[watch++] = shader;
return shader;
}
void _mesa_delete_shader(const void * ctx, struct gl_shader *shader)
{
if (!shader)
return;
if (shader->RefCount > 1) {
shader->DeletePending = GL_TRUE;
return;
}
hieralloc_free(shader);
}
|