mesa: Convert fixed function fragment program generator to GLSL IR.

This is a step towards providing a direct route for drivers accepting
GLSL IR for codegen.  Perhaps more importantly, it runs the fixed
function fragment program through the GLSL IR optimization.  Having
seen how easy it is to make ugly fixed function texenv code that can
do unnecessary work, this may improve real applicatinos.
This commit is contained in:
Eric Anholt
2010-11-01 13:16:21 -07:00
parent 29e013e58b
commit 7cb87dffce
4 changed files with 659 additions and 774 deletions
File diff suppressed because it is too large Load Diff
+8 -4
View File
@@ -277,17 +277,21 @@ update_program(struct gl_context *ctx)
fsProg->FragmentProgram);
}
else if (ctx->FragmentProgram._Enabled) {
/* use user-defined vertex program */
/* use user-defined fragment program */
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
ctx->FragmentProgram.Current);
}
else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
/* Use fragment program generated from fixed-function state.
*/
struct gl_shader_program *f = _mesa_get_fixed_func_fragment_program(ctx);
#if 0
_mesa_reference_shader_program(ctx,
&ctx->Shader.CurrentFragmentProgram, f);
#endif
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
_mesa_get_fixed_func_fragment_program(ctx));
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram,
ctx->FragmentProgram._Current);
f->FragmentProgram);
}
else {
/* no fragment program */
+1 -1
View File
@@ -29,7 +29,7 @@
struct gl_context;
extern struct gl_fragment_program *
extern struct gl_shader_program *
_mesa_get_fixed_func_fragment_program(struct gl_context *ctx);
#endif
+1 -1
View File
@@ -140,7 +140,7 @@ _mesa_free_program_data(struct gl_context *ctx)
#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
_mesa_delete_program_cache(ctx, ctx->FragmentProgram.Cache);
_mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
#endif
#if FEATURE_ARB_geometry_shader4
_mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, NULL);