home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Asuka / h / glc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  2.4 KB  |  128 lines

  1. #ifndef f_GLC_H
  2. #define f_GLC_H
  3.  
  4. #include <vd2/system/vdstl.h>
  5. #include <vd2/system/refcount.h>
  6.  
  7. namespace GLCIL {
  8.     enum {
  9.         kFSOpNone,
  10.         kFSOpMov,
  11.         kFSOpAdd,
  12.         kFSOpSub,
  13.         kFSOpMul,
  14.         kFSOpMad,
  15.         kFSOpLrp,
  16.         kFSOpDp3,
  17.         kFSOpDp4,
  18.         kFSOpMma,        // mul/mul/add
  19.         kFSOpMms,        // mul/mul/sel
  20.         kFSOpDm,        // dp3/mul
  21.         kFSOpDd,        // dp3/dp3
  22.         kFSOpDda,        // dp3/dp3/add (check GL_NV_register_combiners -- this is actually allowed!)
  23.         kFSOpFinal,
  24.         kFSOpDef,
  25.         kFSOpTexld2Arg,
  26.         kFSOpTexcrd,
  27.         kFSOpPhase
  28.     };
  29.  
  30.     enum {
  31.         kInsnModD2        = 0x0001,
  32.         kInsnModD4        = 0x0002,
  33.         kInsnModD8        = 0x0004,
  34.         kInsnModX2        = 0x0008,
  35.         kInsnModX4        = 0x0010,
  36.         kInsnModX8        = 0x0020,
  37.         kInsnModBias    = 0x0040,
  38.         kInsnModBX2        = 0x0080,
  39.         kInsnModSat        = 0x0100
  40.     };
  41.  
  42.     enum {
  43.         kRegModNegate        = 0x0001,
  44.         kRegModSaturate        = 0x0002,
  45.         kRegModComplement    = 0x0004,
  46.         kRegModBias            = 0x0008,
  47.         kRegModX2            = 0x0010,
  48.     };
  49.  
  50.     enum {
  51.         kRegDiscard    = 0x0001,
  52.         kRegZero    = 0x0002,
  53.         kRegR0        = 0x0100,
  54.         kRegV0        = 0x0200,
  55.         kRegT0        = 0x0300,
  56.         kRegC0        = 0x0400,
  57.         kRegTypeMask= 0xFF00
  58.     };
  59.  
  60.     enum {
  61.         kSwizzleRed        = 0x00,
  62.         kSwizzleGreen    = 0x55,
  63.         kSwizzleBlue    = 0xAA,
  64.         kSwizzleAlpha    = 0xFF,
  65.         kSwizzleRGB        = 0x24,
  66.         kSwizzleNone    = 0xE4
  67.     };
  68. }
  69.  
  70. struct GLCDestArg {
  71.     uint16    mReg;
  72.     uint8    mWriteMask;
  73. };
  74.  
  75. struct GLCSourceArg {
  76.     uint16    mReg;
  77.     uint16    mMods;
  78.     uint8    mSwizzle;
  79.     uint8    mSize;
  80. };
  81.  
  82. struct GLCCodeLocation {
  83.     const char *mpFileName;
  84.     int        mLine;
  85.     int        mColumn;
  86. };
  87.  
  88. struct GLCFragmentOp {
  89.     GLCCodeLocation    mLocation;
  90.     uint32                    mInsn;
  91.     uint32                    mModifiers;
  92.     bool                    mbCoIssue;
  93.     GLCDestArg            mDstArgs[3];
  94.     GLCSourceArg        mSrcArgs[7];
  95. };
  96.  
  97. struct GLCFragmentShader {
  98.     GLCCodeLocation        mLocation;
  99.  
  100.     typedef vdfastvector<GLCFragmentOp> FragmentOps;
  101.     FragmentOps mOps;
  102.  
  103.     uint32        mUsedConstants;
  104.     float        mConstants[16][4];
  105.  
  106.     GLCFragmentShader() : mUsedConstants(0) {
  107.         memset(mConstants, 0, sizeof mConstants);
  108.     }
  109. };
  110.  
  111. class GLCErrorSink {
  112. public:
  113.     VDNORETURN void ThrowError(const char *format, ...);
  114.     VDNORETURN void ThrowError(const GLCCodeLocation& loc, const char *format, ...);
  115.  
  116.     virtual GLCCodeLocation GetLocation() const = 0;
  117. };
  118.  
  119. class IGLCFragmentShader : public IVDRefCount {
  120. public:
  121.     virtual ~IGLCFragmentShader() {}
  122.  
  123.     virtual const char *GetTypeString() = 0;
  124.     virtual void Write(FILE *f, const char *sym) = 0;
  125. };
  126.  
  127. #endif
  128.