silence misc warnings
[mesa.git] / src / mesa / drivers / dri / r300 / r300_shader.c
1 #include "glheader.h"
2 #include "macros.h"
3 #include "enums.h"
4
5 #include "program.h"
6 #include "r300_context.h"
7 #include "nvvertprog.h"
8 #if USE_ARB_F_P == 1
9 #include "r300_fragprog.h"
10 #endif
11
12 static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
13 {
14 /*
15 r300ContextPtr rmesa = R300_CONTEXT(ctx);
16 struct r300_vertex_program *vp=(void *)prog;
17 */
18
19 switch(target){
20 case GL_VERTEX_PROGRAM_ARB:
21 #if USE_ARB_F_P == 1
22 case GL_FRAGMENT_PROGRAM_ARB:
23 #endif
24 //rmesa->current_vp = vp;
25 break;
26 default:
27 WARN_ONCE("Target not supported yet!\n");
28 break;
29 }
30 }
31
32 static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
33 {
34 struct r300_vertex_program *vp;
35 #if USE_ARB_F_P == 1
36 struct r300_fragment_program *fp;
37 #else
38 struct fragment_program *fp;
39 #endif
40 struct ati_fragment_shader *afs;
41
42 switch(target){
43 case GL_VERTEX_PROGRAM_ARB:
44 vp=CALLOC_STRUCT(r300_vertex_program);
45 return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
46 case GL_FRAGMENT_PROGRAM_ARB:
47 #if USE_ARB_F_P == 1
48 fp=CALLOC_STRUCT(r300_fragment_program);
49 fp->ctx = ctx;
50 return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
51 #else
52 fp=CALLOC_STRUCT(fragment_program);
53 return _mesa_init_fragment_program(ctx, fp, target, id);
54 #endif
55 case GL_FRAGMENT_PROGRAM_NV:
56 #if USE_ARB_F_P == 1
57 fp=CALLOC_STRUCT(r300_fragment_program);
58 return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
59 #else
60 fp=CALLOC_STRUCT(fragment_program);
61 return _mesa_init_fragment_program(ctx, fp, target, id);
62 #endif
63 case GL_FRAGMENT_SHADER_ATI:
64 afs=CALLOC_STRUCT(ati_fragment_shader);
65 return _mesa_init_ati_fragment_shader(ctx, afs, target, id);
66 default:
67 _mesa_problem(ctx, "Bad target in r300NewProgram");
68 }
69
70 return NULL;
71 }
72
73
74 static void r300DeleteProgram(GLcontext *ctx, struct program *prog)
75 {
76 //r300ContextPtr rmesa = R300_CONTEXT(ctx);
77 //struct r300_vertex_program *vp=(void *)prog;
78
79 _mesa_delete_program(ctx, prog);
80 }
81
82 static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
83 struct program *prog)
84 {
85 /*struct r300_vertex_program *vp=(void *)prog;*/
86 #if USE_ARB_F_P == 1
87 struct r300_fragment_program *fp = (struct r300_fragment_program *) prog;
88 #endif
89
90 switch(target) {
91 case GL_VERTEX_PROGRAM_ARB:
92 /*vp->translated=GL_FALSE;
93 translate_vertex_shader(vp);*/
94 //debug_vp(ctx, vp);
95 break;
96 case GL_FRAGMENT_PROGRAM_ARB:
97 #if USE_ARB_F_P == 1
98 fp->translated = GL_FALSE;
99 #endif
100 break;
101 }
102 }
103
104 static GLboolean r300IsProgramNative(GLcontext *ctx, GLenum target, struct program *prog)
105 {
106 //struct r300_vertex_program *vp=(void *)prog;
107 //r300ContextPtr rmesa = R300_CONTEXT(ctx);
108
109 return 1;
110 }
111
112 void r300InitShaderFuncs(struct dd_function_table *functions)
113 {
114 functions->NewProgram=r300NewProgram;
115 functions->BindProgram=r300BindProgram;
116 functions->DeleteProgram=r300DeleteProgram;
117 functions->ProgramStringNotify=r300ProgramStringNotify;
118 functions->IsProgramNative=r300IsProgramNative;
119 }