2 #include "main/glheader.h"
4 #include "shader/program.h"
6 #include "r300_context.h"
7 #include "r300_fragprog.h"
9 static struct gl_program
*r300NewProgram(GLcontext
* ctx
, GLenum target
,
12 struct r300_vertex_program_cont
*vp
;
13 struct r300_fragment_program
*fp
;
16 case GL_VERTEX_STATE_PROGRAM_NV
:
17 case GL_VERTEX_PROGRAM_ARB
:
18 vp
= CALLOC_STRUCT(r300_vertex_program_cont
);
19 return _mesa_init_vertex_program(ctx
, &vp
->mesa_program
,
22 case GL_FRAGMENT_PROGRAM_NV
:
23 case GL_FRAGMENT_PROGRAM_ARB
:
24 fp
= CALLOC_STRUCT(r300_fragment_program
);
25 return _mesa_init_fragment_program(ctx
, &fp
->Base
, target
, id
);
28 _mesa_problem(ctx
, "Bad target in r300NewProgram");
34 static void r300DeleteProgram(GLcontext
* ctx
, struct gl_program
*prog
)
36 _mesa_delete_program(ctx
, prog
);
40 r300ProgramStringNotify(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
42 struct r300_vertex_program_cont
*vp
= (void *)prog
;
43 struct r300_fragment_program
*r300_fp
= (struct r300_fragment_program
*)prog
;
46 case GL_VERTEX_PROGRAM_ARB
:
49 case GL_FRAGMENT_PROGRAM_ARB
:
50 r300_fp
->translated
= GL_FALSE
;
54 /* need this for tcl fallbacks */
55 _tnl_program_string(ctx
, target
, prog
);
59 r300IsProgramNative(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
61 if (target
== GL_FRAGMENT_PROGRAM_ARB
) {
62 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
63 struct r300_fragment_program
*fp
= (struct r300_fragment_program
*)prog
;
65 rmesa
->vtbl
.TranslateFragmentShader(ctx
, &fp
->Base
);
72 void r300InitShaderFuncs(struct dd_function_table
*functions
)
74 functions
->NewProgram
= r300NewProgram
;
75 functions
->DeleteProgram
= r300DeleteProgram
;
76 functions
->ProgramStringNotify
= r300ProgramStringNotify
;
77 functions
->IsProgramNative
= r300IsProgramNative
;