initial import
[ICEs.git] / 225977 / texenvprogram.i.3
1 struct gl_fragment_program_state {
2 unsigned char _Enabled;
3 struct gl_fragment_program *_TexEnvProgram;
4 };
5 struct gl_shader_state {
6 struct gl_shader_program *CurrentProgram;
7 };
8 struct gl_constants {
9 unsigned int MaxTextureUnits;
10 } GLvertexformat;
11 typedef struct {
12 struct gl_constants Const;
13 struct gl_fragment_program_state FragmentProgram;
14 struct gl_shader_state Shader;
15 } GLcontext;
16 struct mode_opt {
17 };
18 struct state_key {
19 unsigned int enabled_units;
20 struct {
21 unsigned int NumArgsRGB:2;
22 unsigned int ModeRGB:4;
23 struct mode_opt OptRGB[3];
24 unsigned int ModeA:4;
25 } unit[8];
26 };
27 struct ureg {
28 unsigned int file:4;
29 unsigned int idx:8;
30 };
31 struct texenv_fragment_program {
32 struct ureg src_previous;
33 };
34 static struct ureg emit_combine(struct texenv_fragment_program *p,
35 struct ureg dest, unsigned int mask,
36 unsigned char saturate, unsigned int unit,
37 unsigned int nr, unsigned int mode,
38 const struct mode_opt *opt)
39 {
40 struct ureg src[3];
41 switch (mode) {
42 case 6:{
43 struct ureg tmp0;
44 struct ureg neg1;
45 struct ureg two;
46 emit_arith(p, 0, tmp0, 0xf, 0, two, src[0], neg1);
47 }
48 }
49 }
50 static struct ureg emit_texenv(struct texenv_fragment_program *p,
51 unsigned int unit)
52 {
53 struct state_key *key;
54 unsigned char saturate;
55 struct ureg out;
56 struct ureg dest;
57 if (key->unit[unit].ModeRGB == key->unit[unit].ModeA
58 && args_match(key, unit))
59 out =
60 emit_combine(p, dest, 0xf, saturate, unit,
61 key->unit[unit].NumArgsRGB,
62 key->unit[unit].ModeRGB,
63 key->unit[unit].OptRGB);
64 }
65 static void create_new_program(GLcontext * ctx, struct state_key *key,
66 struct gl_fragment_program *program)
67 {
68 struct texenv_fragment_program p;
69 unsigned int unit;
70 for (; unit < ctx->Const.MaxTextureUnits; ++unit)
71 p.src_previous = emit_texenv(&p, unit);
72 }
73
74 _mesa_UpdateTexEnvProgram()
75 {
76 GLcontext *ctx;
77 struct state_key key;
78 if (!ctx->FragmentProgram._Enabled)
79 if (!ctx->Shader.CurrentProgram)
80 if (!ctx->FragmentProgram._TexEnvProgram)
81 create_new_program(ctx, &key,
82 ctx->FragmentProgram._TexEnvProgram);
83 }