Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/GL/src/nvparse/rc1.0_general.h @ 3

Last change on this file since 3 was 3, checked in by anonymous, 17 years ago

=update

File size: 3.2 KB
Line 
1#ifndef _RC10_GENERAL_H
2#define _RC10_GENERAL_H
3
4#include "rc1.0_register.h"
5#include "nvparse_errors.h"
6#include "nvparse_externs.h"
7
8enum {
9        RCP_MUL = 0,
10        RCP_DOT,
11        RCP_MUX,
12        RCP_SUM
13};
14
15class ConstColorStruct {
16public:
17        void Init(RegisterEnum _reg, float _v0, float _v1, float _v2, float _v3)
18        { reg = _reg; v[0] = _v0; v[1] = _v1; v[2] = _v2; v[3] = _v3; }
19        RegisterEnum reg;
20        float v[4];
21};
22
23class OpStruct {
24public:
25        void Init(int _op, RegisterEnum _reg0, MappedRegisterStruct _reg1, MappedRegisterStruct _reg2)
26        { op = _op; reg[0].reg = _reg0; reg[1] = _reg1; reg[2] = _reg2; }
27        void Init(int _op, RegisterEnum _reg0)
28        { op = _op; reg[0].reg = _reg0; }
29        int op;
30        MappedRegisterStruct reg[3];
31        void Validate(int stage, int portion);
32};
33
34class GeneralFunctionStruct {
35public:
36        void Init(OpStruct _op0, OpStruct _op1, OpStruct _op2) { op[0] = _op0; op[1] = _op1; op[2] = _op2; numOps = 3; }
37        void Init(OpStruct _op0, OpStruct _op1) { op[0] = _op0; op[1] = _op1; numOps = 2; }
38        void Init(OpStruct _op0) { op[0] = _op0; numOps = 1; }
39        void Validate(int stage, int portion);
40        void Invoke(int stage, int portion, BiasScaleEnum bs);
41        void ZeroOut();
42        int numOps;
43        OpStruct op[3];
44};
45
46
47class GeneralPortionStruct {
48public:
49        void Init(int _designator, GeneralFunctionStruct _gf, BiasScaleEnum _bs)
50        { designator = _designator; gf = _gf; bs = _bs; }
51
52        void Validate(int stage);
53        void Invoke(int stage);
54        void ZeroOut();
55        int designator;
56        GeneralFunctionStruct gf;
57        BiasScaleEnum bs;
58};
59
60class GeneralCombinerStruct {
61public:
62        void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1, ConstColorStruct _cc0, ConstColorStruct _cc1)
63        { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; cc[0] = _cc0; cc[1] = _cc1; numConsts = 2; }
64        void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1, ConstColorStruct _cc0)
65        { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; cc[0] = _cc0; numConsts = 1; }
66        void Init(GeneralPortionStruct _portion0, GeneralPortionStruct _portion1)
67        { portion[0] = _portion0; portion[1] = _portion1; numPortions = 2; numConsts = 0; }
68
69        void Init(GeneralPortionStruct _portion0, ConstColorStruct _cc0, ConstColorStruct _cc1)
70        { portion[0] = _portion0; numPortions = 1; cc[0] = _cc0; cc[1] = _cc1; numConsts = 2; }
71        void Init(GeneralPortionStruct _portion0, ConstColorStruct _cc0)
72        { portion[0] = _portion0; numPortions = 1; cc[0] = _cc0; numConsts = 1; }
73        void Init(GeneralPortionStruct _portion0)
74        { portion[0] = _portion0; numPortions = 1; numConsts = 0; }
75
76        void Validate(int stage);
77        void SetUnusedLocalConsts(int numGlobalConsts, ConstColorStruct *globalCCs);
78        void Invoke(int stage);
79        void ZeroOut();
80        GeneralPortionStruct portion[2];
81        int numPortions;
82        ConstColorStruct cc[2];
83        int numConsts;
84};
85
86class GeneralCombinersStruct {
87public:
88        void Init() {num = 0;}
89        void Init(GeneralCombinerStruct _gc) { num = 1; general[0] = _gc; }
90        GeneralCombinersStruct& operator+=(GeneralCombinerStruct& _gc)
91        {
92                if (num < RCP_NUM_GENERAL_COMBINERS)
93                        general[num++] = _gc;
94                else
95                        errors.set("Too many general combiners.");
96                return *this;
97        }
98        void Validate(int numConsts, ConstColorStruct *cc);
99        void Invoke();
100        GeneralCombinerStruct general[RCP_NUM_GENERAL_COMBINERS];
101        int num;
102private:
103        int localConsts;
104};
105
106
107#endif
Note: See TracBrowser for help on using the repository browser.