attribute.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // Copyright (C) 2017 LunarG, Inc.
  3. // Copyright (C) 2018 Google, Inc.
  4. //
  5. // All rights reserved.
  6. //
  7. // Redistribution and use in source and binary forms, with or without
  8. // modification, are permitted provided that the following conditions
  9. // are met:
  10. //
  11. // Redistributions of source code must retain the above copyright
  12. // notice, this list of conditions and the following disclaimer.
  13. //
  14. // Redistributions in binary form must reproduce the above
  15. // copyright notice, this list of conditions and the following
  16. // disclaimer in the documentation and/or other materials provided
  17. // with the distribution.
  18. //
  19. // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
  20. // contributors may be used to endorse or promote products derived
  21. // from this software without specific prior written permission.
  22. //
  23. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  30. // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. // POSSIBILITY OF SUCH DAMAGE.
  35. //
  36. #ifndef _ATTRIBUTE_INCLUDED_
  37. #define _ATTRIBUTE_INCLUDED_
  38. #include "../Include/Common.h"
  39. #include "../Include/ConstantUnion.h"
  40. namespace glslang {
  41. enum TAttributeType {
  42. EatNone,
  43. EatAllow_uav_condition,
  44. EatBranch,
  45. EatCall,
  46. EatDomain,
  47. EatEarlyDepthStencil,
  48. EatFastOpt,
  49. EatFlatten,
  50. EatForceCase,
  51. EatInstance,
  52. EatMaxTessFactor,
  53. EatNumThreads,
  54. EatMaxVertexCount,
  55. EatOutputControlPoints,
  56. EatOutputTopology,
  57. EatPartitioning,
  58. EatPatchConstantFunc,
  59. EatPatchSize,
  60. EatUnroll,
  61. EatLoop,
  62. EatBinding,
  63. EatGlobalBinding,
  64. EatLocation,
  65. EatInputAttachment,
  66. EatBuiltIn,
  67. EatPushConstant,
  68. EatConstantId,
  69. EatDependencyInfinite,
  70. EatDependencyLength,
  71. EatMinIterations,
  72. EatMaxIterations,
  73. EatIterationMultiple,
  74. EatPeelCount,
  75. EatPartialCount,
  76. EatFormatRgba32f,
  77. EatFormatRgba16f,
  78. EatFormatR32f,
  79. EatFormatRgba8,
  80. EatFormatRgba8Snorm,
  81. EatFormatRg32f,
  82. EatFormatRg16f,
  83. EatFormatR11fG11fB10f,
  84. EatFormatR16f,
  85. EatFormatRgba16,
  86. EatFormatRgb10A2,
  87. EatFormatRg16,
  88. EatFormatRg8,
  89. EatFormatR16,
  90. EatFormatR8,
  91. EatFormatRgba16Snorm,
  92. EatFormatRg16Snorm,
  93. EatFormatRg8Snorm,
  94. EatFormatR16Snorm,
  95. EatFormatR8Snorm,
  96. EatFormatRgba32i,
  97. EatFormatRgba16i,
  98. EatFormatRgba8i,
  99. EatFormatR32i,
  100. EatFormatRg32i,
  101. EatFormatRg16i,
  102. EatFormatRg8i,
  103. EatFormatR16i,
  104. EatFormatR8i,
  105. EatFormatRgba32ui,
  106. EatFormatRgba16ui,
  107. EatFormatRgba8ui,
  108. EatFormatR32ui,
  109. EatFormatRgb10a2ui,
  110. EatFormatRg32ui,
  111. EatFormatRg16ui,
  112. EatFormatRg8ui,
  113. EatFormatR16ui,
  114. EatFormatR8ui,
  115. EatFormatUnknown,
  116. EatNonWritable,
  117. EatNonReadable
  118. };
  119. class TIntermAggregate;
  120. struct TAttributeArgs {
  121. TAttributeType name;
  122. const TIntermAggregate* args;
  123. // Obtain attribute as integer
  124. // Return false if it cannot be obtained
  125. bool getInt(int& value, int argNum = 0) const;
  126. // Obtain attribute as string, with optional to-lower transform
  127. // Return false if it cannot be obtained
  128. bool getString(TString& value, int argNum = 0, bool convertToLower = true) const;
  129. // How many arguments were provided to the attribute?
  130. int size() const;
  131. protected:
  132. const TConstUnion* getConstUnion(TBasicType basicType, int argNum) const;
  133. };
  134. typedef TList<TAttributeArgs> TAttributes;
  135. } // end namespace glslang
  136. #endif // _ATTRIBUTE_INCLUDED_