Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / r300 / r300_shader.c
1 #include "glheader.h"
2 #include "macros.h"
3 #include "enums.h"
4
5 #include "program.h"
6 #include "tnl/tnl.h"
7 #include "r300_context.h"
8 #include "r300_fragprog.h"
9
10 static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target,
11 GLuint id)
12 {
13 struct r300_vertex_program_cont *vp;
14 struct r300_fragment_program *fp;
15
16 switch (target) {
17 case GL_VERTEX_STATE_PROGRAM_NV:
18 case GL_VERTEX_PROGRAM_ARB:
19 vp = CALLOC_STRUCT(r300_vertex_program_cont);
20 return _mesa_init_vertex_program(ctx, &vp->mesa_program,
21 target, id);
22 case GL_FRAGMENT_PROGRAM_ARB:
23 fp = CALLOC_STRUCT(r300_fragment_program);
24 fp->ctx = ctx;
25 return _mesa_init_fragment_program(ctx, &fp->mesa_program,
26 target, id);
27 case GL_FRAGMENT_PROGRAM_NV:
28 fp = CALLOC_STRUCT(r300_fragment_program);
29 return _mesa_init_fragment_program(ctx, &fp->mesa_program,
30 target, id);
31 default:
32 _mesa_problem(ctx, "Bad target in r300NewProgram");
33 }
34
35 return NULL;
36 }
37
38 static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog)
39 {
40 _mesa_delete_program(ctx, prog);
41 }
42
43 static void
44 r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog)
45 {
46 struct r300_vertex_program_cont *vp = (void *)prog;
47 struct r300_fragment_program *fp = (struct r300_fragment_program *)prog;
48
49 switch (target) {
50 case GL_VERTEX_PROGRAM_ARB:
51 vp->progs = NULL;
52 break;
53 case GL_FRAGMENT_PROGRAM_ARB:
54 fp->translated = GL_FALSE;
55 break;
56 }
57
58 /* need this for tcl fallbacks */
59 _tnl_program_string(ctx, target, prog);
60 }
61
62 static GLboolean
63 r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog)
64 {
65 return GL_TRUE;
66 }
67
68 void r300InitShaderFuncs(struct dd_function_table *functions)
69 {
70 functions->NewProgram = r300NewProgram;
71 functions->DeleteProgram = r300DeleteProgram;
72 functions->ProgramStringNotify = r300ProgramStringNotify;
73 functions->IsProgramNative = r300IsProgramNative;
74 }