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 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
13 struct r300_vertex_program_cont
*vp
;
14 struct r300_fragment_program
*r300_fp
;
15 struct r500_fragment_program
*r500_fp
;
18 case GL_VERTEX_STATE_PROGRAM_NV
:
19 case GL_VERTEX_PROGRAM_ARB
:
20 vp
= CALLOC_STRUCT(r300_vertex_program_cont
);
21 return _mesa_init_vertex_program(ctx
, &vp
->mesa_program
,
23 case GL_FRAGMENT_PROGRAM_ARB
:
24 if (rmesa
->radeon
.radeonScreen
->chip_family
>= CHIP_FAMILY_RV515
) {
25 r500_fp
= CALLOC_STRUCT(r500_fragment_program
);
27 return _mesa_init_fragment_program(ctx
, &r500_fp
->mesa_program
,
30 r300_fp
= CALLOC_STRUCT(r300_fragment_program
);
31 return _mesa_init_fragment_program(ctx
, &r300_fp
->mesa_program
,
35 case GL_FRAGMENT_PROGRAM_NV
:
36 if (rmesa
->radeon
.radeonScreen
->chip_family
>= CHIP_FAMILY_RV515
) {
37 r500_fp
= CALLOC_STRUCT(r500_fragment_program
);
38 return _mesa_init_fragment_program(ctx
, &r500_fp
->mesa_program
,
41 r300_fp
= CALLOC_STRUCT(r300_fragment_program
);
42 return _mesa_init_fragment_program(ctx
, &r300_fp
->mesa_program
,
46 _mesa_problem(ctx
, "Bad target in r300NewProgram");
52 static void r300DeleteProgram(GLcontext
* ctx
, struct gl_program
*prog
)
54 _mesa_delete_program(ctx
, prog
);
58 r300ProgramStringNotify(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
60 r300ContextPtr rmesa
= R300_CONTEXT(ctx
);
61 struct r300_vertex_program_cont
*vp
= (void *)prog
;
62 struct r300_fragment_program
*r300_fp
= (struct r300_fragment_program
*)prog
;
63 struct r500_fragment_program
*r500_fp
= (struct r500_fragment_program
*)prog
;
66 case GL_VERTEX_PROGRAM_ARB
:
69 case GL_FRAGMENT_PROGRAM_ARB
:
70 if (rmesa
->radeon
.radeonScreen
->chip_family
>= CHIP_FAMILY_RV515
)
71 r500_fp
->translated
= GL_FALSE
;
73 r300_fp
->translated
= GL_FALSE
;
77 /* need this for tcl fallbacks */
78 _tnl_program_string(ctx
, target
, prog
);
82 r300IsProgramNative(GLcontext
* ctx
, GLenum target
, struct gl_program
*prog
)
87 void r300InitShaderFuncs(struct dd_function_table
*functions
)
89 functions
->NewProgram
= r300NewProgram
;
90 functions
->DeleteProgram
= r300DeleteProgram
;
91 functions
->ProgramStringNotify
= r300ProgramStringNotify
;
92 functions
->IsProgramNative
= r300IsProgramNative
;