File: ShaderDecl.h

package info (click to toggle)
intel-graphics-compiler2 2.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 106,644 kB
  • sloc: cpp: 805,640; lisp: 287,672; ansic: 16,414; python: 3,952; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (712 lines) | stat: -rw-r--r-- 23,885 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
/*========================== begin_copyright_notice ============================

Copyright (C) 2017-2021 Intel Corporation

SPDX-License-Identifier: MIT

============================= end_copyright_notice ===========================*/

#pragma once

#include "usc_config.h"
#include "usc.h"
#include "ShaderTypesEnum.h"
#include "ShaderToken.h"
#include "ShaderTypes.h"
#include "SurfaceFormats.h"

namespace IGC {
class CAllocator;
}

namespace USC {
struct SIndexedTempDeclType;
}

namespace iSTD {
template <typename Type, class CAllocatorType> class CArray;
}

namespace USC {

/*****************************************************************************\

Class:
    CShaderDecl

Description:

\*****************************************************************************/
class USC_API CShaderDecl {
public:
  static ErrorCode Create(CShaderDecl *&pShaderDecl);
  static void Delete(CShaderDecl *&pShaderDecl);

  virtual void Declare(const unsigned int number);
  virtual bool IsDeclared(const unsigned int number) const;
  virtual void UnDeclare(const unsigned int number);
  virtual unsigned int GetCount(void) const;

  unsigned int GetMaxNumber(void) const { return m_MaxNumber; };
  unsigned int GetMinNumber(void) const { return m_MinNumber; };

  unsigned int GetNextUndeclared(const unsigned int nextUndeclared) const;

  virtual void Compress(void);

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderDecl();
  virtual ~CShaderDecl(void);

  virtual ErrorCode Initialize(void);

  template <typename TOpType> ErrorCode ValidateOperation(const CShaderDecl &src, unsigned char *&pStream);

  unsigned int m_MaxNumber;
  unsigned int m_MinNumber;
};

/*****************************************************************************\

Class:
    CShaderFiniteDecl

Description:

\*****************************************************************************/
class USC_API CShaderFiniteDecl : public CShaderDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderFiniteDecl *&pShaderDecl);
  static void Delete(CShaderFiniteDecl *&pShaderDecl);

  virtual void Declare(const unsigned int number);
  virtual bool IsDeclared(const unsigned int number) const;
  virtual void UnDeclare(const unsigned int number);
  virtual unsigned int GetCount(void) const;
  unsigned int GetMaxRegisters(void) const;

  void GetListOfDeclared(const unsigned int **listOfDeclared, unsigned int &listSize) const;
  bool GetNextUndeclared(const unsigned int nextUndeclaredHint, unsigned int &nextUndeclared);
  void GetDeclaredIndexList(const ShaderRegisterIndexType **declaredIndex, unsigned int &listSize) const;

  const unsigned int *GetListOfDeclared(void) const;
  const ShaderRegisterIndexType *GetDeclaredIndexList(void) const;

  virtual void Compress(void);

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderFiniteDecl(const bool allowResizing, const unsigned int maxRegisters);
  virtual ~CShaderFiniteDecl(void);

  virtual ErrorCode Initialize();
  virtual bool Resize(unsigned int number);

  const bool m_cAllowResizing;

  ShaderRegisterIndexType *m_pDeclaredIndex; // for each register holds SHADER_REGISTER_INDEX_NONE
                                             // if not declared or its declared index otherwise
  unsigned int *m_pDeclaredList;
  unsigned int m_MaxRegisters;
  unsigned int m_Count;

private:
  CShaderFiniteDecl(const CShaderFiniteDecl &);
  void operator=(const CShaderFiniteDecl &);
};

/*****************************************************************************\

Class:
    CShaderSamplerDecl

Description:

\*****************************************************************************/
class USC_API CShaderSamplerDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderSamplerDecl *&pShaderDecl);
  static void Delete(CShaderSamplerDecl *&pShaderDecl);

  void SetSamplerType(const unsigned int number, IGC::SHADER_SAMPLER_TYPE type);

  IGC::SHADER_SAMPLER_TYPE GetSamplerType(const unsigned int number) const;

protected:
  CShaderSamplerDecl(const unsigned int maxRegisters);
  virtual ~CShaderSamplerDecl(void);

  virtual ErrorCode Initialize(void);

private:
  iSTD::CArray<SShaderSamplerDeclType, IGC::CAllocator> *m_pSamplerDecl;
};

/*****************************************************************************\

Class:
    CShaderResourceDecl

Description:

\*****************************************************************************/
class USC_API CShaderResourceDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderResourceDecl *&pShaderDecl);
  static void Delete(CShaderResourceDecl *&pShaderDecl);

  void SetResourceType(const unsigned int number, const IGC::SHADER_RESOURCE_TYPE type);

  void SetSurfaceFormat(const unsigned int number, const SURFACE_FORMAT surfaceFormat);

  void SetUAVAccessMode(const unsigned int number, const IGC::SHADER_UAV_ACCESS_MODE accessMode);

  void SetReturnType(const unsigned int number, const IGC::SHADER_RESOURCE_RETURN_TYPE type);

  void SetStride(const unsigned int number, const unsigned int stride);

  void SetByteOrStructCount(const unsigned int number, const unsigned int byteOrStructCount);

  void SetOffset(const unsigned int number, const unsigned int offset);

  void SetAccessCoherency(const unsigned int number, const bool accessCoherency);

  void SetTGSMVariable(const unsigned int number);

  void SetAlignment(const unsigned int number, const unsigned int alignment);

  SURFACE_FORMAT
  GetSurfaceFormat(const unsigned int number) const;

  IGC::SHADER_RESOURCE_TYPE GetResourceType(const unsigned int number) const;

  unsigned int GetResourceStride(const unsigned int number) const;

  unsigned int GetByteOrStructCount(const unsigned int number) const;

  unsigned int GetOffset(const unsigned int number) const;

  bool GetAccessCoherency(const unsigned int number) const;

  unsigned int GetAlignment(const unsigned int number) const;

  IGC::SHADER_RESOURCE_RETURN_TYPE GetReturnType(const unsigned int number) const;

  bool IsTGSMFixed(const unsigned int number) const;

  bool IsTGSMVariable(const unsigned int number) const;

  virtual void Compress(void);

  SShaderResourceDeclType GetResourceDeclElement(const unsigned int index) const;

  unsigned int GetResourceDeclSize(void) const;

  bool IsValid(void) const;

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderResourceDecl(const unsigned int maxRegisters);
  virtual ~CShaderResourceDecl(void);

  virtual ErrorCode Initialize(void);

  iSTD::CArray<SShaderResourceDeclType, IGC::CAllocator> *m_pResourceDecl;

private:
  CShaderResourceDecl(const CShaderResourceDecl &);
  void operator=(const CShaderResourceDecl &);
};

/*****************************************************************************\

Class:
    CShaderInputDecl

Description:

\*****************************************************************************/
class USC_API CShaderInputDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderInputDecl *&pShaderDecl);
  static void Delete(CShaderInputDecl *&pShaderDecl);

  void SetMask(const unsigned int number, const IGC::SHADER_MASK mask);

  void SetUsage(const unsigned int number, const IGC::SHADER_CHANNEL channel, const IGC::SHADER_USAGE usage);

  void SetUsageIndex(const unsigned int number, const IGC::SHADER_CHANNEL channel, const unsigned int usageIndex);

  void SetInterpolationMode(const unsigned int number, const IGC::SHADER_INTERPOLATION_MODE mode);

  void SetIndexed(const unsigned int number, const bool indexed);

  IGC::SHADER_MASK GetMask(const unsigned int number) const;

  IGC::SHADER_USAGE GetUsage(const unsigned int number, const IGC::SHADER_CHANNEL channel) const;

  unsigned int GetUsageIndex(const unsigned int number, const IGC::SHADER_CHANNEL channel) const;

  IGC::SHADER_INTERPOLATION_MODE GetInterpolationMode(const unsigned int number) const;

  bool IsIndexed(const unsigned int number) const;

  const SShaderInputDeclType &GetShaderInputDecl(unsigned int number) const;

  bool HasIndexing(void) const;

  void SetMaxIndexedInputRegisterNum(const unsigned int number);
  void SetMinIndexedInputRegisterNum(const unsigned int number);
  void SetNumIndexedInputRegisters(const unsigned int number);

  unsigned int GetMinIndexedInputRegisterNum(void) const;
  unsigned int GetMaxIndexedInputRegisterNum(void) const;
  unsigned int GetNumIndexedInputRegisters(void) const;

  inline ShaderRegisterIndexType GetInstanceIDRegisterNum(void) const;
  inline ShaderRegisterIndexType GetVertexIDRegisterNum(void) const;

  virtual void Compress(void);

  SShaderInputDeclType GetInputDeclElement(const unsigned int index) const;

  unsigned int GetInputDeclSize(void) const;

  bool IsValid(void) const;

  inline bool HasFogFactor(void) const;

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderInputDecl(const unsigned int maxRegisters);
  virtual ~CShaderInputDecl(void);

  virtual ErrorCode Initialize(void);

  iSTD::CArray<SShaderInputDeclType, IGC::CAllocator> *m_pInputDecl;

  bool m_HasIndexing;
  bool m_HasFogFactor;

  ShaderRegisterIndexType m_InstanceIDRegisterNum;
  ShaderRegisterIndexType m_VertexIDRegisterNum;

  unsigned int m_MaxIndexedInputRegisterNum;
  unsigned int m_MinIndexedInputRegisterNum;
  unsigned int m_NumIndexedInputRegisters;

private:
  CShaderInputDecl(const CShaderInputDecl &);
  void operator=(const CShaderInputDecl &);
};

/*****************************************************************************\

Function:
    CShaderInputDecl::HasFogFactor

Description:
    Returns true if one of the channels of one of the input declerations
    has usage of FOGFACTOR or FOGCOORDINATE.

Input:
    None

Output:
    bool

\*****************************************************************************/
inline bool CShaderInputDecl::HasFogFactor(void) const { return m_HasFogFactor; }

/*****************************************************************************\

Function:
    CShaderInputDecl::GetInstanceIDRegisterNum

Description:
    Returns the register index which has usage IGC::SHADER_USAGE_INSTANCE_ID or
    SHADER_REGISTER_INDEX_NONE if no such register exist.

Input:
    None

Output:
    ShaderRegisterIndexType

\*****************************************************************************/
inline ShaderRegisterIndexType CShaderInputDecl::GetInstanceIDRegisterNum(void) const {
  return m_InstanceIDRegisterNum;
}

/*****************************************************************************\

Function:
    CShaderInputDecl::GetVertexIDRegisterNum

Description:
    Returns the register index which has usage IGC::SHADER_USAGE_VERTEX_ID or
    SHADER_REGISTER_INDEX_NONE if no such register exist.

Input:
    None

Output:
    ShaderRegisterIndexType

\*****************************************************************************/
inline ShaderRegisterIndexType CShaderInputDecl::GetVertexIDRegisterNum(void) const { return m_VertexIDRegisterNum; }

/*****************************************************************************\

Class:
    CShaderOutputDecl

Description:

\*****************************************************************************/
class CShaderOutputDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderOutputDecl *&pShaderDecl);
  static void Delete(CShaderOutputDecl *&pShaderDecl);

  void SetMask(const unsigned int number, const IGC::SHADER_MASK mask);

  void SetUsage(const unsigned int number, const IGC::SHADER_CHANNEL channel, const IGC::SHADER_USAGE usage,
                const unsigned int usageIndex);

  void SetIndexed(const unsigned int number, const bool indexed);

  IGC::SHADER_MASK GetMask(const unsigned int number) const;

  IGC::SHADER_USAGE GetUsage(const unsigned int number, const IGC::SHADER_CHANNEL channel) const;

  unsigned int GetUsageIndex(const unsigned int number, const IGC::SHADER_CHANNEL channel) const;

  bool IsIndexed(const unsigned int number) const;

  const SShaderOutputDeclType &GetShaderOutputDecl(unsigned int number) const;

  bool HasIndexing(void) const;

  void SetMaxIndexedOutputRegisterNum(const unsigned int number);
  void SetMinIndexedOutputRegisterNum(const unsigned int number);
  void SetNumIndexedOutputRegisters(const unsigned int number);

  unsigned int GetMaxIndexedOutputRegisterNum(void) const;
  unsigned int GetMinIndexedOutputRegisterNum(void) const;
  unsigned int GetNumIndexedOutputRegisters(void) const;

  void SetActualOutputRegistersCount(const unsigned int number);
  void SetAdditionalOutputsCount(const unsigned int number);
  void SetActualOutputIndexNumber(const unsigned int index, const unsigned int number);
  void SetAdditionalOutputIndexNumber(const unsigned int index, const unsigned int number);

  unsigned int GetActualOutputRegistersCount(void) const;
  unsigned int GetAdditionalOutputsCount(void) const;
  unsigned int GetActualOutputIndexNumber(const unsigned int index) const;
  unsigned int GetAdditionalOutputIndexNumber(const unsigned int index) const;

  void GetListOfDeclared(const unsigned int **listOfDeclared, unsigned int &listSize, USC_CLIENT_TYPE clientType,
                         unsigned char renderTargetPropagationMask) const;

  virtual void Compress(void);

  SShaderOutputDeclType GetOutputDeclElement(const unsigned int index) const;

  unsigned int GetOutputDeclSize(void) const;

  bool IsValid(void) const;

  bool GetInvariantEnable(const unsigned int number) const;
  void SetInvariantEnable(const unsigned int number, const bool invariant);

  inline bool HasPointSize(void) const;
  inline const ShaderRegisterIndexType *GetTextureCoordinateToRegisterNumMap(void) const;
  inline const unsigned int *GetActualOutputsArray(void) const;
  inline const unsigned int *GetAdditionalOutputsArray(void) const;
  inline ShaderRegisterIndexType GetFogCoordinateOrFactorRegisterNum(void) const;
  inline ShaderRegisterIndexType GetSecondaryColorRegisterNum(void) const;

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderOutputDecl(const unsigned int maxRegisters);
  virtual ~CShaderOutputDecl(void);

  virtual ErrorCode Initialize(void);

  iSTD::CArray<SShaderOutputDeclType, IGC::CAllocator> *m_pOutputDecl;

  bool m_HasIndexing;

  unsigned int m_MaxIndexedOutputRegisterNum;
  unsigned int m_MinIndexedOutputRegisterNum;
  unsigned int m_NumIndexedOutputRegisters;

  unsigned int m_ActualOutputRegisters[NUM_PSHADER_OUTPUT_REGISTERS];
  unsigned int m_ActualOutputRegistersCount;
  unsigned int m_AdditionalOutputRegisters[NUM_PSHADER_OUTPUT_COLOR_REGISTERS];
  unsigned int m_AdditionalOutputsCount;

  bool m_HasPointSize;
  ShaderRegisterIndexType m_texCoordRegisterNum[NUM_TEXTURE_COORDINATES];
  ShaderRegisterIndexType m_fogCoordRegisterNum;
  ShaderRegisterIndexType m_secondaryColorRegisterNum;

private:
  CShaderOutputDecl(const CShaderOutputDecl &);
  void operator=(const CShaderOutputDecl &);
};

/*****************************************************************************\

Function:
    CShaderOutputDecl::HasPointSize

Description:
    Returns true if one of the channels of one of the output declerations
    has usage of POINT_SIZE.

Input:
    None

Output:
    bool

\*****************************************************************************/
inline bool CShaderOutputDecl::HasPointSize(void) const { return m_HasPointSize; }

/*****************************************************************************\

Function:
    CShaderOutputDecl::GetTextureCoordinateToRegisterNumMap

Description:
    Returns pointer to integer array of size MAX_TEXTURE_COORDINATES,
    each element in the array holds SHADER_REGISTER_INDEX_NONE if the
    corresponding texture coordinate is not defined used in any of the output registers,
    otherwise the register number of the texcoord.

Input:
    None

Output:
    ShaderRegisterIndexType*

\*****************************************************************************/
inline const ShaderRegisterIndexType *CShaderOutputDecl::GetTextureCoordinateToRegisterNumMap(void) const {
  return m_texCoordRegisterNum;
}

inline const unsigned int *CShaderOutputDecl::GetActualOutputsArray(void) const { return m_ActualOutputRegisters; }

inline const unsigned int *CShaderOutputDecl::GetAdditionalOutputsArray(void) const {
  return m_AdditionalOutputRegisters;
}

/*****************************************************************************\

Function:
    CShaderOutputDecl::GetFogCoordinateOrFactorRegisterNum

Description:
    Returns the first register number which has usage of fog coordinate or fog factor.
    If no such register exist, -1 is returned.

Input:
    None

Output:
    int

\*****************************************************************************/
inline ShaderRegisterIndexType CShaderOutputDecl::GetFogCoordinateOrFactorRegisterNum(void) const {
  return m_fogCoordRegisterNum;
}

/*****************************************************************************\

Function:
    CShaderOutputDecl::GetSecondaryColorRegisterNum

Description:
    Returns the first register number which has usage secondary color.
    If no such register exist, -1 is returned.

Input:
    None

Output:
    int

\*****************************************************************************/
inline ShaderRegisterIndexType CShaderOutputDecl::GetSecondaryColorRegisterNum(void) const {
  return m_secondaryColorRegisterNum;
}

/*****************************************************************************\

Class:
    CShaderIndexedTemporaryArrayDecl

Description:

\*****************************************************************************/
class CShaderIndexedTemporaryArrayDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderIndexedTemporaryArrayDecl *&pShaderDecl);
  static void Delete(CShaderIndexedTemporaryArrayDecl *&pShaderDecl);

  void Setup(const unsigned int number, const unsigned int size);
  void SetSize(const unsigned int number, const unsigned int size);
  void SetCached(const unsigned int number, const SIMD_MODE simdMode);
  void SetReadChannels(const unsigned int number, const SShaderWriteMask mask);
  void SetHasIndirectRegisterWrites(const unsigned int number);

  unsigned int GetSize(const unsigned int number) const;
  bool IsCached(const unsigned int number, const SIMD_MODE simdMode) const;
  bool HasCachedTemps(void) const;
  SShaderWriteMask GetReadChannels(const unsigned int number) const;
  unsigned int GetNumReadChannels(const unsigned int number) const;
  IGC::SHADER_CHANNEL GetFirstReadChannel(const unsigned int number) const;
  bool HasIndirectRegisterWrites(const unsigned int number) const;

  virtual void Compress(void);

  SIndexedTempDeclType GetIndexedTemporaryArrayDeclElement(const unsigned int index) const;

  unsigned int GetIndexedTemporaryArrayDeclSize(void) const;

  bool IsValid(void) const;

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderIndexedTemporaryArrayDecl(const unsigned int maxRegisters);
  virtual ~CShaderIndexedTemporaryArrayDecl(void);

  virtual ErrorCode Initialize(void);

  const SIndexedTempDeclType *GetDeclElement(const unsigned int number) const;
  void SetDeclElement(const unsigned int number, const SIndexedTempDeclType &decl);

  iSTD::CArray<SIndexedTempDeclType, IGC::CAllocator> *m_pIndexedTemporaryArrayDecl;

private:
  CShaderIndexedTemporaryArrayDecl(const CShaderIndexedTemporaryArrayDecl &);
  void operator=(const CShaderIndexedTemporaryArrayDecl &);
  bool m_HasCachedTemps;
};

/*****************************************************************************\

Class:
    CShaderInterfaceDecl

Description:

\*****************************************************************************/
class CShaderInterfaceDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderInterfaceDecl *&pShaderDecl);

  static void Delete(CShaderInterfaceDecl *&pShaderDecl);

  virtual void Compress(void);

  bool SetInterface(const unsigned int number, const unsigned int arraySize, const unsigned int numCallSites,
                    const unsigned int numFunctionTables, const unsigned int *&functionTables,
                    const unsigned int constantBufferOffset, SShaderInterfaceDeclType &iface);

  bool GetInterface(const unsigned int number, SShaderInterfaceDeclType &iface) const;

  SShaderInterfaceDeclType GetIfaceDeclElement(const unsigned int index) const;

  bool IsValid(void) const;

  // Throwing assertion failure and returning error, since we have to declare interface manually from CShader
  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderInterfaceDecl(const unsigned int maxRegisters);

  virtual ~CShaderInterfaceDecl(void);

  virtual ErrorCode Initialize(void);

  iSTD::CArray<SShaderInterfaceDeclType, IGC::CAllocator> *m_pIfaceDecls;
};

/*****************************************************************************\

Class:
    CShaderFunctionTableDecl

Description:

\*****************************************************************************/
class CShaderFunctionTableDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderFunctionTableDecl *&pShaderDecl);

  static void Delete(CShaderFunctionTableDecl *&pShaderDecl);

  virtual void Compress(void);

  bool SetFunctionTable(const unsigned int number, const unsigned int numFunctionBodies,
                        const unsigned int *pFunctionBodies);

  bool GetFunctionTable(const unsigned int number, SShaderFunctionTableDeclType &ftDecl) const;

  bool GetCallSite(const unsigned int ftID, const unsigned int fbID, unsigned int &callSite) const;

  bool GetCallOffsets(const unsigned int ftID, const unsigned int callSite, SVFuncCallOffsets &offsets) const;

  SShaderFunctionTableDeclType GetFunctionTablesElement(const unsigned int index) const;

  unsigned int GetFunctionTablesArraySize(void) const;

  bool IsValid(void) const;

  // Throwing assertion failure and returning error, since we have to declare interface manually from CShader
  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderFunctionTableDecl(const unsigned int maxRegisters);

  virtual ~CShaderFunctionTableDecl(void);

  virtual ErrorCode Initialize(void);
  virtual bool Resize(unsigned int number);

  iSTD::CArray<SShaderFunctionTableDeclType, IGC::CAllocator> *m_pFunctionTables;
};

/*****************************************************************************\

Class:
    CShaderFunctionBodyDecl

Description:

\*****************************************************************************/
class CShaderFunctionBodyDecl : public CShaderFiniteDecl {
public:
  static ErrorCode Create(const unsigned int maxRegisters, CShaderFunctionBodyDecl *&pShaderDecl);

  static void Delete(CShaderFunctionBodyDecl *&pShaderDecl);

  template <typename TOpType> ErrorCode Process(const CShaderDecl &src, unsigned char *&pStream, unsigned int &size);

protected:
  CShaderFunctionBodyDecl(const unsigned int maxRegisters);

  virtual ~CShaderFunctionBodyDecl(void);
};

} // namespace USC